Skip to content
This repository
Browse code

More registry fixes.

Add Parse_Date, change Source to using the registry, and fix up a lot of occurrances of Misc::*()
  • Loading branch information...
commit 6e876906a96e2c6fe265a29b92ff73480794c099 1 parent 0b911ec
Ryan McCue rmccue authored
84 SimplePie/Item.php
@@ -334,7 +334,7 @@ public function get_categories()
334 334
335 335 if (!empty($categories))
336 336 {
337   - return SimplePie_Misc::array_unique($categories);
  337 + return $this->registry->call('Misc', 'array_unique', array($categories));
338 338 }
339 339 else
340 340 {
@@ -418,7 +418,7 @@ public function get_contributors()
418 418
419 419 if (!empty($contributors))
420 420 {
421   - return SimplePie_Misc::array_unique($contributors);
  421 + return $this->registry->call('Misc', 'array_unique', array($contributors));
422 422 }
423 423 else
424 424 {
@@ -492,7 +492,7 @@ public function get_authors()
492 492
493 493 if (!empty($authors))
494 494 {
495   - return SimplePie_Misc::array_unique($authors);
  495 + return $this->registry->call('Misc', 'array_unique', array($authors));
496 496 }
497 497 elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
498 498 {
@@ -512,7 +512,7 @@ public function get_copyright()
512 512 {
513 513 if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
514 514 {
515   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  515 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
516 516 }
517 517 elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
518 518 {
@@ -567,7 +567,7 @@ public function get_date($date_format = 'j F Y, g:i a')
567 567
568 568 if (!empty($this->data['date']['raw']))
569 569 {
570   - $parser = SimplePie_Parse_Date::get();
  570 + $parser = $this->registry->call('Parse_Date', 'get');
571 571 $this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
572 572 }
573 573 else
@@ -607,7 +607,7 @@ public function get_updated_date($date_format = 'j F Y, g:i a')
607 607
608 608 if (!empty($this->data['updated']['raw']))
609 609 {
610   - $parser = SimplePie_Parse_Date::get();
  610 + $parser = $this->registry->call('Parse_Date', 'get');
611 611 $this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
612 612 }
613 613 else
@@ -750,7 +750,7 @@ public function get_links($rel = 'alternate')
750 750 $keys = array_keys($this->data['links']);
751 751 foreach ($keys as $key)
752 752 {
753   - if (SimplePie_Misc::is_isegment_nz_nc($key))
  753 + if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
754 754 {
755 755 if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
756 756 {
@@ -896,7 +896,7 @@ public function get_enclosures()
896 896 }
897 897 if (is_array($captions_parent))
898 898 {
899   - $captions_parent = array_values(SimplePie_Misc::array_unique($captions_parent));
  899 + $captions_parent = array_values($this->registry->call('Misc', 'array_unique', array($captions_parent)));
900 900 }
901 901
902 902 // CATEGORIES
@@ -971,7 +971,7 @@ public function get_enclosures()
971 971 }
972 972 if (is_array($categories_parent))
973 973 {
974   - $categories_parent = array_values(SimplePie_Misc::array_unique($categories_parent));
  974 + $categories_parent = array_values($this->registry('Misc', 'array_unique', array($categories_parent)));
975 975 }
976 976
977 977 // COPYRIGHT
@@ -1059,7 +1059,7 @@ public function get_enclosures()
1059 1059 }
1060 1060 if (is_array($credits_parent))
1061 1061 {
1062   - $credits_parent = array_values(SimplePie_Misc::array_unique($credits_parent));
  1062 + $credits_parent = array_values($this->registry('Misc', 'array_unique', array($credits_parent)));
1063 1063 }
1064 1064
1065 1065 // DESCRIPTION
@@ -1151,7 +1151,7 @@ public function get_enclosures()
1151 1151 }
1152 1152 if (is_array($hashes_parent))
1153 1153 {
1154   - $hashes_parent = array_values(SimplePie_Misc::array_unique($hashes_parent));
  1154 + $hashes_parent = array_values($this->registry('Misc', 'array_unique', array($hashes_parent)));
1155 1155 }
1156 1156
1157 1157 // KEYWORDS
@@ -1205,7 +1205,7 @@ public function get_enclosures()
1205 1205 }
1206 1206 if (is_array($keywords_parent))
1207 1207 {
1208   - $keywords_parent = array_values(SimplePie_Misc::array_unique($keywords_parent));
  1208 + $keywords_parent = array_values($this->registry('Misc', 'array_unique', array($keywords_parent)));
1209 1209 }
1210 1210
1211 1211 // PLAYER
@@ -1295,7 +1295,7 @@ public function get_enclosures()
1295 1295 }
1296 1296 if (is_array($ratings_parent))
1297 1297 {
1298   - $ratings_parent = array_values(SimplePie_Misc::array_unique($ratings_parent));
  1298 + $ratings_parent = array_values($this->registry('Misc', 'array_unique', array($ratings_parent)));
1299 1299 }
1300 1300
1301 1301 // RESTRICTIONS
@@ -1373,7 +1373,7 @@ public function get_enclosures()
1373 1373 }
1374 1374 if (is_array($restrictions_parent))
1375 1375 {
1376   - $restrictions_parent = array_values(SimplePie_Misc::array_unique($restrictions_parent));
  1376 + $restrictions_parent = array_values($this->registry('Misc', 'array_unique', array($restrictions_parent)));
1377 1377 }
1378 1378
1379 1379 // THUMBNAILS
@@ -1578,7 +1578,7 @@ public function get_enclosures()
1578 1578 }
1579 1579 if (is_array($captions))
1580 1580 {
1581   - $captions = array_values(SimplePie_Misc::array_unique($captions));
  1581 + $captions = array_values($this->registry('Misc', 'array_unique', array($captions)));
1582 1582 }
1583 1583 }
1584 1584 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
@@ -1614,7 +1614,7 @@ public function get_enclosures()
1614 1614 }
1615 1615 if (is_array($captions))
1616 1616 {
1617   - $captions = array_values(SimplePie_Misc::array_unique($captions));
  1617 + $captions = array_values($this->registry('Misc', 'array_unique', array($captions)));
1618 1618 }
1619 1619 }
1620 1620 else
@@ -1677,15 +1677,15 @@ public function get_enclosures()
1677 1677 }
1678 1678 if (is_array($categories) && is_array($categories_parent))
1679 1679 {
1680   - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
  1680 + $categories = array_values($this->registry('Misc', 'array_unique', array(array_merge($categories, $categories_parent))));
1681 1681 }
1682 1682 elseif (is_array($categories))
1683 1683 {
1684   - $categories = array_values(SimplePie_Misc::array_unique($categories));
  1684 + $categories = array_values($this->registry('Misc', 'array_unique', array($categories)));
1685 1685 }
1686 1686 elseif (is_array($categories_parent))
1687 1687 {
1688   - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
  1688 + $categories = array_values($this->registry('Misc', 'array_unique', array($categories_parent)));
1689 1689 }
1690 1690
1691 1691 // COPYRIGHTS
@@ -1750,7 +1750,7 @@ public function get_enclosures()
1750 1750 }
1751 1751 if (is_array($credits))
1752 1752 {
1753   - $credits = array_values(SimplePie_Misc::array_unique($credits));
  1753 + $credits = array_values($this->registry('Misc', 'array_unique', array($credits)));
1754 1754 }
1755 1755 }
1756 1756 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
@@ -1780,7 +1780,7 @@ public function get_enclosures()
1780 1780 }
1781 1781 if (is_array($credits))
1782 1782 {
1783   - $credits = array_values(SimplePie_Misc::array_unique($credits));
  1783 + $credits = array_values($this->registry('Misc', 'array_unique', array($credits)));
1784 1784 }
1785 1785 }
1786 1786 else
@@ -1825,7 +1825,7 @@ public function get_enclosures()
1825 1825 }
1826 1826 if (is_array($hashes))
1827 1827 {
1828   - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
  1828 + $hashes = array_values($this->registry('Misc', 'array_unique', array($hashes)));
1829 1829 }
1830 1830 }
1831 1831 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
@@ -1850,7 +1850,7 @@ public function get_enclosures()
1850 1850 }
1851 1851 if (is_array($hashes))
1852 1852 {
1853   - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
  1853 + $hashes = array_values($this->registry('Misc', 'array_unique', array($hashes)));
1854 1854 }
1855 1855 }
1856 1856 else
@@ -1872,7 +1872,7 @@ public function get_enclosures()
1872 1872 }
1873 1873 if (is_array($keywords))
1874 1874 {
1875   - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
  1875 + $keywords = array_values($this->registry('Misc', 'array_unique', array($keywords)));
1876 1876 }
1877 1877 }
1878 1878 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
@@ -1888,7 +1888,7 @@ public function get_enclosures()
1888 1888 }
1889 1889 if (is_array($keywords))
1890 1890 {
1891   - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
  1891 + $keywords = array_values($this->registry('Misc', 'array_unique', array($keywords)));
1892 1892 }
1893 1893 }
1894 1894 else
@@ -1933,7 +1933,7 @@ public function get_enclosures()
1933 1933 }
1934 1934 if (is_array($ratings))
1935 1935 {
1936   - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
  1936 + $ratings = array_values($this->registry('Misc', 'array_unique', array($ratings)));
1937 1937 }
1938 1938 }
1939 1939 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
@@ -1958,7 +1958,7 @@ public function get_enclosures()
1958 1958 }
1959 1959 if (is_array($ratings))
1960 1960 {
1961   - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
  1961 + $ratings = array_values($this->registry('Misc', 'array_unique', array($ratings)));
1962 1962 }
1963 1963 }
1964 1964 else
@@ -1990,7 +1990,7 @@ public function get_enclosures()
1990 1990 }
1991 1991 if (is_array($restrictions))
1992 1992 {
1993   - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
  1993 + $restrictions = array_values($this->registry('Misc', 'array_unique', array($restrictions)));
1994 1994 }
1995 1995 }
1996 1996 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
@@ -2016,7 +2016,7 @@ public function get_enclosures()
2016 2016 }
2017 2017 if (is_array($restrictions))
2018 2018 {
2019   - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
  2019 + $restrictions = array_values($this->registry('Misc', 'array_unique', array($restrictions)));
2020 2020 }
2021 2021 }
2022 2022 else
@@ -2033,7 +2033,7 @@ public function get_enclosures()
2033 2033 }
2034 2034 if (is_array($thumbnails))
2035 2035 {
2036   - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
  2036 + $thumbnails = array_values($this->registry('Misc', 'array_unique', array($thumbnails)));
2037 2037 }
2038 2038 }
2039 2039 elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
@@ -2044,7 +2044,7 @@ public function get_enclosures()
2044 2044 }
2045 2045 if (is_array($thumbnails))
2046 2046 {
2047   - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
  2047 + $thumbnails = array_values($this->registry('Misc', 'array_unique', array($thumbnails)));
2048 2048 }
2049 2049 }
2050 2050 else
@@ -2202,7 +2202,7 @@ public function get_enclosures()
2202 2202 }
2203 2203 if (is_array($captions))
2204 2204 {
2205   - $captions = array_values(SimplePie_Misc::array_unique($captions));
  2205 + $captions = array_values($this->registry('Misc', 'array_unique', array($captions)));
2206 2206 }
2207 2207 }
2208 2208 else
@@ -2239,15 +2239,15 @@ public function get_enclosures()
2239 2239 }
2240 2240 if (is_array($categories) && is_array($categories_parent))
2241 2241 {
2242   - $categories = array_values(SimplePie_Misc::array_unique(array_merge($categories, $categories_parent)));
  2242 + $categories = array_values($this->registry('Misc', 'array_unique', array(array_merge($categories, $categories_parent))));
2243 2243 }
2244 2244 elseif (is_array($categories))
2245 2245 {
2246   - $categories = array_values(SimplePie_Misc::array_unique($categories));
  2246 + $categories = array_values($this->registry('Misc', 'array_unique', array($categories)));
2247 2247 }
2248 2248 elseif (is_array($categories_parent))
2249 2249 {
2250   - $categories = array_values(SimplePie_Misc::array_unique($categories_parent));
  2250 + $categories = array_values($this->registry('Misc', 'array_unique', array($categories_parent)));
2251 2251 }
2252 2252 else
2253 2253 {
@@ -2302,7 +2302,7 @@ public function get_enclosures()
2302 2302 }
2303 2303 if (is_array($credits))
2304 2304 {
2305   - $credits = array_values(SimplePie_Misc::array_unique($credits));
  2305 + $credits = array_values($this->registry('Misc', 'array_unique', array($credits)));
2306 2306 }
2307 2307 }
2308 2308 else
@@ -2343,7 +2343,7 @@ public function get_enclosures()
2343 2343 }
2344 2344 if (is_array($hashes))
2345 2345 {
2346   - $hashes = array_values(SimplePie_Misc::array_unique($hashes));
  2346 + $hashes = array_values($this->registry('Misc', 'array_unique', array($hashes)));
2347 2347 }
2348 2348 }
2349 2349 else
@@ -2365,7 +2365,7 @@ public function get_enclosures()
2365 2365 }
2366 2366 if (is_array($keywords))
2367 2367 {
2368   - $keywords = array_values(SimplePie_Misc::array_unique($keywords));
  2368 + $keywords = array_values($this->registry('Misc', 'array_unique', array($keywords)));
2369 2369 }
2370 2370 }
2371 2371 else
@@ -2406,7 +2406,7 @@ public function get_enclosures()
2406 2406 }
2407 2407 if (is_array($ratings))
2408 2408 {
2409   - $ratings = array_values(SimplePie_Misc::array_unique($ratings));
  2409 + $ratings = array_values($this->registry('Misc', 'array_unique', array($ratings)));
2410 2410 }
2411 2411 }
2412 2412 else
@@ -2438,7 +2438,7 @@ public function get_enclosures()
2438 2438 }
2439 2439 if (is_array($restrictions))
2440 2440 {
2441   - $restrictions = array_values(SimplePie_Misc::array_unique($restrictions));
  2441 + $restrictions = array_values($this->registry('Misc', 'array_unique', array($restrictions)));
2442 2442 }
2443 2443 }
2444 2444 else
@@ -2455,7 +2455,7 @@ public function get_enclosures()
2455 2455 }
2456 2456 if (is_array($thumbnails))
2457 2457 {
2458   - $thumbnails = array_values(SimplePie_Misc::array_unique($thumbnails));
  2458 + $thumbnails = array_values($this->registry('Misc', 'array_unique', array($thumbnails)));
2459 2459 }
2460 2460 }
2461 2461 else
@@ -2589,7 +2589,7 @@ public function get_enclosures()
2589 2589 $this->data['enclosures'][] = $this->registry->create('Enclosure', array($url, $type, $length, null, $bitrate, $captions_parent, $categories_parent, $channels, $copyrights_parent, $credits_parent, $description_parent, $duration_parent, $expression, $framerate, $hashes_parent, $height, $keywords_parent, $lang, $medium, $player_parent, $ratings_parent, $restrictions_parent, $samplingrate, $thumbnails_parent, $title_parent, $width));
2590 2590 }
2591 2591
2592   - $this->data['enclosures'] = array_values(SimplePie_Misc::array_unique($this->data['enclosures']));
  2592 + $this->data['enclosures'] = array_values($this->registry('Misc', 'array_unique', array($this->data['enclosures'])));
