PHP Class Habari\RewriteRule

Helper class to encapsulate rewrite rule data
Inheritance: extends QueryRecord
ファイルを表示 Open project: habari/system

Public Properties

Property Type Description
$entire_match
$named_arg_values Entire matched string from the URL

Public Methods

Method Description
__construct ( array $paramarray = [] ) Constructor for the rewrite_rule class.
__get ( string $name ) : mixed Magic property getter for this class
arg_match ( array $args ) : integer Returns a distance from 0 indicating the appropriateness of the rule based on the passed-in arguments.
build ( array $args, boolean $useall = true, boolean $noamp = false ) : string Builds a URL using this rule based on the passed in data
create_url_rule ( string $build_str, string $handler, string $action ) : RewriteRule Create an old-style rewrite rule
default_fields ( ) : array Returns the defined database columns for a rewrite rule.
delete ( ) Deletes an existing rule
insert ( ) Saves a new rewrite rule to the rewrite_rules table
match ( string $stub ) : boolean Match the stub against this rule Also sets internal structures based on a successful match
update ( ) Updates an existing rule in the rewrite_rules table

Method Details

__construct() public method

Constructor for the rewrite_rule class.
public __construct ( array $paramarray = [] )
$paramarray array an associative array or querystring of initial field values

__get() public method

Magic property getter for this class
public __get ( string $name ) : mixed
$name string The name of the class property to return
return mixed The value of that field in this object

arg_match() public method

Returns a distance from 0 indicating the appropriateness of the rule based on the passed-in arguments.
public arg_match ( array $args ) : integer
$args array An array of arguments
return integer Returns 0 for an exact match, a higher number for less of a match

build() public method

Builds a URL using this rule based on the passed in data
public build ( array $args, boolean $useall = true, boolean $noamp = false ) : string
$args array An associative array of arguments to use for replacement in the rule
$useall boolean If true (default), then all passed parameters that are not part of the built URL are tacked onto the URL as querystring
$noamp boolean If true, use HTML-encoded ampersands in the output URL
return string The URL created from the substituted arguments

create_url_rule() public static method

Create an old-style rewrite rule
public static create_url_rule ( string $build_str, string $handler, string $action ) : RewriteRule
$build_str string
$handler string
$action string
return RewriteRule The created rule

default_fields() public static method

Returns the defined database columns for a rewrite rule.
public static default_fields ( ) : array
return array Array of columns in the rewrite_rules table

delete() public method

Deletes an existing rule
public delete ( )

insert() public method

Saves a new rewrite rule to the rewrite_rules table
public insert ( )

match() public method

Match the stub against this rule Also sets internal structures based on a successful match
public match ( string $stub ) : boolean
$stub string The URL stub to match against
return boolean True if this rule matches the stub, false if not

update() public method

Updates an existing rule in the rewrite_rules table
public update ( )

Property Details

$entire_match public_oe property

public $entire_match

$named_arg_values public_oe property

Entire matched string from the URL
public $named_arg_values