d1rk
10/21/2009 - 7:22 AM

listActions

listActions

    function listActions($name, $path) {
		$plugin = (strpos($path, 'app'.DS.'plugins')) ? $this->getPluginFromPath($path).'.' : '';
        $controllerName = $name.'Controller';
        App::import('Controller', $plugin.$controllerName);
        $methods = get_class_methods($controllerName);

debug($controllerName);
debug($methods);

        // base methods
        if (strpos($path, 'app'.DS.'plugins')) {
            $plugin = $this->getPluginFromPath($path);
            $pacName = $plugin.'AppController'; // pac - PluginAppController
            $pacPath = APP.'plugins'.DS.$plugin.DS.$pacName.'_app_controller.php';
            App::import('Controller', $pacName);
			debug($pacName);
            $baseMethods = get_class_methods($pacName);
        } else {
            $baseMethods = get_class_methods('AppController');
        }

debug($baseMethods);
        // filter out methods
        foreach ($methods AS $k => $method) {
            if (strpos($method, '_', 0) === 0) {
                unset($methods[$k]);
                continue;
            }
            if (in_array($method, $baseMethods)) {
                unset($methods[$k]);
                continue;
            }
        }

        return $methods;
    }