当前位置: 首页>>代码示例>>PHP>>正文


PHP EM_Locations::get_post_search方法代码示例

本文整理汇总了PHP中EM_Locations::get_post_search方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Locations::get_post_search方法的具体用法?PHP EM_Locations::get_post_search怎么用?PHP EM_Locations::get_post_search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EM_Locations的用法示例。


在下文中一共展示了EM_Locations::get_post_search方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: em_content

/**
 * Filters for page content and if an event replaces it with the relevant event data.
 * @param $data
 * @return string
 */
function em_content($page_content)
{
    global $post, $wpdb, $wp_query, $EM_Event, $EM_Location, $EM_Category;
    if (empty($post)) {
        return $page_content;
    }
    //fix for any other plugins calling the_content outside the loop
    $events_page_id = get_option('dbem_events_page');
    $locations_page_id = get_option('dbem_locations_page');
    $categories_page_id = get_option('dbem_categories_page');
    $tags_page_id = get_option('dbem_tags_page');
    $edit_events_page_id = get_option('dbem_edit_events_page');
    $edit_locations_page_id = get_option('dbem_edit_locations_page');
    $edit_bookings_page_id = get_option('dbem_edit_bookings_page');
    $my_bookings_page_id = get_option('dbem_my_bookings_page');
    //general defaults
    $args = array('owner' => false, 'pagination' => 1);
    $args['ajax'] = isset($args['ajax']) ? $args['ajax'] : !defined('EM_AJAX') || EM_AJAX;
    if (!post_password_required() && in_array($post->ID, array($events_page_id, $locations_page_id, $categories_page_id, $edit_bookings_page_id, $edit_events_page_id, $edit_locations_page_id, $my_bookings_page_id, $tags_page_id))) {
        $content = apply_filters('em_content_pre', '', $page_content);
        if (empty($content)) {
            ob_start();
            if ($post->ID == $events_page_id && $events_page_id != 0) {
                if (!empty($_REQUEST['calendar_day'])) {
                    //Events for a specific day
                    $args = EM_Events::get_post_search(array_merge($args, $_REQUEST));
                    em_locate_template('templates/calendar-day.php', true, array('args' => $args));
                } elseif (is_object($EM_Event)) {
                    em_locate_template('templates/event-single.php', true, array('args' => $args));
                } else {
                    // Multiple events page
                    $args['orderby'] = get_option('dbem_events_default_orderby');
                    $args['order'] = get_option('dbem_events_default_order');
                    if (get_option('dbem_display_calendar_in_events_page')) {
                        $args['long_events'] = 1;
                        em_locate_template('templates/events-calendar.php', true, array('args' => $args));
                    } else {
                        //Intercept search request, if defined
                        if (!empty($_REQUEST['action']) && ($_REQUEST['action'] == 'search_events' || $_REQUEST['action'] == 'search_events_grouped')) {
                            $args = EM_Events::get_post_search(array_merge($args, $_REQUEST));
                        }
                        if (empty($args['scope'])) {
                            $args['scope'] = get_option('dbem_events_page_scope');
                        }
                        if (get_option('dbem_events_page_search_form')) {
                            //load the search form and pass on custom arguments (from settings page)
                            $search_args = em_get_search_form_defaults();
                            em_locate_template('templates/events-search.php', true, array('args' => $search_args));
                        }
                        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit');
                        if (!empty($args['ajax'])) {
                            echo '<div class="em-search-ajax">';
                        }
                        //AJAX wrapper open
                        if (get_option('dbem_event_list_groupby')) {
                            em_locate_template('templates/events-list-grouped.php', true, array('args' => $args));
                        } else {
                            em_locate_template('templates/events-list.php', true, array('args' => $args));
                        }
                        if (!empty($args['ajax'])) {
                            echo "</div>";
                        }
                        //AJAX wrapper close
                    }
                }
            } elseif ($post->ID == $locations_page_id && $locations_page_id != 0) {
                $args['orderby'] = get_option('dbem_locations_default_orderby');
                $args['order'] = get_option('dbem_locations_default_order');
                $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_locations_default_limit');
                if (EM_MS_GLOBAL && is_object($EM_Location)) {
                    em_locate_template('templates/location-single.php', true, array('args' => $args));
                } else {
                    //Intercept search request, if defined
                    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_locations') {
                        $args = EM_Locations::get_post_search(array_merge($args, $_REQUEST));
                    }
                    if (get_option('dbem_locations_page_search_form')) {
                        //load the search form and pass on custom arguments (from settings page)
                        $search_args = em_get_search_form_defaults();
                        //remove date and category
                        $search_args['search_categories'] = $search_args['search_scope'] = false;
                        em_locate_template('templates/locations-search.php', true, array('args' => $search_args));
                    }
                    if (!empty($args['ajax'])) {
                        echo '<div class="em-search-ajax">';
                    }
                    //AJAX wrapper open
                    em_locate_template('templates/locations-list.php', true, array('args' => $args));
                    if (!empty($args['ajax'])) {
                        echo "</div>";
                    }
                    //AJAX wrapper close
                }
            } elseif ($post->ID == $categories_page_id && $categories_page_id != 0) {
                $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_categories_default_limit');
//.........这里部分代码省略.........
开发者ID:javipaur,项目名称:TiendaVirtual,代码行数:101,代码来源:em-events.php

示例2: em_ajax_search_and_pagination

/**
 * Handles AJAX Searching and Pagination for events, locations, tags and categories
 */
function em_ajax_search_and_pagination()
{
    $args = array('owner' => false, 'pagination' => 1, 'ajax' => true);
    if (empty($args['scope'])) {
        $args['scope'] = get_option('dbem_events_page_scope');
    }
    echo '<div class="em-search-ajax">';
    ob_start();
    if ($_REQUEST['action'] == 'search_events') {
        $args = EM_Events::get_post_search($args);
        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit');
        em_locate_template('templates/events-list.php', true, array('args' => $args));
        //if successful, this template overrides the settings and defaults, including search
    } elseif ($_REQUEST['action'] == 'search_events_grouped' && defined('DOING_AJAX')) {
        $args = EM_Events::get_post_search($args);
        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_events_default_limit');
        em_locate_template('templates/events-list-grouped.php', true, array('args' => $args));
        //if successful, this template overrides the settings and defaults, including search
    } elseif ($_REQUEST['action'] == 'search_locations' && defined('DOING_AJAX')) {
        $args = EM_Locations::get_post_search($args);
        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_locations_default_limit');
        em_locate_template('templates/locations-list.php', true, array('args' => $args));
        //if successful, this template overrides the settings and defaults, including search
    } elseif ($_REQUEST['action'] == 'search_tags' && defined('DOING_AJAX')) {
        $args = EM_Tags::get_post_search($args);
        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_tags_default_limit');
        em_locate_template('templates/tags-list.php', true, array('args' => $args));
        //if successful, this template overrides the settings and defaults, including search
    } elseif ($_REQUEST['action'] == 'search_cats' && defined('DOING_AJAX')) {
        $args = EM_Categories::get_post_search($args);
        $args['limit'] = !empty($args['limit']) ? $args['limit'] : get_option('dbem_categories_default_limit');
        em_locate_template('templates/categories-list.php', true, array('args' => $args));
        //if successful, this template overrides the settings and defaults, including search
    }
    echo '</div>';
    echo apply_filters('em_ajax_' . $_REQUEST['action'], ob_get_clean(), $args);
    exit;
}
开发者ID:batruji,项目名称:metareading,代码行数:41,代码来源:em-actions.php


注:本文中的EM_Locations::get_post_search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。