Example #1
0
function wfOasisSetup()
{
    global $wgHooks;
    // modules and services
    $wgHooks['ArticleSaveComplete'][] = 'LatestActivityController::onArticleSaveComplete';
    $wgHooks['ArticleSaveComplete'][] = 'PageHeaderController::onArticleSaveComplete';
    $wgHooks['BlogTemplateGetResults'][] = 'BlogListingController::getResults';
    $wgHooks['BlogsRenderBlogArticlePage'][] = 'BlogListingController::renderBlogListing';
    $wgHooks['DoEditSectionLink'][] = 'ContentDisplayController::onDoEditSectionLink';
    $wgHooks['EditPage::showEditForm:initial'][] = 'BodyController::onEditPageRender';
    $wgHooks['EditPageLayoutModifyPreview'][] = 'WikiNavigationController::onEditPageLayoutModifyPreview';
    $wgHooks['EditPageMakeGlobalVariablesScript'][] = 'WikiNavigationController::onEditPageMakeGlobalVariablesScript';
    $wgHooks['MakeHeadline'][] = 'ContentDisplayController::onMakeHeadline';
    $wgHooks['MessageCacheReplace'][] = 'WikiNavigationController::onMessageCacheReplace';
    $wgHooks['Parser::showEditLink'][] = 'ContentDisplayController::onShowEditLink';
    $wgHooks['WikiFactoryChanged'][] = 'WikiNavigationController::onWikiFactoryChanged';
    // notifications
    $wgHooks['AchievementsNotification'][] = 'NotificationsController::addBadgeNotification';
    $wgHooks['CommunityMessages::showMessage'][] = 'NotificationsController::addCommunityMessagesNotification';
    $wgHooks['EditSimilar::showMessage'][] = 'NotificationsController::addEditSimilarNotification';
    $wgHooks['SiteWideMessagesNotification'][] = 'NotificationsController::addSiteWideMessageNotification';
    $wgHooks['SkinTemplateOutputPageBeforeExec'][] = 'NotificationsController::addMessageNotification';
    // misc
    $wgHooks['MakeGlobalVariablesScript'][] = 'OasisController::onMakeGlobalVariablesScript';
    // support "noexternals" URL param
    global $wgNoExternals, $wgRequest;
    $wgNoExternals = $wgRequest->getBool('noexternals', $wgNoExternals);
    //Oasis-navigation-v2 messages
    $jsMessages = new JSMessages();
    $jsMessages->registerPackage('Oasis-navigation-v2', array('oasis-navigation-v2-*'));
    $jsMessages->registerPackage('Oasis-mobile-switch', array('oasis-mobile-site'));
    // Generic messages that can be used by all extensions such as error messages
    $jsMessages->registerPackage('Oasis-generic', ['oasis-generic-error']);
    $jsMessages->enqueuePackage('Oasis-generic', JSMessages::EXTERNAL);
}
 public function index()
 {
     global $wgAutoloadClasses;
     wfProfileIn(__METHOD__);
     RenderContentOnlyHelper::setRenderContentVar(true);
     RenderContentOnlyHelper::setRenderContentLevel(RenderContentOnlyHelper::LEAVE_NAV_ONLY);
     $this->response->addAsset('extensions/wikia/SpecialStyleguide/css/SpecialStyleguide.scss');
     $this->wg->Out->setPageTitle(wfMessage('styleguide-pagetitle')->plain());
     $this->response->setCacheValidity(WikiaResponse::CACHE_STANDARD);
     $subpage = mb_strtolower($this->getFirstTextAfterSlash($this->wg->Title->getSubpageText()));
     switch ($subpage) {
         case 'components':
             $data = ['header' => $this->getSectionContent('header/components'), 'body' => $this->getSectionContent('components'), 'footer' => $this->getSectionContent('footer')];
             $this->response->addAsset('extensions/wikia/SpecialStyleguide/js/SpecialStyleguide.js');
             JSMessages::enqueuePackage('SpecialStyleguide', JSMessages::EXTERNAL);
             break;
         default:
             $data = ['header' => $this->getSectionContent('header'), 'body' => $this->getSectionContent('home'), 'footer' => $this->getSectionContent('footer')];
             break;
     }
     $this->wg->Out->clearHTML();
     $this->wg->Out->addHtml((new Wikia\Template\MustacheEngine())->setPrefix(dirname(__FILE__) . '/templates')->setData($data)->render('SpecialStyleguide_index.mustache'));
     // skip rendering
     $this->skipRendering();
     wfProfileOut(__METHOD__);
 }
 public function index()
 {
     $this->wg->Out->setPageTitle(wfMsg('wikifeatures-title'));
     if (!$this->wg->User->isAllowed('wikifeaturesview')) {
         // show this feature to logged in users only regardless of their rights
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     JSMessages::enqueuePackage('WikiFeatures', JSMessages::EXTERNAL);
     $this->response->addAsset('extensions/wikia/WikiFeatures/css/WikiFeatures.scss');
     $this->response->addAsset('extensions/wikia/WikiFeatures/js/modernizr.transform.js');
     $this->response->addAsset('extensions/wikia/WikiFeatures/js/WikiFeatures.js');
     if ($this->getVal('simulateNewLabs', false)) {
         // debug code
         WikiFeaturesHelper::$release_date = array('wgEnableChat' => '2032-09-01');
     }
     $this->features = WikiFeaturesHelper::getInstance()->getFeatureNormal();
     $this->labsFeatures = WikiFeaturesHelper::getInstance()->getFeatureLabs();
     $this->editable = $this->wg->User->isAllowed('wikifeatures') ? true : false;
     // only those with rights can make edits
     if ($this->getVal('simulateEmptyLabs', false)) {
         // debug code
         $this->labsFeatures = array();
     }
 }
 /**
  * Main action for this special page
  */
 public function index()
 {
     wfProfileIn(__METHOD__);
     $this->wg->Out->setPageTitle(wfMessage('edit-hub-title')->text());
     if ($this->checkAccess()) {
         $this->wg->SuppressSpotlights = true;
         $this->wg->SuppressWikiHeader = true;
         $this->wg->SuppressPageHeader = true;
         $this->wg->SuppressFooter = true;
         $this->response->addAsset('/extensions/wikia/SpecialEditHub/css/EditHub.scss');
         $this->response->addAsset('/skins/oasis/css/modules/CorporateDatepicker.scss');
         $action = $this->getRequestedAction();
         JSMessages::enqueuePackage('EditHub', JSMessages::EXTERNAL);
         switch ($action) {
             case 'editHub':
                 $this->forward(__CLASS__, 'editHubAction');
                 break;
             case 'index':
             default:
                 $this->forward(__CLASS__, 'dashboardAction');
                 break;
         }
     }
     wfProfileOut(__METHOD__);
 }
Example #5
0
 protected function openShowVideo()
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     JSMessages::enqueuePackage('VideoPage', JSMessages::EXTERNAL);
     $file = $this->getDisplayedFile();
     //If a timestamp is specified, show the archived version of the video (if it exists)
     $timestamp = $app->wg->Request->getInt('t', 0);
     if ($timestamp > 0) {
         $archiveFile = wfFindFile($this->mTitle, $timestamp);
         if ($archiveFile instanceof LocalFile && $archiveFile->exists()) {
             $file = $archiveFile;
         }
     }
     $autoplay = $app->wg->VideoPageAutoPlay;
     // JS for VideoBootstrap
     $embedCode = $file->getEmbedCode(self::VIDEO_WIDTH, ['autoplay' => $autoplay]);
     // Tell JS that HTML will already be loaded on the page.
     $embedCode['htmlPreloaded'] = 1;
     // HTML is no longer needed in VideoBootstrap
     $html = $embedCode['html'];
     unset($embedCode['html']);
     $videoDisplay = '<script type="text/javascript">window.playerParams = ' . json_encode($embedCode) . ';</script>';
     $videoDisplay .= '<div class="fullImageLink" id="file">' . $html . '</div>';
     $videoDisplay .= $this->getVideoInfoLine($file);
     $app->wg->Out->addHTML($videoDisplay);
     wfProfileOut(__METHOD__);
 }
 /**
  * Load JS needed to display the VideosModule at the bottom of the article content
  * @param OutputPage $out
  * @param string $text
  * @return bool
  */
 public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
 {
     wfProfileIn(__METHOD__);
     // Check if we're on a page where we want to show the Videos Module.
     // If we're not, stop right here.
     if (!self::canShowVideosModule()) {
         wfProfileOut(__METHOD__);
         return true;
     }
     // On file pages, this hook can be called multiple times, so we're going to check if the
     // assets are loaded already before we load them again.
     $app = F::app();
     // Don't do anything if we've already loaded the assets
     if ($app->wg->VideosModuleAssetsLoaded) {
         wfProfileOut(__METHOD__);
         return true;
     }
     // Don't do anything if this is the main page of a site with the VPT enabled
     if ($app->wg->Title->isMainPage() && $app->wg->EnableVideoPageToolExt) {
         wfProfileOut(__METHOD__);
         return true;
     }
     JSMessages::enqueuePackage('VideosModule', JSMessages::EXTERNAL);
     if ($app->checkSkin('venus')) {
         Wikia::addAssetsToOutput('videos_module_venus_js');
         Wikia::addAssetsToOutput('videos_module_venus_scss');
     } else {
         Wikia::addAssetsToOutput('videos_module_js');
     }
     $app->wg->VideosModuleAssetsLoaded = true;
     wfProfileOut(__METHOD__);
     return true;
 }
 /**
  * Send MediaGallery i18n messages to JS.
  * Note: adding them via onOasisSkinAssetGroups doesn't work.
  * @param OutputPage $out
  * @param $text
  * @return bool
  */
 public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
 {
     if (!empty(F::app()->wg->EnableMediaGalleryExt)) {
         JSMessages::enqueuePackage('MediaGallery', JSMessages::EXTERNAL);
     }
     return true;
 }
 public function index()
 {
     if (!$this->checkAccess()) {
         return false;
     }
     $this->wg->out->setPageTitle(wfMsg('promote-title'));
     if (!$this->app->checkSkin('oasis')) {
         $this->wg->out->addWikiMsg('promote-error-oasis-only');
         $this->skipRendering();
         return true;
     }
     $this->response->addAsset('extensions/wikia/SpecialPromote/js/SpecialPromote.js');
     JSMessages::enqueuePackage('SpecialPromote', JSMessages::EXTERNAL);
     $this->minHeaderLength = $this->helper->getMinHeaderLength();
     $this->maxHeaderLength = $this->helper->getMaxHeaderLength();
     $this->minDescriptionLength = $this->helper->getMinDescriptionLength();
     $this->maxDescriptionLength = $this->helper->getMaxDescriptionLength();
     $this->wikiHeadline = $this->helper->getWikiHeadline();
     $this->wikiDesc = $this->helper->getWikiDesc();
     $this->mainImage = $this->helper->getMainImage();
     $this->additionalImages = $this->helper->getAdditionalImages();
     $this->wikiStatus = $this->helper->getWikiStatusMessage($this->wg->CityId, $this->wg->contLang->getCode());
     $cityVisualization = new CityVisualization();
     $this->isCorpLang = $cityVisualization->isCorporateLang($this->wg->contLang->getCode());
 }
