PHP 클래스 Timber\Helper

파일 보기 프로젝트 열기: jarednova/timber 1 사용 예제들

공개 메소드들

메소드 설명
_is_transient_locked ( string $slug )
_lock_transient ( string $slug, integer $lock_timeout )
_unlock_transient ( string $slug )
array_to_object ( array $array ) : stdClass
array_truncate ( array $array, integer $len ) : array
close_tags ( string $html ) : string
error_log ( $error ) : void
function_wrapper ( mixed $function_name, $defaults = [], $return_output_buffer = false ) : FunctionWrapper | mixed
get_comment_form ( integer $post_id = null, array $args = [] ) : string Gets the comment form for use on a single article page
get_current_url ( ) : string
get_object_by_property ( array $array, string $key, mixed $value ) : array | null
get_object_index_by_property ( array $array, string $key, mixed $value ) : boolean | integer
get_wp_title ( string $separator = ' ', string $seplocation = 'left' ) : string
is_array_assoc ( array $arr ) : boolean
is_true ( mixed $value ) : boolean
iseven ( integer $i ) : boolean
isodd ( integer $i ) : boolean
ob_function ( callback $function, array $args = [null] ) : string Calls a function with an output buffer. This is useful if you have a function that outputs text that you want to capture and use within a twig template.
osort ( array &$array, string $prop ) : void
paginate_links ( array $args = [] ) : array
pluck ( array $array, string $key ) Plucks the values of a certain key from an array of objects
start_timer ( ) : float For measuring time, this will start a timer
stop_timer ( integer $start ) : string For stopping time and getting the data
transient ( string $slug, callable $callback, integer $transient_time, integer $lock_timeout = 5, boolean $force = false ) : mixed A utility for a one-stop shop for Transients
trim_words ( string $text, integer $num_words = 55, string | null | false $more = null, string $allowed_tags = 'p a span b i br blockquote' ) : string
warn ( string $message ) : boolean

보호된 메소드들

메소드 설명
handle_transient_locking ( string $slug, callable $callback, integer $transient_time, integer $lock_timeout, boolean $force, boolean $enable_transients ) Does the dirty work of locking the transient, running the callback and unlocking

메소드 상세

_is_transient_locked() 공개 정적인 메소드

public static _is_transient_locked ( string $slug )
$slug string

_lock_transient() 공개 정적인 메소드

public static _lock_transient ( string $slug, integer $lock_timeout )
$slug string
$lock_timeout integer

_unlock_transient() 공개 정적인 메소드

public static _unlock_transient ( string $slug )
$slug string

array_to_object() 공개 정적인 메소드

public static array_to_object ( array $array ) : stdClass
$array array
리턴 stdClass

array_truncate() 공개 정적인 메소드

public static array_truncate ( array $array, integer $len ) : array
$array array
$len integer
리턴 array

close_tags() 공개 정적인 메소드

또한 보기: TextHelper::close_tags
사용 중단: since 1.2.0
public static close_tags ( string $html ) : string
$html string
리턴 string

error_log() 공개 정적인 메소드

public static error_log ( $error ) : void
리턴 void

function_wrapper() 공개 정적인 메소드

public static function_wrapper ( mixed $function_name, $defaults = [], $return_output_buffer = false ) : FunctionWrapper | mixed
$function_name mixed or array( $class( string|object ), $function_name )
리턴 FunctionWrapper | mixed

get_comment_form() 공개 정적인 메소드

Gets the comment form for use on a single article page
사용 중단: 0.21.8 use `{{ function('comment_form') }}` instead
public static get_comment_form ( integer $post_id = null, array $args = [] ) : string
$post_id integer which post_id should the form be tied to?
$args array this $args thing is a fucking mess, [fix at some point](http://codex.wordpress.org/Function_Reference/comment_form)
리턴 string

get_current_url() 공개 메소드

public get_current_url ( ) : string
리턴 string

get_object_by_property() 공개 정적인 메소드

public static get_object_by_property ( array $array, string $key, mixed $value ) : array | null
$array array
$key string
$value mixed
리턴 array | null

get_object_index_by_property() 공개 정적인 메소드

public static get_object_index_by_property ( array $array, string $key, mixed $value ) : boolean | integer
$array array
$key string
$value mixed
리턴 boolean | integer

get_wp_title() 공개 정적인 메소드

public static get_wp_title ( string $separator = ' ', string $seplocation = 'left' ) : string
$separator string
$seplocation string
리턴 string

handle_transient_locking() 보호된 정적인 메소드

Does the dirty work of locking the transient, running the callback and unlocking
protected static handle_transient_locking ( string $slug, callable $callback, integer $transient_time, integer $lock_timeout, boolean $force, boolean $enable_transients )
$slug string
$callback callable
$transient_time integer Expiration of transients in seconds
$lock_timeout integer How long (in seconds) to lock the transient to prevent race conditions
$force boolean Force callback to be executed when transient is locked
$enable_transients boolean Force callback to be executed when transient is locked

is_array_assoc() 공개 정적인 메소드

public static is_array_assoc ( array $arr ) : boolean
$arr array
리턴 boolean

is_true() 공개 정적인 메소드

public static is_true ( mixed $value ) : boolean
$value mixed
리턴 boolean

iseven() 공개 정적인 메소드

public static iseven ( integer $i ) : boolean
$i integer
리턴 boolean

isodd() 공개 정적인 메소드

public static isodd ( integer $i ) : boolean
$i integer
리턴 boolean

ob_function() 공개 정적인 메소드

Calls a function with an output buffer. This is useful if you have a function that outputs text that you want to capture and use within a twig template.
public static ob_function ( callback $function, array $args = [null] ) : string
$function callback
$args array
리턴 string

osort() 공개 정적인 메소드

public static osort ( array &$array, string $prop ) : void
$array array
$prop string
리턴 void

pluck() 공개 정적인 메소드

Plucks the values of a certain key from an array of objects
public static pluck ( array $array, string $key )
$array array
$key string

start_timer() 공개 정적인 메소드

For measuring time, this will start a timer
public static start_timer ( ) : float
리턴 float

stop_timer() 공개 정적인 메소드

For stopping time and getting the data
public static stop_timer ( integer $start ) : string
$start integer
리턴 string

transient() 공개 정적인 메소드

A utility for a one-stop shop for Transients
public static transient ( string $slug, callable $callback, integer $transient_time, integer $lock_timeout = 5, boolean $force = false ) : mixed
$slug string Unique identifier for transient
$callback callable Callback that generates the data that's to be cached
$transient_time integer (optional) Expiration of transients in seconds
$lock_timeout integer (optional) How long (in seconds) to lock the transient to prevent race conditions
$force boolean (optional) Force callback to be executed when transient is locked
리턴 mixed

trim_words() 공개 정적인 메소드

또한 보기: TextHelper::trim_words
사용 중단: since 1.2.0
public static trim_words ( string $text, integer $num_words = 55, string | null | false $more = null, string $allowed_tags = 'p a span b i br blockquote' ) : string
$text string
$num_words integer
$more string | null | false text to appear in "Read more...". Null to use default, false to hide
$allowed_tags string
리턴 string

warn() 공개 정적인 메소드

public static warn ( string $message ) : boolean
$message string that you want to output
리턴 boolean