public function get_raw_message() { global $wpdb; $wpectickets = Tribe__Tickets_Plus__Commerce__WPEC__Main::get_instance(); $data = $this->purchase_log->get_data(); $args = array('post_type' => $wpectickets->attendee_object, 'meta_key' => $wpectickets->atendee_order_key, 'meta_value' => $data['id'], 'posts_per_page' => -1); $query = new WP_Query($args); $attendees = array(); foreach ($query->posts as $post) { $order_id = $data['id']; $usersql = $wpdb->prepare('SELECT DISTINCT `' . WPSC_TABLE_SUBMITTED_FORM_DATA . '`.value, `' . WPSC_TABLE_CHECKOUT_FORMS . '`.* FROM `' . WPSC_TABLE_CHECKOUT_FORMS . '` LEFT JOIN `' . WPSC_TABLE_SUBMITTED_FORM_DATA . '` ON `' . WPSC_TABLE_CHECKOUT_FORMS . '`.id = `' . WPSC_TABLE_SUBMITTED_FORM_DATA . '`.`form_id` WHERE `' . WPSC_TABLE_SUBMITTED_FORM_DATA . "`.log_id=%d and unique_name in ('billingfirstname','billinglastname','billingemail') ORDER BY `" . WPSC_TABLE_CHECKOUT_FORMS . '`.`unique_name`', $order_id); $formfields = $wpdb->get_results($usersql); $name = array(); $name[0] = !empty($formfields[1]->value) ? $formfields[1]->value : ''; $name[1] = !empty($formfields[2]->value) ? $formfields[2]->value : ''; $name = join($name, ' '); $product = get_post(get_post_meta($post->ID, $wpectickets->atendee_product_key, true)); $ticket_unique_id = get_post_meta($post->ID, '_unique_id', true); $ticket_unique_id = $ticket_unique_id === '' ? $post->ID : $ticket_unique_id; $attendees[] = array('event_id' => get_post_meta($post->ID, $wpectickets->atendee_event_key, true), 'product_id' => $product->ID, 'ticket_name' => $product->post_title, 'holder_name' => $name, 'order_id' => $order_id, 'ticket_id' => $ticket_unique_id, 'qr_ticket_id' => $post->ID, 'security_code' => get_post_meta($post->ID, $wpectickets->security_code, true)); } $this->html_message = Tribe__Tickets_Plus__Commerce__WPEC__Main::get_instance()->generate_tickets_email_content($attendees); $this->wpec_tickets_email_msg = $this->html_message; return $this->html_message; }
/** * Get (and instantiate, if necessary) the instance of the class * * @static * @return Tribe__Tickets_Plus__Commerce__WPEC__Main */ public static function get_instance() { if (!self::$instance instanceof self) { self::$instance = new self(); } return self::$instance; }
/** * Check if WPEC is installed and active. * If it is and the version is compatible, load our WPEC connector. */ protected function wpecommerce() { // Check if the legacy plugin exists if (class_exists('Tribe__Events__Tickets__Wpec__Main')) { $args = array('action' => 'deactivate', 'plugin' => $this->get_plugin_file('The Events Calendar: WPEC Tickets'), 'plugin_status' => 'all', 'paged' => 1, 's' => ''); $deactivate_url = wp_nonce_url(add_query_arg($args, 'plugins.php'), 'deactivate-plugin_' . $args['plugin']); $this->nag_data['wpecommerce'] = array(__('WP eCommerce', 'event-tickets-plus'), $deactivate_url, 'legacy-plugin'); return; } if (!class_exists('WP_eCommerce')) { return; } // Here we will check for Comptibility problems if (!version_compare(WPSC_VERSION, Tribe__Tickets_Plus__Commerce__WPEC__Main::REQUIRED_WPEC_VERSION, '>=')) { $this->nag_data['wpecommerce'] = array(__('WP eCommerce', 'event-tickets-plus'), add_query_arg(array('tab' => 'plugin-information', 'plugin' => 'wp-e-commerce', 'TB_iframe' => 'true'), admin_url('plugin-install.php')), 'incompatible'); return; } Tribe__Tickets_Plus__Commerce__WPEC__Main::get_instance(); }