Example #9
0
 public static function onBlogArticleInitialized(CreateBlogPage $blogPage, $mode)
 {
     if ($mode == SpecialCustomEditPage::MODE_EDIT || !$blogPage->user->isAllowed(self::PERM_NAME)) {
         return true;
     }
     Wikia::addAssetsToOutput('extensions/wikia/BlogEditCategoryPrompter/becp.js');
     JSMessages::enqueuePackage('BECP', JSMessages::INLINE);
     return true;
 }
 /**
  * Route the view based on logged in status
  *
  * The only logged in user who must not be re-routed away from
  * the signup form are those who have the right to create new
  * accounts (are members of the createaccount group and therefore
  * have the createaccount right). An example use case: Wikia One's
  * user accounts can be created by a limited group of Wikia
  * employees who have been given the right explicitly.
  */
 public function index()
 {
     JSMessages::enqueuePackage('UserSignup', JSMessages::EXTERNAL);
     if ($this->wg->User->isLoggedIn() && !$this->wg->User->isAllowed('createaccount')) {
         $this->forward('UserLoginSpecialController', 'loggedIn');
     } else {
         $this->forward(__CLASS__, 'signupForm');
     }
 }
Example #11
0
 /**
  * Add extension's JS, CSS and load messages
  *
  * @param EditPageLayoutModule $module edit page module
  * @return boolean always true
  */
 public static function onEditPageLayoutExecute($module)
 {
     $app = F::app();
     // add JS and CSS
     $app->wg->Out->addScriptFile($app->wg->ExtensionsPath . '/wikia/hacks/AutoLinker/js/AutoLinkerModule.js');
     // load messages
     JSMessages::enqueuePackage('AutoLinker', JSMessages::EXTERNAL);
     return true;
 }
 public function index()
 {
     if (!$this->wg->User->isAllowed('curatedcontent')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $this->response->setTemplateEngine(self::TEMPLATE_ENGINE);
     $title = wfMessage('wikiacuratedcontent-content-title');
     $this->wg->Out->setPageTitle($title);
     $this->wg->Out->setHTMLTitle($title);
     $this->wg->Out->addModules(['jquery.autocomplete', 'jquery.ui.sortable', 'wikia.yui', 'wikia.aim']);
     $assetManager = AssetsManager::getInstance();
     $styles = $assetManager->getURL(['extensions/wikia/CuratedContent/css/CuratedContentManagmentTool.scss', 'extensions/wikia/WikiaMiniUpload/css/WMU.scss']);
     foreach ($styles as $s) {
         $this->wg->Out->addStyle($s);
     }
     $scripts = $assetManager->getURL(['/extensions/wikia/CuratedContent/js/CuratedContentManagmentTool.js', '/extensions/wikia/WikiaMiniUpload/js/WMU.js']);
     foreach ($scripts as $s) {
         $this->wg->Out->addScriptFile($s);
     }
     JSMessages::enqueuePackage('CuratedContentMsg', JSMessages::INLINE);
     $this->response->setVal('descriptions', [wfMessage('wikiacuratedcontent-content-description-items'), wfMessage('wikiacuratedcontent-content-description-supported-items-for-sections'), wfMessage('wikiacuratedcontent-content-description-tag-needs-image'), wfMessage('wikiacuratedcontent-content-description-section'), wfMessage('wikiacuratedcontent-content-description-organize'), wfMessage('wikiacuratedcontent-content-description-no-section'), wfMessage('wikiacuratedcontent-content-description-items-input')]);
     $this->response->setVal('addSection', wfMessage('wikiacuratedcontent-content-add-section'));
     $this->response->setVal('addItem', wfMessage('wikiacuratedcontent-content-add-item'));
     $this->response->setVal('save', wfMessage('wikiacuratedcontent-content-save'));
     $this->response->setVal('section_placeholder', wfMessage('wikiacuratedcontent-content-section'));
     $this->response->setVal('item_placeholder', wfMessage('wikiacuratedcontent-content-item'));
     $this->response->setVal('name_placeholder', wfMessage('wikiacuratedcontent-content-name'));
     $itemTemplate = $this->sendSelfRequest(self::ITEM_FUNCTION_NAME)->toString();
     $sectionTemplate = $this->sendSelfRequest('section')->toString();
     $this->wg->Out->addJsConfigVars(['itemTemplate' => $itemTemplate, 'sectionTemplate' => $sectionTemplate]);
     $sections = $this->wg->WikiaCuratedContent;
     if (!empty($sections)) {
         $list = '';
         foreach ($sections as $section) {
             if (isset($section['featured']) && $section['featured']) {
                 $featuredSection = $this->buildSection($section);
             } else {
                 $list .= $this->buildSection($section);
             }
         }
         if (!isset($featuredSection)) {
             // add featured section if not yet exists
             $featuredSection = $this->sendSelfRequest(self::FEATURED_SECTION_TEMPLATE);
         }
         // prepend featured section
         $list = $featuredSection . $list;
         $this->response->setVal('list', $list);
     } else {
         $this->response->setVal('section', $sectionTemplate);
         $this->response->setVal('item', $itemTemplate);
     }
     return true;
 }
 public function multiSelect()
 {
     JSMessages::enqueuePackage('WikiaStyleGuideDropdown', JSMessages::EXTERNAL);
     $this->response->addAsset('extensions/wikia/WikiaStyleGuide/js/Dropdown.js');
     $this->response->addAsset('extensions/wikia/WikiaStyleGuide/js/MultiSelectDropdown.js');
     $this->response->addAsset('extensions/wikia/WikiaStyleGuide/css/Dropdown.scss');
     $this->response->addAsset('extensions/wikia/WikiaStyleGuide/css/MultiSelectDropdown.scss');
     $this->options = $this->getVal('options', array());
     $this->selected = $this->getVal('selected', array());
     $this->toolbar = $this->getVal('toolbar', '');
     $this->selectAll = $this->getVal('selectAll', '');
 }
 /**
  * Load MiniEditor css and js dependencies
  * extensions can add more assets to be loaded AFTER the MiniEditor assets
  * this entire bundle of js vars and assets can be loaded in-page or via makeGlobalVariables (below)
  *
  * @request type array additionalAssets
  * @request type boolean loadOnDemand
  * @request type array loadOnDemandAssets
  */
 public function loadAssets()
 {
     $loadStyles = $this->request->getVal('loadStyles', true);
     $loadOnDemand = $this->request->getVal('loadOnDemand', false);
     $additionalAssets = $this->request->getVal('additionalAssets', array());
     // FIXME: load JSMessages for VET and WMU extensions here too
     // FIXME: must refactor VET and WMU to use JSMessages first
     JSMessages::enqueuePackage('EditPageLayout', JSMessages::EXTERNAL);
     // If this function got called, MiniEditor is enabled
     $this->response->setJSVar('wgEnableMiniEditorExt', true);
     // Create a JS variable to let us know if we are loading on demand or not
     $this->response->setJsVar('wgMiniEditorLoadOnDemand', $loadOnDemand);
     // VOLDEV-25: Create a JS variable to let us know if LinkSuggest should be loaded
     $this->response->setJsVar('wgEnableMiniEditorLinkSuggest', $this->wg->EnableLinkSuggestExt && !$this->wg->User->getGlobalPreference('disablelinksuggest'));
     // If styles are not loaded here, they must be loaded in JavaScript
     if ($loadStyles) {
         $this->response->addAsset('extensions/wikia/MiniEditor/css/MiniEditor.scss');
     }
     // Loading assets on demand
     if ($loadOnDemand) {
         // Export a list of assets to javascript for future dynamic loading
         $this->response->setJsVar('wgMiniEditorAssets', $this->request->getVal('loadOnDemandAssets', array()));
     } else {
         // Load javascript variables
         $response = $this->sendSelfRequest('makeGlobalVariables');
         $jsvars = $response->getData();
         // Load any required assets
         // TODO: add a "raw_url" = true param to $response->addAsset so we can use that
         foreach ($jsvars['wgMiniEditorAssets'] as $asset) {
             // Load JavaScript files/AssetManager groups
             if (preg_match("/(.js(\\?(.*))?\$)|(__am\\/\\d+\\/group)/", $asset)) {
                 $this->wg->Out->addScript("<script type=\"{$this->wg->JsMimeType}\" src=\"{$asset}\"></script>");
                 // Load SASS/CSS files
             } else {
                 if (preg_match("/.s?css(\\?(.*))?\$/", $asset)) {
                     $this->wg->Out->addStyle($asset);
                 }
             }
         }
         // Don't include wgMiniEditorAssets in global page vars
         unset($jsvars['wgMiniEditorAssets']);
         // Set the rest of our global JS vars
         foreach ($jsvars as $var => $value) {
             $this->response->setJsVar($var, $value);
         }
     }
     // Additional assets
     foreach ($additionalAssets as $asset) {
         $this->response->addAsset($asset);
     }
     // No visible output from this module for now so we don't need a template for this function
     $this->skipRendering();
 }
 public function editPage()
 {
     $this->response->setVal('articleUrl', $this->app->wg->Title->getLocalUrl());
     JSMessages::enqueuePackage('wikiamobileeditor', JSMessages::INLINE);
     $this->response->setVal('cancel', wfMessage('wikiamobileeditor-cancel')->text());
     $this->response->setVal('preview', wfMessage('wikiamobileeditor-preview')->text());
     $this->response->setVal('publish', wfMessage('wikiamobileeditor-publish')->text());
     $this->response->setVal('keepEditing', wfMessage('wikiamobileeditor-keep-editing')->text());
     $this->response->setVal('summaryPlaceholder', wfMessage('wikiamobileeditor-summary-placeholder')->escaped());
     $this->response->setVal('licensing', wfMessage('wikiamobileeditor-licensing')->text());
     $this->response->setVal('licensingType', $this->wg->RightsText);
 }
 /**
  * @brief Displays the main menu for the admin dashboard
  *
  */
 public function index()
 {
     $this->wg->Out->setPageTitle(wfMsg('admindashboard-title'));
     if (!$this->wg->User->isAllowed('admindashboard')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $this->tab = $this->getVal('tab', 'general');
     // links
     $this->urlThemeDesigner = Title::newFromText('ThemeDesigner', NS_SPECIAL)->getFullURL();
     $this->urlRecentChanges = Title::newFromText('RecentChanges', NS_SPECIAL)->getFullURL();
     $this->urlTopNavigation = Title::newFromText('Wiki-navigation', NS_MEDIAWIKI)->getFullURL('action=edit');
     $this->urlWikiFeatures = Title::newFromText('WikiFeatures', NS_SPECIAL)->getFullURL();
     $this->urlListUsers = Title::newFromText('ListUsers', NS_SPECIAL)->getFullURL();
     $this->urlUserRights = Title::newFromText('UserRights', NS_SPECIAL)->getFullURL();
     $this->urlCommunityCorner = Title::newFromText('Community-corner', NS_MEDIAWIKI)->getFullURL('action=edit');
     $this->urlAllCategories = Title::newFromText('Categories', NS_SPECIAL)->getFullURL();
     $this->urlAddPage = Title::newFromText('CreatePage', NS_SPECIAL)->getFullURL();
     $this->urlAddPhoto = Title::newFromText('Upload', NS_SPECIAL)->getFullURL();
     if (!empty($this->wg->EnableSpecialVideosExt)) {
         $this->showVideoLink = true;
         $this->urlAddVideo = Title::newFromText('WikiaVideoAdd', NS_SPECIAL)->getFullURL();
         $this->urlAddVideoReturnUrl = SpecialPage::getTitleFor("Videos")->escapeLocalUrl("sort=recent");
     } else {
         $this->showVideoLink = false;
     }
     $this->urlCreateBlogPage = Title::newFromText('CreateBlogPage', NS_SPECIAL)->getFullURL();
     $this->urlMultipleUpload = Title::newFromText('MultipleUpload', NS_SPECIAL)->getFullURL();
     $this->urlLVS = Title::newFromText('LicensedVideoSwap', NS_SPECIAL)->getFullURL();
     $this->urlSpecialCss = SpecialPage::getTitleFor('CSS')->getFullURL();
     // special:specialpages
     $this->advancedSection = (string) $this->app->sendRequest('AdminDashboardSpecialPage', 'getAdvancedSection', array());
     // icon display logic
     $this->displayWikiFeatures = !empty($this->wg->EnableWikiFeatures);
     $this->displaySpecialCss = !empty($this->wg->EnableSpecialCssExt);
     // LicensedVideoSwap
     if (empty($this->wg->EnableLicensedVideoSwapExt)) {
         $this->displayLicensedVideoSwap = false;
         $this->badgeLicensedVideoSwap = '';
     } else {
         $this->displayLicensedVideoSwap = true;
         // alert badge
         $lvsHelper = new LicensedVideoSwapHelper();
         $this->badgeLicensedVideoSwap = $lvsHelper->getAlertBadge();
     }
     // add messages package
     JSMessages::enqueuePackage('AdminDashboard', JSMessages::INLINE);
     // Add Upload Photos Dialog
     Wikia::addAssetsToOutput('upload_photos_dialog_js');
     Wikia::addAssetsToOutput('upload_photos_dialog_scss');
 }
 public function index()
 {
     $this->class = $this->request->getVal('class', '');
     $this->text = $this->request->getVal('text', '');
     $this->tooltip = $this->request->getVal('tooltip');
     $this->tabindex = $this->request->getVal('tabindex', null);
     if ($this->app->checkSkin('wikiamobile')) {
         JSMessages::registerPackage('fblogin', array('wikiamobile-facebook-connect-fail'));
         JSMessages::enqueuePackage('fblogin', JSMessages::INLINE);
         $this->response->setVal('requestType', $this->request->getVal('requestType'));
         $this->overrideTemplate('WikiaMobileIndex');
     }
 }
 public function index()
 {
     //cache response on varnish for 1h to enable rolling of stats
     $this->response->setCacheValidity(3600);
     $this->response->addAsset('wikiahomepage_scss');
     $this->response->addAsset('wikiahomepage_js');
     $this->hubsSlots = $this->prepareHubsSectionSlots();
     JSMessages::enqueuePackage('WikiaHomePage', JSMessages::EXTERNAL);
     $batches = $this->getList();
     $this->wg->Out->addJsConfigVars(['wgCollectionsBatches' => $this->getCollectionsWikiList(), 'wgWikiaBatchesStatus' => $batches['status'], 'wgInitialWikiBatchesForVisualization' => $batches['batches']]);
     $this->lang = self::getContentLang();
     OasisController::addBodyClass('WikiaHome');
 }
 public function preferences()
 {
     JSMessages::enqueuePackage('FacebookClient', JSMessages::EXTERNAL);
     $this->response->addAsset('facebook_client_preferences_scss');
     $isUserConnected = $this->getVal('isConnected', false);
     // Settings for a connected user
     $disconnectLink = wfMessage('fbconnect-disconnect-account-link')->parse();
     $fbFromExist = F::app()->wg->User->getGlobalFlag('fbFromExist');
     // Settings for a user who is not connected yet
     $convertMessage = wfMessage('fbconnect-convert')->plain();
     $connectButton = F::app()->renderView('FacebookButton', 'index', ['class' => 'sso-login-facebook', 'text' => wfMessage('prefs-fbconnect-prefstext')->escaped()]);
     $disconnectButton = F::app()->renderView('FacebookButton', 'index', ['class' => 'fb-disconnect', 'text' => wfMessage('prefs-fbconnect-disconnect-prefstext')->escaped()]);
     $this->response->setData(['isConnected' => $isUserConnected, 'fbFromExist' => $fbFromExist, 'connectButton' => $connectButton, 'disconnectButton' => $disconnectButton, 'convertMessage' => $convertMessage, 'disconnectLink' => $disconnectLink]);
 }
 /**
  * @brief This function gets messages from given list of packages
  */
 public function getMessages()
 {
     // get list of requested packages
     $packages = explode(',', $this->request->getVal('packages'));
     // get messages from given packages
     $messages = JSMessages::getPackages($packages);
     $this->setVal('messages', $messages);
     // this should be handled as JS script
     $this->response->setHeader('Content-type', 'application/javascript; charset=utf-8');
     // cache it well :)
     if (!$this->request->isInternal()) {
         $this->response->setCacheValidity(self::CACHE_TIME);
         $this->response->setContentType('text/javascript; charset=utf-8');
     }
 }
 /**
  * @param Article $article
  */
 function __construct(Article $article)
 {
     $this->app = F::app();
     $this->out = $this->app->wg->Out;
     $this->request = $this->app->wg->Request;
     wfProfileIn(__METHOD__);
     parent::__construct($article);
     $this->helper = EditPageLayoutHelper::getInstance();
     // default setup of summary box
     $this->mSummaryBox = array('name' => 'wpSummary', 'placeholder' => wfMsg('editpagelayout-pageControls-summaryLabel'));
     $this->mCoreEditNotices = new EditPageNotices();
     $this->mEditNotices = new EditPageNotices();
     // add messages (fetch them using <script> tag)
     JSMessages::enqueuePackage('EditPageLayout', JSMessages::EXTERNAL);
     wfProfileOut(__METHOD__);
 }
 /**
  * LicensedVideoSwap page
  *
  * @requestParam integer currentPage
  * @responseParam integer currentPage
  * @responseParam integer pages
  * @responseParam array videoList
  * @responseParam integer thumbWidth
  * @responseParam integer thumbHeight
  * @responseParam integer totalVideos
  * @responseParam string pagination
  */
 public function index()
 {
     /** @var User $user */
     $user = $this->getUser();
     if (!$user->isAllowed('licensedvideoswap')) {
         $this->displayRestrictionError();
         return false;
     }
     // set last visit date
     $user->setGlobalAttribute(LicensedVideoSwapHelper::USER_VISITED_DATE, wfTimestamp());
     $user->saveSettings();
     $helper = new LicensedVideoSwapHelper();
     // clear cache for total new videos for the user
     $helper->invalidateCacheTotalNewVideos($user->getId());
     // Add assets to both LVS and LVS/History
     // TODO: move this to Assets Manager once we release this
     $this->response->addAsset('licensed_video_swap_js');
     $this->response->addAsset('extensions/wikia/LicensedVideoSwap/css/LicensedVideoSwap.scss');
     // See if there is a subpage request to handle (i.e. /History)
     $subpage = $this->getSubpage();
     if (!$this->app->checkSkin('oasis')) {
         $oasisURL = SpecialPage::getTitleFor('LicensedVideoSwap', $subpage)->getLocalURL('useskin=wikia');
         $oasisLink = Xml::element('a', ['href' => $oasisURL], wfMessage('lvs-click-here'));
         $this->wg->out->addHTML(wfMessage('lvs-no-monobook-support')->rawParams($oasisLink)->parse());
         $this->skipRendering();
         return true;
     }
     if ($subpage) {
         $this->forward(__CLASS__, $subpage);
         return true;
     }
     // Setup messages for JS
     JSMessages::enqueuePackage('LVS', JSMessages::EXTERNAL);
     $this->wg->SupressPageSubtitle = true;
     // update h1 text and <title> element
     $this->getContext()->getOutput()->setPageTitle(wfMessage('lvs-page-title')->plain());
     $currentPage = $this->getVal('currentPage', 1);
     $sort = 'recent';
     // Get the list of videos that have suggestions
     $this->videoList = $helper->getRegularVideoList($sort, $currentPage);
     $this->thumbWidth = LicensedVideoSwapHelper::THUMBNAIL_WIDTH;
     $this->thumbHeight = LicensedVideoSwapHelper::THUMBNAIL_HEIGHT;
     // get total videos with suggestions
     $this->totalVideos = $helper->getUnswappedVideoTotal();
     // Set up pagination
     $this->pagination = $helper->getPagination($this->totalVideos, $currentPage, $sort);
 }
 public function index()
 {
     if (!$this->wg->User->isAllowed('gameguidessponsored')) {
         $this->displayRestrictionError();
         return false;
         // skip rendering
     }
     $this->response->setTemplateEngine(self::TEMPLATE_ENGINE);
     $title = wfMsg('wikiagameguides-sponsored-title');
     $this->wg->Out->setPageTitle($title);
     $this->wg->Out->setHTMLTitle($title);
     $this->wg->Out->addModules(['jquery.autocomplete', 'jquery.ui.sortable']);
     $assetManager = AssetsManager::getInstance();
     $styles = $assetManager->getURL(['extensions/wikia/GameGuides/css/GameGuidesContentManagmentTool.scss']);
     foreach ($styles as $s) {
         $this->wg->Out->addStyle($s);
     }
     $scripts = $assetManager->getURL(['/extensions/wikia/GameGuides/js/GameGuidesSponsored.js']);
     foreach ($scripts as $s) {
         $this->wg->Out->addScriptFile($s);
     }
     JSMessages::enqueuePackage('GameGuidesSponsoredMsg', JSMessages::INLINE);
     $this->response->setVal('descriptions', [wfMessage('wikiagameguides-sponsored-description-language')->text(), wfMessage('wikiagameguides-sponsored-description-wiki')->text(), wfMessage('wikiagameguides-sponsored-description-title')->text(), wfMessage('wikiagameguides-sponsored-description-url')->text()]);
     $this->response->setVal('addTag', wfMessage('wikiagameguides-sponsored-add-language')->text());
     $this->response->setVal('addCategory', wfMessage('wikiagameguides-sponsored-add-video')->text());
     $this->response->setVal('save', wfMessage('wikiagameguides-content-save')->text());
     $this->response->setVal('language_placeholder', wfMessage('wikiagameguides-sponsored-language')->text());
     $this->response->setVal('wiki_url_placeholder', wfMessage('wikiagameguides-sponsored-wiki-url')->text());
     $this->response->setVal('video_url_placeholder', wfMessage('wikiagameguides-sponsored-video-url')->text());
     $this->response->setVal('video_title_placeholder', wfMessage('wikiagameguides-sponsored-video-title')->text());
     $videoTemplate = $this->sendSelfRequest('video')->toString();
     $languageTemplate = $this->sendSelfRequest('language')->toString();
     $this->wg->Out->addJsConfigVars(['videoTemplate' => $videoTemplate, 'languageTemplate' => $languageTemplate]);
     $languages = $this->wg->WikiaGameGuidesSponsoredVideos;
     if (!empty($languages)) {
         $list = '';
         foreach ($languages as $lang => $videos) {
             $list .= $this->sendSelfRequest('language', ['value' => $lang]);
             foreach ($videos as $video) {
                 $list .= $this->sendSelfRequest('video', ['video_name' => $video['video_name'], 'video_title' => $video['video_title'], 'wiki' => $video['wiki_domain']]);
             }
         }
         $this->response->setVal('list', $list);
     }
     return true;
 }
 /**
  * Create disconnect button and other things in pref
  *
  * @param User $user
  * @param array $preferences
  * @return bool
  */
 static function GetPreferences($user, &$preferences)
 {
     // Determine if we're connected already or not
     $id = FacebookClient::getInstance()->getFacebookUserId($user);
     if ($id) {
         $isConnected = true;
         $prefTab = 'fbconnect-connect';
     } else {
         $isConnected = false;
         $prefTab = 'fbconnect-disconnect';
     }
     $html = F::app()->renderView('FacebookClientController', 'preferences', ['isConnected' => $isConnected]);
     // Create a new tab on the preferences page
     $preferences[$prefTab] = ['help' => $html, 'label' => '', 'type' => 'info', 'section' => 'fbconnect-prefstext/fbconnect-status-prefstext'];
     JSMessages::enqueuePackage('FacebookClient', JSMessages::EXTERNAL);
     return true;
 }
 public function board()
 {
     $ns = $this->wg->Title->getNamespace();
     if ($ns == NS_WIKIA_FORUM_TOPIC_BOARD) {
         $topicTitle = $this->getTopicTitle();
         if (empty($topicTitle) || !$topicTitle->exists()) {
             if (!$topicTitle->exists()) {
                 $this->redirectToIndex();
                 return false;
             }
         }
     }
     parent::index(self::BOARD_PER_PAGE);
     JSMessages::enqueuePackage('Wall', JSMessages::EXTERNAL);
     $this->response->addAsset('forum_js');
     $this->response->addAsset('extensions/wikia/Forum/css/ForumBoard.scss');
     $this->response->addAsset('extensions/wikia/Wall/css/MessageTopic.scss');
     // VOLDEV-36: separate monobook styling
     if ($this->app->checkSkin('monobook')) {
         $this->response->addAsset('extensions/wikia/Forum/css/monobook/ForumMonobook.scss');
         $this->response->addAsset('extensions/wikia/Forum/css/monobook/ForumBoardMonobook.scss');
     }
     $this->addMiniEditorAssets();
     $this->description = '';
     if ($ns == NS_WIKIA_FORUM_TOPIC_BOARD) {
         $board = ForumBoard::getEmpty();
         $this->response->setVal('activeThreads', $board->getTotalActiveThreads($this->wall->getRelatedPageId()));
         $this->response->setVal('isTopicPage', true);
         $this->app->wg->Out->setPageTitle(wfMessage('forum-board-topic-title', $this->wg->title->getBaseText())->plain());
     } else {
         $boardId = $this->wall->getId();
         $board = ForumBoard::newFromId($boardId);
         if (empty($board)) {
             $this->redirectToIndex();
             return false;
         }
         $this->response->setVal('activeThreads', $board->getTotalActiveThreads());
         $this->response->setVal('isTopicPage', false);
         $this->description = $board->getDescription();
         $this->app->wg->Out->setPageTitle(wfMessage('forum-board-title', $this->wg->title->getBaseText())->plain());
     }
     $this->response->setVal('boardNamespace', NS_WIKIA_FORUM_BOARD);
     //TODO: keep the varnish cache and do purging on post
     $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED);
     $this->app->wg->SuppressPageHeader = true;
 }
 public function addAsset()
 {
     JSMessages::enqueuePackage('Wall', JSMessages::EXTERNAL);
     $this->response->addAsset('wall_topic_js');
     // need to load on thread only
     $this->response->addAsset('wall_js');
     $this->response->addAsset('extensions/wikia/Wall/css/Wall.scss');
     $this->response->addAsset('extensions/wikia/Wall/css/MessageTopic.scss');
     // need to load on thread only
     // Load MiniEditor assets, if enabled
     if ($this->wg->EnableMiniEditorExtForWall && F::app()->checkSkin('oasis')) {
         $this->sendRequest('MiniEditor', 'loadAssets', array('additionalAssets' => array('wall_mini_editor_js', 'extensions/wikia/MiniEditor/css/Wall/Wall.scss')));
     }
     if ($this->app->checkSkin('monobook')) {
         $this->response->addAsset('extensions/wikia/WikiaStyleGuide/js/Form.js');
         $this->response->addAsset('resources/wikia/modules/querystring.js');
         $this->response->addAsset('extensions/wikia/Wall/css/monobook/WallMonobook.scss');
     }
 }
 public function index()
 {
     wfProfileIn(__METHOD__);
     $output = $this->getContext()->getOutput();
     $output->setRobotPolicy("index,follow");
     $policies = Title::newFromText('forum-policies-and-faq', NS_MEDIAWIKI);
     $this->response->setJsVar('wgCanEditPolicies', $this->wg->User->isAllowed('forumadmin'));
     $this->response->setJsVar('wgPoliciesRev', $policies->getLatestRevID());
     $this->response->setJsVar('wgPoliciesEditURL', $policies->getFullUrl('action=edit'));
     //getLatestRevID
     JSMessages::enqueuePackage('Forum', JSMessages::EXTERNAL);
     $this->response->addAsset('extensions/wikia/Forum/js/Forum.js');
     if ($this->request->getVal('showWarning', 0) == 1) {
         BannerNotificationsController::addConfirmation(wfMessage('forum-board-no-board-warning')->escaped(), BannerNotificationsController::CONFIRMATION_WARN);
     }
     $action = $this->getVal('action', '');
     if ('editmode' == $action) {
         $this->forward('ForumSpecial', 'editMode');
     }
     $output->setPageTitle(wfMessage('forum-forum-title')->plain());
     $action = $this->getVal('action', '');
     $this->blurb = wfMessage('forum-specialpage-blurb')->parse();
     $this->blurbHeading = wfMessage('forum-specialpage-blurb-heading')->parse();
     $this->lastPostByMsg = wfMessage('forum-specialpage-board-lastpostby')->escaped();
     $this->canEdit = $this->wg->User->isAllowed('forumadmin');
     $this->editUrl = $this->wg->Title->getFullUrl('action=editmode');
     $forum = new Forum();
     if ($forum->createDefaultBoard()) {
         $this->boards = $forum->getBoardList(DB_MASTER);
     } else {
         $this->boards = $forum->getBoardList(DB_SLAVE);
     }
     if ($forum->haveOldForums()) {
         $this->showOldForumLink = true;
         $this->oldForumLink = Title::newFromText('Index', NS_FORUM)->getFullUrl();
     } else {
         $this->showOldForumLink = false;
     }
     //TODO: keep the varnish cache and do purging on post
     $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED);
     wfProfileOut(__METHOD__);
 }
