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


PHP em_get_event函数代码示例

本文整理汇总了PHP中em_get_event函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_event函数的具体用法?PHP em_get_event怎么用?PHP em_get_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_form

 /**
  * @param EM_Booking $EM_Booking
  */
 function get_form($EM_Event = false, $custom_form_id = false)
 {
     //special lookup for multiple bookings
     if (is_object($custom_form_id) && get_class($custom_form_id) == 'EM_Multiple_Booking') {
         $custom_form_id = get_option('dbem_multiple_bookings_form');
     }
     //make sure we don't need to get another form rather than the one already stored in this object
     $reload = is_numeric($EM_Event) && $EM_Event != self::$event_id || !empty($EM_Event->event_id) && $EM_Event->event_id != self::$event_id || empty($EM_Event) && $custom_form_id && $custom_form_id != self::$form_id;
     //get the right form
     if (empty(self::$form) || $reload) {
         global $wpdb;
         if (is_numeric($EM_Event)) {
             $EM_Event = em_get_event($EM_Event);
         }
         $custom_form_id = !empty($EM_Event->post_id) ? get_post_meta($EM_Event->post_id, '_custom_booking_form', true) : $custom_form_id;
         $form_id = !empty($custom_form_id) && is_numeric($custom_form_id) ? $custom_form_id : get_option('em_booking_form_fields');
         $sql = $wpdb->prepare("SELECT meta_id, meta_value FROM " . EM_META_TABLE . " WHERE meta_key = 'booking-form' AND meta_id=%d", $form_id);
         $form_data_row = $wpdb->get_row($sql, ARRAY_A);
         if (empty($form_data_row)) {
             $form_data = self::$form_template;
             self::$form_name = __('Default', 'em-pro');
         } else {
             $form_data = unserialize($form_data_row['meta_value']);
             self::$form_id = $form_data_row['meta_id'];
             self::$form_name = $form_data['name'];
         }
         self::$event_id = !empty($EM_Event) ? $EM_Event->event_id : false;
         self::$form = new EM_Form($form_data['form'], 'em_bookings_form');
         self::$form->form_required_error = get_option('em_booking_form_error_required');
     }
     return self::$form;
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:35,代码来源:bookings-form.php

示例2: redirection

 /**
  * will redirect old links to new link structures.
  */
 public static function redirection()
 {
     global $wpdb, $wp_query;
     if (is_object($wp_query) && $wp_query->get('em_redirect')) {
         //is this a querystring url?
         if ($wp_query->get('event_slug')) {
             $event = $wpdb->get_row('SELECT event_id, post_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get('event_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
             if (!empty($event)) {
                 $EM_Event = em_get_event($event['event_id']);
                 $url = get_permalink($EM_Event->post_id);
             }
         } elseif ($wp_query->get('location_slug')) {
             $location = $wpdb->get_row('SELECT location_id, post_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='" . $wp_query->get('location_slug') . "' AND (blog_id=" . get_current_blog_id() . " OR blog_id IS NULL OR blog_id=0)", ARRAY_A);
             if (!empty($location)) {
                 $EM_Location = em_get_location($location['location_id']);
                 $url = get_permalink($EM_Location->post_id);
             }
         } elseif ($wp_query->get('category_slug')) {
             $url = get_term_link($wp_query->get('category_slug'), EM_TAXONOMY_CATEGORY);
         }
         if (!empty($url)) {
             wp_redirect($url, 301);
             exit;
         }
     }
 }
开发者ID:pcco,项目名称:portal-redesign,代码行数:29,代码来源:em-permalinks.php

示例3: em_get_event_shortcode

/**
 * Shows a list of events according to given specifications. Accepts any event query attribute.
 * @param array $atts
 * @return string
 */
function em_get_event_shortcode($atts, $format = '')
{
    global $EM_Event, $post;
    $the_event = is_object($EM_Event) ? clone $EM_Event : null;
    //save global temporarily
    $atts = (array) $atts;
    $atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
    $atts['format'] = html_entity_decode($atts['format']);
    //shorcode doesn't accept html
    if (!empty($atts['event']) && is_numeric($atts['event'])) {
        $EM_Event = em_get_event($atts['event']);
        $return = !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    } elseif (!empty($atts['post_id']) && is_numeric($atts['post_id'])) {
        $EM_Event = em_get_event($atts['post_id'], 'post_id');
        $return = !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
    //no specific event or post id supplied, check globals
    if (!empty($EM_Event)) {
        $return = !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    } elseif ($post->post_type == EM_POST_TYPE_EVENT) {
        $EM_Event = em_get_event($post->ID, 'post_id');
        $return = !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
    $EM_Event = is_object($the_event) ? $the_event : $EM_Event;
    //reset global
    return $return;
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:32,代码来源:em-shortcode.php

示例4: em_bp_events_format_activity_action_events

/**
 * Not yet used fully - formats event-related actions
 * @param string $action
 * @param object $activity
 * @return string
 */
function em_bp_events_format_activity_action_events($action, $activity)
{
    return '';
    $member_link = bp_core_get_userlink($activity->user_id);
    $EM_Event = em_get_event($activity->item_id);
    $action = sprintf(__('%s added the event %s', 'dbem'), $member_link, $EM_Event->output('#_EVENTLINK'));
    return apply_filters('bp_events_format_activity_action_events', $action, $activity);
}
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:14,代码来源:bp-em-activity.php

示例5: em_ml_admin_original_event_link

 public static function em_ml_admin_original_event_link($link)
 {
     global $EM_Event;
     if (empty($EM_Event->event_id) && !empty($_REQUEST['trid'])) {
         $post_id = SitePress::get_original_element_id_by_trid($_REQUEST['trid']);
         $original_event_link = em_get_event($post_id, 'post_id')->get_edit_url();
     }
     return $link;
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:9,代码来源:em-wpml-admin.php

示例6: the_category

 function the_category($thelist, $separator = '', $parents = '')
 {
     global $post, $wp_rewrite;
     if ($post->post_type == EM_POST_TYPE_EVENT) {
         $EM_Event = em_get_event($post);
         $categories = $EM_Event->get_categories();
         if (empty($categories)) {
             return '';
         }
         /* Copied from get_the_category_list function, with a few minor edits to make urls work, and removing parent stuff (for now) */
         $rel = is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ? 'rel="category tag"' : 'rel="category"';
         $thelist = '';
         if ('' == $separator) {
             $thelist .= '<ul class="post-categories">';
             foreach ($categories as $category) {
                 $thelist .= "\n\t<li>";
                 switch (strtolower($parents)) {
                     case 'multiple':
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>' . $category->name . '</a></li>';
                         break;
                     case 'single':
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>';
                         $thelist .= $category->name . '</a></li>';
                         break;
                     case '':
                     default:
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>' . $category->name . '</a></li>';
                 }
             }
             $thelist .= '</ul>';
         } else {
             $i = 0;
             foreach ($categories as $category) {
                 if (0 < $i) {
                     $thelist .= $separator;
                 }
                 switch (strtolower($parents)) {
                     case 'multiple':
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>' . $category->name . '</a>';
                         break;
                     case 'single':
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>';
                         $thelist .= "{$category->name}</a>";
                         break;
                     case '':
                     default:
                         $thelist .= '<a href="' . $category->get_url() . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '" ' . $rel . '>' . $category->name . '</a>';
                 }
                 ++$i;
             }
         }
         /* End copying */
     }
     return $thelist;
 }
开发者ID:rajankz,项目名称:webspace,代码行数:55,代码来源:em-event-post.php

示例7: em_get_event_shortcode

/**
 * Shows a list of events according to given specifications. Accepts any event query attribute.
 * @param array $atts
 * @return string
 */
function em_get_event_shortcode($atts, $format = '')
{
    $atts = (array) $atts;
    $atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
    $atts['format'] = html_entity_decode($atts['format']);
    //shorcode doesn't accept html
    if (!empty($atts['event']) && is_numeric($atts['event'])) {
        $EM_Event = em_get_event($atts['event']);
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    } elseif (!empty($atts['post_id']) && is_numeric($atts['post_id'])) {
        $EM_Event = em_get_event($atts['post_id'], 'post_id');
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
}
开发者ID:rajankz,项目名称:webspace,代码行数:19,代码来源:em-shortcode.php

示例8: em_ical_event

function em_ical_event()
{
    global $wpdb;
    //add endpoints to events
    if (get_query_var(EM_POST_TYPE_EVENT) && get_query_var('ical')) {
        $event_id = $wpdb->get_var('SELECT event_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . get_query_var(EM_POST_TYPE_EVENT) . "' AND event_status=1 LIMIT 1");
        if (!empty($event_id)) {
            global $EM_Event;
            $EM_Event = em_get_event($event_id);
            ob_start();
            em_locate_template('templates/ical-event.php', true);
            echo preg_replace("/([^\r])\n/", "\$1\r\n", ob_get_clean());
            exit;
        }
    }
}
开发者ID:rajankz,项目名称:webspace,代码行数:16,代码来源:em-ical.php

示例9: em_ical_event

/**
 * Generates an ics file for a single event 
 */
function em_ical_event()
{
    global $wpdb, $wp_query;
    //add endpoints to events
    if (!empty($wp_query) && $wp_query->get(EM_POST_TYPE_EVENT) && $wp_query->get('ical')) {
        $event_id = $wpdb->get_var('SELECT event_id FROM ' . EM_EVENTS_TABLE . " WHERE event_slug='" . $wp_query->get(EM_POST_TYPE_EVENT) . "' AND event_status=1 LIMIT 1");
        if (!empty($event_id)) {
            global $EM_Event;
            $EM_Event = em_get_event($event_id);
            //send headers
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename="' . $EM_Event->event_slug . '.ics"');
            em_locate_template('templates/ical.php', true);
            exit;
        }
    }
}
开发者ID:batruji,项目名称:metareading,代码行数:20,代码来源:em-ical.php

示例10: remove_booking

 function remove_booking($event_id)
 {
     if (!empty($this->bookings[$event_id])) {
         $EM_Event = em_get_event($event_id);
         //remove ticket booking records belonging to this event
         foreach ($EM_Event->get_tickets() as $EM_Ticket) {
             /* @var $EM_Ticket EM_Ticket */
             if (!empty($this->get_tickets_bookings()->tickets_bookings[$EM_Ticket->ticket_id])) {
                 unset($this->get_tickets_bookings()->tickets_bookings[$EM_Ticket->ticket_id]);
             }
         }
         //remove event from bookings array
         unset($this->bookings[$_REQUEST['event_id']]);
         //refresh price and spaces
         $this->calculate_price();
         $this->get_spaces(true);
         return true;
     }
     return false;
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:20,代码来源:multiple-booking.php

示例11: em_get_event_shortcode

/**
 * Shows a list of events according to given specifications. Accepts any event query attribute.
 * @param array $atts
 * @return string
 */
function em_get_event_shortcode($atts, $format = '')
{
    $atts = (array) $atts;
    $atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
    $atts['format'] = html_entity_decode($atts['format']);
    //shorcode doesn't accept html
    if (!empty($atts['event']) && is_numeric($atts['event'])) {
        $EM_Event = em_get_event($atts['event']);
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    } elseif (!empty($atts['post_id']) && is_numeric($atts['post_id'])) {
        $EM_Event = em_get_event($atts['post_id'], 'post_id');
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
    //no specific event or post id supplied, check globals
    global $EM_Event, $post;
    if (!empty($EM_Event)) {
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    } elseif ($post->post_type == EM_POST_TYPE_EVENT) {
        $EM_Event = em_get_event($post->ID, 'post_id');
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
}
开发者ID:hscale,项目名称:webento,代码行数:27,代码来源:em-shortcode.php

示例12: columns_output

 function columns_output($column)
 {
     global $post, $EM_Event;
     if ($post->post_type == 'event-recurring') {
         $post = $EM_Event = em_get_event($post);
         /* @var $post EM_Event */
         switch ($column) {
             case 'event-id':
                 echo $EM_Event->event_id;
                 break;
             case 'location':
                 //get meta value to see if post has location, otherwise
                 $EM_Location = $EM_Event->get_location();
                 if (!empty($EM_Location->location_id)) {
                     echo "<strong>" . $EM_Location->location_name . "</strong><br/>" . $EM_Location->location_address . " - " . $EM_Location->location_town;
                 } else {
                     echo __('None', 'dbem');
                 }
                 break;
             case 'date-time':
                 echo $EM_Event->get_recurrence_description();
                 break;
         }
     }
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:25,代码来源:em-event-posts-admin.php

示例13: get

 /**
  * Returns an array of EM_Events that match the given specs in the argument, or returns a list of future evetnts in future 
  * (see EM_Events::get_default_search() ) for explanation of possible search array values. You can also supply a numeric array
  * containing the ids of the events you'd like to obtain 
  * 
  * @param array $args
  * @return EM_Event array()
  */
 public static function get($args = array(), $count = false)
 {
     global $wpdb;
     $events_table = EM_EVENTS_TABLE;
     $locations_table = EM_LOCATIONS_TABLE;
     //Quick version, we can accept an array of IDs, which is easy to retrieve
     if (self::array_is_numeric($args)) {
         //Array of numbers, assume they are event IDs to retreive
         //We can just get all the events here and return them
         $sql = "\r\n\t\t\t\tSELECT * FROM {$events_table}\r\n\t\t\t\tLEFT JOIN {$locations_table} ON {$locations_table}.location_id={$events_table}.location_id\r\n\t\t\t\tWHERE event_id=" . implode(" OR event_id=", $args) . "\r\n\t\t\t";
         $results = $wpdb->get_results(apply_filters('em_events_get_sql', $sql), ARRAY_A);
         $events = array();
         foreach ($results as $result) {
             $events[$result['event_id']] = new EM_Event($result);
         }
         return $events;
         //We return all the events matched as an EM_Event array.
     }
     //We assume it's either an empty array or array of search arguments to merge with defaults
     $args = self::get_default_search($args);
     $limit = $args['limit'] && is_numeric($args['limit']) ? "LIMIT {$args['limit']}" : '';
     $offset = $limit != "" && is_numeric($args['offset']) ? "OFFSET {$args['offset']}" : '';
     $groupby_sql = '';
     //Get the default conditions
     $conditions = self::build_sql_conditions($args);
     //Put it all together
     $where = count($conditions) > 0 ? " WHERE " . implode(" AND ", $conditions) : '';
     //Get ordering instructions
     $EM_Event = new EM_Event();
     $EM_Location = new EM_Location();
     $orderby = self::build_sql_orderby($args, array_keys(array_merge($EM_Event->fields, $EM_Location->fields)), get_option('dbem_events_default_order'));
     //Now, build orderby sql
     $orderby_sql = count($orderby) > 0 ? 'ORDER BY ' . implode(', ', $orderby) : '';
     //Create the SQL statement and execute
     if (!$count && $args['array']) {
         $selectors_array = array();
         foreach (array_keys($EM_Event->fields) as $field_selector) {
             $selectors_array[] = $events_table . '.' . $field_selector;
         }
         $selectors = implode(',', $selectors_array);
     } elseif (EM_MS_GLOBAL) {
         $selectors = $events_table . '.post_id, ' . $events_table . '.blog_id';
         $groupby_sql[] = $events_table . '.post_id, ' . $events_table . '.blog_id';
     } else {
         $selectors = $events_table . '.post_id';
         $groupby_sql[] = $events_table . '.post_id';
         //prevent duplicates showing in lists
     }
     if ($count) {
         $selectors = 'SQL_CALC_FOUND_ROWS *';
         $limit = 'LIMIT 1';
         $offset = 'OFFSET 0';
     }
     //add group_by if needed
     $groupby_sql = !empty($groupby_sql) && is_array($groupby_sql) ? 'GROUP BY ' . implode(',', $groupby_sql) : '';
     $sql = apply_filters('em_events_get_sql', "\r\n\t\t\tSELECT {$selectors} FROM {$events_table}\r\n\t\t\tLEFT JOIN {$locations_table} ON {$locations_table}.location_id={$events_table}.location_id\r\n\t\t\t{$where}\r\n\t\t\t{$groupby_sql} {$orderby_sql}\r\n\t\t\t{$limit} {$offset}\r\n\t\t", $args);
     //If we're only counting results, return the number of results
     if ($count) {
         $wpdb->query($sql);
         return apply_filters('em_events_get_count', $wpdb->get_var('SELECT FOUND_ROWS()'), $args);
     }
     $results = $wpdb->get_results($sql, ARRAY_A);
     //If we want results directly in an array, why not have a shortcut here?
     if ($args['array'] == true) {
         return apply_filters('em_events_get_array', $results, $args);
     }
     //Make returned results EM_Event objects
     $results = is_array($results) ? $results : array();
     $events = array();
     if (EM_MS_GLOBAL) {
         foreach ($results as $event) {
             $events[] = em_get_event($event['post_id'], $event['blog_id']);
         }
     } else {
         foreach ($results as $event) {
             $events[] = em_get_event($event['post_id'], 'post_id');
         }
     }
     return apply_filters('em_events_get', $events, $args);
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:88,代码来源:em-events.php

示例14: meta_boxes

 public static function meta_boxes()
 {
     global $EM_Event, $post;
     //no need to proceed if we're not dealing with a recurring event
     if ($post->post_type != 'event-recurring') {
         return;
     }
     //since this is the first point when the admin area loads event stuff, we load our EM_Event here
     if (empty($EM_Event) && !empty($post)) {
         $EM_Event = em_get_event($post->ID, 'post_id');
     }
     add_meta_box('em-event-recurring', __('Recurrences', 'events-manager'), array('EM_Event_Recurring_Post_Admin', 'meta_box_recurrence'), 'event-recurring', 'normal', 'high');
     //add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin','meta_box_metadump'),'event-recurring', 'normal','high');
     add_meta_box('em-event-where', __('Where', 'events-manager'), array('EM_Event_Post_Admin', 'meta_box_location'), 'event-recurring', 'normal', 'high');
     if (get_option('dbem_rsvp_enabled') && $EM_Event->can_manage('manage_bookings', 'manage_others_bookings')) {
         add_meta_box('em-event-bookings', __('Bookings/Registration', 'events-manager'), array('EM_Event_Post_Admin', 'meta_box_bookings'), 'event-recurring', 'normal', 'high');
     }
     if (get_option('dbem_attributes_enabled')) {
         add_meta_box('em-event-attributes', __('Attributes', 'events-manager'), array('EM_Event_Post_Admin', 'meta_box_attributes'), 'event-recurring', 'normal', 'default');
     }
     if (EM_MS_GLOBAL && !is_main_site() && get_option('dbem_categories_enabled')) {
         add_meta_box('em-event-categories', __('Site Categories', 'events-manager'), array('EM_Event_Post_Admin', 'meta_box_ms_categories'), 'event-recurring', 'side', 'low');
     }
     if (defined('WP_DEBUG') && WP_DEBUG && defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY) {
         add_meta_box('em-event-meta', 'Event Meta (debugging only)', array('EM_Event_Post_Admin', 'meta_box_metadump'), 'event-recurring', 'normal', 'high');
     }
 }
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:27,代码来源:em-event-post-admin.php

示例15: get_event

 /**
  * Gets the event for this object, or a blank event if none exists
  * @return EM_Event
  */
 function get_event()
 {
     if (is_numeric($this->event_id)) {
         return em_get_event($this->event_id);
     } else {
         return new EM_Event();
     }
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:12,代码来源:em-categories.php


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