本文整理汇总了PHP中entity_selector::set_cache_lifespan方法的典型用法代码示例。如果您正苦于以下问题:PHP entity_selector::set_cache_lifespan方法的具体用法?PHP entity_selector::set_cache_lifespan怎么用?PHP entity_selector::set_cache_lifespan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entity_selector
的用法示例。
在下文中一共展示了entity_selector::set_cache_lifespan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _get_sharing_sites
/**
* Get the set of sites that share events
* @return array site entities keyed on Reason id
* @access private
*/
protected function _get_sharing_sites()
{
static $sharing_sites = array();
if (empty($sharing_sites)) {
$es = new entity_selector();
$es->add_type(id_of('site'));
$es->add_left_relationship(id_of('event_type'), relationship_id_of('site_shares_type'));
$es->limit_tables('site');
$es->limit_fields('site_state');
$es->add_relation('site_state="Live"');
$es->set_cache_lifespan($this->_get_cache_lifespan_meta());
$sharing_sites = $es->run_one();
}
return $sharing_sites;
}
示例2: array
/**
* Set up an initalization array for a reason calendar object
*
* @param string $start_date mysql date
* @param string $end_date mysql date
* @param string $view
* @return array
*/
function make_reason_calendar_init_array($start_date, $end_date = '', $view = '')
{
$init_array = array();
$init_array['context_site'] = $this->parent->site_info;
$init_array['site'] = $this->_get_sites();
$init_array['sharing_mode'] = $this->_get_sharing_mode();
if(!empty($start_date))
$init_array['start_date'] = $start_date;
if(!empty($end_date))
{
$init_array['end_date'] = $end_date;
}
elseif(!empty($view))
{
$init_array['view'] = $view;
}
if(!empty($this->pass_vars['audience']))
{
$audience = new entity($this->pass_vars['audience']);
$init_array['audiences'] = array( $audience->id()=>$audience );
}
if(!empty($this->pass_vars['category']))
{
$category = new entity($this->pass_vars['category']);
$init_array['categories'] = array( $category->id()=>$category );
}
if($this->params['limit_to_page_categories'])
{
$es = new entity_selector( $this->parent->site_id );
$es->description = 'Selecting categories for this page';
$es->add_type( id_of('category_type') );
$es->set_env('site',$this->parent->site_id);
$es->add_right_relationship( $this->parent->cur_page->id(), relationship_id_of('page_to_category') );
$es->set_cache_lifespan($this->get_cache_lifespan_meta());
$cats = $es->run_one();
if(!empty($cats))
{
$init_array['or_categories'] = $cats;
}
}
if($this->params['ideal_count'])
$init_array['ideal_count'] = $this->params['ideal_count'];
elseif(!empty($this->ideal_count))
$init_array['ideal_count'] = $this->ideal_count;
if($this->params['default_view_min_days'])
$init_array['default_view_min_days'] = $this->params['default_view_min_days'];
$init_array['automagic_window_snap_to_nearest_view'] = $this->snap_to_nearest_view;
if($markup = $this->get_markup_object('list'))
$display_type = $markup->get_ongoing_display_type();
else
$display_type = 'above';
if('inline' == $display_type)
{
$init_array['ongoing_count_all_occurrences'] = true;
}
elseif('above' == $display_type)
{
$init_array['ongoing_count_all_occurrences'] = false;
$init_array['ongoing_count_pre_start_dates'] = true;
$init_array['ongoing_count_ends'] = $this->params['ongoing_show_ends'];
}
elseif('below' == $display_type)
{
$init_array['ongoing_count_all_occurrences'] = false;
$init_array['ongoing_count_pre_start_dates'] = false;
$init_array['ongoing_count_ends'] = $this->params['ongoing_show_ends'];
}
if(!empty($this->request['search']))
{
$init_array['simple_search'] = $this->request['search'];
}
$init_array['es_callback'] = array($this, 'reason_calendar_master_callback');
$init_array['cache_lifespan'] = $this->get_cache_lifespan();
$init_array['cache_lifespan_meta'] = $this->get_cache_lifespan_meta();
return $init_array;
}