Example #28
0
 /**
  * add resources needed by chat
  * as chat entry points or links can appear on any page,
  * we really need them everywhere
  */
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgExtensionsPath, $wgTitle, $wgResourceBasePath;
     wfProfileIn(__METHOD__);
     $sp = array('Contributions', 'Log', 'Recentchanges');
     foreach ($sp as $value) {
         if ($wgTitle->isSpecial($value)) {
             // For Chat2 (doesn't exist in Chat(1))
             $srcs = AssetsManager::getInstance()->getGroupCommonURL('chat_ban_js', array());
             foreach ($srcs as $val) {
                 $out->addScript('<script src="' . $val . '"></script>');
             }
             JSMessages::enqueuePackage('ChatBanModal', JSMessages::EXTERNAL);
             $out->addStyle(AssetsManager::getInstance()->getSassCommonURL('extensions/wikia/Chat2/css/ChatModal.scss'));
             break;
         }
     }
     JSMessages::enqueuePackage('ChatEntryPoint', JSMessages::INLINE);
     wfProfileOut(__METHOD__);
     return true;
 }
<?php

/**
 * EditHub
 *
 * @author Damian Jóźwiak
 * @author Sebastian Marzjan
 * @author Łukasz Konieczny
 * @author Bartosz Bentkowski
 *
 */
