/**
  * Legacy ticketing modules relied on core The Events Calendar code to generate the price field,
  * this method takes over that responsibility.
  */
 public function add_fields($price = null, $regular_price = null)
 {
     $metabox_template = Tribe__Tickets__Main::instance()->plugin_path . 'src/admin-views/legacy-ticket-fields.php';
     foreach ($this->active_legacy_modules as $legacy_identifier) {
         include $metabox_template;
     }
 }
Example #2
0
 /**
  * Get (and instantiate, if necessary) the instance of the class
  *
  * @static
  * @return Tribe__Tickets__Woo__Main
  */
 public static function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Example #3
0
 /**
  * Adds the "orders" link in the admin list row actions for each event.
  *
  * @param $actions
  *
  * @return array
  */
 public function orders_row_action($actions)
 {
     global $post;
     // the orders table only works with WooCommerce
     if (!class_exists('WooCommerce')) {
         return $actions;
     }
     if (!in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types())) {
         return $actions;
     }
     $url = add_query_arg(array('post_type' => $post->post_type, 'page' => self::$orders_slug, 'event_id' => $post->ID), admin_url('edit.php'));
     $actions['tickets_orders'] = sprintf('<a title="%s" href="%s">%s</a>', esc_html__('See purchases for this event', 'event-tickets'), esc_url($url), esc_html__('Orders', 'event-tickets'));
     return $actions;
 }
Example #4
0
 /**
  * Enqueue the tickets metabox JS and CSS
  * @static
  *
  * @param $hook
  */
 public static function add_admin_scripts($hook)
 {
     global $post;
     $modules = apply_filters('tribe_events_tickets_modules', null);
     /* Only load the resources in the event edit screen, and if there's a provider available */
     if ($hook != 'post-new.php' && $hook != 'post.php' || !in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types()) || empty($modules)) {
         return;
     }
     $resources_url = plugins_url('src/resources', dirname(dirname(__FILE__)));
     wp_enqueue_style('event-tickets', $resources_url . '/css/tickets.css', array(), Tribe__Tickets__Main::instance()->css_version());
     wp_enqueue_script('event-tickets', $resources_url . '/js/tickets.js', array('jquery-ui-datepicker'), Tribe__Tickets__Main::instance()->js_version(), true);
     $upload_header_data = array('title' => esc_html__('Ticket header image', 'event-tickets'), 'button' => esc_html__('Set as ticket header', 'event-tickets'));
     wp_localize_script('event-tickets', 'HeaderImageData', $upload_header_data);
     $nonces = array('add_ticket_nonce' => wp_create_nonce('add_ticket_nonce'), 'edit_ticket_nonce' => wp_create_nonce('edit_ticket_nonce'), 'remove_ticket_nonce' => wp_create_nonce('remove_ticket_nonce'));
     wp_localize_script('event-tickets', 'TribeTickets', $nonces);
 }
Example #5
0
 /**
  * Gets the sum of all the stock for all the tickets associated to an event.
  *
  * @param int|string|WP_Post $event Either an event post `ID` or a `WP_Post` instance for an event.
  */
 public function get_total_for($event)
 {
     $event = get_post($event);
     $supported_post_types = Tribe__Tickets__Main::instance()->post_types();
     if (empty($event) || !in_array($event->post_type, $supported_post_types)) {
         return new WP_Error('not-an-event', sprintf('The post with ID "%s" is not an event.', $event->ID));
     }
     $sum = 0;
     $all_tickets = Tribe__Tickets__Tickets::get_all_event_tickets($event->ID);
     /** @var Tribe__Tickets__Ticket_Object $ticket */
     foreach ($all_tickets as $ticket) {
         $sum += $ticket->stock();
     }
     // return the sum
     return $sum;
 }
Example #6
0
 /**
  * Hook the necessary filters and Actions!
  * @return void
  */
 public static function hook()
 {
     $myself = self::instance();
     // This will include before the RSVP
     add_action('tribe_events_single_event_after_the_meta', array($myself, 'render'), 4);
     // Add the Admin Option for removing the Attendees List
     add_action('tribe_events_tickets_metabox_pre', array($myself, 'render_admin_options'));
     foreach (Tribe__Tickets__Main::instance()->post_types() as $post_type) {
         add_action('save_post_' . $post_type, array($myself, 'save_attendees_list_option'));
     }
     // Create the ShortCode
     add_shortcode('tribe_attendees_list', array($myself, 'shortcode'));
     // Purging the attendees cache on all the modules
     // @todo: make this a little bit more clean
     add_action('event_tickets_rsvp_ticket_created', array($myself, 'purge_transient'), 10, 3);
     add_action('wootickets_generate_ticket_attendee', array($myself, 'purge_transient'), 10, 3);
     add_action('event_tickets_shopp_ticket_created', array($myself, 'shopp_purge_transient'), 10, 2);
     add_action('event_tickets_edd_ticket_created', array($myself, 'edd_purge_transient'), 10, 2);
     add_action('event_tickets_wpec_ticket_created', array($myself, 'wpec_purge_transient'), 10, 2);
 }
 /**
  * Enqueue the tickets metabox JS and CSS
  * @static
  *
  * @param $hook
  */
 public static function add_admin_scripts($hook)
 {
     global $post;
     $modules = apply_filters('tribe_events_tickets_modules', null);
     /* Only load the resources in the event edit screen, and if there's a provider available */
     if ($hook != 'post-new.php' && $hook != 'post.php' || !in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types()) || empty($modules)) {
         return;
     }
     $resources_url = plugins_url('src/resources', dirname(dirname(__FILE__)));
     wp_enqueue_style('event-tickets', $resources_url . '/css/tickets.css', array(), Tribe__Tickets__Main::instance()->css_version());
     wp_enqueue_script('event-tickets', $resources_url . '/js/tickets.js', array('jquery-ui-datepicker'), Tribe__Tickets__Main::instance()->js_version(), true);
     wp_localize_script('event-tickets', 'tribe_ticket_notices', array('confirm_alert' => __('Are you sure you want to delete this ticket? This cannot be undone.', 'event-tickets')));
     $upload_header_data = array('title' => esc_html__('Ticket header image', 'event-tickets'), 'button' => esc_html__('Set as ticket header', 'event-tickets'));
     wp_localize_script('event-tickets', 'HeaderImageData', $upload_header_data);
     wp_localize_script('event-tickets', 'tribe_global_stock_admin_ui', array('nav_away_msg' => __('It looks like you have modified your global stock settings but have not saved or updated the post.', 'event-tickets')));
     self::localize_decimal_character();
     $nonces = array('add_ticket_nonce' => wp_create_nonce('add_ticket_nonce'), 'edit_ticket_nonce' => wp_create_nonce('edit_ticket_nonce'), 'remove_ticket_nonce' => wp_create_nonce('remove_ticket_nonce'));
     wp_localize_script('event-tickets', 'TribeTickets', $nonces);
     wp_enqueue_script('tribe-bumpdown');
 }
