PluginBag.php in Crumbs, the Breadcrumbs suite 7.2
File
lib/PluginSystem/PluginBag.php
View source
<?php
class crumbs_PluginSystem_PluginBag {
protected $plugins;
protected $routelessPluginMethods = array();
protected $routePluginMethods = array();
function __construct($plugins, $routelessPluginMethods, $routePluginMethods) {
$this->plugins = $plugins;
$this->routelessPluginMethods = $routelessPluginMethods;
$this->routePluginMethods = $routePluginMethods;
}
function getDecorateBreadcrumbPlugins() {
$plugin_methods = isset($this->routelessPluginMethods['decorateBreadcrumb']) ? $this->routelessPluginMethods['decorateBreadcrumb'] : array();
$plugins = array();
foreach ($plugin_methods as $pluginKey => $method) {
if (!isset($this->plugins[$pluginKey])) {
continue;
}
$plugins[$pluginKey] = $this->plugins[$pluginKey];
}
return $plugins;
}
function getRoutePluginMethodIterator($base_method_name, $route) {
$methods = $this
->getRoutePluginMethods($base_method_name, $route);
return new crumbs_PluginSystem_PluginMethodIterator($methods, $this->plugins, $base_method_name);
}
private function getRoutePluginMethods($base_method_name, $route) {
if (isset($this->routePluginMethods[$base_method_name][$route])) {
return $this->routePluginMethods[$base_method_name][$route];
}
if (isset($this->routelessPluginMethods[$base_method_name])) {
return $this->routelessPluginMethods[$base_method_name];
}
return array();
}
}