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


PHP EM_Events::get_post_search方法代码示例

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


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

示例1: is_numeric

$args['page'] = !empty($_REQUEST['pno']) && is_numeric($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
if ($events_count > 0) {
    //If there's a search, let's change the pagination a little here
    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_events') {
        $args['pagination'] = false;
        if (get_option('dbem_event_list_groupby')) {
            $args['mode'] = get_option('dbem_event_list_groupby');
            $args['date_format'] = get_option('dbem_event_list_groupby_format');
            echo em_events_list_grouped($args);
        } else {
            echo EM_Events::output($args);
        }
        //do some custom pagination (if needed/requested)
        if (!empty($args['limit']) && $events_count > $args['limit']) {
            //Show the pagination links (unless there's less than $limit events), note that we set em_search instead of search to prevent conflicts
            $search_args = array_merge(EM_Events::get_post_search(), array('pno' => '%PAGE%', 'action' => 'search_events', 'search' => null, 'em_search' => $args['search']));
            $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], $search_args, false);
            //don't html encode, so em_paginate does its thing
            echo apply_filters('em_events_output_pagination', em_paginate($page_link_template, $events_count, $args['limit'], $args['pno']), $page_link_template, $events_count, $args['limit'], $args['pno']);
        }
    } else {
        if (get_option('dbem_event_list_groupby')) {
            $args['mode'] = get_option('dbem_event_list_groupby');
            $args['date_format'] = get_option('dbem_event_list_groupby_format');
            echo em_events_list_grouped($args);
        } else {
            echo EM_Events::output($args);
        }
    }
} else {
    echo get_option('dbem_no_events_message');
开发者ID:interfisch,项目名称:lm,代码行数:31,代码来源:events-list.php

示例2: 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

示例3: get


//.........这里部分代码省略.........
         $year_pre = $year;
         $year_post = $year + 1;
     } else {
         $month_pre = $month - 1;
         $month_post = $month + 1;
         $year_pre = $year;
         $year_post = $year;
     }
     $args['year'] = array($year_pre, $year_post);
     $args['month'] = array($month_pre, $month_post);
     $events = EM_Events::get($args);
     $event_format = get_option('dbem_full_calendar_event_format');
     $event_title_format = get_option('dbem_small_calendar_event_title_format');
     $event_title_separator_format = get_option('dbem_small_calendar_event_title_separator');
     $eventful_days = array();
     if ($events) {
         //Go through the events and slot them into the right d-m index
         foreach ($events as $event) {
             $event = apply_filters('em_calendar_output_loop_start', $event);
             if ($long_events) {
                 //If $long_events is set then show a date as eventful if there is an multi-day event which runs during that day
                 $event_start_date = strtotime($event->start_date);
                 $event_end_date = mktime(0, 0, 0, $month_post, date('t', $event_start_date), $year_post);
                 if ($event_end_date == '') {
                     $event_end_date = $event_start_date;
                 }
                 while ($event_start_date <= $event->end) {
                     //Ensure date is within event dates, if so add to eventful days array
                     $event_eventful_date = date('Y-m-d', $event_start_date);
                     if (array_key_exists($event_eventful_date, $eventful_days) && is_array($eventful_days[$event_eventful_date])) {
                         $eventful_days[$event_eventful_date][] = $event;
                     } else {
                         $eventful_days[$event_eventful_date] = array($event);
                     }
                     $event_start_date += 86400;
                     //add a day
                 }
             } else {
                 //Only show events on the day that they start
                 if (isset($eventful_days[$event->event_start_date]) && is_array($eventful_days[$event->event_start_date])) {
                     $eventful_days[$event->event_start_date][] = $event;
                 } else {
                     $eventful_days[$event->event_start_date] = array($event);
                 }
             }
         }
     }
     //generate a link argument string containing event search only
     $day_link_args = self::get_link_args(array_intersect_key($original_args, EM_Events::get_post_search($args, true)));
     foreach ($eventful_days as $day_key => $events) {
         if (array_key_exists($day_key, $calendar_array['cells'])) {
             //Get link title for this date
             $events_titles = array();
             foreach ($events as $event) {
                 if (!get_option('dbem_display_calendar_events_limit') || count($events_titles) < get_option('dbem_display_calendar_events_limit')) {
                     $events_titles[] = $event->output($event_title_format);
                 } else {
                     $events_titles[] = get_option('dbem_display_calendar_events_limit_msg');
                     break;
                 }
             }
             $calendar_array['cells'][$day_key]['link_title'] = implode($event_title_separator_format, $events_titles);
             //Get the link to this calendar day
             global $wp_rewrite;
             if (count($events) > 1 || !get_option('dbem_calendar_direct_links')) {
                 if (get_option("dbem_events_page") > 0) {
                     $event_page_link = get_permalink(get_option("dbem_events_page"));
                     //PAGE URI OF EM
                 } else {
                     if ($wp_rewrite->using_permalinks()) {
                         $event_page_link = trailingslashit(home_url()) . EM_POST_TYPE_EVENT_SLUG . '/';
                         //don't use EM_URI here, since ajax calls this before EM_URI is defined.
                     } else {
                         $event_page_link = trailingslashit(home_url()) . '?post_type=' . EM_POST_TYPE_EVENT;
                         //don't use EM_URI here, since ajax calls this before EM_URI is defined.
                     }
                 }
                 if ($wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS')) {
                     $calendar_array['cells'][$day_key]['link'] = trailingslashit($event_page_link) . $day_key . "/";
                     if (!empty($day_link_args)) {
                         $calendar_array['cells'][$day_key]['link'] .= '?' . $day_link_args;
                     }
                 } else {
                     $joiner = stristr($event_page_link, "?") ? "&amp;" : "?";
                     $calendar_array['cells'][$day_key]['link'] = $event_page_link . $joiner . "calendar_day=" . $day_key;
                     if (!empty($day_link_args)) {
                         $calendar_array['cells'][$day_key]['link'] .= '&amp;' . $day_link_args;
                     }
                 }
             } else {
                 foreach ($events as $EM_Event) {
                     $calendar_array['cells'][$day_key]['link'] = $EM_Event->get_permalink();
                 }
             }
             //Add events to array
             $calendar_array['cells'][$day_key]['events'] = $events;
         }
     }
     return apply_filters('em_calendar_get', $calendar_array, $args);
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:101,代码来源:em-calendar.php