$dir = dirname(__FILE__) . '/';
$wgExtensionCredits['specialpage'][] = array('name' => 'Edit Hub', 'descriptionmsg' => 'edithub-desc', 'authors' => array('Damian Jóźwiak', 'Sebastian Marzjan', 'Łukasz Konieczny', 'Bartosz Bentkowski'), 'version' => 1.0, 'url' => 'https://github.com/Wikia/app/tree/dev/extensions/wikia/SpecialEditHub');
//classes
$wgAutoloadClasses['EditHubController'] = $dir . 'EditHubController.class.php';
$wgAutoloadClasses['EditHubVideosController'] = $dir . 'EditHubVideosController.class.php';
// hooks
$wgAutoloadClasses['EditHubHooks'] = $dir . 'hooks/EditHubHooks.class.php';
$wgHooks['MakeGlobalVariablesScript'][] = 'EditHubHooks::onMakeGlobalVariablesScript';
//special page
$wgSpecialPages['EditHub'] = 'EditHubController';
$wgSpecialPageGroups['EditHub'] = 'wikia';
//message files
$wgExtensionMessagesFiles['EditHub'] = $dir . 'EditHub.i18n.php';
JSMessages::registerPackage('EditHub', array('edit-hub-*', 'wikia-hubs-*'));
$wgAvailableRights[] = 'edithub';
$wgGroupPermissions['*']['edithub'] = false;
$wgGroupPermissions['staff']['edithub'] = true;
$wgGroupPermissions['helper']['edithub'] = true;
Example #30
0
<?php

