本文整理汇总了PHP中Piwik\Plugin\Manager::getLoadedPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP Manager::getLoadedPlugin方法的具体用法?PHP Manager::getLoadedPlugin怎么用?PHP Manager::getLoadedPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Plugin\Manager
的用法示例。
在下文中一共展示了Manager::getLoadedPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
}
}