本文整理汇总了PHP中Tribe__Events__Template_Factory::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Tribe__Events__Template_Factory::__construct方法的具体用法?PHP Tribe__Events__Template_Factory::__construct怎么用?PHP Tribe__Events__Template_Factory::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tribe__Events__Template_Factory
的用法示例。
在下文中一共展示了Tribe__Events__Template_Factory::__construct方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Set the notices used on month view
*
* @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query
*/
public function __construct($args = null)
{
if ($args === null) {
global $wp_query;
$args = $wp_query->query;
if (!empty($wp_query->query_vars['meta_query'])) {
$args['meta_query'] = $wp_query->query_vars['meta_query'];
}
}
$this->use_cache = tribe_get_option('enable_month_view_cache', false);
// Cache the result of month/content.php
if ($this->use_cache) {
$cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
$this->html_cache = new Tribe__Events__Template_Part_Cache('month/content.php', serialize($args), $cache_expiration, 'save_post');
}
self::$args = $args;
self::$posts_per_page_limit = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
// don't enqueue scripts and js when we're not constructing month view,
// they'll have to be enqueued separately
if (!tribe_is_month()) {
$this->asset_packages = array();
}
parent::__construct();
}
示例2: __construct
/**
* Set the notices used on month view.
*
* @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query.
*/
public function __construct($args = array())
{
// set the proper query args
$this->set_args($args);
// include child categories in the query, save categories for reuse
$this->set_queried_event_cats();
// decide if we should use the month view cache
$this->use_cache = tribe_get_option('enable_month_view_cache', false);
// Cache the result of month/content.php
if ($this->use_cache) {
$cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
$this->html_cache = new Tribe__Template_Part_Cache('month/content.php', serialize($this->args), $cache_expiration, 'save_post');
}
$this->events_per_day = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
$this->requested_date = $this->requested_date();
$this->first_grid_date = self::calculate_first_cell_date($this->requested_date);
$this->final_grid_date = self::calculate_final_cell_date($this->requested_date);
// get all the ids for the events in this month, speeds up queries
$this->set_events_in_month();
// don't enqueue scripts and js when we're not constructing month view,
// they'll have to be enqueued separately
if (!tribe_is_month()) {
$this->asset_packages = array();
}
parent::__construct();
}
示例3: __construct
/**
* The class constructor.
*/
public function __construct()
{
parent::__construct();
add_action('tribe_events_asset_package', array(__CLASS__, 'asset_package'), 10, 2);
}
示例4: __construct
/**
* Set the notices used on month view.
*
* @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query.
*/
public function __construct($args = array())
{
// set the proper query args
$this->set_args($args);
// include child categories in the query, save categories for reuse
$this->set_queried_event_cats();
/**
* Controls whether or not month view caching is enabled.
*
* Filtering this value can be useful if you need to implement
* a fine grained caching policy for month view.
*
* @param boolean $enable
* @param array $args
*/
$this->use_cache = apply_filters('tribe_events_enable_month_view_cache', $this->should_enable_month_view_cache(), $this->args);
// Cache the result of month/content.php
if ($this->use_cache) {
$cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
$this->html_cache = new Tribe__Template_Part_Cache('month/content.php', serialize($this->args), $cache_expiration, 'save_post');
}
$this->events_per_day = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
$this->requested_date = $this->requested_date();
$this->first_grid_date = self::calculate_first_cell_date($this->requested_date);
$this->final_grid_date = self::calculate_final_cell_date($this->requested_date);
// get all the ids for the events in this month, speeds up queries
$this->set_events_in_month();
// don't enqueue scripts and js when we're not constructing month view,
// they'll have to be enqueued separately
if (!tribe_is_month()) {
$this->asset_packages = array();
}
parent::__construct();
}
示例5: __construct
/**
* Set the notices used on month view.
*
* @param array $args Set of $wp_query params for the month view, if none passed then will default to $wp_query.
*/
public function __construct($args = null)
{
if ($args === null) {
global $wp_query;
$args = $wp_query->query;
if (!empty($wp_query->query_vars['meta_query'])) {
$args['meta_query'] = $wp_query->query_vars['meta_query'];
}
}
$this->use_cache = tribe_get_option('enable_month_view_cache', false);
// Cache the result of month/content.php
if ($this->use_cache) {
$cache_expiration = apply_filters('tribe_events_month_view_transient_expiration', HOUR_IN_SECONDS);
$this->html_cache = new Tribe__Events__Template_Part_Cache('month/content.php', serialize($args), $cache_expiration, 'save_post');
}
$args = (array) $args;
self::$args = (array) $args;
$this->events_per_day = apply_filters('tribe_events_month_day_limit', tribe_get_option('monthEventAmount', '3'));
$this->requested_date = $this->requested_date();
$this->first_grid_date = $this->calculate_first_cell_date($this->requested_date);
$this->final_grid_date = $this->calculate_final_cell_date($this->requested_date);
// get all the ids for the events in this month, speeds up queries
$this->events_in_month = tribe_get_events(array_merge($args, array('fields' => 'ids', 'start_date' => $this->first_grid_date, 'end_date' => $this->final_grid_date, 'posts_per_page' => -1)));
// don't enqueue scripts and js when we're not constructing month view,
// they'll have to be enqueued separately
if (!tribe_is_month()) {
$this->asset_packages = array();
}
parent::__construct();
}
示例6: __construct
/**
* Constructor
*
* @author Modern Tribe
**/
public function __construct()
{
parent::__construct();
wp_enqueue_style('tribe-agenda-view', get_stylesheet_directory_uri() . "/tribe-events/agenda-view.css", array(), '0.1', 'screen');
wp_enqueue_script('tribe-agenda-view-scripts', get_stylesheet_directory_uri() . "/tribe-events/agenda-view.js", array('jquery'), null, true);
}