return $this->skinname;
}
+ /**
+ * @param $out OutputPage
+ */
function initPage( OutputPage $out ) {
wfProfileIn( __METHOD__ );
*/
abstract function outputPage( OutputPage $out = null );
+ /**
+ * @param $data array
+ * @return string
+ */
static function makeVariablesScript( $data ) {
if ( $data ) {
return Html::inlineScript(
}
}
+ /**
+ * Make a <script> tag containing global variables
+ *
+ * @deprecated in 1.19
+ * @param $unused 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
*
return $wgLogo;
}
+ /**
+ * @return string
+ */
function getCategoryLinks() {
global $wgUseCategoryBrowser;
return $return;
}
+ /**
+ * @return string
+ */
function getCategories() {
$out = $this->getOutput();
protected function generateDebugHTML() {
global $wgShowDebug;
+ $html = MWDebug::getDebugHTML( $this->getContext() );
+
if ( $wgShowDebug ) {
$listInternals = $this->formatDebugHTML( $this->getOutput()->mDebugtext );
- return "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">" .
+ $html .= "\n<hr />\n<strong>Debug data:</strong><ul id=\"mw-debug-html\">" .
$listInternals . "</ul>\n";
}
- return '';
+ return $html;
}
+ /**
+ * @param $debugText string
+ * @return string
+ */
private function formatDebugHTML( $debugText ) {
global $wgDebugTimestamps;
$pre = '';
if ( $wgDebugTimestamps ) {
$matches = array();
- if ( preg_match( '/^(\d+\.\d+ \d+.\dM\s{2})/', $line, $matches ) ) {
+ if ( preg_match( '/^(\d+\.\d+ {1,3}\d+.\dM\s{2})/', $line, $matches ) ) {
$pre = $matches[1];
$line = substr( $line, strlen( $pre ) );
}
return $this->msg( 'retrievedfrom', '<a href="' . $url . '">' . $url . '</a>' )->text();
}
+ /**
+ * @return String
+ */
function getUndeleteLink() {
$action = $this->getRequest()->getVal( 'action', 'view' );
return '';
}
+ /**
+ * @return string
+ */
function subPageSubtitle() {
$out = $this->getOutput();
$subpages = '';
return $wgShowIPinHeader && session_id() != '';
}
+ /**
+ * @return String
+ */
function getSearchLink() {
$searchPage = SpecialPage::getTitleFor( 'Search' );
return $searchPage->getLocalURL();
}
+ /**
+ * @return string
+ */
function escapeSearchLink() {
return htmlspecialchars( $this->getSearchLink() );
}
+ /**
+ * @param $type string
+ * @return string
+ */
function getCopyright( $type = 'detect' ) {
global $wgRightsPage, $wgRightsUrl, $wgRightsText, $wgContLang;
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 {
}
}
+ /**
+ * @return null|string
+ */
function getCopyrightIcon() {
global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon;
/**
* 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 ) {
return $s;
}
+ /**
+ * @param $align string
+ * @return string
+ */
function logoText( $align = '' ) {
if ( $align != '' ) {
$a = " align='{$align}'";
$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>";
return $s;
}
+ /**
+ * @param $desc
+ * @param $page
+ * @return string
+ */
public function footerLink( $desc, $page ) {
// if the link description has been set to "-" in the default language,
if ( $this->msg( $desc )->inContentLanguage()->isDisabled() ) {
return $options;
}
+ /**
+ * @param $id User|int
+ * @return bool
+ */
function showEmailUser( $id ) {
if ( $id instanceof User ) {
$targetUser = $id;
}
/* these are used extensively in SkinTemplate, but also some other places */
+
+ /**
+ * @param $urlaction string
+ * @return String
+ */
static function makeMainPageUrl( $urlaction = '' ) {
$title = Title::newMainPage();
self::checkTitle( $title, '' );
return $title->getLocalURL( $urlaction );
}
+ /**
+ * @param $name string
+ * @param $urlaction string
+ * @return String
+ */
static function makeSpecialUrl( $name, $urlaction = '' ) {
$title = SpecialPage::getSafeTitleFor( $name );
return $title->getLocalURL( $urlaction );
}
+ /**
+ * @param $name string
+ * @param $subpage string
+ * @param $urlaction string
+ * @return String
+ */
static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) {
$title = SpecialPage::getSafeTitleFor( $name, $subpage );
return $title->getLocalURL( $urlaction );
}
+ /**
+ * @param $name string
+ * @param $urlaction string
+ * @return String
+ */
static function makeI18nUrl( $name, $urlaction = '' ) {
$title = Title::newFromText( wfMsgForContent( $name ) );
self::checkTitle( $title, $name );
return $title->getLocalURL( $urlaction );
}
+ /**
+ * @param $name string
+ * @param $urlaction string
+ * @return String
+ */
static function makeUrl( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
self::checkTitle( $title, $name );
}
}
- # this can be passed the NS number as defined in Language.php
+ /**
+ * this can be passed the NS number as defined in Language.php
+ * @param $name
+ * @param $urlaction string
+ * @param $namespace int
+ * @return String
+ */
static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) {
$title = Title::makeTitleSafe( $namespace, $name );
self::checkTitle( $title, $name );
return $title->getLocalURL( $urlaction );
}
- /* these return an array with the 'href' and boolean 'exists' */
+ /**
+ * these return an array with the 'href' and boolean 'exists'
+ * @param $name
+ * @param $urlaction string
+ * @return array
+ */
static function makeUrlDetails( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
self::checkTitle( $title, $name );
);
}
- # make sure we have some title to operate on
+ /**
+ * make sure we have some title to operate on
+ *
+ * @param $title Title
+ * @param $name string
+ */
static function checkTitle( &$title, $name ) {
if ( !is_object( $title ) ) {
$title = Title::newFromText( $name );
*
* This is just a wrapper around addToSidebarPlain() for backwards compatibility
*
- * @param &$bar array
+ * @param $bar array
* @param $message String
*/
function addToSidebar( &$bar, $message ) {
/**
* Add content from plain text
* @since 1.17
- * @param &$bar array
+ * @param $bar array
* @param $text string
* @return Array
*/
if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) {
$href = $link;
-
+
// Parser::getExternalLinkAttribs won't work here because of the Namespace things
global $wgNoFollowLinks, $wgNoFollowDomainExceptions;
if ( $wgNoFollowLinks && !wfMatchesDomainList( $href, $wgNoFollowDomainExceptions ) ) {
$extraAttribs['rel'] = 'nofollow';
}
-
+
global $wgExternalLinkTarget;
if ( $wgExternalLinkTarget) {
$extraAttribs['target'] = $wgExternalLinkTarget;
}
$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;
}