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


PHP Gadget::loadList方法代码示例

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


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

示例1: beforePageDisplay

 /**
  * BeforePageDisplay hook handler.
  * @param $out OutputPage
  * @return bool
  */
 public static function beforePageDisplay($out)
 {
     wfProfileIn(__METHOD__);
     $gadgets = Gadget::loadList();
     if (!$gadgets) {
         wfProfileOut(__METHOD__);
         return true;
     }
     $lb = new LinkBatch();
     $lb->setCaller(__METHOD__);
     $pages = array();
     /**
      * @var $gadget Gadget
      */
     $user = $out->getUser();
     foreach ($gadgets as $gadget) {
         if ($gadget->isEnabled($user) && $gadget->isAllowed($user)) {
             if ($gadget->hasModule()) {
                 $out->addModuleStyles($gadget->getModuleName());
                 $out->addModules($gadget->getModuleName());
             }
             foreach ($gadget->getLegacyScripts() as $page) {
                 $lb->add(NS_MEDIAWIKI, $page);
                 $pages[] = $page;
             }
         }
     }
     // Allow other extensions, e.g. MobileFrontend, to disallow legacy gadgets
     if (wfRunHooks('Gadgets::allowLegacy', array($out->getContext()))) {
         $lb->execute(__METHOD__);
         $done = array();
         foreach ($pages as $page) {
             if (isset($done[$page])) {
                 continue;
             }
             $done[$page] = true;
             self::applyScript($page, $out);
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:47,代码来源:Gadgets_body.php

示例2: showExportForm

 /**
  * Exports a gadget with its dependencies in a serialized form
  * @param $gadget String Name of gadget to export
  */
 public function showExportForm($gadget)
 {
     global $wgOut, $wgScript;
     $gadgets = Gadget::loadList();
     if (!isset($gadgets[$gadget])) {
         $wgOut->showErrorPage('error', 'gadgets-not-found', array($gadget));
         return;
     }
     $g = $gadgets[$gadget];
     $this->setHeaders();
     $wgOut->setPagetitle(wfMsg("gadgets-export-title"));
     $wgOut->addWikiMsg('gadgets-export-text', $gadget, $g->getDefinition());
     $exportList = "MediaWiki:gadget-{$gadget}\n";
     foreach ($g->getScriptsAndStyles() as $page) {
         $exportList .= "MediaWiki:{$page}\n";
     }
     $wgOut->addHTML(Html::openElement('form', array('method' => 'get', 'action' => $wgScript)) . Html::hidden('title', SpecialPage::getTitleFor('Export')->getPrefixedDBKey()) . Html::hidden('pages', $exportList) . Html::hidden('wpDownload', '1') . Html::hidden('templates', '1') . Xml::submitButton(wfMsg('gadgets-export-download')) . Html::closeElement('form'));
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:22,代码来源:SpecialGadgets.php

示例3: beforePageDisplay

 /**
  * BeforePageDisplay hook handler.
  * @param $out OutputPage
  * @return bool
  */
 public static function beforePageDisplay($out)
 {
     global $wgUser;
     wfProfileIn(__METHOD__);
     $gadgets = Gadget::loadList();
     if (!$gadgets) {
         wfProfileOut(__METHOD__);
         return true;
     }
     $lb = new LinkBatch();
     $lb->setCaller(__METHOD__);
     $pages = array();
     /**
      * @var $gadget Gadget
      */
     foreach ($gadgets as $gadget) {
         if ($gadget->isEnabled($wgUser) && $gadget->isAllowed($wgUser)) {
             if ($gadget->hasModule()) {
                 $out->addModuleStyles($gadget->getModuleName());
                 $out->addModules($gadget->getModuleName());
             }
             foreach ($gadget->getLegacyScripts() as $page) {
                 $lb->add(NS_MEDIAWIKI, $page);
                 $pages[] = $page;
             }
         }
     }
     $lb->execute(__METHOD__);
     $done = array();
     foreach ($pages as $page) {
         if (isset($done[$page])) {
             continue;
         }
         $done[$page] = true;
         self::applyScript($page, $out);
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:44,代码来源:Gadgets_body.php

示例4: beforePageDisplay

 /**
  * BeforePageDisplay hook handler.
  * @param $out OutputPage
  */
 public static function beforePageDisplay($out)
 {
     global $wgUser;
     wfProfileIn(__METHOD__);
     $gadgets = Gadget::loadList();
     if (!$gadgets) {
         wfProfileOut(__METHOD__);
         return true;
     }
     $lb = new LinkBatch();
     $lb->setCaller(__METHOD__);
     $pages = array();
     $stylesModules = array();
     foreach ($gadgets as $gadget) {
         if ($gadget->isEnabled($wgUser) && $gadget->isAllowed($wgUser)) {
             if ($gadget->hasModule()) {
                 $out->addModules($gadget->getModuleName());
             }
             if ($gadget->hasStylesModule()) {
                 $stylesModules[] = $gadget->getStylesModuleName();
             }
             foreach ($gadget->getLegacyScripts() as $page) {
                 $lb->add(NS_MEDIAWIKI, $page);
                 $pages[] = $page;
             }
         }
     }
     if (count($stylesModules)) {
         $out->addHeadItem('ext.gadget', $out->makeResourceLoaderLink($stylesModules, ResourceLoaderModule::TYPE_STYLES) . Html::inlineScript(ResourceLoader::makeLoaderConditionalScript(ResourceLoader::makeLoaderStateScript(array_fill_keys($stylesModules, 'ready')))));
     }
     $lb->execute(__METHOD__);
     $done = array();
     foreach ($pages as $page) {
         if (isset($done[$page])) {
             continue;
         }
         $done[$page] = true;
         self::applyScript($page, $out);
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:46,代码来源:Gadgets_body.php


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