/**
* Fetch the set of available skins.
- * @return array of strings
+ * @return array associative array of strings
*/
static function getSkinNames() {
global $wgValidSkinNames;
}
return $wgValidSkinNames;
}
+
+ /**
+ * Fetch the skinname messages for available skins.
+ * @return array of strings
+ */
+ static function getSkinNameMessages() {
+ $messages = array();
+ foreach( self::getSkinNames() as $skinKey => $skinName ) {
+ $messages[] = "skinname-$skinKey";
+ }
+ return $messages;
+ }
/**
* Fetch the list of usable skins in regards to $wgSkipSkins.
$skinNames = Skin::getSkinNames();
- if ( $key == '' ) {
+ if ( $key == '' || $key == 'default' ) {
// Don't return the default immediately;
// in a misconfiguration we need to fall back.
$key = $wgDefaultSkin;
abstract function outputPage( OutputPage $out = null );
/**
- * @param $data
+ * @param $data array
* @return string
*/
static function makeVariablesScript( $data ) {
}
}
+ /**
+ * Make a <script> tag containing global variables
+ *
+ * @deprecated in 1.19
+ * @param $unused
+ * @return string HTML fragment
+ */
+ public static function makeGlobalVariablesScript( $unused ) {
+ global $wgOut;
+
+ wfDeprecated( __METHOD__, '1.19' );
+
+ return self::makeVariablesScript( $wgOut->getJSVars() );
+ }
+
/**
* Get the query to generate a dynamic stylesheet
*
protected function generateDebugHTML() {
global $wgShowDebug;
- $html = MWDebug::getDebugHTML();
+ $html = MWDebug::getDebugHTML( $this->getContext() );
if ( $wgShowDebug ) {
$listInternals = $this->formatDebugHTML( $this->getOutput()->mDebugtext );
}
/**
- * @param $debugText
+ * @param $debugText string
* @return string
*/
private function formatDebugHTML( $debugText ) {
}
/**
- * @param string $type
+ * @param $type string
* @return string
*/
function getCopyright( $type = 'detect' ) {
if ( $forContent ) {
$msg = $msgObj->inContentLanguage()->text();
if ( $this->getLanguage()->getCode() !== $wgContLang->getCode() ) {
- $msg = Html::rawElement( 'span', array( 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), $msg );
+ $msg = Html::rawElement( 'span', array( 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ), $msg );
}
return $msg;
} else {
/**
* Get the timestamp of the latest revision, formatted in user language
*
- * @param $page WikiPage object. Used if we're working with the current revision
* @return String
*/
- protected function lastModified( $page ) {
- if ( !$this->isRevisionCurrent() ) {
+ protected function lastModified() {
+ $timestamp = $this->getOutput()->getRevisionTimestamp();
+
+ # No cached timestamp, load it from the database
+ if ( $timestamp === null ) {
$timestamp = Revision::getTimestampFromId( $this->getTitle(), $this->getRevisionId() );
- } else {
- $timestamp = $page->getTimestamp();
}
if ( $timestamp ) {
$mp = $this->msg( 'mainpage' )->escaped();
$mptitle = Title::newMainPage();
- $url = ( is_object( $mptitle ) ? $mptitle->escapeLocalURL() : '' );
+ $url = ( is_object( $mptitle ) ? htmlspecialchars( $mptitle->getLocalURL() ) : '' );
$logourl = $this->getLogo();
$s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
}
/**
- * @param $id
+ * @param $id User|int
* @return bool
*/
function showEmailUser( $id ) {
}
/**
- * @param $name
+ * @param $name string
* @param $urlaction string
* @return String
*/
}
/**
- * @param $name
- * @param $subpage
+ * @param $name string
+ * @param $subpage string
* @param $urlaction string
* @return String
*/
}
/**
- * @param $name
+ * @param $name string
* @param $urlaction string
* @return String
*/
}
/**
- * @param $name
+ * @param $name string
* @param $urlaction string
* @return String
*/
* make sure we have some title to operate on
*
* @param $title Title
- * @param $name
+ * @param $name string
*/
static function checkTitle( &$title, $name ) {
if ( !is_object( $title ) ) {
* @return array
*/
function buildSidebar() {
- global $parserMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
+ global $wgMemc, $wgEnableSidebarCache, $wgSidebarCacheExpiry;
wfProfileIn( __METHOD__ );
$key = wfMemcKey( 'sidebar', $this->getLanguage()->getCode() );
if ( $wgEnableSidebarCache ) {
- $cachedsidebar = $parserMemc->get( $key );
+ $cachedsidebar = $wgMemc->get( $key );
if ( $cachedsidebar ) {
wfProfileOut( __METHOD__ );
return $cachedsidebar;
wfRunHooks( 'SkinBuildSidebar', array( $this, &$bar ) );
if ( $wgEnableSidebarCache ) {
- $parserMemc->set( $key, $bar, $wgSidebarCacheExpiry );
+ $wgMemc->set( $key, $bar, $wgSidebarCacheExpiry );
}
wfProfileOut( __METHOD__ );
if ( strpos( $line, '|' ) !== false ) { // sanity check
$line = MessageCache::singleton()->transform( $line, false, null, $this->getTitle() );
$line = array_map( 'trim', explode( '|', $line, 2 ) );
+ if ( count( $line ) !== 2 ) {
+ // Second sanity check, could be hit by people doing
+ // funky stuff with parserfuncs... (bug 33321)
+ continue;
+ }
+
$extraAttribs = array();
$msgLink = $this->msg( $line[0] )->inContentLanguage();
} else {
$link = $line[0];
}
-
$msgText = $this->msg( $line[1] );
if ( $msgText->exists() ) {
$text = $msgText->text();
}
$notice = Html::rawElement( 'div', array( 'id' => 'localNotice',
- 'lang' => $wgContLang->getCode(), 'dir' => $wgContLang->getDir() ), $notice );
+ 'lang' => $wgContLang->getHtmlCode(), 'dir' => $wgContLang->getDir() ), $notice );
wfProfileOut( __METHOD__ );
return $notice;
}
if ( !is_null( $tooltip ) ) {
# Bug 25462: undo double-escaping.
$tooltip = Sanitizer::decodeCharReferences( $tooltip );
- $attribs['title'] = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag' ), $tooltip );
+ $attribs['title'] = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag', 'replaceafter' ), $tooltip );
}
$link = Linker::link( $nt, wfMsgExt( 'editsection', array( 'language' => $lang ) ),
$attribs,
# we can rid of it someday.
$attribs = '';
if ( $tooltip ) {
- $attribs = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag', 'escape' ), $tooltip );
+ $attribs = wfMsgExt( 'editsectionhint', array( 'language' => $lang, 'parsemag', 'escape', 'replaceafter' ), $tooltip );
$attribs = " title=\"$attribs\"";
}
$result = null;
*
* @param $fname String Name of called method
* @param $args Array Arguments to the method
+ * @return mixed
*/
function __call( $fname, $args ) {
$realFunction = array( 'Linker', $fname );