当前位置: 首页>>代码示例>>PHP>>正文


PHP OutputPage::addJsConfigVars方法代码示例

本文整理汇总了PHP中OutputPage::addJsConfigVars方法的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage::addJsConfigVars方法的具体用法?PHP OutputPage::addJsConfigVars怎么用?PHP OutputPage::addJsConfigVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OutputPage的用法示例。


在下文中一共展示了OutputPage::addJsConfigVars方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onBeforePageDisplay

 public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin)
 {
     $title = $output->getTitle();
     // Disallow commenting on pages without article id
     if ($title->getArticleID() == 0) {
         return true;
     }
     if ($title->isSpecialPage()) {
         return true;
     }
     // These could be explicitly allowed in later version
     if (!$title->canTalk()) {
         return true;
     }
     if ($title->isTalkPage()) {
         return true;
     }
     // No commenting on main page
     if ($title->isMainPage()) {
         return true;
     }
     // Do not display when printing
     if ($output->isPrintable()) {
         return true;
     }
     // Disable if not viewing
     if ($skin->getRequest()->getVal('action', 'view') != 'view') {
         return true;
     }
     // Blacklist several namespace
     if (in_array($title->getNamespace(), self::getFilteredNamespace())) {
         return true;
     }
     if ($output->getUser()->isAllowed('commentadmin-restricted')) {
         $output->addJsConfigVars(array('commentadmin' => ''));
     }
     global $wgFlowThreadConfig;
     $config = array('Avatar' => $wgFlowThreadConfig['Avatar'], 'AnonymousAvatar' => $wgFlowThreadConfig['AnonymousAvatar']);
     if (\FlowThread\Post::canPost($output->getUser())) {
         $output->addJsConfigVars(array('canpost' => ''));
     } else {
         $config['CantPostNotice'] = wfMessage('flowthread-ui-cantpost')->toString();
     }
     global $wgFlowThreadConfig;
     $output->addJsConfigVars(array('wgFlowThreadConfig' => $config));
     $output->addModules('ext.flowthread');
     return true;
 }
开发者ID:nbdd0121,项目名称:MW-FlowThread,代码行数:48,代码来源:FlowThread_body.php

