* @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 string Name of our skin, it probably needs to be all lower case.
+ * Child classes should override the default.
*/
- var $skinname = 'monobook';
+ public $skinname = 'monobook';
/**
- * Stylesheets set to use. Subdirectory in skins/ where various stylesheets
- * are located. 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 $stylename = 'monobook';
+ public $stylename = 'monobook';
/**
- * For QuickTemplate, the name of the subclass which will actually fill the
- * template. Child classes should override the default.
+ * @var string For QuickTemplate, the name of the subclass which will
+ * actually fill the template. Child classes should override the default.
*/
- var $template = 'QuickTemplate';
+ public $template = 'QuickTemplate';
/**
- * Whether this skin use OutputPage::headElement() to generate the "<head>"
- * tag
+ * @var bool Whether this skin use OutputPage::headElement() to generate
+ * the "<head>" tag.
*/
- var $useHeadElement = false;
-
- /**#@-*/
+ public $useHeadElement = false;
/**
* Add specific styles for this skin
'lang' => $ilInterwikiCodeBCP47,
'hreflang' => $ilInterwikiCodeBCP47,
);
- wfRunHooks( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle() ) );
+ wfRunHooks(
+ 'SkinTemplateGetLanguageLink',
+ array( &$languageLink, $languageLinkTitle, $this->getTitle() )
+ );
$languageLinks[] = $languageLink;
}
}
// 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() ) {
// 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" )
);
}
*/
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;