Example #8
0
 /**
  * Enqueue the tickets metabox JS and CSS
  * @static
  *
  * @param $hook
  */
 public static function add_admin_scripts($hook)
 {
     global $post;
     $modules = apply_filters('tribe_events_tickets_modules', null);
     /* Only load the resources in the event edit screen, and if there's a provider available */
     if ($hook != 'post-new.php' && $hook != 'post.php' || !in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types()) || empty($modules)) {
         return;
     }
     $resources_url = plugins_url('src/resources', dirname(dirname(__FILE__)));
     wp_enqueue_style('event-tickets', $resources_url . '/css/tickets.css', array(), Tribe__Tickets__Main::instance()->css_version());
     wp_enqueue_script('event-tickets', $resources_url . '/js/tickets.js', array('jquery-ui-datepicker'), Tribe__Tickets__Main::instance()->js_version(), true);
     $upload_header_data = array('title' => esc_html__('Ticket header image', 'event-tickets'), 'button' => esc_html__('Set as ticket header', 'event-tickets'));
     wp_localize_script('event-tickets', 'HeaderImageData', $upload_header_data);
     wp_localize_script('event-tickets', 'tribe_global_stock_admin_ui', array('nav_away_msg' => __('It looks like you have modified your global stock settings but have not saved or updated the post.', 'event-tickets')));
     $locale = localeconv();
     $decimal = isset($locale['decimal_point']) ? $locale['decimal_point'] : '.';
     /**
      * Filter the decimal point character used in the price
      */
     $decimal = apply_filters('tribe_event_ticket_decimal_point', $decimal);
     wp_localize_script('event-tickets', 'price_format', array('decimal' => $decimal, 'decimal_error' => __('Please enter in without thousand separators and currency symbols.', 'event-tickets')));
     $nonces = array('add_ticket_nonce' => wp_create_nonce('add_ticket_nonce'), 'edit_ticket_nonce' => wp_create_nonce('edit_ticket_nonce'), 'remove_ticket_nonce' => wp_create_nonce('remove_ticket_nonce'));
     wp_localize_script('event-tickets', 'TribeTickets', $nonces);
 }
 /**
  * Handler for the order status column
  *
  * @param $item
  *
  * @return string
  */
 public function column_order_status($item)
 {
     $icon = '';
     $warning = false;
     // Check if the order_warning flag has been set (to indicate the order has been cancelled, refunded etc)
     if (isset($item['order_warning']) && $item['order_warning']) {
         $warning = true;
     }
     // If the warning flag is set, add the appropriate icon
     if ($warning) {
         $icon = sprintf("<span class='warning'><img src='%s'/></span> ", esc_url(Tribe__Tickets__Main::instance()->plugin_url . 'src/resources/images/warning.png'));
     }
     // Look for an order_status_label, fall back on the actual order_status string @todo remove fallback in 3.4.3
     if (empty($item['order_status'])) {
         $item['order_status'] = '';
     }
     $label = isset($item['order_status_label']) ? $item['order_status_label'] : ucwords($item['order_status']);
     return $icon . $label;
 }
 /**
  * Enqueues the JS and CSS for the attendees page in the admin
  *
  * @param $hook
  */
 public function attendees_page_load_css_js($hook)
 {
     if ($hook != $this->attendees_page) {
         return;
     }
     $resources_url = plugins_url('src/resources', dirname(dirname(__FILE__)));
     wp_enqueue_style(self::$attendees_slug, $resources_url . '/css/tickets-attendees.css', array(), Tribe__Tickets__Main::instance()->css_version());
     wp_enqueue_style(self::$attendees_slug . '-print', $resources_url . '/css/tickets-attendees-print.css', array(), Tribe__Tickets__Main::instance()->css_version(), 'print');
     wp_enqueue_script(self::$attendees_slug, $resources_url . '/js/tickets-attendees.js', array('jquery'), Tribe__Tickets__Main::instance()->js_version());
     $mail_data = array('nonce' => wp_create_nonce('email-attendee-list'), 'required' => esc_html__('You need to select a user or type a valid email address', 'event-tickets'), 'sending' => esc_html__('Sending...', 'event-tickets'), 'checkin_nonce' => wp_create_nonce('checkin'), 'uncheckin_nonce' => wp_create_nonce('uncheckin'));
     wp_localize_script(self::$attendees_slug, 'Attendees', $mail_data);
 }
Example #11
0
 /**
  * Loads the timezone settings from an admin-view file and returns them as an array.
  *
  * @return array
  */
 protected function get_settings_array()
 {
     $plugin_path = Tribe__Tickets__Main::instance()->plugin_path;
     include $plugin_path . 'src/admin-views/tribe-options-tickets.php';
     return $tickets_tab;
 }
