public function makeGlobalVariables() { $app = F::app(); $vars = array(); // RTE has been disabled but minieditor is enabled. probably shouldn't be allowed to happen if (!class_exists('RTE')) { $vars['RTEDisabledReason'] = 'sitedisabled'; } else { // Need to call RTE::init to get Disabled reason (if any, usually preferences) $ep = new EditPage(new Article(new Title())); RTE::init($ep); RTE::makeGlobalVariablesScript($vars); // pass by reference } // FIXME: We have to force AssetsManager to combine scripts. // MiniEditor will break in loadOnDemand mode because of improper script execution order. $minify = empty($this->wg->DevelEnvironment); // If RTE is disabled, fall back to the mediawiki editor if (isset($vars['RTEDisabledReason'])) { $assetList = AssetsManager::getInstance()->getGroupCommonURL('mini_editor_js', array(), true, $minify); } else { $assetList = AssetsManager::getInstance()->getGroupCommonURL('mini_editor_rte_js', array(), true, $minify); } // Save our asset list for loading in JavaScript $vars['wgMiniEditorAssets'] = $assetList; // EditPage needs to know if this is an article page, and it is not. $vars['wgIsArticle'] = false; // Image uploading can only happen on action=edit pages, make it so. $vars['wgAction'] = 'edit'; // Extensions use hooks to load their setup only on edit pages (VideoEmbedTool, WikiaMiniUploader) // To load ONLY the vars we need and not all of them we will call the setup functions directly if ($app->wg->EnableVideoToolExt) { VETSetupVars($vars); // pass by reference } if ($app->wg->EnableWikiaMiniUploadExt) { WMUSetupVars($vars); // pass by reference } $this->response->setData($vars); }