Add all the phpdocs to the domframework
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1246 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
45
route.php
45
route.php
@@ -1,19 +1,28 @@
|
||||
<?php
|
||||
/** DomFramework
|
||||
@package domframework
|
||||
@author Dominique Fournier <dominique@fournier38.fr> */
|
||||
|
||||
error_reporting (E_ALL);
|
||||
/** The routing module, base of the DomFramework */
|
||||
class route
|
||||
{
|
||||
/** The baseURL of the site */
|
||||
private $baseURL = "";
|
||||
/** The baseURL of the module in the site */
|
||||
private $baseURLmodule = "";
|
||||
/** The method used to ask the page */
|
||||
public $method = "";
|
||||
/** The module name */
|
||||
public $module = NULL;
|
||||
public $debug=0; // 0:NoDebug, 1:routing, 2:more debug (developpement)
|
||||
/** The debug mode :
|
||||
0:NoDebug, 1:routing, 2:more debug (developpement)*/
|
||||
public $debug=0;
|
||||
//public $defaultOutput = "html"; // Default renderer : html
|
||||
function __construct ()
|
||||
{
|
||||
}
|
||||
|
||||
/** Return the baseURL of the site
|
||||
Always finish with a slash */
|
||||
Always finish with a slash
|
||||
@param string|null $module The module name (if thereis one) */
|
||||
function baseURL ($module = FALSE)
|
||||
{
|
||||
if ($this->module === NULL)
|
||||
@@ -51,6 +60,8 @@ class route
|
||||
return $this->baseURLmodule;
|
||||
}
|
||||
|
||||
/** Define the base URL of the site
|
||||
@param string $baseURL The base URL of the site */
|
||||
function baseURLset ($baseURL)
|
||||
{
|
||||
$this->baseURL = $baseURL;
|
||||
@@ -73,7 +84,9 @@ class route
|
||||
/** Do all the routing with redirections
|
||||
$destURL can be absolute or relative
|
||||
If module is set, the site is modular and a directory is named with module
|
||||
name */
|
||||
name
|
||||
@param string $destURL Do a redirection of the HTTP page
|
||||
@param string $module The module name */
|
||||
function redirect ($destURL, $module)
|
||||
{
|
||||
if (php_sapi_name () === "cli")
|
||||
@@ -424,7 +437,9 @@ class route
|
||||
function is called.
|
||||
Ex. : $app->get('/hello/{name}', function ($name) {
|
||||
echo "Hello, $name";
|
||||
}); */
|
||||
});
|
||||
@param string $route Route to check with the URL
|
||||
@param function $function Function to be executed if the route match */
|
||||
public function get ($route, $function)
|
||||
{
|
||||
if ($this->debug)
|
||||
@@ -443,7 +458,9 @@ class route
|
||||
function is called.
|
||||
Ex. : $app->get('/hello/{name}', function ($name) {
|
||||
echo "Hello, $name";
|
||||
}); */
|
||||
});
|
||||
@param string $route Route to check with the URL
|
||||
@param function $function Function to be executed if the route match */
|
||||
public function post ($route, $function)
|
||||
{
|
||||
if ($this->debug)
|
||||
@@ -462,7 +479,9 @@ class route
|
||||
function is called.
|
||||
Ex. : $app->get('/hello/{name}', function ($name) {
|
||||
echo "Hello, $name";
|
||||
}); */
|
||||
});
|
||||
@param string $route Route to check with the URL
|
||||
@param function $function Function to be executed if the route match */
|
||||
public function put ($route, $function)
|
||||
{
|
||||
if ($this->debug)
|
||||
@@ -481,7 +500,9 @@ class route
|
||||
function is called.
|
||||
Ex. : $app->get('/hello/{name}', function ($name) {
|
||||
echo "Hello, $name";
|
||||
}); */
|
||||
});
|
||||
@param string $route Route to check with the URL
|
||||
@param function $function Function to be executed if the route match */
|
||||
public function delete ($route, $function)
|
||||
{
|
||||
if ($this->debug)
|
||||
@@ -497,7 +518,9 @@ class route
|
||||
}
|
||||
|
||||
/** Do the mapping between the url and the route : call the function if
|
||||
thereis a match */
|
||||
thereis a match
|
||||
@param string $route Route to check with the URL
|
||||
@param function $function Function to be executed if the route match */
|
||||
public function map ($route, $function)
|
||||
{
|
||||
$url = substr ($this->requestURL (), strlen ($this->baseURLmodule ()));
|
||||
|
||||
Reference in New Issue
Block a user