/**
  * Prepare configured and available page actions
  * @param BaseTemplate $tpl
  */
 protected function preparePageActions(BaseTemplate $tpl)
 {
     $title = $this->getTitle();
     // Reuse template data variable from SkinTemplate to construct page menu
     $menu = array();
     $actions = $tpl->data['content_navigation']['actions'];
     // empty placeholder for edit and photos which both require js
     if ($this->isAllowedPageAction('edit')) {
         $menu['edit'] = array('id' => 'ca-edit', 'text' => '', 'itemtitle' => $this->msg('mobile-frontend-pageaction-edit-tooltip'), 'class' => MobileUI::iconClass('edit', 'element', 'hidden'));
     }
     if ($this->isAllowedPageAction('watch')) {
         $watchTemplate = array('id' => 'ca-watch', 'class' => MobileUI::iconClass('watch', 'element', 'icon-32px watch-this-article hidden'));
         // standardise watch article into one menu item
         if (isset($actions['watch'])) {
             $menu['watch'] = array_merge($actions['watch'], $watchTemplate);
         } elseif (isset($actions['unwatch'])) {
             $menu['watch'] = array_merge($actions['unwatch'], $watchTemplate);
             $menu['watch']['class'] .= ' watched';
         } else {
             // placeholder for not logged in
             $menu['watch'] = $watchTemplate;
             // FIXME: makeLink (used by makeListItem) when no text is present defaults to use the key
             $menu['watch']['text'] = '';
             $menu['watch']['href'] = $this->getLoginUrl(array('returnto' => $title));
         }
     }
     $tpl->set('page_actions', $menu);
 }
 /**
  * Sets values for search form.
  * @param SkinTemplate $sktemplate
  * @param BaseTemplate $tpl
  * @return boolean Always true to keep hook running
  */
 public function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl)
 {
     $tpl->set('searchtitle', SpecialPage::getTitleFor('SpecialExtendedSearch')->getFullText());
     if (!empty(SearchOptions::$searchStringRaw)) {
         $tpl->set('q', SearchOptions::$searchStringRaw);
     }
     $tpl->set('bs_search_input', array('id' => 'bs-extendedsearch-input', 'type' => 'text', 'name' => 'q'));
     $aHiddenFields = array();
     $aHiddenFields['sft'] = '1';
     if (BsConfig::get('MW::ExtendedSearch::SearchFiles')) {
         $aHiddenFields['search_files'] = '1';
     }
     $tpl->set('bs_search_hidden_fields', $aHiddenFields);
     return true;
 }