/**
 * Adds support for MW messages in JS code
 *
 * Provides a way to register and use packages of messages in JavaScript via $.msg() function
 *
 * @see https://internal.wikia-inc.com/wiki/JSMessages
 * @author macbre
 */
$wgExtensionCredits['other'][] = array('name' => 'JSMessages', 'version' => '1.1', 'author' => 'Maciej Brencz', 'descriptionmsg' => 'jsmessages-desc', 'url' => 'https://github.com/Wikia/app/tree/dev/extensions/wikia/JSMessages');
$dir = dirname(__FILE__);
//i18n
$wgExtensionMessagesFiles['JSMessages'] = $dir . '/JSMessages.i18n.php';
// classes
$wgAutoloadClasses['JSMessages'] = $dir . '/JSMessages.class.php';
$wgAutoloadClasses['JSMessagesHelper'] = $dir . '/JSMessagesHelper.class.php';
$wgAutoloadClasses['JSMessagesController'] = $dir . '/JSMessagesController.class.php';
// hooks
$wgHooks['WikiaSkinTopScripts'][] = 'JSMessages::onWikiaSkinTopScripts';
$wgHooks['ResourceLoaderGetConfigVars'][] = 'JSMessages::onResourceLoaderGetConfigVars';
$wgHooks['MessageCacheReplace'][] = 'JSMessagesHelper::onMessageCacheReplace';
$wgExtensionFunctions[] = function () {
    // This has to be wrapped in a function so it isn't run before we include GlobalSettings.php
    JSMessages::registerPackage("ConfirmModal", array('ok', 'cancel'));
    JSMessages::enqueuePackage("ConfirmModal", JSMessages::EXTERNAL);
    // We need this to ensure the messages are loaded on every page
};