nyroFwk  0.2
Static Public Member Functions | Static Protected 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 Member Functions

static jsEncodeSearchFunc (array &$vars, &$startFunc=1)
 

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

◆ cutArray()

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

Split an array with

Parameters
array$arrArray to split
int$nbCount element for the first part
bool$presKeyTrue 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.

◆ formatDate()

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

Format a date, using helper_date

Parameters
int | string$dateInt to directly set a timestamp or strong for a date to format (compatible with strtotime)
string | true$typeFormat needed or true if you want to use formatDirect
string$lenFormat length needed or date format if using formatDirect
Returns
string The date formatted
See also
helper_date::format

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

◆ getIcon()

static getIcon ( array  $prm)
static

Get an icon

Parameters
array$prmIcon 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.

◆ getModuleName()

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.

◆ getValInArray()

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

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

Parameters
array$sourceThe array source
array$keysThe path in the $source array, numercally indexed
Returns
mixed

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

◆ html2Text()

static html2Text (   $html)
static

Transform HTML to text, using html2text library

Parameters
string$htmlThe HTML string to transform
Returns
string

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

◆ htmlAttribute()

static htmlAttribute ( array  $prm)
static

Create a string for HTML attribute

Parameters
array$prmArray for create the attribue
Returns
string

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

◆ htmlChars()

static htmlChars ( )
static

Get the HTML translation table

Returns
array

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

◆ htmlDeOut()

static htmlDeOut (   $val,
  $key = false 
)
static

Opposite of htmlOut

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

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

◆ htmlIn()

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.

◆ htmlObfuscate()

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.

◆ htmlOut()

static htmlOut (   $val,
  $key = false 
)
static

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

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

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

◆ htmlTag()

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

Create a HTML tag

Parameters
string$tagTag name
array$attributesattributes for the tag used by htmlAttribute
null | string$contentEventual tag content
Returns
string

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

◆ img()

static img (   $prm,
  $absolute = false 
)
static

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

Parameters
string | array$prmSrc string or array of attribute for the img tag
Returns
string The HTML img tag

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

◆ initTabNumPair()

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

Transform a numeric pair array to a string key array

Parameters
array$varsVariable array to transfer
string$finalNameName for the last key, if needed

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

◆ isContained()

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 478 of file utils.class.php.

◆ jsEncode()

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 414 of file utils.class.php.

◆ jsEncodeSearchFunc()

static jsEncodeSearchFunc ( array &  $vars,
$startFunc = 1 
)
staticprotected

Internal function used from jsEndcode to deeply search for function

Parameters
array$vars
int$startFunc
Returns
array

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

◆ mailTo()

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

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

Parameters
string$emailThe email
string | null$nameThe name to show as text. If null, $email will be used
array$attributesAttributes to add to the html tag
Returns
string

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

◆ randomStr()

static randomStr (   $len = 10,
  $ignore = null 
)
static

Create a random string

Parameters
int$lenLength of the returned string
null | string$ignoreCharacter to exclude from the random string
Returns
string

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

◆ render()

static render ( array  $prm)
static

Render a tpl element

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

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

◆ urlify()

static urlify (   $text,
  $ignore = null 
)
static

Clean a string to be used in an URL

Parameters
string$text
string$ignoreIgnore charater list
Returns
string

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

Field Documentation

◆ $date

$date
staticprotected

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

◆ $htmlChars

$htmlChars = null
staticprivate

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


The documentation for this class was generated from the following file:
Generated on Sun Oct 15 2017 22:25:21 for nyroFwk by doxygen 1.8.13