cvs: php-master-web /scripts rss_parser

From: Date: Fri, 15 Aug 2003 15:23:33 +0000
Subject: cvs: php-master-web /scripts rss_parser
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-20380@lists.php.net to get a copy of this message
goba Fri Aug 15 11:23:33 2003 EDT Modified files: /php-master-web/scripts rss_parser Log: Proper end of news list detection and beautify output (trim leading and trailing space, and collapse spaces) Index: php-master-web/scripts/rss_parser diff -u php-master-web/scripts/rss_parser:1.8 php-master-web/scripts/rss_parser:1.9 --- php-master-web/scripts/rss_parser:1.8 Thu Aug 14 07:21:49 2003 +++ php-master-web/scripts/rss_parser Fri Aug 15 11:23:33 2003 @@ -56,8 +56,9 @@ $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); - // Return with the content HTML stripped - return strip_tags($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 @@ -99,7 +100,7 @@ #DEBUG# print "<p>Info: New Headline: $headlineid<br />"; // End of headlines reached - } elseif (preg_match('/<a href="\/news.php">Old News<\/a>/', $line)) { + } elseif (strpos($line, '<a href="/news-2003.php">News Archive</a>')) { array_pop($headlines); break;

« previous php.mirrors (#20380) next »