# Class FrontController

The front controller designed to optionally handle all requests

Package: alpha::controller::front
Copyright: Copyright (c) 2013, John Collins (founder of Alpha Framework). All rights reserved.

    Redistribution and use in source and binary forms, with or
    without modification, are permitted provided that the
    following conditions are met:

    * Redistributions of source code must retain the above
      copyright notice, this list of conditions and the
      following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the
      following disclaimer in the documentation and/or other
      materials provided with the distribution.
    * Neither the name of the Alpha Framework nor the names
      of its contributors may be used to endorse or promote
      products derived from this software without specific
      prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
    OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: FrontController.inc 1693 2013-12-09 23:33:24Z alphadevx $
Since: 1.0
Located at controller/front/FrontController.inc

Methods summary
`public` | # `__construct( )` The constructor method The constructor method #### Throws ``ResourceNotFoundException`` ``BadRequestException`` #### Since 1.0
`public` | # `setEncrypt( boolean $encryptedQuery )` Sets the encryption flag Sets the encryption flag #### Parameters $encryptedQuery `boolean` $encryptedQuery #### Since 1.0
`private` | # `populateGetVars( )` Method to populate the global _GET and _REQUEST arrays with the decoded query string Method to populate the global _GET and _REQUEST arrays with the decoded query string #### Since 1.0
`public static string` | # `generateSecureURL( string $params )` Static method for generating an absolute, secure URL for a page controller Static method for generating an absolute, secure URL for a page controller #### Parameters $params `string` $params #### Returns `string` #### Since 1.0
`public static string` | # `encodeQuery( string $queryString )` Static method for encoding a query string Static method for encoding a query string #### Parameters $queryString `string` $queryString #### Returns `string` #### Since 1.0
`private` | # `decodeQuery( )` Method to decode the current query string Method to decode the current query string #### Throws ``SecurityException`` #### Since 1.0
`public static string` | # `decodeQueryParams( mixed $tk )` Static method to return the decoded GET paramters from an encrytpted tk value Static method to return the decoded GET paramters from an encrytpted tk value #### Returns `string` #### Since 1.0
`public static array` | # `getDecodeQueryParams( mixed $tk )` Static method to return the decoded GET paramters from an encrytpted tk value as an array of key/value pairs. Static method to return the decoded GET paramters from an encrytpted tk value as an array of key/value pairs. #### Returns `array` #### Since 1.0
`public` | # `loadController( boolean $allowRedirects = true )` Method to load the page controller Method to load the page controller #### Parameters $allowRedirects `boolean` $allowRedirects Defaults to true, set to false if you want to prevent the front controller from redirecting the request #### Throws ``ResourceNotFoundException`` #### Since 1.0
`public` | # `registerAlias( string $controller, string $alias, string $param = null )` Used to register a controller alias to enable shorter URLs with mod_rewrite support enabled. Note that only controllers with a single parameter are supported. Used to register a controller alias to enable shorter URLs with mod_rewrite support enabled. Note that only controllers with a single parameter are supported. #### Parameters $controller `string` $controller The name of the page controller class $alias `string` $alias The URL alias for the page controller $param `string` $param The name of the GET parameter on the alias URL request #### Since 1.0
`public boolean` | # `checkAlias( string $alias )` Check to see if an alias exists for the given alias name Check to see if an alias exists for the given alias name #### Parameters $alias `string` $alias #### Returns `boolean` #### Since 1.0
`public boolean` | # `hasAlias( string $controller )` Check to see if an alias exists for the given controller name Check to see if an alias exists for the given controller name #### Parameters $controller `string` $controller #### Returns `boolean` #### Since 1.0
`public string` | # `getAliasController( string $alias )` Gets the full name of the controller for the given alias Gets the full name of the controller for the given alias #### Parameters $alias `string` $alias #### Returns `string` #### Since 1.0
`public string` | # `getControllerAlias( string $controller )` Gets the name of the alias for the given controller Gets the name of the alias for the given controller #### Parameters $controller `string` $controller #### Returns `string` #### Since 1.0
`public string` | # `getAliasParam( string $alias )` Gets the parameter name expected in requests to the controller with the given alias Gets the parameter name expected in requests to the controller with the given alias #### Parameters $alias `string` $alias #### Returns `string` #### Since 1.0
`public string` | # `getControllerParam( string $controller )` Gets the parameter name expected in requests to the controller with the given controller name Gets the parameter name expected in requests to the controller with the given controller name #### Parameters $controller `string` $controller #### Returns `string` #### Since 1.0
`private static array` | # `multipleExplode( string $string, array $delimiters = array() )` Explodes the provided string into an array based on the array of delimiters provided Explodes the provided string into an array based on the array of delimiters provided #### Parameters $string `string` $string The string to explode. $delimiters `array` $delimiters An array of delimiters. #### Returns `array` #### Since 1.2
`private` | # `handleModRewriteRequests( )` Handles all of the rules for mod_rewrite style URL parsing Handles all of the rules for mod_rewrite style URL parsing #### Since 1.0
`public string` | # `getPageController( )` Getter for the page controller Getter for the page controller #### Returns `string` #### Since 1.0
`public` | # `registerFilter( `AlphaFilterInterface` $filterObject )` Add the supplied filter object to the list of filters ran on each request to the front controller Add the supplied filter object to the list of filters ran on each request to the front controller #### Parameters $filterObject ``AlphaFilterInterface`` $filterObject #### Throws ``IllegalArguementException`` #### Since 1.0
`public array` | # `getFilters( )` Returns the array of filters currently attached to this FrontController Returns the array of filters currently attached to this FrontController #### Returns `array` #### Since 1.0

Properties summary
`private string` | $queryString | `` | # The GET query string The GET query string #### Since 1.0
`private string` | $pageController | `` | # The name of the page controller we want to invoke The name of the page controller we want to invoke #### Since 1.0
`private boolean` | $encryptedQuery | `false` | # Boolean to flag if the GET query string is encrypted or not Boolean to flag if the GET query string is encrypted or not #### Since 1.0
`private array` | $controllerAlias | `array()` | # An array of controller alias An array of controller alias #### Since 1.0
`private array` | $filters | `array()` | # An array of HTTP filters applied to each request to the front controller. Each member must implement AlphaFilterInterface! An array of HTTP filters applied to each request to the front controller. Each member must implement AlphaFilterInterface! #### Since 1.0
`private string` | $currentAlias | `` | # The name of the current alias The name of the current alias #### Since 1.0
`private static `Logger`` | $logger | `null` | # Trace logger Trace logger #### Since 1.0