📄 simplepie.php
字号:
* @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_parser_class($class = 'SimplePie_Parser') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Parser')) { $this->parser_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for remote file fetching. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_file_class($class = 'SimplePie_File') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_File')) { $this->file_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for data sanitization. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_sanitize_class($class = 'SimplePie_Sanitize') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Sanitize')) { $this->sanitize =& new $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for handling feed items. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_item_class($class = 'SimplePie_Item') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Item')) { $this->item_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for handling author data. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_author_class($class = 'SimplePie_Author') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Author')) { $this->author_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for handling category data. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_category_class($class = 'SimplePie_Category') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Category')) { $this->category_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for feed enclosures. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_enclosure_class($class = 'SimplePie_Enclosure') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Enclosure')) { $this->enclosure_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for <media:text> captions * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_caption_class($class = 'SimplePie_Caption') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Caption')) { $this->caption_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for <media:copyright> * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_copyright_class($class = 'SimplePie_Copyright') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Copyright')) { $this->copyright_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for <media:credit> * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_credit_class($class = 'SimplePie_Credit') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Credit')) { $this->credit_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for <media:rating> * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_rating_class($class = 'SimplePie_Rating') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Rating')) { $this->rating_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for <media:restriction> * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class. * @link http://php.net/manual/en/keyword.extends.php PHP4 extends documentation * @link http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation */ function set_restriction_class($class = 'SimplePie_Restriction') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Restriction')) { $this->restriction_class = $class; return true; } return false; } /** * Allows you to override the default user agent string. * * @access public * @param string $ua New user agent string. */ function set_useragent($ua = SIMPLEPIE_USERAGENT) { $this->useragent = (string) $ua; } /** * Set callback function to create cache filename with * * @access public * @param mixed $function Callback function */ function set_cache_name_function($function = 'md5') { if (is_callable($function)) { $this->cache_name_function = $function; } } /** * Set javascript query string parameter * * @access public * @param mixed $get Javascript query string parameter */ function set_javascript($get = 'js') { if ($get) { $this->javascript = (string) $get; } else { $this->javascript = false; } } /** * Set options to make SP as fast as possible. Forgoes a * substantial amount of data sanitization in favor of speed. * * @access public * @param bool $set Whether to set them or not */ function set_stupidly_fast($set = false) { if ($set) { $this->enable_order_by_date(false); $this->remove_div(false); $this->strip_comments(false); $this->strip_htmltags(false); $this->strip_attributes(false); $this->set_image_handler(false); } } /** * Set maximum number of feeds to check with autodiscovery * * @access public * @param int $max Maximum number of feeds to check */ function set_max_checked_feeds($max = 10) { $this->max_checked_feeds = (int) $max; } function remove_div($enable = true) { $this->sanitize->remove_div($enable); } function strip_htmltags($tags = '', $encode = null) { if ($tags === '') { $tags = $this->strip_htmltags; } $this->sanitize->strip_htmltags($tags); if ($encode !== null) { $this->sanitize->encode_instead_of_strip($tags); } } function encode_instead_of_strip($enable = true) { $this->sanitize->encode_instead_of_strip($enable); } function strip_attributes($attribs = '') { if ($attribs === '') { $attribs = $this->strip_attributes; } $this->sanitize->strip_attributes($attribs); } function set_output_encoding($encoding = 'UTF-8') { $this->sanitize->set_output_encoding($encoding); } function strip_comments($strip = false) { $this->sanitize->strip_comments($strip); } /** * Set element/attribute key/value pairs of HTML attributes * containing URLs that need to be resolved relative to the feed * * @access public * @since 1.0 * @param array $element_attribute Element/attribute key/value pairs */ function set_url_replacements($element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'), 'input' => 'src', 'ins' => 'cite', 'q' => 'cite')) { $this->sanitize->set_url_replacements($element_attribute); } /** * Set the handler to enable the display of cached favicons. * * @access public * @param str $page Web-accessible path to the handler_favicon.php file. * @param str $qs The query string that the value should be passed to. */ function set_favicon_handler($page = false, $qs = 'i') { if ($page != false) { $this->favicon_handler = $page . '?' . $qs . '='; } else { $this->favicon_handler = ''; } } /** * Set the handler to enable the display of cached images. * * @access public * @param str $page Web-accessible path to the handler_image.php file. * @param str $qs The query string that the value should be passed to. */ function set_image_handler($page = false, $qs = 'i') { if ($page != false) { $this->sanitize->set_image_handler($page . '?' . $qs . '='); } else { $this->image_handler = ''; } } function init() { if ((function_exists('version_compare') && version_compare(PHP_VERSION, '4.1.0', '<')) || !extension_loaded('xml') || !extension_loaded('pcre')) { return false; } if (isset($_GET[$this->javascript])) { if (function_exists('ob_gzhandler')) { ob_start('ob_gzhandler'); } header('Content-type: text/javascript; charset: UTF-8'); header('Cache-Control: must-revalidate'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 604800) . ' GMT'); // 7 days ?>function embed_odeo(link) { document.writeln('<embed src="http://odeo.com/flash/audio_player_fullsize.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="440" height="80" wmode="transparent" allowScriptAccess="any" flashvars="valid_sample_rate=true&external_url='+link+'"></embed>');}function embed_quicktime(type, bgcolor, width, height, link, placeholder, loop) { if (placeholder != '') { document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" href="'+link+'" src="'+placeholder+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="false" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); } else { document.writeln('<embed type="'+type+'" style="cursor:hand; cursor:pointer;" src="'+link+'" width="'+width+'" height="'+height+'" autoplay="false" target="myself" controller="true" loop="'+loop+'" scale="aspect" bgcolor="'+bgcolor+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>'); }}function embed_flash(bgcolor, width, height, link, loop, type) { document.writeln('<embed src="'+link+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="'+type+'" quality="high" width="'+width+'" height="'+height+'" bgcolor="'+bgcolor+'" loop="'+loop+'"></embed>');}function embed_flv(width, height, link, placeholder, loop, player) { document.writeln('<embed src="'+player+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="high" width="'+width+'" height="'+height+'" wmode="transparent" flashvars="file='+link+'&autostart=false&repeat='+loop+'&showdigits=true&showfsbutton=false"></embed>');}function embed_wmedia(width, height, link) { document.writeln('<embed type="application/x-mplayer2" src="'+link+'" autosize="1" width="'+width+'" height="'+height+'" showcontrols="1" showstatusbar="0" showdisplay="0" autostart="0"></embed>');} <?php exit; } // Pass whatever was set with config options over to the sanitizer. $this->sanitize->pass_cache_data($this->cache, $this->cache_location, $this->cache_name_function, $this->cache_class); $this->sanitize->pass_file_data($this->file_class, $this->timeout, $this->useragent, $this->force_fsockopen); if ($this->feed_url !== null || $this->raw_data !== null) { $this->data = array(); $this->multifeed_objects = array(); $cache = false; if ($this->feed_url !== null) { $parsed_feed_url = SimplePie_Misc::parse_url($this->feed_url); // Decide whether to enable caching if ($this->cache && $parsed_feed_url['scheme'] !== '') { $cache =& new $this->cache_class($this->cache_location, call_user_func($this->cache_name_function, $this->feed_url), 'spc'); } // If it's enabled and we don't want an XML dump, use the cache if ($cache && !$this->xml_dump) { // Load the Cache $this->data = $cache->load(); if (!empty($this->data)) { // If the cache is for an outdated build of SimplePie if (!isset($this->data['build']) || $this->data['build'] != SIMPLEPIE_BUILD) { $cache->unlink(); $this->data = array(); } // If we've hit a collision just rerun it with caching disabled elseif (isset($this->data['url']) && $this->data['url'] != $this->feed_url) { $cache = false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -