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


PHP Manager::activatePlugin方法代码示例

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


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

示例1: test_deactivatePlugin

 public function test_deactivatePlugin()
 {
     $this->assertFalse($this->manager->isPluginActivated('ExampleTheme'));
     $this->manager->activatePlugin('ExampleTheme');
     $this->assertTrue($this->manager->isPluginActivated('ExampleTheme'));
     $this->manager->deactivatePlugin('ExampleTheme');
     $this->assertFalse($this->manager->isPluginActivated('ExampleTheme'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:ManagerTest.php

示例2: activate

 public function activate($redirectAfter = true)
 {
     $pluginName = $this->initPluginModification(static::ACTIVATE_NONCE);
     $this->dieIfPluginsAdminIsDisabled();
     $this->pluginManager->activatePlugin($pluginName);
     if ($redirectAfter) {
         $message = $this->translator->translate('CorePluginsAdmin_SuccessfullyActicated', array($pluginName));
         if ($this->settingsProvider->getSystemSettings($pluginName)) {
             $target = sprintf('<a href="index.php%s#%s">', Url::getCurrentQueryStringWithParametersModified(array('module' => 'CoreAdminHome', 'action' => 'generalSettings')), $pluginName);
             $message .= ' ' . $this->translator->translate('CorePluginsAdmin_ChangeSettingsPossible', array($target, '</a>'));
         }
         $notification = new Notification($message);
         $notification->raw = true;
         $notification->title = $this->translator->translate('General_WellDone');
         $notification->context = Notification::CONTEXT_SUCCESS;
         Notification\Manager::notify('CorePluginsAdmin_PluginActivated', $notification);
         $redirectTo = Common::getRequestVar('redirectTo', '', 'string');
         if (!empty($redirectTo) && $redirectTo === 'marketplace') {
             $this->redirectToIndex('Marketplace', 'overview');
         } elseif (!empty($redirectTo) && $redirectTo === 'referrer') {
             $this->redirectAfterModification($redirectAfter);
         } else {
             $plugin = $this->pluginManager->loadPlugin($pluginName);
             $actionToRedirect = 'plugins';
             if ($plugin->isTheme()) {
                 $actionToRedirect = 'themes';
             }
             $this->redirectToIndex('CorePluginsAdmin', $actionToRedirect);
         }
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:31,代码来源:Controller.php

示例3: installAllPaidPlugins

 public function installAllPaidPlugins()
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->dieIfPluginsAdminIsDisabled();
     Plugin\ControllerAdmin::displayWarningIfConfigFileNotWritable();
     Nonce::checkNonce(static::INSTALL_NONCE);
     $paidPlugins = $this->plugins->getAllPaidPlugins();
     $hasErrors = false;
     foreach ($paidPlugins as $paidPlugin) {
         if (!$this->canPluginBeInstalled($paidPlugin)) {
             continue;
         }
         $pluginName = $paidPlugin['name'];
         try {
             $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
         } catch (\Exception $e) {
             $notification = new Notification($e->getMessage());
             $notification->context = Notification::CONTEXT_ERROR;
             Notification\Manager::notify('Marketplace_Install' . $pluginName, $notification);
             $hasErrors = true;
         }
     }
     if ($hasErrors) {
         Url::redirectToReferrer();
         return;
     }
     $dependency = new Plugin\Dependency();
     for ($i = 0; $i <= 10; $i++) {
         foreach ($paidPlugins as $index => $paidPlugin) {
             $pluginName = $paidPlugin['name'];
             if ($this->pluginManager->isPluginActivated($pluginName)) {
                 unset($paidPlugins[$index]);
                 continue;
             }
             if (empty($paidPlugin['require']) || !$dependency->hasDependencyToDisabledPlugin($paidPlugin['require'])) {
                 unset($paidPlugins[$index]);
                 try {
                     $this->pluginManager->activatePlugin($pluginName);
                 } catch (Exception $e) {
                     $hasErrors = true;
                     $notification = new Notification($e->getMessage());
                     $notification->context = Notification::CONTEXT_ERROR;
                     Notification\Manager::notify('Marketplace_Install' . $pluginName, $notification);
                 }
             }
         }
     }
     if ($hasErrors) {
         $notification = new Notification(Piwik::translate('Marketplace_OnlySomePaidPluginsInstalledAndActivated'));
         $notification->context = Notification::CONTEXT_INFO;
     } else {
         $notification = new Notification(Piwik::translate('Marketplace_AllPaidPluginsInstalledAndActivated'));
         $notification->context = Notification::CONTEXT_SUCCESS;
     }
     Notification\Manager::notify('Marketplace_InstallAll', $notification);
     Url::redirectToReferrer();
 }
开发者ID:piwik,项目名称:piwik,代码行数:57,代码来源:Controller.php

示例4: exec

 public function exec()
 {
     if (!$this->pluginManager->isPluginActivated($this->pluginName)) {
         $this->pluginManager->activatePlugin($this->pluginName);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:6,代码来源:Activate.php


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