public
|
#
__construct( array $vars = [] )
Creates a fragment with the given variables.
Creates a fragment with the given variables.
Parameters
- $vars
- A array of key-value pairs to pass as local parameters
|
|
public
mixed
|
#
getVar( string $name, string $default = null )
Returns the value of the given variable $name.
Returns the value of the given variable $name.
Parameters
- $name
- Variable name
- $default
- Default value
Returns
mixed mixed
|
|
public
mixed
|
#
setVar( string $name, mixed $value, boolean $escape = true )
Set the variable $name to the given value.
Set the variable $name to the given value.
Parameters
- $name
- The name of the variable
- $value
- The value for the variable
- $escape
- Flag which indicates if the value should be escaped or not
Returns
mixed $this
Throws
InvalidArgumentException InvalidArgumentException
|
|
public
string
|
#
parse( string $filename )
Parses the variables of the fragment into the file $filename.
Parses the variables of the fragment into the file $filename.
Parameters
- $filename
- the filename of the fragment to parse
Returns
string string
Throws
InvalidArgumentException InvalidArgumentException
rex_exception
rex_exception
|
|
public
mixed
|
#
decorate( string $filename, array $params )
Decorate the current fragment, with another fragment. The decorated fragment
receives the parameters which are passed to this method.
Decorate the current fragment, with another fragment. The decorated fragment
receives the parameters which are passed to this method.
Parameters
- $filename
- The filename of the fragment used for decoration
- $params
- A array of key-value pairs to pass as parameters
Returns
mixed $this
|
|
protected
mixed
|
#
escape( mixed $value, string $strategy = 'html' )
Escapes the value $val for proper use in the gui.
Escapes the value $val for proper use in the gui.
Parameters
- $value
- The value to escape
- $strategy
- One of "html", "html_attr", "css", "js", "url"
Returns
mixed mixed
Throws
InvalidArgumentException InvalidArgumentException
|
|
protected
|
#
subfragment( string $filename, array $params = [] )
Include a Subfragment from within a fragment.
Include a Subfragment from within a fragment.
The Subfragment gets all variables of the current fragment, plus optional
overrides from $params
Parameters
- $filename
- The filename of the fragment to use
- $params
- A array of key-value pairs to pass as local parameters
|
|
protected
string
|
#
i18n( string $key )
Translate the given key $key.
Translate the given key $key.
Parameters
- $key
- The key to translate
Returns
string string
Throws
InvalidArgumentException InvalidArgumentException
|
|
public
mixed
|
#
__get( string $name )
Magic getter to reference variables from within the fragment.
Magic getter to reference variables from within the fragment.
Parameters
- $name
- The name of the variable to get
Returns
mixed mixed
|
|
public
boolean
|
#
__isset( string $name )
Magic method to check if a variable is set.
Magic method to check if a variable is set.
Parameters
- $name
- The name of the variable to check
Returns
boolean bool
|
|
public static
|
#
addDirectory( string $dir )
Add a path to the fragment search path.
Add a path to the fragment search path.
Parameters
- $dir
- A path to a directory where fragments can be found
|
|