• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP EM_Object类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_bookings

 function get_bookings($ids_only = false, $status = false)
 {
     global $wpdb;
     $status_condition = $blog_condition = '';
     if (is_multisite()) {
         if (!is_main_site()) {
             //not the main blog, force single blog search
             $blog_condition = "AND e.blog_id=" . get_current_blog_id();
         } elseif (is_main_site() && !get_option('dbem_ms_global_events')) {
             $blog_condition = "AND (e.blog_id=" . get_current_blog_id() . ' OR e.blog_id IS NULL)';
         }
     }
     if (is_numeric($status)) {
         $status_condition = " AND booking_status={$status}";
     } elseif (EM_Object::array_is_numeric($status)) {
         $status_condition = " AND booking_status IN (" . implode(',', $status) . ")";
     }
     $EM_Booking = em_get_booking();
     //empty booking for fields
     $results = $wpdb->get_results("SELECT b." . implode(', b.', array_keys($EM_Booking->fields)) . " FROM " . EM_BOOKINGS_TABLE . " b, " . EM_EVENTS_TABLE . " e WHERE e.event_id=b.event_id AND person_id={$this->ID} {$blog_condition} {$status_condition} ORDER BY " . get_option('dbem_bookings_default_orderby', 'event_start_date') . " " . get_option('dbem_bookings_default_order', 'ASC'), ARRAY_A);
     $bookings = array();
     if ($ids_only) {
         foreach ($results as $booking_data) {
             $bookings[] = $booking_data['booking_id'];
         }
         return apply_filters('em_person_get_bookings', $bookings, $this);
     } else {
         foreach ($results as $booking_data) {
             $bookings[] = em_get_booking($booking_data);
         }
         return apply_filters('em_person_get_bookings', new EM_Bookings($bookings), $this);
     }
 }
开发者ID:pcco,项目名称:portal-redesign,代码行数:33,代码来源:em-person.php


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


示例3: em_admin_ms_locations

/**
 * Looks at the request values, saves/updates and then displays the right menu in the admin
 * @return null
 */
function em_admin_ms_locations()
{
    //TODO EM_Location is globalized, use it fully here
    global $EM_Location;
    EM_Object::ms_global_switch();
    //Take actions
    if (!empty($_REQUEST['action']) && ($_REQUEST['action'] == "edit" || $_REQUEST['action'] == "location_save")) {
        em_admin_location();
    } else {
        // no action, just a locations list
        em_admin_locations();
    }
    EM_Object::ms_global_switch_back();
}
开发者ID:hscale,项目名称:webento,代码行数:18,代码来源:em-ms-locations.php


示例4: em_ical_item

/**
 * Generates an ics file for a single event 
 */
function em_ical_item()
{
    global $wpdb, $wp_query, $wp_rewrite;
    //check if we're outputting an ical feed
    if (!empty($wp_query) && $wp_query->get('ical')) {
        $execute_ical = false;
        $filename = 'events';
        $args = array();
        //single event
        if ($wp_query->get(EM_POST_TYPE_EVENT)) {
            $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)) {
                $filename = $wp_query->get(EM_POST_TYPE_EVENT);
                $args['event'] = $event_id;
            }
            //single location
        } elseif ($wp_query->get(EM_POST_TYPE_LOCATION)) {
            $location_id = $wpdb->get_var('SELECT location_id FROM ' . EM_LOCATIONS_TABLE . " WHERE location_slug='" . $wp_query->get(EM_POST_TYPE_LOCATION) . "' AND location_status=1 LIMIT 1");
            if (!empty($location_id)) {
                $filename = $wp_query->get(EM_POST_TYPE_LOCATION);
                $args['location'] = $location_id;
            }
            //taxonomies
        } else {
            $taxonomies = EM_Object::get_taxonomies();
            foreach ($taxonomies as $tax_arg => $taxonomy_info) {
                $taxonomy_term = $wp_query->get($taxonomy_info['query_var']);
                if ($taxonomy_term) {
                    $filename = $taxonomy_term;
                    $args[$tax_arg] = $taxonomy_term;
                }
            }
        }
        //only output the ical if we have a match from above
        if (count($args) > 0) {
            //send headers and output ical
            header('Content-type: text/calendar; charset=utf-8');
            header('Content-Disposition: inline; filename="' . $filename . '.ics"');
            em_locate_template('templates/ical.php', true, array('args' => $args));
            exit;
        } else {
            //no item exists, so redirect to original URL
            $url_to_redirect = preg_replace("/ical\\/\$/", '', esc_url_raw(add_query_arg(array('ical' => null))));
            wp_redirect($url_to_redirect, '302');
            exit;
        }
    }
}
开发者ID:Olaf1989,项目名称:Cakes-and-more,代码行数:51,代码来源:em-ical.php


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


