PHP Класс PHPFusion\Rewrite\RewriteDriver

Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$alias_pattern Array of Pattern for Aliases which are made for matching.
$aliases
$buffer_search_regex
$handlers Array of Handlers example: news, threads, articles
$instance
$output The site render HTML buffer which is to be scanned
$path_search_regex
$pattern_replace Target URLs to which permalink request will be rewrited.
$pattern_search Permalink Patterns which will be searched to match against current request.
$pattern_tables Array of DB Table Names with Schema example: prefix_news, prefix_threads, prefix_articles
$patterns_regex Array of Regular Expressions Patterns which are made for matching.
$queries Array of Total Queries which were run.
$regex_statements array Statements are calculation results of Rewrite scan We will have various types of regex statements This is the results data of the entire permalink success/fails
$requesturi Portion of the URL to match in the Regex
$rewrite_code example: %thread_id%, %news_id%
$rewrite_replace example: %thread_id% should be replaced with ([0-9]+)
$warnings Array of Warnings

Открытые методы

Метод Описание
getInstance ( ) : static Get the instance of the class

Защищенные методы

Метод Описание
HTML_In ( $output ) Entrance to Permalink from PHP Buffer This function prepares HTML codes to be preg_matched against Permalink Driver Decode everything
HTML_Out ( $output ) Exit from Permalink to PHP Buffer This function prepares HTML codes to be viewed by browser
addRegexTag ( array $regex, string $driver ) Adds the Regular Expression Tags
appendSearchPath ( string $str ) : string Append the BASEDIR Path to Search String
cleanRegex ( string $regex ) : string Clean the REGEX by escaping some characters
cleanString ( $mystr = "" ) Clean the URI String for MATCH/AGAINST in MySQL
cleanURL ( string $string, $delimiter = "-" ) : string Cleans the URL
getTagPosition ( string $pattern, string $search ) Calculates the Tag Position in a given pattern.
getUniqueIDtag ( string $type ) Get the Tag of the Unique ID type
handle_non_seo_url ( ) Validate_url
handle_permalink_requests ( ) Builds the Regular Expressions Patterns for Permalink Translations
includeHandlers ( ) Include the Handlers
includeRewrite ( ) Include the rewrite include file
loadSQLDrivers ( ) Import Handlers from Database
makeSearchRegex ( $pattern, string $type ) Adds the Regular Expression Tags -- for permalink search regex
normalize ( $string ) : string Replaces special characters in a string with their "non-special" counterpart.
prepare_searchRegex ( )
redirect_301 ( string $target, $debug = FALSE ) Redirect 301 : Moved Permanently Redirect This function invoked to prevent of caching any kinds of Non SEO URL on render.
replaceOtherTags ( string $type, string $search, string $replace, array $matches, string $matchkey ) : string Replace Other Tags in Pattern
setWarning ( integer $code, string $info = "" ) Set Warnings
verifyHandlers ( ) Verify Handlers
wrapDoubleQuotes ( $str ) : string Add compatibalities with double quotes HTML codes for Permalink
wrapQuotes ( string $str ) : string Wrap a String with Single Quotes (') This function will wrap a string passed with Single Quotes.

Приватные методы

Метод Описание
AddRewrite ( string $include_prefix ) Add the rewrite include file to be included

Описание методов

HTML_In() защищенный Метод

Entrance to Permalink from PHP Buffer This function prepares HTML codes to be preg_matched against Permalink Driver Decode everything
protected HTML_In ( $output )

HTML_Out() защищенный Метод

Exit from Permalink to PHP Buffer This function prepares HTML codes to be viewed by browser
protected HTML_Out ( $output )
$output

addRegexTag() защищенный Метод

This will Add Regex Tags, which will be replaced in the search patterns. Example: %news_id% could be replaced with ([0-9]+) as it must be a number.
protected addRegexTag ( array $regex, string $driver )
$regex array Array of Tags to be added.
$driver string Type or Handler name

appendSearchPath() защищенный Метод

This function will append the BASEDIR path to the Search pattern. This is required in some cases like when we are on actual php script page and Permalinks are ON.
protected appendSearchPath ( string $str ) : string
$str string The String
Результат string

cleanRegex() защищенный статический Метод

This function will escape some characters in the Regex expression
protected static cleanRegex ( string $regex ) : string
$regex string The expression String
Результат string

cleanString() защищенный Метод

This function will Clean the string and removes any unwanted characters from it.
protected cleanString ( $mystr = "" )

cleanURL() защищенный статический Метод

This function will clean the URL by removing any unwanted characters from it and only allowing alphanumeric and - in the URL. This function can be customized according to your needs.
protected static cleanURL ( string $string, $delimiter = "-" ) : string
$string string The URL String
Результат string

getInstance() публичный статический Метод

Get the instance of the class
public static getInstance ( ) : static
Результат static

getTagPosition() защищенный Метод

This function will calculate the position of a given Tag in a given pattern. Example: %id% is at 2 position in articles-%title%-%id%
protected getTagPosition ( string $pattern, string $search )
$pattern string The Pattern string in which particular Tag will be searched.
$search string The Tag which will be searched.

getUniqueIDtag() защищенный Метод

Example: For news, unique ID should be news_id So it will return %news_id% because of array("%%news_id" => "news_id")
protected getUniqueIDtag ( string $type )
$type string Type or Handler name

handle_non_seo_url() защищенный Метод

If Page is Not SEO, Redirect to SEO one
protected handle_non_seo_url ( )

includeHandlers() защищенный Метод

This function will include the neccessary files for the Handler and call the functions to manipulate the information from the Handler files.
protected includeHandlers ( )

includeRewrite() защищенный Метод

The include file will be included from INCLUDES."rewrites/".PREFIX."_rewrite_include.php
protected includeRewrite ( )

loadSQLDrivers() защищенный Метод

This will import all the Enabled Handlers from the Database Table
protected loadSQLDrivers ( )

makeSearchRegex() защищенный Метод

This will Add Regex Tags, which will be replaced in the search patterns. Example: %news_id% could be replaced with ([0-9]+) as it must be a number.
protected makeSearchRegex ( $pattern, string $type )
$type string Type or Handler name

normalize() защищенный статический Метод

Useful for friendly URLs.
protected static normalize ( $string ) : string
Результат string

prepare_searchRegex() защищенный Метод

protected prepare_searchRegex ( )

redirect_301() защищенный статический Метод

Let search engine mark as 301 permanently
protected static redirect_301 ( string $target, $debug = FALSE )
$target string The Target URL

replaceOtherTags() защищенный Метод

This function will replace all the Tags in the Pattern with their suitable found matches. All the Information is passed to the function and it will replace the Tags with their respective matches.
protected replaceOtherTags ( string $type, string $search, string $replace, array $matches, string $matchkey ) : string
$type string Type of Pattern
$search string specific Search Pattern
$replace string specific Replace Pattern
$matches array Array of the Matches found for a specific pattern
$matchkey string A Unique matchkey for different matches found for same pattern
Результат string

setWarning() защищенный Метод

This function will set Warnings. It will set them by Adding them into the $this->warnings array.
protected setWarning ( integer $code, string $info = "" )
$code integer The Code Number of the Warning
$info string Any other Info to Show along with Warning

verifyHandlers() защищенный Метод

This will verify all the added Handlers by checking if they are enabled or not. The Disabled Handlers are removed from the List and only Enabled Handlers are kept for working.
protected verifyHandlers ( )

wrapDoubleQuotes() защищенный статический Метод

Add compatibalities with double quotes HTML codes for Permalink
protected static wrapDoubleQuotes ( $str ) : string
$str
Результат string

wrapQuotes() защищенный статический Метод

Example: mystring will become 'mystring'
protected static wrapQuotes ( string $str ) : string
$str string The String
Результат string

Описание свойств

$alias_pattern защищенное свойство

Array of Pattern for Aliases which are made for matching.
protected $alias_pattern

$aliases защищенное свойство

protected $aliases

$buffer_search_regex защищенное свойство

protected $buffer_search_regex

$handlers защищенное свойство

Array of Handlers example: news, threads, articles
protected $handlers

$instance защищенное статическое свойство

protected static $instance

$output защищенное свойство

The site render HTML buffer which is to be scanned
protected $output

$path_search_regex защищенное свойство

protected $path_search_regex

$pattern_replace защищенное свойство

Target URLs to which permalink request will be rewrited.
protected $pattern_replace

$pattern_tables защищенное свойство

Array of DB Table Names with Schema example: prefix_news, prefix_threads, prefix_articles
protected $pattern_tables

$patterns_regex защищенное свойство

Array of Regular Expressions Patterns which are made for matching.
protected $patterns_regex

$queries защищенное свойство

Array of Total Queries which were run.
protected $queries

$regex_statements защищенное свойство

Statements are calculation results of Rewrite scan We will have various types of regex statements This is the results data of the entire permalink success/fails
protected array $regex_statements
Результат array

$requesturi защищенное свойство

Portion of the URL to match in the Regex
protected $requesturi

$rewrite_code защищенное свойство

example: %thread_id%, %news_id%
protected $rewrite_code

$rewrite_replace защищенное свойство

example: %thread_id% should be replaced with ([0-9]+)
protected $rewrite_replace

$warnings защищенное свойство

Array of Warnings
protected $warnings