| Index: trunk/phase3/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" ); |
| — | — | @@ -201,15 +201,10 @@ |
| 202 | 202 | } elseif ( $this->reader->nodeType == XmlReader::ELEMENT ) { |
| 203 | 203 | switch( $this->reader->name ) { |
| 204 | 204 | case 'animate': |
| 205 | | - case 'svg:animate': |
| 206 | 205 | case 'set': |
| 207 | | - case 'svg:set': |
| 208 | 206 | case 'animateMotion': |
| 209 | | - case 'svg:animateMotion': |
| 210 | 207 | case 'animateColor': |
| 211 | | - case 'svg:animateColor': |
| 212 | 208 | case 'animateTransform': |
| 213 | | - case 'svg:animateTransform': |
| 214 | 209 | $this->debug( "HOUSTON WE HAVE ANIMATION" ); |
| 215 | 210 | $this->metadata['animated'] = true; |
| 216 | 211 | break; |
| — | — | @@ -318,22 +313,4 @@ |
| 319 | 314 | return floatval( $length ); |
| 320 | 315 | } |
| 321 | 316 | } |
| 322 | | - |
| 323 | | - /** |
| 324 | | - * XML namespace check |
| 325 | | - * |
| 326 | | - * Check if a read node name matches the expected nodeName |
| 327 | | - * @param $qualifiedName as read by XMLReader |
| 328 | | - * @param $prefix the namespace prefix that you expect for this element, defaults to svg namespace |
| 329 | | - * @param $localName the localName part of the element that you want to match |
| 330 | | - * |
| 331 | | - * @return boolean |
| 332 | | - */ |
| 333 | | - private function qualifiedNameEquals( $qualifiedName, $prefix="svg", $localName ) { |
| 334 | | - if( ($qualifiedName == $localName && $prefix == "svg" ) || |
| 335 | | - $qualifiedName == ($prefix . ":" . $localName) ) { |
| 336 | | - return true; |
| 337 | | - } |
| 338 | | - return false; |
| 339 | | - } |
| 340 | 317 | } |