Index: branches/wmf/1.17wmf1/includes/media/SVGMetadataExtractor.php |
— | — | @@ -101,7 +101,7 @@ |
102 | 102 | $keepReading = $this->reader->read(); |
103 | 103 | } |
104 | 104 | |
105 | | - if ( !$this->qualifiedNameEquals( $this->reader->name, 'svg', 'svg' ) ) { |
| 105 | + if ( $this->reader->name != 'svg' ) { |
106 | 106 | throw new MWException( "Expected <svg> tag, got ". |
107 | 107 | $this->reader->name ); |
108 | 108 | } |
— | — | @@ -116,13 +116,13 @@ |
117 | 117 | |
118 | 118 | $this->debug( "$tag" ); |
119 | 119 | |
120 | | - if ( $this->qualifiedNameEquals( $tag, 'svg', 'svg' ) && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) { |
| 120 | + if ( $tag == 'svg' && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) { |
121 | 121 | break; |
122 | | - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'title' ) ) { |
| 122 | + } elseif ( $tag == 'title' ) { |
123 | 123 | $this->readField( $tag, 'title' ); |
124 | | - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'desc' ) ) { |
| 124 | + } elseif ( $tag == 'desc' ) { |
125 | 125 | $this->readField( $tag, 'description' ); |
126 | | - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'metadata' ) && $type == XmlReader::ELEMENT ) { |
| 126 | + } elseif ( $tag == 'metadata' && $type == XmlReader::ELEMENT ) { |
127 | 127 | $this->readXml( $tag, 'metadata' ); |
128 | 128 | } elseif ( $tag !== '#text' ) { |
129 | 129 | $this->debug( "Unhandled top-level XML tag $tag" ); |
— | — | @@ -198,15 +198,10 @@ |
199 | 199 | } elseif ( $this->reader->nodeType == XmlReader::ELEMENT ) { |
200 | 200 | switch( $this->reader->name ) { |
201 | 201 | case 'animate': |
202 | | - case 'svg:animate': |
203 | 202 | case 'set': |
204 | | - case 'svg:set': |
205 | 203 | case 'animateMotion': |
206 | | - case 'svg:animateMotion': |
207 | 204 | case 'animateColor': |
208 | | - case 'svg:animateColor': |
209 | 205 | case 'animateTransform': |
210 | | - case 'svg:animateTransform': |
211 | 206 | $this->debug( "HOUSTON WE HAVE ANIMATION" ); |
212 | 207 | $this->metadata['animated'] = true; |
213 | 208 | break; |
— | — | @@ -315,22 +310,4 @@ |
316 | 311 | return floatval( $length ); |
317 | 312 | } |
318 | 313 | } |
319 | | - |
320 | | - /** |
321 | | - * XML namespace check |
322 | | - * |
323 | | - * Check if a read node name matches the expected nodeName |
324 | | - * @param $qualifiedName as read by XMLReader |
325 | | - * @param $prefix the namespace prefix that you expect for this element, defaults to svg namespace |
326 | | - * @param $localName the localName part of the element that you want to match |
327 | | - * |
328 | | - * @return boolean |
329 | | - */ |
330 | | - private function qualifiedNameEquals( $qualifiedName, $prefix="svg", $localName ) { |
331 | | - if( ($qualifiedName == $localName && $prefix == "svg" ) || |
332 | | - $qualifiedName == ($prefix . ":" . $localName) ) { |
333 | | - return true; |
334 | | - } |
335 | | - return false; |
336 | | - } |
337 | 314 | } |