/** * Check if specific $action is valid controller action (method exists and it is not reserved) * * @access public * @param string $action * @return boolean or Error */ function validAction($action) { // Get reserved names and check action name... $reserved_names = Controller::getReservedActionNames(); if (is_array($reserved_names) && in_array($action, $reserved_names)) { return false; } // Get methods of this class... $methods = get_class_methods(get_class($this)); // If we don't have defined action return false if (!in_array($action, $methods)) { return false; } // All fine... return true; }
/** * Check if specific $action is valid controller action (method exists and it is not reserved) * * @param string $action * @return boolean or Error */ function validAction($action) { $reserved_names = Controller::getReservedActionNames(); if (is_error($reserved_names)) { return $reserved_names; } // if if (is_array($reserved_names) && in_array($action, $reserved_names)) { return false; } // if $methods = get_class_methods(get_class($this)); if (!in_array($action, $methods)) { return false; } // if return true; }