function _eventorganiser_load_eo_confirmation_page_session() { if (!defined('EVENT_ORGANISER_PRO_DIR') || version_compare('1.9', EVENT_ORGANISER_PRO_VER) > 0) { return; } // Include Eric Mann's WP Session Manager // This isn't working for now as requiring it directly like this produces a 'headers already sent' error in PHP, which doesn't happen if // the plugin is loaded as normal in WordPress (rather than included as a library here) // require(dirname(__FILE__) . '/inc/wp-session-manager/wp-session-manager.php'); // require(dirname(__FILE__) . '/lib/confirmation-page-session.php'); require dirname(__FILE__) . '/lib/class-confirmation-page-session.php'; require dirname(__FILE__) . '/lib/shortcodes.php'; // Check if wp_session_manager exists. If it does, use it. If it doesn't, fall back to $_SESSSION. If neither exist, display an error if (class_exists('WP_Session')) { //Don't use PHP sessions as WP_Session exists Confirmation_Page_Session::get_instance(false)->init(); } elseif (session_status() === PHP_SESSION_NONE || session_status() === PHP_SESSION_ACTIVE) { // WP_Session doesn't exist, but we can use $_SESSION Confirmation_Page_Session::get_instance(true)->init(); } else { //We have neither WP_Session or $_SESSION. Oh dear. Display an error add_action('admin_notices', array(Confirmation_Page_Session::get_instance(), 'display_no_session_error')); } // add_action( 'admin_notices', array(Confirmation_Page_Session::get_instance(), 'display_no_session_error') ); }
<?php $booking_id = Confirmation_Page_Session::get_instance()->get_booking_id($a['unset']); // Take the unset argument from the shortcode. True by default if ($booking_id) { $ticket_quantity = eo_get_booking_meta($booking_id, 'ticket_quantity'); $event_id = eo_get_booking_meta($booking_id, 'event_id'); $occurrence_id = eo_get_booking_meta($booking_id, 'occurrence_id'); $event_title = get_the_title($event_id); $event_date = eo_get_the_start(get_option('date_format', 'l jS F Y'), $event_id, null, $occurrence_id); // Echo the booking confirmation message, passing it through gettext $booking_message = sprintf(__('You have booked %d ticket(s) to %s on %s with booking reference %d. Please check your email for a copy of your tickets.', 'eo-confirmation-page-session'), $ticket_quantity, $event_title, $event_date, $booking_id); ?> <div class="confirmation-message"> <?php echo $booking_message; ?> </div> <div class="confirmation-ticket-table"> <?php // Based on the code of eventorganiser_email_ticket_list() $booking_tickets = eo_get_booking_tickets($booking_id, false); $total_price = eo_get_booking_meta($booking_id, 'booking_amount'); $booking_table = sprintf('<table> <thead><tr> <th>%s</th><th> %s </th></tr></thead> <tbody>', __('Ticket', 'eventorganiserp'), __('Price', 'eventorganiserp')); foreach ($booking_tickets as $ticket) { $booking_table .= sprintf('<tr> <td>%s<td> %s </td></tr>', esc_html($ticket->ticket_name), eo_format_price($ticket->ticket_price)); }
public static function get_instance($use_php_sessions = null) { NULL === self::$instance and self::$instance = new self($use_php_sessions); return self::$instance; }