Orion PHP  0.11.12
The PHP5.3 framework
Orion\Core\Tools Class Reference

List of all members.

Static Public Member Functions

static callClassMethod (&$class, $method, $args=null)
static escapeRegex ($regex)
static escapeSql ($string)
static extractArrayKeysStartingWith ($array, $pattern)
static getFiles ($directory)
static match ($string, $pattern, $modifiers='')
static concatWithTrail ($trail, $array, $tolower=false)
static removeString ($needle, $string)
static startWith ($string, $start)
static translateRegex ($regex)

Static Private Attributes

static $_REGEX_ESCAPED = array( '\-', '\#', '\!', '\^', '\$', '\(', '\)', '\[', '\]', '\{', '\}', '\+', '\*', '\.', '\|' )
static $_REGEX_UNESCAPED = array( '-', '#', '!', '^', '$', '(', ')', '[', ']', '{', '}', '+', '*', '.', '|' )
static $_REGEX_WILDCARDS = array( '@', '?', '*' )
static $_REGEX_WSAVE = array( '::number::', '::word::', '::any::' )
static $_REGEX_WCREPLACE = array( '(\d+)', '([a-zA-Z0-9_-]+)', '(.*?)' )
static $_SQL_UNESCAPED = array( '%', '_' )
static $_SQL_ESCAPED = array( '\%', '\_' )

Detailed Description

Orion tools class.

Various function helpers used internally

Author:
Thibaut Despoulain BSD 4-clauses
Version:
0.11.12

Definition at line 19 of file tools.php.


Member Function Documentation

static Orion\Core\Tools::callClassMethod ( &$  class,
method,
args = null 
) [static]

Call a class method with $args as arguments. This is a more effective version of call_user_func_array() for 5 or less arguments.

If $args is of size 6 or more, call_user_func_array is called instead

Parameters:
mixed$classThe class instance
string$methodThe method name
array<mixed>$args An array of arguments

Definition at line 72 of file tools.php.

static Orion\Core\Tools::concatWithTrail ( trail,
array,
tolower = false 
) [static]

Concats an array with $trail after each item (Useful for path and file array to string)

Parameters:
string$trail
array$array
boolean$tolowerShould each item be lower case'd ?
Returns:
string

Definition at line 197 of file tools.php.

static Orion\Core\Tools::escapeRegex ( regex) [static]

Escape special regex chars. In fact, this function is only usefull with an easy-regex instance or in very particular cases.

Parameters:
string$regexRegex to escape (without starting and ending delimiters and special chars that must remain special chars)
Returns:
string Escaped regex

Definition at line 100 of file tools.php.

static Orion\Core\Tools::escapeSql ( string) [static]

Escapes sql wildcards (% and _) (prevents some SQL injection methods)

Parameters:
string$stringSQL string
Returns:
escaped string

Definition at line 110 of file tools.php.

static Orion\Core\Tools::extractArrayKeysStartingWith ( array,
pattern 
) [static]

Extract sub array from base array, keeping only keys starting with $pattern

Parameters:
array<string,mixed>$array
string$pattern
Returns:
array<key, mixed>

Definition at line 121 of file tools.php.

static Orion\Core\Tools::getFiles ( directory) [static]

Get an array of files contained in a directory (recursively)

Parameters:
string$directoryThe directory to scan recursively.
Returns:
string[] An array of file paths

Definition at line 139 of file tools.php.

static Orion\Core\Tools::match ( string,
pattern,
modifiers = '' 
) [static]

preg_match shortcut.

Parameters:
StringInput to test
StringRegex pattern without start/end tags (ex: "[a-zA-Z]+")
Returns:
TRUE if $string matches $pattern, FALSE otherwise.

Definition at line 185 of file tools.php.

static Orion\Core\Tools::removeString ( needle,
string 
) [static]

Removes one or more characters from a string.

Parameters:
String|String[]$needle
String$string
Returns:
String

Definition at line 216 of file tools.php.

static Orion\Core\Tools::startWith ( string,
start 
) [static]

Test if provided string starts with provided expression.

Parameters:
StringInput to test
StringStarting expression
Returns:
TRUE if $string starts with $start, FALSE otherwise.

Definition at line 229 of file tools.php.

static Orion\Core\Tools::translateRegex ( regex) [static]

Translates an Easy-regex into a valid PCRE regex.

Parameters:
string$regexPCRE or Easy-regex.
Returns:
string PCRE-valid regex

Definition at line 239 of file tools.php.


Member Data Documentation

Orion::Core\Tools::$_REGEX_ESCAPED = array( '\-', '\#', '\!', '\^', '\$', '\(', '\)', '\[', '\]', '\{', '\}', '\+', '\*', '\.', '\|' ) [static, private]

Definition at line 26 of file tools.php.

Orion::Core\Tools::$_REGEX_UNESCAPED = array( '-', '#', '!', '^', '$', '(', ')', '[', ']', '{', '}', '+', '*', '.', '|' ) [static, private]

Definition at line 32 of file tools.php.

Orion::Core\Tools::$_REGEX_WCREPLACE = array( '(\d+)', '([a-zA-Z0-9_-]+)', '(.*?)' ) [static, private]

Definition at line 50 of file tools.php.

Orion::Core\Tools::$_REGEX_WILDCARDS = array( '@', '?', '*' ) [static, private]

Definition at line 38 of file tools.php.

Orion::Core\Tools::$_REGEX_WSAVE = array( '::number::', '::word::', '::any::' ) [static, private]

Definition at line 44 of file tools.php.

Orion::Core\Tools::$_SQL_ESCAPED = array( '\%', '\_' ) [static, private]

Definition at line 62 of file tools.php.

Orion::Core\Tools::$_SQL_UNESCAPED = array( '%', '_' ) [static, private]

Definition at line 56 of file tools.php.


The documentation for this class was generated from the following file: