public function locations()
{
if (empty($this->locations)) {
$page = $this->getPage("Locations");
if (empty($page)) {
return array();
}
// no such page
$tag_s = strpos($this->page['Locations'], '<div id="tn15adrhs">');
$tag_e = strpos($this->page['Locations'], '</dl>');
$block = substr($this->page['Locations'], $tag_s, $tag_e - $tag_s);
$block = substr($block, strpos($block, '<dl>'));
if (preg_match_all('!<dt>(<a href="(.*?)">|)(.*?)(</a>|</dt>)!ims', $block, $matches)) {
for ($i = 0; $i < count($matches[0]); ++$i) {
$this->locations[] = array('name' => $matches[3][$i], 'url' => $matches[2][$i]);
}
}
}
return $this->locations;
}