PHP Class Habari\HiEngineParser

Show file Open project: habari/system

Protected Properties

Property Type Description
$contexts
$file
$filename
$position
$strings

Public Methods

Method Description
apply_parameters ( array $returnval, array $params ) : string Take the found paramters on a variable tag and apply them to the output
hi_command ( array $matches ) : string Replace a single function template tag with its PHP counterpart
hi_if ( array $matches ) : string Replace an if tag section with its PHP counterpart
hi_loop ( array $matches ) : string Replace a loop tag section with its PHP counterpart, and add the context to the stack
hi_quote ( array $matches ) Prepare strings for translation
hi_to_var ( $hisyntax )
hi_var ( array $matches ) : string Replace a single template tag with its PHP counterpart
process ( string $template ) : string Process the template file for template tags
stream_eof ( ) : boolean Report whether the stream is at the end of the file
stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean Open a HiEngineParser stream
stream_read ( integer $count ) : string Read data from a HiEngineParser stream
stream_seek ( integer $offset, integer $whence ) : boolean Seek to a specific position within the stream
stream_stat ( ) : array Return fstat() info as required when calling stats on the stream
stream_tell ( ) : integer Report the position in the stream
stream_write ( string $data ) : boolean Srite data to a HiEngineParser stream
string_stack ( array $matches ) Creates a table of static strings in hiengine expressions to be replaced in later
var_replace ( array $matches ) Replace variables in the hiengine syntax with PHP varaibles

Method Details

apply_parameters() public method

Take the found paramters on a variable tag and apply them to the output
public apply_parameters ( array $returnval, array $params ) : string
$returnval array The expression to be output
$params array An associative array of parameters
return string The PHP expression with the paramters applied

hi_command() public method

Replace a single function template tag with its PHP counterpart
public hi_command ( array $matches ) : string
$matches array The match array found in HiEngineParser::process()
return string The PHP replacement for the function template tag

hi_if() public method

Replace an if tag section with its PHP counterpart
public hi_if ( array $matches ) : string
$matches array The match array found in HiEngineParser::process()
return string The PHP replacement for the template tag

hi_loop() public method

Replace a loop tag section with its PHP counterpart, and add the context to the stack
public hi_loop ( array $matches ) : string
$matches array The match array found in HiEngineParser::process()
return string The PHP replacement for the template tag

hi_quote() public method

Prepare strings for translation
public hi_quote ( array $matches )
$matches array Matches in HiEngineParser::process()

hi_to_var() public method

public hi_to_var ( $hisyntax )

hi_var() public method

Replace a single template tag with its PHP counterpart
public hi_var ( array $matches ) : string
$matches array The match array found in HiEngineParser::process()
return string The PHP replacement for the template tag

process() public method

Process the template file for template tags
public process ( string $template ) : string
$template string The template file contents
return string The processed template

stream_eof() public method

Report whether the stream is at the end of the file
public stream_eof ( ) : boolean
return boolean true if the file pointer is at or beyond the end of the file

stream_open() public method

Open a HiEngineParser stream
public stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean
$path string Path of the opened resource, including the protocol specifier
$mode string Mode used to open the file
$options integer Bitmask options for opening this stream
$opened_path string The actual path opened if using relative path, by reference
return boolean true on success

stream_read() public method

Read data from a HiEngineParser stream
public stream_read ( integer $count ) : string
$count integer Number of characters to read from the current position
return string Characters read from the stream

stream_seek() public method

Seek to a specific position within the stream
public stream_seek ( integer $offset, integer $whence ) : boolean
$offset integer The offset from the specified position
$whence integer The position to seek from
return boolean true if seek was successful

stream_stat() public method

Return fstat() info as required when calling stats on the stream
public stream_stat ( ) : array
return array An array of stat info

stream_tell() public method

Report the position in the stream
public stream_tell ( ) : integer
return integer the position in the stream

stream_write() public method

Srite data to a HiEngineParser stream
public stream_write ( string $data ) : boolean
$data string Data to write
return boolean false, since this stream type is read-only

string_stack() public method

Creates a table of static strings in hiengine expressions to be replaced in later
public string_stack ( array $matches )
$matches array The match found in hi_if ()

var_replace() public method

Replace variables in the hiengine syntax with PHP varaibles
public var_replace ( array $matches )
$matches array The match array found in hi_if ()

Property Details

$contexts protected property

protected $contexts

$file protected property

protected $file

$filename protected property

protected $filename

$position protected property

protected $position

$strings protected property

protected $strings