本文整理汇总了PHP中System\Classes\PluginManager::getPlugins方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManager::getPlugins方法的具体用法?PHP PluginManager::getPlugins怎么用?PHP PluginManager::getPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System\Classes\PluginManager
的用法示例。
在下文中一共展示了PluginManager::getPlugins方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadItems
/**
* Loads the menu items from modules and plugins
* @return void
*/
protected function loadItems()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
$items = $plugin->registerNavigation();
if (!is_array($items)) {
continue;
}
$this->registerMenuItems($id, $items);
}
/*
* Extensibility
*/
Event::fire('backend.menu.extendItems', [$this]);
/*
* Sort menu items
*/
uasort($this->items, function ($a, $b) {
return $a->order - $b->order;
});
/*
* Filter items user lacks permission for
*/
$user = BackendAuth::getUser();
$this->items = $this->filterItemPermissions($user, $this->items);
foreach ($this->items as $item) {
if (!$item->sideMenu || !count($item->sideMenu)) {
continue;
}
/*
* Apply incremental default orders
*/
$orderCount = 0;
foreach ($item->sideMenu as $sideMenuItem) {
if ($sideMenuItem->order !== -1) {
continue;
}
$sideMenuItem->order = $orderCount += 100;
}
/*
* Sort side menu items
*/
uasort($item->sideMenu, function ($a, $b) {
return $a->order - $b->order;
});
/*
* Filter items user lacks permission for
*/
$item->sideMenu = $this->filterItemPermissions($user, $item->sideMenu);
}
}
示例2: loadExtensions
protected function loadExtensions()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
$items = $plugin->registerMarkupTags();
if (!is_array($items)) {
continue;
}
foreach ($items as $type => $definitions) {
if (!is_array($definitions)) {
continue;
}
$this->registerExtensions($type, $definitions);
}
}
}
示例3: listReportWidgets
/**
* Returns a list of registered report widgets.
* @return array Array keys are class names.
*/
public function listReportWidgets()
{
if ($this->reportWidgets === null) {
$this->reportWidgets = [];
/*
* Load module widgets
*/
foreach ($this->reportWidgetCallbacks as $callback) {
$callback($this);
}
/*
* Load plugin widgets
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $plugin) {
if (!is_array($widgets = $plugin->registerReportWidgets())) {
continue;
}
foreach ($widgets as $className => $widgetInfo) {
$this->registerReportWidget($className, $widgetInfo);
}
}
}
return $this->reportWidgets;
}
示例4: loadResources
public function loadResources()
{
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
if (!method_exists($plugin, 'registerAPIResources')) {
continue;
}
$resources = $plugin->registerAPIResources();
if (!is_array($resources)) {
continue;
}
$this->registerResources($resources);
}
}
示例5: loadItems
protected function loadItems()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
$items = $plugin->registerSettings();
if (!is_array($items)) {
continue;
}
$this->registerSettingItems($id, $items);
}
/*
* Sort settings items
*/
usort($this->items, function ($a, $b) {
return $a->order - $b->order;
});
/*
* Filter items user lacks permission for
*/
$user = BackendAuth::getUser();
$this->items = $this->filterItemPermissions($user, $this->items);
/*
* Process each item in to a category array
*/
$catItems = [];
foreach ($this->items as $item) {
$category = $item->category ?: 'Misc';
if (!isset($catItems[$category])) {
$catItems[$category] = [];
}
$catItems[$category][] = $item;
}
$this->allItems = $this->items;
$this->items = $catItems;
}
示例6: loadItems
/**
* Loads the menu items from modules and plugins
* @return void
*/
protected function loadItems()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
$items = $plugin->registerNavigation();
if (!is_array($items)) {
continue;
}
$this->registerMenuItems($id, $items);
}
/*
* Sort menu items
*/
usort($this->items, function ($a, $b) {
if ($a->order == $b->order) {
return 0;
}
return $a->order > $b->order ? 1 : -1;
});
/*
* Filter items user lacks permission for
*/
$user = BackendAuth::getUser();
$this->items = $this->filterItemPermissions($user, $this->items);
foreach ($this->items as $item) {
if (!$item->sideMenu || !count($item->sideMenu)) {
continue;
}
$item->sideMenu = $this->filterItemPermissions($user, $item->sideMenu);
}
}
示例7: loadGateways
/**
* Loads the menu items from modules and plugins
* @return void
*/
protected function loadGateways()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
if (!method_exists($plugin, 'registerPaymentGateways')) {
continue;
}
$gateways = $plugin->registerPaymentGateways();
if (!is_array($gateways)) {
continue;
}
$this->registerGateways($id, $gateways);
}
}
示例8: loadNotifications
/**
* Loads the notifications from modules and plugins
*
* @return void
*/
protected function loadNotifications()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
if (!method_exists($plugin, 'registerNotifications')) {
continue;
}
$notifications = $plugin->registerNotifications();
if (!is_array($notifications)) {
continue;
}
$this->registerNotifications($id, $notifications);
}
}
示例9: loadConverters
/**
* Loads the menu items from modules and plugins
* @return void
*/
protected function loadConverters()
{
/*
* Load module items
*/
foreach ($this->callbacks as $callback) {
$callback($this);
}
/*
* Load plugin items
*/
$plugins = $this->pluginManager->getPlugins();
foreach ($plugins as $id => $plugin) {
if (!method_exists($plugin, 'registerCurrencyConverters')) {
continue;
}
$converters = $plugin->registerCurrencyConverters();
if (!is_array($converters)) {
continue;
}
$this->registerConverters($id, $converters);
}
}