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


PHP EM_Locations::get方法代码示例

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


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

示例1: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     $instance = array_merge($this->defaults, $instance);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'];
         echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         echo $args['after_title'];
     }
     $instance['owner'] = false;
     $locations = EM_Locations::get(apply_filters('em_widget_locations_get_args', $instance));
     echo "<ul>";
     $li_wrap = !preg_match('/^<li>/i', trim($instance['format']));
     if (count($locations) > 0) {
         foreach ($locations as $location) {
             if ($li_wrap) {
                 echo '<li>' . $location->output($instance['format']) . '</li>';
             } else {
                 echo $location->output($instance['format']);
             }
         }
     } else {
         echo '<li>' . __('No locations', 'dbem') . '</li>';
     }
     echo "</ul>";
     echo $args['after_widget'];
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:28,代码来源:em-locations.php

示例2: widget

 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     $instance = array_merge($this->defaults, $instance);
     echo $args['before_widget'];
     if (!empty($instance['title'])) {
         echo $args['before_title'];
         echo apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
         echo $args['after_title'];
     }
     //make sure no owner searches are being run
     $instance['owner'] = false;
     //legacy sanitization
     if (!preg_match('/^<li/i', trim($instance['format']))) {
         $instance['format'] = '<li>' . $instance['format'] . '</li>';
     }
     //get locations
     $locations = EM_Locations::get(apply_filters('em_widget_locations_get_args', $instance));
     //output locations
     echo "<ul>";
     if (count($locations) > 0) {
         foreach ($locations as $location) {
             echo $location->output($instance['format']);
         }
     } else {
         echo $instance['no_locations_text'];
     }
     echo "</ul>";
     echo $args['after_widget'];
 }
开发者ID:sajjadalisiddiqui,项目名称:cms,代码行数:30,代码来源:em-locations.php

示例3: dbem_get_locations

function dbem_get_locations($eventful = false)
{
    $EM_Locations = EM_Locations::get(array('eventful' => $eventful));
    foreach ($EM_Locations as $key => $EM_Location) {
        $EM_Locations[$key] = $EM_Location->to_array();
    }
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:7,代码来源:em-template-tags-depreciated.php

示例4: em_options_radio_binary

        echo "</td></tr>";
    }
}
em_options_radio_binary(sprintf(__('Enable %s attributes?', 'dbem'), __('event', 'dbem')), 'dbem_attributes_enabled', __('Select yes to enable the attributes feature', 'dbem'));
em_options_radio_binary(sprintf(__('Enable %s custom fields?', 'dbem'), __('event', 'dbem')), 'dbem_cp_events_custom_fields', __('Custom fields are the same as attributes, except you cannot restrict specific values, users can add any kind of custom field name/value pair. Only available in the WordPress admin area.', 'dbem'));
if (get_option('dbem_attributes_enabled')) {
    em_options_textarea(sprintf(__('%s Attributes', 'dbem'), __('Event', 'dbem')), 'dbem_placeholders_custom', sprintf(__("You can also add event attributes here, one per line in this format <code>#_ATT{key}</code>. They will not appear on event pages unless you insert them into another template below, but you may want to store extra information about an event for other uses. <a href='%s'>More information on placeholders.</a>", 'dbem'), EM_ADMIN_URL . '&amp;page=events-manager-help'));
}
if (get_option('dbem_locations_enabled')) {
    /*default location*/
    if (defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS) {
        em_options_input_text(__('Default Location', 'dbem'), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.', 'dbem') . ' ' . __('This option allows you to select the default location when adding an event.', 'dbem') . " " . __('(not applicable with event ownership on presently, coming soon!)', 'dbem'));
    } else {
        $location_options = array();
        $location_options[0] = __('no default location', 'dbem');
        $EM_Locations = EM_Locations::get();
        foreach ($EM_Locations as $EM_Location) {
            $location_options[$EM_Location->location_id] = $EM_Location->location_name;
        }
        em_options_select(__('Default Location', 'dbem'), 'dbem_default_location', $location_options, __('Please enter your Location ID.', 'dbem') . ' ' . __('This option allows you to select the default location when adding an event.', 'dbem') . " " . __('(not applicable with event ownership on presently, coming soon!)', 'dbem'));
    }
    /*default location country*/
    em_options_select(__('Default Location Country', 'dbem'), 'dbem_location_default_country', em_get_countries(__('no default country', 'dbem')), __('If you select a default country, that will be pre-selected when creating a new location.', 'dbem'));
}
?>

			<tr class="em-header">
				<td colspan="2">
					<h4><?php 
echo sprintf(__('%s Settings', 'dbem'), __('Location', 'dbem'));
?>
开发者ID:pcco,项目名称:portal-redesign,代码行数:31,代码来源:general.php

示例5: em_locations_admin

/**
 * Outputs table of locations belonging to user
 * @param array $args
 */
function em_locations_admin($args = array())
{
    global $EM_Location;
    if (is_user_logged_in() && current_user_can('edit_locations')) {
        if (!empty($_GET['action']) && $_GET['action'] == 'edit') {
            if (empty($_REQUEST['redirect_to'])) {
                $_REQUEST['redirect_to'] = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => null, 'location_id' => null));
            }
            em_location_form();
        } else {
            if (get_option('dbem_css_editors')) {
                echo '<div class="css-locations-admin">';
            }
            $limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
            //Default limit
            $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
            $offset = $page > 1 ? ($page - 1) * $limit : 0;
            $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'ASC';
            if (array_key_exists('status', $_REQUEST)) {
                $status = $_REQUEST['status'] ? 1 : 0;
            } else {
                $status = false;
            }
            $blog = false;
            if (EM_MS_GLOBAL && !get_site_option('dbem_ms_mainblog_locations') && !is_main_site()) {
                //set current blog id if not on main site and using global mode whilst not forcing all locations to be on main blog
                $blog = get_current_blog_id();
            }
            $args = array('limit' => $limit, 'offset' => $offset, 'status' => $status, 'blog' => $blog);
            //count locations
            $locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id(), 'blog' => $blog, 'status' => false));
            $locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => $blog, 'status' => false, 'owner' => false)) : 0;
            //get set of locations
            if (!empty($_REQUEST['view']) && $_REQUEST['view'] == 'others' && current_user_can('read_others_locations')) {
                $locations = EM_Locations::get($args);
                $locations_count = $locations_all_count;
            } else {
                $locations = EM_Locations::get(array_merge($args, array('owner' => get_current_user_id())));
                $locations_count = $locations_mine_count;
            }
            em_locate_template('tables/locations.php', true, array('args' => $args, 'locations' => $locations, 'locations_count' => $locations_count, 'locations_mine_count' => $locations_mine_count, 'locations_all_count' => $locations_all_count, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => true));
            if (get_option('dbem_css_editors')) {
                echo '</div>';
            }
        }
    } else {
        if (get_option('dbem_css_editors')) {
            echo '<div class="css-locations-admin">';
        }
        echo '<div class="css-locations-admin-login">' . __("You must log in to view and manage your locations.", 'dbem') . '</div>';
        if (get_option('dbem_css_editors')) {
            echo '</div>';
        }
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:59,代码来源:em-template-tags.php

示例6: 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()) {
                    if (empty($_REQUEST['event_id'])) {
                        $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_form_result_success_updated')), 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), false, false);
                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)) {
            $event = $EM_Event->duplicate();
            if ($event === false) {
                $EM_Notices->add_error($EM_Event->errors, true);
                wp_redirect(wp_get_referer());
            } else {
                $EM_Notices->add_confirm($EM_Event->feedback_message, true);
                wp_redirect($event->get_edit_url());
            }
            exit;
        }
//.........这里部分代码省略.........
开发者ID:Olaf1989,项目名称:Cakes-and-more,代码行数:101,代码来源:em-actions.php

示例7: em_admin_options_page

function em_admin_options_page()
{
    global $wpdb;
    //TODO place all options into an array
    $events_placeholders = '<a href="admin.php?page=events-manager-help#event-placeholders">' . __('Event Related Placeholders', 'dbem') . '</a>';
    $locations_placeholders = '<a href="admin.php?page=events-manager-help#location-placeholders">' . __('Location Related Placeholders', 'dbem') . '</a>';
    $bookings_placeholders = '<a href="admin.php?page=events-manager-help#booking-placeholders">' . __('Booking Related Placeholders', 'dbem') . '</a>';
    $categories_placeholders = '<a href="admin.php?page=events-manager-help#category-placeholders">' . __('Category Related Placeholders', 'dbem') . '</a>';
    $events_placeholder_tip = " " . sprintf(__('This accepts %s and %s placeholders.', 'dbem'), $events_placeholders, $locations_placeholders);
    $locations_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $locations_placeholders);
    $categories_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $categories_placeholders);
    $bookings_placeholder_tip = " " . sprintf(__('This accepts %s, %s and %s placeholders.', 'dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
    $save_button = '<tr><th>&nbsp;</th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" id="dbem_options_submit" name="Submit" value="' . __('Save Changes') . ' (' . __('All', 'dbem') . ')" /></p></ts></td></tr>';
    //Do some multisite checking here for reuse
    $multisite_view = is_multisite() && is_super_admin() ? ' - (' . __('Only Network Admins see this', 'dbem') . ')' : '';
    ?>
	
	<script type="text/javascript" charset="utf-8">
		jQuery(document).ready(function($){
			var close_text = '<?php 
    _e('Collapse All', 'dbem');
    ?>
';
			var open_text = '<?php 
    _e('Expand All', 'dbem');
    ?>
';
			var open_close = $('<a href="#" style="display:block; float:right; clear:right; margin:10px;">'+close_text+'</a>');
			$('#icon-options-general').after(open_close);
			open_close.click( function(e){
				e.preventDefault();
				if($(this).text() == close_text){
					$(".postbox").addClass('closed');
					$(this).text(open_text);
				}else{
					$(".postbox").removeClass('closed');
					$(this).text(close_text);
				} 
			});
			//For rewrite titles
			$('input:radio[name=dbem_disable_title_rewrites]').live('change',function(){
				checked_check = $('input:radio[name=dbem_disable_title_rewrites]:checked');
				if( checked_check.val() == 1 ){
					$('#dbem_title_html_row').show();
				}else{
					$('#dbem_title_html_row').hide();					
				}
			});
			$('input:radio[name=dbem_disable_title_rewrites]').trigger('change');
			$(".postbox").addClass('closed'); //Let's start off closing everything for now.			
		});
	</script>
	<div class="wrap">
		<div id='icon-options-general' class='icon32'><br />
		</div>		
		<h2><?php 
    _e('Event Manager Options', 'dbem');
    ?>
</h2>
		<?php 
    /*
     * START MIGRATION BIT
     */
    if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'bookings_migrate') {
        require_once dirname(__FILE__) . '/../em-install.php';
        em_migrate_bookings();
    } elseif (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'bookings_migrate_delete') {
        require_once dirname(__FILE__) . '/../em-install.php';
        em_migrate_bookings_delete();
    }
    ?>
		<?php 
    if ($wpdb->get_var("SHOW TABLES LIKE '" . EM_PEOPLE_TABLE . "'") == EM_PEOPLE_TABLE) {
        ?>
			<?php 
        if ($wpdb->get_var('SELECT COUNT(*) FROM ' . EM_TICKETS_BOOKINGS_TABLE) > 0) {
            ?>
				<div class='updated'>
					<p>
					It looks like you've already tried reimporting some bookings into the new version (or new bookings have been made since you installed). 
					If everything looks correct, you can 
					<a href="admin.php?page=events-manager-options&amp;_wpnonce=<?php 
            echo wp_create_nonce('bookings_migrate_delete');
            ?>
&amp;action=bookings_migrate_delete">delete the unused tables</a>, 
					or you can also safely try 
					<a href="admin.php?page=events-manager-options&amp;_wpnonce=<?php 
            echo wp_create_nonce('bookings_migrate');
            ?>
&amp;action=bookings_migrate">re-importing again</a>.
					</p>
				</div>
			<?php 
        } else {
            ?>
				<div class='updated'>
					<p>It looks like you've upgraded from Events Manager version 3.0, meaning your old bookings won't work until you re-import them. 
					Events Manager 3.0 kept booking user info in a simple database table, whereas now people that make bookings get a subscriber account so 
					they can access private booking information. You have to choice to 
					<a href="admin.php?page=events-manager-options&amp;_wpnonce=<?php 
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:em-options.php

示例8: _e

 </th>
			<td> 
				<select name="location_id" id='location-select-id' size="1">  
					<?php 
    if (!get_option('dbem_require_location', true)) {
        ?>
<option value="0"><?php 
        _e('No Location', 'events-manager');
        ?>
</option><?php 
    }
    ?>
					<?php 
    $ddm_args = array('blog' => false, 'private' => $EM_Event->can_manage('read_private_locations'));
    $ddm_args['owner'] = is_user_logged_in() && !current_user_can('read_others_locations') ? get_current_user_id() : false;
    $locations = EM_Locations::get($ddm_args);
    $selected_location = !empty($EM_Event->location_id) || !empty($EM_Event->event_id) ? $EM_Event->location_id : get_option('dbem_default_location');
    foreach ($locations as $EM_Location) {
        $selected = $selected_location == $EM_Location->location_id ? "selected='selected' " : '';
        ?>
          
				    	<option value="<?php 
        echo $EM_Location->location_id;
        ?>
" title="<?php 
        echo "{$EM_Location->location_latitude},{$EM_Location->location_longitude}";
        ?>
" <?php 
        echo $selected;
        ?>
><?php 
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:31,代码来源:location.php

示例9: _e

    _e('Location:', 'dbem');
    ?>
 </th>
			<td> 
				<select name="location_id" id='location-select-id' size="1">  
					<?php 
    if (!get_option('dbem_require_location', true)) {
        ?>
<option value="0"><?php 
        _e('No Location');
        ?>
</option><?php 
    }
    ?>
					<?php 
    $locations = EM_Locations::get(array('blog' => false, 'private' => $EM_Event->can_manage('read_private_locations')));
    $selected_location = !empty($EM_Event->location_id) ? $EM_Event->location_id : get_option('dbem_default_location');
    foreach ($locations as $EM_Location) {
        $selected = $selected_location == $EM_Location->location_id ? "selected='selected' " : '';
        ?>
          
				    	<option value="<?php 
        echo $EM_Location->location_id;
        ?>
" title="<?php 
        echo "{$EM_Location->location_latitude},{$EM_Location->location_longitude}";
        ?>
" <?php 
        echo $selected;
        ?>
><?php 
开发者ID:adisonc,项目名称:MaineLearning,代码行数:31,代码来源:location.php

示例10:

<?php

/*
 * Default Location List Template
 * This page displays a list of locations, called during the em_content() if this is an events list page.
 * You can override the default display settings pages by copying this file to yourthemefolder/plugins/events-manager/templates/ and modifying it however you need.
 * You can display locations (or whatever) however you wish, there are a few variables made available to you:
 * 
 * $args - the args passed onto EM_Locations::output()
 * 
 */
$locations = EM_Locations::get(apply_filters('em_content_locations_args', $args));
$args['limit'] = get_option('dbem_events_default_limit');
$args['page'] = !empty($_REQUEST['page']) && is_numeric($_REQUEST['page']) ? $_REQUEST['page'] : 1;
if (count($locations) > 0) {
    echo EM_Locations::output($locations, $args);
} else {
    echo get_option('dbem_no_locations_message');
}
开发者ID:hypenotic,项目名称:slowfood,代码行数:19,代码来源:locations-list.php

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

示例12: em_admin_locations

function em_admin_locations($message = '', $fill_fields = false)
{
    $limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
    //Default limit
    $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
    $offset = $page > 1 ? ($page - 1) * $limit : 0;
    $locations = EM_Locations::get();
    $locations_count = count($locations);
    ?>
		<div class='wrap'>
			<div id='icon-edit' class='icon32'>
				<br/>
			</div>
 	 		<h2>
 	 			<?php 
    _e('Locations', 'dbem');
    ?>
 	 			<a href="admin.php?page=events-manager-locations&action=add" class="button add-new-h2"><?php 
    _e('Add New');
    ?>
</a>
 	 		</h2>  

			<?php 
    if ($message != "") {
        ?>
				<div id='message' class='updated fade below-h2'>
					<p><?php 
        echo $message;
        ?>
</p>
				</div>
			<?php 
    }
    ?>
  
			  
		 	 <form id='bookings-filter' method='post' action=''>
				<input type='hidden' name='page' value='locations'/>
				<input type='hidden' name='limit' value='<?php 
    echo $limit;
    ?>
' />	
				<input type='hidden' name='p' value='<?php 
    echo $page;
    ?>
' />								
				<?php 
    if ($locations_count > 0) {
        ?>
				<div class='tablenav'>					
					<div class="alignleft actions">
						<select name="action">
							<option value="" selected="selected"><?php 
        _e('Bulk Actions');
        ?>
</option>
							<option value="delete"><?php 
        _e('Delete selected', 'dbem');
        ?>
</option>
						</select> 
						<input type="submit" value="<?php 
        _e('Apply');
        ?>
" id="doaction2" class="button-secondary action" /> 
						<?php 
        //Pagination (if needed/requested)
        if ($locations_count >= $limit) {
            //Show the pagination links (unless there's less than 10 events
            $page_link_template = preg_replace('/(&|\\?)p=\\d+/i', '', $_SERVER['REQUEST_URI']);
            $page_link_template = em_add_get_params($page_link_template, array('pno' => '%PAGE%'));
            $locations_nav = em_paginate($page_link_template, $locations_count, $limit, $page);
            echo $locations_nav;
        }
        ?>
					</div>
				</div>
				<table class='widefat'>
					<thead>
						<tr>
							<th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
							<th><?php 
        _e('Name', 'dbem');
        ?>
</th>
							<th><?php 
        _e('Address', 'dbem');
        ?>
</th>
							<th><?php 
        _e('Town', 'dbem');
        ?>
</th>                
						</tr> 
					</thead>
					<tfoot>
						<tr>
							<th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
							<th><?php 
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:em-locations.php

示例13: em_locations_admin

/**
 * Outputs table of locations belonging to user
 * @param array $args
 */
function em_locations_admin($args = array())
{
    global $EM_Location;
    if (is_user_logged_in() && current_user_can('edit_locations')) {
        if (!empty($_GET['action']) && $_GET['action'] == 'edit') {
            if (empty($_REQUEST['redirect_to'])) {
                $_REQUEST['redirect_to'] = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => null, 'location_id' => null));
            }
            em_location_form();
        } else {
            $url = empty($url) ? $_SERVER['REQUEST_URI'] : $url;
            //url to this page
            $limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
            //Default limit
            $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
            $offset = $page > 1 ? ($page - 1) * $limit : 0;
            $args = array('limit' => $limit, 'offset' => $offset, 'status' => false, 'blog' => false);
            if (!empty($_REQUEST['view']) && $_REQUEST['view'] == 'others' && current_user_can('read_others_locations')) {
                $locations = EM_Locations::get($args);
                $locations_count = EM_Locations::count(array('status' => false, 'blog' => false, 'owner' => false));
            } else {
                $locations = EM_Locations::get(array_merge($args, array('owner' => get_current_user_id())));
                $locations_count = EM_Locations::count(array('status' => false, 'blog' => false, 'owner' => get_current_user_id()));
            }
            $locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id(), 'blog' => false, 'status' => false));
            $locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => false, 'status' => false)) : 0;
            em_locate_template('tables/locations.php', true, array('args' => $args, 'locations' => $locations, 'locations_count' => $locations_count, 'locations_mine_count' => $locations_mine_count, 'locations_all_count' => $locations_all_count, 'url' => $url, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => true));
        }
    } else {
        echo __("You must log in to view and manage your locations.", 'dbem');
    }
}
开发者ID:rajankz,项目名称:webspace,代码行数:36,代码来源:em-template-tags.php

示例14: _e

}
?>
			
			
			<h4><?php 
_e('Where', 'dbem');
?>
</h4>
			<div class="inside">
				<table id="dbem-location-data">     
					<tr>
						<td style="padding-right:20px; vertical-align:top;">
							<?php 
$args = array();
$args['owner'] = current_user_can('read_others_locations') ? false : get_current_user_id();
$locations = EM_Locations::get($args);
?>
							<?php 
if (count($locations) > 0) {
    ?>
							<select name="location_id" id='location-select-id' size="1">  
								<?php 
    foreach ($locations as $location) {
        $selected = "";
        if (is_object($EM_Event->location)) {
            if ($EM_Event->location->id == $location->id) {
                $selected = "selected='selected' ";
            }
        }
        ?>
          
开发者ID:hypenotic,项目名称:slowfood,代码行数:30,代码来源:event-editor.php

示例15: em_admin_locations

function em_admin_locations($message = '', $fill_fields = false)
{
    global $EM_Notices;
    $limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
    //Default limit
    $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
    $offset = $page > 1 ? ($page - 1) * $limit : 0;
    if (!empty($_REQUEST['owner']) && current_user_can('read_others_locations')) {
        $locations = EM_Locations::get(array('owner' => false));
        $locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id()));
        $locations_all_count = count($locations);
    } else {
        $locations = EM_Locations::get(array('owner' => get_current_user_id(), 'blog' => false));
        $locations_mine_count = count($locations);
        $locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => false)) : 0;
    }
    $locations_count = count($locations);
    ?>
		<div class='wrap'>
			<div id='icon-edit' class='icon32'>
				<br/>
			</div>
 	 		<h2>
 	 			<?php 
    _e('Locations', 'dbem');
    ?>
 	 			<a href="admin.php?page=events-manager-locations&action=add" class="button add-new-h2"><?php 
    _e('Add New', 'dbem');
    ?>
</a>
 	 		</h2>  

			<?php 
    echo $EM_Notices;
    ?>
  
			  
		 	 <form id='locations-filter' method='post' action=''>
				<input type='hidden' name='page' value='locations'/>
				<input type='hidden' name='limit' value='<?php 
    echo $limit;
    ?>
' />	
				<input type='hidden' name='p' value='<?php 
    echo $page;
    ?>
' />	
				<div class="subsubsub">
					<a href='admin.php?page=events-manager-locations' <?php 
    echo empty($_REQUEST['owner']) ? 'class="current"' : '';
    ?>
><?php 
    echo sprintf(__('My %s', 'dbem'), __('Locations', 'dbem'));
    ?>
 <span class="count">(<?php 
    echo $locations_mine_count;
    ?>
)</span></a>
					<?php 
    if (current_user_can('read_others_locations')) {
        ?>
					&nbsp;|&nbsp;
					<a href='admin.php?page=events-manager-locations&amp;owner=all' <?php 
        echo !empty($_REQUEST['owner']) ? 'class="current"' : '';
        ?>
><?php 
        echo sprintf(__('All %s', 'dbem'), __('Locations', 'dbem'));
        ?>
 <span class="count">(<?php 
        echo $locations_all_count;
        ?>
)</span></a>
					<?php 
    }
    ?>
				</div>										
				<?php 
    if ($locations_count > 0) {
        ?>
				<div class='tablenav'>					
					<div class="alignleft actions">
						<select name="action">
							<option value="" selected="selected"><?php 
        _e('Bulk Actions');
        ?>
</option>
							<option value="location_delete"><?php 
        _e('Delete selected', 'dbem');
        ?>
</option>
						</select> 
						<input type="submit" value="<?php 
        _e('Apply');
        ?>
" id="doaction2" class="button-secondary action" /> 
					</div>
						<?php 
        if ($locations_count >= $limit) {
            $locations_nav = em_admin_paginate($locations_count, $limit, $page);
            echo $locations_nav;
//.........这里部分代码省略.........
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:em-locations.php


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