示例6: get_global

    /**
     * Shortcode for producing a google map with all the locations. Unfinished and undocumented.
     * @param array $atts
     * @return string
     */
    function get_global($atts)
    {
        //TODO Finish and document this feature, need to add balloons here
        if (get_option('dbem_gmap_is_active') == '1') {
            ob_start();
            $atts['em_ajax'] = true;
            $atts['query'] = 'GlobalMapData';
            $rand = substr(md5(rand() . rand()), 0, 5);
            //build js array of arguments to send to event query
            ?>
			<div class='em-locations-map' id='em-locations-map-<?php 
            echo $rand;
            ?>
' style='width:<?php 
            echo $atts['width'];
            ?>
px; height:<?php 
            echo $atts['height'];
            ?>
px'><em><?php 
            _e('Loading Map....', 'dbem');
            ?>
</em></div>
			<div class='em-locations-map-coords' id='em-locations-map-coords-<?php 
            echo $rand;
            ?>
' style="display:none; visibility:hidden;"><?php 
            echo EM_Object::json_encode($atts);
            ?>
</div>
			<?php 
            return apply_filters('em_map_get_global', ob_get_clean());
        } else {
            return '';
        }
    }
开发者ID:hypenotic,项目名称:slowfood,代码行数:41,代码来源:em-map.php


示例7: meta_box_ms_categories

    public static function meta_box_ms_categories()
    {
        global $EM_Event;
        EM_Object::ms_global_switch();
        $categories = EM_Categories::get(array('hide_empty' => false));
        ?>

		<?php 
        if (count($categories) > 0) {
            ?>

			<p class="ms-global-categories">
			 <?php 
            $selected = $EM_Event->get_categories()->get_ids();
            ?>

			 <?php 
            $walker = new EM_Walker_Category();
            ?>

			 <?php 
            $args_em = array('hide_empty' => 0, 'name' => 'event_categories[]', 'hierarchical' => true, 'id' => EM_TAXONOMY_CATEGORY, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'walker' => $walker);
            ?>

			 <?php 
            echo walk_category_dropdown_tree($categories, 0, $args_em);
            ?>

			</p>
		<?php 
        } else {
            ?>

			<p><?php 
            sprintf(__('No categories available, <a href="%s">create one here first</a>', 'dbem'), get_bloginfo('wpurl') . '/wp-admin/admin.php?page=events-manager-categories');
            ?>
</p>
		<?php 
        }
        ?>

		<!-- END Categories -->
		<?php 
        EM_Object::ms_global_switch_back();
    }
开发者ID:batruji,项目名称:metareading,代码行数:45,代码来源:em-event-post-admin.php


示例8: rewrite_rules_array


