?? simplepie.php
字號:
* @access private */ var $autodiscovery = SIMPLEPIE_LOCATOR_ALL; /** * @var string Class used for caching feeds * @see SimplePie::set_cache_class() * @access private */ var $cache_class = 'SimplePie_Cache'; /** * @var string Class used for locating feeds * @see SimplePie::set_locator_class() * @access private */ var $locator_class = 'SimplePie_Locator'; /** * @var string Class used for parsing feeds * @see SimplePie::set_parser_class() * @access private */ var $parser_class = 'SimplePie_Parser'; /** * @var string Class used for fetching feeds * @see SimplePie::set_file_class() * @access private */ var $file_class = 'SimplePie_File'; /** * @var string Class used for items * @see SimplePie::set_item_class() * @access private */ var $item_class = 'SimplePie_Item'; /** * @var string Class used for authors * @see SimplePie::set_author_class() * @access private */ var $author_class = 'SimplePie_Author'; /** * @var string Class used for categories * @see SimplePie::set_category_class() * @access private */ var $category_class = 'SimplePie_Category'; /** * @var string Class used for enclosures * @see SimplePie::set_enclosures_class() * @access private */ var $enclosure_class = 'SimplePie_Enclosure'; /** * @var string Class used for Media RSS <media:text> captions * @see SimplePie::set_caption_class() * @access private */ var $caption_class = 'SimplePie_Caption'; /** * @var string Class used for Media RSS <media:copyright> * @see SimplePie::set_copyright_class() * @access private */ var $copyright_class = 'SimplePie_Copyright'; /** * @var string Class used for Media RSS <media:credit> * @see SimplePie::set_credit_class() * @access private */ var $credit_class = 'SimplePie_Credit'; /** * @var string Class used for Media RSS <media:rating> * @see SimplePie::set_rating_class() * @access private */ var $rating_class = 'SimplePie_Rating'; /** * @var string Class used for Media RSS <media:restriction> * @see SimplePie::set_restriction_class() * @access private */ var $restriction_class = 'SimplePie_Restriction'; /** * @var mixed Set javascript query string parameter (false, or * anything type-cast to false, disables this feature) * @see SimplePie::set_javascript() * @access private */ var $javascript = 'js'; /** * @var int Maximum number of feeds to check with autodiscovery * @see SimplePie::set_max_checked_feeds() * @access private */ var $max_checked_feeds = 10; /** * @var string Web-accessible path to the handler_favicon.php file. * @see SimplePie::set_favicon_handler() * @access private */ var $favicon_handler = ''; /** * @var string Web-accessible path to the handler_image.php file. * @see SimplePie::set_image_handler() * @access private */ var $image_handler = ''; /** * @var array Stores the URLs when multiple feeds are being initialized. * @see SimplePie::set_feed_url() * @access private */ var $multifeed_url = array(); /** * @var array Stores SimplePie objects when multiple feeds initialized. * @access private */ var $multifeed_objects = array(); /** * @var array Stores the get_object_vars() array for use with multifeeds. * @see SimplePie::set_feed_url() * @access private */ var $config_settings = null; /** * @var array Stores the default attributes to be stripped by strip_attributes(). * @see SimplePie::strip_attributes() * @access private */ var $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc'); /** * @var array Stores the default tags to be stripped by strip_htmltags(). * @see SimplePie::strip_htmltags() * @access private */ var $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style'); /** * The SimplePie class contains feed level data and options * * There are two ways that you can create a new SimplePie object. The first * is by passing a feed URL as a parameter to the SimplePie constructor * (as well as optionally setting the cache location and cache expiry). This * will initialise the whole feed with all of the default settings, and you * can begin accessing methods and properties immediately. * * The second way is to create the SimplePie object with no parameters * at all. This will enable you to set configuration options. After setting * them, you must initialise the feed using $feed->init(). At that point the * object's methods and properties will be available to you. This format is * what is used throughout this documentation. * * @access public * @since 1.0 Preview Release * @param string $feed_url This is the URL you want to parse. * @param string $cache_location This is where you want the cache to be stored. * @param int $cache_duration This is the number of seconds that you want to store the cache file for. */ function SimplePie($feed_url = null, $cache_location = null, $cache_duration = null) { // Other objects, instances created here so we can set options on them $this->sanitize =& new SimplePie_Sanitize; // Set options if they're passed to the constructor if ($cache_location !== null) { $this->set_cache_location($cache_location); } if ($cache_duration !== null) { $this->set_cache_duration($cache_duration); } // Only init the script if we're passed a feed URL if ($feed_url !== null) { $this->set_feed_url($feed_url); $this->init(); } } /** * Used for converting object to a string */ function __toString() { return md5(serialize($this->data)); } /** * This is the URL of the feed you want to parse. * * This allows you to enter the URL of the feed you want to parse, or the * website you want to try to use auto-discovery on. This takes priority * over any set raw data. * * You can set multiple feeds to mash together by passing an array instead * of a string for the $url. Remember that with each additional feed comes * additional processing and resources. * * @access public * @since 1.0 Preview Release * @param mixed $url This is the URL (or array of URLs) that you want to parse. * @see SimplePie::set_raw_data() */ function set_feed_url($url) { if (is_array($url)) { $this->multifeed_url = array(); foreach ($url as $value) { $this->multifeed_url[] = SimplePie_Misc::fix_protocol($value, 1); } } else { $this->feed_url = SimplePie_Misc::fix_protocol($url, 1); } } /** * Provides an instance of SimplePie_File to use as a feed * * @access public * @param object &$file Instance of SimplePie_File (or subclass) * @return bool True on success, false on failure */ function set_file(&$file) { if (SimplePie_Misc::is_a($file, 'SimplePie_File')) { $this->feed_url = $file->url; $this->file =& $file; return true; } return false; } /** * Allows you to use a string of RSS/Atom data instead of a remote feed. * * If you have a feed available as a string in PHP, you can tell SimplePie * to parse that data string instead of a remote feed. Any set feed URL * takes precedence. * * @access public * @since 1.0 Beta 3 * @param string $data RSS or Atom data as a string. * @see SimplePie::set_feed_url() */ function set_raw_data($data) { $this->raw_data = trim($data); } /** * Allows you to override the default timeout for fetching remote feeds. * * This allows you to change the maximum time the feed's server to respond * and send the feed back. * * @access public * @since 1.0 Beta 3 * @param int $timeout The maximum number of seconds to spend waiting to retrieve a feed. */ function set_timeout($timeout = 10) { $this->timeout = (int) $timeout; } /** * Forces SimplePie to use fsockopen() instead of the preferred cURL * functions. * * @access public * @since 1.0 Beta 3 * @param bool $enable Force fsockopen() to be used */ function force_fsockopen($enable = false) { $this->force_fsockopen = (bool) $enable; } /** * Outputs the raw XML content of the feed, after it has gone through * SimplePie's filters. * * Used only for debugging, this function will output the XML content as * text/xml. When SimplePie reads in a feed, it does a bit of cleaning up * before trying to parse it. Many parts of the feed are re-written in * memory, and in the end, you have a parsable feed. XML dump shows you the * actual XML that SimplePie tries to parse, which may or may not be very * different from the original feed. * * @access public * @since 1.0 Preview Release * @param bool $enable Enable XML dump */ function enable_xml_dump($enable = false) { $this->xml_dump = (bool) $enable; } /** * Enables/disables caching in SimplePie. * * This option allows you to disable caching all-together in SimplePie. * However, disabling the cache can lead to longer load times. * * @access public * @since 1.0 Preview Release * @param bool $enable Enable caching */ function enable_cache($enable = true) { $this->cache = (bool) $enable; } /** * Set the length of time (in seconds) that the contents of a feed * will be cached. * * @access public * @param int $seconds The feed content cache duration. */ function set_cache_duration($seconds = 3600) { $this->cache_duration = (int) $seconds; } /** * Set the length of time (in seconds) that the autodiscovered feed * URL will be cached. * * @access public * @param int $seconds The autodiscovered feed URL cache duration. */ function set_autodiscovery_cache_duration($seconds = 604800) { $this->autodiscovery_cache_duration = (int) $seconds; } /** * Set the file system location where the cached files should be stored. * * @access public * @param string $location The file system location. */ function set_cache_location($location = './cache') { $this->cache_location = (string) $location; } /** * Determines whether feed items should be sorted into reverse chronological order. * * @access public * @param bool $enable Sort as reverse chronological order. */ function enable_order_by_date($enable = true) { $this->order_by_date = (bool) $enable; } /** * Allows you to override the character encoding reported by the feed. * * @access public * @param string $encoding Character encoding. */ function set_input_encoding($encoding = false) { if ($encoding) { $this->input_encoding = (string) $encoding; } else { $this->input_encoding = false; } } /** * Set how much feed autodiscovery to do * * @access public * @see SIMPLEPIE_LOCATOR_NONE * @see SIMPLEPIE_LOCATOR_AUTODISCOVERY * @see SIMPLEPIE_LOCATOR_LOCAL_EXTENSION * @see SIMPLEPIE_LOCATOR_LOCAL_BODY * @see SIMPLEPIE_LOCATOR_REMOTE_EXTENSION * @see SIMPLEPIE_LOCATOR_REMOTE_BODY * @see SIMPLEPIE_LOCATOR_ALL * @param int $level Feed Autodiscovery Level (level can be a * combination of the above constants, see bitwise OR operator) */ function set_autodiscovery_level($level = SIMPLEPIE_LOCATOR_ALL) { $this->autodiscovery = (int) $level; } /** * Allows you to change which class SimplePie uses for caching. * 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_cache_class($class = 'SimplePie_Cache') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Cache')) { $this->cache_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for auto-discovery. * 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_locator_class($class = 'SimplePie_Locator') { if (SimplePie_Misc::is_subclass_of($class, 'SimplePie_Locator')) { $this->locator_class = $class; return true; } return false; } /** * Allows you to change which class SimplePie uses for XML parsing. * Useful when you are overloading or extending SimplePie's default classes. * * @access public * @param string $class Name of custom class.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -