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