本文整理汇总了PHP中EM_Locations::context方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Locations::context方法的具体用法?PHP EM_Locations::context怎么用?PHP EM_Locations::context使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Locations
的用法示例。
在下文中一共展示了EM_Locations::context方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_default_search
public static function get_default_search($array_or_defaults = array(), $array = array())
{
self::$context = EM_POST_TYPE_LOCATION;
$defaults = array('eventful' => false, 'eventless' => false, 'orderby' => 'location_name', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'status' => 1, 'scope' => 'all', 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_locations'), 'private_only' => false, 'post_id' => false);
//sort out whether defaults were supplied or just the array of search values
if (empty($array)) {
$array = $array_or_defaults;
} else {
$defaults = array_merge($defaults, $array_or_defaults);
}
//specific functionality
if (EM_MS_GLOBAL) {
if (get_site_option('dbem_ms_mainblog_locations')) {
//when searching in MS Global mode with all locations being stored on the main blog, blog_id becomes redundant as locations are stored in one blog table set
$array['blog'] = false;
} elseif ((!is_admin() || defined('DOING_AJAX')) && empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_locations')) {
//if enabled, by default we display all blog locations on main site
$array['blog'] = false;
}
}
$array['eventful'] = !empty($array['eventful']) && $array['eventful'] == true;
$array['eventless'] = !empty($array['eventless']) && $array['eventless'] == true;
if (is_admin() && !defined('DOING_AJAX')) {
$defaults['owner'] = !current_user_can('read_others_locations') ? get_current_user_id() : false;
}
return apply_filters('em_locations_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
}
示例2: array
function get_default_search($array = array())
{
self::$context = EM_POST_TYPE_LOCATION;
$defaults = array('eventful' => false, 'eventless' => false, 'orderby' => 'location_name', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'status' => 1, 'scope' => 'all', 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_locations'), 'private_only' => false, 'post_id' => false);
if (EM_MS_GLOBAL && get_site_option('dbem_ms_mainblog_locations')) {
//when searching in MS Global mode with all locations being stored on the main blog, blog_id becomes redundant as locations are stored in one blog table set
$array['blog'] = false;
}
$array['eventful'] = !empty($array['eventful']) && $array['eventful'] == true;
$array['eventless'] = !empty($array['eventless']) && $array['eventless'] == true;
if (is_admin()) {
$defaults['owner'] = !current_user_can('read_others_locations') ? get_current_user_id() : false;
}
return apply_filters('em_locations_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
}