2593 2593 }
2594 2594 if (!empty($this->data['enclosures']))
2595 2595 {
18 SimplePie/Locator.php
@@ -169,7 +169,7 @@ public function get_base()
169 169 {
170 170 if ($element->hasAttribute('href'))
171 171 {
172   - $this->base = SimplePie_Misc::absolutize_url(trim($element->getAttribute('href')), $this->http_base);
  172 + $this->base = $this->registry->call('Misc', 'absolutize_url', array(trim($element->getAttribute('href')), $this->http_base));
173 173 $this->base_location = $element->getLineNo();
174 174 break;
175 175 }
@@ -205,18 +205,18 @@ protected function search_elements_by_tag($name, &$done, $feeds)
205 205 }
206 206 if ($link->hasAttribute('href') && $link->hasAttribute('rel'))
207 207 {
208   - $rel = array_unique(SimplePie_Misc::space_seperated_tokens(strtolower($link->getAttribute('rel'))));
  208 + $rel = array_unique($this->registry->call('Misc', 'space_seperated_tokens', array(strtolower($link->getAttribute('rel')))));
209 209
210 210 if ($this->base_location < $link->getLineNo())
211 211 {
212   - $href = SimplePie_Misc::absolutize_url(trim($link->getAttribute('href')), $this->base);
  212 + $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
213 213 }
214 214 else
215 215 {
216   - $href = SimplePie_Misc::absolutize_url(trim($link->getAttribute('href')), $this->http_base);
  216 + $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
217 217 }
218 218
219   - if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower(SimplePie_Misc::parse_mime($link->getAttribute('type'))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
  219 + if (!in_array($href, $done) && in_array('feed', $rel) || (in_array('alternate', $rel) && !in_array('stylesheet', $rel) && $link->hasAttribute('type') && in_array(strtolower($this->registry->call('Misc', 'parse_mime', array($link->getAttribute('type')))), array('application/rss+xml', 'application/atom+xml'))) && !isset($feeds[$href]))
220 220 {
221 221 $this->checked_feeds++;
222 222 $headers = array(
@@ -243,19 +243,19 @@ public function get_links()
243 243 if ($link->hasAttribute('href'))
244 244 {
245 245 $href = trim($link->getAttribute('href'));
246   - $parsed = SimplePie_Misc::parse_url($href);
  246 + $parsed = $this->registry->call('Misc', 'parse_url', array($href));
247 247 if ($parsed['scheme'] === '' || preg_match('/^(http(s)|feed)?$/i', $parsed['scheme']))
248 248 {
249 249 if ($this->base_location < $link->getLineNo())
250 250 {
251   - $href = SimplePie_Misc::absolutize_url(trim($link->getAttribute('href')), $this->base);
  251 + $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->base));
252 252 }
253 253 else
254 254 {
255   - $href = SimplePie_Misc::absolutize_url(trim($link->getAttribute('href')), $this->http_base);
  255 + $href = $this->registry->call('Misc', 'absolutize_url', array(trim($link->getAttribute('href')), $this->http_base));
256 256 }
257 257
258   - $current = SimplePie_Misc::parse_url($this->file->url);
  258 + $current = $this->registry->call('Misc', 'parse_url', array($this->file->url));
259 259
260 260 if ($parsed['authority'] === '' || $parsed['authority'] === $current['authority'])
261 261 {
3  SimplePie/Registry.php
@@ -76,7 +76,8 @@ class SimplePie_Registry
76 76 'Content_Type_Sniffer' => 'SimplePie_Content_Type_Sniffer',
77 77 'Source' => 'SimplePie_Source',
78 78 'Misc' => 'SimplePie_Misc',
79   - 'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser'
  79 + 'XML_Declaration_Parser' => 'SimplePie_XML_Declaration_Parser',
  80 + 'Parse_Date' => 'SimplePie_Parse_Date',
80 81 );
81 82
82 83 /**
6 SimplePie/Sanitize.php
@@ -344,7 +344,7 @@ public function sanitize($data, $type, $base = '')
344 344
345 345 if ($type & SIMPLEPIE_CONSTRUCT_IRI)
346 346 {
347   - $data = SimplePie_Misc::absolutize_url($data, $base);
  347 + $data = $this->registry->call('Misc', 'absolutize_url', array($data, $base));
348 348 }
349 349
350 350 if ($type & (SIMPLEPIE_CONSTRUCT_TEXT | SIMPLEPIE_CONSTRUCT_IRI))
@@ -354,7 +354,7 @@ public function sanitize($data, $type, $base = '')
354 354
355 355 if ($this->output_encoding !== 'UTF-8')
356 356 {
357   - $data = SimplePie_Misc::change_encoding($data, 'UTF-8', $this->output_encoding);
  357 + $data = $this->registry->call('Misc', 'change_encoding', array($data, 'UTF-8', $this->output_encoding));
358 358 }
359 359 }
360 360 return $data;
@@ -399,7 +399,7 @@ public function replace_urls(&$document, $tag, $attributes)
399 399 {
400 400 if ($element->hasAttribute($attribute))
401 401 {
402   - $value = SimplePie_Misc::absolutize_url($element->getAttribute($attribute), $this->base);
  402 + $value = $this->registry->call('Misc', 'absolutize_url', array($element->getAttribute($attribute), $this->base));
403 403 $element->setAttribute($attribute, $value);
404 404 }
405 405 }
48 SimplePie/Source.php
@@ -55,6 +55,7 @@ class SimplePie_Source
55 55 {
56 56 var $item;
57 57 var $data = array();
  58 + protected $registry;
58 59
59 60 public function __construct($item, $data)
60 61 {
@@ -62,6 +63,11 @@ public function __construct($item, $data)
62 63 $this->data = $data;
63 64 }
64 65
  66 + public function set_registry(&$registry)
  67 + {
  68 + $this->registry = &$registry;
  69 + }
  70 +
65 71 public function __toString()
66 72 {
67 73 return md5(serialize($this->data));
@@ -98,11 +104,11 @@ public function get_title()
98 104 {
99 105 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
100 106 {
101   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  107 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
102 108 }
103 109 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
104 110 {
105   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  111 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
106 112 }
107 113 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
108 114 {
@@ -164,7 +170,7 @@ public function get_categories()
164 170 {
165 171 $label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
166 172 }
167   - $categories[] = new $this->item->feed->category_class($term, $scheme, $label);
  173 + $categories[] = $this->registry->create('Category', array($term, $scheme, $label));
168 174 }
169 175 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
170 176 {
@@ -179,20 +185,20 @@ public function get_categories()
179 185 {
180 186 $scheme = null;
181 187 }
182   - $categories[] = new $this->item->feed->category_class($term, $scheme, null);
  188 + $categories[] = $this->registry->create('Category', array($term, $scheme, null));
183 189 }
184 190 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'subject') as $category)
185 191 {
186   - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
  192 + $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
187 193 }
188 194 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'subject') as $category)
189 195 {
190   - $categories[] = new $this->item->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
  196 + $categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
191 197 }
192 198
193 199 if (!empty($categories))
194 200 {
195   - return SimplePie_Misc::array_unique($categories);
  201 + return $this->registry->call('Misc', 'array_unique', array($categories));
196 202 }
197 203 else
198 204 {
@@ -235,7 +241,7 @@ public function get_authors()
235 241 }
236 242 if ($name !== null || $email !== null || $uri !== null)
237 243 {
238   - $authors[] = new $this->item->feed->author_class($name, $uri, $email);
  244 + $authors[] = $this->registry->create('Author', array($name, $uri, $email));
239 245 }
240 246 }
241 247 if ($author = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
@@ -257,25 +263,25 @@ public function get_authors()
257 263 }
258 264 if ($name !== null || $email !== null || $url !== null)
259 265 {
260   - $authors[] = new $this->item->feed->author_class($name, $url, $email);
  266 + $authors[] = $this->registry->create('Author', array($name, $url, $email));
261 267 }
262 268 }
263 269 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
264 270 {
265   - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
  271 + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
266 272 }
267 273 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
268 274 {
269   - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
  275 + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
270 276 }
271 277 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
272 278 {
273   - $authors[] = new $this->item->feed->author_class($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);
  279 + $authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
274 280 }
275 281
276 282 if (!empty($authors))
277 283 {
278   - return SimplePie_Misc::array_unique($authors);
  284 + return $this->registry->call('Misc', 'array_unique', array($authors));
279 285 }
280 286 else
281 287 {
@@ -318,7 +324,7 @@ public function get_contributors()
318 324 }
319 325 if ($name !== null || $email !== null || $uri !== null)
320 326 {
321   - $contributors[] = new $this->item->feed->author_class($name, $uri, $email);
  327 + $contributors[] = $this->registry->create('Author', array($name, $uri, $email));
322 328 }
323 329 }
324 330 foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
@@ -340,13 +346,13 @@ public function get_contributors()
340 346 }
341 347 if ($name !== null || $email !== null || $url !== null)
342 348 {
343   - $contributors[] = new $this->item->feed->author_class($name, $url, $email);
  349 + $contributors[] = $this->registry->create('Author', array($name, $url, $email));
344 350 }
345 351 }
346 352
347 353 if (!empty($contributors))
348 354 {
349   - return SimplePie_Misc::array_unique($contributors);
  355 + return $this->registry->call('Misc', 'array_unique', array($contributors));
350 356 }
351 357 else
352 358 {
@@ -419,7 +425,7 @@ public function get_links($rel = 'alternate')
419 425 $keys = array_keys($this->data['links']);
420 426 foreach ($keys as $key)
421 427 {
422   - if (SimplePie_Misc::is_isegment_nz_nc($key))
  428 + if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
423 429 {
424 430 if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
425 431 {
@@ -453,11 +459,11 @@ public function get_description()
453 459 {
454 460 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'subtitle'))
455 461 {
456   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  462 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
457 463 }
458 464 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'tagline'))
459 465 {
460   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  466 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
461 467 }
462 468 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
463 469 {
@@ -497,11 +503,11 @@ public function get_copyright()
497 503 {
498 504 if ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
499 505 {
500   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_10_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  506 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
501 507 }
502 508 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'copyright'))
503 509 {
504   - return $this->sanitize($return[0]['data'], SimplePie_Misc::atom_03_construct_type($return[0]['attribs']), $this->get_base($return[0]));
  510 + return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
505 511 }
506 512 elseif ($return = $this->get_source_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'copyright'))
507 513 {

0 comments on commit 6e87690

Please sign in to comment.
Something went wrong with that request. Please try again.