Example #1
0
function valid_action($action)
{
    $action = strtolower(str_underscorize($action));
    $valid_php_function_name = '/[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9_\\x7f-\\xff]*/';
    if (preg_match($valid_php_function_name, $action)) {
        return $action;
    }
}
Example #2
0
function handler_match_($handler, $req, &$matches = NULL)
{
    $method_matched = (is_equal($req['method'], $handler['method']) or is_equal('*', $handler['method']));
    foreach ($handler['paths'] as $path) {
        if ($path_matched = path_match($path, $req['path'], $matches)) {
            break;
        }
    }
    $action_cond_failed = (isset($handler['conds']['action']) and (!isset($req['form']['action']) or !is_equal($handler['conds']['action'], strtolower(str_underscorize($req['form']['action'])))));
    $query_cond_failed = (isset($handler['conds']['query']) and is_equal(true, $handler['conds']['query']) and empty($req['query']));
    if ($method_matched and $path_matched and !$action_cond_failed and !$query_cond_failed) {
        return $handler;
    }
}