PHP Class Gdn_Dispatcher, vanilla

Inheritance: extends Gdn_Pluggable
ファイルを表示 Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$ControllerMethod method of the controller to be called.
$ControllerName The name of the controller to be dispatched.

Public Methods

Method Description
__construct ( AddonManager $addonManager = null ) Class constructor.
__get ( string $name ) : mixed Backwards compatible support for deprecated properties.
application ( )
cleanup ( )
controller ( )
controllerArguments ( $Value = null )
controllerMethod ( )
controllerName ( ) Return the properly formatted controller class name.
dispatch ( string | Gdn_Request | null $ImportRequest = null, boolean $Permanent = true ) Dispatch a request to a controller method.
enabledApplication ( $folder = '' ) Returns the name of the enabled application based on $ApplicationFolder.
enabledApplicationFolders ( string $EnabledApplications = '' )
passAsset ( string $AssetName, mixed $Asset ) Allows the passing of a string to the controller's asset collection.
passData ( $Name, $Value )
passProperty ( string $Name, mixed $Mixed ) Allows the passing of any variable to the controller as a property.
reset ( ) Reset the dispatchert to its default state.
start ( )

Private Methods

Method Description
analyzeRequest ( Gdn_Request $request ) Parses the query string looking for supplied request parameters.
createController ( string $controllerName, Gdn_Request $request, &$routeArgs ) : Gdn_Controller Create a controller and initialize it with data from the dispatcher.
dispatchController ( Gdn_Request $request, array $routeArgs ) Dispatch to a controller that's already been found with {@link Gdn_Dispatcher::analyzeRequest()}.
dispatchNotFound ( $reason = 'notfound', $request = null ) * Dispatch a 404 with an event that can be handled.
findController ( array $parts ) : array Find the controller object corresponding to a request path.
findControllerMethod ( Gdn_Controller $controller, string[] $pathArgs ) : array Find the method to call on a controller, based on a path.
getCanBlock ( Gdn_Request $request ) : integer Figure out what kind of blocks are allowed for dispatches.
getEnabledApplicationFolders ( ) : array Get the enabled application folders.
methodExists ( string | Gdn_Controller $object, string $method ) : boolean Check to see if a controller has a method.
parseDeliveryMethod ( string[] $parts ) : array Parse the delivery method base on the file extension.
requestVal ( string $key, array $get, array $post, mixed $default = null ) : mixed A helper function to search through the get/post for a key.
rewriteRequest ( Gdn_Request $request ) Rewrite the request based on rewrite rules (currently called routes in Vanilla).

Method Details

__construct() public method

Class constructor.
public __construct ( AddonManager $addonManager = null )
$addonManager Vanilla\AddonManager

__get() public method

Backwards compatible support for deprecated properties.
public __get ( string $name ) : mixed
$name string The name of the property to get.
return mixed Returns the property value.

application() public method

public application ( )

cleanup() public method

public cleanup ( )

controller() public method

public controller ( )

controllerArguments() public method

public controllerArguments ( $Value = null )

controllerMethod() public method

public controllerMethod ( )

controllerName() public method

Return the properly formatted controller class name.
public controllerName ( )

dispatch() public method

This method analyzes a request and figures out which controller and method it maps to. It also instantiates the controller and calls the method.
public dispatch ( string | Gdn_Request | null $ImportRequest = null, boolean $Permanent = true )
$ImportRequest string | Gdn_Request | null The request to dispatch. This can be a string URL or a Gdn_Request object,
$Permanent boolean Whether or not to set {@link Gdn::request()} with the dispatched request.

enabledApplication() public method

Returns the name of the enabled application based on $ApplicationFolder.
public enabledApplication ( $folder = '' )

enabledApplicationFolders() public method

Deprecation:
public enabledApplicationFolders ( string $EnabledApplications = '' )
$EnabledApplications string

passAsset() public method

Allows the passing of a string to the controller's asset collection.
public passAsset ( string $AssetName, mixed $Asset )
$AssetName string The name of the asset collection to add the string to.
$Asset mixed The string asset to be added. The asset can be one of two things. - string: The string will be rendered to the page. - Gdn_IModule: The Gdn_IModule::Render() method will be called when the asset is rendered.

passData() public method

public passData ( $Name, $Value )
$Name
$Value

passProperty() public method

Allows the passing of any variable to the controller as a property.
public passProperty ( string $Name, mixed $Mixed )
$Name string The name of the property to assign the variable to.
$Mixed mixed The variable to be passed as a property of the controller.

reset() public method

Reset the dispatchert to its default state.
public reset ( )

start() public method

public start ( )

Property Details

$ControllerMethod public_oe property

method of the controller to be called.
public $ControllerMethod

$ControllerName public_oe property

The name of the controller to be dispatched.
public $ControllerName