route : allow prerouting informations to be added in map comparisons

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2205 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-06-16 12:08:45 +00:00
parent 55bf63d754
commit f5fb16ae57

View File

@@ -26,6 +26,8 @@ class route
// Provide the the class catch errors in routing. // Provide the the class catch errors in routing.
// Must be provided in an array(class,method); // Must be provided in an array(class,method);
public $errors = null; public $errors = null;
/** Preroute used in modules */
public $preroute = "";
/** Return the baseURL of the site /** Return the baseURL of the site
Always finish with a slash Always finish with a slash
@@ -263,6 +265,7 @@ class route
@param function $function Function to be executed if the route match */ @param function $function Function to be executed if the route match */
public function get ($route, $function) public function get ($route, $function)
{ {
$route = $this->preroute.$route;
if ($this->debug) if ($this->debug)
echo "<pre>==> GET $route ?? "; echo "<pre>==> GET $route ?? ";
if ($this->method () !== "GET") if ($this->method () !== "GET")
@@ -284,6 +287,7 @@ class route
@param function $function Function to be executed if the route match */ @param function $function Function to be executed if the route match */
public function post ($route, $function) public function post ($route, $function)
{ {
$route = $this->preroute.$route;
if ($this->debug) if ($this->debug)
echo "<pre>==> POST $route ?? "; echo "<pre>==> POST $route ?? ";
if ($this->method () !== "POST") if ($this->method () !== "POST")
@@ -305,6 +309,7 @@ class route
@param function $function Function to be executed if the route match */ @param function $function Function to be executed if the route match */
public function put ($route, $function) public function put ($route, $function)
{ {
$route = $this->preroute.$route;
if ($this->debug) if ($this->debug)
echo "<pre>==> PUT $route ?? "; echo "<pre>==> PUT $route ?? ";
if ($this->method () !== "PUT") if ($this->method () !== "PUT")
@@ -326,6 +331,7 @@ class route
@param function $function Function to be executed if the route match */ @param function $function Function to be executed if the route match */
public function delete ($route, $function) public function delete ($route, $function)
{ {
$route = $this->preroute.$route;
if ($this->debug) if ($this->debug)
echo "<pre>==> DELETE $route ?? "; echo "<pre>==> DELETE $route ?? ";
if ($this->method () !== "DELETE") if ($this->method () !== "DELETE")