PHP 클래스 Stash

저자: Mark Croxton ([email protected])
파일 보기 프로젝트 열기: croxton/stash 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$EE
$context
$default_scope
$file_sync
$limit_bots
$path
$site_id
$stash_cookie
$stash_cookie_expire
$version

보호된 프로퍼티들

프로퍼티 타입 설명
$bundle_id
$bundles
$parse_complete
$parse_conditionals
$parse_depth
$parse_tags
$parse_vars
$priority
$process
$replace
$type
$xss_clean

공개 메소드들

메소드 설명
__call ( string $name, array $arguments ) : void Shortcut to stash:get or stash:set
__construct ( $calling_from_hook = FALSE ) * Constructor
_no_results ( ) : String parse and return no_results content
_prep_no_results ( string $prefix ) : String prep a prefixed no_results block in current template tagdata
append ( ) : void Append the specified value to an already existing variable.
append_list ( ) : string Append to array
append_value ( ) : void Single tag version of append()
block ( ) : string Define default/fallback content for a stash variable from enclosed tagdata
bundle ( array $params = [], array $dynamic = [] ) : void Bundle up a collection of variables and save in the database
cache ( ) : string Cache tagdata to db and link it to the current URL context
context ( ) : void Set the current context
copy ( ) : string Clone a variable / list
destroy ( mixed $params = [], string $type = 'variable', string $scope = 'user' ) : void Unset variable(s) in the current session, optionally flush from db
embed ( ) : string Embed a Stash template file in the current template
embed_extend ( ) : string Pass variables to an embed via variable pairs in tagdata
extend ( ) : string | void Inject a stash embed into a variable or block
final_output ( $output = '' ) : string Final parsing/cleanup of template tagdata before output
finish ( ) : string Tagb for cleaning up specific placeholders before final output
flatten_list ( $array ) : string Flattens an array into a quasi-serialized format suitable for saving as a stash variable
flush_cache ( ) : string Flush the variables database cache for the current site (Super Admins only)
get ( mixed $params = '', string $type = 'variable', string $scope = 'user' ) : string Get content from session, database, $_POST/$_GET superglobals or file
get_bundle ( $set = TRUE ) : string Restore values for a given bundle
get_list ( $params = [], $value = '', $type = 'variable', $scope = 'user' ) : string Retrieve a serialised array of items, explode and replace into tagdata
init ( boolean $calling_from_hook = FALSE ) : void Initialise tag parameters
is_empty ( $string = NULL ) : integer Checks if a variable or string has any content, handy for conditionals
join_lists ( ) : string Create a union of two or more existing lists Lists *must* share the same keys and be *already in memory*
list_count ( ) : string Retrieve the item count for a given list
not_empty ( $string = NULL ) : integer Checks if a variable or string is empty or non-existent, handy for conditionals
not_found ( ) : string Output the 404 template with the correct header and exit
parse ( array $params = [], string $value = NULL ) : string Parse tagdata
prepend ( ) : void Prepend the specified value to an already existing variable.
prepend_list ( ) : string Prepend to array
prepend_value ( ) : void Single tag version of prepend()
rebuild_list ( mixed $params = '', string $type = 'variable', string $scope = 'user' ) : array Retrieve and rebuild list, or optionally part of a list
save_output ( string $output = '' ) : string Save the final rendered template output to a static file
set ( mixed $params = [], string $value = '', string $type = 'variable', string $scope = 'user' ) : void Set content in the current session, optionally save to the database
set_bundle ( ) : void Set values into a bundle
set_list ( ) : string Serialize a multidimenisional array and save as a variable
set_parse_params ( ) : String set individual parse parameters if parse="yes"
set_value ( ) : void Single tag version of set(), for when you need to use a plugin as a tag parameter (always use with parse="inward")
shuffle_list_key ( $arr, $key ) : void Shuffle a stash list key
sort_by_key ( $arr, $key, $cmp = 'sort_by_integer' ) : void Sort a multi-dimensional array by key
split_list ( )
static_cache ( string $output = '' ) : string Cache a template to file and link it to the current URL context

보호된 메소드들

메소드 설명
sort_by_integer ( $a, $b ) Sort callback function: sort by integer
sort_by_string ( $a, $b ) Sort callback function: sort by string

비공개 메소드들

