Overview

Namespaces

  • LightnCandy

Classes

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

Class SafeString

LightnCandy SafeString class

LightnCandy\Encoder
Extended by LightnCandy\SafeString
Namespace: LightnCandy
Located at SafeString.php
Methods summary
public
# __construct( string $str, boolean|string $escape = false )

Constructor

Constructor

Parameters

$str
input string
$escape
false to not escape, true to escape, 'encq' to escape as handlebars.js
public
# __toString( )
public static string
# stripExtendedComments( string $template )

Strip extended comments {{!-- .... --}}

Strip extended comments {{!-- .... --}}

Parameters

$template
handlebars template string

Returns

string
Stripped template

Expect

'abc' when input 'abc'
'abc{{!}}cde' when input 'abc{{!}}cde'
'abc{{! }}cde' when input 'abc{{!----}}cde'
public static string
# escapeTemplate( string $template )

Escape template

Escape template

Parameters

$template
handlebars template string

Returns

string
Escaped template

Expect

'abc' when input 'abc'
'a\\bc' when input 'a\bc'
'a\\'bc' when input 'a\'bc'
Methods inherited from LightnCandy\Encoder
enc(), encq(), raw()
Constants summary
string EXTENDED_COMMENT_SEARCH
# '/{{!--.*?--}}/s'
string IS_SUBEXP_SEARCH
# '/^\(.+\)$/s'
string IS_BLOCKPARAM_SEARCH
# '/^ +\|(.+)\|$/s'
Properties summary
public static array $jsContext
# array( 'flags' => array( 'jstrue' => 1, 'jsobj' => 1, ) )
API documentation generated by ApiGen