Changes from trunk/wp-includes/class-simplepie.php at r10747 to branches/2.8/wp-includes/class-simplepie.php at r11658
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.8/wp-includes/class-simplepie.php
r10747 r11658 752 752 function __destruct() 753 753 { 754 if (!empty($this->data['items'])) 755 { 756 foreach ($this->data['items'] as $item) 757 { 758 $item->__destruct(); 759 } 760 unset($this->data['items']); 761 } 762 if (!empty($this->data['ordered_items'])) 763 { 764 foreach ($this->data['ordered_items'] as $item) 765 { 766 $item->__destruct(); 767 } 768 unset($this->data['ordered_items']); 754 if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) 755 { 756 if (!empty($this->data['items'])) 757 { 758 foreach ($this->data['items'] as $item) 759 { 760 $item->__destruct(); 761 } 762 unset($item, $this->data['items']); 763 } 764 if (!empty($this->data['ordered_items'])) 765 { 766 foreach ($this->data['ordered_items'] as $item) 767 { 768 $item->__destruct(); 769 } 770 unset($item, $this->data['ordered_items']); 771 } 769 772 } 770 773 } … … 1684 1687 $headers = $file->headers; 1685 1688 $data = $file->body; 1686 $sniffer = new $this->content_type_sniffer_class($file);1689 $sniffer =& new $this->content_type_sniffer_class($file); 1687 1690 $sniffed = $sniffer->get_type(); 1688 1691 } … … 1962 1965 if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0) 1963 1966 { 1964 $sniffer = new $this->content_type_sniffer_class($file);1967 $sniffer =& new $this->content_type_sniffer_class($file); 1965 1968 if (substr($sniffer->get_type(), 0, 6) === 'image/') 1966 1969 { … … 3083 3086 function __destruct() 3084 3087 { 3085 unset($this->feed); 3088 if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode')) 3089 { 3090 unset($this->feed); 3091 } 3086 3092 } 3087 3093 … … 5683 5689 } 5684 5690 5685 /**5686 * Remove items that link back to this before destroying this object5687 */5688 function __destruct()5689 {5690 unset($this->item);5691 }5692 5693 5691 function get_source_tags($namespace, $tag) 5694 5692 { … … 7747 7745 case 'gzip': 7748 7746 case 'x-gzip': 7749 $decoder = new SimplePie_gzdecode($this->body);7747 $decoder =& new SimplePie_gzdecode($this->body); 7750 7748 if (!$decoder->parse()) 7751 7749 { … … 8955 8953 function parse_url($url) 8956 8954 { 8957 static $cache = array(); 8958 if (isset($cache[$url])) 8959 { 8960 return $cache[$url]; 8961 } 8962 elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match)) 8963 { 8964 for ($i = count($match); $i <= 9; $i++) 8965 { 8966 $match[$i] = ''; 8967 } 8968 return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]); 8969 } 8970 else 8971 { 8972 return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => ''); 8973 } 8955 preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match); 8956 for ($i = count($match); $i <= 9; $i++) 8957 { 8958 $match[$i] = ''; 8959 } 8960 return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]); 8974 8961 } 8975 8962 … … 10556 10543 function entities_decode($data) 10557 10544 { 10558 $decoder = new SimplePie_Decode_HTML_Entities($data);10545 $decoder =& new SimplePie_Decode_HTML_Entities($data); 10559 10546 return $decoder->parse(); 10560 10547 } … … 10810 10797 function codepoint_to_utf8($codepoint) 10811 10798 { 10812 static $cache = array();10813 10799 $codepoint = (int) $codepoint; 10814 if (isset($cache[$codepoint])) 10815 { 10816 return $cache[$codepoint]; 10817 } 10818 elseif ($codepoint < 0) 10819 { 10820 return $cache[$codepoint] = false; 10800 if ($codepoint < 0) 10801 { 10802 return false; 10821 10803 } 10822 10804 else if ($codepoint <= 0x7f) 10823 10805 { 10824 return $cache[$codepoint] =chr($codepoint);10806 return chr($codepoint); 10825 10807 } 10826 10808 else if ($codepoint <= 0x7ff) 10827 10809 { 10828 return $cache[$codepoint] =chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));10810 return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f)); 10829 10811 } 10830 10812 else if ($codepoint <= 0xffff) 10831 10813 { 10832 return $cache[$codepoint] =chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));10814 return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 10833 10815 } 10834 10816 else if ($codepoint <= 0x10ffff) 10835 10817 { 10836 return $cache[$codepoint] =chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));10818 return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f)); 10837 10819 } 10838 10820 else 10839 10821 { 10840 10822 // U+FFFD REPLACEMENT CHARACTER 10841 return $cache[$codepoint] ="\xEF\xBF\xBD";10823 return "\xEF\xBF\xBD"; 10842 10824 } 10843 10825 } … … 10957 10939 if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E")) 10958 10940 { 10959 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));10941 $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')); 10960 10942 if ($parser->parse()) 10961 10943 { … … 10970 10952 if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00")) 10971 10953 { 10972 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));10954 $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')); 10973 10955 if ($parser->parse()) 10974 10956 { … … 10983 10965 if ($pos = strpos($data, "\x00\x3F\x00\x3E")) 10984 10966 { 10985 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));10967 $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')); 10986 10968 if ($parser->parse()) 10987 10969 { … … 10996 10978 if ($pos = strpos($data, "\x3F\x00\x3E\x00")) 10997 10979 { 10998 $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));10980 $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')); 10999 10981 if ($parser->parse()) 11000 10982 { … … 11009 10991 if ($pos = strpos($data, "\x3F\x3E")) 11010 10992 { 11011 $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));10993 $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 11012 10994 if ($parser->parse()) 11013 10995 { … … 11735 11717 if (!isset($cache[get_class($this)])) 11736 11718 { 11737 if (extension_loaded('Reflection')) 11738 { 11739 $class = new ReflectionClass(get_class($this)); 11740 $methods = $class->getMethods(); 11741 $all_methods = array(); 11742 foreach ($methods as $method) 11743 { 11744 $all_methods[] = $method->getName(); 11745 } 11746 } 11747 else 11748 { 11749 $all_methods = get_class_methods($this); 11750 } 11719 $all_methods = get_class_methods($this); 11751 11720 11752 11721 foreach ($all_methods as $method) … … 11775 11744 if (!$object) 11776 11745 { 11777 $object = new SimplePie_Parse_Date;11746 $object =& new SimplePie_Parse_Date; 11778 11747 } 11779 11748 return $object; … … 12810 12779 if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 12811 12780 { 12812 $sniffer = new $this->content_type_sniffer_class($this->file);12781 $sniffer =& new $this->content_type_sniffer_class($this->file); 12813 12782 if ($sniffer->get_type() !== 'text/html') 12814 12783 { … … 12856 12825 if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) 12857 12826 { 12858 $sniffer = new $this->content_type_sniffer_class($file);12827 $sniffer =& new $this->content_type_sniffer_class($file); 12859 12828 $sniffed = $sniffer->get_type(); 12860 12829 if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) … … 13084 13053 if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false) 13085 13054 { 13086 $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));13055 $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); 13087 13056 if ($declaration->parse()) 13088 13057 {
Note: See TracChangeset
for help on using the changeset viewer.