]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/class-simplepie.php
Wizard 2.8.2-scripts
[autoinstalls/wordpress.git] / wp-includes / class-simplepie.php
index 21cc5d24eb02247a0c3c68212a8e1b63420f741b..88050b3916efebff0024bc0ae3e214dd4180d870 100644 (file)
@@ -751,21 +751,24 @@ class SimplePie
         */
        function __destruct()
        {
-               if (!empty($this->data['items']))
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
                {
-                       foreach ($this->data['items'] as $item)
+                       if (!empty($this->data['items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['items']);
                        }
-                       unset($this->data['items']);
-               }
-               if (!empty($this->data['ordered_items']))
-               {
-                       foreach ($this->data['ordered_items'] as $item)
+                       if (!empty($this->data['ordered_items']))
                        {
-                               $item->__destruct();
+                               foreach ($this->data['ordered_items'] as $item)
+                               {
+                                       $item->__destruct();
+                               }
+                               unset($item, $this->data['ordered_items']);
                        }
-                       unset($this->data['ordered_items']);
                }
        }
 
@@ -1683,7 +1686,7 @@ function embed_wmedia(width, height, link) {
 
                                $headers = $file->headers;
                                $data = $file->body;
-                               $sniffer = new $this->content_type_sniffer_class($file);
+                               $sniffer =& new $this->content_type_sniffer_class($file);
                                $sniffed = $sniffer->get_type();
                        }
                        else
@@ -1961,7 +1964,7 @@ function embed_wmedia(width, height, link) {
 
                                        if ($file->success && ($file->status_code == 200 || ($file->status_code > 206 && $file->status_code < 300)) && strlen($file->body) > 0)
                                        {
-                                               $sniffer = new $this->content_type_sniffer_class($file);
+                                               $sniffer =& new $this->content_type_sniffer_class($file);
                                                if (substr($sniffer->get_type(), 0, 6) === 'image/')
                                                {
                                                        if ($cache->save(array('headers' => $file->headers, 'body' => $file->body)))
@@ -3082,7 +3085,10 @@ class SimplePie_Item
         */
        function __destruct()
        {
-               unset($this->feed);
+               if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
+               {
+                       unset($this->feed);
+               }
        }
 
        function get_item_tags($namespace, $tag)
@@ -5682,14 +5688,6 @@ class SimplePie_Source
                return md5(serialize($this->data));
        }
 
-       /**
-        * Remove items that link back to this before destroying this object
-        */
-       function __destruct()
-       {
-               unset($this->item);
-       }
-
        function get_source_tags($namespace, $tag)
        {
                if (isset($this->data['child'][$namespace][$tag]))
@@ -7746,7 +7744,7 @@ class SimplePie_File
                                                                {
                                                                        case 'gzip':
                                                                        case 'x-gzip':
-                                                                               $decoder = new SimplePie_gzdecode($this->body);
+                                                                               $decoder =& new SimplePie_gzdecode($this->body);
                                                                                if (!$decoder->parse())
                                                                                {
                                                                                        $this->error = 'Unable to decode HTTP "gzip" stream';
@@ -8954,23 +8952,12 @@ class SimplePie_Misc
 
        function parse_url($url)
        {
-               static $cache = array();
-               if (isset($cache[$url]))
-               {
-                       return $cache[$url];
-               }
-               elseif (preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match))
+               preg_match('/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/', $url, $match);
+               for ($i = count($match); $i <= 9; $i++)
                {
-                       for ($i = count($match); $i <= 9; $i++)
-                       {
-                               $match[$i] = '';
-                       }
-                       return $cache[$url] = array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
-               }
-               else
-               {
-                       return $cache[$url] = array('scheme' => '', 'authority' => '', 'path' => '', 'query' => '', 'fragment' => '');
+                       $match[$i] = '';
                }
+               return array('scheme' => $match[2], 'authority' => $match[4], 'path' => $match[5], 'query' => $match[7], 'fragment' => $match[9]);
        }
 
        function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
@@ -10555,7 +10542,7 @@ class SimplePie_Misc
         */
        function entities_decode($data)
        {
-               $decoder = new SimplePie_Decode_HTML_Entities($data);
+               $decoder =& new SimplePie_Decode_HTML_Entities($data);
                return $decoder->parse();
        }
 
@@ -10809,36 +10796,31 @@ class SimplePie_Misc
         */
        function codepoint_to_utf8($codepoint)
        {
-               static $cache = array();
                $codepoint = (int) $codepoint;
-               if (isset($cache[$codepoint]))
-               {
-                       return $cache[$codepoint];
-               }
-               elseif ($codepoint < 0)
+               if ($codepoint < 0)
                {
-                       return $cache[$codepoint] = false;
+                       return false;
                }
                else if ($codepoint <= 0x7f)
                {
-                       return $cache[$codepoint] = chr($codepoint);
+                       return chr($codepoint);
                }
                else if ($codepoint <= 0x7ff)
                {
-                       return $cache[$codepoint] = chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else if ($codepoint <= 0xffff)
                {
-                       return $cache[$codepoint] = chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else if ($codepoint <= 0x10ffff)
                {
-                       return $cache[$codepoint] = chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
+                       return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
                }
                else
                {
                        // U+FFFD REPLACEMENT CHARACTER
-                       return $cache[$codepoint] = "\xEF\xBF\xBD";
+                       return "\xEF\xBF\xBD";
                }
        }
 
@@ -10956,7 +10938,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10969,7 +10951,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10982,7 +10964,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -10995,7 +10977,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
+                               $parser =& new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8'));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -11008,7 +10990,7 @@ class SimplePie_Misc
                {
                        if ($pos = strpos($data, "\x3F\x3E"))
                        {
-                               $parser = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                               $parser =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
                                if ($parser->parse())
                                {
                                        $encoding[] = $parser->encoding;
@@ -11734,20 +11716,7 @@ class SimplePie_Parse_Date
                static $cache;
                if (!isset($cache[get_class($this)]))
                {
-                       if (extension_loaded('Reflection'))
-                       {
-                               $class = new ReflectionClass(get_class($this));
-                               $methods = $class->getMethods();
-                               $all_methods = array();
-                               foreach ($methods as $method)
-                               {
-                                       $all_methods[] = $method->getName();
-                               }
-                       }
-                       else
-                       {
-                               $all_methods = get_class_methods($this);
-                       }
+                       $all_methods = get_class_methods($this);
 
                        foreach ($all_methods as $method)
                        {
@@ -11774,7 +11743,7 @@ class SimplePie_Parse_Date
                static $object;
                if (!$object)
                {
-                       $object = new SimplePie_Parse_Date;
+                       $object =& new SimplePie_Parse_Date;
                }
                return $object;
        }
@@ -12809,7 +12778,7 @@ class SimplePie_Locator
 
                if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
                {
-                       $sniffer = new $this->content_type_sniffer_class($this->file);
+                       $sniffer =& new $this->content_type_sniffer_class($this->file);
                        if ($sniffer->get_type() !== 'text/html')
                        {
                                return null;
@@ -12855,7 +12824,7 @@ class SimplePie_Locator
        {
                if ($file->method & SIMPLEPIE_FILE_SOURCE_REMOTE)
                {
-                       $sniffer = new $this->content_type_sniffer_class($file);
+                       $sniffer =& new $this->content_type_sniffer_class($file);
                        $sniffed = $sniffer->get_type();
                        if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml')))
                        {
@@ -13083,7 +13052,7 @@ class SimplePie_Parser
 
                if (substr($data, 0, 5) === '<?xml' && strspn(substr($data, 5, 1), "\x09\x0A\x0D\x20") && ($pos = strpos($data, '?>')) !== false)
                {
-                       $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
+                       $declaration =& new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5));
                        if ($declaration->parse())
                        {
                                $data = substr($data, $pos + 2);
@@ -13669,4 +13638,4 @@ class SimplePie_Sanitize
        }
 }
 
-?>
\ No newline at end of file
+?>