public function Index()
 {
     global $wgUser, $wgEnableWallExt, $wgEnableForumExt;
     wfProfileIn(__METHOD__);
     $loggedIn = $wgUser->isLoggedIn();
     $suppressWallNotifications = $this->areNotificationsSuppressedByExtensions();
     if ($loggedIn && !$suppressWallNotifications) {
         OasisController::addSkinAssetGroup('wall_notifications_js');
         $this->response->addAsset('extensions/wikia/WallNotifications/styles/WallNotifications.scss');
         $this->response->setVal('prehide', empty($wgEnableWallExt) && empty($wgEnableForumExt));
     }
     $this->response->setVal('loggedIn', $loggedIn);
     $this->response->setVal('suppressWallNotifications', $suppressWallNotifications);
     wfProfileOut(__METHOD__);
 }
Пример #2
0
 /**
  * @param OutputPage $out
  * @param            $text
  *
  * Add needed messages to page and add JS assets
  *
  * @return bool
  */
 public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
 {
     $app = F::app();
     $wg = $app->wg;
     $request = $app->wg->Request;
     $title = $wg->Title;
     $am = AssetsManager::getInstance();
     $relatedPagesGroupName = 'relatedpages_js';
     if ($out->isArticle() && $request->getVal('action', 'view') == 'view') {
         JSMessages::enqueuePackage('RelatedPages', JSMessages::INLINE);
         if (!(Wikia::isMainPage() || !empty($title) && !in_array($title->getNamespace(), $wg->ContentNamespaces)) && !$app->checkSkin('wikiamobile') && $am->checkIfGroupForSkin($relatedPagesGroupName, $out->getSkin())) {
             if ($app->checkSkin('oasis')) {
                 OasisController::addSkinAssetGroup($relatedPagesGroupName);
             } else {
                 $scripts = $am->getURL($relatedPagesGroupName);
                 foreach ($scripts as $script) {
                     $wg->Out->addScript("<script src='{$script}'></script>");
                 }
             }
         }
     }
     return true;
 }