Marius Cramer
2013-11-14 7fe908c50c8dbc5cc05f571dbe11d66141caacd4
interface/lib/classes/simplepie.inc.php
@@ -43,6 +43,7 @@
 * @todo phpDoc comments
 */
/**
 * SimplePie Name
 */
@@ -395,6 +396,7 @@
 */
class simplepie
{
   /**
    * @var array Raw data
    * @access private
@@ -711,6 +713,7 @@
    */
   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
    *
@@ -756,6 +759,7 @@
      }
   }
   /**
    * Used for converting object to a string
    */
@@ -763,6 +767,7 @@
   {
      return md5(serialize($this->data));
   }
   /**
    * Remove items that link back to this before destroying this object
@@ -790,6 +795,7 @@
      }
   }
   /**
    * Force the given data/URL to be treated as a feed no matter what it
    * appears like
@@ -802,6 +808,7 @@
   {
      $this->force_feed = (bool) $enable;
   }
   /**
    * This is the URL of the feed you want to parse.
@@ -835,6 +842,7 @@
      }
   }
   /**
    * Provides an instance of SimplePie_File to use as a feed
    *
@@ -853,6 +861,7 @@
      return false;
   }
   /**
    * Allows you to use a string of RSS/Atom data instead of a remote feed.
    *
@@ -870,6 +879,7 @@
      $this->raw_data = $data;
   }
   /**
    * Allows you to override the default timeout for fetching remote feeds.
    *
@@ -885,6 +895,7 @@
      $this->timeout = (int) $timeout;
   }
   /**
    * Forces SimplePie to use fsockopen() instead of the preferred cURL
    * functions.
@@ -897,6 +908,7 @@
   {
      $this->force_fsockopen = (bool) $enable;
   }
   /**
    * Outputs the raw XML content of the feed, after it has gone through
@@ -918,6 +930,7 @@
      $this->xml_dump = (bool) $enable;
   }
   /**
    * Enables/disables caching in SimplePie.
    *
@@ -933,6 +946,7 @@
      $this->cache = (bool) $enable;
   }
   /**
    * Set the length of time (in seconds) that the contents of a feed
    * will be cached.
@@ -944,6 +958,7 @@
   {
      $this->cache_duration = (int) $seconds;
   }
   /**
    * Set the length of time (in seconds) that the autodiscovered feed
@@ -957,6 +972,7 @@
      $this->autodiscovery_cache_duration = (int) $seconds;
   }
   /**
    * Set the file system location where the cached files should be stored.
    *
@@ -968,6 +984,7 @@
      $this->cache_location = (string) $location;
   }
   /**
    * Determines whether feed items should be sorted into reverse chronological order.
    *
@@ -978,6 +995,7 @@
   {
      $this->order_by_date = (bool) $enable;
   }
   /**
    * Allows you to override the character encoding reported by the feed.
@@ -996,6 +1014,7 @@
         $this->input_encoding = false;
      }
   }
   /**
    * Set how much feed autodiscovery to do
@@ -1016,6 +1035,7 @@
      $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.
@@ -1034,6 +1054,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for auto-discovery.
@@ -1054,6 +1075,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for XML parsing.
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1072,6 +1094,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for remote file fetching.
@@ -1092,6 +1115,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for data sanitization.
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1110,6 +1134,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for handling feed items.
@@ -1130,6 +1155,7 @@
      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.
@@ -1148,6 +1174,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for handling category data.
@@ -1168,6 +1195,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for feed enclosures.
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1186,6 +1214,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for <media:text> captions
@@ -1206,6 +1235,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for <media:copyright>
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1224,6 +1254,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for <media:credit>
@@ -1244,6 +1275,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for <media:rating>
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1262,6 +1294,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for <media:restriction>
@@ -1282,6 +1315,7 @@
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses for content-type sniffing.
    * Useful when you are overloading or extending SimplePie's default classes.
@@ -1300,6 +1334,7 @@
      }
      return false;
   }
   /**
    * Allows you to change which class SimplePie uses item sources.
@@ -1320,6 +1355,7 @@
      return false;
   }
   /**
    * Allows you to override the default user agent string.
    *
@@ -1330,6 +1366,7 @@
   {
      $this->useragent = (string) $ua;
   }
   /**
    * Set callback function to create cache filename with
@@ -1344,6 +1381,7 @@
         $this->cache_name_function = $function;
      }
   }
   /**
    * Set javascript query string parameter
@@ -1362,6 +1400,7 @@
         $this->javascript = false;
      }
   }
   /**
    * Set options to make SP as fast as possible.  Forgoes a
@@ -1382,6 +1421,7 @@
         $this->set_image_handler(false);
      }
   }
   /**
    * Set maximum number of feeds to check with autodiscovery
@@ -1436,6 +1476,7 @@
      $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
@@ -1448,6 +1489,7 @@
   {
      $this->sanitize->set_url_replacements($element_attribute);
   }
   /**
    * Set the handler to enable the display of cached favicons.
@@ -1468,6 +1510,7 @@
      }
   }
   /**
    * Set the handler to enable the display of cached images.
    *
@@ -1486,6 +1529,7 @@
         $this->image_handler = '';
      }
   }
   /**
    * Set the limit for items returned per-feed with multifeeds.
@@ -1830,6 +1874,7 @@
      }
   }
   /**
    * Return the error message for the occured error
    *
@@ -1943,6 +1988,7 @@
      return $this->data['type'];
   }
   /**
    * Returns the URL for the favicon of the feed's website.
    *
@@ -2003,6 +2049,7 @@
      }
      return false;
   }
   /**
    * @todo If we have a perm redirect we should return the new URL
@@ -2068,6 +2115,7 @@
         return null;
      }
   }
   /**
    * Creates the subscribe_* methods' return data
@@ -2577,6 +2625,7 @@
      }
   }
   /**
    * Added for parity between the parent-level and the item/entry-level.
    */
