public function releaseInfo()
{
if (empty($this->release_info)) {
$page = $this->getPage("ReleaseInfo");
if (empty($page)) {
return array();
}
// no such page
$tag_s = strpos($this->page["ReleaseInfo"], '<th class="xxxx">Country</th><th class="xxxx">Date</th>');
$tag_e = strpos($this->page["ReleaseInfo"], '</table', $tag_s);
$block = substr($this->page["ReleaseInfo"], $tag_s, $tag_e - $tag_s);
preg_match_all('!<tr[^>]*>\\s*<td><a[^>]*>(.*?)</a></td>\\s*<td[^>]*>(.*?)</td>\\s*<td>(.*?)</td>!ims', $block, $matches);
$mc = count($matches[0]);
for ($i = 0; $i < $mc; ++$i) {
$country = strip_tags($matches[1][$i]);
if (preg_match('!href="/date/(\\d{2})-(\\d{2})/">\\d+ (.*?)</a>\\s*<a href="/year/(\\d{4})/">!is', $matches[2][$i], $match)) {
// full info
$this->release_info[] = array('country' => $country, 'day' => $match[2], 'month' => $match[3], 'mon' => $match[1], 'year' => $match[4], 'comment' => $matches[3][$i]);
} elseif (preg_match('!(\\d{1,2})\\s*(.+?)<a href="/year/(\\d{4})/.+?"\\s*>!is', $matches[2][$i], $match)) {
// full info v2
$this->release_info[] = array('country' => $country, 'day' => $match[1], 'month' => trim($match[2]), 'mon' => $this->monthNo(trim($match[2])), 'year' => $match[3], 'comment' => $matches[3][$i]);
} elseif (!preg_match('|a href=|i', $matches[2][$i], $match)) {
// no links within
if (preg_match('!^(.+?)\\s(\\d{4})$!s', trim($matches[2][$i]), $match)) {
// month and year
$this->release_info[] = array('country' => $country, 'day' => '', 'month' => $match[1], 'mon' => $this->monthNo(trim($match[1])), 'year' => $match[2], 'comment' => $matches[3][$i]);
} elseif (preg_match('!(\\d{4})!', trim($matches[2][$i]), $match)) {
// year at least
$this->release_info[] = array('country' => $country, 'day' => '', 'month' => '', 'mon' => '', 'year' => $match[1], 'comment' => $matches[3][$i]);
}
} else {
$this->debug_scalar("NO MATCH ON<pre>" . htmlentities($matches[2][$i]) . "</pre>");
}
}
}
return $this->release_info;
}