메소드 설명
_api_call ( string $method, mixed $params, string $type = 'variable', string $scope = 'user', string $value = NULL ) : void API: call a Stash method directly
_api_static_call ( string $method, mixed $params, string $type = 'variable', string $scope = 'user', string $value = NULL ) : void API: call a Stash method statically (DEPRECATED, PHP <5.6 only)
_clean_string ( string $value = NULL ) : string String manipulations
_get_boolean_config_item ( string $item, boolean $default = TRUE ) : boolean get the boolean value of a config item, with the desired fallback value
_get_stash_cookie ( ) : boolean/array get the stash cookie
_get_users_vars ( ) : array return the standard set of user variables
_is_bot ( ) : void Check if the user agent is a bot
_is_cacheable ( boolean $check_request_type = TRUE ) : string Check to see if a template (not a fragment) is suitable for caching
_lcd ( $array, $x = 1 ) : integer get the least common denominator for a given array of numbers
_list_row_explode ( string $string ) : array
_list_row_implode ( array $array ) : string
_load_EE_TMPL ( ) : void Load the EE Template class and register the Stash module Used when Stash is instantiated outside of an EE template
_matches ( string $match, string/array $against ) : boolean Match a regex against a string or array of strings
_normalize ( $str ) : string Normalize characters in a string (the dirty way)
_parse_context ( string $name, $disable_query_str = FALSE ) : string Replace the current context in a variable name
_parse_fraction ( $fraction, $offset, $total ) : integer get a fraction from a parameter value
_parse_output ( string $value = NULL, string $match = NULL, string $filter = NULL, string $default = NULL ) : string Final parsing of the stash variable before output to the template
_parse_sub_template ( boolean $tags = TRUE, boolean $vars = TRUE, boolean $conditionals = FALSE, integer $depth = 1, $nocache_id = FALSE ) : string Parse template data
_parse_template_vars ( string $template = '' ) : string Parse global vars inside a string
_placeholders ( array $matches ) : string Replaces nested tag content with placeholders
_post_parse ( $method ) : Mixed Delay processing a tag until template_post_parse hook
_prep_in_conditionals ( string $tagdata = '' ) : String Prep {if var IN (array)} conditionals
_run_tag ( string $method, array $params = [] ) : string Run a Stash module tag with a known set of parameters
_serialize_stash_tag_pairs ( ) : void Retrieve {stash:var}{/stash:var} tag pairs and serialize
_set_stash_cookie ( string $unique_id ) : void set the stash cookie
_un_prefix ( string $prefix, string $template ) : String remove a given prefix from common variables in the template tagdata
_update_list ( boolean $append = TRUE ) : string Append / prepend to array

메소드 상세

__call() 공개 메소드

Shortcut to stash:get or stash:set
public __call ( string $name, array $arguments ) : void
$name string The method name being called or context if third tagpart
$arguments array The method call arguments
리턴 void

__construct() 공개 메소드

* Constructor
public __construct ( $calling_from_hook = FALSE )

_no_results() 공개 메소드

parse and return no_results content
public _no_results ( ) : String
리턴 String

_prep_no_results() 공개 메소드

prep a prefixed no_results block in current template tagdata
public _prep_no_results ( string $prefix ) : String
$prefix string
리턴 String

append() 공개 메소드

Append the specified value to an already existing variable.
public append ( ) : void
리턴 void

append_list() 공개 메소드

Append to array
public append_list ( ) : string
리턴 string

append_value() 공개 메소드

Single tag version of append()
public append_value ( ) : void
리턴 void

block() 공개 메소드

Define default/fallback content for a stash variable from enclosed tagdata
public block ( ) : string
리턴 string

bundle() 공개 메소드

Bundle up a collection of variables and save in the database
public bundle ( array $params = [], array $dynamic = [] ) : void
$params array
$dynamic array
리턴 void

cache() 공개 메소드

Cache tagdata to db and link it to the current URL context
public cache ( ) : string
리턴 string

context() 공개 메소드

Set the current context
public context ( ) : void
리턴 void

copy() 공개 메소드

Clone a variable / list
public copy ( ) : string
리턴 string

destroy() 공개 메소드

Unset variable(s) in the current session, optionally flush from db
public destroy ( mixed $params = [], string $type = 'variable', string $scope = 'user' ) : void
$params mixed The name of the variable to unset, or an array of key => value pairs
$type string The type of variable
$scope string The scope of the variable
리턴 void

embed() 공개 메소드

Embed a Stash template file in the current template
public embed ( ) : string
리턴 string

embed_extend() 공개 메소드

Pass variables to an embed via variable pairs in tagdata
public embed_extend ( ) : string
리턴 string

extend() 공개 메소드

Inject a stash embed into a variable or block
public extend ( ) : string | void
리턴 string | void

final_output() 공개 메소드

Final parsing/cleanup of template tagdata before output
public final_output ( $output = '' ) : string
리턴 string

finish() 공개 메소드

Tagb for cleaning up specific placeholders before final output
public finish ( ) : string
리턴 string

flatten_list() 공개 정적인 메소드

Flattens an array into a quasi-serialized format suitable for saving as a stash variable
public static flatten_list ( $array ) : string
리턴 string The imploded string

flush_cache() 공개 메소드

Flush the variables database cache for the current site (Super Admins only)
public flush_cache ( ) : string
리턴 string

get() 공개 메소드

Get content from session, database, $_POST/$_GET superglobals or file
public get ( mixed $params = '', string $type = 'variable', string $scope = 'user' ) : string
$params mixed The name of the variable to retrieve, or an array of key => value pairs
$type string The type of variable
$scope string The scope of the variable
리턴 string

get_bundle() 공개 메소드

Restore values for a given bundle
public get_bundle ( $set = TRUE ) : string
리턴 string

get_list() 공개 메소드

Retrieve a serialised array of items, explode and replace into tagdata
public get_list ( $params = [], $value = '', $type = 'variable', $scope = 'user' ) : string
리턴 string

init() 공개 메소드

Initialise tag parameters
public init ( boolean $calling_from_hook = FALSE ) : void
$calling_from_hook boolean Is method being called by an extension hook?
리턴 void

is_empty() 공개 메소드

Checks if a variable or string has any content, handy for conditionals
public is_empty ( $string = NULL ) : integer
$string a string to test
리턴 integer

join_lists() 공개 메소드

Create a union of two or more existing lists Lists *must* share the same keys and be *already in memory*
public join_lists ( ) : string
리턴 string

list_count() 공개 메소드

Retrieve the item count for a given list
public list_count ( ) : string
리턴 string

not_empty() 공개 메소드

Checks if a variable or string is empty or non-existent, handy for conditionals
public not_empty ( $string = NULL ) : integer
$string a string to test
리턴 integer

not_found() 공개 메소드

Output the 404 template with the correct header and exit
public not_found ( ) : string
리턴 string

parse() 공개 메소드

Parse tagdata
public parse ( array $params = [], string $value = NULL ) : string
$params array an array of key => value pairs representing tag parameters
$value string string to parse, defaults to template tagdata
리턴 string

prepend() 공개 메소드

Prepend the specified value to an already existing variable.
public prepend ( ) : void
리턴 void

prepend_list() 공개 메소드

Prepend to array
public prepend_list ( ) : string
리턴 string

prepend_value() 공개 메소드

Single tag version of prepend()
public prepend_value ( ) : void
리턴 void

rebuild_list() 공개 메소드

Retrieve and rebuild list, or optionally part of a list
public rebuild_list ( mixed $params = '', string $type = 'variable', string $scope = 'user' ) : array
$params mixed The name of the variable to retrieve, or an array of key => value pairs
$type string The type of variable
$scope string The scope of the variable
리턴 array

save_output() 공개 메소드

Save the final rendered template output to a static file
public save_output ( string $output = '' ) : string
$output string the rendered template
리턴 string

set() 공개 메소드

Set content in the current session, optionally save to the database
public set ( mixed $params = [], string $value = '', string $type = 'variable', string $scope = 'user' ) : void
$params mixed The name of the variable to retrieve, or an array of key => value pairs
$value string The value of the variable
$type string The type of variable
$scope string The scope of the variable
리턴 void

set_bundle() 공개 메소드

Set values into a bundle
public set_bundle ( ) : void
리턴 void

set_list() 공개 메소드

Serialize a multidimenisional array and save as a variable
public set_list ( ) : string
리턴 string

set_parse_params() 공개 메소드

set individual parse parameters if parse="yes"
public set_parse_params ( ) : String
리턴 String

set_value() 공개 메소드

Single tag version of set(), for when you need to use a plugin as a tag parameter (always use with parse="inward")
public set_value ( ) : void
리턴 void

shuffle_list_key() 공개 메소드

Shuffle a stash list key
public shuffle_list_key ( $arr, $key ) : void
리턴 void

sort_by_integer() 보호된 메소드

Sort callback function: sort by integer
protected sort_by_integer ( $a, $b )

sort_by_key() 공개 메소드

Sort a multi-dimensional array by key
public sort_by_key ( $arr, $key, $cmp = 'sort_by_integer' ) : void
리턴 void

sort_by_string() 보호된 메소드

Sort callback function: sort by string
protected sort_by_string ( $a, $b )

split_list() 공개 메소드

public split_list ( )

static_cache() 공개 메소드

Cache a template to file and link it to the current URL context
public static_cache ( string $output = '' ) : string
$output string additional tagdata to return to the template along with the placeholder
리턴 string

프로퍼티 상세

$EE 공개적으로 프로퍼티

public $EE

$bundle_id 보호되어 있는 프로퍼티

protected $bundle_id

$bundles 보호되어 있는 정적으로 프로퍼티

protected static $bundles

$context 공개적으로 정적으로 프로퍼티

public static $context

$default_scope 공개적으로 프로퍼티

public $default_scope

$file_sync 공개적으로 프로퍼티

public $file_sync

$limit_bots 공개적으로 프로퍼티

public $limit_bots

$parse_complete 보호되어 있는 프로퍼티

protected $parse_complete

$parse_conditionals 보호되어 있는 프로퍼티

protected $parse_conditionals

$parse_depth 보호되어 있는 프로퍼티

protected $parse_depth

$parse_tags 보호되어 있는 프로퍼티

protected $parse_tags

$parse_vars 보호되어 있는 프로퍼티

protected $parse_vars

$path 공개적으로 프로퍼티

public $path

$priority 보호되어 있는 프로퍼티

protected $priority

$process 보호되어 있는 프로퍼티

protected $process

$replace 보호되어 있는 프로퍼티

protected $replace

$site_id 공개적으로 프로퍼티

public $site_id

$type 보호되어 있는 프로퍼티

protected $type

$version 공개적으로 프로퍼티

public $version

$xss_clean 보호되어 있는 프로퍼티

protected $xss_clean