@@ -3048,6 +3097,7 @@
      }
   }
   /**
    * @static
    */
@@ -3055,6 +3105,7 @@
   {
      return $a->get_date('U') <= $b->get_date('U');
   }
   /**
    * @static
@@ -3106,6 +3157,7 @@
         return array();
      }
   }
}
class SimplePie_Item
@@ -3123,6 +3175,7 @@
   {
      return md5(serialize($this->data));
   }
   /**
    * Remove items that link back to this before destroying this object
@@ -3758,6 +3811,7 @@
      }
   }
   /**
    * @todo Add ability to prefer one type of content over another (in a media group).
    */
@@ -3773,6 +3827,7 @@
         return null;
      }
   }
   /**
    * Grabs all available enclosures (podcasts, etc.)
@@ -5626,6 +5681,7 @@
      }
   }
   /**
    * Creates the add_to_* methods' return data
    *
@@ -5725,6 +5781,7 @@
   {
      return $this->add_to_service('http://www.technorati.com/search/');
   }
}
class SimplePie_Source
@@ -6043,6 +6100,7 @@
      }
   }
   /**
    * Added for parity between the parent-level and the item/entry-level.
    */
@@ -6276,6 +6334,7 @@
         return null;
      }
   }
}
class SimplePie_Author
@@ -6333,6 +6392,7 @@
         return null;
      }
   }
}
class SimplePie_Category
@@ -6390,6 +6450,7 @@
         return $this->get_term();
      }
   }
}
class SimplePie_Enclosure
@@ -6914,6 +6975,7 @@
      return $this->embed($options, true);
   }
   /**
    * @todo If the dimensions for media:content are defined, use them when width/height are set to 'auto'.
    */
@@ -7345,6 +7407,7 @@
         return $type;
      }
   }
}
class SimplePie_Caption
@@ -7430,6 +7493,7 @@
         return null;
      }
   }
}
class SimplePie_Credit
@@ -7487,6 +7551,7 @@
         return null;
      }
   }
}
class SimplePie_Copyright
@@ -7530,6 +7595,7 @@
         return null;
      }
   }
}
class SimplePie_Rating
@@ -7573,6 +7639,7 @@
         return null;
      }
   }
}
class SimplePie_Restriction
@@ -7630,6 +7697,7 @@
         return null;
      }
   }
}
/**
@@ -7862,6 +7930,7 @@
         }
      }
   }
}
/**
@@ -7871,6 +7940,7 @@
 */
