本文整理汇总了PHP中em_get_scopes函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_scopes函数的具体用法?PHP em_get_scopes怎么用?PHP em_get_scopes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了em_get_scopes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restrict_manage_posts
function restrict_manage_posts()
{
global $wp_query;
if ($wp_query->query_vars['post_type'] == EM_POST_TYPE_EVENT || $wp_query->query_vars['post_type'] == 'event-recurring') {
?>
<select name="scope">
<?php
$scope = !empty($wp_query->query_vars['scope']) ? $wp_query->query_vars['scope'] : 'future';
foreach (em_get_scopes() as $key => $value) {
$selected = "";
if ($key == $scope) {
$selected = "selected='selected'";
}
echo "<option value='{$key}' {$selected}>{$value}</option> ";
}
?>
</select>
<?php
if (get_option('dbem_categories_enabled')) {
//Categories
$selected = !empty($_GET['event-categories']) ? $_GET['event-categories'] : 0;
wp_dropdown_categories(array('hide_empty' => 1, 'name' => EM_TAXONOMY_CATEGORY, 'hierarchical' => true, 'orderby' => 'name', 'id' => EM_TAXONOMY_CATEGORY, 'taxonomy' => EM_TAXONOMY_CATEGORY, 'selected' => $selected, 'show_option_all' => __('View all categories')));
}
if (!empty($_REQUEST['author'])) {
?>
<input type="hidden" name="author" value="<?php
echo esc_attr($_REQUEST['author']);
?>
" />
<?php
}
}
}
示例2: em_admin_options_page
//.........这里部分代码省略.........
foreach ($order_options as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == get_option('dbem_events_default_order') ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<br/>
<em><?php
_e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.', 'dbem');
?>
</em>
</td>
</tr>
<tr valign="top" id='dbem_events_display_time_limit'>
<th scope="row"><?php
_e('Event list scope', 'dbem');
?>
</th>
<td>
<select name="dbem_events_page_scope" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == get_option('dbem_events_page_scope') ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<br />
<em><?php
_e('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.', 'dbem');
?>
</em>
</td>
</tr>
<?php
em_options_input_text(__('Event List Limits', 'dbem'), 'dbem_events_default_limit', __("This will control how many events are shown on one list by default.", 'dbem'));
echo $save_button;
?>
</table>
</div> <!-- . inside -->
</div> <!-- .postbox -->
示例3: form
/** @see WP_Widget::form */
function form($instance)
{
$instance = array_merge($this->defaults, $instance);
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
esc_html_e('Title', 'dbem');
?>
: </label>
<input class="widefat" type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo esc_attr($instance['title']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('limit');
?>
"><?php
esc_html_e('Show number of locations', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('limit');
?>
" name="<?php
echo $this->get_field_name('limit');
?>
" value="<?php
echo esc_attr($instance['limit']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
esc_html_e('Scope of the locations', 'dbem');
?>
:</label><br/>
<select class="widefat" id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo esc_attr($key);
?>
' <?php
echo $key == $instance['scope'] ? "selected='selected'" : '';
?>
>
<?php
echo esc_html($value);
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<label for="<?php
echo $this->get_field_id('order');
?>
"><?php
esc_html_e('Order By', 'dbem');
?>
: </label>
<select class="widefat" id="<?php
echo $this->get_field_id('orderby');
?>
" name="<?php
echo $this->get_field_name('orderby');
?>
">
<?php
foreach ($this->em_orderby_options as $key => $value) {
?>
<option value='<?php
echo esc_attr($key);
?>
//.........这里部分代码省略.........
示例4: output_table
function output_table()
{
$EM_Ticket = $this->get_ticket();
$EM_Event = $this->get_event();
$EM_Person = $this->get_person();
$this->get_bookings(true);
//get bookings and refresh
?>
<div class='em-bookings-table em_obj' id="em-bookings-table">
<form class='bookings-filter' method='post' action='<?php
bloginfo('wpurl');
?>
/wp-admin/edit.php'>
<?php
if ($EM_Event !== false) {
?>
<input type="hidden" name="event_id" value='<?php
echo $EM_Event->event_id;
?>
' />
<?php
}
?>
<?php
if ($EM_Ticket !== false) {
?>
<input type="hidden" name="ticket_id" value='<?php
echo $EM_Ticket->ticket_id;
?>
' />
<?php
}
?>
<?php
if ($EM_Person !== false) {
?>
<input type="hidden" name="person_id" value='<?php
echo $EM_Person->ID;
?>
' />
<?php
}
?>
<input type="hidden" name="is_public" value="<?php
echo !empty($_REQUEST['is_public']) || !is_admin() ? 1 : 0;
?>
" />
<input type="hidden" name="pno" value='<?php
echo $this->page;
?>
' />
<input type="hidden" name="order" value='<?php
echo $this->order;
?>
' />
<input type="hidden" name="orderby" value='<?php
echo $this->orderby;
?>
' />
<input type="hidden" name="_wpnonce" value="<?php
echo !empty($_REQUEST['_wpnonce']) ? esc_attr($_REQUEST['_wpnonce']) : wp_create_nonce('em_bookings_table');
?>
" />
<input type="hidden" name="action" value="em_bookings_table" />
<input type="hidden" name="cols" value="<?php
echo implode(',', $this->cols);
?>
" />
<div class='tablenav'>
<div class="alignleft actions">
<a href="#" class="em-bookings-table-export" id="em-bookings-table-export-trigger" rel="#em-bookings-table-export" title="<?php
_e('Export these bookings.', 'dbem');
?>
"></a>
<a href="#" class="em-bookings-table-settings" id="em-bookings-table-settings-trigger" rel="#em-bookings-table-settings"></a>
<?php
if ($EM_Event === false) {
?>
<select name="scope">
<?php
foreach (em_get_scopes() as $key => $value) {
$selected = "";
if ($key == $this->scope) {
$selected = "selected='selected'";
}
echo "<option value='{$key}' {$selected}>{$value}</option> ";
}
?>
</select>
<?php
}
?>
<select name="limit">
<option value="<?php
echo $this->limit;
?>
"><?php
echo sprintf(__('%s Rows', 'dbem'), $this->limit);
?>
//.........这里部分代码省略.........
示例5: __
<div class="handlediv" title="<?php
__('Click to toggle', 'events-manager');
?>
"><br /></div><h3><span><?php
_e('RSS', 'events-manager');
?>
</span></h3>
<div class="inside">
<table class="form-table">
<?php
em_options_input_text(__('RSS main title', 'events-manager'), 'dbem_rss_main_title', __('The main title of your RSS events feed.', 'events-manager') . $events_placeholder_tip);
em_options_input_text(__('RSS main description', 'events-manager'), 'dbem_rss_main_description', __('The main description of your RSS events feed.', 'events-manager'));
em_options_input_text(__('RSS title format', 'events-manager'), 'dbem_rss_title_format', __('The format of the title of each item in the events RSS feed.', 'events-manager') . $events_placeholder_tip);
em_options_input_text(__('RSS description format', 'events-manager'), 'dbem_rss_description_format', __('The format of the description of each item in the events RSS feed.', 'events-manager') . $events_placeholder_tip);
em_options_input_text(__('RSS limit', 'events-manager'), 'dbem_rss_limit', __('Limits the number of future events shown (0 = unlimited).', 'events-manager'));
em_options_select(__('RSS Scope', 'events-manager'), 'dbem_rss_scope', em_get_scopes(), __('Choose to show events within a specific time range.', 'events-manager'));
?>
<tr valign="top" id='dbem_rss_orderby_row'>
<th scope="row"><?php
_e('Default event list ordering', 'events-manager');
?>
</th>
<td>
<select name="dbem_rss_orderby" >
<?php
$orderby_options = apply_filters('em_settings_events_default_orderby_ddm', array('event_start_date,event_start_time,event_name' => __('Order by start date, start time, then event name', 'events-manager'), 'event_name,event_start_date,event_start_time' => __('Order by name, start date, then start time', 'events-manager'), 'event_name,event_end_date,event_end_time' => __('Order by name, end date, then end time', 'events-manager'), 'event_end_date,event_end_time,event_name' => __('Order by end date, end time, then event name', 'events-manager')));
?>
<?php
foreach ($orderby_options as $key => $value) {
?>
示例6: form
/** @see WP_Widget::form */
function form($instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo esc_attr($instance['title']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('limit');
?>
"><?php
_e('Number of events', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('limit');
?>
" name="<?php
echo $this->get_field_name('limit');
?>
" size="3" value="<?php
echo esc_attr($instance['limit']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
_e('Scope', 'dbem');
?>
: </label><br/>
<select id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == $instance['scope'] ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<label for="<?php
echo $this->get_field_id('order');
?>
"><?php
_e('Order By', 'dbem');
?>
: </label>
<select id="<?php
echo $this->get_field_id('orderby');
?>
" name="<?php
echo $this->get_field_name('orderby');
?>
">
<?php
//.........这里部分代码省略.........
示例7: _e
</option>
<?php
}
?>
</select>
<br/>
<em><?php
_e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.', 'dbem');
?>
</em>
</td>
</tr>
<?php
em_options_select(__('Event list scope', 'dbem'), 'dbem_events_page_scope', em_get_scopes(), __('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.', 'dbem'));
em_options_input_text(__('Event List Limits', 'dbem'), 'dbem_events_default_limit', __("This will control how many events are shown on one list by default.", 'dbem'));
echo $save_button;
?>
</table>
</div> <!-- . inside -->
</div> <!-- .postbox -->
<?php
if (get_option('dbem_locations_enabled')) {
?>
<div class="postbox " id="em-opt-location-pages" >
<div class="handlediv" title="<?php
__('Click to toggle', 'dbem');
示例8: form
/** @see WP_Widget::form */
function form($instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
esc_html_e('Title', 'events-manager');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo esc_attr($instance['title']);
?>
" class="widefat" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('limit');
?>
"><?php
esc_html_e('Number of events', 'events-manager');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('limit');
?>
" name="<?php
echo $this->get_field_name('limit');
?>
" size="3" value="<?php
echo esc_attr($instance['limit']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
esc_html_e('Scope', 'events-manager');
?>
: </label><br/>
<select id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" class="widefat" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo esc_attr($key);
?>
' <?php
echo $key == $instance['scope'] ? "selected='selected'" : '';
?>
>
<?php
echo esc_html($value);
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<label for="<?php
echo $this->get_field_id('order');
?>
"><?php
esc_html_e('Order By', 'events-manager');
?>
: </label>
<select id="<?php
echo $this->get_field_id('orderby');
?>
" name="<?php
echo $this->get_field_name('orderby');
?>
" class="widefat">
<?php
foreach ($this->em_orderby_options as $key => $value) {
?>
//.........这里部分代码省略.........
示例9: form
/** @see WP_Widget::form */
function form($instance)
{
$instance = array_merge($this->defaults, $instance);
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo esc_attr($instance['title']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('limit');
?>
"><?php
_e('Show number of locations', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('limit');
?>
" name="<?php
echo $this->get_field_name('limit');
?>
" value="<?php
echo esc_attr($instance['limit']);
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
_e('Scope of the locations', 'dbem');
?>
:</label><br/>
<select id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == get_option('dbem_events_page_scope') ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<label for="<?php
echo $this->get_field_id('order');
?>
"><?php
_e('Order By', 'dbem');
?>
: </label>
<select id="<?php
echo $this->get_field_id('orderby');
?>
" name="<?php
echo $this->get_field_name('orderby');
?>
">
<?php
echo $this->em_orderby_options;
?>
<?php
foreach ($this->em_orderby_options as $key => $value) {
?>
//.........这里部分代码省略.........
示例10: em_admin_options_page
//.........这里部分代码省略.........
foreach ($order_options as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == get_option('dbem_events_default_order') ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<br/>
<em><?php
_e('When Events Manager displays lists of events the default behaviour is ordering by start date in ascending order. To change this, modify the values above.', 'dbem');
?>
</em>
</td>
</tr>
<tr valign="top" id='dbem_events_display_time_limit'>
<th scope="row"><?php
_e('Event list scope', 'dbem');
?>
</th>
<td>
<select name="dbem_events_page_scope" >
<?php
foreach (em_get_scopes() as $key => $value) {
?>
<option value='<?php
echo $key;
?>
' <?php
echo $key == get_option('dbem_events_page_scope') ? "selected='selected'" : '';
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
<br />
<em><?php
_e('Only show events starting within a certain time limit on the events page. Default is future events with no end time limit.', 'dbem');
?>
</em>
</td>
</tr>
<?php
echo $save_button;
?>
</table>
</div> <!-- . inside -->
</div> <!-- .postbox -->
示例11: em_events_admin
/**
* Outputs table of events belonging to user
* Additional search arguments:
* * show_add_new - passes argument to template as $show_add_new whether to show the add new event button
* @param array $args
*/
function em_events_admin($args = array())
{
global $EM_Event, $bp;
if (is_user_logged_in() && current_user_can('edit_events')) {
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, 'event_id' => null));
}
em_event_form();
} else {
if (get_option('dbem_css_editors')) {
echo '<div class="css-events-admin">';
}
//template $args for different views
$args_views['pending'] = array('status' => 0, 'owner' => get_current_user_id(), 'scope' => 'all', 'recurring' => 'include');
$args_views['draft'] = array('status' => null, 'owner' => get_current_user_id(), 'scope' => 'all', 'recurring' => 'include');
$args_views['past'] = array('status' => 'all', 'owner' => get_current_user_id(), 'scope' => 'past');
$args_views['future'] = array('status' => '1', 'owner' => get_current_user_id(), 'scope' => 'future');
//get listing options for $args
$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';
$search = !empty($_REQUEST['em_search']) ? $_REQUEST['em_search'] : '';
//deal with view or scope/status combinations
$show_add_new = isset($args['show_add_new']) ? $args['show_add_new'] : true;
$args = array('order' => $order, 'search' => $search, 'owner' => get_current_user_id());
if (!empty($_REQUEST['view']) && in_array($_REQUEST['view'], array('future', 'draft', 'past', 'pending'))) {
$args = array_merge($args, $args_views[$_REQUEST['view']]);
} else {
$scope_names = em_get_scopes();
$args['scope'] = !empty($_REQUEST['scope']) && array_key_exists($_REQUEST['scope'], $scope_names) ? $_REQUEST['scope'] : 'future';
if (array_key_exists('status', $_REQUEST)) {
$status = $_REQUEST['status'] ? 1 : 0;
if ($_REQUEST['status'] == 'all') {
$status = 'all';
}
if ($_REQUEST['status'] == 'draft') {
$status = null;
}
} else {
$status = false;
}
$args['status'] = $status;
}
$events_count = EM_Events::count($args);
//count events without limits for pagination
$args['limit'] = $limit;
$args['offset'] = $offset;
$EM_Events = EM_Events::get($args);
//now get the limited events to display
$future_count = EM_Events::count($args_views['future']);
$pending_count = EM_Events::count($args_views['pending']);
$draft_count = EM_Events::count($args_views['draft']);
$past_count = EM_Events::count($args_views['past']);
em_locate_template('tables/events.php', true, array('args' => $args, 'EM_Events' => $EM_Events, 'events_count' => $events_count, 'future_count' => $future_count, 'pending_count' => $pending_count, 'draft_count' => $draft_count, 'past_count' => $past_count, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => $show_add_new));
if (get_option('dbem_css_editors')) {
echo '</div>';
}
}
} elseif (!is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
em_event_form($args);
} else {
if (get_option('dbem_css_editors')) {
echo '<div class="css-events-admin">';
}
echo '<div class="css-events-admin-login">' . apply_filters('em_event_submission_login', __("You must log in to view and manage your events.", 'dbem')) . '</div>';
if (get_option('dbem_css_editors')) {
echo '</div>';
}
}
}
示例12: em_events_admin
/**
* Outputs table of events belonging to user
* @param array $args
*/
function em_events_admin($args = array())
{
global $EM_Event, $bp;
if (is_user_logged_in() && current_user_can('edit_events')) {
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, 'event_id' => null));
}
em_event_form();
} else {
$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';
$scope_names = em_get_scopes();
$scope = !empty($_REQUEST['scope']) && array_key_exists($_REQUEST['scope'], $scope_names) ? $_REQUEST['scope'] : 'future';
if (array_key_exists('status', $_REQUEST)) {
$status = $_REQUEST['status'] ? 1 : 0;
} else {
$status = false;
}
$search = !empty($_REQUEST['em_search']) ? $_REQUEST['em_search'] : '';
$args = array('scope' => $scope, 'order' => $order, 'search' => $search, 'owner' => get_current_user_id(), 'status' => $status);
$events_count = EM_Events::count($args);
//count events without limits for pagination
$args['limit'] = $limit;
$args['offset'] = $offset;
$EM_Events = EM_Events::get($args);
if ($scope != 'future') {
$future_count = EM_Events::count(array('status' => 1, 'owner' => get_current_user_id(), 'scope' => 'future'));
} else {
$future_count = $events_count;
}
$pending_count = EM_Events::count(array('status' => 0, 'owner' => get_current_user_id(), 'scope' => 'all'));
em_locate_template('tables/events.php', true, array('args' => $args, 'EM_Events' => $EM_Events, 'events_count' => $events_count, 'future_count' => $future_count, 'pending_count' => $pending_count, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => true));
}
} elseif (!is_user_logged_in() && get_option('dbem_events_anonymous_submissions')) {
em_event_form($args);
} else {
echo apply_filters('em_event_submission_login', __("You must log in to view and manage your events.", 'dbem'));
}
}
示例13: form
/** @see WP_Widget::form */
function form($instance)
{
$instance = array_merge($this->defaults, $instance);
$instance = $this->fix_scope($instance);
// depcreciate
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" value="<?php
echo $instance['title'];
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('limit');
?>
"><?php
_e('Number of events', 'dbem');
?>
: </label>
<input type="text" id="<?php
echo $this->get_field_id('limit');
?>
" name="<?php
echo $this->get_field_name('limit');
?>
" size="3" value="<?php
echo $instance['limit'];
?>
" />
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
_e('Scope of the events', 'dbem');
?>
:</label><br/>
<select id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" >
<option value="future" <?php
echo $instance['scope'] == 'future' ? 'selected="selected"' : '';
?>
><?php
_e('Future events', 'dbem');
?>
</option>
<option value="all" <?php
echo $instance['scope'] == 'all' ? 'selected="selected"' : '';
?>
><?php
_e('All events', 'dbem');
?>
</option>
<option value="past" <?php
echo $instance['scope'] == 'past' ? 'selected="selected"' : '';
?>
><?php
_e('Past events', 'dbem');
?>
</option>
</select>
</p>
<p>
<label for="<?php
echo $this->get_field_id('scope');
?>
"><?php
_e('Scope', 'dbem');
?>
: </label><br/>
<select id="<?php
echo $this->get_field_id('scope');
?>
" name="<?php
echo $this->get_field_name('scope');
?>
" >
<?php
foreach (em_get_scopes() as $key => $value) {
//.........这里部分代码省略.........
示例14: em_migrate_v3
function em_migrate_v3()
{
global $wpdb, $current_user;
get_currentuserinfo();
$errors = array();
//approve all old events
$wpdb->query('UPDATE ' . EM_EVENTS_TABLE . ' SET event_status=1');
//give all old events a default ticket
$wpdb->query('TRUNCATE TABLE ' . EM_TICKETS_TABLE);
$wpdb->query("INSERT INTO " . EM_TICKETS_TABLE . " (`event_id`, `ticket_name`, `ticket_spaces`) SELECT event_id, 'Standard' as ticket_name, event_spaces FROM " . EM_EVENTS_TABLE . " WHERE recurrence!=1 and event_rsvp=1");
//create permalinks for each location, category, event
$array = array('event' => EM_EVENTS_TABLE, 'location' => EM_LOCATIONS_TABLE, 'category' => EM_CATEGORIES_TABLE);
foreach ($array as $prefix => $table) {
$used_slugs = array();
$results = $wpdb->get_results("SELECT {$prefix}_id AS id, {$prefix}_slug AS slug, {$prefix}_name AS name FROM {$table}", ARRAY_A);
foreach ($results as $row) {
$slug = sanitize_title($row['name']);
$count = 2;
while (in_array($slug, $used_slugs)) {
$slug = preg_replace('/\\-[0-9]+$/', '', $slug) . '-' . $count;
$count++;
}
$wpdb->query("UPDATE {$table} SET {$prefix}_slug='{$slug}' WHERE {$prefix}_id={$row['id']}");
$used_slugs[] = $slug;
}
}
//categories
$wpdb->query('DELETE FROM ' . EM_META_TABLE . " WHERE meta_key='event-category'");
$wpdb->query('INSERT INTO ' . EM_META_TABLE . " (`meta_key`,`meta_value`,`object_id`) SELECT 'event-category' as meta_key, event_category_id, event_id FROM " . EM_EVENTS_TABLE . " WHERE recurrence!=1 AND event_category_id IS NOT NULL");
update_option('em_notice_migrate_v3', 1);
//change some old values so it doesn't surprise admins with new features
update_option('dbem_events_page_search', 0);
$time_limit = get_option('dbem_events_page_time_limit');
if (is_numeric($time_limit) && $time_limit > 0) {
$scopes = em_get_scopes();
if (array_key_exists($time_limit . '-months', $scopes)) {
update_option('dbem_events_page_scope', $time_limit . '-months');
} elseif (array_key_exists('month', $scopes)) {
update_option('dbem_events_page_scope', 'month');
} else {
update_option('dbem_events_page_scope', 'future');
}
}
}
示例15: em_get_scopes
<?php
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
global $wpdb, $bp, $EM_Event, $EM_Notices;
$url = $bp->events->link . 'my-events/';
//url to this page
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'ASC';
$limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
//Default limit
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
$search = !empty($_REQUEST['em_search']) ? $_REQUEST['em_search'] : '';
$scope_names = em_get_scopes();
$scope = !empty($_REQUEST['scope']) && array_key_exists($_REQUEST['scope'], $scope_names) ? $_REQUEST['scope'] : 'future';
if (array_key_exists('status', $_REQUEST)) {
$status = $_REQUEST['status'] ? 1 : 0;
} else {
$status = false;
}
$args = array('scope' => $scope, 'limit' => 0, 'order' => $order, 'search' => $search, 'owner' => get_current_user_id(), 'status' => $status);
$EM_Events = EM_Events::get($args);
$events_count = count($EM_Events);
$future_count = EM_Events::count(array('status' => 1, 'owner' => get_current_user_id(), 'scope' => 'future'));
$pending_count = EM_Events::count(array('status' => 0, 'owner' => get_current_user_id(), 'scope' => 'all'));
$use_events_end = get_option('dbem_use_event_end');
echo $EM_Notices;
?>
<div class="wrap">
<?php
echo $EM_Notices;
?>