本文整理匯總了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);
}
}
}