示例4: em_init_actions


//.........这里部分代码省略.........
                echo apply_filters('em_ajax_search_towns', $return);
                exit;
            } else {
                echo EM_Object::json_encode($results);
                exit;
            }
        }
        if ($_REQUEST['action'] == 'search_regions') {
            if (!empty($_REQUEST['country'])) {
                $conds[] = $wpdb->prepare("(location_country = '%s' OR location_country IS NULL )", $_REQUEST['country']);
            }
            $cond = count($conds) > 0 ? "AND " . implode(' AND ', $conds) : '';
            $results = $wpdb->get_results("SELECT DISTINCT location_region AS value FROM " . EM_LOCATIONS_TABLE . " WHERE location_region IS NOT NULL AND location_region != '' {$cond}  ORDER BY location_region");
            if ($_REQUEST['return_html']) {
                //quick shortcut for quick html form manipulation
                ob_start();
                ?>
				<option value=''><?php 
                echo get_option('dbem_search_form_regions_label');
                ?>
</option>
				<?php 
                foreach ($results as $result) {
                    echo "<option>{$result->value}</option>";
                }
                $return = ob_get_clean();
                echo apply_filters('em_ajax_search_regions', $return);
                exit;
            } else {
                echo EM_Object::json_encode($results);
                exit;
            }
        } elseif ($_REQUEST['action'] == 'search_events' && get_option('dbem_events_page_search') && defined('DOING_AJAX')) {
            $args = EM_Events::get_post_search();
            $args['owner'] = false;
            ob_start();
            em_locate_template('templates/events-list.php', true, array('args' => $args));
            //if successful, this template overrides the settings and defaults, including search
            echo apply_filters('em_ajax_search_events', ob_get_clean(), $args);
            exit;
        }
    }
    //EM Ajax requests require this flag.
    if (is_user_logged_in()) {
        //Admin operations
        //Specific Oject Ajax
        if (!empty($_REQUEST['em_obj'])) {
            switch ($_REQUEST['em_obj']) {
                case 'em_bookings_events_table':
                case 'em_bookings_pending_table':
                case 'em_bookings_confirmed_table':
                    //add some admin files just in case
                    include_once 'admin/bookings/em-confirmed.php';
                    include_once 'admin/bookings/em-events.php';
                    include_once 'admin/bookings/em-pending.php';
                    call_user_func($_REQUEST['em_obj']);
                    exit;
                    break;
            }
        }
    }
    //Export CSV - WIP
    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'export_bookings_csv' && wp_verify_nonce($_REQUEST['_wpnonce'], 'export_bookings_csv')) {
        //sort out cols
        if (!empty($_REQUEST['cols']) && is_array($_REQUEST['cols'])) {
            $cols = array();
开发者ID:rajankz,项目名称:webspace,代码行数:67,代码来源:em-actions.php

示例5: 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

示例6: get


//.........这里部分代码省略.........
                 $event_end_ts = strtotime($event['event_end_date']);
                 $event_end_ts = $event_end_ts > $scope_datetime_end->format('U') ? $scope_datetime_end->format('U') : $event_end_ts;
                 while ($event_start_ts <= $event_end_ts) {
                     //we loop until the last day of our time-range, not the end date of the event, which could be in a year
                     //Ensure date is within event dates and also within the limits of events to show per day, if so add to eventful days array
                     $event_eventful_date = date('Y-m-d', $event_start_ts);
                     if (empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit) {
                         //now we know this is an event that'll be used, convert it to an object
                         $EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : ($EM_Event = em_get_event($event['post_id'], 'post_id'));
                         if (empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date])) {
                             $eventful_days[$event_eventful_date] = array();
                         }
                         //add event to array with a corresponding timestamp for sorting of times including long and all-day events
                         $event_ts_marker = $EM_Event->event_all_day ? 0 : (int) strtotime($event_eventful_date . ' ' . $EM_Event->event_start_time);
                         while (!empty($eventful_days[$event_eventful_date][$event_ts_marker])) {
                             $event_ts_marker++;
                             //add a second
                         }
                         $eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
                     }
                     //count events for that day
                     $eventful_days_count[$event_eventful_date] = empty($eventful_days_count[$event_eventful_date]) ? 1 : $eventful_days_count[$event_eventful_date] + 1;
                     $event_start_ts += 86400;
                     //add a day
                 }
             } else {
                 //Only show events on the day that they start
                 $event_eventful_date = $event['event_start_date'];
                 if (empty($eventful_days_count[$event_eventful_date]) || !$limit || $eventful_days_count[$event_eventful_date] < $limit) {
                     $EM_Event = EM_MS_GLOBAL ? em_get_event($event['post_id'], $event['blog_id']) : em_get_event($event['post_id'], 'post_id');
                     if (empty($eventful_days[$event_eventful_date]) || !is_array($eventful_days[$event_eventful_date])) {
                         $eventful_days[$event_eventful_date] = array();
                     }
                     //add event to array with a corresponding timestamp for sorting of times including long and all-day events
                     $event_ts_marker = $EM_Event->event_all_day ? 0 : (int) $EM_Event->start;
                     while (!empty($eventful_days[$event_eventful_date][$event_ts_marker])) {
                         $event_ts_marker++;
                         //add a second
                     }
                     $eventful_days[$event_eventful_date][$event_ts_marker] = $EM_Event;
                 }
                 //count events for that day
                 $eventful_days_count[$event['event_start_date']] = empty($eventful_days_count[$event['event_start_date']]) ? 1 : $eventful_days_count[$event['event_start_date']] + 1;
             }
         }
     }
     //generate a link argument string containing event search only
     $day_link_args = self::get_link_args(array_intersect_key($original_args, EM_Events::get_post_search($args, true)));
     foreach ($eventful_days as $day_key => $events) {
         if (array_key_exists($day_key, $calendar_array['cells'])) {
             //Get link title for this date
             $events_titles = array();
             foreach ($events as $event) {
                 if (!$limit || count($events_titles) < $limit) {
                     $events_titles[] = $event->output($event_title_format);
                 } else {
                     $events_titles[] = get_option('dbem_display_calendar_events_limit_msg');
                     break;
                 }
             }
             $calendar_array['cells'][$day_key]['link_title'] = implode($event_title_separator_format, $events_titles);
             //Get the link to this calendar day
             global $wp_rewrite;
             if ($eventful_days_count[$day_key] > 1 || !get_option('dbem_calendar_direct_links')) {
                 if (get_option("dbem_events_page") > 0) {
                     $event_page_link = get_permalink(get_option("dbem_events_page"));
                     //PAGE URI OF EM
                 } else {
                     if ($wp_rewrite->using_permalinks()) {
                         $event_page_link = trailingslashit(home_url()) . EM_POST_TYPE_EVENT_SLUG . '/';
                         //don't use EM_URI here, since ajax calls this before EM_URI is defined.
                     } else {
                         $event_page_link = trailingslashit(home_url()) . '?post_type=' . EM_POST_TYPE_EVENT;
                         //don't use EM_URI here, since ajax calls this before EM_URI is defined.
                     }
                 }
                 if ($wp_rewrite->using_permalinks() && !defined('EM_DISABLE_PERMALINKS')) {
                     $calendar_array['cells'][$day_key]['link'] = trailingslashit($event_page_link) . $day_key . "/";
                     if (!empty($day_link_args)) {
                         $calendar_array['cells'][$day_key]['link'] .= '?' . $day_link_args;
                     }
                 } else {
                     $joiner = stristr($event_page_link, "?") ? "&amp;" : "?";
                     $calendar_array['cells'][$day_key]['link'] = $event_page_link . $joiner . "calendar_day=" . $day_key;
                     if (!empty($day_link_args)) {
                         $calendar_array['cells'][$day_key]['link'] .= '&amp;' . $day_link_args;
                     }
                 }
             } else {
                 foreach ($events as $EM_Event) {
                     $calendar_array['cells'][$day_key]['link'] = $EM_Event->get_permalink();
                 }
             }
             //Add events to array
             $calendar_array['cells'][$day_key]['events_count'] = $eventful_days_count[$day_key];
             $calendar_array['cells'][$day_key]['events'] = $events;
         }
     }
     return apply_filters('em_calendar_get', $calendar_array, $args);
 }
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:101,代码来源:em-calendar.php

