* @private
* @ingroup Skins
*/
-class MediaWiki_I18N {
- var $_context = array();
+class MediaWikiI18N {
+ private $context = array();
function set( $varName, $value ) {
- $this->_context[$varName] = $value;
+ $this->context[$varName] = $value;
}
function translate( $value ) {
while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
list( $src, $var ) = $m;
wfSuppressWarnings();
- $varValue = $this->_context[$var];
+ $varValue = $this->context[$var];
wfRestoreWarnings();
$value = str_replace( $src, $varValue, $value );
}
* @ingroup Skins
*/
class SkinTemplate extends Skin {
- /**#@+
- * @private
- */
-
- /**
- * Name of our skin, it probably needs to be all lower case. Child classes
- * should override the default.
- */
- var $skinname = 'monobook';
-
/**
- * Stylesheets set to use. Subdirectory in skins/ where various stylesheets
- * are located. Child classes should override the default.
+ * @var string Name of our skin, it probably needs to be all lower case.
+ * Child classes should override the default.
*/
- var $stylename = 'monobook';
+ public $skinname = 'monobook';
/**
- * For QuickTemplate, the name of the subclass which will actually fill the
- * template. Child classes should override the default.
+ * @var string Stylesheets set to use. Subdirectory in skins/ where various
+ * stylesheets are located. Child classes should override the default.
*/
- var $template = 'QuickTemplate';
+ public $stylename = 'monobook';
/**
- * Whether this skin use OutputPage::headElement() to generate the "<head>"
- * tag
+ * @var string For QuickTemplate, the name of the subclass which will
+ * actually fill the template. Child classes should override the default.
*/
- var $useHeadElement = false;
-
- /**#@-*/
+ public $template = 'QuickTemplate';
/**
* Add specific styles for this skin
* roughly equivalent to PHPTAL 0.7.
*
* @param string $classname
- * @param string $repository Subdirectory where we keep template files
- * @param string $cache_dir
+ * @param bool|string $repository Subdirectory where we keep template files
+ * @param bool|string $cache_dir
* @return QuickTemplate
* @private
*/
'lang' => $ilInterwikiCodeBCP47,
'hreflang' => $ilInterwikiCodeBCP47,
);
- wfRunHooks( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle() ) );
+ wfRunHooks(
+ 'SkinTemplateGetLanguageLink',
+ array( &$languageLink, $languageLinkTitle, $this->getTitle() )
+ );
$languageLinks[] = $languageLink;
}
}
$out = $this->getOutput();
$tpl = $this->setupTemplateForOutput();
- wfProfileIn( __METHOD__ . '-stuff-head' );
- if ( !$this->useHeadElement ) {
- $tpl->set( 'pagecss', false );
- $tpl->set( 'usercss', false );
-
- $tpl->set( 'userjs', false );
- $tpl->set( 'userjsprev', false );
-
- $tpl->set( 'jsvarurl', false );
-
- $tpl->set( 'xhtmldefaultnamespace', 'http://www.w3.org/1999/xhtml' );
- $tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
- $tpl->set( 'html5version', $wgHtml5Version );
- $tpl->set( 'headlinks', $out->getHeadLinks() );
- $tpl->set( 'csslinks', $out->buildCssLinks() );
- $tpl->set( 'pageclass', $this->getPageClasses( $title ) );
- $tpl->set( 'skinnameclass', ( 'skin-' . Sanitizer::escapeClass( $this->getSkinName() ) ) );
- }
- wfProfileOut( __METHOD__ . '-stuff-head' );
-
wfProfileIn( __METHOD__ . '-stuff2' );
$tpl->set( 'title', $out->getPageTitle() );
$tpl->set( 'pagetitle', $out->getHTMLTitle() );
// that interface elements are in a different language.
$tpl->set( 'userlangattributes', '' );
$tpl->set( 'specialpageattributes', '' ); # obsolete
- // Used by VectorBeta to insert HTML before content but after the heading for the page title. Defaults to empty string.
+ // Used by VectorBeta to insert HTML before content but after the
+ // heading for the page title. Defaults to empty string.
$tpl->set( 'prebodyhtml', '' );
if ( $userLangCode !== $wgContLang->getHtmlCode() || $userLangDir !== $wgContLang->getDir() ) {
$tpl->set( 'nav_urls', $this->buildNavUrls() );
// Set the head scripts near the end, in case the above actions resulted in added scripts
- if ( $this->useHeadElement ) {
- $tpl->set( 'headelement', $out->headElement( $this ) );
- } else {
- $tpl->set( 'headscripts', $out->getHeadScripts() . $out->getHeadItems() );
- }
+ $tpl->set( 'headelement', $out->headElement( $this ) );
$tpl->set( 'debug', '' );
$tpl->set( 'debughtml', $this->generateDebugHTML() );
// and output printfooter and debughtml separately
$tpl->set( 'bodycontent', $tpl->data['bodytext'] );
- // Append printfooter and debughtml onto bodytext so that skins that were already
- // using bodytext before they were split out don't suddenly start not outputting information
- $tpl->data['bodytext'] .= Html::rawElement( 'div', array( 'class' => 'printfooter' ), "\n{$tpl->data['printfooter']}" ) . "\n";
+ // Append printfooter and debughtml onto bodytext so that skins that
+ // were already using bodytext before they were split out don't suddenly
+ // start not outputting information.
+ $tpl->data['bodytext'] .= Html::rawElement(
+ 'div',
+ array( 'class' => 'printfooter' ),
+ "\n{$tpl->data['printfooter']}"
+ ) . "\n";
$tpl->data['bodytext'] .= $tpl->data['debughtml'];
// allow extensions adding stuff after the page content.
$login_url = array(
'text' => $this->msg( $loginlink )->text(),
'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
- 'active' => $title->isSpecial( 'Userlogin' ) && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
+ 'active' => $title->isSpecial( 'Userlogin' )
+ && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
);
$createaccount_url = array(
'text' => $this->msg( 'pt-createaccount' )->text(),
* links, however these are usually automatically generated by SkinTemplate
* itself and are not necessary when using a hook. The only things these may
* matter to are people modifying content_navigation after it's initial creation:
- * - id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility
+ * - id: A "preferred" id, most skins are best off outputting this preferred
+ * id for best compatibility.
* - tooltiponly: This is set to true for some tabs in cases where the system
- * believes that the accesskey should not be added to the tab.
+ * believes that the accesskey should not be added to the tab.
*
* @return array
*/
wfProfileIn( __METHOD__ . '-edit' );
// Checks if user can edit the current page if it exists or create it otherwise
- if ( $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) ) ) {
+ if ( $title->quickUserCan( 'edit', $user )
+ && ( $title->exists() || $title->quickUserCan( 'create', $user ) )
+ ) {
// Builds CSS class for talk page links
$isTalkClass = $isTalk ? ' istalk' : '';
// Whether the user is editing the page
&& ( ( $isTalk && $this->isRevisionCurrent() ) || $out->showNewSectionLink() );
$section = $request->getVal( 'section' );
- if ( $title->exists() || ( $title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !== false ) ) {
+ if ( $title->exists()
+ || ( $title->getNamespace() == NS_MEDIAWIKI
+ && $title->getDefaultMessageText() !== false
+ )
+ ) {
$msgKey = $isForeignFile ? 'edit-local' : 'edit';
} else {
$msgKey = $isForeignFile ? 'create-local' : 'create';
}
$content_navigation['views']['edit'] = array(
- 'class' => ( $isEditing && ( $section !== 'new' || !$showNewSection ) ? 'selected' : '' ) . $isTalkClass,
- 'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )->setContext( $this->getContext() )->text(),
+ 'class' => ( $isEditing && ( $section !== 'new' || !$showNewSection )
+ ? 'selected'
+ : ''
+ ) . $isTalkClass,
+ 'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( $this->editUrlOptions() ),
'primary' => !$isForeignFile, // don't collapse this in vector
);
//$content_navigation['actions']['addsection']
$content_navigation['views']['addsection'] = array(
'class' => ( $isEditing && $section == 'new' ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( 'action=edit§ion=new' )
);
}
// Adds view source view link
$content_navigation['views']['viewsource'] = array(
'class' => ( $onPage && $action == 'edit' ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-action-viewsource", 'viewsource' )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-action-viewsource", 'viewsource' )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( $this->editUrlOptions() ),
'primary' => true, // don't collapse this in vector
);
// Adds history view link
$content_navigation['views']['history'] = array(
'class' => ( $onPage && $action == 'history' ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-view-history", 'history_short' )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-view-history", 'history_short' )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( 'action=history' ),
'rel' => 'archives',
);
if ( $title->quickUserCan( 'delete', $user ) ) {
$content_navigation['actions']['delete'] = array(
'class' => ( $onPage && $action == 'delete' ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-action-delete", 'delete' )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-action-delete", 'delete' )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( 'action=delete' )
);
}
$moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() );
$content_navigation['actions']['move'] = array(
'class' => $this->getTitle()->isSpecial( 'Movepage' ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-action-move", 'move' )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-action-move", 'move' )
+ ->setContext( $this->getContext() )->text(),
'href' => $moveTitle->getLocalURL()
);
}
$n = $title->isDeleted();
if ( $n ) {
$undelTitle = SpecialPage::getTitleFor( 'Undelete' );
- // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead
+ // If the user can't undelete but can view deleted
+ // history show them a "View .. deleted" tab instead.
$msgKey = $user->isAllowed( 'undelete' ) ? 'undelete' : 'viewdeleted';
$content_navigation['actions']['undelete'] = array(
'class' => $this->getTitle()->isSpecial( 'Undelete' ) ? 'selected' : false,
$mode = $title->isProtected() ? 'unprotect' : 'protect';
$content_navigation['actions'][$mode] = array(
'class' => ( $onPage && $action == $mode ) ? 'selected' : false,
- 'text' => wfMessageFallback( "$skname-action-$mode", $mode )->setContext( $this->getContext() )->text(),
+ 'text' => wfMessageFallback( "$skname-action-$mode", $mode )
+ ->setContext( $this->getContext() )->text(),
'href' => $title->getLocalURL( "action=$mode" )
);
}
/**
* an array of edit links by default used for the tabs
+ * @param $content_navigation
* @return array
- * @private
*/
- function buildContentActionUrls( $content_navigation ) {
+ private function buildContentActionUrls( $content_navigation ) {
wfProfileIn( __METHOD__ );
$content_actions = array();
foreach ( $content_navigation as $links ) {
-
foreach ( $links as $key => $value ) {
-
if ( isset( $value['redundant'] ) && $value['redundant'] ) {
// Redundant tabs are dropped from content_actions
continue;
}
$content_actions[$key] = $value;
-
}
-
}
wfProfileOut( __METHOD__ );
/**
* build array of common navigation links
* @return array
- * @private
*/
protected function buildNavUrls() {
global $wgUploadNavigationUrl;
/**
* Generate strings used for xml 'id' names
* @return string
- * @private
*/
- function getNameSpaceKey() {
+ protected function getNameSpaceKey() {
return $this->getTitle()->getNamespaceKey();
}
}
*/
function __construct() {
$this->data = array();
- $this->translator = new MediaWiki_I18N();
+ $this->translator = new MediaWikiI18N();
}
/**
}
/**
- * @param MediaWiki_I18N $t
+ * @param MediaWikiI18N $t
*/
public function setTranslator( &$t ) {
$this->translator = &$t;
wfProfileIn( __METHOD__ );
$toolbox = array();
- if ( isset( $this->data['nav_urls']['whatlinkshere'] ) && $this->data['nav_urls']['whatlinkshere'] ) {
+ if ( isset( $this->data['nav_urls']['whatlinkshere'] )
+ && $this->data['nav_urls']['whatlinkshere']
+ ) {
$toolbox['whatlinkshere'] = $this->data['nav_urls']['whatlinkshere'];
$toolbox['whatlinkshere']['id'] = 't-whatlinkshere';
}
- if ( isset( $this->data['nav_urls']['recentchangeslinked'] ) && $this->data['nav_urls']['recentchangeslinked'] ) {
+ if ( isset( $this->data['nav_urls']['recentchangeslinked'] )
+ && $this->data['nav_urls']['recentchangeslinked']
+ ) {
$toolbox['recentchangeslinked'] = $this->data['nav_urls']['recentchangeslinked'];
$toolbox['recentchangeslinked']['msg'] = 'recentchangeslinked-toolbox';
$toolbox['recentchangeslinked']['id'] = 't-recentchangeslinked';
$toolbox['feeds']['links'][$key]['class'] = 'feedlink';
}
}
- foreach ( array( 'contributions', 'log', 'blockip', 'emailuser', 'userrights', 'upload', 'specialpages' ) as $special ) {
+ foreach ( array( 'contributions', 'log', 'blockip', 'emailuser',
+ 'userrights', 'upload', 'specialpages' ) as $special
+ ) {
if ( isset( $this->data['nav_urls'][$special] ) && $this->data['nav_urls'][$special] ) {
$toolbox[$special] = $this->data['nav_urls'][$special];
$toolbox[$special]['id'] = "t-$special";
}
while ( count( $wrapper ) > 0 ) {
$element = array_pop( $wrapper );
- $html = Html::rawElement( $element['tag'], isset( $element['attributes'] ) ? $element['attributes'] : null, $html );
+ $html = Html::rawElement( $element['tag'], isset( $element['attributes'] )
+ ? $element['attributes']
+ : null, $html );
}
}
$attrs['class'] = $options['link-class'];
}
}
- $html = Html::rawElement( isset( $attrs['href'] ) ? 'a' : $options['link-fallback'], $attrs, $html );
+ $html = Html::rawElement( isset( $attrs['href'] )
+ ? 'a'
+ : $options['link-fallback'], $attrs, $html );
}
return $html;
* If you pass "flat" as an option then the returned array will be a flat array
* of footer icons instead of a key/value array of footerlinks arrays broken
* up into categories.
+ * @param string $option
* @return array|mixed
*/
function getFooterLinks( $option = null ) {
* in the list of footer icons. This is mostly useful for skins which only
* display the text from footericons instead of the images and don't want a
* duplicate copyright statement because footerlinks already rendered one.
+ * @param string $option
* @return string
*/
function getFooterIcons( $option = null ) {
<?php $this->html( 'reporttime' ) ?>
<?php
}
-
}