Documentation

Encoder
in package

LightnCandy class to encode.

Table of Contents

enc()  : string
Get html encoded string
encq()  : string
LightnCandy runtime method for {{var}} , and deal with single quote to same as handlebars.js .
raw()  : array<string|int, array|string|int>|string|int|null
Get string value

Methods

enc()

Get html encoded string

public static enc(array<string, array|string|int> $cx, array<string|int, array|string|int>|string|int|null $var) : string
Parameters
$cx : array<string, array|string|int>

render time context

$var : array<string|int, array|string|int>|string|int|null

value to be htmlencoded

Tags
expect

'a' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'

expect

'a&b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a&b'

expect

'a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'b'

Return values
string

The htmlencoded value of the specified variable

encq()

LightnCandy runtime method for {{var}} , and deal with single quote to same as handlebars.js .

public static encq(array<string, array|string|int> $cx, array<string|int, array|string|int>|string|int|null $var) : string
Parameters
$cx : array<string, array|string|int>

render time context

$var : array<string|int, array|string|int>|string|int|null

value to be htmlencoded

Tags
expect

'a' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'

expect

'a&b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a&b'

expect

'a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'b'

expect

'`a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), '`a'b'

Return values
string

The htmlencoded value of the specified variable

raw()

Get string value

public static raw(array<string, array|string|int> $cx, array<string|int, array|string|int>|string|int|null $v, int $ex) : array<string|int, array|string|int>|string|int|null
Parameters
$cx : array<string, array|string|int>

render time context

$v : array<string|int, array|string|int>|string|int|null

value to be output

$ex : int

1 to return untouched value, default is 0

Tags
expect

true when input array('flags' => array('jstrue' => 0, 'mustlam' => 0, 'lambda' => 0)), true

expect

'true' when input array('flags' => array('jstrue' => 1)), true

expect

'' when input array('flags' => array('jstrue' => 0, 'mustlam' => 0, 'lambda' => 0)), false

expect

'false' when input array('flags' => array('jstrue' => 1)), false

expect

false when input array('flags' => array('jstrue' => 1)), false, true

expect

'Array' when input array('flags' => array('jstrue' => 1, 'jsobj' => 0)), array('a', 'b')

expect

'a,b' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a', 'b')

expect

'[object Object]' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1)), array('a', 'c' => 'b')

expect

'[object Object]' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1)), array('c' => 'b')

expect

'a,true' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a', true)

expect

'a,1' when input array('flags' => array('jstrue' => 0, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',true)

expect

'a,' when input array('flags' => array('jstrue' => 0, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',false)

expect

'a,false' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',false)

Return values
array<string|int, array|string|int>|string|int|null

The raw value of the specified variable

Search results