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


PHP WidgetsList::isDefined方法代码示例

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


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

示例1: removeDisabledPluginFromLayout

 public function removeDisabledPluginFromLayout($layout)
 {
     $layoutObject = $this->decodeLayout($layout);
     // if the json decoding works (ie. new Json format)
     // we will only return the widgets that are from enabled plugins
     if (is_array($layoutObject)) {
         $layoutObject = (object) array('config' => array('layout' => '33-33-33'), 'columns' => $layoutObject);
     }
     if (empty($layoutObject) || empty($layoutObject->columns)) {
         $layoutObject = (object) array('config' => array('layout' => '33-33-33'), 'columns' => array());
     }
     foreach ($layoutObject->columns as &$row) {
         if (!is_array($row)) {
             $row = array();
             continue;
         }
         foreach ($row as $widgetId => $widget) {
             if (isset($widget->parameters->module)) {
                 $controllerName = $widget->parameters->module;
                 $controllerAction = $widget->parameters->action;
                 if (!WidgetsList::isDefined($controllerName, $controllerAction)) {
                     unset($row[$widgetId]);
                 }
             } else {
                 unset($row[$widgetId]);
             }
         }
     }
     $layout = $this->encodeLayout($layoutObject);
     return $layout;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:31,代码来源:Dashboard.php

示例2: widgetExists

 private function widgetExists($widget)
 {
     if (empty($widget->parameters)) {
         return false;
     }
     $module = $widget->parameters->module;
     $action = $widget->parameters->action;
     return WidgetsList::isDefined($module, $action);
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:9,代码来源:API.php

示例3: testIsDefined

 public function testIsDefined()
 {
     // setup the access layer
     FakeAccess::$superUser = true;
     Translate::loadAllTranslations();
     Fixture::createWebsite('2009-01-04 00:11:42', true);
     $_GET['idSite'] = 1;
     WidgetsList::_reset();
     WidgetsList::add('Actions', 'Pages', 'Actions', 'getPageUrls');
     $this->assertTrue(WidgetsList::isDefined('Actions', 'getPageUrls'));
     $this->assertFalse(WidgetsList::isDefined('Actions', 'inValiD'));
     Translate::reset();
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:13,代码来源:WidgetsListTest.php

示例4: testIsDefined

 /**
  * @group Core
  */
 public function testIsDefined()
 {
     // setup the access layer
     $pseudoMockAccess = new FakeAccess();
     FakeAccess::$superUser = true;
     Access::setSingletonInstance($pseudoMockAccess);
     \Piwik\Translate::loadEnglishTranslation();
     Fixture::createWebsite('2009-01-04 00:11:42', true);
     $_GET['idSite'] = 1;
     WidgetsList::_reset();
     WidgetsList::add('Actions', 'Pages', 'Actions', 'getPageUrls');
     $this->assertTrue(WidgetsList::isDefined('Actions', 'getPageUrls'));
     $this->assertFalse(WidgetsList::isDefined('Actions', 'inValiD'));
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:17,代码来源:WidgetsListTest.php

示例5: factory

 /**
  * @ignore
  * @return Widgets|null
  */
 public static function factory($module, $action)
 {
     if (empty($module) || empty($action)) {
         return;
     }
     $pluginManager = PluginManager::getInstance();
     try {
         if (!$pluginManager->isPluginActivated($module)) {
             return;
         }
         $plugin = $pluginManager->getLoadedPlugin($module);
     } catch (\Exception $e) {
         // we are not allowed to use possible widgets, plugin is not active
         return;
     }
     /** @var Widgets $widgetContainer */
     $widgetContainer = $plugin->findComponent('Widgets', 'Piwik\\Plugin\\Widgets');
     if (empty($widgetContainer)) {
         // plugin does not define any widgets, we cannot do anything
         return;
     }
     if (!is_callable(array($widgetContainer, $action))) {
         // widget does not implement such a method, we cannot do anything
         return;
     }
     // the widget class implements such an action, but we have to check whether it is actually exposed and whether
     // it was maybe disabled by another plugin, this is only possible by checking the widgetslist, unfortunately
     if (!WidgetsList::isDefined($module, $action)) {
         return;
     }
     return $widgetContainer;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:36,代码来源:Widgets.php


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