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


PHP Plugin\Manager类代码示例

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


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

示例1: arePiwikProAdsEnabled

 /**
  * Returns true if it is ok to show some Piwik PRO advertising in the Piwik UI.
  * @return bool
  */
 public function arePiwikProAdsEnabled()
 {
     if ($this->pluginManager->isPluginActivated('EnterpriseAdmin') || $this->pluginManager->isPluginActivated('LoginAdmin') || $this->pluginManager->isPluginActivated('CloudAdmin') || $this->pluginManager->isPluginActivated('WhiteLabel')) {
         return false;
     }
     $showAds = $this->config->General['piwik_pro_ads_enabled'];
     return !empty($showAds);
 }
开发者ID:aassou,项目名称:AnnahdaWebsiteCanvas,代码行数:12,代码来源:Advertising.php

示例2: getAllLogTables

 /**
  * Get all log table instances defined by any activated and loaded plugin. The returned tables are not sorted in
  * any order.
  * @return LogTable[]
  */
 public function getAllLogTables()
 {
     if (!isset($this->tablesCache)) {
         $tables = $this->pluginManager->findMultipleComponents('Tracker', 'Piwik\\Tracker\\LogTable');
         $this->tablesCache = array();
         foreach ($tables as $table) {
             $this->tablesCache[] = StaticContainer::get($table);
         }
     }
     return $this->tablesCache;
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:16,代码来源:LogTablesProvider.php

示例3: getAllReleaseChannels

 /**
  * @return ReleaseChannel[]
  */
 public function getAllReleaseChannels()
 {
     $classNames = $this->pluginManager->findMultipleComponents('ReleaseChannel', 'Piwik\\UpdateCheck\\ReleaseChannel');
     $channels = array();
     foreach ($classNames as $className) {
         $channels[] = StaticContainer::get($className);
     }
     usort($channels, function (ReleaseChannel $a, ReleaseChannel $b) {
         if ($a->getOrder() === $b->getOrder()) {
             return 0;
         }
         return $a->getOrder() < $b->getOrder() ? -1 : 1;
     });
     return $channels;
 }
开发者ID:piwik,项目名称:piwik,代码行数:18,代码来源:ReleaseChannels.php

示例4: enrichPluginInformation

 private function enrichPluginInformation($plugin)
 {
     if (empty($plugin)) {
         return $plugin;
     }
     $plugin['isInstalled'] = $this->isPluginInstalled($plugin['name']);
     $plugin['isActivated'] = $this->isPluginActivated($plugin['name']);
     $plugin['isInvalid'] = $this->pluginManager->isPluginThirdPartyAndBogus($plugin['name']);
     $plugin['canBeUpdated'] = $plugin['isInstalled'] && $this->hasPluginUpdate($plugin);
     $plugin['lastUpdated'] = $this->toShortDate($plugin['lastUpdated']);
     $plugin['hasExceededLicense'] = !empty($plugin['isInstalled']) && !empty($plugin['shop']) && empty($plugin['isFree']) && empty($plugin['isDownloadable']) && !empty($plugin['consumer']['license']['isValid']) && !empty($plugin['consumer']['license']['isExceeded']);
     $plugin['isMissingLicense'] = !empty($plugin['isInstalled']) && !empty($plugin['shop']) && empty($plugin['isFree']) && empty($plugin['isDownloadable']) && empty($plugin['consumer']['license']);
     if (!empty($plugin['owner']) && strtolower($plugin['owner']) === 'piwikpro' && !empty($plugin['homepage']) && strpos($plugin['homepage'], 'pk_campaign') === false) {
         $plugin['homepage'] = $this->advertising->addPromoCampaignParametersToUrl($plugin['homepage'], Advertising::CAMPAIGN_NAME_PROFESSIONAL_SERVICES, 'Marketplace', $plugin['name']);
     }
     if ($plugin['canBeUpdated']) {
         $pluginUpdate = $this->getPluginUpdateInformation($plugin);
         $plugin['repositoryChangelogUrl'] = $pluginUpdate['repositoryChangelogUrl'];
         $plugin['currentVersion'] = $pluginUpdate['currentVersion'];
     }
     if (!empty($plugin['activity']['lastCommitDate']) && false === strpos($plugin['activity']['lastCommitDate'], '0000') && false === strpos($plugin['activity']['lastCommitDate'], '1970')) {
         $plugin['activity']['lastCommitDate'] = $this->toLongDate($plugin['activity']['lastCommitDate']);
     } else {
         $plugin['activity']['lastCommitDate'] = null;
     }
     if (!empty($plugin['versions'])) {
         foreach ($plugin['versions'] as $index => $version) {
             $plugin['versions'][$index]['release'] = $this->toLongDate($version['release']);
         }
     }
     $plugin = $this->addMissingRequirements($plugin);
     return $plugin;
 }
开发者ID:piwik,项目名称:piwik,代码行数:33,代码来源:Plugins.php

示例5: 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

示例6: 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

示例7: update

 static function update()
 {
     $errors = array();
     try {
         $checker = new DoNotTrackHeaderChecker();
         // enable DoNotTrack check in PrivacyManager if DoNotTrack plugin was enabled
         if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('DoNotTrack')) {
             $checker->activate();
         }
         // enable IP anonymization if AnonymizeIP plugin was enabled
         if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('AnonymizeIP')) {
             IPAnonymizer::activate();
         }
     } catch (\Exception $ex) {
         // pass
     }
     // disable & delete old plugins
     $oldPlugins = array('DoNotTrack', 'AnonymizeIP');
     foreach ($oldPlugins as $plugin) {
         try {
             \Piwik\Plugin\Manager::getInstance()->deactivatePlugin($plugin);
         } catch (\Exception $e) {
         }
         $dir = PIWIK_INCLUDE_PATH . "/plugins/{$plugin}";
         if (file_exists($dir)) {
             Filesystem::unlinkRecursive($dir, true);
         }
         if (file_exists($dir)) {
             $errors[] = "Please delete this directory manually (eg. using your FTP software): {$dir} \n";
         }
     }
     if (!empty($errors)) {
         throw new \Exception("Warnings during the update: <br>" . implode("<br>", $errors));
     }
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:35,代码来源:2.0.3-b7.php

