/** * @var WP_Post $post * @var bool $show_global_stock * @var Tribe__Tickets__Global_Stock $global_stock */ // Don't load directly if (!defined('ABSPATH')) { die('-1'); } $header_id = get_post_meta(get_the_ID(), $this->image_header_field, true); $header_id = !empty($header_id) ? $header_id : ''; $header_img = ''; if (!empty($header_id)) { $header_img = wp_get_attachment_image($header_id, 'full'); } $modules = Tribe__Tickets__Tickets::modules(); ?> <table id="event_tickets" class="eventtable"> <?php wp_nonce_field('tribe-tickets-meta-box', 'tribe-tickets-post-settings'); if (get_post_meta(get_the_ID(), '_EventOrigin', true) === 'community-events') { ?> <tr> <td colspan="2" class="tribe_sectionheader updated"> <p class="error-message"><?php esc_html_e('This event was created using Community Events. Are you sure you want to sell tickets for it?', 'event-tickets'); ?> </p> </td> </tr>
/** * Attempts to load the specified ticket type post object. * * @param int $ticket_id * * @return Tribe__Tickets__Ticket_Object|null */ public static function load_ticket_object($ticket_id) { foreach (Tribe__Tickets__Tickets::modules() as $provider_class => $name) { $provider = call_user_func(array($provider_class, 'get_instance')); $event = $provider->get_event_for_ticket($ticket_id); if (!$event) { continue; } $ticket_object = $provider->get_ticket($event->ID, $ticket_id); if ($ticket_object) { return $ticket_object; } } return null; }
/** * Provides an array containing the value of the ATTENDEE_EVENT_KEY class constant * for each active ticketing provider. * * @return array */ protected function get_event_keys() { $event_keys = array(); foreach (Tribe__Tickets__Tickets::modules() as $module_class => $module_instance) { /** * The usage of plain `$module_class::ATTENDEE_EVENT_KEY` will throw a `T_PAAMAYIM_NEKUDOTAYIM` * when using PHP 5.2, which is a fatal. * * So we have to construct the constant name using a string and use the `constant` function. */ $event_keys[] = constant("{$module_class}::ATTENDEE_EVENT_KEY"); } return $event_keys; }
/** * Checks the user in, for all the *Tickets modules running. * * @param $ticket_id */ private function _check_in($ticket_id) { $modules = Tribe__Tickets__Tickets::modules(); foreach ($modules as $class => $module) { if (!is_callable(array($class, 'get_instance'))) { continue; } $obj = call_user_func(array($class, 'get_instance')); $obj->checkin($ticket_id, false); } }
/** * Scan for the presence of any "old school" ticketing providers. * * For each (if any) that is discovered, the main class name of that plugin is * added to the $this->active_legacy_modules array. */ protected function find_active_legacy_modules() { $legacy_classes = array('Tribe__Events__Tickets__Woo__Main', 'Tribe__Events__Tickets__EDD__Main', 'Tribe__Events__Tickets__Shopp__Main', 'Tribe__Events__Tickets__Wpec__Main'); $active_ticket_modules = Tribe__Tickets__Tickets::modules(); $this->active_legacy_modules = array_intersect(array_keys($active_ticket_modules), $legacy_classes); }