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.'));
}