示例7: get_option

 * 
 * $args - the args passed onto EM_Events::output()
 * 
 */
$events = EM_Events::get(apply_filters('em_content_events_args', $args));
$args['limit'] = get_option('dbem_events_default_limit');
//since we are passing this info to an output function or template, we should get all the events first
$args['page'] = !empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 1;
$events_count = count($events);
if (get_option('dbem_events_page_search')) {
    em_locate_template('templates/events-search.php', true);
}
if ($events_count > 0) {
    //If there's a search, let's change the pagination a little here
    if (!empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'search_events')) {
        $args['pagination'] = false;
        echo EM_Events::output($events, $args);
        //do some custom pagination (if needed/requested)
        if (!empty($args['limit']) && $events_count > $args['limit']) {
            //Show the pagination links (unless there's less than $limit events)
            $search_args = EM_Events::get_post_search() + array('page' => '%PAGE%', '_wpnonce' => $_REQUEST['_wpnonce']);
            $page_link_template = preg_replace('/(&|\\?)page=\\d+/i', '', $_SERVER['REQUEST_URI']);
            $page_link_template = em_add_get_params($page_link_template, $search_args);
            echo apply_filters('em_events_output_pagination', em_paginate($page_link_template, $events_count, $args['limit'], $args['page']), $page_link_template, $events_count, $args['limit'], $args['page']);
        }
    } else {
        echo EM_Events::output($events, $args);
    }
} else {
    echo get_option('dbem_no_events_message');
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:31,代码来源:events-list.php

示例8: em_init_actions


//.........这里部分代码省略.........
                die;
            }
        }
        if ($result && defined('DOING_AJAX')) {
            $return = array('result' => true, 'message' => $EM_Booking->feedback_message);
            echo EM_Object::json_encode($return);
            die;
        } elseif (!$result && defined('DOING_AJAX')) {
            $return = array('result' => false, 'message' => $EM_Booking->feedback_message, 'errors' => $EM_Notices->get_errors());
            echo EM_Object::json_encode($return);
            die;
        }
    } elseif (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'booking_add' && !is_user_logged_in() && !get_option('dbem_bookings_anonymous')) {
        $EM_Notices->add_error(__('You must log in before you make a booking.', 'dbem'));
        if (!$result && defined('DOING_AJAX')) {
            $return = array('result' => false, 'message' => $EM_Booking->feedback_message, 'errors' => $EM_Notices->get_errors());
            echo EM_Object::json_encode($return);
        }
        die;
    }
    //AJAX call for searches
    if (!empty($_REQUEST['action']) && substr($_REQUEST['action'], 0, 6) == 'search') {
        if ($_REQUEST['action'] == 'search_states' && wp_verify_nonce($_REQUEST['_wpnonce'], 'search_states')) {
            if (!empty($_REQUEST['country'])) {
                $results = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_state AS value, location_country AS country, CONCAT(location_state, ', ', location_country) AS label FROM " . EM_LOCATIONS_TABLE . " WHERE location_state IS NOT NULL AND location_state != '' AND location_country=%s", $_REQUEST['country']));
            } elseif (!empty($_REQUEST['region'])) {
                $results = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_state AS value, location_country AS country, CONCAT(location_state, ', ', location_country) AS label FROM " . EM_LOCATIONS_TABLE . " WHERE location_state IS NOT NULL AND location_state != '' AND location_region=%s", $_REQUEST['region']));
            } else {
                $results = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_state AS value, location_country AS country, CONCAT(location_state, ', ', location_country) AS label FROM " . EM_LOCATIONS_TABLE, $_REQUEST['country'] . "WHERE  location_state IS NOT NULL AND location_state != ''"));
            }
            if ($_REQUEST['return_html']) {
                //quick shortcut for quick html form manipulation
                ob_start();
                ?>
				<option value=''><?php 
                _e('All States', 'dbem');
                ?>
</option>
				<?php 
                foreach ($results as $result) {
                    echo "<option>{$result->value}</option>";
                }
                $return = ob_get_clean();
                echo apply_filters('em_ajax_search_states', $return);
                exit;
            } else {
                echo EM_Object::json_encode($results);
                exit;
            }
        }
        if ($_REQUEST['action'] == 'search_regions' && wp_verify_nonce($_REQUEST['_wpnonce'], 'search_regions')) {
            if (!empty($_REQUEST['country'])) {
                $results = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_region AS value, location_country AS country, CONCAT(location_region, ', ', location_country) AS label FROM " . EM_LOCATIONS_TABLE . " WHERE location_region IS NOT NULL AND location_region != '' AND location_country=%s", $_REQUEST['country']));
            } else {
                $results = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_region AS value, location_country AS country, CONCAT(location_region, ', ', location_country) AS label FROM " . EM_LOCATIONS_TABLE . " WHERE location_region IS NOT NULL AND location_region != ''", $_REQUEST['country']));
            }
            if ($_REQUEST['return_html']) {
                //quick shortcut for quick html form manipulation
                ob_start();
                ?>
				<option value=''><?php 
                _e('All Regions', 'dbem');
                ?>
</option>
				<?php 
                foreach ($results as $result) {
                    echo "<option>{$result->value}</option>";
                }
                $return = ob_get_clean();
                echo apply_filters('em_ajax_search_regions', $return);
                exit;
            } else {
                echo EM_Object::json_encode($results);
                exit;
            }
        } elseif ($_REQUEST['action'] == 'search_events' && wp_verify_nonce($_POST['_wpnonce'], 'search_events') && get_option('dbem_events_page_search')) {
            $args = EM_Events::get_post_search();
            ob_start();
            em_locate_template('templates/events-list.php', true, array('args' => $args));
            //if successful, this template overrides the settings and defaults, including search
            echo apply_filters('em_ajax_search_events', ob_get_clean(), $args);
            exit;
        }
    }
    //EM Ajax requests require this flag.
    if (is_admin() && is_user_logged_in()) {
        //Admin operations
        //Specific Oject Ajax
        if (!empty($_REQUEST['em_obj'])) {
            switch ($_REQUEST['em_obj']) {
                case 'em_bookings_events_table':
                case 'em_bookings_pending_table':
                case 'em_bookings_confirmed_table':
                    call_user_func($_REQUEST['em_obj']);
                    break;
            }
            die;
        }
    }
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:em-actions.php

