/**
  *
  * @param OutputPage $oOutputPage
  * @param SkinTemplate $oSkinTemplate
  * @return boolean
  */
 public function onBeforePageDisplay($oOutputPage, $oSkinTemplate)
 {
     $oTitle = $oOutputPage->getTitle();
     $sHideTitlePageProp = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_hidetitle');
     if ($sHideTitlePageProp === '') {
         $oOutputPage->mPagetitle = '';
         $oOutputPage->addInlineScript("\$('.firstHeading').remove()");
     }
     return true;
 }
 /**
  * Checks wether to set Context or not.
  * @return bool
  */
 private function checkContext()
 {
     if (BsConfig::get('MW::Authors::Show') === false) {
         return false;
     }
     $oTitle = $this->getTitle();
     if (!is_object($oTitle)) {
         return false;
     }
     if (!$oTitle->exists()) {
         return false;
     }
     // Do only display when user is allowed to read
     if (!$oTitle->userCan('read')) {
         return false;
     }
     // Do only display in view mode
     if ($this->getRequest()->getVal('action', 'view') != 'view') {
         return false;
     }
     // Do not display on SpecialPages, CategoryPages or ImagePages
     if (in_array($oTitle->getNamespace(), array(NS_SPECIAL, NS_CATEGORY, NS_FILE))) {
         return false;
     }
     // Do not display if __NOAUTHORS__ keyword is found
     $vNoAuthors = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_noauthors');
     if ($vNoAuthors === '') {
         return false;
     }
     return true;
 }
 /**
  *
  * @param OutputPage $oOutputPage
  * @param SkinTemplate $oSkinTemplate
  * @return boolean
  */
 public function onBeforePageDisplay($oOutputPage, $oSkinTemplate)
 {
     if (BsConfig::get('MW::ShoutBox::Show') === false) {
         return true;
     }
     $oTitle = $oOutputPage->getTitle();
     if ($oOutputPage->isPrintable()) {
         return true;
     }
     if (is_object($oTitle) && $oTitle->exists() == false) {
         return true;
     }
     if (!$oTitle->userCan('readshoutbox')) {
         return true;
     }
     if ($this->getRequest()->getVal('action', 'view') != 'view') {
         return true;
     }
     if ($oTitle->isSpecialPage()) {
         return true;
     }
     if (!$oTitle->userCan('read')) {
         return true;
     }
     $aNamespacesToDisplayShoutBox = BsConfig::get('MW::ShoutBox::ShowShoutBoxByNamespace');
     if (!in_array($oTitle->getNsText(), $aNamespacesToDisplayShoutBox)) {
         return true;
     }
     $vNoShoutbox = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_noshoutbox');
     if ($vNoShoutbox === '') {
         return true;
     }
     $oOutputPage->addModuleStyles('ext.bluespice.shoutbox.styles');
     $oOutputPage->addModules('ext.bluespice.shoutbox');
     $oOutputPage->addModules('ext.bluespice.shoutbox.mention');
     BsExtensionManager::setContext('MW::ShoutboxShow');
     return true;
 }
 /**
  * Hook handler that adds information to the StateBar body
  * @param StateBar $oStatebar
  * @param array $aBodyViews
  * @param User $oUser
  * @param Title $oTitle
  * @return boolean Always true to keep the hook running
  */
 public function onBSStateBarBeforeBodyViewAdd($oStatebar, &$aBodyViews, $oUser, $oTitle)
 {
     $oMeta = BsArticleHelper::getInstance($oTitle)->getJSONPageProp('bs-universalexport-meta');
     $oParams = BsArticleHelper::getInstance($oTitle)->getJSONPageProp('bs-universalexport-params');
     if ($oMeta instanceof stdClass) {
         $aBodyViews['statebarbodyuniversalexportmeta'] = BsUniversalExportTagLibrary::makeStateBarBodyElementKeyValueTable(array('rows' => (array) $oMeta, 'heading' => wfMessage('bs-universalexport-statebarbodyuniversalexportmeta')->plain(), 'key' => 'statebarbodyuniversalexportmeta'));
     }
     if ($oParams instanceof stdClass) {
         $aBodyViews['statebarbodyuniversalexportparams'] = BsUniversalExportTagLibrary::makeStateBarBodyElementKeyValueTable(array('rows' => (array) $oParams, 'heading' => wfMessage('bs-universalexport-statebarbodyuniversalexportparams')->plain(), 'key' => 'statebarbodyuniversalexportparams'));
     }
     return true;
 }
 /**
  * Checks wether to set Context or not.
  * @param Title $oTitle
  * @param bool $bRedirect
  * @return Title - null when context check fails
  */
 private function checkContext($oTitle, $bRedirect = false)
 {
     if (is_null($oTitle)) {
         return null;
     }
     if ($oTitle->exists() === false) {
         return null;
     }
     if ($oTitle->getNamespace() === NS_SPECIAL) {
         return null;
     }
     if ($oTitle->userCan('read') === false) {
         return null;
     }
     if ($bRedirect) {
         $vNoStatebar = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_nostatebar');
         if ($vNoStatebar === '') {
             return null;
         }
         return $oTitle;
     }
     global $wgRequest;
     if ($oTitle->isRedirect() && $wgRequest->getVal('redirect') != 'no') {
         //check again for redirect target
         $this->oRedirectTargetTitle = BsArticleHelper::getInstance($oTitle)->getTitleFromRedirectRecurse();
         /* If redirect points to none existing article
          * you don't get redirected, so display StateBar.
          * See HW#2014010710000128
          */
         if (is_null($this->oRedirectTargetTitle) || !$this->oRedirectTargetTitle->exists()) {
             return $oTitle;
         }
         return $this->checkContext($this->oRedirectTargetTitle, true);
     }
     $vNoStatebar = BsArticleHelper::getInstance($oTitle)->getPageProp('bs_nostatebar');
     if ($vNoStatebar === '') {
         return null;
     }
     return $oTitle;
 }