From b042f2c8350b0edb15036caa8f6731ec1185bf1d Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 19 Sep 2008 13:39:30 +0000 Subject: [PATCH] Add accessor to $rootElement, rather than accessing it directly. --- includes/MimeMagic.php | 4 ++-- includes/XmlTypeCheck.php | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/MimeMagic.php b/includes/MimeMagic.php index 8f903a8fdb..b21ff540e2 100644 --- a/includes/MimeMagic.php +++ b/includes/MimeMagic.php @@ -460,8 +460,8 @@ class MimeMagic { $xml = new XmlTypeCheck( $file ); if( $xml->wellFormed ) { global $wgXMLMimeTypes; - if( isset( $wgXMLMimeTypes[$xml->rootElement] ) ) { - return $wgXMLMimeTypes[$xml->rootElement]; + if( isset( $wgXMLMimeTypes[$xml->getRootElement()] ) ) { + return $wgXMLMimeTypes[$xml->getRootElement()]; } else { return 'application/xml'; } diff --git a/includes/XmlTypeCheck.php b/includes/XmlTypeCheck.php index 09b8c20ad7..10a08547fb 100644 --- a/includes/XmlTypeCheck.php +++ b/includes/XmlTypeCheck.php @@ -28,6 +28,13 @@ class XmlTypeCheck { $this->softNamespaces = $softNamespaces; $this->run( $file ); } + + /** + * Get the root element. Simple accessor to $rootElement + */ + public function getRootElement() { + return $this->rootElement; + } private function run( $fname ) { if( $this->softNamespaces ) { -- 2.20.1