示例9: 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');
    $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);
    if (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))) {
        $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 ($wp_query->get('bookings_page') && empty($my_bookings_page_id)) {
                    //Bookings Page
                    em_locate_template('templates/my-bookings.php', true);
                } 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
                        $args['scope'] = get_option('dbem_events_page_scope');
                        if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'search_events') {
                            $args = EM_Events::get_post_search(array_merge($args, $_REQUEST));
                        }
                        em_locate_template('templates/events-list.php', true, array('args' => $args));
                    }
                }
            } 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');
                if (EM_MS_GLOBAL && is_object($EM_Location)) {
                    em_locate_template('templates/location-single.php', true, array('args' => $args));
                } else {
                    em_locate_template('templates/locations-list.php', true, array('args' => $args));
                }
            } elseif ($post->ID == $categories_page_id && $categories_page_id != 0) {
                $args['orderby'] = get_option('dbem_categories_default_orderby');
                $args['order'] = get_option('dbem_categories_default_order');
                em_locate_template('templates/categories-list.php', true, array('args' => $args));
            } elseif ($post->ID == $edit_events_page_id && $edit_events_page_id != 0) {
                em_events_admin();
            } elseif ($post->ID == $edit_locations_page_id && $edit_locations_page_id != 0) {
                em_locations_admin();
            } elseif ($post->ID == $edit_bookings_page_id && $edit_bookings_page_id != 0) {
                em_bookings_admin();
            } elseif ($post->ID == $my_bookings_page_id && $my_bookings_page_id != 0) {
                em_my_bookings();
            }
            $content = ob_get_clean();
            //If disable rewrite flag is on, then we need to add a placeholder here
            if (get_option('dbem_disable_title_rewrites') == 1) {
                $content = str_replace('#_PAGETITLE', em_content_page_title(''), get_option('dbem_title_html')) . $content;
            }
            //Now, we either replace CONTENTS or just replace the whole page
            if (preg_match('/CONTENTS/', $page_content)) {
                $content = str_replace('CONTENTS', $content, $page_content);
            }
            if (get_option('dbem_credits')) {
                $content .= '<p style="color:#999; font-size:11px;">Powered by <a href="http://wp-events-plugin.com" style="color:#999;" target="_blank">Events Manager</a></p>';
            }
        }
        return apply_filters('em_content', '<div id="em-wrapper">' . $content . '</div>');
    }
    return $page_content;
}
开发者ID:hscale,项目名称:webento,代码行数:89,代码来源:em-events.php

