+ $scripts .= $this->makeResourceLoaderLink( $sk, $userScripts, ResourceLoaderModule::TYPE_SCRIPTS );
+
+ return $scripts;
+ }
+
+ /**
+ * Get an array containing global JS variables
+ *
+ * Do not add things here which can be evaluated in
+ * ResourceLoaderStartupScript - in other words, without state.
+ * You will only be adding bloat to the page and causing page caches to
+ * have to be purged on configuration changes.
+ */
+ protected function getJSVars() {
+ global $wgUser, $wgRequest, $wgUseAjax, $wgEnableMWSuggest, $wgContLang;
+
+ $title = $this->getTitle();
+ $ns = $title->getNamespace();
+ $nsname = MWNamespace::exists( $ns ) ? MWNamespace::getCanonicalName( $ns ) : $title->getNsText();
+
+ $vars = array(
+ 'wgCanonicalNamespace' => $nsname,
+ 'wgCanonicalSpecialPageName' => $ns == NS_SPECIAL ?
+ SpecialPage::resolveAlias( $title->getDBkey() ) : false, # bug 21115
+ 'wgNamespaceNumber' => $title->getNamespace(),
+ 'wgPageName' => $title->getPrefixedDBKey(),
+ 'wgTitle' => $title->getText(),
+ 'wgCurRevisionId' => $title->getLatestRevID(),
+ 'wgArticleId' => $title->getArticleId(),
+ 'wgIsArticle' => $this->isArticle(),
+ 'wgAction' => $wgRequest->getText( 'action', 'view' ),
+ 'wgUserName' => $wgUser->isAnon() ? null : $wgUser->getName(),
+ 'wgUserGroups' => $wgUser->getEffectiveGroups(),
+ 'wgCategories' => $this->getCategories(),
+ 'wgBreakFrames' => $this->getFrameOptions() == 'DENY',
+ );
+ if ( $wgContLang->hasVariants() ) {
+ $vars['wgUserVariant'] = $wgContLang->getPreferredVariant();
+ }
+ foreach ( $title->getRestrictionTypes() as $type ) {
+ $vars['wgRestriction' . ucfirst( $type )] = $title->getRestrictions( $type );
+ }
+ if ( $wgUseAjax && $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
+ $vars['wgSearchNamespaces'] = SearchEngine::userNamespaces( $wgUser );