| @@ -960,6 +960,10 @@ discard block | ||
| 960 | 960 | return null; | 
| 961 | 961 | } | 
| 962 | 962 | |
| 963 | + /** | |
| 964 | + * @param string $namespace | |
| 965 | + * @param string $tag | |
| 966 | + */ | |
| 963 | 967 | public function get_channel_tags($namespace, $tag) | 
| 964 | 968 |      { | 
| 965 | 969 | $type = $this->get_type(); | 
| @@ -1003,6 +1007,10 @@ discard block | ||
| 1003 | 1007 | return null; | 
| 1004 | 1008 | } | 
| 1005 | 1009 | |
| 1010 | + /** | |
| 1011 | + * @param string $namespace | |
| 1012 | + * @param string $tag | |
| 1013 | + */ | |
| 1006 | 1014 | public function get_image_tags($namespace, $tag) | 
| 1007 | 1015 |      { | 
| 1008 | 1016 | $type = $this->get_type(); | 
| @@ -1039,6 +1047,9 @@ discard block | ||
| 1039 | 1047 | return null; | 
| 1040 | 1048 | } | 
| 1041 | 1049 | |
| 1050 | + /** | |
| 1051 | + * @return string | |
| 1052 | + */ | |
| 1042 | 1053 | public function get_base($element = array()) | 
| 1043 | 1054 |      { | 
| 1044 | 1055 | if (!($this->get_type() & SIMPLEPIE_TYPE_RSS_SYNDICATION) && !empty($element['xml_base_explicit']) && isset($element['xml_base'])) | 
| @@ -1316,6 +1327,9 @@ discard block | ||
| 1316 | 1327 | } | 
| 1317 | 1328 | } | 
| 1318 | 1329 | |
| 1330 | + /** | |
| 1331 | + * @return string | |
| 1332 | + */ | |
| 1319 | 1333 | public function get_link($key = 0, $rel = 'alternate') | 
| 1320 | 1334 |      { | 
| 1321 | 1335 | $links = $this->get_links($rel); | 
| @@ -1960,6 +1974,9 @@ discard block | ||
| 1960 | 1974 | abstract class SimplePie_Cache_DB implements SimplePie_Cache_Base | 
| 1961 | 1975 |  { | 
| 1962 | 1976 | |
| 1977 | + /** | |
| 1978 | + * @param SimplePie $data | |
| 1979 | + */ | |
| 1963 | 1980 | protected static function prepare_simplepie_object_for_cache($data) | 
| 1964 | 1981 |      { | 
| 1965 | 1982 | $items = $data->get_items(); | 
| @@ -3049,6 +3066,9 @@ discard block | ||
| 3049 | 3066 | } | 
| 3050 | 3067 | } | 
| 3051 | 3068 | |
| 3069 | + /** | |
| 3070 | + * @param string $chars | |
| 3071 | + */ | |
| 3052 | 3072 | public function consume_range($chars) | 
| 3053 | 3073 |      { | 
| 3054 | 3074 | if ($len = strspn($this->data, $chars, $this->position)) | 
| @@ -4682,6 +4702,9 @@ discard block | ||
| 4682 | 4702 |          trigger_error("Cannot write property $name", E_USER_ERROR); | 
| 4683 | 4703 | } | 
| 4684 | 4704 | |
| 4705 | + /** | |
| 4706 | + * @param string $data | |
| 4707 | + */ | |
| 4685 | 4708 | public function __construct($data) | 
| 4686 | 4709 |      { | 
| 4687 | 4710 | $this->compressed_data = $data; | 
| @@ -5295,6 +5318,9 @@ discard block | ||
| 5295 | 5318 | $this->set_iri($iri); | 
| 5296 | 5319 | } | 
| 5297 | 5320 | |
| 5321 | + /** | |
| 5322 | + * @param SimplePie_IRI $base | |
| 5323 | + */ | |
| 5298 | 5324 | public static function absolutize($base, $relative) | 
| 5299 | 5325 |      { | 
| 5300 | 5326 | if (!($relative instanceof SimplePie_IRI)) | 
| @@ -5382,6 +5408,9 @@ discard block | ||
| 5382 | 5408 | } | 
| 5383 | 5409 | } | 
| 5384 | 5410 | |
| 5411 | + /** | |
| 5412 | + * @param string $iri | |
| 5413 | + */ | |
| 5385 | 5414 | protected function parse_iri($iri) | 
| 5386 | 5415 |      { | 
| 5387 | 5416 | $iri = trim($iri, "\x20\x09\x0A\x0C\x0D"); | 
| @@ -5470,6 +5499,9 @@ discard block | ||
| 5470 | 5499 | return $output . $input; | 
| 5471 | 5500 | } | 
| 5472 | 5501 | |
| 5502 | + /** | |
| 5503 | + * @param string $extra_chars | |
| 5504 | + */ | |
| 5473 | 5505 | protected function replace_invalid_with_pct_encoding($string, $extra_chars, $iprivate = false) | 
| 5474 | 5506 |      { | 
| 5475 | 5507 | // Normalize as many pct-encoded sections as possible | 
| @@ -5808,6 +5840,9 @@ discard block | ||
| 5808 | 5840 | } | 
| 5809 | 5841 | } | 
| 5810 | 5842 | |
| 5843 | + /** | |
| 5844 | + * @param string|null $scheme | |
| 5845 | + */ | |
| 5811 | 5846 | public function set_scheme($scheme) | 
| 5812 | 5847 |      { | 
| 5813 | 5848 | if ($scheme === null) | 
| @@ -5826,6 +5861,9 @@ discard block | ||
| 5826 | 5861 | return true; | 
| 5827 | 5862 | } | 
| 5828 | 5863 | |
| 5864 | + /** | |
| 5865 | + * @param string|null $authority | |
| 5866 | + */ | |
| 5829 | 5867 | public function set_authority($authority) | 
| 5830 | 5868 |      { | 
| 5831 | 5869 | static $cache; | 
| @@ -5881,6 +5919,9 @@ discard block | ||
| 5881 | 5919 | } | 
| 5882 | 5920 | } | 
| 5883 | 5921 | |
| 5922 | + /** | |
| 5923 | + * @param string|null $iuserinfo | |
| 5924 | + */ | |
| 5884 | 5925 | public function set_userinfo($iuserinfo) | 
| 5885 | 5926 |      { | 
| 5886 | 5927 | if ($iuserinfo === null) | 
| @@ -5940,6 +5981,9 @@ discard block | ||
| 5940 | 5981 | return true; | 
| 5941 | 5982 | } | 
| 5942 | 5983 | |
| 5984 | + /** | |
| 5985 | + * @param null|string $port | |
| 5986 | + */ | |
| 5943 | 5987 | public function set_port($port) | 
| 5944 | 5988 |      { | 
| 5945 | 5989 | if ($port === null) | 
| @@ -5960,6 +6004,9 @@ discard block | ||
| 5960 | 6004 | } | 
| 5961 | 6005 | } | 
| 5962 | 6006 | |
| 6007 | + /** | |
| 6008 | + * @param string|null $ipath | |
| 6009 | + */ | |
| 5963 | 6010 | public function set_path($ipath) | 
| 5964 | 6011 |      { | 
| 5965 | 6012 | static $cache; | 
| @@ -5983,6 +6030,9 @@ discard block | ||
| 5983 | 6030 | return true; | 
| 5984 | 6031 | } | 
| 5985 | 6032 | |
| 6033 | + /** | |
| 6034 | + * @param string|null $iquery | |
| 6035 | + */ | |
| 5986 | 6036 | public function set_query($iquery) | 
| 5987 | 6037 |      { | 
| 5988 | 6038 | if ($iquery === null) | 
| @@ -5997,6 +6047,9 @@ discard block | ||
| 5997 | 6047 | return true; | 
| 5998 | 6048 | } | 
| 5999 | 6049 | |
| 6050 | + /** | |
| 6051 | + * @param string|null $ifragment | |
| 6052 | + */ | |
| 6000 | 6053 | public function set_fragment($ifragment) | 
| 6001 | 6054 |      { | 
| 6002 | 6055 | if ($ifragment === null) | 
| @@ -6011,6 +6064,9 @@ discard block | ||
| 6011 | 6064 | return true; | 
| 6012 | 6065 | } | 
| 6013 | 6066 | |
| 6067 | + /** | |
| 6068 | + * @param false|string $string | |
| 6069 | + */ | |
| 6014 | 6070 | public function to_uri($string) | 
| 6015 | 6071 |      { | 
| 6016 | 6072 | static $non_ascii; | 
| @@ -6135,6 +6191,10 @@ discard block | ||
| 6135 | 6191 | } | 
| 6136 | 6192 | } | 
| 6137 | 6193 | |
| 6194 | + /** | |
| 6195 | + * @param string $namespace | |
| 6196 | + * @param string $tag | |
| 6197 | + */ | |
| 6138 | 6198 | public function get_item_tags($namespace, $tag) | 
| 6139 | 6199 |      { | 
| 6140 | 6200 | if (isset($this->data['child'][$namespace][$tag])) | 
| @@ -6147,11 +6207,17 @@ discard block | ||
| 6147 | 6207 | } | 
| 6148 | 6208 | } | 
| 6149 | 6209 | |
| 6210 | + /** | |
| 6211 | + * @return string | |
| 6212 | + */ | |
| 6150 | 6213 | public function get_base($element = array()) | 
| 6151 | 6214 |      { | 
| 6152 | 6215 | return $this->feed->get_base($element); | 
| 6153 | 6216 | } | 
| 6154 | 6217 | |
| 6218 | + /** | |
| 6219 | + * @return string | |
| 6220 | + */ | |
| 6155 | 6221 | public function sanitize($data, $type, $base = '') | 
| 6156 | 6222 |      { | 
| 6157 | 6223 | return $this->feed->sanitize($data, $type, $base); | 
| @@ -8755,6 +8821,10 @@ discard block | ||
| 8755 | 8821 | return null; | 
| 8756 | 8822 | } | 
| 8757 | 8823 | } | 
| 8824 | + | |
| 8825 | + /** | |
| 8826 | + * @param string $name | |
| 8827 | + */ | |
| 8758 | 8828 | protected function search_elements_by_tag($name, &$done, $feeds) | 
| 8759 | 8829 |      { | 
| 8760 | 8830 | if ($this->dom === null) | 
| @@ -9102,6 +9172,11 @@ discard block | ||
| 9102 | 9172 | return strtr($string, $convert_table); | 
| 9103 | 9173 | } | 
| 9104 | 9174 | |
| 9175 | + /** | |
| 9176 | + * @param string $data | |
| 9177 | + * @param string $input | |
| 9178 | + * @param string $output | |
| 9179 | + */ | |
| 9105 | 9180 | public static function change_encoding($data, $input, $output) | 
| 9106 | 9181 |      { | 
| 9107 | 9182 | $input = SimplePie_Misc::encoding($input); | 
| @@ -10243,6 +10318,10 @@ discard block | ||
| 10243 | 10318 | return $charset; | 
| 10244 | 10319 | } | 
| 10245 | 10320 | } | 
| 10321 | + | |
| 10322 | + /** | |
| 10323 | + * @return string | |
| 10324 | + */ | |
| 10246 | 10325 | public static function get_curl_version() | 
| 10247 | 10326 |      { | 
| 10248 | 10327 | if (is_array($curl = curl_version())) | 
| @@ -10287,6 +10366,9 @@ discard block | ||
| 10287 | 10366 | return $parser->parse($dt); | 
| 10288 | 10367 | } | 
| 10289 | 10368 | |
| 10369 | + /** | |
| 10370 | + * @param string|false $data | |
| 10371 | + */ | |
| 10290 | 10372 | public static function entities_decode($data) | 
| 10291 | 10373 |      { | 
| 10292 | 10374 | $decoder = new SimplePie_Decode_HTML_Entities($data); | 
| @@ -10766,6 +10848,9 @@ discard block | ||
| 10766 | 10848 | return $ip; | 
| 10767 | 10849 | } | 
| 10768 | 10850 | |
| 10851 | + /** | |
| 10852 | + * @param string $ip | |
| 10853 | + */ | |
| 10769 | 10854 | public static function compress($ip) | 
| 10770 | 10855 |      { | 
| 10771 | 10856 | // Prepare the IP to be compressed | 
| @@ -11852,6 +11937,10 @@ discard block | ||
| 11852 | 11937 |      { | 
| 11853 | 11938 | return $this->data; | 
| 11854 | 11939 | } | 
| 11940 | + | |
| 11941 | + /** | |
| 11942 | + * @param string $tag | |
| 11943 | + */ | |
| 11855 | 11944 | public function tag_open($parser, $tag, $attributes) | 
| 11856 | 11945 |      { | 
| 11857 | 11946 | list($this->namespace[], $this->element[]) = $this->split_ns($tag); | 
| @@ -11914,6 +12003,10 @@ discard block | ||
| 11914 | 12003 | } | 
| 11915 | 12004 | } | 
| 11916 | 12005 | } | 
| 12006 | + | |
| 12007 | + /** | |
| 12008 | + * @param string $cdata | |
| 12009 | + */ | |
| 11917 | 12010 | public function cdata($parser, $cdata) | 
| 11918 | 12011 |      { | 
| 11919 | 12012 | if ($this->current_xhtml_construct >= 0) | 
| @@ -11925,6 +12018,10 @@ discard block | ||
| 11925 | 12018 | $this->data['data'] .= $cdata; | 
| 11926 | 12019 | } | 
| 11927 | 12020 | } | 
| 12021 | + | |
| 12022 | + /** | |
| 12023 | + * @param string $tag | |
| 12024 | + */ | |
| 11928 | 12025 | public function tag_close($parser, $tag) | 
| 11929 | 12026 |      { | 
| 11930 | 12027 | if ($this->current_xhtml_construct >= 0) | 
| @@ -12057,6 +12154,10 @@ discard block | ||
| 12057 | 12154 | |
| 12058 | 12155 |      public function __construct() { } | 
| 12059 | 12156 | |
| 12157 | + /** | |
| 12158 | + * @param string $type | |
| 12159 | + * @param string $class | |
| 12160 | + */ | |
| 12060 | 12161 | public function register($type, $class, $legacy = false) | 
| 12061 | 12162 |      { | 
| 12062 | 12163 | if (!is_subclass_of($class, $this->default[$type])) | 
| @@ -12084,6 +12185,9 @@ discard block | ||
| 12084 | 12185 | return null; | 
| 12085 | 12186 | } | 
| 12086 | 12187 | |
| 12188 | + /** | |
| 12189 | + * @param string $type | |
| 12190 | + */ | |
| 12087 | 12191 | public function &create($type, $parameters = array()) | 
| 12088 | 12192 |      { | 
| 12089 | 12193 | $class = $this->get_class($type); | 
| @@ -12115,6 +12219,10 @@ discard block | ||
| 12115 | 12219 | return $instance; | 
| 12116 | 12220 | } | 
| 12117 | 12221 | |
| 12222 | + /** | |
| 12223 | + * @param string $type | |
| 12224 | + * @param string $method | |
| 12225 | + */ | |
| 12118 | 12226 | public function &call($type, $method, $parameters = array()) | 
| 12119 | 12227 |      { | 
| 12120 | 12228 | $class = $this->get_class($type); | 
| @@ -12146,6 +12254,10 @@ discard block | ||
| 12146 | 12254 | |
| 12147 | 12255 | var $value; | 
| 12148 | 12256 | |
| 12257 | + /** | |
| 12258 | + * @param string $relationship | |
| 12259 | + * @param string $value | |
| 12260 | + */ | |
| 12149 | 12261 | public function __construct($relationship = null, $type = null, $value = null) | 
| 12150 | 12262 |      { | 
| 12151 | 12263 | $this->relationship = $relationship; | 
| @@ -12472,6 +12584,10 @@ discard block | ||
| 12472 | 12584 | } | 
| 12473 | 12585 | return $data; | 
| 12474 | 12586 | } | 
| 12587 | + | |
| 12588 | + /** | |
| 12589 | + * @param string $html | |
| 12590 | + */ | |
| 12475 | 12591 | protected function preprocess($html, $type) | 
| 12476 | 12592 |      { | 
| 12477 | 12593 | $ret = ''; | 
| @@ -12493,6 +12609,10 @@ discard block | ||
| 12493 | 12609 | $ret .= '</head><body>' . $html . '</body></html>'; | 
| 12494 | 12610 | return $ret; | 
| 12495 | 12611 | } | 
| 12612 | + | |
| 12613 | + /** | |
| 12614 | + * @param DOMDocument $document | |
| 12615 | + */ | |
| 12496 | 12616 | public function replace_urls($document, $tag, $attributes) | 
| 12497 | 12617 |      { | 
| 12498 | 12618 | if (!is_array($attributes)) | 
| @@ -12542,6 +12662,10 @@ discard block | ||
| 12542 | 12662 | return ''; | 
| 12543 | 12663 | } | 
| 12544 | 12664 | } | 
| 12665 | + | |
| 12666 | + /** | |
| 12667 | + * @param DOMDocument $document | |
| 12668 | + */ | |
| 12545 | 12669 | protected function strip_tag($tag, $document, $type) | 
| 12546 | 12670 |      { | 
| 12547 | 12671 | $xpath = new DOMXPath($document); | 
| @@ -12617,6 +12741,10 @@ discard block | ||
| 12617 | 12741 | } | 
| 12618 | 12742 | } | 
| 12619 | 12743 | } | 
| 12744 | + | |
| 12745 | + /** | |
| 12746 | + * @param DOMDocument $document | |
| 12747 | + */ | |
| 12620 | 12748 | protected function strip_attr($attrib, $document) | 
| 12621 | 12749 |      { | 
| 12622 | 12750 | $xpath = new DOMXPath($document); | 
| @@ -12645,6 +12773,11 @@ discard block | ||
| 12645 | 12773 |      { | 
| 12646 | 12774 | return md5(serialize($this->data)); | 
| 12647 | 12775 | } | 
| 12776 | + | |
| 12777 | + /** | |
| 12778 | + * @param string $namespace | |
| 12779 | + * @param string $tag | |
| 12780 | + */ | |
| 12648 | 12781 | public function get_source_tags($namespace, $tag) | 
| 12649 | 12782 |      { | 
| 12650 | 12783 | if (isset($this->data['child'][$namespace][$tag])) | 
| @@ -12656,6 +12789,10 @@ discard block | ||
| 12656 | 12789 | return null; | 
| 12657 | 12790 | } | 
| 12658 | 12791 | } | 
| 12792 | + | |
| 12793 | + /** | |
| 12794 | + * @return string | |
| 12795 | + */ | |
| 12659 | 12796 | public function get_base($element = array()) | 
| 12660 | 12797 |      { | 
| 12661 | 12798 | return $this->item->get_base($element); | 
| @@ -3505,7 +3505,7 @@ discard block | ||
| 3505 | 3505 | } | 
| 3506 | 3506 | if ($match !== null) | 
| 3507 | 3507 |                  { | 
| 3508 | - $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); | |
| 3508 | + $this->data = substr_replace($this->data, $entities[$match], $this->position - strlen($consumed) - 1, strlen($match) + 1); | |
| 3509 | 3509 | $this->position += strlen($entities[$match]) - strlen($consumed) - 1; | 
| 3510 | 3510 | } | 
| 3511 | 3511 | break; | 
| @@ -5213,7 +5213,7 @@ discard block | ||
| 5213 | 5213 | call_user_func(array($this, 'set_' . $name), $value); | 
| 5214 | 5214 | } | 
| 5215 | 5215 | elseif ( | 
| 5216 | - $name === 'iauthority' | |
| 5216 | + $name === 'iauthority' | |
| 5217 | 5217 | || $name === 'iuserinfo' | 
| 5218 | 5218 | || $name === 'ihost' | 
| 5219 | 5219 | || $name === 'ipath' | 
| @@ -5560,13 +5560,13 @@ discard block | ||
| 5560 | 5560 | || $character >= 0xFDD0 && $character <= 0xFDEF | 
| 5561 | 5561 | || ( | 
| 5562 | 5562 | // Everything else not in ucschar | 
| 5563 | - $character > 0xD7FF && $character < 0xF900 | |
| 5563 | + $character > 0xD7FF && $character < 0xF900 | |
| 5564 | 5564 | || $character < 0xA0 | 
| 5565 | 5565 | || $character > 0xEFFFD | 
| 5566 | 5566 | ) | 
| 5567 | 5567 | && ( | 
| 5568 | 5568 | // Everything not in iprivate, if it applies | 
| 5569 | - !$iprivate | |
| 5569 | + !$iprivate | |
| 5570 | 5570 | || $character < 0xE000 | 
| 5571 | 5571 | || $character > 0x10FFFD | 
| 5572 | 5572 | ) | 
| @@ -5775,13 +5775,13 @@ discard block | ||
| 5775 | 5775 | elseif (isset($cache[$iri])) | 
| 5776 | 5776 |          { | 
| 5777 | 5777 | list($this->scheme, | 
| 5778 | - $this->iuserinfo, | |
| 5779 | - $this->ihost, | |
| 5780 | - $this->port, | |
| 5781 | - $this->ipath, | |
| 5782 | - $this->iquery, | |
| 5783 | - $this->ifragment, | |
| 5784 | - $return) = $cache[$iri]; | |
| 5778 | + $this->iuserinfo, | |
| 5779 | + $this->ihost, | |
| 5780 | + $this->port, | |
| 5781 | + $this->ipath, | |
| 5782 | + $this->iquery, | |
| 5783 | + $this->ifragment, | |
| 5784 | + $return) = $cache[$iri]; | |
| 5785 | 5785 | return $return; | 
| 5786 | 5786 | } | 
| 5787 | 5787 | else | 
| @@ -5797,13 +5797,13 @@ discard block | ||
| 5797 | 5797 | && $this->set_query($parsed['query']) | 
| 5798 | 5798 | && $this->set_fragment($parsed['fragment']); | 
| 5799 | 5799 | $cache[$iri] = array($this->scheme, | 
| 5800 | - $this->iuserinfo, | |
| 5801 | - $this->ihost, | |
| 5802 | - $this->port, | |
| 5803 | - $this->ipath, | |
| 5804 | - $this->iquery, | |
| 5805 | - $this->ifragment, | |
| 5806 | - $return); | |
| 5800 | + $this->iuserinfo, | |
| 5801 | + $this->ihost, | |
| 5802 | + $this->port, | |
| 5803 | + $this->ipath, | |
| 5804 | + $this->iquery, | |
| 5805 | + $this->ifragment, | |
| 5806 | + $return); | |
| 5807 | 5807 | return $return; | 
| 5808 | 5808 | } | 
| 5809 | 5809 | } | 
| @@ -5841,9 +5841,9 @@ discard block | ||
| 5841 | 5841 | elseif (isset($cache[$authority])) | 
| 5842 | 5842 |          { | 
| 5843 | 5843 | list($this->iuserinfo, | 
| 5844 | - $this->ihost, | |
| 5845 | - $this->port, | |
| 5846 | - $return) = $cache[$authority]; | |
| 5844 | + $this->ihost, | |
| 5845 | + $this->port, | |
| 5846 | + $return) = $cache[$authority]; | |
| 5847 | 5847 | return $return; | 
| 5848 | 5848 | } | 
| 5849 | 5849 | else | 
| @@ -5874,9 +5874,9 @@ discard block | ||
| 5874 | 5874 | $this->set_host($remaining) && | 
| 5875 | 5875 | $this->set_port($port); | 
| 5876 | 5876 | $cache[$authority] = array($this->iuserinfo, | 
| 5877 | - $this->ihost, | |
| 5878 | - $this->port, | |
| 5879 | - $return); | |
| 5877 | + $this->ihost, | |
| 5878 | + $this->port, | |
| 5879 | + $return); | |
| 5880 | 5880 | return $return; | 
| 5881 | 5881 | } | 
| 5882 | 5882 | } | 
| @@ -9128,7 +9128,7 @@ discard block | ||
| 9128 | 9128 |          elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output))) | 
| 9129 | 9129 |          { | 
| 9130 | 9130 | return $return; | 
| 9131 | - } | |
| 9131 | + } | |
| 9132 | 9132 | // This is last, as behaviour of this varies with OS userland and PHP version | 
| 9133 | 9133 |          elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output))) | 
| 9134 | 9134 |          { | 
| @@ -12,31 +12,31 @@ | ||
| 12 | 12 | |
| 13 | 13 |  class CRSSFeed { | 
| 14 | 14 | |
| 15 | - // constructor - initialize SimplePie. | |
| 16 | -  public function __construct($feedArr, $duration = 3600) { | |
| 17 | - $this->object = new SimplePie(); | |
| 18 | - $this->object->set_cache_location(CACHE); | |
| 19 | - $this->object->set_cache_duration($duration); | |
| 20 | - $this->object->set_feed_url($feedArr); | |
| 21 | - $this->object->init(); | |
| 22 | - } | |
| 15 | + // constructor - initialize SimplePie. | |
| 16 | +    public function __construct($feedArr, $duration = 3600) { | |
| 17 | + $this->object = new SimplePie(); | |
| 18 | + $this->object->set_cache_location(CACHE); | |
| 19 | + $this->object->set_cache_duration($duration); | |
| 20 | + $this->object->set_feed_url($feedArr); | |
| 21 | + $this->object->init(); | |
| 22 | + } | |
| 23 | 23 | |
| 24 | - // return content. | |
| 25 | -  public function getFeed() { | |
| 26 | - $feedItems = $this->object->get_items(); | |
| 27 | - $html = '<article>'; | |
| 28 | - $html .= "<h1>Senaste nytt från IDG</h1>"; | |
| 29 | -      foreach($feedItems as $content) { | |
| 30 | - $html .= '<div class="feed-content">'; | |
| 31 | - $html .= "<h2>" . $content->get_title() . "</h2>" ; | |
| 32 | -		  $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; | |
| 33 | -          $html .= "<p>{$content->get_content()}</p>"; | |
| 34 | - $html .= "<p><a href='" . $content->get_permalink() . "'>Läs mer</a>"; | |
| 35 | - $html .= '</div>'; | |
| 36 | - } | |
| 37 | - $html .= "</article>"; | |
| 38 | - return $html; | |
| 39 | - } | |
| 24 | + // return content. | |
| 25 | +    public function getFeed() { | |
| 26 | + $feedItems = $this->object->get_items(); | |
| 27 | + $html = '<article>'; | |
| 28 | + $html .= "<h1>Senaste nytt från IDG</h1>"; | |
| 29 | +        foreach($feedItems as $content) { | |
| 30 | + $html .= '<div class="feed-content">'; | |
| 31 | + $html .= "<h2>" . $content->get_title() . "</h2>" ; | |
| 32 | +            $html .= "<small>Postad ". $content->get_date('Y-m-d | H:i:s')."</small>"; | |
| 33 | +            $html .= "<p>{$content->get_content()}</p>"; | |
| 34 | + $html .= "<p><a href='" . $content->get_permalink() . "'>Läs mer</a>"; | |
| 35 | + $html .= '</div>'; | |
| 36 | + } | |
| 37 | + $html .= "</article>"; | |
| 38 | + return $html; | |
| 39 | + } | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | /*$rss = new SimplePie(); |