示例10: 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)
{
    $events_page_id = get_option('dbem_events_page');
    if (get_the_ID() == $events_page_id && $events_page_id != 0) {
        /*
        echo "<h2>WP_REWRITE</h2>";
        echo "<pre>";
        global $wp_rewrite;
        print_r($wp_rewrite);
        echo "</pre>";
        echo "<h2>WP_QUERY</h2>";
        echo "<pre>";
        global $wp_query;
        print_r($wp_query->query_vars);
        echo "</pre>";
        die();
        */
        global $wpdb, $wp_query, $EM_Event, $EM_Location, $EM_Category;
        //general defaults
        $args = array('owner' => false, 'pagination' => 1);
        $content = apply_filters('em_content_pre', '', $page_content);
        if (empty($content)) {
            ob_start();
            if (!empty($_REQUEST['calendar_day'])) {
                //Events for a specific day
                em_locate_template('templates/calendar-day.php', true, array('args' => $args));
            } elseif (is_object($EM_Location)) {
                //Just a single location
                em_locate_template('templates/location-single.php', true);
            } elseif (is_object($EM_Category)) {
                //Just a single category
                em_locate_template('templates/category-single.php', true);
            } elseif ($wp_query->get('bookings_page')) {
                //Bookings Page
                em_locate_template('templates/my-bookings.php', true);
            } elseif (is_object($EM_Event)) {
                // single event page
                em_locate_template('templates/event-single.php', true, array('args' => $args));
            } elseif (!empty($_REQUEST['event_locations'])) {
                $args['orderby'] = get_option('dbem_locations_default_orderby');
                $args['order'] = get_option('dbem_locations_default_order');
                em_locate_template('templates/locations-list.php', true, array('args' => $args));
            } elseif (!empty($_REQUEST['event_categories'])) {
                $args['orderby'] = get_option('dbem_categories_default_orderby');
                $args['order'] = get_option('dbem_categories_default_order');
                em_locate_template('templates/categories-list.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
                    $args['scope'] = get_option('dbem_events_page_scope');
                    if (!empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'search_events') && get_option('dbem_events_page_search')) {
                        $args = EM_Events::get_post_search($args);
                    }
                    em_locate_template('templates/events-list.php', true, array('args' => $args));
                }
            }
            $content = ob_get_clean();
        }
        //If disable rewrite flag is on, then we need to add a placeholder here
        if (get_option('dbem_disable_title_rewrites') == 1) {
            $content = str_replace('#_PAGETITLE', em_content_page_title(''), get_option('dbem_title_html')) . $content;
        }
        //Now, we either replace CONTENTS or just replace the whole page
        if (preg_match('/CONTENTS/', $page_content)) {
            $content = str_replace('CONTENTS', $content, $page_content);
        }
        if (get_option('dbem_credits')) {
            $content .= '<p style="color:#999; font-size:11px;">Powered by <a href="http://wp-events-plugin.com" style="color:#999;" target="_blank">Events Manager</a></p>';
        }
        //TODO FILTER - filter em page content before display
        return apply_filters('em_content', '<div id="em-wrapper">' . $content . '</div>');
    }
    return $page_content;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:85,代码来源:em-events.php

