本文整理汇总了PHP中EM_Events::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Events::delete方法的具体用法?PHP EM_Events::delete怎么用?PHP EM_Events::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Events
的用法示例。
在下文中一共展示了EM_Events::delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: bp_em_remove_data
/**
* Delete events when you delete a user.
*/
function bp_em_remove_data($user_id)
{
$EM_Events = EM_Events::get(array('scope' => 'all', 'owner' => $user_id, 'status' => false));
EM_Events::delete($EM_Events);
}
示例3: delete_events
/**
* Removes all reoccurring events.
* @param $recurrence_id
* @return null
*/
function delete_events()
{
global $wpdb;
do_action('em_event_delete_events_pre', $this);
//So we don't do something we'll regret later, we could just supply the get directly into the delete, but this is safer
$result = false;
if ($this->can_manage('delete_events', 'delete_others_events')) {
$EM_Events = EM_Events::get(array('recurrence_id' => $this->id));
$event_ids = array();
foreach ($EM_Events as $EM_Event) {
if ($EM_Event->recurrence_id == $this->id) {
$event_ids[] = $EM_Event->id;
//ONLY ADD if id's match - hard coded
}
}
$result = EM_Events::delete($event_ids);
}
return apply_filters('delete_events', $result, $this);
}
示例4: em_delete_blog
function em_delete_blog($blog_id)
{
global $wpdb;
$prefix = $wpdb->get_blog_prefix($blog_id);
$wpdb->query('DROP TABLE ' . $prefix . 'em_events');
$wpdb->query('DROP TABLE ' . $prefix . 'em_bookings');
$wpdb->query('DROP TABLE ' . $prefix . 'em_locations');
$wpdb->query('DROP TABLE ' . $prefix . 'em_tickets');
$wpdb->query('DROP TABLE ' . $prefix . 'em_tickets_bookings');
$wpdb->query('DROP TABLE ' . $prefix . 'em_meta');
//delete events if MS Global
if (EM_MS_GLOBAL) {
EM_Events::delete(array('limit' => 0, 'blog' => $blog_id));
EM_Locations::delete(array('limit' => 0, 'blog' => $blog_id));
}
}
示例5: 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;
}
//.........这里部分代码省略.........
示例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;
//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_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);
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();
}
if ($_REQUEST['action'] == 'event_save' && current_user_can('edit_events')) {
//Check Nonces
if (is_admin()) {
if (!wp_verify_nonce($_REQUEST['_wpnonce'] && 'event_save')) {
check_admin_referer('trigger_error');
}
} else {
if (!wp_verify_nonce($_REQUEST['_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)
$EM_Notices->add_confirm($EM_Event->feedback_message);
if (is_admin()) {
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : '';
$scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope'] : '';
//wp_redirect( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager&pno='.$page.'&scope='.$scope.'&message='.urlencode($EM_Event->feedback_message));
} else {
$redirect = !empty($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : wp_get_referer();
wp_redirect($redirect);
}
$events_result = true;
} else {
$EM_Notices->add_error($EM_Event->get_errors());
$events_result = false;
}
}
if ($_REQUEST['action'] == 'event_duplicate') {
global $EZSQL_ERROR;
$EM_Event = $EM_Event->duplicate();
if ($EM_Event === false) {
$EM_Notices->add_error($EM_Event->errors, true);
} else {
if ($EM_Event->id == $_REQUEST['event_id']) {
$EM_Notices->add_confirm($EM_Event->feedback_message . " " . sprintf(__('You are now viewing the duplicated %s.', 'dbem'), __('event', 'dbem')), true);
} else {
$EM_Notices->add_confirm($EM_Event->feedback_message, true);
}
}
}
if ($_REQUEST['action'] == 'event_delete') {
//.........这里部分代码省略.........
示例7: em_admin_events_page
/**
* Determines whether to show event page or events page, and saves any updates to the event or events
* @return null
*/
function em_admin_events_page()
{
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
global $wpdb;
global $EM_Event;
$action = !empty($_GET['action']) ? $_GET['action'] : '';
$order = !empty($_GET['order']) ? $_GET['order'] : 'ASC';
$limit = !empty($_GET['limit']) ? $_GET['limit'] : 20;
//Default limit
$page = !empty($_GET['pno']) ? $_GET['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
$scope_names = array('past' => __('Past events', 'dbem'), 'all' => __('All events', 'dbem'), 'future' => __('Future events', 'dbem'));
$scope = !empty($_GET['scope']) && array_key_exists($_GET['scope'], $scope_names) ? $_GET['scope'] : 'future';
$selectedEvents = !empty($_GET['events']) ? $_GET['events'] : '';
// DELETE action
if ($action == 'deleteEvents' && EM_Object::array_is_numeric($selectedEvents)) {
EM_Events::delete($selectedEvents);
}
// No action, only showing the events list
switch ($scope) {
case "past":
$title = __('Past Events', 'dbem');
break;
case "all":
$title = __('All Events', 'dbem');
break;
default:
$title = __('Future Events', 'dbem');
$scope = "future";
}
$args = array('scope' => $scope, 'limit' => 0, 'order' => $order);
if (!get_option('dbem_permissions_events') && !em_verify_admin()) {
$args['owner'] = get_current_user_id();
}
$events = EM_Events::get($args);
$events_count = count($events);
$use_events_end = get_option('dbem_use_event_end');
?>
<div class="wrap">
<div id="icon-events" class="icon32"><br />
</div>
<h2>
<?php
echo $title;
?>
<a href="admin.php?page=events-manager-event" class="button add-new-h2"><?php
_e('Add New', 'dbem');
?>
</a>
</h2>
<?php
$link = array();
$link['past'] = "<a href='" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=events-manager&scope=past&order=desc'>" . __('Past events', 'dbem') . "</a>";
$link['all'] = " <a href='" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=events-manager&scope=all&order=desc'>" . __('All events', 'dbem') . "</a>";
$link['future'] = " <a href='" . get_bloginfo('wpurl') . "/wp-admin/admin.php?page=events-manager&scope=future'>" . __('Future events', 'dbem') . "</a>";
?>
<?php
if (!empty($_GET['error'])) {
?>
<div id='message' class='error'>
<p><?php
echo $_GET['error'];
?>
</p>
</div>
<?php
}
?>
<?php
if (!empty($_GET['message'])) {
?>
<div id='message' class='updated fade'>
<p><?php
echo $_GET['message'];
?>
</p>
</div>
<?php
}
?>
<form id="posts-filter" action="" method="get"><input type='hidden' name='page' value='events-manager' />
<ul class="subsubsub">
<li><a href='#' class="current"><?php
_e('Total', 'dbem');
?>
<span class="count">(<?php
echo count($events);
?>
)</span></a></li>
</ul>
<p class="search-box">
<label class="screen-reader-text" for="post-search-input"><?php
_e('Search Events', 'dbem');
?>
:</label>
//.........这里部分代码省略.........