summaryrefslogtreecommitdiff
path: root/includes/Metadata.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/Metadata.php')
-rw-r--r--includes/Metadata.php57
1 files changed, 28 insertions, 29 deletions
diff --git a/includes/Metadata.php b/includes/Metadata.php
index 0ca15393..0b8014a7 100644
--- a/includes/Metadata.php
+++ b/includes/Metadata.php
@@ -34,7 +34,7 @@ abstract class RdfMetaData {
$this->mArticle = $article;
}
- public abstract function show();
+ abstract public function show();
protected function setup() {
global $wgOut, $wgRequest;
@@ -42,7 +42,7 @@ abstract class RdfMetaData {
$httpaccept = isset( $_SERVER['HTTP_ACCEPT'] ) ? $_SERVER['HTTP_ACCEPT'] : null;
$rdftype = wfNegotiateType( wfAcceptToPrefs( $httpaccept ), wfAcceptToPrefs( self::RDF_TYPE_PREFS ) );
- if( !$rdftype ){
+ if( !$rdftype ) {
throw new HttpError( 406, wfMessage( 'notacceptable' ) );
}
@@ -70,7 +70,7 @@ abstract class RdfMetaData {
$lastEditor = User::newFromId( $this->mArticle->getUser() );
$this->person( 'creator', $lastEditor );
- foreach( $this->mArticle->getContributors() as $user ){
+ foreach( $this->mArticle->getContributors() as $user ) {
$this->person( 'contributor', $user );
}
@@ -82,10 +82,10 @@ abstract class RdfMetaData {
print "\t\t<dc:{$name}>{$value}</dc:{$name}>\n";
}
- protected function date($timestamp) {
- return substr($timestamp, 0, 4) . '-'
- . substr($timestamp, 4, 2) . '-'
- . substr($timestamp, 6, 2);
+ protected function date( $timestamp ) {
+ return substr( $timestamp, 0, 4 ) . '-'
+ . substr( $timestamp, 4, 2 ) . '-'
+ . substr( $timestamp, 6, 2 );
}
protected function pageOrString( $name, $page, $str ) {
@@ -95,7 +95,7 @@ abstract class RdfMetaData {
$nt = Title::newFromText( $page );
}
- if( !$nt || $nt->getArticleID() == 0 ){
+ if( !$nt || $nt->getArticleID() == 0 ) {
$this->element( $name, $str );
} else {
$this->page( $name, $nt );
@@ -110,13 +110,13 @@ abstract class RdfMetaData {
$this->url( $name, $title->getFullUrl() );
}
- protected function url($name, $url) {
+ protected function url( $name, $url ) {
$url = htmlspecialchars( $url );
print "\t\t<dc:{$name} rdf:resource=\"{$url}\" />\n";
}
protected function person( $name, User $user ) {
- if( $user->isAnon() ){
+ if( $user->isAnon() ) {
$this->element( $name, wfMessage( 'anonymous' )->numParams( 1 )->text() );
} else {
$real = $user->getRealName();
@@ -141,19 +141,19 @@ abstract class RdfMetaData {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
if( $wgRightsPage && ( $nt = Title::newFromText( $wgRightsPage ) )
- && ($nt->getArticleID() != 0)) {
- $this->page('rights', $nt);
- } elseif( $wgRightsUrl ){
- $this->url('rights', $wgRightsUrl);
- } elseif( $wgRightsText ){
+ && ( $nt->getArticleID() != 0 ) ) {
+ $this->page( 'rights', $nt );
+ } elseif( $wgRightsUrl ) {
+ $this->url( 'rights', $wgRightsUrl );
+ } elseif( $wgRightsText ) {
$this->element( 'rights', $wgRightsText );
}
}
- protected function getTerms( $url ){
+ protected function getTerms( $url ) {
global $wgLicenseTerms;
- if( $wgLicenseTerms ){
+ if( $wgLicenseTerms ) {
return $wgLicenseTerms;
} else {
$known = $this->getKnownLicenses();
@@ -166,23 +166,23 @@ abstract class RdfMetaData {
}
protected function getKnownLicenses() {
- $ccLicenses = array('by', 'by-nd', 'by-nd-nc', 'by-nc',
- 'by-nc-sa', 'by-sa');
- $ccVersions = array('1.0', '2.0');
+ $ccLicenses = array( 'by', 'by-nd', 'by-nd-nc', 'by-nc',
+ 'by-nc-sa', 'by-sa' );
+ $ccVersions = array( '1.0', '2.0' );
$knownLicenses = array();
- foreach ($ccVersions as $version) {
- foreach ($ccLicenses as $license) {
- if( $version == '2.0' && substr( $license, 0, 2) != 'by' ) {
+ foreach ( $ccVersions as $version ) {
+ foreach ( $ccLicenses as $license ) {
+ if( $version == '2.0' && substr( $license, 0, 2 ) != 'by' ) {
# 2.0 dropped the non-attribs licenses
continue;
}
$lurl = "http://creativecommons.org/licenses/{$license}/{$version}/";
- $knownLicenses[$lurl] = explode('-', $license);
+ $knownLicenses[$lurl] = explode( '-', $license );
$knownLicenses[$lurl][] = 're';
$knownLicenses[$lurl][] = 'di';
$knownLicenses[$lurl][] = 'no';
- if (!in_array('nd', $knownLicenses[$lurl])) {
+ if ( !in_array( 'nd', $knownLicenses[$lurl] ) ) {
$knownLicenses[$lurl][] = 'de';
}
}
@@ -191,13 +191,12 @@ abstract class RdfMetaData {
/* Handle the GPL and LGPL, too. */
$knownLicenses['http://creativecommons.org/licenses/GPL/2.0/'] =
- array('de', 're', 'di', 'no', 'sa', 'sc');
+ array( 'de', 're', 'di', 'no', 'sa', 'sc' );
$knownLicenses['http://creativecommons.org/licenses/LGPL/2.1/'] =
- array('de', 're', 'di', 'no', 'sa', 'sc');
+ array( 'de', 're', 'di', 'no', 'sa', 'sc' );
$knownLicenses['http://www.gnu.org/copyleft/fdl.html'] =
- array('de', 're', 'di', 'no', 'sa', 'sc');
+ array( 'de', 're', 'di', 'no', 'sa', 'sc' );
return $knownLicenses;
}
}
-