gyro/core/controller/base/routes/parameterizedroutehandlers/ansistring.handler.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Handle ansi string (the "sp" type) 00004 * 00005 * @since 0.5.1 00006 * 00007 * @author Gerd Riesselmann 00008 * @ingroup Controller 00009 */ 00010 class AnsistringParameterizedRouteHandler implements IParameterizedRouteHandler { 00011 /** 00012 * Returns the key that is used to identify this handler in route declaration, e.g. "s" or "ui>" 00013 * 00014 * @return string 00015 */ 00016 public function get_type_key() { 00017 return "sp"; 00018 } 00019 00020 /** 00021 * Return regex to validate path 00022 */ 00023 public function get_validate_regex($params) { 00024 if ($params === false) { 00025 return '[a-zA-Z0-9_-]*?'; 00026 } 00027 else { 00028 return '[a-zA-Z0-9_-]{' . preg_quote($params) . '}'; 00029 } 00030 } 00031 00032 /** 00033 * Preprocess a value before URL is build 00034 */ 00035 public function preprocess_build_url($value) { 00036 return String::plain_ascii($value, '-', true); 00037 } 00038 }