class SimplePie_HTTP_Parser
{
   /**
    * HTTP Version
    *
@@ -7959,6 +8029,7 @@
    */
   var $value = '';
   /**
    * Create an instance of the class with the input data
    *
@@ -7970,6 +8041,7 @@
      $this->data = $data;
      $this->data_length = strlen($this->data);
   }
   /**
    * Parse the input data
@@ -8000,6 +8072,7 @@
      }
   }
   /**
    * Check whether there is data beyond the pointer
    *
@@ -8010,6 +8083,7 @@
   {
      return (bool) ($this->position < $this->data_length);
   }
   /**
    * See if the next character is LWS
@@ -8025,6 +8099,7 @@
            && isset($this->data[$this->position + 1])
            && ($this->data[$this->position + 1] === "\x09" || $this->data[$this->position + 1] === "\x20")));
   }
   /**
    * Parse the HTTP version
@@ -8055,6 +8130,7 @@
      }
   }
   /**
    * Parse the status code
    *
@@ -8074,6 +8150,7 @@
      }
   }
   /**
    * Parse the reason phrase
    *
@@ -8086,6 +8163,7 @@
      $this->position += $len + 1;
      $this->state = 'new_line';
   }
   /**
    * Deal with a new line, shifting data around as needed
@@ -8125,6 +8203,7 @@
      }
   }
   /**
    * Parse a header name
    *
@@ -8153,6 +8232,7 @@
      }
   }
   /**
    * Parse LWS, replacing consecutive LWS characters with a single space
    *
@@ -8174,6 +8254,7 @@
      } while ($this->has_data() && $this->is_linear_whitespace());
      $this->value .= "\x20";
   }
   /**
    * See what state to move to while within non-quoted header values
@@ -8207,6 +8288,7 @@
      }
   }
   /**
    * Parse a header value while outside quotes
    *
@@ -8219,6 +8301,7 @@
      $this->position += $len;
      $this->state = 'value';
   }
   /**
    * See what state to move to while within quoted header values
@@ -8257,6 +8340,7 @@
      }
   }
   /**
    * Parse a header value while within quotes
    *
@@ -8270,6 +8354,7 @@
      $this->state = 'value';
   }
   /**
    * Parse an escaped character within quotes
    *
@@ -8282,6 +8367,7 @@
      $this->state = 'quote';
   }
   /**
    * Parse the body
    *
@@ -8292,6 +8378,7 @@
      $this->body = substr($this->data, $this->position);
      $this->state = 'emit';
   }
}
/**
@@ -8301,6 +8388,7 @@
 */
class SimplePie_gzdecode
{
   /**
    * Compressed data
    *
@@ -8407,6 +8495,7 @@
    */
   var $comment;
   /**
    * Don't allow anything to be set
    *
@@ -8416,6 +8505,7 @@
   {
      trigger_error("Cannot write property $name", E_USER_ERROR);
   }
   /**
    * Set the compressed string and related properties
@@ -8427,6 +8517,7 @@
      $this->compressed_data = $data;
      $this->compressed_size = strlen($data);
   }
   /**
    * Decode the GZIP stream
@@ -8602,10 +8693,13 @@
         return false;
      }
   }
}
class SimplePie_Cache
{
   /**
    * Don't call the constructor. Please.
    *
@@ -8615,6 +8709,7 @@
   {
      trigger_error('Please call SimplePie_Cache::create() instead of the constructor', E_USER_ERROR);
   }
   /**
    * Create a new SimplePie_Cache object
@@ -8638,6 +8733,7 @@
            return new SimplePie_Cache_File($location, $filename, $extension);
      }
   }
}
class SimplePie_Cache_File
@@ -8719,6 +8815,7 @@
      }
      return false;
   }
}
class SimplePie_Cache_DB
@@ -8799,6 +8896,7 @@
      }
      return array(serialize($data->data), $items_by_id);
   }
}
class SimplePie_Cache_MySQL extends SimplePie_Cache_DB
@@ -9071,6 +9169,7 @@
         return false;
      }
   }
}
class SimplePie_Misc
@@ -9260,6 +9359,7 @@
      return $message;
   }
   /**
    * If a file has been cached, retrieve and display it.
    *
@@ -9378,6 +9478,7 @@
      }
   }
   /**
    * Remove bad UTF-8 bytes
    *
@@ -9412,6 +9513,7 @@
         return '';
      }
   }
   /**
    * Converts a Windows-1252 encoded string to a UTF-8 encoded string
@@ -10840,6 +10942,7 @@
      return false;
   }
   /**
    * Strip HTML comments
    *
@@ -10884,6 +10987,7 @@
      $decoder = new SimplePie_Decode_HTML_Entities($data);
      return $decoder->parse();
   }
   /**
    * Remove RFC822 comments
@@ -11125,6 +11229,7 @@
      }
   }
   /**
    * Converts a unicode codepoint to a UTF-8 character
    *
@@ -11162,6 +11267,7 @@
         return "\xEF\xBF\xBD";
      }
   }
   /**
    * Re-implementation of PHP 5's stripos()
@@ -11205,6 +11311,7 @@
         return strpos(strtolower($haystack), $needle, $offset);
      }
   }
   /**
    * Similar to parse_str()
@@ -11381,6 +11488,7 @@
}
      <?php
   }
}
/**
@@ -11392,6 +11500,7 @@
 */
class SimplePie_Decode_HTML_Entities
{
   /**
    * Data to be parsed
    *
@@ -11416,6 +11525,7 @@
    */
   var $position = 0;
   /**
    * Create an instance of the class with the input data
    *
@@ -11426,6 +11536,7 @@
   {
      $this->data = $data;
   }
   /**
    * Parse the input data
@@ -11443,6 +11554,7 @@
      }
      return $this->data;
   }
   /**
    * Consume the next byte
@@ -11462,6 +11574,7 @@
         return false;
      }
   }
   /**
    * Consume a range of characters
@@ -11485,6 +11598,7 @@
      }
   }
   /**
    * Unconsume one byte
    *
@@ -11495,6 +11609,7 @@
      $this->consumed = substr($this->consumed, 0, -1);
      $this->position--;
   }
   /**
    * Decode an entity
@@ -11585,6 +11700,7 @@
            break;
      }
   }
}
/**
@@ -11594,6 +11710,7 @@
 */
class SimplePie_IRI
{
   /**
    * Scheme
    *
@@ -11658,6 +11775,7 @@
    */
   var $valid = array();
   /**
    * Return the entire IRI when you try and read the object as a string
    *
@@ -11668,6 +11786,7 @@
   {
      return $this->get_iri();
   }
   /**
    * Create a new IRI object, from a specified string
@@ -11771,6 +11890,7 @@
      return $target;
   }
   /**
    * Parse an IRI into scheme/authority/path/query/fragment segments
    *
@@ -11787,6 +11907,7 @@
      }
      return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
   }
   /**
    * Remove dot segments from a path
@@ -11848,6 +11969,7 @@
      }
      return $output . $input;
   }
   /**
    * Replace invalid character with percent encoding
@@ -11928,6 +12050,7 @@
      return $string;
   }
   /**
    * Check if the object represents a valid IRI
    *
@@ -11938,6 +12061,7 @@
   {
      return array_sum($this->valid) === count($this->valid);
   }
   /**
    * Set the scheme. Returns true on success, false on failure (if there are
@@ -11980,6 +12104,7 @@
      return true;
   }
   /**
    * Set the authority. Returns true on success, false on failure (if there are
    * any invalid characters).
@@ -12013,6 +12138,7 @@
      return $this->set_userinfo($userinfo) && $this->set_host($authority) && $this->set_port($port);
   }
   /**
    * Set the userinfo.
    *
@@ -12033,6 +12159,7 @@
      $this->valid[__FUNCTION__] = true;
      return true;
   }
   /**
    * Set the host. Returns true on success, false on failure (if there are
@@ -12073,6 +12200,7 @@
      }
   }
   /**
    * Set the port. Returns true on success, false on failure (if there are
    * any invalid characters).
@@ -12102,6 +12230,7 @@
         return false;
      }
   }
   /**
    * Set the path.
@@ -12136,6 +12265,7 @@
      }
   }
   /**
    * Set the query.
    *
@@ -12157,6 +12287,7 @@
      return true;
   }
   /**
    * Set the fragment.
    *
@@ -12177,6 +12308,7 @@
      $this->valid[__FUNCTION__] = true;
      return true;
   }
   /**
    * Get the complete IRI
@@ -12218,6 +12350,7 @@
      }
   }
   /**
    * Get the scheme
    *
@@ -12228,6 +12361,7 @@
   {
      return $this->scheme;
   }
   /**
    * Get the complete authority
@@ -12261,6 +12395,7 @@
      }
   }
   /**
    * Get the user information
    *
@@ -12271,6 +12406,7 @@
   {
      return $this->userinfo;
   }
   /**
    * Get the host
@@ -12283,6 +12419,7 @@
      return $this->host;
   }
   /**
    * Get the port
    *
@@ -12293,6 +12430,7 @@
   {
      return $this->port;
   }
   /**
    * Get the path
@@ -12305,6 +12443,7 @@
      return $this->path;
   }
   /**
    * Get the query
    *
@@ -12316,6 +12455,7 @@
      return $this->query;
   }
   /**
    * Get the fragment
    *
@@ -12326,6 +12466,7 @@
   {
      return $this->fragment;
   }
}
/**
@@ -12342,6 +12483,8 @@
 */
class SimplePie_Net_IPv6
{
   /**
    * Removes a possible existing netmask specification of an IP address.
    *
@@ -12363,6 +12506,7 @@
      }
      return $addr;
   }
   /**
    * Uncompresses an IPv6 address
@@ -12451,6 +12595,7 @@
      return $uip;
   }
   /**
    * Splits an IPv6 address into the IPv6 and a possible IPv4 part
    *
@@ -12480,6 +12625,7 @@
         return array($ip, '');
      }
   }
   /**
    * Checks an IPv6 address
@@ -12538,6 +12684,7 @@
         return false;
      }
   }
}
/**
@@ -12547,6 +12694,7 @@
 */
class SimplePie_Parse_Date
{
   /**
    * Input data
    *
@@ -13029,6 +13177,7 @@
    */
   var $user = array();
   /**
    * Create new SimplePie_Parse_Date object, and set self::day_pcre,
    * self::month_pcre, and self::built_in
@@ -13075,6 +13224,7 @@
      return $object;
   }
   /**
    * Parse a date
    *
@@ -13104,6 +13254,7 @@
      return false;
   }
   /**
    * Add a callback method to parse a date
    *
@@ -13122,6 +13273,7 @@
         trigger_error('User-supplied function must be a valid callback', E_USER_WARNING);
      }
   }
   /**
    * Parse a superset of W3C-DTF (allows hyphens and colons to be omitted, as
@@ -13196,6 +13348,7 @@
      }
   }
   /**
    * Remove RFC822 comments
    *
@@ -13256,6 +13409,7 @@
      return $output;
   }
   /**
    * Parse RFC2822's date format
@@ -13350,6 +13504,7 @@
      }
   }
   /**
    * Parse RFC850's date format
    *
@@ -13415,6 +13570,7 @@
      }
   }
   /**
    * Parse C99's asctime()'s date format
    *
@@ -13457,6 +13613,7 @@
      }
   }
   /**
    * Parse dates using strtotime()
    *
@@ -13475,6 +13632,7 @@
         return $strtotime;
      }
   }
}
/**
@@ -13484,6 +13642,7 @@
 */
class SimplePie_Content_Type_Sniffer
{
   /**
    * File object
    *
@@ -13491,6 +13650,7 @@
    * @access private
    */
   var $file;
   /**
    * Create an instance of the class with the input file
@@ -13502,6 +13662,7 @@
   {
      $this->file = $file;
   }
   /**
    * Get the Content-Type of the specified file
@@ -13568,6 +13729,7 @@
      }
   }
   /**
    * Sniff text or binary
    *
@@ -13592,6 +13754,7 @@
         return 'text/plain';
      }
   }
   /**
    * Sniff unknown
@@ -13639,6 +13802,7 @@
      }
   }
   /**
    * Sniff images
    *
@@ -13669,6 +13833,7 @@
         return false;
      }
   }
   /**
    * Sniff HTML
@@ -13751,6 +13916,7 @@
      return 'text/html';
   }
}
/**
@@ -13760,6 +13926,7 @@
 */
class SimplePie_XML_Declaration_Parser
{
   /**
    * XML Version
    *
@@ -13816,6 +13983,7 @@
    */
   var $position = 0;
   /**
    * Create an instance of the class with the input data
    *
@@ -13827,6 +13995,7 @@
      $this->data = $data;
      $this->data_length = strlen($this->data);
   }
   /**
    * Parse the input data
@@ -13855,6 +14024,7 @@
      }
   }
   /**
    * Check whether there is data beyond the pointer
    *
@@ -13865,6 +14035,7 @@
   {
      return (bool) ($this->position < $this->data_length);
   }
   /**
    * Advance past any whitespace
@@ -13877,6 +14048,7 @@
      $this->position += $whitespace;
      return $whitespace;
   }
   /**
    * Read value
@@ -14068,6 +14240,7 @@
         $this->state = false;
      }
   }
}
class SimplePie_Locator
@@ -14325,6 +14498,7 @@
      }
      return null;
   }
}
class SimplePie_Parser
@@ -14663,6 +14837,7 @@
      }
      return $cache[$string];
   }
}
/**
@@ -14817,6 +14992,7 @@
   {
      $this->output_encoding = (string) $encoding;
   }
   /**
    * Set element/attribute key/value pairs of HTML attributes
@@ -15018,6 +15194,7 @@
         return '';
      }
   }
}
?>