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


PHP EM_Event类代码示例

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


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

示例1: 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 = new EM_Event($atts['event']);
        return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
    }
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:16,代码来源:em-shortcode.php

示例2: em_event_added_email

/**
 * @param EM_Event $EM_Event
 * @return string
 */
function em_event_added_email($EM_Event)
{
    if (!$EM_Event->get_status() && get_option('dbem_bookings_approval') && get_option('dbem_event_submitted_email_admin') != '') {
        $admin_emails = explode(',', get_option('dbem_event_submitted_email_admin'));
        //admin emails are in an array, single or multiple
        $subject = $EM_Event->output(get_option('dbem_event_submitted_email_subject'));
        $message = $EM_Event->output(get_option('dbem_event_submitted_email_body'));
        //Send email to admins
        $EM_Event->email_send($subject, $message, $admin_emails);
    }
}
开发者ID:rajankz,项目名称:webspace,代码行数:15,代码来源:em-emails.php

示例3: 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()
  */
 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 = "\n\t\t\t\tSELECT * FROM {$events_table}\n\t\t\t\tLEFT JOIN {$locations_table} ON {$locations_table}.location_id={$events_table}.location_id\n\t\t\t\tWHERE event_id=" . implode(" OR event_id=", $args) . "\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']}" : '';
     //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();
     $accepted_fields = $EM_Event->get_fields(true);
     $orderby = self::build_sql_orderby($args, $accepted_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
     $selectors = $count ? 'COUNT(*)' : '*';
     $sql = "\n\t\t\tSELECT {$selectors} FROM {$events_table}\n\t\t\tLEFT JOIN {$locations_table} ON {$locations_table}.location_id={$events_table}.location_id\n\t\t\t{$where}\n\t\t\t{$orderby_sql}\n\t\t\t{$limit} {$offset}\n\t\t";
     //If we're only counting results, return the number of results
     if ($count) {
         return $wpdb->get_var($sql);
     }
     $results = $wpdb->get_results(apply_filters('em_events_get_sql', $sql, $args), ARRAY_A);
     //If we want results directly in an array, why not have a shortcut here?
     if ($args['array'] == true) {
         return $results;
     }
     //Make returned results EM_Event objects
     $results = is_array($results) ? $results : array();
     $events = array();
     foreach ($results as $event) {
         $events[] = new EM_Event($event);
     }
     return apply_filters('em_events_get', $events, $args);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:60,代码来源:em-events.php

示例4: get

 /**
  * Returns an array of EM_Location objects
  * @param boolean $eventful
  * @param boolean $return_objects
  * @return array
  */
 function get($args = array())
 {
     global $wpdb;
     $events_table = $wpdb->prefix . EM_EVENTS_TABLE;
     $locations_table = $wpdb->prefix . EM_LOCATIONS_TABLE;
     //Quick version, we can accept an array of IDs, which is easy to retrieve
     if (self::array_is_numeric($args) && count()) {
         //Array of numbers, assume they are event IDs to retreive
         //We can just get all the events here and return them
         $sql = "SELECT * FROM {$locations_table} WHERE location_id=" . implode(" OR location_id=", $args);
         $results = $wpdb->get_results($sql, ARRAY_A);
         $events = array();
         foreach ($results as $result) {
             $locations[$result['location_id']] = new EM_Location($result);
         }
         return $locations;
         //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']}" : '';
     //Get the default conditions
     $conditions = self::build_sql_conditions($args);
     //Put it all together
     $EM_Location = new EM_Location(0);
     //Empty class for strict message avoidance
     $fields = $locations_table . "." . implode(", {$locations_table}.", array_keys($EM_Location->fields));
     $where = count($conditions) > 0 ? " WHERE " . implode(" AND ", $conditions) : '';
     //Get ordering instructions
     $EM_Event = new EM_Event();
     //blank event for below
     $accepted_fields = $EM_Location->get_fields(true);
     $accepted_fields = array_merge($EM_Event->get_fields(true), $accepted_fields);
     $orderby = self::build_sql_orderby($args, $accepted_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
     $sql = "\n\t\t\tSELECT {$fields} FROM {$locations_table}\n\t\t\tLEFT JOIN {$events_table} ON {$locations_table}.location_id={$events_table}.location_id\n\t\t\t{$where}\n\t\t\tGROUP BY location_id\n\t\t\t{$orderby_sql}\n\t\t\t{$limit} {$offset}\n\t\t";
     $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 $results;
     }
     $locations = array();
     foreach ($results as $location) {
         $locations[] = new EM_Location($location);
     }
     return apply_filters('em_locations_get', $locations, $args);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:56,代码来源:em-locations.php

示例5: bp_em_group_event_can_manage

/**
 * Overrides the default capability of the user for another owner's event if the user is a group admin and the event belongs to a group. 
 * User must have the relevant permissions globally in order to inherit that capability for this event as well.
 * @param boolean $result
 * @param EM_Event $EM_Event
 */
function bp_em_group_event_can_manage($result, $EM_Event, $owner_capability, $admin_capability, $user_to_check)
{
    if (!$result && $EM_Event->event_owner != get_current_user_id() && !empty($EM_Event->group_id) && bp_is_active('groups')) {
        //only override if already false, incase it's true
        //if the user is an admin of this group, and actually has the relevant permissions globally, they can manage this event
        $EM_Object = new EM_Object();
        //create new object to prevent infinite loop should we call $EM_Event->can_manage();
        if (groups_is_user_admin(get_current_user_id(), $EM_Event->group_id) && $EM_Object->can_manage($owner_capability, $admin_capability, $user_to_check)) {
            //This user is an admin of the owner's group, so they can edit this event.
            return true;
        } else {
            $EM_Event->add_error($EM_Object->get_errors());
            //add any applicable errors
        }
    }
    return $result;
}
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:23,代码来源:bp-em-groups.php

示例6: ajax_add_booking

 function ajax_add_booking()
 {
     /* Check the nonce */
     check_admin_referer('add_booking', '_wpnonce_add_booking');
     if (!empty($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id'])) {
         $EM_Event = new EM_Event($_REQUEST['event_id']);
         $result = $EM_Event->get_bookings()->add_from_post();
         if ($result) {
             $return = array('result' => true, 'message' => $EM_Event->get_bookings()->feedback_message);
         } else {
             $return = array('result' => false, 'message' => implode('<br />', $EM_Event->get_bookings()->errors));
         }
         echo EM_Object::json_encode($return);
         exit;
     } else {
         $return = array('result' => false, 'message' => '');
         echo EM_Object::json_encode($return);
         exit;
     }
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:20,代码来源:em-bookings.php

示例7: em_admin_event_actions

function em_admin_event_actions()
{
    if (current_user_can(EM_MIN_CAPABILITY) && !empty($_GET['page']) && $_GET['page'] == 'events-manager-event' && !empty($_REQUEST['action'])) {
        global $wpdb;
        global $EM_Event;
        //if dealing with new event, we still want an event object
        if (!is_object($EM_Event)) {
            $EM_Event = new EM_Event();
        }
        // UPDATE or CREATE action
        if ($_REQUEST['action'] == 'save') {
            $validation = $EM_Event->get_post();
            if ($validation) {
                //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
                //Save
                if ($EM_Event->save()) {
                    $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : '';
                    $scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope'] : '';
                    wp_redirect(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=events-manager&p=' . $page . '&scope=' . $scope . '&message=' . urlencode($EM_Event->feedback_message));
                }
            }
            //errors added automatically to event global object
        }
        //Copy the event
        if ($_REQUEST['action'] == 'duplicate') {
            global $EZSQL_ERROR;
            $EM_Event = $EM_Event->duplicate();
            if ($EM_Event === false) {
                $redirect_url = em_add_get_params($_SERVER['HTTP_REFERER'], array('error' => __('There was an error duplicating the event. Try again maybe?', 'dbem'), 'message' => ''), false);
                wp_redirect($redirect_url);
            } else {
                $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : '';
                $scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope'] : '';
                wp_redirect(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=events-manager-event&event_id=' . $EM_Event->id . '&p=' . $page . '&scope=' . $scope . '&message=' . urlencode($EM_Event->feedback_message));
            }
        }
    }
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:38,代码来源:em-event.php

示例8: em_admin_email_test_ajax

function em_admin_email_test_ajax()
{
    if (wp_verify_nonce($_REQUEST['_check_email_nonce'], 'check_email') && current_user_can('activate_plugins')) {
        $subject = __("Events Manager Test Email", 'dbem');
        $content = __('Congratulations! Your email settings work.', 'dbem');
        $current_user = get_user_by('id', get_current_user_id());
        //add filters for options used in EM_Mailer so the current supplied ones are used
        ob_start();
        function pre_option_dbem_mail_sender_name()
        {
            return sanitize_email($_REQUEST['dbem_mail_sender_name']);
        }
        add_filter('pre_option_dbem_mail_sender_name', 'pre_option_dbem_mail_sender_name');
        function pre_option_dbem_mail_sender_address()
        {
            return sanitize_text_field($_REQUEST['dbem_mail_sender_address']);
        }
        add_filter('pre_option_dbem_mail_sender_address', 'pre_option_dbem_mail_sender_address');
        function pre_option_dbem_rsvp_mail_send_method()
        {
            return sanitize_text_field($_REQUEST['dbem_rsvp_mail_send_method']);
        }
        add_filter('pre_option_dbem_rsvp_mail_send_method', 'pre_option_dbem_rsvp_mail_send_method');
        function pre_option_dbem_rsvp_mail_port()
        {
            return sanitize_text_field($_REQUEST['dbem_rsvp_mail_port']);
        }
        add_filter('pre_option_dbem_rsvp_mail_port', 'pre_option_dbem_rsvp_mail_port');
        function pre_option_dbem_rsvp_mail_SMTPAuth()
        {
            return sanitize_text_field($_REQUEST['dbem_rsvp_mail_SMTPAuth']);
        }
        add_filter('pre_option_dbem_rsvp_mail_SMTPAuth', 'pre_option_dbem_rsvp_mail_SMTPAuth');
        function pre_option_dbem_smtp_host()
        {
            return sanitize_text_field($_REQUEST['dbem_smtp_host']);
        }
        add_filter('pre_option_dbem_smtp_host', 'pre_option_dbem_smtp_host');
        function pre_option_dbem_smtp_username()
        {
            return sanitize_text_field($_REQUEST['dbem_smtp_username']);
        }
        add_filter('pre_option_dbem_smtp_username', 'pre_option_dbem_smtp_username');
        function pre_option_dbem_smtp_password()
        {
            return sanitize_text_field($_REQUEST['dbem_smtp_password']);
        }
        add_filter('pre_option_dbem_smtp_password', 'pre_option_dbem_smtp_password');
        ob_clean();
        //remove any php errors/warnings output
        $EM_Event = new EM_Event();
        if ($EM_Event->email_send($subject, $content, $current_user->user_email)) {
            $result = array('result' => true, 'message' => sprintf(__('Email sent succesfully to %s', 'dbem'), $current_user->user_email));
        } else {
            $result = array('result' => false, 'message' => __('Email not sent.', 'dbem') . " <ul><li>" . implode('</li><li>', $EM_Event->get_errors()) . '</li></ul>');
        }
        echo EM_Object::json_encode($result);
    }
    exit;
}
开发者ID:rolka,项目名称:events-manager,代码行数:60,代码来源:em-options.php

示例9: em_init_actions

/**
 * Performs actions on init. This works for both ajax and normal requests, the return results depends if an em_ajax flag is passed via POST or GET.
 */
function em_init_actions()
{
    global $wpdb, $EM_Notices, $EM_Event;
    if (defined('DOING_AJAX') && DOING_AJAX) {
        $_REQUEST['em_ajax'] = true;
    }
    //NOTE - No EM objects are globalized at this point, as we're hitting early init mode.
    //TODO Clean this up.... use a uniformed way of calling EM Ajax actions
    if (!empty($_REQUEST['em_ajax']) || !empty($_REQUEST['em_ajax_action'])) {
        if (isset($_REQUEST['em_ajax_action']) && $_REQUEST['em_ajax_action'] == 'get_location') {
            if (isset($_REQUEST['id'])) {
                $EM_Location = new EM_Location($_REQUEST['id'], 'location_id');
                $location_array = $EM_Location->to_array();
                $location_array['location_balloon'] = $EM_Location->output(get_option('dbem_location_baloon_format'));
                echo EM_Object::json_encode($location_array);
            }
            die;
        }
        if (isset($_REQUEST['em_ajax_action']) && $_REQUEST['em_ajax_action'] == 'delete_ticket') {
            if (isset($_REQUEST['id'])) {
                $EM_Ticket = new EM_Ticket($_REQUEST['id']);
                $result = $EM_Ticket->delete();
                if ($result) {
                    $result = array('result' => true);
                } else {
                    $result = array('result' => false, 'error' => $EM_Ticket->feedback_message);
                }
            } else {
                $result = array('result' => false, 'error' => __('No ticket id provided', 'dbem'));
            }
            echo EM_Object::json_encode($result);
            die;
        }
        if (isset($_REQUEST['query']) && $_REQUEST['query'] == 'GlobalMapData') {
            $EM_Locations = EM_Locations::get($_REQUEST);
            $json_locations = array();
            foreach ($EM_Locations as $location_key => $EM_Location) {
                $json_locations[$location_key] = $EM_Location->to_array();
                $json_locations[$location_key]['location_balloon'] = $EM_Location->output(get_option('dbem_map_text_format'));
            }
            echo EM_Object::json_encode($json_locations);
            die;
        }
        if (isset($_REQUEST['ajaxCalendar']) && $_REQUEST['ajaxCalendar']) {
            //FIXME if long events enabled originally, this won't show up on ajax call
            echo EM_Calendar::output($_REQUEST, false);
            die;
        }
    }
    //Event Actions
    if (!empty($_REQUEST['action']) && substr($_REQUEST['action'], 0, 5) == 'event') {
        //Load the event object, with saved event if requested
        if (!empty($_REQUEST['event_id'])) {
            $EM_Event = new EM_Event($_REQUEST['event_id']);
        } else {
            $EM_Event = new EM_Event();
        }
        //Save Event, only via BP or via [event_form]
        if ($_REQUEST['action'] == 'event_save' && $EM_Event->can_manage('edit_events', 'edit_others_events')) {
            //Check Nonces
            if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'wpnonce_event_save')) {
                exit('Trying to perform an illegal action.');
            }
            //Grab and validate submitted data
            if ($EM_Event->get_post() && $EM_Event->save()) {
                //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
                $events_result = true;
                //Success notice
                if (is_user_logged_in()) {
                    $EM_Notices->add_confirm($EM_Event->output(get_option('dbem_events_form_result_success')), true);
                } else {
                    $EM_Notices->add_confirm($EM_Event->output(get_option('dbem_events_anonymous_result_success')), true);
                }
                $redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : wp_get_referer();
                $redirect = em_add_get_params($redirect, array('success' => 1));
                wp_redirect($redirect);
                exit;
            } else {
                $EM_Notices->add_error($EM_Event->get_errors());
                $events_result = false;
            }
        }
        if ($_REQUEST['action'] == 'event_duplicate' && wp_verify_nonce($_REQUEST['_wpnonce'], 'event_duplicate_' . $EM_Event->event_id)) {
            $EM_Event = $EM_Event->duplicate();
            if ($EM_Event === false) {
                $EM_Notices->add_error($EM_Event->errors, true);
            } else {
                $EM_Notices->add_confirm($EM_Event->feedback_message, true);
            }
            wp_redirect(wp_get_referer());
            exit;
        }
        if ($_REQUEST['action'] == 'event_delete' && wp_verify_nonce($_REQUEST['_wpnonce'], 'event_delete_' . $EM_Event->event_id)) {
            //DELETE action
            $selectedEvents = !empty($_REQUEST['events']) ? $_REQUEST['events'] : '';
            if (EM_Object::array_is_numeric($selectedEvents)) {
                $events_result = EM_Events::delete($selectedEvents);
//.........这里部分代码省略.........
开发者ID:rajankz,项目名称:webspace,代码行数:101,代码来源:em-actions.php

示例10: duplicate

 /**
  * Duplicates this event and returns the duplicated event. Will return false if there is a problem with duplication.
  * @return EM_Event
  */
 function duplicate()
 {
     global $wpdb, $EZSQL_ERROR;
     //First, duplicate.
     if ($this->can_manage('edit_events', 'edit_others_events')) {
         $event_table_name = EM_EVENTS_TABLE;
         $eventArray = $this->to_array();
         unset($eventArray['event_id']);
         $EM_Event = new EM_Event($eventArray);
         if ($EM_Event->save()) {
             $EM_Event->feedback_message = sprintf(__("%s successfully duplicated.", 'dbem'), __('Event', 'dbem'));
             return apply_filters('em_event_duplicate', $EM_Event, $this);
         }
     } else {
         $EM_Event->add_error(sprintf(__('You are not allowed to manage this %s.'), __('event', 'dbem')));
     }
     //TODO add error notifications for duplication failures.
     return apply_filters('em_event_duplicate', false, $this);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:23,代码来源:em-event.php

示例11: em_booking_form_footer

    /**
     * Called instead of the filter in EM_Gateways if a manual booking is being made
     * @param EM_Event $EM_Event
     */
    function em_booking_form_footer($EM_Event)
    {
        if ($EM_Event->can_manage('manage_bookings', 'manage_others_bookings')) {
            //Admin is adding a booking here, so let's show a different form here.
            ?>
			<input type="hidden" name="gateway" value="<?php 
            echo $this->gateway;
            ?>
" />
			<input type="hidden" name="manual_booking" value="<?php 
            echo wp_create_nonce('em_manual_booking_' . $EM_Event->event_id);
            ?>
" />
			<p class="em-booking-gateway" id="em-booking-gateway">
				<label><?php 
            _e('Amount Paid', 'em-pro');
            ?>
</label>
				<input type="text" name="payment_amount" id="em-payment-amount" value="<?php 
            if (!empty($_REQUEST['payment_amount'])) {
                echo esc_attr($_REQUEST['payment_amount']);
            }
            ?>
">
				<?php 
            _e('Fully Paid', 'em-pro');
            ?>
 <input type="checkbox" name="payment_full" id="em-payment-full" value="1"><br />
				<em><?php 
            _e('If you check this as fully paid, and leave the amount paid blank, it will be assumed the full payment has been made.', 'em-pro');
            ?>
</em>
			</p>
			<?php 
        }
        return;
    }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:41,代码来源:gateway.offline.php

示例12: em_content

/**
 * Filters for page content and if an event replaces it with the relevant event data.
 * @param $data
 * @return string
 */
function em_content($content)
{
    $events_page_id = get_option('dbem_events_page');
    if (get_the_ID() == $events_page_id && $events_page_id != 0) {
        global $wpdb, $EM_Event;
        //TODO FILTER - filter em page content before placeholder replacing
        //TODO any loop should put the current $EM_Event etc. into the global variable
        //general defaults
        $args = array('orderby' => get_option('dbem_events_default_orderby'), 'order' => get_option('dbem_events_default_order'), 'owner' => false, 'pagination' => 1);
        if (!empty($_REQUEST['calendar_day'])) {
            //Events for a specific day
            $args['scope'] = $_REQUEST['calendar_day'];
            $page = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
            $events = EM_Events::get(apply_filters('em_content_calendar_day_args', $args));
            //Get events first, so we know how many there are in advance
            if (count($events) > 1 || $page > 1 || get_option('dbem_display_calendar_day_single') == 1) {
                $args['limit'] = get_option('dbem_events_default_limit');
                $args['offset'] = $args['limit'] * ($page - 1);
                $content = EM_Events::output($events, apply_filters('em_content_calendar_day_output_args', $args));
            } elseif (count($events) == 1) {
                $EM_Event = $events[0];
                $content = $EM_Event->output_single();
            } else {
                $content = get_option('dbem_no_events_message');
            }
        } elseif (!empty($_REQUEST['location_id']) && is_numeric($_REQUEST['location_id'])) {
            //Just a single location
            $location = new EM_Location($_REQUEST['location_id']);
            $content = $location->output_single();
        } elseif (!empty($_REQUEST['event_id']) && is_numeric($_REQUEST['event_id'])) {
            // single event page
            $event = new EM_Event($_REQUEST['event_id']);
            $content = $event->output_single();
        } elseif (!empty($_REQUEST['bookings_id'])) {
            //bookings page
        } else {
            // Multiple events page
            $scope = !empty($_REQUEST['scope']) ? EM_Object::sanitize($_REQUEST['scope']) : "future";
            //If we have a $_GET['page'] var, use it to calculate the offset/limit ratios (safer than offset/limit get vars)
            $args['scope'] = $scope;
            if (!empty($_REQUEST['category_id'])) {
                $args['category'] = $_REQUEST['category_id'];
            }
            if (get_option('dbem_display_calendar_in_events_page')) {
                $args['full'] = 1;
                $args['long_events'] = get_option('dbem_full_calendar_long_events');
                $content = EM_Calendar::output(apply_filters('em_content_calendar_args', $args));
            } else {
                $args['limit'] = get_option('dbem_events_default_limit');
                $args['page'] = !empty($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;
                /*calculate event list time range */
                $time_limit = get_option('dbem_events_page_time_limit');
                if (is_numeric($time_limit) && $time_limit > 0) {
                    $args['scope'] = date('Y-m-d') . "," . date('Y-m-t', strtotime('+' . ($time_limit - 1) . ' month'));
                }
                $content = EM_Events::output(apply_filters('em_content_events_args', $args));
            }
        }
        //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_events_page_title(''), get_option('dbem_title_html')) . $content;
        }
        //TODO FILTER - filter em page content before display
        return apply_filters('em_content', '<div id="em-wrapper">' . $content . '</div>');
    }
    return $content;
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:72,代码来源:em-events.php

示例13: em_admin_email_test_ajax

function em_admin_email_test_ajax()
{
    if (wp_verify_nonce($_REQUEST['_check_email_nonce'], 'check_email') && current_user_can('activate_plugins')) {
        $subject = __("Events Manager Test Email", 'dbem');
        $content = __('Congratulations! Your email settings work.', 'dbem');
        $current_user = get_user_by('id', get_current_user_id());
        $EM_Event = new EM_Event();
        if ($EM_Event->email_send($subject, $content, $current_user->user_email)) {
            $result = array('result' => true, 'message' => sprintf(__('Email sent succesfully to %s', 'dbem'), $current_user->user_email));
        } else {
            $result = array('result' => false, 'message' => __('Email not sent.', 'dbem') . " <ul><li>" . implode('</li><li>', $EM_Event->get_errors()) . '</li></ul>');
        }
        echo json_encode($result);
    }
    exit;
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:16,代码来源:em-options.php

示例14: maybe_publish_location

 /**
  * Publish the location if the event has just been approved and the location is pending. We assume an editor published the event and approves the location too.
  * @param EM_Event $EM_Event
  */
 function maybe_publish_location($EM_Event)
 {
     //do a dirty update for location too if it's not published
     if ($EM_Event->is_published() && !empty($EM_Event->location_id)) {
         $EM_Location = $EM_Event->get_location();
         if ($EM_Location->location_status !== 1) {
             //let's also publish the location
             $EM_Location->set_status(1, true);
         }
     }
 }
开发者ID:rajankz,项目名称:webspace,代码行数:15,代码来源:em-event-post-admin.php

示例15: get

 /**
  * Returns an array of EM_Location objects
  * @param boolean $eventful
  * @param boolean $return_objects
  * @return array
  */
 public static function get($args = array(), $count = false)
 {
     global $wpdb;
     $events_table = EM_EVENTS_TABLE;
     $locations_table = EM_LOCATIONS_TABLE;
     $locations = array();
     //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 = "SELECT * FROM {$locations_table} WHERE location_id=" . implode(" OR location_id=", $args);
         $results = $wpdb->get_results($sql, ARRAY_A);
         $events = array();
         foreach ($results as $result) {
             $locations[$result['location_id']] = new EM_Location($result);
         }
         return apply_filters('em_locations_get', $locations, $args);
         //We return all the events matched as an EM_Event array.
     } elseif (is_numeric($args)) {
         //return an event in the usual array format
         return apply_filters('em_locations_get', array(new EM_Location($args)), $args);
     } elseif (is_array($args) && is_object(current($args)) && get_class(current($args)) == 'EM_Location') {
         return apply_filters('em_locations_get', $args, $args);
     }
     //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']}" : '';
     //Get the default conditions
     $conditions = self::build_sql_conditions($args);
     //Put it all together
     $EM_Location = new EM_Location(0);
     //Empty class for strict message avoidance
     $fields = $locations_table . "." . implode(", {$locations_table}.", array_keys($EM_Location->fields));
     $where = count($conditions) > 0 ? " WHERE " . implode(" AND ", $conditions) : '';
     //Get ordering instructions
     $EM_Event = new EM_Event();
     //blank event for below
     $accepted_fields = $EM_Location->get_fields(true);
     $accepted_fields = array_merge($EM_Event->get_fields(true), $accepted_fields);
     $orderby = self::build_sql_orderby($args, $accepted_fields, get_option('dbem_events_default_order'));
     //Now, build orderby sql
     $orderby_sql = count($orderby) > 0 ? 'ORDER BY ' . implode(', ', $orderby) : '';
     $fields = $count ? $locations_table . '.location_id' : $locations_table . '.post_id';
     if (EM_MS_GLOBAL) {
         $selectors = $count ? 'COUNT(' . $locations_table . '.location_id)' : $locations_table . '.post_id, ' . $locations_table . '.blog_id';
     } else {
         $selectors = $count ? 'COUNT(' . $locations_table . '.location_id)' : $locations_table . '.post_id';
     }
     //Create the SQL statement and execute
     $sql = "\r\n\t\t\tSELECT {$selectors} FROM {$locations_table}\r\n\t\t\tLEFT JOIN {$events_table} ON {$locations_table}.location_id={$events_table}.location_id\r\n\t\t\t{$where}\r\n\t\t\tGROUP BY {$locations_table}.location_id\r\n\t\t\t{$orderby_sql}\r\n\t\t\t{$limit} {$offset}\r\n\t\t";
     //If we're only counting results, return the number of results
     if ($count) {
         return apply_filters('em_locations_get_array', count($wpdb->get_col($sql)), $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_locations_get_array', $results, $args);
     }
     if (EM_MS_GLOBAL) {
         foreach ($results as $location) {
             if (empty($location['blog_id'])) {
                 $location['blog_id'] = get_current_site()->blog_id;
             }
             $locations[] = em_get_location($location['post_id'], $location['blog_id']);
         }
     } else {
         foreach ($results as $location) {
             $locations[] = em_get_location($location['post_id'], 'post_id');
         }
     }
     return apply_filters('em_locations_get', $locations, $args);
 }
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:80,代码来源:em-locations.php


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