//.........这里部分代码省略.........
             $child_posts = $wpdb->get_results("SELECT ID, post_name FROM {$wpdb->posts} WHERE post_parent={$events_page->ID} AND post_type='page' AND post_status='publish'");
             foreach ($child_posts as $child_post) {
                 $em_rules[$events_page->post_name . '/' . urldecode($child_post->post_name) . '/?$'] = 'index.php?page_id=' . $child_post->ID;
                 //single event booking form with slug    //check if child page has children
                 $grandchildren = $wpdb->get_results("SELECT ID, post_name FROM {$wpdb->posts} WHERE post_parent={$child_post->ID} AND post_type='page' AND post_status='publish'");
                 if (count($grandchildren) != 0) {
                     foreach ($grandchildren as $grandchild) {
                         $em_rules[$events_slug . urldecode($child_post->post_name) . '/' . urldecode($grandchild->post_name) . '/?$'] = 'index.php?page_id=' . $grandchild->ID;
                     }
                 }
             }
         }
         //global links hard-coded
         if (EM_MS_GLOBAL && !get_site_option('dbem_ms_global_events_links', true)) {
             //MS Mode has slug also for global links
             $em_rules[$events_slug . get_site_option('dbem_ms_events_slug', EM_EVENT_SLUG) . '/(.+)$'] = 'index.php?pagename=' . $events_slug . '&em_redirect=1&event_slug=$matches[1]';
             //single event from subsite
         }
         //add redirection for backwards compatability
         $em_rules[$events_slug . EM_EVENT_SLUG . '/(.+)$'] = 'index.php?pagename=' . $events_slug . '&em_redirect=1&event_slug=$matches[1]';
         //single event
         $em_rules[$events_slug . EM_LOCATION_SLUG . '/(.+)$'] = 'index.php?pagename=' . $events_slug . '&em_redirect=1&location_slug=$matches[1]';
         //single location page
         $em_rules[$events_slug . EM_CATEGORY_SLUG . '/(.+)$'] = 'index.php?pagename=' . $events_slug . '&em_redirect=1&category_slug=$matches[1]';
         //single category page slug
         //add a rule that ensures that the events page is found and used over other pages
         $em_rules[trim($events_slug, '/') . '/?$'] = 'index.php?pagename=' . trim($events_slug, '/');
     } else {
         $events_slug = EM_POST_TYPE_EVENT_SLUG;
         $em_rules[$events_slug . '/(\\d{4}-\\d{2}-\\d{2})$'] = 'index.php?post_type=' . EM_POST_TYPE_EVENT . '&calendar_day=$matches[1]';
         //event calendar date search
         if (get_option('dbem_rsvp_enabled')) {
             if (!get_option('dbem_my_bookings_page') || !is_object(get_post(get_option('dbem_my_bookings_page')))) {
                 //only added if bookings page isn't assigned
                 $em_rules[$events_slug . '/my\\-bookings$'] = 'index.php?post_type=' . EM_POST_TYPE_EVENT . '&bookings_page=1';
                 //page for users to manage bookings
             }
         }
         //check for potentially conflicting posts with the same slug as events
         $conflicting_posts = get_posts(array('name' => EM_POST_TYPE_EVENT_SLUG, 'post_type' => 'any', 'numberposts' => 0));
         if (count($conflicting_posts) > 0) {
             //won't apply on homepage
             foreach ($conflicting_posts as $conflicting_post) {
                 //make sure we hard-code rewrites for child pages of events
                 $child_posts = get_posts(array('post_type' => 'any', 'post_parent' => $conflicting_post->ID, 'numberposts' => 0));
                 foreach ($child_posts as $child_post) {
                     $em_rules[EM_POST_TYPE_EVENT_SLUG . '/' . urldecode($child_post->post_name) . '/?$'] = 'index.php?page_id=' . $child_post->ID;
                     //single event booking form with slug
                     //check if child page has children
                     $grandchildren = get_pages('child_of=' . $child_post->ID);
                     if (count($grandchildren) != 0) {
                         foreach ($grandchildren as $grandchild) {
                             $em_rules[$events_slug . urldecode($child_post->post_name) . '/' . urldecode($grandchild->post_name) . '/?$'] = 'index.php?page_id=' . $grandchild->ID;
                         }
                     }
                 }
             }
         }
     }
     $em_rules = apply_filters('em_rewrite_rules_array_events', $em_rules, $events_slug);
     //make sure there's no page with same name as archives, that should take precedence as it can easily be deleted wp admin side
     $em_query = new WP_Query(array('pagename' => EM_POST_TYPE_EVENT_SLUG));
     if ($em_query->have_posts()) {
         $em_rules[trim(EM_POST_TYPE_EVENT_SLUG, '/') . '/?$'] = 'index.php?pagename=' . trim(EM_POST_TYPE_EVENT_SLUG, '/');
         wp_reset_postdata();
     }
     //make sure there's no page with same name as archives, that should take precedence as it can easily be deleted wp admin side
     $em_query = new WP_Query(array('pagename' => EM_POST_TYPE_LOCATION_SLUG));
     if ($em_query->have_posts()) {
         $em_rules[trim(EM_POST_TYPE_LOCATION_SLUG, '/') . '/?$'] = 'index.php?pagename=' . trim(EM_POST_TYPE_LOCATION_SLUG, '/');
         wp_reset_postdata();
     }
     //If in MS global mode and locations are linked on same site
     if (EM_MS_GLOBAL && !get_site_option('dbem_ms_global_locations_links', true)) {
         $locations_page_id = get_option('dbem_locations_page');
         $locations_page = get_post($locations_page_id);
         if (is_object($locations_page)) {
             $locations_slug = preg_replace('/\\/$/', '', str_replace(trailingslashit(home_url()), '', get_permalink($locations_page_id)));
             $locations_slug_slashed = !empty($locations_slug) ? trailingslashit($locations_slug) : $locations_slug;
             $em_rules[$locations_slug . '/' . get_site_option('dbem_ms_locations_slug', EM_LOCATION_SLUG) . '/(.+)$'] = 'index.php?pagename=' . $locations_slug_slashed . '&location_slug=$matches[1]';
             //single event booking form with slug
         }
     }
     //add ical CPT endpoints
     $em_rules[EM_POST_TYPE_EVENT_SLUG . "/([^/]+)/ical/?\$"] = 'index.php?' . EM_POST_TYPE_EVENT . '=$matches[1]&ical=1';
     if (get_option('dbem_locations_enabled')) {
         $em_rules[EM_POST_TYPE_LOCATION_SLUG . "/([^/]+)/ical/?\$"] = 'index.php?' . EM_POST_TYPE_LOCATION . '=$matches[1]&ical=1';
     }
     //add ical taxonomy endpoints
     $taxonomies = EM_Object::get_taxonomies();
     foreach ($taxonomies as $tax_arg => $taxonomy_info) {
         //set the dynamic rule for this taxonomy
         $em_rules[$taxonomy_info['slug'] . "/([^/]+)/ical/?\$"] = 'index.php?' . $taxonomy_info['query_var'] . '=$matches[1]&ical=1';
     }
     //add RSS location CPT endpoint
     if (get_option('dbem_locations_enabled')) {
         $em_rules[EM_POST_TYPE_LOCATION_SLUG . "/([^/]+)/rss/?\$"] = 'index.php?' . EM_POST_TYPE_LOCATION . '=$matches[1]&rss=1';
     }
     return $em_rules + $rules;
 }