示例2: onBeforePageDisplay

 /**
  *
  * @param OutputPage $oOutputPage
  * @param Skin $oSkin
  * @return boolean - always true
  */
 public function onBeforePageDisplay(&$oOutputPage, &$oSkin)
 {
     if (!in_array($oOutputPage->getRequest()->getVal('action', 'view'), array('edit', 'submit'))) {
         return true;
     }
     $oOutputPage->addModules('bluespice.insertLink.interWikiLinks');
     //TODO implement ow
     $oOutputPage->addJsConfigVars('BSInterWikiPrefixes', $this->getInterWikiLinkPrefixes());
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:16,代码来源:InterWikiLinks.class.php

示例3: onBeforePageDisplay

 /**
  * Adds resources to ResourceLoader
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean Always true to keep hook running
  */
 public function onBeforePageDisplay(&$out, &$skin)
 {
     $out->addModules('ext.bluespice.contextmenu');
     //We check if the current user can send Mails trough the wiki
     //TODO: Maybe move to BSF?
     $mEMailPermissioErrors = SpecialEmailUser::getPermissionsError($this->getUser(), $this->getUser()->getEditToken());
     $bUserCanSendMail = false;
     if ($mEMailPermissioErrors === null) {
         $bUserCanSendMail = true;
     }
     $out->addJsConfigVars('bsUserCanSendMail', $bUserCanSendMail);
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:19,代码来源:ContextMenu.class.php

示例4: onBeforePageDisplay

 /**
  * Adds VisualEditor JS to the output.
  *
  * This is attached to the MediaWiki 'BeforePageDisplay' hook.
  *
  * @param OutputPage $output
  * @param Skin $skin
  * @return boolean
  */
 public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin)
 {
     $output->addModules(array('ext.visualEditor.desktopArticleTarget.init', 'ext.visualEditor.targetLoader'));
     $output->addModuleStyles(array('ext.visualEditor.desktopArticleTarget.noscript'));
     // add scroll offset js variable to output
     $veConfig = ConfigFactory::getDefaultInstance()->makeConfig('visualeditor');
     $skinsToolbarScrollOffset = $veConfig->get('VisualEditorSkinToolbarScrollOffset');
     $toolbarScrollOffset = 0;
     $skinName = $skin->getSkinName();
     if (isset($skinsToolbarScrollOffset[$skinName])) {
         $toolbarScrollOffset = $skinsToolbarScrollOffset[$skinName];
     }
     $output->addJsConfigVars('wgVisualEditorToolbarScrollOffset', $toolbarScrollOffset);
     return true;
 }
开发者ID:eliagbayani,项目名称:eoearth,代码行数:24,代码来源:VisualEditor.hooks.php

示例5: injectCss

 public static function injectCss(OutputPage $out, $text)
 {
     global $wgTranslatePageTranslationULS;
     $title = $out->getTitle();
     $isSource = TranslatablePage::isSourcePage($title);
     $isTranslation = TranslatablePage::isTranslationPage($title);
     if ($isSource || $isTranslation) {
         $out->addModuleStyles('ext.translate');
         if ($wgTranslatePageTranslationULS) {
             $out->addModules('ext.translate.pagetranslation.uls');
         }
         // Per bug T63331
         $type = $isSource ? 'source' : 'translation';
         $out->addJsConfigVars('wgTranslatePageTranslation', $type);
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:17,代码来源:PageTranslationHooks.php

示例6: onBeforePageDisplay

 /**
  * Adds resources to ResourceLoader
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean Always true to keep hook running
  */
 public function onBeforePageDisplay(&$out, &$skin)
 {
     //Having a dedicated module for styles and loading it through
     //'addModuleStyles' prevents CSS flickering. It shoult obly be done
     //when styling elements that are available in the source HTML. If you
     //want to style markup that gets generated by JavaScript embed your
     //styling in the same module and use 'addModules'.
     $out->addModuleStyles('ext.bluespice.boilerPlate.styles');
     //Adding JavaScript and clientside I18N
     $out->addModules('ext.bluespice.boilerPlate.scripts');
     //Additional context sensitive data for the clientside
     $bVar = date('w') == 3;
     //Is it Wednesday?
     $out->addJsConfigVars('bsBoilerPlateSomeCalculatedVar', $bVar);
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:22,代码来源:BoilerPlate.class.php

示例7: onBeforePageDisplay

 /**
  * Adds the 'ext.bluespice.responsibleeditors' module to the OutputPage
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean
  */
 public function onBeforePageDisplay($out, $skin)
 {
     if ($out->getRequest()->getVal('action', 'view') == 'view' && !$out->getTitle()->isSpecialPage()) {
         $out->addModules('ext.bluespice.responsibleEditors');
         $out->addModuleStyles('ext.bluespice.responsibleEditors.styles');
         //Make information about current pages RespEds available on client side
         $iArticleId = $out->getTitle()->getArticleID();
         $aResponsibleEditorIds = $this->getResponsibleEditorIdsByArticleId($iArticleId);
         $oData = new stdClass();
         $oData->articleId = $iArticleId;
         $oData->editorIds = $aResponsibleEditorIds;
         $out->addJsConfigVars('bsResponsibleEditors', $oData);
     }
     if (BsExtensionManager::getExtension('Bookshelf') !== null) {
         //Attach Bookshelfs plugin if in context
         if (SpecialPage::getTitleFor('BookshelfBookManager')->equals($out->getTitle())) {
             $out->addModules('ext.bluespice.responsibleEditors.bookshelfPlugin');
         }
     }
     if (BsExtensionManager::getExtension('SuperList') !== null) {
         //Attach SuperList plugin if in context
         if (SpecialPage::getTitleFor('SuperList')->equals($out->getTitle())) {
             $out->addModules('ext.bluespice.responsibleEditors.superList');
         }
     }
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:33,代码来源:ResponsibleEditors.class.php

示例8: onBeforePageDisplay

 /**
  * Adds CSS to Page
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean
  */
 public function onBeforePageDisplay(&$out, &$skin)
 {
     $out->addModuleStyles('ext.bluespice.review.styles');
     if ($out->getTitle()->isContentPage() == false) {
         return true;
     }
     if ($out->getTitle()->exists() == false) {
         return true;
     }
     //if( $out->getTitle()->userCan('workflowread') == false ) return true;
     $out->addModules('ext.bluespice.review');
     //PW TODO: find better way
     //this always was loaded too late, no matter what dependency or position
     $out->addScript('<script>' . "\$(document).on( 'BsStateBarRegisterToggleClickElements', function(event, aRegisteredToggleClickElements) {" . "aRegisteredToggleClickElements.push(\$('#sb-Review'));" . "});" . '</script>');
     $bUserCanEdit = $out->getTitle()->userCan('workflowedit');
     $out->addJsConfigVars('bsReviewUserCanEdit', $bUserCanEdit);
     $oRev = BsReviewProcess::newFromPid($out->getTitle()->getArticleID());
     $out->addJsConfigVars('bsReview', $this->makeJSDataObject($oRev));
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:26,代码来源:Review.class.php

示例9: onBeforePageDisplay

 /**
  *
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean
  */
 public static function onBeforePageDisplay(&$out, &$skin)
 {
     $out->addModuleStyles('ext.bluespice.insertcategory.styles');
     $out->addModules('ext.bluespice.insertcategory');
     $out->addJsConfigVars('BSInsertCategoryWithParents', BsConfig::get('MW::InsertCategory::WithParents'));
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:13,代码来源:InsertCategory.class.php


注:本文中的OutputPage::addJsConfigVars方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。