<?php
+/**
+ * Base class for template-based skins
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
if ( ! defined( 'MEDIAWIKI' ) )
die( 1 );
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# http://www.gnu.org/copyleft/gpl.html
-
/**
* Wrapper object for MediaWiki's localization functions,
* to be passed to the template engine.
* @param $out OutputPage
*/
function setupSkinUserCss( OutputPage $out ){
- $out->addStyle( 'common/shared.css', 'screen' );
- $out->addStyle( 'common/commonPrint.css', 'print' );
+ $out->addModuleStyles( array( 'mediawiki.legacy.shared', 'mediawiki.legacy.commonPrint' ) );
}
/**
* and eventually it spits out some HTML. Should have interface
* roughly equivalent to PHPTAL 0.7.
*
- * @param $callback string (or file)
+ * @param $classname string (or file)
* @param $repository string: subdirectory where we keep template files
* @param $cache_dir string
* @return object
*/
function outputPage( OutputPage $out ) {
global $wgArticle, $wgUser, $wgLang, $wgContLang;
- global $wgScript, $wgStylePath, $wgContLanguageCode;
+ global $wgScript, $wgStylePath, $wgLanguageCode;
global $wgMimeType, $wgJsMimeType, $wgOutputEncoding, $wgRequest;
global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
global $wgDisableCounters, $wgLogo, $wgHideInterlanguageLinks;
$tpl->setRef( 'xhtmldefaultnamespace', $wgXhtmlDefaultNamespace );
$tpl->set( 'xhtmlnamespaces', $wgXhtmlNamespaces );
$tpl->set( 'html5version', $wgHtml5Version );
- $tpl->set( 'headlinks', $out->getHeadLinks() );
+ $tpl->set( 'headlinks', $out->getHeadLinks( $this->getSkinName() ) );
$tpl->set( 'csslinks', $out->buildCssLinks() );
if( $wgUseTrackbacks && $out->isArticleRelated() ) {
$tpl->setRef( 'scriptpath', $wgScriptPath );
$tpl->setRef( 'serverurl', $wgServer );
$tpl->setRef( 'logopath', $wgLogo );
- $tpl->setRef( 'lang', $wgContLanguageCode );
- $tpl->set( 'dir', $wgContLang->getDir() );
- $tpl->set( 'rtl', $wgContLang->isRTL() );
+
+ $lang = wfUILang();
+ $tpl->set( 'lang', $lang->getCode() );
+ $tpl->set( 'dir', $lang->getDir() );
+ $tpl->set( 'rtl', $lang->isRTL() );
+
$tpl->set( 'capitalizeallnouns', $wgLang->capitalizeAllNouns() ? ' capitalize-all-nouns' : '' );
- $tpl->set( 'langname', $wgContLang->getLanguageName( $wgContLanguageCode ) );
$tpl->set( 'showjumplinks', $wgUser->getOption( 'showjumplinks' ) );
$tpl->set( 'username', $wgUser->isAnon() ? null : $this->username );
$tpl->setRef( 'userpage', $this->userpage );
$tpl->set( 'reporttime', wfReportTime() );
$tpl->set( 'sitenotice', wfGetSiteNotice() );
- $tpl->set( 'bottomscripts', $this->bottomScripts() );
+ $tpl->set( 'bottomscripts', $this->bottomScripts( $out ) );
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n";
+ global $wgBetterDirectionality;
+ if ( $wgBetterDirectionality ) {
+ $realBodyAttribs = array( 'lang' => $wgLanguageCode, 'dir' => $wgContLang->getDir() );
+ $out->mBodytext = Html::rawElement( 'div', $realBodyAttribs, $out->mBodytext );
+ }
$out->mBodytext .= $printfooter . $this->generateDebugHTML();
$tpl->setRef( 'bodytext', $out->mBodytext );
'href' => $nt->getFullURL(),
'text' => ( $wgContLang->getLanguageName( $nt->getInterwiki() ) != '' ?
$wgContLang->getLanguageName( $nt->getInterwiki() ) : $l ),
+ 'title' => $nt->getText(),
'class' => $class
);
}
* an error object of the appropriate type.
* For the base class, assume strings all around.
*
- * @param mixed $str
+ * @param $str Mixed
* @private
*/
function printOrError( $str ) {
self::checkTitle( $title, $name );
return array(
'href' => $title->getLocalURL( $urlaction ),
- 'exists' => $title->getArticleID() != 0 ? true : false
+ 'exists' => $title->getArticleID() != 0,
);
}
self::checkTitle( $title, $name );
return array(
'href' => $title->getLocalURL( $urlaction ),
- 'exists' => $title->getArticleID() != 0 ? true : false
+ 'exists' => $title->getArticleID() != 0,
);
}
$istalkclass = $istalk?' istalk':'';
$content_actions['edit'] = array(
'class' => ( ( ( $action == 'edit' or $action == 'submit' ) and $section != 'new' ) ? 'selected' : '' ) . $istalkclass,
- 'text' => ( $this->mTitle->exists() || ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) )
+ 'text' => ( $this->mTitle->exists() || ( $this->mTitle->getNamespace() == NS_MEDIAWIKI && !wfEmptyMsg( $this->mTitle->getText() ) ) )
? wfMsg( 'edit' )
: wfMsg( 'create' ),
'href' => $this->mTitle->getLocalUrl( $this->editUrlOptions() )
*/
function buildNavUrls() {
global $wgUseTrackbacks, $wgOut, $wgUser, $wgRequest;
- global $wgEnableUploads, $wgUploadNavigationUrl;
+ global $wgUploadNavigationUrl;
wfProfileIn( __METHOD__ );