From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/media/SVGMetadataExtractor.php | 64 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'includes/media/SVGMetadataExtractor.php') diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 0de212b9..2e33bb98 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -101,7 +101,7 @@ class SVGReader { wfSuppressWarnings(); try { $this->read(); - } catch( Exception $e ) { + } catch ( Exception $e ) { // Note, if this happens, the width/height will be taken to be 0x0. // Should we consider it the default 512x512 instead? wfRestoreWarnings(); @@ -128,12 +128,12 @@ class SVGReader { $keepReading = $this->reader->read(); /* Skip until first element */ - while( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) { + while ( $keepReading && $this->reader->nodeType != XmlReader::ELEMENT ) { $keepReading = $this->reader->read(); } if ( $this->reader->localName != 'svg' || $this->reader->namespaceURI != self::NS_SVG ) { - throw new MWException( "Expected tag, got ". + throw new MWException( "Expected tag, got " . $this->reader->localName . " in NS " . $this->reader->namespaceURI ); } $this->debug( " tag is correct." ); @@ -144,7 +144,7 @@ class SVGReader { while ( $keepReading ) { $tag = $this->reader->localName; $type = $this->reader->nodeType; - $isSVG = ($this->reader->namespaceURI == self::NS_SVG); + $isSVG = ( $this->reader->namespaceURI == self::NS_SVG ); $this->debug( "$tag" ); @@ -185,16 +185,16 @@ class SVGReader { * @param string $name of the element that we are reading from * @param string $metafield that we will fill with the result */ - private function readField( $name, $metafield=null ) { - $this->debug ( "Read field $metafield" ); - if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + private function readField( $name, $metafield = null ) { + $this->debug( "Read field $metafield" ); + if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { return; } $keepReading = $this->reader->read(); - while( $keepReading ) { - if( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) { + while ( $keepReading ) { + if ( $this->reader->localName == $name && $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::END_ELEMENT ) { break; - } elseif( $this->reader->nodeType == XmlReader::TEXT ) { + } elseif ( $this->reader->nodeType == XmlReader::TEXT ) { $this->metadata[$metafield] = trim( $this->reader->value ); } $keepReading = $this->reader->read(); @@ -207,13 +207,13 @@ class SVGReader { * @param string $metafield that we will fill with the result * @throws MWException */ - private function readXml( $metafield=null ) { - $this->debug ( "Read top level metadata" ); - if( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + private function readXml( $metafield = null ) { + $this->debug( "Read top level metadata" ); + if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { return; } // TODO: find and store type of xml snippet. metadata['metadataType'] = "rdf" - if( method_exists( $this->reader, 'readInnerXML' ) ) { + if ( method_exists( $this->reader, 'readInnerXML' ) ) { $this->metadata[$metafield] = trim( $this->reader->readInnerXML() ); } else { throw new MWException( "The PHP XMLReader extension does not come with readInnerXML() method. Your libxml is probably out of date (need 2.6.20 or later)." ); @@ -227,8 +227,8 @@ class SVGReader { * @param string $name of the element that we are reading from */ private function animateFilter( $name ) { - $this->debug ( "animate filter for tag $name" ); - if( $this->reader->nodeType != XmlReader::ELEMENT ) { + $this->debug( "animate filter for tag $name" ); + if ( $this->reader->nodeType != XmlReader::ELEMENT ) { return; } if ( $this->reader->isEmptyElement ) { @@ -236,12 +236,12 @@ class SVGReader { } $exitDepth = $this->reader->depth; $keepReading = $this->reader->read(); - while( $keepReading ) { - if( $this->reader->localName == $name && $this->reader->depth <= $exitDepth + while ( $keepReading ) { + if ( $this->reader->localName == $name && $this->reader->depth <= $exitDepth && $this->reader->nodeType == XmlReader::END_ELEMENT ) { break; } elseif ( $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XmlReader::ELEMENT ) { - switch( $this->reader->localName ) { + switch ( $this->reader->localName ) { case 'script': // Normally we disallow files with //