本文整理汇总了PHP中EM_Event::output方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Event::output方法的具体用法?PHP EM_Event::output怎么用?PHP EM_Event::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Event
的用法示例。
在下文中一共展示了EM_Event::output方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: em_event_submission_emails
/**
* @param boolean $result
* @param EM_Event $EM_Event
* @return boolean
*/
function em_event_submission_emails($result, $EM_Event)
{
if ($result) {
//if this is just published, we need to email the user about the publication, or send to pending mode again for review
$cant_publish_event = $EM_Event->is_individual() && !user_can($EM_Event->get_contact()->ID, 'publish_events');
$cant_publish_recurring_event = $EM_Event->is_recurring() && !user_can($EM_Event->get_contact()->ID, 'publish_recurring_events');
$output_type = get_option('dbem_smtp_html') ? 'html' : 'email';
if ($cant_publish_event || $cant_publish_recurring_event) {
if ($EM_Event->is_published() && !$EM_Event->previous_status) {
//only send email to users that can't publish events themselves and that were previously unpublished
$approvals_count = get_post_meta($EM_Event->post_id, '_event_approvals_count', true);
$approvals_count = $approvals_count > 0 ? $approvals_count : 0;
if ($approvals_count == 1) {
$subject = $EM_Event->output(get_option('dbem_event_approved_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_approved_email_body'), $output_type);
} else {
$subject = $EM_Event->output(get_option('dbem_event_reapproved_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_reapproved_email_body'), $output_type);
}
if ($EM_Event->event_owner == "") {
return true;
}
$EM_Event->email_send($subject, $body, $EM_Event->get_contact()->user_email);
} elseif (!$EM_Event->get_status() && get_option('dbem_event_submitted_email_admin') != '') {
$approvals_count = get_post_meta($EM_Event->post_id, '_event_approvals_count', true);
$approvals_count = $approvals_count > 0 ? $approvals_count : 0;
update_post_meta($EM_Event->post_id, '_event_approvals_count', $approvals_count + 1);
$admin_emails = explode(',', str_replace(' ', '', get_option('dbem_event_submitted_email_admin')));
//admin emails are in an array, single or multiple
if (empty($admin_emails)) {
return true;
}
if ($approvals_count > 1) {
$subject = $EM_Event->output(get_option('dbem_event_resubmitted_email_subject'), 'raw');
$message = $EM_Event->output(get_option('dbem_event_resubmitted_email_body'), $output_type);
} else {
$subject = $EM_Event->output(get_option('dbem_event_submitted_email_subject'), 'raw');
$message = $EM_Event->output(get_option('dbem_event_submitted_email_body'), $output_type);
}
//Send email to admins
$EM_Event->email_send($subject, $message, $admin_emails);
}
} elseif (!current_user_can('list_users')) {
if ($EM_Event->is_published() && !$EM_Event->previous_status) {
$admin_emails = explode(',', str_replace(' ', '', get_option('dbem_event_submitted_email_admin')));
//admin emails are in an array, single or multiple
if (empty($admin_emails)) {
return true;
}
$subject = $EM_Event->output(get_option('dbem_event_published_email_subject'), 'raw');
$body = $EM_Event->output(get_option('dbem_event_published_email_body'), $output_type);
$EM_Event->email_send($subject, $body, $admin_emails);
}
}
}
return $result;
}
示例2: em_event_added_email
/**
* @param EM_Event $EM_Event
* @return string
*/
function em_event_added_email($EM_Event)
{
if (!$EM_Event->get_status() && get_option('dbem_bookings_approval') && get_option('dbem_event_submitted_email_admin') != '') {
$admin_emails = explode(',', get_option('dbem_event_submitted_email_admin'));
//admin emails are in an array, single or multiple
$subject = $EM_Event->output(get_option('dbem_event_submitted_email_subject'));
$message = $EM_Event->output(get_option('dbem_event_submitted_email_body'));
//Send email to admins
$EM_Event->email_send($subject, $message, $admin_emails);
}
}
示例3: em_get_event_shortcode
/**
* Shows a list of events according to given specifications. Accepts any event query attribute.
* @param array $atts
* @return string
*/
function em_get_event_shortcode($atts, $format = '')
{
$atts = (array) $atts;
$atts['format'] = $format != '' || empty($atts['format']) ? $format : $atts['format'];
$atts['format'] = html_entity_decode($atts['format']);
//shorcode doesn't accept html
if (!empty($atts['event']) && is_numeric($atts['event'])) {
$EM_Event = new EM_Event($atts['event']);
return !empty($atts['format']) ? $EM_Event->output($atts['format']) : $EM_Event->output_single();
}
}
示例4: 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);
//.........这里部分代码省略.........
示例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;
}
//.........这里部分代码省略.........