开发者ID:pcco,项目名称:portal-redesign,代码行数:101,代码来源:em-permalinks.php


示例9: em_booking_get_post

 /**
  * Hooks into em_booking_get_post filter and makes sure that if there's an active gateway for new bookings, if no $_REQUEST['gateway'] is supplied (i.e. hacking, spammer, or js problem with booking button mode).
  * @param boolean $result
  * @param EM_Booking $EM_Booking
  * @return boolean
  */
 static function em_booking_get_post($result, $EM_Booking)
 {
     if (!empty($_REQUEST['manual_booking']) && wp_verify_nonce($_REQUEST['manual_booking'], 'em_manual_booking_' . $_REQUEST['event_id'])) {
         return $result;
     }
     if (get_option('dbem_multiple_bookings') && get_class($EM_Booking) == 'EM_Booking') {
         //we only deal with the EM_Multiple_Booking class if we're in multi booking mode
         return $result;
     }
     if (empty($EM_Booking->booking_id) && (empty($_REQUEST['gateway']) || !array_key_exists($_REQUEST['gateway'], self::active_gateways())) && $EM_Booking->get_price() > 0 && count(EM_Gateways::active_gateways()) > 0) {
         //spammer or hacker trying to get around no gateway selection
         $error = __('Choice of payment method not recognized. If you are seeing this error and selecting a method of payment, we apologize for the inconvenience. Please contact us and we\'ll help you make a booking as soon as possible.', 'em-pro');
         $EM_Booking->add_error($error);
         $result = false;
         if (defined('DOING_AJAX')) {
             $return = array('result' => false, 'message' => $error, 'errors' => $error);
             echo EM_Object::json_encode($return);
             die;
         }
     }
     return $result;
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:28,代码来源:gateways.php


示例10: array

<?php

$args = !empty($args) ? $args : array();
/* @var $args array */
?>
<!-- START Category Search -->
<div class="em-search-category em-search-field">
	<label><?php 
echo esc_html($args['category_label']);
?>
</label>
	<?php 
EM_Object::ms_global_switch();
//in case in global tables mode of MultiSite, grabs main site categories, if not using MS Global, nothing happens
wp_dropdown_categories(array('hide_empty' => 0, 'orderby' => 'name', 'name' => 'category', 'hierarchical' => true, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $args['category'], 'show_option_none' => $args['categories_label'], 'class' => 'em-events-search-category'));
EM_Object::ms_global_switch_back();
//if switched above, switch back
?>
</div>
<!-- END Category Search -->
开发者ID:mpaskew,项目名称:isc-dev,代码行数:20,代码来源:categories.php


示例11: get_option

<?php

/*
 * This page will search for either a specific location via GET "id" variable 
 * or will search for events by name via the GET "q" variable.
 */
require_once '../../../../wp-load.php';
global $wpdb;
$locations_table = $wpdb->prefix . EM_LOCATIONS_TABLE;
$location_cond = get_option('dbem_permissions_locations') < 1 && !em_verify_admin() ? "AND location_owner=" . get_current_user_id() : '';
$term = isset($_GET['term']) ? '%' . $_GET['term'] . '%' : '%' . $_GET['q'] . '%';
$sql = $wpdb->prepare("\n\tSELECT \n\t\tConcat( location_name, ', ', location_address, ', ', location_town)  AS `label`,\n\t\tlocation_name AS `value`,\n\t\tlocation_address AS `address`, \n\t\tlocation_town AS `town`, \n\t\tlocation_id AS `id`\n\tFROM {$locations_table} \n\tWHERE ( `location_name` LIKE %s ) {$location_cond} LIMIT 10\n", $term);
$locations_array = $wpdb->get_results($sql);
echo EM_Object::json_encode($locations_array);
/*
$return_string_array = array();
foreach($locations_array as $location){
	$return_string_class = array();
	foreach($location as $key => $value ){
		$return_string_class[] = "$key : '".addslashes($value)."'";
	}
	$return_string_array[] = '{'. implode(',', $return_string_class) .'}'; 
}
echo '['. implode(',', $return_string_array) .']';
*/
开发者ID:hypenotic,项目名称:slowfood,代码行数:25,代码来源:em-locations-search.php


示例12: em_admin_init

function em_admin_init()
{
    //in MS global mode and locations are stored in the main blog, then a user must have at least a subscriber role
    if (EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations')) {
        EM_Object::ms_global_switch();
        $user = new WP_User(get_current_user_id());
        if (count($user->roles) == 0) {
            $user->set_role('subscriber');
        }
        EM_Object::ms_global_switch_back();
    }
}
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:12,代码来源:em-admin.php


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


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


示例15: array

 /**
  * Save an array into this class
  * @param $array
  * @return null
  */
 function to_object($array = array())
 {
     //Save event core data
     parent::to_object($array);
     //Save location info
     $this->location = new EM_Location($array['location_id']);
     //Save contact person info
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:13,代码来源:em-recurrence.php


示例16: get_default_search

 public static function get_default_search($array_or_defaults = array(), $array = array())
 {
     self::$context = EM_POST_TYPE_LOCATION;
     $defaults = array('eventful' => false, 'eventless' => false, 'orderby' => 'location_name', 'town' => false, 'state' => false, 'country' => false, 'region' => false, 'status' => 1, 'scope' => 'all', 'blog' => get_current_blog_id(), 'private' => current_user_can('read_private_locations'), 'private_only' => false, 'post_id' => false);
     //sort out whether defaults were supplied or just the array of search values
     if (empty($array)) {
         $array = $array_or_defaults;
     } else {
         $defaults = array_merge($defaults, $array_or_defaults);
     }
     //specific functionality
     if (EM_MS_GLOBAL) {
         if (get_site_option('dbem_ms_mainblog_locations')) {
             //when searching in MS Global mode with all locations being stored on the main blog, blog_id becomes redundant as locations are stored in one blog table set
             $array['blog'] = false;
         } elseif ((!is_admin() || defined('DOING_AJAX')) && empty($array['blog']) && is_main_site() && get_site_option('dbem_ms_global_locations')) {
             //if enabled, by default we display all blog locations on main site
             $array['blog'] = false;
         }
     }
     $array['eventful'] = !empty($array['eventful']) && $array['eventful'] == true;
     $array['eventless'] = !empty($array['eventless']) && $array['eventless'] == true;
     if (is_admin() && !defined('DOING_AJAX')) {
         $defaults['owner'] = !current_user_can('read_others_locations') ? get_current_user_id() : false;
     }
     return apply_filters('em_locations_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
 }
开发者ID:KhanMaytok,项目名称:events-manager,代码行数:27,代码来源:em-locations.php


示例17:

 /**
  * Can the user manage this coupon? 
  */
 function can_manage($owner_capability = false, $admin_capability = false, $user_to_check = false)
 {
     return apply_filters('em_coupon_can_manage', parent::can_manage($owner_capability, $admin_capability, $user_to_check), $this, $owner_capability, $admin_capability, $user_to_check);
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:7,代码来源:coupon.php


示例18:

 /**
  * Can the user manage this location? 
  */
 function can_manage($owner_capability = false, $admin_capability = false)
 {
     if ($owner_capability == 'edit_locations' && $this->id == '' && !is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
         return apply_filters('em_event_can_manage', true);
     }
     return apply_filters('em_location_can_manage', parent::can_manage($owner_capability, $admin_capability), $this);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:10,代码来源:em-location.php


示例19: get_taxonomies

 public static function get_taxonomies()
 {
     if (empty(self::$taxonomies_array)) {
         //default taxonomies
         $taxonomies_array = array('category' => array('name' => EM_TAXONOMY_CATEGORY, 'ms' => 'event-category', 'context' => array()), 'tag' => array('name' => EM_TAXONOMY_TAG, 'context' => array()));
         //get additional taxonomies associated with locations and events and set context for default taxonomies
         foreach (get_taxonomies(array(), 'objects') as $tax_name => $tax) {
             $event_tax = in_array(EM_POST_TYPE_EVENT, $tax->object_type);
             $loc_tax = in_array(EM_POST_TYPE_LOCATION, $tax->object_type);
             if ($tax_name == EM_TAXONOMY_CATEGORY || $tax_name == EM_TAXONOMY_TAG) {
                 $tax_name = $tax_name == EM_TAXONOMY_CATEGORY ? 'category' : 'tag';
                 if ($event_tax) {
                     $taxonomies_array[$tax_name]['context'][] = EM_POST_TYPE_EVENT;
                 }
                 if ($loc_tax) {
                     $taxonomies_array[$tax_name]['context'][] = EM_POST_TYPE_LOCATION;
                 }
             } else {
                 $tax_name = str_replace('-', '_', $tax_name);
                 $prefix = !array_key_exists($tax_name, $taxonomies_array) ? '' : 'post_';
                 if (is_array($tax->object_type)) {
                     if ($event_tax || $loc_tax) {
                         $taxonomies_array[$prefix . $tax_name] = array('name' => $tax_name, 'context' => array());
                     }
                     if ($event_tax) {
                         $taxonomies_array[$prefix . $tax_name]['context'][] = EM_POST_TYPE_EVENT;
                     }
                     if ($loc_tax) {
                         $taxonomies_array[$prefix . $tax_name]['context'][] = EM_POST_TYPE_LOCATION;
                     }
                 }
             }
         }
         //users can add even more to this if needed, e.g. MS compatability
         self::$taxonomies_array = apply_filters('em_object_taxonomies', $taxonomies_array);
     }
     return self::$taxonomies_array;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:38,代码来源:em-object.php


示例20: get_default_search

 public static function get_default_search($array_or_defaults = array(), $array = array())
 {
     $defaults = array('orderby' => get_option('dbem_categories_default_orderby'), 'order' => get_option('dbem_categories_default_order'), 'hide_empty' => false, 'exclude' => array(), 'exclude_tree' => array(), 'include' => array(), 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 'pad_counts' => false, 'offset' => '', 'search' => '', 'cache_domain' => 'core');
     //sort out whether defaults were supplied or just the array of search values
     if (empty($array)) {
         $array = $array_or_defaults;
     } else {
         $defaults = array_merge($defaults, $array_or_defaults);
     }
     return apply_filters('em_categories_get_default_search', parent::get_default_search($defaults, $array), $array, $defaults);
 }
开发者ID:mpaskew,项目名称:isc-dev,代码行数:11,代码来源:em-categories.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP EMongoDocument类代码示例发布时间:2022-05-23
下一篇:
PHP EM_Locations类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap