PHP Class Themosis\Route\Route

Inheritance: extends Illuminate\Routing\Route
Show file Open project: themosis/framework Class Usage Examples

Protected Properties

Property Type Description
$condition string The WordPress template condition.
$conditionalParameters array | void The additional parameters for the WordPress template conditions
$conditions array WordPress conditional tags.
$rewrite_tag_prefix string The prefix used to name the custom route tag.

Public Methods

Method Description
__construct ( array | string $methods, string $uri, mixed $action ) Build a Route instance.
addConditions ( array $conditions ) Allow developers to add route WordPress conditions.
condition ( ) : string Get the WordPress condition.
conditionalParameters ( ) : array Return the conditional parameters
createRewriteRule ( ) Create a WordPress rewrite rule for the route if the route is not using a WordPress conditional tag.
getRewriteRuleRegex ( ) : mixed | string Returns the regex to be registered as a rewrite rule to let WordPress know the existence of this route
getWpValidators ( ) : array Get matching validators.
matches ( Illuminate\Http\Request $request, boolean $includingMethod = true ) : boolean Determine if the route matches given request.
parameters ( ) : array Get the key / value list of parameters for the route.

Protected Methods

Method Description
getConditions ( ) : array Retrieve the list of registered WordPress conditions.
parseCondition ( string $uri ) : string Return the real WordPress conditional tag.
parseConditionalParameters ( array $action ) : array Parses the conditional parameter out of the action parameter. This is the parameter given to WordPress conditional functions later.

Method Details

__construct() public method

Build a Route instance.
public __construct ( array | string $methods, string $uri, mixed $action )
$methods array | string
$uri string
$action mixed

addConditions() public method

Allow developers to add route WordPress conditions.
public addConditions ( array $conditions )
$conditions array

condition() public method

Get the WordPress condition.
public condition ( ) : string
return string

conditionalParameters() public method

Return the conditional parameters
public conditionalParameters ( ) : array
return array

createRewriteRule() public method

By registering a rewrite rule using the route's regex we force WordPress not to change the url to one Wordpress knows.
public createRewriteRule ( )

getConditions() protected method

Retrieve the list of registered WordPress conditions.
protected getConditions ( ) : array
return array

getRewriteRuleRegex() public method

Returns the regex to be registered as a rewrite rule to let WordPress know the existence of this route
public getRewriteRuleRegex ( ) : mixed | string
return mixed | string

getWpValidators() public method

Get matching validators.
public getWpValidators ( ) : array
return array

matches() public method

Determine if the route matches given request.
public matches ( Illuminate\Http\Request $request, boolean $includingMethod = true ) : boolean
$request Illuminate\Http\Request
$includingMethod boolean
return boolean

parameters() public method

Get the key / value list of parameters for the route.
public parameters ( ) : array
return array

parseCondition() protected method

Return the real WordPress conditional tag.
protected parseCondition ( string $uri ) : string
$uri string
return string

parseConditionalParameters() protected method

Parses the conditional parameter out of the action parameter. This is the parameter given to WordPress conditional functions later.
protected parseConditionalParameters ( array $action ) : array
$action array The action parameter where the conditional parameters are in
return array An array with the conditional parameters or null

Property Details

$condition protected property

The WordPress template condition.
protected string $condition
return string

$conditionalParameters protected property

The additional parameters for the WordPress template conditions
protected array|void $conditionalParameters
return array | void

$conditions protected property

WordPress conditional tags.
protected array $conditions
return array

$rewrite_tag_prefix protected property

The prefix used to name the custom route tag.
protected string $rewrite_tag_prefix
return string