Added a separate error message for mkdir failures
[lhc/web/wiklou.git] / includes / libs / XmlTypeCheck.php
index 6d01986..34afb68 100644 (file)
@@ -38,6 +38,13 @@ class XmlTypeCheck {
         */
        public $filterMatch = false;
 
+       /**
+        * Will contain the type of filter hit if the optional element filter returned
+        * a match at some point.
+        * @var mixed
+        */
+       public $filterMatchType = false;
+
        /**
         * Name of the document's root element, including any namespace
         * as an expanded URL.
@@ -173,7 +180,7 @@ class XmlTypeCheck {
                // First, move through anything that isn't an element, and
                // handle any processing instructions with the callback
                do {
-                       if( !$this->readNext( $reader ) ) {
+                       if ( !$this->readNext( $reader ) ) {
                                // Hit the end of the document before any elements
                                $this->wellFormed = false;
                                return;
@@ -294,17 +301,20 @@ class XmlTypeCheck {
                list( $name, $attribs ) = array_pop( $this->elementDataContext );
                $data = array_pop( $this->elementData );
                $this->stackDepth--;
+               $callbackReturn = false;
 
-               if ( is_callable( $this->filterCallback )
-                       && call_user_func(
+               if ( is_callable( $this->filterCallback ) ) {
+                       $callbackReturn = call_user_func(
                                $this->filterCallback,
                                $name,
                                $attribs,
                                $data
-                       )
-               ) {
-                       // Filter hit
+                       );
+               }
+               if ( $callbackReturn ) {
+                       // Filter hit!
                        $this->filterMatch = true;
+                       $this->filterMatchType = $callbackReturn;
                }
        }
 
@@ -321,15 +331,18 @@ class XmlTypeCheck {
         * @param $data
         */
        private function processingInstructionHandler( $target, $data ) {
+               $callbackReturn = false;
                if ( $this->parserOptions['processing_instruction_handler'] ) {
-                       if ( call_user_func(
+                       $callbackReturn = call_user_func(
                                $this->parserOptions['processing_instruction_handler'],
                                $target,
                                $data
-                       ) ) {
-                               // Filter hit!
-                               $this->filterMatch = true;
-                       }
+                       );
+               }
+               if ( $callbackReturn ) {
+                       // Filter hit!
+                       $this->filterMatch = true;
+                       $this->filterMatchType = $callbackReturn;
                }
        }
 }