public static function OnRSSFetched($prm) { $mngr = new rRSSManager(); $rules = rURLRewriteRulesList::load($mngr); $newHrefs = array(); foreach ($prm["rss"]->items as $href => &$item) { $oldHref = $href; $rules->apply($prm["rss"], $mngr->groups, $href, $item['guid']); if ($oldHref != $href) { $newHrefs[$href] = $item; unset($prm["rss"]->items[$oldHref]); } } if (count($newHrefs)) { $prm["rss"]->items = array_merge($prm["rss"]->items, $newHrefs); } }
<?php require_once 'rules.php'; if (isset($_REQUEST['mode'])) { $cmd = $_REQUEST['mode']; } $mngr = rURLRewriteRulesList::load(); $val = null; switch ($cmd) { case "checkrule": $rule = new rURLRewriteRule('test', trim($_REQUEST['pattern']), trim($_REQUEST['replacement'])); $href = trim($_REQUEST['test']); $rslt = $rule->apply($href, $href); $val = array("msg" => $rslt); break; case "setrules": $mngr->set(); break; } if (is_null($val)) { $val = $mngr->getContents(); } cachedEcho(json_encode($val), "application/json", true);