Example #12
0
 /**
  * Loads theme files in appropriate hierarchy: 1) child theme,
  * 2) parent template, 3) plugin resources. will look in the events/
  * directory in a theme and the views/ directory in the plugin
  *
  * @param string $template template file to search for
  * @param array  $args     additional arguments to affect the template path
  *                         - namespace
  *                         - plugin_path
  *                         - disable_view_check - bypass the check to see if the view is enabled
  *
  * @return string
  **/
 public static function get_template_hierarchy($template, $args = array())
 {
     if (!is_array($args)) {
         $args = array();
         $passed = func_get_args();
         $backwards_map = array('namespace', 'plugin_path', 'disable_view_check');
         $count = count($passed);
         if ($count > 1) {
             for ($i = 1; $i < $count; $i++) {
                 $args[$backwards_map[$i - 1]] = $passed[$i];
             }
         }
     }
     $args = wp_parse_args($args, array('namespace' => '/', 'plugin_path' => '', 'disable_view_check' => false));
     $namespace = $args['namespace'];
     $plugin_path = $args['plugin_path'];
     $disable_view_check = $args['disable_view_check'];
     // append .php to file name
     if (substr($template, -4) != '.php') {
         $template .= '.php';
     }
     /**
      * Allow base path for templates to be filtered
      *
      * @var array
      */
     $template_base_paths = apply_filters('tribe_tickets_template_paths', (array) Tribe__Tickets__Main::instance()->plugin_path);
     // backwards compatibility if $plugin_path arg is used
     if ($plugin_path && !in_array($plugin_path, $template_base_paths)) {
         array_unshift($template_base_paths, $plugin_path);
     }
     // ensure that addon plugins look in the right override folder in theme
     $namespace = !empty($namespace) ? trailingslashit($namespace) : $namespace;
     $file = false;
     /* potential scenarios:
     
     		- the user has no template overrides
     			-> we can just look in our plugin dirs, for the specific path requested, don't need to worry about the namespace
     		- the user created template overrides without the namespace, which reference non-overrides without the namespace and, their own other overrides without the namespace
     			-> we need to look in their theme for the specific path requested
     			-> if not found, we need to look in our plugin views for the file by adding the namespace
     		- the user has template overrides using the namespace
     			-> we should look in the theme dir, then the plugin dir for the specific path requested, don't need to worry about the namespace
     
     		*/
     // check if there are overrides at all
     if (locate_template(array('tribe-events/'))) {
         $overrides_exist = true;
     } else {
         $overrides_exist = false;
     }
     if ($overrides_exist) {
         // check the theme for specific file requested
         $file = locate_template(array('tribe-events/' . $template), false, false);
     }
     // if the theme file wasn't found, check our plugins views dirs
     if (!$file) {
         foreach ($template_base_paths as $template_base_path) {
             // make sure directories are trailingslashed
             $template_base_path = !empty($template_base_path) ? trailingslashit($template_base_path) : $template_base_path;
             $file = $template_base_path . 'src/views/' . $template;
             /**
              * Filter the template file path before inclusion
              *
              * @var string File path
              * @var string Template filename
              */
             $file = apply_filters('tribe_tickets_template', $file, $template);
             // return the first one found
             if (file_exists($file)) {
                 break;
             } else {
                 $file = false;
             }
         }
     }
     /**
      * Filter the template file path before inclusion for the specific requested template
      *
      * @var string File path
      */
     return apply_filters('tribe_tickets_template_' . $template, $file);
 }
Example #13
0
     */
    if (apply_filters('tribe_tickets_current_user_can_delete_ticket', true, $ticket->ID, $ticket->provider_class)) {
        $controls[] = sprintf('<span><a href="#" attr-provider="%1$s" attr-ticket-id="%2$s" id="ticket_delete_%2$s" class="ticket_delete">' . esc_html__('Delete', 'event-tickets') . '</a></span>', $ticket->provider_class, $ticket->ID);
    }
    if ($ticket->frontend_link && get_post_status($post_id) == 'publish') {
        $controls[] = sprintf("<span><a href='%s'>" . esc_html__('View', 'event-tickets') . '</a></span>', esc_url($ticket->frontend_link));
    }
    if (is_admin()) {
        if ($ticket->admin_link) {
            $controls[] = sprintf("<span><a href='%s'>" . esc_html__('Edit in %s', 'event-tickets') . '</a></span>', esc_url($ticket->admin_link), $modules[$ticket->provider_class]);
        }
        $report = $provider_obj->get_ticket_reports_link($post_id, $ticket->ID);
        if ($report) {
            $controls[] = $report;
        }
        $move_type_url = add_query_arg(array('dialog' => Tribe__Tickets__Main::instance()->move_ticket_types()->dialog_name(), 'ticket_type_id' => $ticket->ID, 'check' => wp_create_nonce('move_tickets'), 'TB_iframe' => 'true'));
        $controls[] = sprintf('<a href="%1$s" class="thickbox">' . __('Move', 'event-tickets') . '</a>', $move_type_url);
    }
    if ($ticket->provider_class !== $provider || $count == 0) {
        ?>
			<td colspan="4" class="titlewrap">
				<h4 class="tribe_sectionheader">
					<?php 
        echo esc_html(apply_filters('tribe_events_tickets_module_name', $modules[$ticket->provider_class], $ticket->provider_class));
        echo $provider_obj->get_event_reports_link($post_id);
        ?>
					<small>&nbsp;|&nbsp;</small>
					<?php 
        $attendees_url = add_query_arg(array('post_type' => $post_type, 'page' => Tribe__Tickets__Tickets_Handler::$attendees_slug, 'event_id' => $post_id), admin_url('edit.php'));
        echo sprintf("<small><a title='" . esc_attr__('See who purchased tickets to this event', 'event-tickets') . "' href='%s'>%s</a></small>", esc_url(apply_filters('tribe_events_tickets_attendees_url', $attendees_url, $post_id)), esc_html__('Attendees', 'event-tickets'));
        ?>
Example #14
0
 /**
  * Accepts a reference to a product (either an object or a numeric ID) and
  * tests to see if it functions as a ticket: if so, the corresponding event
  * object is returned. If not, boolean false is returned.
  *
  * @param $ticket_product
  *
  * @return bool|WP_Post
  */
 public function get_event_for_ticket($ticket_product)
 {
     if (is_object($ticket_product) && isset($ticket_product->ID)) {
         $ticket_product = $ticket_product->ID;
     }
     if (null === ($product = get_post($ticket_product))) {
         return false;
     }
     if ('' === ($event = get_post_meta($ticket_product, self::$event_key, true))) {
         return false;
     }
     if (in_array(get_post_type($event), Tribe__Tickets__Main::instance()->post_types())) {
         return get_post($event);
     }
     return false;
 }
Example #15
0
 public function front_end_tickets_form_in_content($content)
 {
     global $post;
     if (is_admin()) {
         return $content;
     }
     // if this isn't a post for some reason, bail
     if (!$post instanceof WP_Post) {
         return $content;
     }
     // if this isn't a supported post type, bail
     if (!in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types())) {
         return $content;
     }
     // if this is a tribe_events post, let's bail because those post types are handled with a different hook
     if ('tribe_events' === $post->post_type) {
         return $content;
     }
     // if there aren't any tickets, bail
     $tickets = $this->get_tickets($post->ID);
     if (empty($tickets)) {
         return $content;
     }
     ob_start();
     $this->front_end_tickets_form($content);
     $form = ob_get_clean();
     $content .= $form;
     return $content;
 }
