X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FSVGMetadataExtractor.php;h=6c53bc59e9cfd9adf5a14962789d17c1cdaad719;hb=e7c9096ecc084bb81a99d3acc949c32b0ef49d56;hp=2a1091d81d4d750654bb8c4e93d78e2f8594d781;hpb=166191535f486569277e95b7e6a3850b5db6757d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 2a1091d81d..6c53bc59e9 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -108,17 +108,17 @@ class SVGReader { // Because we cut off the end of the svg making an invalid one. Complicated // try catch thing to make sure warnings get restored. Seems like there should // be a better way. - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); try { $this->read(); } 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(); + MediaWiki\restoreWarnings(); libxml_disable_entity_loader( $oldDisable ); throw $e; } - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); libxml_disable_entity_loader( $oldDisable ); } @@ -138,7 +138,7 @@ 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(); } @@ -158,7 +158,7 @@ class SVGReader { $this->debug( "$tag" ); - if ( $isSVG && $tag == 'svg' && $type == XmlReader::END_ELEMENT + if ( $isSVG && $tag == 'svg' && $type == XMLReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) { break; @@ -166,7 +166,7 @@ class SVGReader { $this->readField( $tag, 'title' ); } elseif ( $isSVG && $tag == 'desc' ) { $this->readField( $tag, 'description' ); - } elseif ( $isSVG && $tag == 'metadata' && $type == XmlReader::ELEMENT ) { + } elseif ( $isSVG && $tag == 'metadata' && $type == XMLReader::ELEMENT ) { $this->readXml( $tag, 'metadata' ); } elseif ( $isSVG && $tag == 'script' ) { // We normally do not allow scripted svgs. @@ -199,17 +199,17 @@ class SVGReader { */ private function readField( $name, $metafield = null ) { $this->debug( "Read field $metafield" ); - if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + 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 + && $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(); @@ -224,7 +224,7 @@ class SVGReader { */ private function readXml( $metafield = null ) { $this->debug( "Read top level metadata" ); - if ( !$metafield || $this->reader->nodeType != XmlReader::ELEMENT ) { + if ( !$metafield || $this->reader->nodeType != XMLReader::ELEMENT ) { return; } // @todo Find and store type of xml snippet. metadata['metadataType'] = "rdf" @@ -246,7 +246,7 @@ class SVGReader { */ private function animateFilterAndLang( $name ) { $this->debug( "animate filter for tag $name" ); - if ( $this->reader->nodeType != XmlReader::ELEMENT ) { + if ( $this->reader->nodeType != XMLReader::ELEMENT ) { return; } if ( $this->reader->isEmptyElement ) { @@ -256,11 +256,11 @@ class SVGReader { $keepReading = $this->reader->read(); while ( $keepReading ) { if ( $this->reader->localName == $name && $this->reader->depth <= $exitDepth - && $this->reader->nodeType == XmlReader::END_ELEMENT + && $this->reader->nodeType == XMLReader::END_ELEMENT ) { break; } elseif ( $this->reader->namespaceURI == self::NS_SVG - && $this->reader->nodeType == XmlReader::ELEMENT + && $this->reader->nodeType == XMLReader::ELEMENT ) { $sysLang = $this->reader->getAttribute( 'systemLanguage' );