PHP Class Timber\Timber

Main class called Timber for this plugin.
Mostra file Open project: jarednova/timber Class Usage Examples

Public Properties

Property Type Description
$auto_meta
$autoescape
$cache
$context_cache
$dirname
$locations
$twig_cache
$version

Public Methods

Method Description
__construct ( )
add_route ( string $route, callable $callback, array $args = [] ) Add route.
compile ( array $filenames, array $data = [], boolean | integer $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT, boolean $via_render = false ) : boolean | string Compile function.
compile_string ( string $string, array $data = [] ) : boolean | string Compile string.
fetch ( array $filenames, array $data = [], boolean $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT ) : boolean | string Fetch function.
get_context ( ) : array Get context.
get_pagination ( array $prefs = [] ) : array Get pagination.
get_post ( mixed $query = false, string | array $PostClass = 'Timber\Post' ) : array | boolean | null Get post.
get_posts ( mixed $query = false, string | array $PostClass = 'Timber\Post', $return_collection = false ) : array | boolean | null Get posts.
get_sidebar ( string $sidebar = 'sidebar.php', array $data = [] ) : boolean | string Get sidebar.
get_sidebar_from_php ( string $sidebar = '', array $data ) : string Get sidebar from PHP
get_sites ( array | boolean $blog_ids = false ) : array Get sites.
get_term ( integer | WP_Term | object $term, string $taxonomy = 'post_tag', $TermClass = 'Timber\Term' ) : Timber\Term | WP_Error | null Get term.
get_terms ( string | array $args = null, array $maybe_args = [], string $TermClass = 'Timber\Term' ) : mixed Get terms.
get_widgets ( integer $widget_id ) : TimberFunctionWrapper Get widgets.
init_constants ( )
query_post ( mixed $query = false, string $PostClass = 'Timber\Post' ) : array | boolean | null Query post.
query_posts ( mixed $query = false, string $PostClass = 'Timber\Post' ) : PostCollection Query posts.
render ( array $filenames, array $data = [], boolean | integer $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT ) : boolean | string Render function.
render_string ( string $string, array $data = [] ) : boolean | string Render string.

Protected Methods

Method Description
init ( )
test_compatibility ( ) Tests whether we can use Timber

Private Methods

Method Description
backwards_compatibility ( )

Method Details

__construct() public method

public __construct ( )

add_route() public static method

Add route.
Deprecation: since 0.20.0 and will be removed in 1.1
public static add_route ( string $route, callable $callback, array $args = [] )
$route string
$callback callable
$args array

compile() public static method

Compile function.
public static compile ( array $filenames, array $data = [], boolean | integer $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT, boolean $via_render = false ) : boolean | string
$filenames array
$data array
$expires boolean | integer
$cache_mode string
$via_render boolean
return boolean | string

compile_string() public static method

Compile string.
public static compile_string ( string $string, array $data = [] ) : boolean | string
$string string a string with twig variables.
$data array an array with data in it.
return boolean | string

fetch() public static method

Fetch function.
public static fetch ( array $filenames, array $data = [], boolean $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT ) : boolean | string
$filenames array
$data array
$expires boolean
$cache_mode string
return boolean | string

get_context() public static method

Get context.
public static get_context ( ) : array
return array

get_pagination() public static method

Get pagination.
public static get_pagination ( array $prefs = [] ) : array
$prefs array
return array mixed

get_post() public static method

Get post.
public static get_post ( mixed $query = false, string | array $PostClass = 'Timber\Post' ) : array | boolean | null
$query mixed
$PostClass string | array
return array | boolean | null

get_posts() public static method

Get posts.
public static get_posts ( mixed $query = false, string | array $PostClass = 'Timber\Post', $return_collection = false ) : array | boolean | null
$query mixed
$PostClass string | array
return array | boolean | null

get_sidebar() public static method

Get sidebar.
public static get_sidebar ( string $sidebar = 'sidebar.php', array $data = [] ) : boolean | string
$sidebar string
$data array
return boolean | string

get_sidebar_from_php() public static method

Get sidebar from PHP
public static get_sidebar_from_php ( string $sidebar = '', array $data ) : string
$sidebar string
$data array
return string

get_sites() public static method

Get sites.
public static get_sites ( array | boolean $blog_ids = false ) : array
$blog_ids array | boolean
return array

get_term() public static method

Get term.
public static get_term ( integer | WP_Term | object $term, string $taxonomy = 'post_tag', $TermClass = 'Timber\Term' ) : Timber\Term | WP_Error | null
$term integer | WP_Term | object
$taxonomy string
return Timber\Term | WP_Error | null

get_terms() public static method

Get terms.
public static get_terms ( string | array $args = null, array $maybe_args = [], string $TermClass = 'Timber\Term' ) : mixed
$args string | array
$maybe_args array
$TermClass string
return mixed

get_widgets() public static method

Get widgets.
public static get_widgets ( integer $widget_id ) : TimberFunctionWrapper
$widget_id integer
return TimberFunctionWrapper

init() protected static method

protected static init ( )

init_constants() public method

public init_constants ( )

query_post() public static method

Query post.
public static query_post ( mixed $query = false, string $PostClass = 'Timber\Post' ) : array | boolean | null
$query mixed
$PostClass string
return array | boolean | null

query_posts() public static method

Query posts.
public static query_posts ( mixed $query = false, string $PostClass = 'Timber\Post' ) : PostCollection
$query mixed
$PostClass string
return PostCollection

render() public static method

Render function.
public static render ( array $filenames, array $data = [], boolean | integer $expires = false, string $cache_mode = Loader::CACHE_USE_DEFAULT ) : boolean | string
$filenames array
$data array
$expires boolean | integer
$cache_mode string
return boolean | string

render_string() public static method

Render string.
public static render_string ( string $string, array $data = [] ) : boolean | string
$string string a string with twig variables.
$data array an array with data in it.
return boolean | string

test_compatibility() protected method

Tests whether we can use Timber
protected test_compatibility ( )

Property Details

$auto_meta public_oe static_oe property

public static $auto_meta

$autoescape public_oe static_oe property

public static $autoescape

$cache public_oe static_oe property

public static $cache

$context_cache public_oe static_oe property

public static $context_cache

$dirname public_oe static_oe property

public static $dirname

$locations public_oe static_oe property

public static $locations

$twig_cache public_oe static_oe property

public static $twig_cache

$version public_oe static_oe property

public static $version