Bug 35034 - moved autocomment-prefix between the prefix and the arrow. Follow up...
[lhc/web/wiklou.git] / includes / Metadata.php
index 6439ef3..e5e3296 100644 (file)
@@ -28,7 +28,7 @@ abstract class RdfMetaData {
         * Constructor
         * @param $article Article object
         */
-       public function __construct( Article $article ) {
+       public function __construct( Page $article ) {
                $this->mArticle = $article;
        }
 
@@ -41,14 +41,13 @@ abstract class RdfMetaData {
                $rdftype = wfNegotiateType( wfAcceptToPrefs( $httpaccept ), wfAcceptToPrefs( self::RDF_TYPE_PREFS ) );
 
                if( !$rdftype ){
-                       wfHttpError( 406, 'Not Acceptable', wfMsg( 'notacceptable' ) );
-                       return false;
-               } else {
-                       $wgOut->disable();
-                       $wgRequest->response()->header( "Content-type: {$rdftype}; charset=utf-8" );
-                       $wgOut->sendCacheControl();
-                       return true;
+                       throw new HttpError( 406, wfMessage( 'notacceptable' ) );
                }
+
+               $wgOut->disable();
+               $wgRequest->response()->header( "Content-type: {$rdftype}; charset=utf-8" );
+               $wgOut->sendCacheControl();
+               return true;
        }
 
        protected function reallyFullUrl() {
@@ -58,7 +57,7 @@ abstract class RdfMetaData {
        protected function basics() {
                global $wgLanguageCode, $wgSitename;
 
-               $this->element( 'title', $this->mArticle->mTitle->getText() );
+               $this->element( 'title', $this->mArticle->getTitle()->getText() );
                $this->pageOrString( 'publisher', wfMsg( 'aboutpage' ), $wgSitename );
                $this->element( 'language', $wgLanguageCode );
                $this->element( 'type', 'Text' );
@@ -88,10 +87,11 @@ abstract class RdfMetaData {
        }
 
        protected function pageOrString( $name, $page, $str ) {
-               if( $page instanceof Title )
+               if( $page instanceof Title ) {
                        $nt = $page;
-               else
+               } else {
                        $nt = Title::newFromText( $page );
+               }
 
                if( !$nt || $nt->getArticleID() == 0 ){
                        $this->element( $name, $str );
@@ -100,6 +100,10 @@ abstract class RdfMetaData {
                }
        }
 
+       /**
+        * @param $name string
+        * @param $title Title
+        */
        protected function page( $name, $title ) {
                $this->url( $name, $title->getFullUrl() );
        }
@@ -133,9 +137,9 @@ abstract class RdfMetaData {
                if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) )
                        && ($nt->getArticleID() != 0)) {
                        $this->page('rights', $nt);
-               } else if( $wgRightsUrl ){
+               } elseif( $wgRightsUrl ){
                        $this->url('rights', $wgRightsUrl);
-               } else if( $wgRightsText ){
+               } elseif( $wgRightsText ){
                        $this->element( 'rights', $wgRightsText );
                }
        }