PHP 클래스 Simpletags, 68kb

A simple tag parsing library.
파일 보기 프로젝트 열기: 68kb/68kb 1 사용 예제들

공개 메소드들

메소드 설명
__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

비공개 메소드들

메소드 설명
_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

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( $config = [] ) : void
리턴 void

parse() 공개 메소드

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
리턴 mixed Either the tags as array or callback results

parse_globals() 공개 메소드

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
리턴 string The parsed content

set_delimiters() 공개 메소드

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

set_trigger() 공개 메소드

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
리턴 object Returns $this to enable method chaining