本文整理汇总了PHP中Piwik\Plugin\Manager::isPluginActivated方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::isPluginActivated方法的具体用法?PHP Manager::isPluginActivated怎么用?PHP Manager::isPluginActivated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Plugin\Manager
的用法示例。
在下文中一共展示了Manager::isPluginActivated方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
}
示例2: 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);
}
示例3: isPluginActivated
private function isPluginActivated($pluginName)
{
if (in_array($pluginName, $this->activatedPluginNames)) {
return true;
}
return $this->pluginManager->isPluginActivated($pluginName);
}
示例4: uploadPlugin
public function uploadPlugin()
{
static::dieIfPluginsAdminIsDisabled();
Piwik::checkUserHasSuperUserAccess();
$nonce = Common::getRequestVar('nonce', null, 'string');
if (!Nonce::verifyNonce(MarketplaceController::INSTALL_NONCE, $nonce)) {
throw new \Exception($this->translator->translate('General_ExceptionNonceMismatch'));
}
Nonce::discardNonce(MarketplaceController::INSTALL_NONCE);
if (empty($_FILES['pluginZip'])) {
throw new \Exception('You did not specify a ZIP file.');
}
if (!empty($_FILES['pluginZip']['error'])) {
throw new \Exception('Something went wrong during the plugin file upload. Please try again.');
}
$file = $_FILES['pluginZip']['tmp_name'];
if (!file_exists($file)) {
throw new \Exception('Something went wrong during the plugin file upload. Please try again.');
}
$view = $this->configureView('@CorePluginsAdmin/uploadPlugin');
$pluginMetadata = $this->pluginInstaller->installOrUpdatePluginFromFile($file);
$view->nonce = Nonce::getNonce(static::ACTIVATE_NONCE);
$view->plugin = array('name' => $pluginMetadata->name, 'version' => $pluginMetadata->version, 'isTheme' => !empty($pluginMetadata->theme), 'isActivated' => $this->pluginManager->isPluginActivated($pluginMetadata->name));
return $view->render();
}
示例5: canPluginBeInstalled
private function canPluginBeInstalled($plugin)
{
if (empty($plugin['isDownloadable'])) {
return false;
}
$pluginName = $plugin['name'];
$isAlreadyInstalled = $this->pluginManager->isPluginInstalled($pluginName) || $this->pluginManager->isPluginLoaded($pluginName) || $this->pluginManager->isPluginActivated($pluginName);
return !$isAlreadyInstalled;
}
示例6: getLoadedAndActivated
private function getLoadedAndActivated($pluginName)
{
if (!$this->pluginManager->isPluginLoaded($pluginName)) {
return;
}
try {
if (!$this->pluginManager->isPluginActivated($pluginName)) {
return;
}
$plugin = $this->pluginManager->getLoadedPlugin($pluginName);
} catch (\Exception $e) {
// we are not allowed to use possible settings from this plugin, plugin is not active
return;
}
return $plugin;
}
示例7: factory
/**
* Get the widget defined by the given module and action.
*
* @param string $module Aka plugin name, eg 'CoreHome'
* @param string $action An action eg 'renderMe'
* @return Widget|null
* @throws \Exception Throws an exception if the widget is not enabled.
*/
public function factory($module, $action)
{
if (empty($module) || empty($action)) {
return;
}
try {
if (!$this->pluginManager->isPluginActivated($module)) {
return;
}
$plugin = $this->pluginManager->getLoadedPlugin($module);
} catch (\Exception $e) {
// we are not allowed to use possible widgets, plugin is not active
return;
}
/** @var Widget[] $widgetContainer */
$widgets = $plugin->findMultipleComponents('Widgets', 'Piwik\\Widget\\Widget');
foreach ($widgets as $widgetClass) {
$config = $this->getWidgetConfigForClassName($widgetClass);
if ($config->getAction() === $action) {
$config->checkIsEnabled();
return StaticContainer::get($widgetClass);
}
}
}
示例8: exec
public function exec()
{
if (!$this->pluginManager->isPluginActivated($this->pluginName)) {
$this->pluginManager->activatePlugin($this->pluginName);
}
}
示例9: isPluginActivated
protected function isPluginActivated($pluginName)
{
return $this->pluginManager->isPluginActivated($pluginName);
}
示例10: makeSiteSearchCategory
private function makeSiteSearchCategory(Plugin\Manager $pluginManager)
{
return $this->makeProperty('sitesearch_category_parameters', $default = array(), FieldConfig::TYPE_ARRAY, function (FieldConfig $field) use($pluginManager) {
$field->title = Piwik::translate('SitesManager_SearchCategoryLabel');
$field->uiControl = FieldConfig::UI_CONTROL_TEXT;
$field->inlineHelp = Piwik::translate('Goals_Optional') . '<br /><br />' . Piwik::translate('SitesManager_SearchCategoryParametersDesc');
$hasCustomVars = (int) $pluginManager->isPluginActivated('CustomVariables');
$field->condition = $hasCustomVars . ' && sitesearch && !use_default_site_search_params';
});
}