/', $text, $matches)) { $link = "#" .$matches[1]; } elseif (preg_match('/<\?php\s+print_link\s*\("([^"]+)",\s*"[^"]+"\);\s*\?>/', $text, $matches)) { $link = $matches[1]; } elseif (preg_match('/<\?php\s+print_link\s*\(\'([^\']+)\',\s*\'[^\']+\'\);\s*\?>/', $text, $matches)) { $link = $matches[1]; } elseif (preg_match('/<\?php\s+print_link\s*\("([^"]+)",\s*make_image\s*\([^\)]*\)\s*\);\s*\?>/', $text, $matches)) { $link = $matches[1]; } elseif (preg_match('//', $text, $matches)) { $link = $matches[1]; } // Make sure it is a full URL if (!preg_match('/^http:/', $link)) { $rootLink = rtrim($rootLink, "/"); $link = ($link[0] != '/') ? "$rootLink/$link" : "$rootLink$link"; } return $link; } // Preserve parts in the text needed and drop out everything unsusable function ProcessText($text) { // Delete images, since this data will go through XML $text = preg_replace('/<\?php\s+echo\s+make_image\s*\("([^"]*)",\s*"([^"]*)",\s+"([^"]*)"\);\s*\?>/i', " ", $text); // Replace the links with links (use this or the one below) /* $text = preg_replace('/<\?php\s+print_link\s*\("([^"]+)",\s*"([^"]+)"\);\s*\?>/', "$2", $text); // /', "$2", $text); $text = preg_replace('/<\?php\s+print_link\s*\("([^"]+)",\s*make_image\s*\([^\)]*\)\s*\);\s*\?>/', "", $text); */ // Remove the hyperlink references (use this or the one above) $text = preg_replace('/<\?php\s+print_link\s*\("([^"]+)",\s*"([^"]+)"\);\s*\?>/', "$2", $text); $text = preg_replace('/<\?php\s+print_link\s*\(\'([^\']+)\',\s*\'([^\']+)\'\);\s*\?>/', "$2", $text); $text = preg_replace('/<\?php\s+print_link\s*\("([^"]+)",\s*make_image\s*\([^\)]*\)\s*\);\s*\?>/', "", $text); // Drop HTML, trim string and drop multiple spaces $text = trim(strip_tags($text)); return preg_replace("!\\s+!", " ", $text); } // Parse the index file searching for news item information function ParseNews ($index_page = "", $aboutLink) { // Remove commented items //$index_page = preg_replace("//", "", $index_page); // Split the file by newlines $lines = preg_split("/\n/", $index_page); #DEBUG# print "
"; print_r($lines); print ""; // Define month conversion hash $mos = [ "Jan" => 1, "Feb" => 2, "Mar" => 3, "Apr" => 4, "May" => 5, "Jun" => 6, "Jul" => 7, "Aug" => 8, "Sep" => 9, "Oct" => 10, "Nov" => 11, "Dec" => 12 ]; // We have not started to parse the // news and we have no headlines right here $news_started = FALSE; $headlineid = 0; // Try to classify every line backed with state information // and patterns to recognize for news item elements foreach ($lines as $i => $line) { // We are not in a news item if (!$news_started) { // If we found theis comment, then we are at the right place if (strpos($line, "DO NOT REMOVE THIS COMMENT")) { $news_started = TRUE; } else { continue; } // We are in a news item } elseif ($news_started) { // Headline separator reached if (preg_match('!
Info: New Headline: $headlineid
";
// End of headlines reached
} elseif (preg_match('@News Archive@', $line) || strpos($line, "// NO MORE NEWS TO PARSE") === 0) {
array_pop($headlines);
break;
// The headline title is in