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


PHP Manager::getInstance方法代码示例

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


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

示例1: test_getAllDimensions_shouldReturnActionVisitAndConversionDimensions

 public function test_getAllDimensions_shouldReturnActionVisitAndConversionDimensions()
 {
     Manager::getInstance()->loadPlugins(array('Actions', 'Events', 'DevicesDetector', 'Goals'));
     $dimensions = Dimension::getAllDimensions();
     $this->assertGreaterThan(20, count($dimensions));
     $foundConversion = false;
     $foundVisit = false;
     $foundAction = false;
     foreach ($dimensions as $dimension) {
         if ($dimension instanceof \Piwik\Plugin\Dimension\ConversionDimension) {
             $foundConversion = true;
         } else {
             if ($dimension instanceof \Piwik\Plugin\Dimension\ActionDimension) {
                 $foundAction = true;
             } else {
                 if ($dimension instanceof \Piwik\Plugin\Dimension\VisitDimension) {
                     $foundVisit = true;
                 } else {
                     $this->fail('Unexpected dimension class found');
                 }
             }
         }
         $this->assertRegExp('/Piwik.Plugins.(Actions|Events|DevicesDetector|Goals).Columns/', get_class($dimension));
     }
     $this->assertTrue($foundConversion);
     $this->assertTrue($foundAction);
     $this->assertTrue($foundVisit);
 }
开发者ID:Abine,项目名称:piwik,代码行数:28,代码来源:DimensionTest.php

示例2: doUpdate

 public function doUpdate(Updater $updater)
 {
     try {
         Manager::getInstance()->activatePlugin('Monolog');
     } catch (\Exception $e) {
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:2.11.0-b5.php

示例3: deactivate

 /**
  * Called on plugin deactivation.
  */
 public function deactivate()
 {
     // activate default Login module, as one of them is needed to access Piwik
     if (Manager::getInstance()->isPluginActivated("Login") == false) {
         Manager::getInstance()->activatePlugin("Login");
     }
 }
开发者ID:Joey3000,项目名称:piwik-LoginEncrypted,代码行数:10,代码来源:LoginEncrypted.php

示例4: update

 static function update()
 {
     try {
         Manager::getInstance()->activatePlugin('Monolog');
     } catch (\Exception $e) {
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:7,代码来源:2.11.0-b5.php

示例5: piwikVersionBasedCacheBuster

 /**
  * Cache buster based on
  *  - Piwik version
  *  - Loaded plugins
  *  - Super user salt
  *  - Latest
  *
  * @param string[] $pluginNames
  * @return string
  */
 public function piwikVersionBasedCacheBuster($pluginNames = false)
 {
     $currentGitHash = @file_get_contents(PIWIK_INCLUDE_PATH . '/.git/refs/heads/master');
     $pluginList = md5(implode(",", !$pluginNames ? Manager::getInstance()->getLoadedPluginsName() : $pluginNames));
     $cacheBuster = md5(SettingsPiwik::getSalt() . $pluginList . PHP_VERSION . Version::VERSION . trim($currentGitHash));
     return $cacheBuster;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:UIAssetCacheBuster.php

示例6: doUpdate

 public function doUpdate(Updater $updater)
 {
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('ImageGraph');
     } catch (\Exception $e) {
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:1.6-rc1.php

示例7: update

 static function update()
 {
     try {
         \Piwik\Plugin\Manager::getInstance()->activatePlugin('PrivacyManager');
     } catch (\Exception $e) {
     }
 }
开发者ID:carriercomm,项目名称:piwik,代码行数:7,代码来源:1.5-rc6.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     Plugin\Manager::getInstance()->activatePlugin('MobileAppMeasurable');
     // setup the access layer
     FakeAccess::$superUser = true;
 }
开发者ID:ahdinosaur,项目名称:analytics.dinosaur.is,代码行数:7,代码来源:ApiTest.php

示例9: registerWidgets

 public function registerWidgets()
 {
     if (PluginManager::getInstance()->isPluginActivated('UserCountry')) {
         WidgetsList::add('General_Visitors', Piwik::translate('UserCountryMap_VisitorMap'), 'UserCountryMap', 'visitorMap');
         WidgetsList::add('Live!', Piwik::translate('UserCountryMap_RealTimeMap'), 'UserCountryMap', 'realtimeMap');
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:7,代码来源:UserCountryMap.php

示例10: __construct

 public function __construct(Api\Client $marketplaceClient, Consumer $consumer, Advertising $advertising)
 {
     $this->marketplaceClient = $marketplaceClient;
     $this->consumer = $consumer;
     $this->advertising = $advertising;
     $this->pluginManager = Plugin\Manager::getInstance();
 }
开发者ID:piwik,项目名称:piwik,代码行数:7,代码来源:Plugins.php

示例11: configureTopMenu

 public function configureTopMenu(MenuTop $menu)
 {
     $login = Piwik::getCurrentUserLogin();
     $user = APIUsersManager::getInstance()->getUser($login);
     if (!empty($user['alias'])) {
         $login = $user['alias'];
     }
     if (Plugin\Manager::getInstance()->isPluginActivated('Feedback')) {
         $menu->addItem('General_Help', null, array('module' => 'Feedback', 'action' => 'index'));
     }
     if (Piwik::isUserIsAnonymous()) {
         if (Plugin\Manager::getInstance()->isPluginActivated('Feedback')) {
             $menu->addItem($login, null, array('module' => 'Feedback', 'action' => 'index'), 998);
         } else {
             $menu->addItem($login, null, array('module' => 'API', 'action' => 'listAllAPI'), 998);
         }
     } else {
         $menu->addItem($login, null, array('module' => 'UsersManager', 'action' => 'userSettings'), 998);
     }
     $module = $this->getLoginModule();
     if (Piwik::isUserIsAnonymous()) {
         $menu->addItem('Login_LogIn', null, array('module' => $module, 'action' => false), 999);
     } else {
         $menu->addItem('General_Logout', null, array('module' => $module, 'action' => 'logout', 'idSite' => null), 999);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:26,代码来源:Menu.php

示例12: postEvent

 /**
  * Triggers an event, executing all callbacks associated with it.
  *
  * @param string $eventName The name of the event, ie, API.getReportMetadata.
  * @param array $params The parameters to pass to each callback when executing.
  * @param bool $pending Whether this event should be posted again for plugins
  *                      loaded after the event is fired.
  * @param array|null $plugins The plugins to post events to. If null, the event
  *                            is posted to all plugins. The elements of this array
  *                            can be either the Plugin objects themselves
  *                            or their string names.
  */
 public function postEvent($eventName, $params, $pending = false, $plugins = null)
 {
     if ($pending) {
         $this->pendingEvents[] = array($eventName, $params);
     }
     if (empty($plugins)) {
         $plugins = \Piwik\Plugin\Manager::getInstance()->getPluginsLoadedAndActivated();
     }
     $callbacks = array();
     // collect all callbacks to execute
     foreach ($plugins as $plugin) {
         if (is_string($plugin)) {
             $plugin = \Piwik\Plugin\Manager::getInstance()->getLoadedPlugin($plugin);
         }
         $hooks = $plugin->getListHooksRegistered();
         if (isset($hooks[$eventName])) {
             list($pluginFunction, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($hooks[$eventName]);
             $callbacks[$callbackGroup][] = is_string($pluginFunction) ? array($plugin, $pluginFunction) : $pluginFunction;
         }
     }
     if (isset($this->extraObservers[$eventName])) {
         foreach ($this->extraObservers[$eventName] as $callbackInfo) {
             list($callback, $callbackGroup) = $this->getCallbackFunctionAndGroupNumber($callbackInfo);
             $callbacks[$callbackGroup][] = $callback;
         }
     }
     // sort callbacks by their importance
     ksort($callbacks);
     // execute callbacks in order
     foreach ($callbacks as $callbackGroup) {
         foreach ($callbackGroup as $callback) {
             call_user_func_array($callback, $params);
         }
     }
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:47,代码来源:EventDispatcher.php

示例13: factory

 /**
  * Create a component instance that exists within a specific plugin. Uses the component's
  * unqualified class name and expected base type.
  *
  * This method will only create a class if it is located within the component type's
  * associated subdirectory.
  *
  * @param string $pluginName The name of the plugin the component is expected to belong to,
  *                           eg, `'UserSettings'`.
  * @param string $componentClassSimpleName The component's class name w/o namespace, eg,
  *                                         `"GetKeywords"`.
  * @param string $componentTypeClass The fully qualified class name of the component type, eg,
  *                                   `"Piwik\Plugin\Report"`.
  * @return mixed|null A new instance of the desired component or null if not found. If the
  *                    plugin is not loaded or activated or the component is not located in
  *                    in the sub-namespace specified by `$componentTypeClass::COMPONENT_SUBNAMESPACE`,
  *                    this method will return null.
  */
 public static function factory($pluginName, $componentClassSimpleName, $componentTypeClass)
 {
     if (empty($pluginName) || empty($componentClassSimpleName)) {
         return null;
     }
     $pluginManager = PluginManager::getInstance();
     try {
         if (!$pluginManager->isPluginActivated($pluginName)) {
             return null;
         }
         $plugin = $pluginManager->getLoadedPlugin($pluginName);
     } catch (Exception $e) {
         Log::debug($e);
         return null;
     }
     $subnamespace = $componentTypeClass::COMPONENT_SUBNAMESPACE;
     $desiredComponentClass = 'Piwik\\Plugins\\' . $pluginName . '\\' . $subnamespace . '\\' . $componentClassSimpleName;
     $components = $plugin->findMultipleComponents($subnamespace, $componentTypeClass);
     foreach ($components as $class) {
         if ($class == $desiredComponentClass) {
             return new $class();
         }
     }
     return null;
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:43,代码来源:ComponentFactory.php

示例14: getTopMenuTranslationKey

 function getTopMenuTranslationKey()
 {
     // if MobileMessaging is not activated, display 'Email reports'
     if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging')) {
         return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
     }
     if (Piwik::isUserIsAnonymous()) {
         return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
     }
     try {
         $reports = API::getInstance()->getReports();
         $reportCount = count($reports);
         // if there are no reports and the mobile account is
         //  - not configured: display 'Email reports'
         //  - configured: display 'Email & SMS reports'
         if ($reportCount == 0) {
             return APIMobileMessaging::getInstance()->areSMSAPICredentialProvided() ? self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY : self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
         }
     } catch (\Exception $e) {
         return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
     }
     $anyMobileReport = false;
     foreach ($reports as $report) {
         if ($report['type'] == MobileMessaging::MOBILE_TYPE) {
             $anyMobileReport = true;
             break;
         }
     }
     // if there is at least one sms report, display 'Email & SMS reports'
     if ($anyMobileReport) {
         return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
     }
     return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:34,代码来源:Menu.php

示例15: installOrUpdatePluginFromMarketplace

 public function installOrUpdatePluginFromMarketplace($pluginName)
 {
     $this->checkMarketplaceIsEnabled();
     $this->pluginName = $pluginName;
     try {
         $this->makeSureFoldersAreWritable();
         $this->makeSurePluginNameIsValid();
         $tmpPluginZip = $this->downloadPluginFromMarketplace();
         $tmpPluginFolder = dirname($tmpPluginZip) . '/' . basename($tmpPluginZip, '.zip') . '/';
         $this->extractPluginFiles($tmpPluginZip, $tmpPluginFolder);
         $this->makeSurePluginJsonExists($tmpPluginFolder);
         $metadata = $this->getPluginMetadataIfValid($tmpPluginFolder);
         $this->makeSureThereAreNoMissingRequirements($metadata);
         $this->copyPluginToDestination($tmpPluginFolder);
         Filesystem::deleteAllCacheOnUpdate($this->pluginName);
         $pluginManager = PluginManager::getInstance();
         if ($pluginManager->isPluginLoaded($this->pluginName)) {
             $plugin = PluginManager::getInstance()->getLoadedPlugin($this->pluginName);
             if (!empty($plugin)) {
                 $plugin->reloadPluginInformation();
             }
         }
     } catch (\Exception $e) {
         if (!empty($tmpPluginZip)) {
             Filesystem::deleteFileIfExists($tmpPluginZip);
         }
         if (!empty($tmpPluginFolder)) {
             $this->removeFolderIfExists($tmpPluginFolder);
         }
         throw $e;
     }
     $this->removeFileIfExists($tmpPluginZip);
     $this->removeFolderIfExists($tmpPluginFolder);
 }
开发者ID:piwik,项目名称:piwik,代码行数:34,代码来源:PluginInstaller.php


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