start(); $timer->setMarker('Starting up.'); # $profiling = $timer->getProfiling(); // get the profil */ // Set up for logging. require_once 'Log.php'; if (!defined('LOG_PATH')) { define('LOG_PATH', '../logs'); } global $log; $log = &Log::singleton('file', LOG_PATH.'/feedmagick-debug-'.date('Ymd', time()).'.log', 'main'); $log->info(basename($_SERVER['SCRIPT_FILENAME'])." starting up..."); require_once 'HTTPCache.php'; function xmlentities ($string) { return str_replace ( array ( '&', '"', "'", '<', '>' ), array ( '&' , '"', ''' , '<' , '>' ), $string ); } function echox($str) { echo xmlentities($str); } function endsWith( $str, $sub ) { return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub ); } function processFilter(&$filter) { $filters = array($filter); return processFilters($filters); } function processFilters(&$filters) { if (!array_key_exists('in', $_GET)) { presentParamsForm($filters); } else { // Use the HTTP cache to grab the incoming data. $in_url = $_GET['in']; $cache =& new HTTPCache($in_url); $data = $cache->fetch(); // Feed the data through each of the filters. foreach ($filters as $filter) { $filter_class = get_class($filter); $data = $filter->filterFeedData($data); } // Send an XML content type header if no headers yet sent. if (!headers_sent()) { // TODO: Send off an application/rss+xml header? header('Content-type: text/xml; charset=utf-8', true); } echo $data; } } function presentParamsForm(&$filters) { $form_url = $_SERVER['PHP_SELF']; ?>