* main()
*/
public function execute( $par ) {
- global $wgSpecialVersionShowHooks;
+ global $wgSpecialVersionShowHooks, $IP;
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->allowClickjacking();
- $text =
- $this->getMediaWikiCredits() .
- $this->softwareInformation() .
- $this->getEntryPointInfo() .
- $this->getExtensionCredits();
- if ( $wgSpecialVersionShowHooks ) {
- $text .= $this->getWgHooks();
- }
+ if( $par !== 'Credits' ) {
+ $text =
+ $this->getMediaWikiCredits() .
+ $this->softwareInformation() .
+ $this->getEntryPointInfo() .
+ $this->getExtensionCredits();
+ if ( $wgSpecialVersionShowHooks ) {
+ $text .= $this->getWgHooks();
+ }
- $out->addWikiText( $text );
- $out->addHTML( $this->IPInfo() );
+ $out->addWikiText( $text );
+ $out->addHTML( $this->IPInfo() );
- if ( $this->getRequest()->getVal( 'easteregg' ) ) {
- if ( $this->showEasterEgg() ) {
- // TODO: put something interesting here
+ if ( $this->getRequest()->getVal( 'easteregg' ) ) {
+ if ( $this->showEasterEgg() ) {
+ // TODO: put something interesting here
+ }
}
+ } else {
+ // Credits sub page
+
+ // Header
+ $out->addHTML( wfMessage( 'version-credits-summary' )->parseAsBlock() );
+
+ $wikiText = file_get_contents( $IP . '/CREDITS' );
+
+ // Take everything from the first section onwards, to remove the (not localized) header
+ $wikiText = substr( $wikiText, strpos( $wikiText, '==' ) );
+
+ $out->addWikiText( $wikiText );
}
}
* @return string
*/
private static function getMediaWikiCredits() {
- $ret = Xml::element( 'h2', array( 'id' => 'mw-version-license' ), wfMsg( 'version-license' ) );
+ $ret = Xml::element( 'h2', array( 'id' => 'mw-version-license' ), wfMessage( 'version-license' )->text() );
// This text is always left-to-right.
- $ret .= '<div>';
+ $ret .= '<div class="plainlinks">';
$ret .= "__NOTOC__
" . self::getCopyrightAndAuthorList() . "\n
- " . wfMsg( 'version-license-info' );
+ " . wfMessage( 'version-license-info' )->text();
$ret .= '</div>';
return str_replace( "\t\t", '', $ret ) . "\n";
'Alexandre Emsenhuber', 'Siebrand Mazeland', 'Chad Horohoe',
'Roan Kattouw', 'Trevor Parscal', 'Bryan Tong Minh', 'Sam Reed',
'Victor Vasiliev', 'Rotem Liss', 'Platonides', 'Antoine Musso',
- 'Timo Tijhof',
- wfMsg( 'version-poweredby-others' )
+ 'Timo Tijhof', 'Daniel Kinzler', 'Jeroen De Dauw',
+ '[[Special:Version/Credits|' .
+ wfMessage( 'version-poweredby-others' )->text() .
+ ']]'
);
- return wfMsg( 'version-poweredby-credits', date( 'Y' ),
- $wgLang->listToText( $authorList ) );
+ return wfMessage( 'version-poweredby-credits', date( 'Y' ),
+ $wgLang->listToText( $authorList ) )->text();
}
/**
$dbr = wfGetDB( DB_SLAVE );
// Put the software in an array of form 'name' => 'version'. All messages should
- // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
- // can be used.
+ // be loaded here, so feel free to use wfMessage in the 'name'. Raw HTML or
+ // wikimarkup can be used.
$software = array();
$software['[https://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
$software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
// Allow a hook to add/remove items.
wfRunHooks( 'SoftwareInfo', array( &$software ) );
- $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
- Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-software' ) ) .
+ $out = Xml::element( 'h2', array( 'id' => 'mw-version-software' ), wfMessage( 'version-software' )->text() ) .
+ Xml::openElement( 'table', array( 'class' => 'wikitable plainlinks', 'id' => 'sv-software' ) ) .
"<tr>
- <th>" . wfMsg( 'version-software-product' ) . "</th>
- <th>" . wfMsg( 'version-software-version' ) . "</th>
+ <th>" . wfMessage( 'version-software-product' )->text() . "</th>
+ <th>" . wfMessage( 'version-software-version' )->text() . "</th>
</tr>\n";
foreach( $software as $name => $version ) {
$version = "$wgVersion (r{$svnInfo['checkout-rev']})";
} else {
$version = $wgVersion . ' ' .
- wfMsg(
+ wfMessage(
'version-svn-revision',
isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
$info['checkout-rev']
- );
+ )->text();
}
wfProfileOut( __METHOD__ );
* @return string wgVersion + a link to subversion revision of svn BASE
*/
private static function getVersionLinkedSvn() {
- global $wgVersion, $IP;
+ global $IP;
$info = self::getSvnInfo( $IP );
if( !isset( $info['checkout-rev'] ) ) {
return false;
}
- $linkText = wfMsg(
+ $linkText = wfMessage(
'version-svn-revision',
isset( $info['directory-rev'] ) ? $info['directory-rev'] : '',
$info['checkout-rev']
- );
+ )->text();
if ( isset( $info['viewvc-url'] ) ) {
- $version = "$wgVersion [{$info['viewvc-url']} $linkText]";
+ $version = "[{$info['viewvc-url']} $linkText]";
} else {
- $version = "$wgVersion $linkText";
+ $version = $linkText;
}
- return $version;
+ return self::getwgVersionLinked() . " $version";
+ }
+
+ /**
+ * @return string
+ */
+ private static function getwgVersionLinked() {
+ global $wgVersion;
+ $versionUrl = "";
+ if( wfRunHooks( 'SpecialVersionVersionUrl', array( $wgVersion, &$versionUrl ) ) ) {
+ $versionParts = array();
+ preg_match( "/^(\d+\.\d+)/", $wgVersion, $versionParts );
+ $versionUrl = "https://www.mediawiki.org/wiki/MediaWiki_{$versionParts[1]}";
+ }
+ return "[$versionUrl $wgVersion]";
}
/**
* @return bool|string wgVersion + HEAD sha1 stripped to the first 7 chars. False on failure
*/
private static function getVersionLinkedGit() {
- global $wgVersion, $IP;
+ global $IP;
$gitInfo = new GitInfo( $IP );
$headSHA1 = $gitInfo->getHeadSHA1();
if ( $viewerUrl !== false ) {
$shortSHA1 = "[$viewerUrl $shortSHA1]";
}
- return "$wgVersion $shortSHA1";
+ return self::getwgVersionLinked() . " $shortSHA1";
}
/**
public static function getExtensionTypes() {
if ( self::$extensionTypes === false ) {
self::$extensionTypes = array(
- 'specialpage' => wfMsg( 'version-specialpages' ),
- 'parserhook' => wfMsg( 'version-parserhooks' ),
- 'variable' => wfMsg( 'version-variables' ),
- 'media' => wfMsg( 'version-mediahandlers' ),
- 'antispam' => wfMsg( 'version-antispam' ),
- 'skin' => wfMsg( 'version-skins' ),
- 'api' => wfMsg( 'version-api' ),
- 'other' => wfMsg( 'version-other' ),
+ 'specialpage' => wfMessage( 'version-specialpages' )->text(),
+ 'parserhook' => wfMessage( 'version-parserhooks' )->text(),
+ 'variable' => wfMessage( 'version-variables' )->text(),
+ 'media' => wfMessage( 'version-mediahandlers' )->text(),
+ 'antispam' => wfMessage( 'version-antispam' )->text(),
+ 'skin' => wfMessage( 'version-skins' )->text(),
+ 'api' => wfMessage( 'version-api' )->text(),
+ 'other' => wfMessage( 'version-other' )->text(),
);
wfRunHooks( 'ExtensionTypes', array( &self::$extensionTypes ) );
*/
wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
- $out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) .
- Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
+ $out = Xml::element( 'h2', array( 'id' => 'mw-version-ext' ), $this->msg( 'version-extensions' )->text() ) .
+ Xml::openElement( 'table', array( 'class' => 'wikitable plainlinks', 'id' => 'sv-ext' ) );
// Make sure the 'other' type is set to an array.
if ( !array_key_exists( 'other', $wgExtensionCredits ) ) {
$out .= $this->getExtensionCategory( 'other', $extensionTypes['other'] );
if ( count( $wgExtensionFunctions ) ) {
- $out .= $this->openExtType( wfMsg( 'version-extension-functions' ), 'extension-functions' );
+ $out .= $this->openExtType( $this->msg( 'version-extension-functions' )->text(), 'extension-functions' );
$out .= '<tr><td colspan="4">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
}
for ( $i = 0; $i < $cnt; ++$i ) {
$tags[$i] = "<{$tags[$i]}>";
}
- $out .= $this->openExtType( wfMsg( 'version-parser-extensiontags' ), 'parser-tags' );
+ $out .= $this->openExtType( $this->msg( 'version-parser-extensiontags' )->text(), 'parser-tags' );
$out .= '<tr><td colspan="4">' . $this->listToText( $tags ). "</td></tr>\n";
}
$fhooks = $wgParser->getFunctionHooks();
if( count( $fhooks ) ) {
- $out .= $this->openExtType( wfMsg( 'version-parser-function-hooks' ), 'parser-function-hooks' );
+ $out .= $this->openExtType( $this->msg( 'version-parser-function-hooks' )->text(), 'parser-function-hooks' );
$out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
}
# Make subversion text/link.
if ( $svnInfo !== false ) {
$directoryRev = isset( $svnInfo['directory-rev'] ) ? $svnInfo['directory-rev'] : null;
- $vcsText = wfMsg( 'version-svn-revision', $directoryRev, $svnInfo['checkout-rev'] );
+ $vcsText = $this->msg( 'version-svn-revision', $directoryRev, $svnInfo['checkout-rev'] )->text();
$vcsText = isset( $svnInfo['viewvc-url'] ) ? '[' . $svnInfo['viewvc-url'] . " $vcsText]" : $vcsText;
}
}
if ( isset( $extension['version'] ) ) {
$versionText = '<span class="mw-version-ext-version">' .
- wfMsg( 'version-version', $extension['version'] ) .
+ $this->msg( 'version-version', $extension['version'] )->text() .
'</span>';
} else {
$versionText = '';
$descriptionMsgKey = $descriptionMsg[0]; // Get the message key
array_shift( $descriptionMsg ); // Shift out the message key to get the parameters only
array_map( "htmlspecialchars", $descriptionMsg ); // For sanity
- $description = wfMsg( $descriptionMsgKey, $descriptionMsg );
+ $description = $this->msg( $descriptionMsgKey, $descriptionMsg )->text();
} else {
- $description = wfMsg( $descriptionMsg );
+ $description = $this->msg( $descriptionMsg )->text();
}
}
$myWgHooks = $wgHooks;
ksort( $myWgHooks );
- $ret = Xml::element( 'h2', array( 'id' => 'mw-version-hooks' ), wfMsg( 'version-hooks' ) ) .
+ $ret = Xml::element( 'h2', array( 'id' => 'mw-version-hooks' ), $this->msg( 'version-hooks' )->text() ) .
Xml::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-hooks' ) ) .
"<tr>
- <th>" . wfMsg( 'version-hook-name' ) . "</th>
- <th>" . wfMsg( 'version-hook-subscribedby' ) . "</th>
+ <th>" . $this->msg( 'version-hook-name' )->text() . "</th>
+ <th>" . $this->msg( 'version-hook-subscribedby' )->text() . "</th>
</tr>\n";
foreach ( $myWgHooks as $hook => $hooks ) {
$list = array();
foreach( (array)$authors as $item ) {
if( $item == '...' ) {
- $list[] = wfMsg( 'version-poweredby-others' );
+ $list[] = $this->msg( 'version-poweredby-others' )->text();
} else {
$list[] = $item;
}
'version-entrypoints-load-php' => wfScript( 'load' ),
);
- $out = Html::element( 'h2', array( 'id' => 'mw-version-entrypoints' ), wfMsg( 'version-entrypoints' ) ) .
- Html::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'mw-version-entrypoints-table' ) ) .
+ $language = $this->getLanguage();
+ $thAttribures = array(
+ 'dir' => $language->getDir(),
+ 'lang' => $language->getCode()
+ );
+ $out = Html::element( 'h2', array( 'id' => 'mw-version-entrypoints' ), $this->msg( 'version-entrypoints' )->text() ) .
+ Html::openElement( 'table',
+ array(
+ 'class' => 'wikitable plainlinks',
+ 'id' => 'mw-version-entrypoints-table',
+ 'dir' => 'ltr',
+ 'lang' => 'en'
+ )
+ ) .
Html::openElement( 'tr' ) .
- Html::element( 'th', array(), wfMessage( 'version-entrypoints-header-entrypoint' )->text() ) .
- Html::element( 'th', array(), wfMessage( 'version-entrypoints-header-url' )->text() ) .
+ Html::element( 'th', $thAttribures, $this->msg( 'version-entrypoints-header-entrypoint' )->text() ) .
+ Html::element( 'th', $thAttribures, $this->msg( 'version-entrypoints-header-url' )->text() ) .
Html::closeElement( 'tr' );
foreach ( $entryPoints as $message => $value ) {
$out .= Html::openElement( 'tr' ) .
// ->text() looks like it should be ->parse(), but this function
// returns wikitext, not HTML, boo
- Html::rawElement( 'td', array(), wfMessage( $message )->text() ) .
+ Html::rawElement( 'td', array(), $this->msg( $message )->text() ) .
Html::rawElement( 'td', array(), Html::rawElement( 'code', array(), "[$url $value]" ) ) .
Html::closeElement( 'tr' );
}