Static Public Member Functions | Static Protected Attributes | Static Private Attributes

utils Class Reference

Static Public Member Functions

static cutArray (array $arr, $nb, $presKey=true)
static html2Text ($html)
static htmlTag ($tag, array $attributes, $content=null)
static mailTo ($email, $name=null, array $attributes=array())
static htmlObfuscate ($text)
static htmlAttribute (array $prm)
static htmlOut ($val, $key=false)
static htmlDeOut ($val, $key=false)
static htmlChars ()
static htmlIn ($val)
static getModuleName ($className)
static initTabNumPair (array &$vars, $finalName= 'final')
static getIcon (array $prm)
static formatDate ($date, $type= 'date', $len= 'short2', $htmlOut=true)
static img ($prm, $absolute=false)
static render (array $prm)
static getValInArray (array $source, array $keys)
static urlify ($text, $ignore=null)
static jsEncode ($vars)
static randomStr ($len=10, $ignore=null)
static isContained (array $url, array $checks)

Static Protected Attributes

static $date

Static Private Attributes

static $htmlChars = null

Detailed Description

functions utils

Definition at line 10 of file utils.class.php.


Member Function Documentation

static cutArray ( array $  arr,
nb,
presKey = true 
) [static]

Split an array with

Parameters:
array $arr Array to split
int $nb Count element for the first part
bool $presKey True if the key must be preserved
Returns:
array First element will be the first splitted part, Second the rest

Definition at line 20 of file utils.class.php.

static formatDate ( date,
type = 'date',
len = 'short2',
htmlOut = true 
) [static]

Format a date, using helper_date

Parameters:
int|string $date Int to directly set a timestamp or strong for a date to format (compatible with strtotime)
string $type Format needed
string $len Format length needed
Returns:
string The date formatted
See also:
helper_date::format

Definition at line 298 of file utils.class.php.

static getIcon ( array $  prm  )  [static]

Get an icon

Parameters:
array $prm Icon configuration. Available key:

  • string name: action name (required)
  • string type: icon type
  • bool imgTag: true if the return should be a valid html img tag. if false, will return he url
  • string alt: alt text for the image, used only if imgTag = true
  • array attr: attributes added to the img tag
Returns:
unknown

Definition at line 250 of file utils.class.php.

static getModuleName ( className  )  [static]

Get the module name from the class name

Parameters:
string $className
Returns:
string

Definition at line 214 of file utils.class.php.

static getValInArray ( array $  source,
array $  keys 
) [static]

Get a value in an array, by specifing the path to it

Parameters:
array $source The array source
array $keys The path in the $source array, numercally indexed
Returns:
mixed

Definition at line 358 of file utils.class.php.

static html2Text ( html  )  [static]

Transform HTML to text, using html2text library

Parameters:
string $html The HTML string to transform
Returns:
string

Definition at line 33 of file utils.class.php.

static htmlAttribute ( array $  prm  )  [static]

Create a string for HTML attribute

Parameters:
array $prm Array for create the attribue
Returns:
string

Definition at line 90 of file utils.class.php.

static htmlChars (  )  [static]

Get the HTML translation table

Returns:
array

Definition at line 158 of file utils.class.php.

static htmlDeOut ( val,
key = false 
) [static]

Opposite of htmlOut

Parameters:
array|string $val
bool $key In case of an array, indicate if the keys should also be processed
Returns:
array|string

Definition at line 128 of file utils.class.php.

static htmlIn ( val  )  [static]

Used to retrieve the data from the request

Parameters:
array|string $val
Returns:
array|string

Definition at line 199 of file utils.class.php.

static htmlObfuscate ( text  )  [static]

Create the HTML string to obfuscate a text (usually an email)

Parameters:
string $text
Returns:
string

Definition at line 77 of file utils.class.php.

static htmlOut ( val,
key = false 
) [static]

Convert html entities. If array provided, all the data will be converted

Parameters:
array|string $val
bool $key In case of an array, indicate if the keys should also be processed
Returns:
array|string

Definition at line 105 of file utils.class.php.

static htmlTag ( tag,
array $  attributes,
content = null 
) [static]

Create a HTML tag

Parameters:
string $tag Tag name
array $attributes attributes for the tag used by htmlAttribute
null|string $content Eventual tag content
Returns:
string

Definition at line 46 of file utils.class.php.

static img ( prm,
absolute = false 
) [static]

Create the image tag for an image (in the img directory)

Parameters:
string|array $prm Src string or array of attribute for the img tag
Returns:
string The HTML img tag

Definition at line 319 of file utils.class.php.

static initTabNumPair ( array &$  vars,
finalName = 'final' 
) [static]

Transform a numeric pair array to a string key array

Parameters:
array $vars Variable array to transfer
string $finalName Name for the last key, if needed

Definition at line 227 of file utils.class.php.

static isContained ( array $  url,
array $  checks 
) [static]

Indicate if a configuration array is contained in the url

Parameters:
array $url
array $checks
Returns:
bool True if a line in $checks matches the $url

Definition at line 454 of file utils.class.php.

static jsEncode ( vars  )  [static]

Encodes an array to be used as a Json object. Keeps functions declaration

Parameters:
array $vars
Returns:
string

Definition at line 405 of file utils.class.php.

static mailTo ( email,
name = null,
array $  attributes = array() 
) [static]

Create a mailto HTML tag to send an email, with obfuscating

Parameters:
string $email The email
string|null $name The name to show as text. If null, $email will be used
array $attributes Attributes to add to the html tag
Returns:
string

Definition at line 63 of file utils.class.php.

static randomStr ( len = 10,
ignore = null 
) [static]

Create a random string

Parameters:
int $len Length of the returned string
null|string $ignore Character to exclude from the random string
Returns:
string

Definition at line 431 of file utils.class.php.

static render ( array $  prm  )  [static]

Render a tpl element

Parameters:
array $prm Array configuration, with at least the module and action keys
Returns:
string The rendered element

Definition at line 347 of file utils.class.php.

static urlify ( text,
ignore = null 
) [static]

Clean a string to be used in an URL

Parameters:
string $text
string $ignore Ignore charater list
Returns:
string

Definition at line 376 of file utils.class.php.


Field Documentation

$date [static, protected]

Definition at line 287 of file utils.class.php.

$htmlChars = null [static, private]

Definition at line 151 of file utils.class.php.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Enumerations
Generated on Tue May 8 2012 16:02:25 for nyroFwk by doxygen 1.7.1