示例8: update

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

示例9: getAvailableCommands

 /**
  * Returns a list of available command classnames.
  *
  * @return string[]
  */
 private function getAvailableCommands()
 {
     $commands = $this->getDefaultPiwikCommands();
     $detected = PluginManager::getInstance()->findMultipleComponents('Commands', 'Piwik\\Plugin\\ConsoleCommand');
     $commands = array_merge($commands, $detected);
     /**
      * Triggered to filter / restrict console commands. Plugins that want to restrict commands
      * should subscribe to this event and remove commands from the existing list.
      *
      * **Example**
      *
      *     public function filterConsoleCommands(&$commands)
      *     {
      *         $key = array_search('Piwik\Plugins\MyPlugin\Commands\MyCommand', $commands);
      *         if (false !== $key) {
      *             unset($commands[$key]);
      *         }
      *     }
      *
      * @param array &$commands An array containing a list of command class names.
      */
     Piwik::postEvent('Console.filterCommands', array(&$commands));
     $commands = array_values(array_unique($commands));
     return $commands;
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:30,代码来源:Console.php

示例10: getPluginName

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return array
  * @throws \RuntimeException
  */
 protected function getPluginName(InputInterface $input, OutputInterface $output)
 {
     $overwrite = $input->getOption('overwrite');
     $self = $this;
     $validate = function ($pluginName) use($self, $overwrite) {
         if (empty($pluginName)) {
             throw new \RuntimeException('You have to enter a plugin name');
         }
         if (strlen($pluginName) > 40) {
             throw new \RuntimeException('Your plugin name cannot be longer than 40 characters');
         }
         if (!Plugin\Manager::getInstance()->isValidPluginName($pluginName)) {
             throw new \RuntimeException(sprintf('The plugin name %s is not valid. The name must start with a letter and is only allowed to contain numbers and letters.', $pluginName));
         }
         $pluginPath = $self->getPluginPath($pluginName);
         if (file_exists($pluginPath) && !$overwrite) {
             throw new \RuntimeException('A plugin with this name already exists');
         }
         return $pluginName;
     };
     $pluginName = $input->getOption('name');
     if (empty($pluginName)) {
         $dialog = $this->getHelperSet()->get('dialog');
         $pluginName = $dialog->askAndValidate($output, 'Enter a plugin name: ', $validate);
     } else {
         $validate($pluginName);
     }
     $pluginName = ucfirst($pluginName);
     return $pluginName;
 }
开发者ID:piwik,项目名称:piwik,代码行数:36,代码来源:GeneratePlugin.php

示例11: isPluginActivated

 protected function isPluginActivated($pluginName)
 {
     if (in_array($pluginName, $this->activatedPluginNames)) {
         return true;
     }
     return $this->pluginManager->isPluginActivated($pluginName);
 }
开发者ID:piwik,项目名称:piwik,代码行数:7,代码来源:InvalidLicenses.php

示例12: 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

示例13: doUpdate

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

示例14: 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

示例15: update

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


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