Example #16
0
 public function front_end_tickets_form_in_content($content)
 {
     global $post;
     // Prevents firing more then it needs too outside of the loop
     $in_the_loop = isset($GLOBALS['wp_query']->in_the_loop) && $GLOBALS['wp_query']->in_the_loop;
     if (is_admin() || !$in_the_loop) {
         return $content;
     }
     // if this isn't a post for some reason, bail
     if (!$post instanceof WP_Post) {
         return $content;
     }
     // if this isn't a supported post type, bail
     if (!in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types())) {
         return $content;
     }
     // if this is a tribe_events post, let's bail because those post types are handled with a different hook
     if ('tribe_events' === $post->post_type) {
         return $content;
     }
     // if there aren't any tickets, bail
     $tickets = $this->get_tickets($post->ID);
     if (empty($tickets)) {
         return $content;
     }
     ob_start();
     $this->front_end_tickets_form($content);
     $form = ob_get_clean();
     $content .= $form;
     return $content;
 }
Example #17
0
 /**
  * Renders the advanced fields in the new/edit ticket form.
  * Using the method, providers can add as many fields as
  * they want, specific to their implementation.
  *
  *
  * @param $event_id
  * @param $ticket_id
  *
  * @return mixed
  */
 public function do_metabox_advanced_options($event_id, $ticket_id)
 {
     $stock = '';
     if (!empty($ticket_id)) {
         $ticket = $this->get_ticket($event_id, $ticket_id);
         if (!empty($ticket)) {
             $stock = $ticket->original_stock();
         }
     }
     include Tribe__Tickets__Main::instance()->plugin_path . 'src/admin-views/rsvp-metabox-advanced.php';
 }
Example #18
0
 public function enqueue_scripts()
 {
     wp_enqueue_style('event-tickets-plus-tickets');
     wp_enqueue_script('event-tickets-plus-attendees-list');
     $post_types = Tribe__Tickets__Main::instance()->post_types();
 }
Example #19
0
/**
 * Returns or echoes a url to a file in the Event Tickets plugin resources directory
 *
 * @category Tickets
 * @param string $resource the filename of the resource
 * @param bool   $echo     whether or not to echo the url
 * @param string $root_dir directory to hunt for resource files (src or common)
 *
 * @return string
 **/
