Utility functions for use in templates and controllers
Located in /Routes/lib/Horde/Routes/Utils.php (line 20)
Match data from last match; implements for urlFor() route memory
Callback function used for redirectTo()
Scan a directory for PHP files and use them as controllers. Used as the default scanner callback for Horde_Routes_Mapper. See the constructor of that class for more information.
Given a directory with: foo.php, bar.php, baz.php Returns an array: foo, bar, baz
Callback used by usort() in controllerScan() to sort controller names by the longest first.
Quote a string containing a URL in a given encoding.
Constructor
Issues a redirect based on the arguments.
Redirects *should* occur as a "302 Moved" header, however the web framework may utilize a different method.
All arguments are passed to urlFor() to retrieve the appropriate URL, then the resulting URL it sent to the redirect function as the URL.
Generates a URL.
All keys given to urlFor are sent to the Routes Mapper instance for generation except for::
anchor specified the anchor name to be appened to the path host overrides the default (current) host if provided protocol overrides the default (current) protocol if provided qualified creates the URL with the host/port information as needed
The URL is generated based on the rest of the keys. When generating a new URL, values will be used from the current request's parameters (if present). The following rules are used to determine when and how to keep the current requests parameters:
* If the controller is present and begins with '/', no defaults are used * If the controller is changed, action is set to 'index' unless otherwise specified
For example, if the current request yielded a dict (associative array) of array('controller'=>'blog', 'action'=>'view', 'id'=>2), with the standard ':controller/:action/:id' route, you'd get the following results::
urlFor(array('id'=>4)) => '/blog/view/4', urlFor(array('controller'=>'/admin')) => '/admin', urlFor(array('controller'=>'admin')) => '/admin/view/2' urlFor(array('action'=>'edit')) => '/blog/edit/2', urlFor(array('action'=>'list', id=NULL)) => '/blog/list'
**Static and Named Routes**
If there is a string present as the first argument, a lookup is done against the named routes table to see if there's any matching routes. The keyword defaults used with static routes will be sent in as GET query arg's if a route matches.
If no route by that name is found, the string is assumed to be a raw URL. Should the raw URL begin with ``/`` then appropriate SCRIPT_NAME data will be added if present, otherwise the string will be used as the url with keyword args becoming GET query args.
Documentation generated on Sun, 30 Jan 2011 05:23:06 +0000 by phpDocumentor 1.4.3