コード例 #3
0
 /**
  * Prepare configured and available page actions
  * @param BaseTemplate $tpl
  */
 protected function preparePageActions(BaseTemplate $tpl)
 {
     $title = $this->getTitle();
     $noJsEdit = MobileContext::singleton()->getMFConfig()->get('MFAllowNonJavaScriptEditing');
     // Reuse template data variable from SkinTemplate to construct page menu
     $menu = array();
     $actions = $tpl->data['content_navigation']['actions'];
     if ($this->isUserPage) {
         if (!$this->getTitle()->exists()) {
             $tpl->set('page_actions', $menu);
             return;
         }
     }
     // empty placeholder for edit and photos which both require js
     if ($this->isAllowedPageAction('edit')) {
         $additionalClass = $noJsEdit ? ' nojs-edit' : '';
         $menu['edit'] = array('id' => 'ca-edit', 'text' => '', 'itemtitle' => $this->msg('mobile-frontend-pageaction-edit-tooltip'), 'class' => MobileUI::iconClass('edit-enabled', 'element' . $additionalClass), 'links' => array('edit' => array('href' => $this->getTitle()->getLocalUrl(array('action' => 'edit', 'section' => 0)))));
     }
     if ($this->isAllowedPageAction('watch')) {
         $watchTemplate = array('id' => 'ca-watch', 'class' => MobileUI::iconClass('watch', 'element', 'icon-32px watch-this-article hidden'));
         // standardise watch article into one menu item
         if (isset($actions['watch'])) {
             $menu['watch'] = array_merge($actions['watch'], $watchTemplate);
         } elseif (isset($actions['unwatch'])) {
             $menu['watch'] = array_merge($actions['unwatch'], $watchTemplate);
             $menu['watch']['class'] .= ' watched';
         } else {
             // placeholder for not logged in
             $menu['watch'] = $watchTemplate;
             // FIXME: makeLink (used by makeListItem) when no text is present defaults to use the key
             $menu['watch']['text'] = '';
             $menu['watch']['href'] = $this->getLoginUrl(array('returnto' => $title));
         }
     }
     $tpl->set('page_actions', $menu);
 }
 /**
  * Modifies the logo on runtime
  * @param SkinTemplate $sktemplate
  * @param BaseTemplate $tpl
  * @return boolean Always true to keep hook running
  */
 public static function onSkinTemplateOutputPageBeforeExec(&$sktemplate, &$tpl)
 {
     $sFlexiskin = $sktemplate->getRequest()->getVal('flexiskin');
     if ($sFlexiskin || BsConfig::get('MW::Flexiskin::Active') != '') {
         $sId = $sFlexiskin != '' ? $sFlexiskin : BsConfig::get('MW::Flexiskin::Active');
         if ($sId != "default") {
             $bPreview = $sktemplate->getRequest()->getVal('preview', false);
             $api = new ApiMain(new DerivativeRequest($sktemplate->getRequest(), array('action' => 'flexiskin', 'type' => 'get', 'mode' => 'config', 'id' => $sId, 'preview' => $bPreview), false), true);
             $api->execute();
             $aResult = $api->getResultData();
             $oResult = FormatJson::decode($aResult['flexiskin']);
             if ($oResult->success === false) {
                 return true;
             }
             $aConfig = FormatJson::decode($oResult->config);
             $sLogo = BsConfig::get("MW::Flexiskin::Logo");
             if ($sLogo == "") {
                 return true;
             }
             $sPath = BS_DATA_PATH . "/flexiskin/" . $sId . "/images/";
             $tpl->set('logopath', $sPath . $sLogo);
             return true;
         }
         return true;
     }
     return true;
 }
コード例 #5
0
ファイル: WikiaMonoBook.php プロジェクト: yusufchang/app
 /**
  * Setup ads handling
  */
 protected function setupAds(BaseTemplate &$tpl)
 {
     $tpl->set('ads-column', '');
     $tpl->set('ads_top', '');
     $tpl->set('ads_topleft', '');
     $tpl->set('ads_topright', '');
     $tpl->set('ads_bot', '');
 }
コード例 #6
0
ファイル: WikiaMonoBook.php プロジェクト: schwarer2006/wikia
	/**
	 * Setup ads handling
	 */
	protected function setupAds(BaseTemplate &$tpl) {
		AdEngine::getInstance()->setLoadType('inline');

		// BugId:26735 We want spotlights regardless of whether ads have been enabled.
		$adsColumn = '<div id="column-google" class="noprint">'."\n".
			AdEngine::getInstance()->getSetupHtml() .
			'<div id="wikia_header" style="display:none"></div>'; // Hack because ads have code that referenc    es this. Awful.

		if($this->ads === false) {
			// FIXME: not used anymore?
			$tpl->set('ads_top', '');
			$tpl->set('ads_topleft', '');
			$tpl->set('ads_topright', '');
			$tpl->set('ads_bot','');

			$adsColumn .= '<!-- not USING ad server! -->'."\n".'</div>'."\n</div>\n";
		} else {
			// FIXME: not used anymore?
			$tpl->set('ads_top', AdServer::getInstance()->getAd('t'));
			$tpl->set('ads_topleft', AdServer::getInstance()->getAd('tl'));
			$tpl->set('ads_topright', AdServer::getInstance()->getAd('tr'));
			$tpl->set('ads_bot', AdServer::getInstance()->getAd('b'));

			$adsColumn .= '<!-- USING ad server! -->'."\n".
				'<div id="column-google-right">'.AdEngine::getInstance()->getAd('RIGHT_SKYSCRAPER_1').'</div></div>'."\n";
		}

		// BugId:26735 We want spotlights regardless of whether ads have been enabled.
		$adsColumn .= '<table id="spotlight_container"><tr>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_1').'</div></td>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_2').'</div></td>' .
			'<td><div>'.AdEngine::getInstance()->getPlaceHolderIframe('SPOTLIGHT_FOOTER_3').'</div></td>'.
			"</tr></table>\n".
			AdEngine::getInstance()->getDelayedIframeLoadingCode();

		// add ads column after content
		$tpl->set('ads-column', $adsColumn);
	}