X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FOutputPage.php;h=de50c060bd7b944f7a08f5e1b89a5dd91d3b5d29;hb=9cb3299aee7acc5ba824427146e9f4c77e325ede;hp=1baf8e248e21319f346249c2c10d6132fd34f7fa;hpb=51e3fb9a716f3ccd3b114109e5a5045a09864ff0;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 1baf8e248e..de50c060bd 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -563,11 +563,6 @@ class OutputPage {
$nameWithTags = Sanitizer::normalizeCharReferences( Sanitizer::removeHTMLtags( $name ) );
$this->mPagetitle = $nameWithTags;
- $taction = $this->getPageTitleActionText();
- if( !empty( $taction ) ) {
- $name .= ' - '.$taction;
- }
-
# change "foo&bar" to "foo&bar"
$this->setHTMLTitle( wfMsg( 'pagetitle', Sanitizer::stripAllTags( $nameWithTags ) ) );
}
@@ -1430,7 +1425,17 @@ class OutputPage {
if( $variant === $wgContLang->getCode() ) {
continue;
} else {
- $aloption[] = "string-contains=$variant";
+ $aloption[] = 'string-contains=' . $variant;
+
+ // IE and some other browsers use another form of language code
+ // in their Accept-Language header, like "zh-CN" or "zh-TW".
+ // We should handle these too.
+ $ievariant = explode( '-', $variant );
+ if ( count( $ievariant ) == 2 ) {
+ $ievariant[1] = strtoupper( $ievariant[1] );
+ $ievariant = implode( '-', $ievariant );
+ $aloption[] = 'string-contains=' . $ievariant;
+ }
}
}
$this->addVaryHeader( 'Accept-Language', $aloption );
@@ -1612,8 +1617,7 @@ class OutputPage {
$sk = $wgUser->getSkin();
// Add base resources
- $this->addModules( array( 'mediawiki.legacy.wikibits' ) );
- $this->addModules( array( 'mediawiki.util' ) );
+ $this->addModules( array( 'mediawiki.legacy.wikibits', 'mediawiki.util' ) );
// Add various resources if required
if ( $wgUseAjax ) {
@@ -1622,7 +1626,7 @@ class OutputPage {
wfRunHooks( 'AjaxAddScript', array( &$this ) );
if( $wgAjaxWatch && $wgUser->isLoggedIn() ) {
- $this->addModules( 'mediawiki.legacy.ajaxwatch' );
+ $this->addModules( 'mediawiki.action.watch.ajax' );
}
if ( $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
@@ -1631,7 +1635,7 @@ class OutputPage {
}
if( $wgUser->getBoolOption( 'editsectiononrightclick' ) ) {
- $this->addModules( 'mediawiki.legacy.rightclickedit' );
+ $this->addModules( 'mediawiki.action.view.rightClickEdit' );
}
if( $wgUniversalEditButton ) {
@@ -1697,21 +1701,6 @@ class OutputPage {
print $outs;
}
- /**
- * @todo document
- */
- public static function setEncodings() {
- global $wgInputEncoding, $wgOutputEncoding;
-
- $wgInputEncoding = strtolower( $wgInputEncoding );
-
- if ( empty( $_SERVER['HTTP_ACCEPT_CHARSET'] ) ) {
- $wgOutputEncoding = strtolower( $wgOutputEncoding );
- return;
- }
- $wgOutputEncoding = $wgInputEncoding;
- }
-
/**
* @deprecated use wfReportTime() instead.
*
@@ -1813,9 +1802,7 @@ class OutputPage {
$this->mRedirect = '';
$this->mBodytext = '';
- array_unshift( $params, 'parse' );
- array_unshift( $params, $msg );
- $this->addHTML( call_user_func_array( 'wfMsgExt', $params ) );
+ $this->addWikiMsgArray( $msg, $params );
$this->returnToMain();
}
@@ -1900,7 +1887,7 @@ class OutputPage {
$this->setPageTitle( wfMsg( 'loginreqtitle' ) );
$this->setHtmlTitle( wfMsg( 'errorpagetitle' ) );
$this->setRobotPolicy( 'noindex,nofollow' );
- $this->setArticleFlag( false );
+ $this->setArticleRelated( false );
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
$loginLink = $skin->link(
@@ -2046,7 +2033,6 @@ class OutputPage {
* @return none
*/
public function addPasswordSecurity( $passwordId, $retypeId ) {
- $this->includeJQuery();
$data = array(
'password' => '#' . $passwordId,
'retype' => '#' . $retypeId,
@@ -2227,8 +2213,8 @@ class OutputPage {
$ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
$ret .= implode( "\n", array(
- $this->getHeadLinks( $sk ),
- $this->buildCssLinks(),
+ $this->getHeadLinks(),
+ $this->buildCssLinks( $sk ),
$this->getHeadItems(),
) );
if ( $sk->usercss ) {
@@ -2285,30 +2271,62 @@ class OutputPage {
return $ret;
}
- // TODO: Document
- protected function makeResourceLoaderLink( $skin, $modules, $only, $useESI = false ) {
- global $wgUser, $wgLang, $wgRequest, $wgLoadScript, $wgResourceLoaderDebug, $wgResourceLoaderUseESI,
- $wgResourceLoaderInlinePrivateModules;
- // Lazy-load ResourceLoader
+ /**
+ * Get a ResourceLoader object associated with this OutputPage
+ */
+ public function getResourceLoader() {
if ( is_null( $this->mResourceLoader ) ) {
$this->mResourceLoader = new ResourceLoader();
}
+ return $this->mResourceLoader;
+ }
+
+ /**
+ * TODO: Document
+ * @param $skin Skin
+ * @param $modules Array/string with the module name
+ * @param $only string May be styles, messages or scripts
+ * @param $useESI boolean
+ * @return string html