<?php
/**
- * Provides CreativeCommons metadata
*
* Copyright 2004, Evan Prodromou <evan@wikitravel.org>.
*
* Constructor
* @param $article Article object
*/
- public function __construct( Article $article ) {
+ public function __construct( Page $article ) {
$this->mArticle = $article;
}
public abstract function show();
- /**
- *
- */
protected function setup() {
global $wgOut, $wgRequest;
$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() {
return $this->mArticle->getTitle()->getFullURL();
}
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' );
}
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 );
}
}
+ /**
+ * @param $name string
+ * @param $title Title
+ */
protected function page( $name, $title ) {
$this->url( $name, $title->getFullUrl() );
}
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 );
}
}