function tribe_tickets_resource_url($resource, $echo = false, $root_dir = 'src')
{
    $extension = pathinfo($resource, PATHINFO_EXTENSION);
    if ('src' !== $root_dir) {
        return tribe_resource_url($resource, $echo, $root_dir);
    }
    $resources_path = $root_dir . '/resources/';
    switch ($extension) {
        case 'css':
            $resource_path = $resources_path . 'css/';
            break;
        case 'js':
            $resource_path = $resources_path . 'js/';
            break;
        case 'scss':
            $resource_path = $resources_path . 'scss/';
            break;
        default:
            $resource_path = $resources_path;
            break;
    }
    $path = $resource_path . $resource;
    $url = plugins_url(Tribe__Tickets__Main::instance()->plugin_dir . $path);
    /**
     * Filter the ticket resource URL
     *
     * @var $url Resource URL
     * @var $resource The filename of the resource
     */
    $url = apply_filters('tribe_tickets_resource_url', $url, $resource);
    if ($echo) {
        echo esc_url($url);
    }
    return $url;
}
Example #20
0
 /**
  * Checks if the standalone Tickets plugin is activated.
  * If it's not, it loads the Tickets framework from our
  * vendor/ submodule.
  */
 public function maybe_load_tickets_framework()
 {
     if (defined('EVENT_TICKETS_DIR')) {
         return;
     }
     // Give the standalone plugin a chance to load on activation
     // WordPress loads all the active plugins before activating a new one.
     if (isset($_GET['action']) && $_GET['action'] == 'activate' && isset($_GET['plugin']) && strstr($_GET['plugin'], 'event-tickets.php')) {
         return;
     }
     // if there aren't any ticket plugins activated, bail
     if (!defined('EVENT_TICKETS_PLUS') && !defined('EVENTS_TICKETS_EDD_DIR') && !defined('EVENTS_TICKETS_SHOPP_DIR') && !defined('EVENTS_TICKETS_WOO_DIR') && !defined('EVENTS_TICKETS_WPEC_DIR')) {
         return;
     }
     require_once $this->plugin_path . 'vendor/tickets/event-tickets.php';
     Tribe__Tickets__Main::instance()->plugins_loaded();
 }
 /**
  * Populates the status column.
  *
  * @param array $item
  *
  * @return string
  */
 public function column_status(array $item)
 {
     $icon = '';
     $warning = false;
     // Check if the order_warning flag has been set (to indicate the order has been cancelled, refunded etc)
     if (isset($item['order_warning']) && $item['order_warning']) {
         $warning = true;
     }
     // If the warning flag is set, add the appropriate icon
     if ($warning) {
         $icon = sprintf("<span class='warning'><img src='%s'/></span> ", esc_url(Tribe__Tickets__Main::instance()->plugin_url . 'src/resources/images/warning.png'));
     }
     // Look for an order_status_label, fall back on the actual order_status string @todo remove fallback in 3.4.3
     if (empty($item['order_status'])) {
         $item['order_status'] = '';
     }
     $label = isset($item['order_status_label']) ? $item['order_status_label'] : ucwords($item['order_status']);
     $order_id_url = $this->get_order_id_url($item);
     if (!empty($order_id_url) && !empty($item['order_id'])) {
         $label = '<a href="' . esc_url($order_id_url) . '">#' . esc_html($item['order_id']) . ' &ndash; ' . $label . '</a>';
     } elseif (!empty($item['order_id'])) {
         $label = '#' . esc_html($item['order_id']) . ' &ndash; ' . $label;
     }
     /**
      * Provides an opportunity to modify the order status text within
      * the attendees table.
      *
      * @param string $order_status_html
      * @param array  $item
      */
     return apply_filters('tribe_tickets_attendees_table_order_status', $icon . $label, $item);
 }
Example #22
0
 public function register_resources()
 {
     wp_register_script('jquery-cookie', plugins_url('vendor/jquery.cookie/jquery.cookie.js', dirname(dirname(__FILE__))), array('jquery'), Tribe__Tickets__Main::instance()->js_version(), true);
     wp_register_script('jquery-deparam', plugins_url('vendor/jquery.deparam/jquery.deparam.js', dirname(dirname(__FILE__))), array(), Tribe__Tickets__Main::instance()->js_version());
     wp_register_script('event-tickets-meta', plugins_url('resources/js/meta.js', dirname(__FILE__)), array('jquery-cookie', 'jquery-deparam'), Tribe__Tickets__Main::instance()->js_version(), true);
     wp_register_style('event-tickets-meta', plugins_url('resources/css/meta.css', dirname(__FILE__)), array(), Tribe__Tickets__Main::instance()->css_version());
     wp_register_script('event-tickets-meta-admin', plugins_url('resources/js/meta-admin.js', dirname(__FILE__)), array('jquery-ui-draggable', 'jquery-ui-droppable'), Tribe__Tickets__Main::instance()->js_version());
     wp_register_script('event-tickets-meta-report', plugins_url('resources/js/meta-report.js', dirname(__FILE__)), array(), Tribe__Tickets__Main::instance()->js_version());
 }
