private function getActions()
{
$this->actions = array();
$filter = array('Authentication', 'Error', 'Core');
$modules = array();
$finder = new Finder();
$finder->name('*.php')->in(BACKEND_MODULES_PATH . '/*/Actions')->in(BACKEND_MODULES_PATH . '/*/Ajax');
foreach ($finder->files() as $file) {
/** @var $file \SplFileInfo */
$module = $file->getPathInfo()->getPathInfo()->getBasename();
// skip some modules
if (in_array($module, $filter)) {
continue;
}
if (BackendAuthentication::isAllowedModule($module)) {
$actionName = $file->getBasename('.php');
$isAjax = $file->getPathInfo()->getBasename() == 'Ajax';
$modules[] = $module;
// ajax-files should be required
if ($isAjax) {
$class = 'Backend\\Modules\\' . $module . '\\Ajax\\' . $actionName;
} else {
$class = 'Backend\\Modules\\' . $module . '\\Actions\\' . $actionName;
}
$reflection = new \ReflectionClass($class);
$phpDoc = trim($reflection->getDocComment());
if ($phpDoc != '') {
$offset = mb_strpos($reflection->getDocComment(), '*', 7);
$description = mb_substr($reflection->getDocComment(), 0, $offset);
$description = str_replace('*', '', $description);
$description = trim(str_replace('/', '', $description));
} else {
$description = '';
}
$this->actions[$module][] = array('label' => \SpoonFilter::toCamelCase($actionName), 'value' => $actionName, 'description' => $description);
}
}
$modules = array_unique($modules);
foreach ($modules as $module) {
$this->modules[] = array('label' => \SpoonFilter::toCamelCase($module), 'value' => $module);
}
}