Habari\RewriteRule::create_url_rule PHP Метод

create_url_rule() публичный статический Метод

Create an old-style rewrite rule
public static create_url_rule ( string $build_str, string $handler, string $action ) : RewriteRule
$build_str string
$handler string
$action string
Результат RewriteRule The created rule
    public static function create_url_rule($build_str, $handler, $action)
    {
        $arr = explode('/', $build_str);
        $searches = array('/^([^"\']+)$/', '/^["\'](.+)["\']$/');
        $replacements = array('(?P<\\1>.+)', '\\1');
        $re_arr = preg_replace($searches, $replacements, $arr);
        $searches = array('/^([^"\']+)$/', '/^["\'](.+)["\']$/');
        $replacements = array('{$\\1}', '\\1');
        $str_arr = preg_replace($searches, $replacements, $arr);
        $regex = '/^' . implode('\\/', $re_arr) . '\\/?$/i';
        $build_str = implode('/', $str_arr);
        return new RewriteRule(array('name' => $action, 'parse_regex' => $regex, 'build_str' => $build_str, 'handler' => $handler, 'action' => $action, 'priority' => 1, 'is_active' => 1, 'rule_class' => RewriteRule::RULE_CUSTOM, 'description' => 'Custom old-style rule.'));
    }