示例11: icl_ls_languages

 /**
  * Hooks into icl_ls_languages and fixes links for when viewing an events list page specific to a calendar day.
  * @param array $langs
  * @return array
  */
 public static function icl_ls_languages($langs)
 {
     global $wp_rewrite;
     //modify the URL if we're dealing with calendar day URLs
     if (!empty($_REQUEST['calendar_day']) && preg_match('/\\d{4}-\\d{2}-\\d{2}/', $_REQUEST['calendar_day'])) {
         $query_args = EM_Calendar::get_query_args(array_intersect_key(EM_Calendar::get_default_search($_GET), EM_Events::get_post_search($_GET, true)));
         if ($wp_rewrite->using_permalinks()) {
             //if using rewrites, add as a slug
             foreach ($langs as $lang => $lang_array) {
                 $lang_url_parts = explode('?', $lang_array['url']);
                 $lang_url_parts[0] = trailingslashit($lang_url_parts[0]) . $_REQUEST['calendar_day'] . '/';
                 $langs[$lang]['url'] = esc_url_raw(add_query_arg($query_args, implode('?', $lang_url_parts)));
             }
         } else {
             $query_args['calendar_day'] = $_REQUEST['calendar_day'];
             foreach ($langs as $lang => $lang_array) {
                 $langs[$lang]['url'] = esc_url_raw(add_query_arg($query_args, $lang_array['url']));
             }
         }
     }
     return $langs;
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:27,代码来源:events-manager-wpml.php


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