public function getAvailableActionsAction()
{
$actions = [];
$controller = $this->getParam("controllerName");
$controllerClass = str_replace("-", " ", $controller);
$controllerClass = str_replace(" ", "", ucwords($controllerClass));
$controllerClass = preg_replace_callback("/([_])([a-z])/i", function ($matches) {
return "/" . strtoupper($matches[2]);
}, $controllerClass);
$controllerDir = $this->getControllerDir();
$controllerFile = $controllerDir . $controllerClass . "Controller.php";
if (is_file($controllerFile)) {
preg_match_all("/function[ ]+([a-zA-Z0-9]+)Action/i", file_get_contents($controllerFile), $matches);
foreach ($matches[1] as $match) {
$dat = [];
$dat["name"] = strtolower(preg_replace("/[A-Z]/", "-\\0", $match));
$actions[] = $dat;
}
}
$this->_helper->json(["data" => $actions]);
}