[ Index ]

PHP Cross Reference of Akelos Framework

title

Body

[close]

/ -> AkRouter.php (summary)

Native PHP URL rewriting for the Akelos Framework.

Author: Bermi Ferrer
Copyright: Copyright (c) 2002-2006, Akelos Media, S.L. http://www.akelos.org
License: GNU Lesser General Public License
File Size: 751 lines (32 kb)
Included or required: 3 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

AkRouter:: (10 methods):
  __construct()
  getRoutes()
  toUrl()
  toParams()
  connect()
  map()
  _urlDecode()
  _urlEncode()
  _loadUrlRewriteSettings()
  AkRouter()


Class: AkRouter  - X-Ref

Native PHP URL rewriting for the Akelos Framework

This class implements PHP based URL rewriting for the Akelos Framework, thus shifting the responsibility of URL parsing from the webserver to the Akelos Framework itself. This has been a requested feature for two primary reasons.

- Not all webservers support rewriting. By moving this code to the core, the framework is able to function out of the box on almost all webservers.

- A rewriting implementation in the Akelos Framework can also be used to generate custom URLs by linking it to the standard URL helpers such as url_for, link_to, and redirect_to.

__construct()   X-Ref
No description

getRoutes()   X-Ref
$this->_loaded_routes getter

Use this method to get $this->_loaded_routes value

return: array Returns Loaded Routes array.

toUrl($params=array()   X-Ref
Generates a custom URL, depending on current rewrite rules.

Generates a custom URL, depending on current rewrite rules.

param: array    $params    An array with parameters to include in the url.
return: string Having the following rewrite rules:

toParams($url)   X-Ref
Gets the parameters from a Akelos Framework friendly URL.

This method returns the parameters found in an Akelos Framework friendly URL.

This function will inspect the rewrite rules and will return the params that match the first one.

param: string    $url    URL to get params from.
return: mixed Having the following rewrite rules:

connect($url_pattern, $options = array()   X-Ref
Add a rewrite rule

Rewrite rules are defined on the file <code>config/routes.php</code>

Rules that are defined first take precedence over the rest.

param: string    $url_pattern    URL patterns have the following format:
param: array    $options    Options is an array with and array pair of field=>value
param: array    $requirements    $requirements holds an array with and array pair of field=>value where value is a perl compatible regular expression that will be used to validate rewrite rules
return: void

map($url_pattern, $options = array()   X-Ref
Alias for map


_urlDecode($input)   X-Ref
Url decode a string or an array of strings


_urlEncode($input)   X-Ref
Url encodes a string or an array of strings


_loadUrlRewriteSettings()   X-Ref
This method tries to determine if url rewrite is enabled on this server.
It has only been tested on apache.
It is strongly recomended that you manually define the constant
AK_URL_REWRITE_ENABLED on your config file to the avoid overload
this function causes and to prevent from missfunctioning


AkRouter()   X-Ref
No description



Generated: Mon Oct 27 12:43:49 2008 Cross-referenced by PHPXref 0.6