📄 rssfilter.php
字号:
Function beginsWith($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (strlen($value) > strlen($currentValue)) return FALSE; if ($matchCase) { if ((strncmp($currentValue, $value, strlen($value))) == 0) { return TRUE; } } else { if ((strncasecmp($currentValue, $value, strlen($value))) == 0) { return TRUE; } } return FALSE; } Function notBeginsWith($elementName, $value, $matchCase = 0) { return !$this->beginsWith($elementName, $value, $matchCase); } Function endsWith($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (strlen($value) > strlen($currentValue)) return FALSE; if ($matchCase) { if ((strncmp(substr($currentValue, -strlen($value)), $value, strlen($value))) == 0) { return TRUE; } } else { if ((strncasecmp(substr($currentValue, -strlen($value)), $value, strlen($value))) == 0) { return TRUE; } } return FALSE; } Function notEndsWith($elementName, $value, $matchCase = 0) { return !$this->endsWith($elementName, $value, $matchCase); } Function beforeTime($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ($currentValue < $timeValue) return TRUE; return FALSE; } Function afterTime($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ($currentValue > $timeValue) return TRUE; return FALSE; } Function beforeDate($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ((int)($currentValue/86400) < (int)($timeValue/86400)) return TRUE; return FALSE; } Function beforeOrOnDate($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ((int)($currentValue/86400) <= (int)($timeValue/86400)) return TRUE; return FALSE; } Function onDate($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ((int)($currentValue/86400) == (int)($timeValue/86400)) return TRUE; return FALSE; } Function afterDate($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ((int)($currentValue/86400) > (int)($timeValue/86400)) return TRUE; return FALSE; } Function afterOrOnDate($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if (($timeValue = strtotime($value)) === FALSE) return TRUE; if ((int)($currentValue/86400) >= (int)($timeValue/86400)) return TRUE; return FALSE; } Function isEmpty($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if ($currentValue == "") return TRUE; return FALSE; } Function notEmpty($elementName, $value, $matchCase = 0) { return !$this->isEmpty($elementName, $value, $matchCase); } Function alphaBefore($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if ($this->equal($currentValue, $value, $matchCase) === TRUE) return TRUE; $tempArray = Array($currentValue, $value); if ($matchCase) { natsort($tempArray); } else { natcasesort($tempArray); } $resultArray = array_values($tempArray); if ($resultArray[0] == $currentValue) return TRUE; return FALSE; } Function alphaAfter($elementName, $value, $matchCase = 0) { if (($currentValue = $this->getValueOf($elementName)) == NULL) return FALSE; if ($this->equal($currentValue, $value, $matchCase) === TRUE) return TRUE; $tempArray = Array($currentValue, $value); if ($matchCase) { natsort($tempArray); } else { natcasesort($tempArray); } $resultArray = array_values($tempArray); if ($resultArray[0] == $value) return TRUE; return FALSE; } }'); return $newClassName;}@include_once("FeedForAll_XMLParser.inc.php");if (!isset($XMLfilename)) { $XMLfilename = "http://www.FeedForAll.com/blog-feed.xml";}if (!isset($FilterScriptFilename)) { $FilterScriptFilename = "rssFilter_SampleScript.php";}if (isset($_REQUEST["SCRIPTFILE"])) { if (stristr($_REQUEST["SCRIPTFILE"], "file"."://")) { // Not allowed ; } elseif (stristr($_REQUEST["SCRIPTFILE"], "://")) { // Won't work ; } else { // It is local and must be in the same directory $FilterScriptFilename = basename($_REQUEST["SCRIPTFILE"]); }}if (isset($_REQUEST["testScript"])) { echo "<h2>Output of rssFilter.php in test mode</h2>\n"; $scriptValue = stripslashes($_POST["scriptValue"]); $result = eval(stripslashes($_POST["scriptValue"]));}if ($FilterScriptFilename != "DO_NOT_INCLUDE_SCRIPT") { ob_start(); @include_once($FilterScriptFilename); ob_end_clean();}if (isset($_REQUEST["buildScript"])) { // // Build config goes here $arrayCount = 0; if ($_REQUEST["buildScript"] != "") { ob_start(); @include_once($_REQUEST["buildScript"]); ob_end_clean(); $arrayCount = count($filterElements); for ($x = 0; $x < $arrayCount; $x++) { $_POST["filterName$x"] = $filterElements[$x]["Filter"]; $_POST["fieldName$x"] = $filterElements[$x]["Field"]; $_POST["fieldValue$x"] = htmlentities($filterElements[$x]["Value"]); $_POST["matchCase$x"] = $filterElements[$x]["MatchCase"]; } $_POST["XMLfilename"] = $XMLfilename; $_POST["useOutputCaching"] = $useOutputCaching; $_POST["outputCacheTTL"] = $outputCacheTTL; $_POST["matchType"] = $matchType; } if (!isset($_POST["XMLfilename"])) { $_POST["XMLfilename"] = "http://www.feedforall.com/blog-feed.xml"; } if (!isset($_POST["useOutputCaching"])) { $_POST["useOutputCaching"] = 0; } if (!isset($_POST["outputCacheTTL"])) { $_POST["outputCacheTTL"] = 3600; } if (!isset($_POST["matchType"])) { $_POST["matchType"] = "AND"; } if (isset($_POST["arrayCount"])) { $arrayCount = $_POST["arrayCount"]; } for ($x = 0; $x < $arrayCount+10; $x++) { if (!isset($_POST["matchCase$x"])) { $_POST["matchCase$x"] = 0; } } $itemParser = new baseItemClass(""); $arrayOfFields = $itemParser->getArrayOfFields(); $arrayOfFilters = $itemParser->getArrayOfFilters(); unset($itemParser); Function createFieldSelect($arrayOfFields, $name, $currentValue = "") { $count = count($arrayOfFields); $result = "<select name=\"$name\" size=\"1\">\n"; $result .= "<option value=\"\"></option>\n"; for ($x = 0; $x < $count; $x++) { $result .= "<option value=\"$arrayOfFields[$x]\""; if ($currentValue == $arrayOfFields[$x]) $result .= " SELECTED"; $result .= ">$arrayOfFields[$x]</option>\n"; } $result .= "</select>\n"; return $result; } Function createFilterSelect($arrayOfFilters, $name, $currentValue = "") { $count = count($arrayOfFilters); $result = "<select name=\"$name\" size=\"1\">\n"; $result .= "<option value=\"\">NOT USED</option>\n"; for ($x = 0; $x < $count; $x++) { $parts = split("//", $arrayOfFilters[$x]); $result .= "<option value=\"$parts[0]\""; if ($currentValue == $parts[0]) $result .= " SELECTED"; $result .= ">$parts[1]</option>\n"; } $result .= "</select>\n"; return $result; } if (!headers_sent()) { // Send the Content-Type to force UTF-8 header("Content-Type: text/html; charset=UTF-8"); } echo "<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"><title>rssFilter.php Configuration tool</title></head><body bgcolor=\"#EEEEFF\">\n"; if ($_SERVER["REQUEST_METHOD"] == "POST") { echo "Copy between the dividers below and save as the script file<br>\n"; echo "<br>================= Start of file =================\n"; $scriptString = ""; $scriptString .= "// The URL of the feed.\n"; $scriptString .= "\$XMLfilename = \"$_POST[XMLfilename]\";\n\n"; $scriptString .= "\$outputCacheTTL = $_POST[outputCacheTTL];\n"; $scriptString .= "\$useOutputCaching = $_POST[useOutputCaching];\n"; $scriptString .= "//\n"; $scriptString .= "// The function that decides if the current item will be used.\n"; $scriptString .= "// return TRUE to use the itme, FALSE to not\n"; $scriptString .= "if (!isset(\$_REQUEST[\"buildScript\"])) {\n"; $scriptString .= " Function rssFilter_useItem(\$currentItem) {\n"; $scriptString .= " // the default fall through is to use the item\n"; $scriptString .= " if (<><><>filterProgram<><>) {\n"; $scriptString .= " return TRUE;\n"; $scriptString .= " }\n"; $scriptString .= " return FALSE;\n"; $scriptString .= " }\n"; $scriptString .= "}\n"; $scriptString .= "\n"; $scriptString .= "//\n"; $scriptString .= "// Since we are calling rssFilter.php from here, we don't want\n"; $scriptString .= "// to include a separate script file.\n"; $scriptString .= "\$FilterScriptFilename = \"DO_NOT_INCLUDE_SCRIPT\";\n"; $scriptString .= "if (!isset(\$_REQUEST[\"buildScript\"])) {\n"; $scriptString .= " @include_once(\"rssFilter.php\");\n"; $scriptString .= "}\n"; $scriptString .= "\n"; $scriptString .= "\$matchType = \"$_POST[matchType]\";\n"; $scriptString .= "\$filterElements = Array(\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -