Nun, da ich schon einige Male gefragt wurde, wie am besten zu lösen (wobei ich nicht sagen kann, ob dies die beste Lösung ist), poste ich mal ‚unsere‘ Möglichkeit:
[...]
$acl_resources = array();
foreach ($this->getFrontController()->getControllerDirectory() as $module => $cntrl_path)
{
$files = scandir($cntrl_path);
foreach ($files as $file)
{
if (preg_match('/^([\\w]*)Controller\.php$/i',$file,$hits))
{
$classPrefix = ($module == 'default') ? '' : ucfirst($module).'_';
$className = $classPrefix.$hits[1].'Controller';
require_once($cntrl_path.DIRECTORY_SEPARATOR.$file);
if (class_exists($className))
{
$refl_class = new ReflectionClass($className);
foreach ($refl_class->getMethods() as $refl_method)
{
if (preg_match('/^([\\w]*)Action$/i',(string) $refl_method->getName(),$matches))
{
$acl_resources[$refl_method->getDeclaringClass()->getName()][] = array(
'action' => $matches[0],
'action_short' => strtolower($matches[1])
);
}
}
}
}
}
}
[...]
Wenn’s gefällt, viel Spass – ansonsten bin ich über Kommentare/ Kritik sehr erfreut.
Gruß tucci