⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rssfilter.php

📁 for news RSS to HTML as ASP
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php//// rssFilter.php Filter RSS feeds//// Copyright 2007 NotePage, Inc.// http://www.feedforall.com//// NotePage, Inc. grants registerd users of our FeedForAll and/or// FeedForAll Mac product(s) the right to install and use the// rssFilter.php script free of charge.// Please refer to the EULA included in the download for full license// terms and conditions.//// $Id: rssFilter.php,v 3.3 2007/04/27 17:32:12 housley Exp $//// $Log: rssFilter.php,v $// Revision 3.3  2007/04/27 17:32:12  housley// Some versions of PHP, on windows at least, want the rssFilter_useItem() // function before the include in the script.//// Revision 3.2  2007/04/26 23:40:40  housley// * Properly read "matchType" from a configuration file// * Add UTF-8 characterset to the buildScript pages//// Revision 3.1  2007/04/24 18:29:55  housley// Parse the iTunes Music Store namespace//// Revision 3.0  2007/04/16 14:23:04  housley// Release version 3.0 of the scripts//// Revision 1.25  2007/04/11 18:38:08  housley// Update the user agent to be 3.0//// Revision 1.24  2007/04/09 01:25:50  housley// Fix the commented out code for enabling the extensions//// Revision 1.23  2007/04/06 11:08:58  housley// Add support for the Dublin Core (dc) namespace//// Revision 1.22  2007/04/04 20:55:46  housley// Add the ability to set CURLOPT_CONNECTTIMEOUT//// Revision 1.21  2007/04/04 14:53:27  housley// * Remove the ...OrOnTime compares because of TZ they are too hard// * Move the BeforeTime/AfterTime to the bottom to encourage ...Date compares//// Revision 1.20  2007/03/31 12:29:42  housley// When working with an existing script, don't define the useItem() function//// Revision 1.19  2007/03/31 12:28:41  housley// Add filters that include the current time/date//// Revision 1.18  2007/03/30 01:34:12  housley// Move the very specific rssFilter code to rssFilter.php//// Revision 1.17  2007/03/27 23:16:31  housley// Add support for Atom 1.0 atom:updated date field//// Revision 1.16  2007/03/26 20:51:48  housley// Create a method to update the channel level date to the most recent// item date//// Revision 1.15  2007/03/14 18:15:39  housley// Get the top and bottom properly for Atom and RDF feeds//// Revision 1.14  2007/03/12 23:25:48  housley// Set the caching variable when no script is defined//// Revision 1.13  2007/03/07 03:01:22  housley// Add the flag to not parse TrackBack//// Revision 1.12  2007/03/07 00:22:26  housley// Change the order of the filter builder fields, to make the operation// easier to understand//// Revision 1.11  2007/03/06 14:27:41  housley// Fix typo that prevented any output with a valid cache//// Revision 1.9  2007/03/05 21:13:11  housley// * Add support for working with pubDate as a date or time// * Show which items will and won't be used//// Revision 1.8  2007/03/05 18:23:58  housley// Don't abort processing on XML parse error, just don't do anything else//// Revision 1.7  2007/03/05 17:29:46  housley// Add a simple way to block parsing extensions//// Revision 1.6  2007/03/05 17:28:54  housley// Remove some config variables that aren't used//// Revision 1.5  2007/03/05 15:10:33  housley// Allow testing of the current script//// Revision 1.4  2007/03/05 01:19:45  housley// Rename FeedForAll_rss2html_readFile() to FeedForAll_scripts_readFile()//// Revision 1.3  2007/03/05 01:12:16  housley// Move FeedForAll_scripts_convertEncoding and FeedForAll_scripts_readFile// into FeedForAll_XMLParser.inc.php, because they are used in every file//// Revision 1.2  2007/03/05 00:43:49  housley// Allow the setting the type of joining of the statements//// Revision 1.1  2007/03/04 22:54:30  housley// Program to filter rss feeds////////// ==========================================================================// Configuration options// ==========================================================================//// Set the following variable useFopenURL to one if you want/need to use// fopen() instead of CURLif (!isset($useFopenURL)) {  $useFopenURL = 0;}//// Destination Encoding:  By default rssFilter.php converts all feeds to UTF-8// and then produces webpages in UTF-8 because UTF-8 is capable of displaying// all possible characters.if (!isset($destinationEncoding)) {  $destinationEncoding = "UTF-8";}//// Missing Encoding Default:  Some feeds do not specify the character set // they are encoded in.  The XML specification states that if there is no// encoding specified the XML file, all RSS feeds are XML, must be encoded// in UTF-8, but experience has show differently.  This specifies the // encoding that will be used for feeds that don't specify the encoding.//$missingEncodingDefault = "UTF-8";if (!isset($missingEncodingDefault)) {  $missingEncodingDefault = "ISO-8859-1";}//// Enable the caching for the resulting XML file.  Since it may take time to // process multiple RSS feeds and may be noticed by visitors to your// website this is highly recommended.  During development and testing set // this to 0 so you can see the results of your changes.if (!isset($useOutputCaching)) {  $useOutputCaching = 0;}//// The variable $outputCacheTTL controls how many seconds a cached copy of// resulting RSS feed can be used before it must be recreated.if (!isset($outputCacheTTL)) {  // $outputCacheTTL = 60;      //cache files for 1 minute  $outputCacheTTL = 3600;    //cache files for 1 hour  // $outputCacheTTL = 86400;   //cache files for 1 day}//// The variable $outputCacheFolder specifies the name of the directory, relative to// the location of rssFilter.php, where the cached files are stored.  It not// recommened you change this with out a very good reason.if (!isset($outputCacheFolder)) {  $outputCacheFolder = "rssFilterCacheFiles";}//// $connectTimeoutLimit allows the limiting the amount of time cURL will// wait to successfully connect to a remote server.  Use with caution,// a value too small will cause all connections to fail.//$connectTimeoutLimit = 30;//// To prevent parsing of the iTunes(R) XML namespace extension, uncomment the// following line.//$Dont_Parse_iTunes == TRUE;//// To prevent parsing of the TrackBack XML namespace extension, uncomment the// following line.//$Dont_Parse_TrackBack == TRUE;//// To prevent parsing of the DublinCore XML namespace extension, uncomment the// following line.//$Dont_Parse_DublinCore == TRUE;//// To prevent parsing of the ITMS XML namespace extension, uncomment the// following line.//$Dont_Parse_ITMS == TRUE;  // ==========================================================================// Below this point of the file there are no user editable options.  Your// are welcome to make any modifications that you wish to any of the code// below, but that is not necessary for normal use.// ==========================================================================//// If using cURL, make sure it existsif (($useFopenURL == 0) && !function_exists("curl_init")) {  $useFopenURL = 1;}if ($useFopenURL) {  ini_set("allow_url_fopen", "1");  ini_set("user_agent", 'FeedForAll rssFilter.php v3');}// Since the output is cached it is not recommended to cache the XML in input$allowCachingXMLFiles = 0;@include_once("FeedForAll_Scripts_CachingExtension.php");//// Read in the configuration file$config = Array();@include_once("FeedForAll_parse_Extensions.inc.php");if (function_exists("FeedForAll_parseExtensions") === FALSE) {  Function FeedForAll_parseExtensions() {    return FALSE;  }}Function rssFilter_extendClass($className) {  $newClassName = $className."_rssFilter";  eval('class ' . $newClassName . ' extends ' . $className . ' {    Function getArrayOfFilters() {      $result = Array();        $result[] = "contains//Conatins";      $result[] = "notContains//Does not contain";      $result[] = "equal//Equal with";      $result[] = "notEqual//Not equal with";      $result[] = "beginsWith//Begins with";      $result[] = "notBeginsWith//Does not begin with";      $result[] = "endsWith//Ends with";      $result[] = "notEndsWith//Does not end with";      $result[] = "isEmpty//Is Empty";      $result[] = "notEmpty//Is Not Empty";      $result[] = "alphaBefore//Alphabetically Before";      $result[] = "alphaAfter//Alphabetically After";      $result[] = "beforeDate//Before Date";      $result[] = "beforeOrOnDate//Before or On Date";      $result[] = "onDate//On Date";      $result[] = "afterDate//After Date";      $result[] = "afterOrOnDate//After or On Date";      $result[] = "beforeTime//Before Time";      $result[] = "afterTime//After Time";            return $result;    }        Function contains($elementName, $value, $matchCase = 0) {      if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE;        if ($matchCase) {        if ((strstr($currentValue, $value)) !== FALSE) {          return TRUE;        }      } else {        if ((stristr($currentValue, $value)) !== FALSE) {          return TRUE;        }      }      return FALSE;    }      Function notContains($elementName, $value, $matchCase = 0) {      return !$this->contains($elementName, $value, $matchCase);    }        Function equal($elementName, $value, $matchCase = 0) {      if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE;        if ($matchCase) {        if ((strcmp($currentValue, $value)) == 0) {          return TRUE;        }      } else {        if ((strcasecmp($currentValue, $value)) == 0) {          return TRUE;        }      }      return FALSE;    }      Function notEqual($elementName, $value, $matchCase = 0) {      return !$this->equal($elementName, $value, $matchCase);    }    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -