PHP Class Simpletags, 68kb

A simple tag parsing library.
Afficher le fichier Open project: 68kb/68kb Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( $config = [] ) : void Constructor
parse ( $content, $data = [], $callback = [] ) : mixed Parse
parse_globals ( $content, $data ) : string Parse Globals
set_delimiters ( $left, $right ) : object Set Delimiters
set_trigger ( $trigger ) : object Set Trigger

Private Methods

Méthode Description
_force_array ( $var, $level = 1 ) : array Forces normal multi-dimensional arrays and objects into an array structure that will work with EE/Mojo/CI Parsers.
_parse_attributes ( $attributes ) : array Parse Attributes
_parse_data_double ( $tag, $data ) : mixed Get the data pertaining to the given double tag. This will loop through arrays of given data
_parse_data_single ( $tag, $data ) : mixed Get the data pertaining to the given single tag.
_parse_lang ( $content ) : mixed Parse any language strings
_parse_lang_single ( $tag ) : string Parse the lang lines
_parse_segments ( $segments ) : array Parse Segments

Method Details

__construct() public méthode

Constructor
public __construct ( $config = [] ) : void
Résultat void

parse() public méthode

Parses the content and returns an array with marked content and tags or the resulting content from calling the callback for each tag.
public parse ( $content, $data = [], $callback = [] ) : mixed
Résultat mixed Either the tags as array or callback results

parse_globals() public méthode

Parses global data tags. These are tags that do not use a trigger and have a variable in the $data array. This enables you to use globals inside of other tags: The Tag: {tag:blog:posts offset="{offset}"} The data array: array( 'offset' => $this->uri->segment(3), );
public parse_globals ( $content, $data ) : string
Résultat string The parsed content

set_delimiters() public méthode

Set the delimeters for the tags
public set_delimiters ( $left, $right ) : object
Résultat object Returns $this to enable method chaining

set_trigger() public méthode

Sets the tag trigger to use. This allows you to only consider tags that have a trigger: {tag:name}{/tag:name}
public set_trigger ( $trigger ) : object
Résultat object Returns $this to enable method chaining