Overview

Namespaces

  • LightnCandy

Classes

  • Compiler
  • Context
  • Encoder
  • Exporter
  • Expression
  • Flags
  • LightnCandy
  • Parser
  • Partial
  • Runtime
  • SafeString
  • StringObject
  • Token
  • Validator
  • Overview
  • Namespace
  • Class

Class Encoder

LightnCandy class to encode.

Direct known subclasses

LightnCandy\Runtime, LightnCandy\SafeString
Namespace: LightnCandy
Located at Encoder.php
Methods summary
public static array<array|string|integer>|string|integer|null
# raw( array<string,array|string|integer> $cx, array<array|string|integer>|string|integer|null $v, integer $ex = 0 )

Get string value

Get string value

Parameters

$cx
render time context
$v
value to be output
$ex
1 to return untouched value, default is 0

Returns

array<array|string|integer>|string|integer|null
The raw value of the specified variable

Expect

true when input array('flags' => array('jstrue' => 0, 'mustlam' => 0, 'lambda' => 0)), true
'true' when input array('flags' => array('jstrue' => 1)), true
'' when input array('flags' => array('jstrue' => 0, 'mustlam' => 0, 'lambda' => 0)), false
'false' when input array('flags' => array('jstrue' => 1)), false
false when input array('flags' => array('jstrue' => 1)), false, true
'Array' when input array('flags' => array('jstrue' => 1, 'jsobj' => 0)), array('a', 'b')
'a,b' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a', 'b')
'[object Object]' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1)), array('a', 'c' => 'b')
'[object Object]' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1)), array('c' => 'b')
'a,true' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a', true)
'a,1' when input array('flags' => array('jstrue' => 0, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',true)
'a,' when input array('flags' => array('jstrue' => 0, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',false)
'a,false' when input array('flags' => array('jstrue' => 1, 'jsobj' => 1, 'mustlam' => 0, 'lambda' => 0)), array('a',false)
public static string
# enc( array<string,array|string|integer> $cx, array<array|string|integer>|string|integer|null $var )

Get html encoded string

Get html encoded string

Parameters

$cx
render time context
$var
value to be htmlencoded

Returns

string
The htmlencoded value of the specified variable

Expect

'a' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'
'a&b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a&b'
'a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a\'b'
public static string
# encq( array<string,array|string|integer> $cx, array<array|string|integer>|string|integer|null $var )

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

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

Parameters

$cx
render time context
$var
value to be htmlencoded

Returns

string
The htmlencoded value of the specified variable

Expect

'a' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a'
'a&b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a&b'
'a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), 'a\'b'
'`a'b' when input array('flags' => array('mustlam' => 0, 'lambda' => 0)), '`a\'b'
API documentation generated by ApiGen