]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/atomlib.php
WordPress 4.7
[autoinstalls/wordpress.git] / wp-includes / atomlib.php
index c6f2f24750d74ad578c58ca373dc7318f3e99e37..f2cba56361aaac15a45c5197f0cba3fdca568731 100644 (file)
@@ -7,7 +7,7 @@
  *
  * @author Elias Torres <elias@torrez.us>
  * @version 0.4
  *
  * @author Elias Torres <elias@torrez.us>
  * @version 0.4
- * @since 2.3
+ * @since 2.3.0
  */
 
 /**
  */
 
 /**
@@ -87,7 +87,10 @@ class AtomParser {
     var $feed;
     var $current;
 
     var $feed;
     var $current;
 
-    function AtomParser() {
+       /**
+        * PHP5 constructor.
+        */
+    function __construct() {
 
         $this->feed = new AtomFeed();
         $this->current = null;
 
         $this->feed = new AtomFeed();
         $this->current = null;
@@ -95,6 +98,13 @@ class AtomParser {
         $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
     }
 
         $this->map_xmlns_func = create_function('$p,$n', '$xd = "xmlns"; if(strlen($n[0])>0) $xd .= ":{$n[0]}"; return "{$xd}=\"{$n[1]}\"";');
     }
 
+       /**
+        * PHP4 constructor.
+        */
+       public function AtomParser() {
+               self::__construct();
+       }
+
     function _p($msg) {
         if($this->debug) {
             print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n";
     function _p($msg) {
         if($this->debug) {
             print str_repeat(" ", $this->depth * $this->indent) . $msg ."\n";
@@ -111,6 +121,11 @@ class AtomParser {
 
         array_unshift($this->ns_contexts, array());
 
 
         array_unshift($this->ns_contexts, array());
 
+        if ( ! function_exists( 'xml_parser_create_ns' ) ) {
+               trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
+               return false;
+        }
+
         $parser = xml_parser_create_ns();
         xml_set_object($parser, $this);
         xml_set_element_handler($parser, "start_element", "end_element");
         $parser = xml_parser_create_ns();
         xml_set_object($parser, $this);
         xml_set_element_handler($parser, "start_element", "end_element");
@@ -130,9 +145,10 @@ class AtomParser {
             if($this->debug) $this->content .= $data;
 
             if(!xml_parse($parser, $data, feof($fp))) {
             if($this->debug) $this->content .= $data;
 
             if(!xml_parse($parser, $data, feof($fp))) {
-                trigger_error(sprintf(__('XML error: %s at line %d')."\n",
-                    xml_error_string(xml_get_error_code($xml_parser)),
-                    xml_get_current_line_number($xml_parser)));
+                /* translators: 1: error message, 2: line number */
+                trigger_error(sprintf(__('XML Error: %1$s at line %2$s')."\n",
+                    xml_error_string(xml_get_error_code($parser)),
+                    xml_get_current_line_number($parser)));
                 $ret = false;
                 break;
             }
                 $ret = false;
                 break;
             }
@@ -148,7 +164,7 @@ class AtomParser {
 
     function start_element($parser, $name, $attrs) {
 
 
     function start_element($parser, $name, $attrs) {
 
-        $tag = array_pop(split(":", $name));
+        $tag = array_pop(explode(":", $name));
 
         switch($name) {
             case $this->NS . ':feed':
 
         switch($name) {
             case $this->NS . ':feed':
@@ -227,7 +243,7 @@ class AtomParser {
 
     function end_element($parser, $name) {
 
 
     function end_element($parser, $name) {
 
-        $tag = array_pop(split(":", $name));
+        $tag = array_pop(explode(":", $name));
 
         $ccount = count($this->in_content);
 
 
         $ccount = count($this->in_content);
 
@@ -302,7 +318,7 @@ class AtomParser {
 
     function ns_to_prefix($qname, $attr=false) {
         # split 'http://www.w3.org/1999/xhtml:div' into ('http','//www.w3.org/1999/xhtml','div')
 
     function ns_to_prefix($qname, $attr=false) {
         # split 'http://www.w3.org/1999/xhtml:div' into ('http','//www.w3.org/1999/xhtml','div')
-        $components = split(":", $qname);
+        $components = explode(":", $qname);
 
         # grab the last one (e.g 'div')
         $name = array_pop($components);
 
         # grab the last one (e.g 'div')
         $name = array_pop($components);