Example #23
0
 /**
  * Determines if this is a suitable opportunity to inject ticket form content into a post.
  * Expects to run within "the_content".
  *
  * @return bool
  */
 protected function should_inject_ticket_form_into_post_content()
 {
     global $post;
     // Prevents firing more then it needs too outside of the loop
     $in_the_loop = isset($GLOBALS['wp_query']->in_the_loop) && $GLOBALS['wp_query']->in_the_loop;
     if (is_admin() || !$in_the_loop) {
         return false;
     }
     // if this isn't a post for some reason, bail
     if (!$post instanceof WP_Post) {
         return false;
     }
     // if this isn't a supported post type, bail
     if (!in_array($post->post_type, Tribe__Tickets__Main::instance()->post_types())) {
         return false;
     }
     // if this is a tribe_events post, let's bail because those post types are handled with a different hook
     if ('tribe_events' === $post->post_type) {
         return false;
     }
     // if there aren't any tickets, bail
     $tickets = $this->get_tickets($post->ID);
     if (empty($tickets)) {
         return false;
     }
     return true;
 }
 /**
  * Returns a list of post types for which tickets are currently enabled.
  *
  * The list is expressed as an array in the following format:
  *
  *     [ 'slug' => 'name', ... ]
  *
  * @return array
  */
 protected function get_post_types_list()
 {
     $types_list = array('all' => __('All supported types', 'tribe-tickets'));
     foreach (Tribe__Tickets__Main::instance()->post_types() as $type) {
         $pto = get_post_type_object($type);
         $types_list[$type] = $pto->label;
     }
     return $types_list;
 }
Example #25
0
Author URI: http://m.tri.be/28
License: GPLv2 or later
Text Domain: event-tickets
Domain Path: /lang/
*/
/*
Copyright 2010-2012 by Modern Tribe Inc and the contributors

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
if (!defined('ABSPATH')) {
    die('-1');
}
define('EVENT_TICKETS_DIR', dirname(__FILE__));
define('EVENT_TICKETS_MAIN_PLUGIN_FILE', __FILE__);
// the main plugin class
require_once EVENT_TICKETS_DIR . '/src/Tribe/Main.php';
Tribe__Tickets__Main::instance();
 /**
  * Enqueues the JS and CSS for the attendees page in the admin
  *
  * @param $hook
  */
 public function attendees_page_load_css_js($hook)
 {
     if ($hook != $this->attendees_page) {
         return;
     }
     $resources_url = plugins_url('src/resources', dirname(dirname(__FILE__)));
     wp_enqueue_style(self::$attendees_slug, $resources_url . '/css/tickets-attendees.css', array(), Tribe__Tickets__Main::instance()->css_version());
     wp_enqueue_style(self::$attendees_slug . '-print', $resources_url . '/css/tickets-attendees-print.css', array(), Tribe__Tickets__Main::instance()->css_version(), 'print');
     wp_enqueue_script(self::$attendees_slug, $resources_url . '/js/tickets-attendees.js', array('jquery'), Tribe__Tickets__Main::instance()->js_version());
     add_thickbox();
     $mail_data = array('nonce' => wp_create_nonce('email-attendee-list'), 'required' => esc_html__('You need to select a user or type a valid email address', 'event-tickets'), 'sending' => esc_html__('Sending...', 'event-tickets'), 'checkin_nonce' => wp_create_nonce('checkin'), 'uncheckin_nonce' => wp_create_nonce('uncheckin'), 'cannot_move' => esc_html__('You must first select one or more tickets before you can move them!', 'event-tickets'), 'move_url' => add_query_arg(array('dialog' => Tribe__Tickets__Main::instance()->move_tickets()->dialog_name(), 'check' => wp_create_nonce('move_tickets'), 'TB_iframe' => 'true')));
     wp_localize_script(self::$attendees_slug, 'Attendees', $mail_data);
 }