@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML{ |
|
29 | - public function __construct($template_file,$args = array(), $options_array = array()) { |
|
30 | - $html = EEH_Template::locate_template( $template_file, $args ); |
|
28 | +class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML { |
|
29 | + public function __construct($template_file, $args = array(), $options_array = array()) { |
|
30 | + $html = EEH_Template::locate_template($template_file, $args); |
|
31 | 31 | |
32 | 32 | // echo " filepath:$template_file html $html"; |
33 | 33 | parent::__construct($html, $options_array); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * |
4 | 4 | * EE_Billing_Info_Form |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @author Mike Nelson |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Billing_Info_Form extends EE_Form_Section_Proper{ |
|
14 | +class EE_Billing_Info_Form extends EE_Form_Section_Proper { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * The payment method this billing form is for |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * @param EE_Payment_Method $payment_method |
27 | 27 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
28 | 28 | */ |
29 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
29 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
30 | 30 | $this->_pm_instance = $payment_method; |
31 | 31 | $this->_layout_strategy = new EE_Div_Per_Section_Layout(); |
32 | - parent::__construct( $options_array ); |
|
32 | + parent::__construct($options_array); |
|
33 | 33 | |
34 | 34 | } |
35 | 35 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param EE_Payment_Method $payment_method |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function set_payment_method( EE_Payment_Method $payment_method ){ |
|
43 | + public function set_payment_method(EE_Payment_Method $payment_method) { |
|
44 | 44 | $this->_pm_instance = $payment_method; |
45 | 45 | } |
46 | 46 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * Returns the instance of the payment method this billing form is for |
51 | 51 | * @return EE_Payment_Method |
52 | 52 | */ |
53 | - public function payment_method(){ |
|
53 | + public function payment_method() { |
|
54 | 54 | return $this->_pm_instance; |
55 | 55 | } |
56 | 56 | |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * payment_fields_autofilled_notice_html |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - public function payment_fields_autofilled_notice_html(){ |
|
63 | + public function payment_fields_autofilled_notice_html() { |
|
64 | 64 | return new EE_Form_Section_HTML( |
65 | 65 | EEH_HTML::p( |
66 | - apply_filters( 'FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __( 'Payment fields have been autofilled because you are in debug mode', 'event_espresso' )), |
|
66 | + apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', __('Payment fields have been autofilled because you are in debug mode', 'event_espresso')), |
|
67 | 67 | '', |
68 | 68 | 'important-notice' |
69 | 69 | ) |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | /** |
76 | 76 | * @return string |
77 | 77 | */ |
78 | - public function html_class(){ |
|
79 | - return ! empty( $this->_html_class ) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form'; |
|
78 | + public function html_class() { |
|
79 | + return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @subpackage messages |
21 | 21 | * @author Darren Ethier |
22 | 22 | */ |
23 | -class EE_Pdf_messenger extends EE_messenger { |
|
23 | +class EE_Pdf_messenger extends EE_messenger { |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @see abstract declaration in EE_messenger for details. |
66 | 66 | */ |
67 | 67 | protected function _set_admin_pages() { |
68 | - $this->admin_registered_pages = array( 'events_edit' => false ); |
|
68 | + $this->admin_registered_pages = array('events_edit' => false); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | protected function _set_validator_config() { |
86 | 86 | $this->_validator_config = array( |
87 | 87 | 'subject' => array( |
88 | - 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email','event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
88 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
89 | 89 | ), |
90 | 90 | 'content' => array( |
91 | - 'shortcodes' => array( 'recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email','event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
91 | + 'shortcodes' => array('recipient_details', 'organization', 'event', 'ticket', 'venue', 'primary_registration_details', 'event_author', 'email', 'event_meta', 'recipient_list', 'transaction', 'datetime_list', 'datetime') |
|
92 | 92 | ), |
93 | 93 | 'attendee_list' => array( |
94 | 94 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | 'required' => array('[EVENT_LIST]') |
100 | 100 | ), |
101 | 101 | 'ticket_list' => array( |
102 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'), |
|
102 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
103 | 103 | 'required' => array('[TICKET_LIST]') |
104 | 104 | ), |
105 | 105 | 'datetime_list' => array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function enqueue_scripts_styles() { |
121 | 121 | parent::enqueue_scripts_styles(); |
122 | - do_action( 'AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
122 | + do_action('AHEE__EE_Pdf_messenger__enqueue_scripts_styles'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -245,18 +245,18 @@ discard block |
||
245 | 245 | */ |
246 | 246 | protected function _send_message() { |
247 | 247 | $this->_template_args = array( |
248 | - 'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8"), |
|
249 | - 'base_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation ), |
|
250 | - 'print_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation ), |
|
251 | - 'main_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation ), |
|
252 | - 'extra_css' => EE_LIBRARIES_URL . 'messages/defaults/default/variations/pdf_base_default.css', |
|
253 | - 'main_body' => apply_filters( 'FHEE__EE_Pdf_messenger___send_message__main_body', wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )), $this->_content ) |
|
248 | + 'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"), |
|
249 | + 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation), |
|
250 | + 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation), |
|
251 | + 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation), |
|
252 | + 'extra_css' => EE_LIBRARIES_URL.'messages/defaults/default/variations/pdf_base_default.css', |
|
253 | + 'main_body' => apply_filters('FHEE__EE_Pdf_messenger___send_message__main_body', wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))), $this->_content) |
|
254 | 254 | ); |
255 | 255 | $this->_deregister_wp_hooks(); |
256 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
256 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
257 | 257 | $content = $this->_get_main_template(); |
258 | 258 | // die( $content ); |
259 | - $this->_do_pdf( $content ); |
|
259 | + $this->_do_pdf($content); |
|
260 | 260 | exit(0); |
261 | 261 | } |
262 | 262 | |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | |
281 | 281 | //just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
282 | 282 | add_action('wp_head', 'wp_enqueue_scripts'); |
283 | - add_action( 'wp_footer', 'wp_print_footer_scripts' ); |
|
284 | - add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); |
|
283 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
284 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | * @param bool $preview |
295 | 295 | * @return string |
296 | 296 | */ |
297 | - protected function _get_main_template( $preview = FALSE ) { |
|
298 | - $wrapper_template = $this->_tmp_pack->get_wrapper( 'html', 'main' ); |
|
297 | + protected function _get_main_template($preview = FALSE) { |
|
298 | + $wrapper_template = $this->_tmp_pack->get_wrapper('html', 'main'); |
|
299 | 299 | //add message type to template_args |
300 | 300 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
301 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE ); |
|
301 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -311,21 +311,21 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return void |
313 | 313 | */ |
314 | - protected function _do_pdf( $content = '' ) { |
|
315 | - $invoice_name = html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8"); |
|
314 | + protected function _do_pdf($content = '') { |
|
315 | + $invoice_name = html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8"); |
|
316 | 316 | |
317 | 317 | //only load dompdf if nobody else has yet... |
318 | - if( ! defined('DOMPDF_DIR')){ |
|
318 | + if ( ! defined('DOMPDF_DIR')) { |
|
319 | 319 | define('DOMPDF_ENABLE_REMOTE', TRUE); |
320 | 320 | define('DOMPDF_ENABLE_JAVASCRIPT', FALSE); |
321 | 321 | define('DOMPDF_ENABLE_CSS_FLOAT', TRUE); |
322 | - require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php'); |
|
322 | + require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php'); |
|
323 | 323 | } |
324 | 324 | $dompdf = new DOMPDF(); |
325 | 325 | $dompdf->load_html($content); |
326 | 326 | $dompdf->render(); |
327 | 327 | //forcing the browser to open a download dialog. |
328 | - $dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => TRUE )); |
|
328 | + $dompdf->stream($invoice_name.".pdf", array('Attachment' => TRUE)); |
|
329 | 329 | } |
330 | 330 | |
331 | 331 |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Event Espresso |
7 | 7 | * @subpackage messages |
8 | 8 | */ |
9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
10 | 10 | exit('NO direct script access allowed'); |
11 | 11 | |
12 | 12 | /** |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @subpackage messages |
20 | 20 | * @author Darren Ethier |
21 | 21 | */ |
22 | -class EE_Html_messenger extends EE_messenger { |
|
22 | +class EE_Html_messenger extends EE_messenger { |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @see abstract declaration in EE_messenger for details. |
63 | 63 | */ |
64 | 64 | protected function _set_admin_pages() { |
65 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
65 | + $this->admin_registered_pages = array('events_edit' => true); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | protected function _set_validator_config() { |
83 | 83 | $this->_validator_config = array( |
84 | 84 | 'subject' => array( |
85 | - 'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction' ) |
|
85 | + 'shortcodes' => array('organization', 'primary_registration_details', 'email', 'transaction') |
|
86 | 86 | ), |
87 | 87 | 'content' => array( |
88 | - 'shortcodes' => array( 'organization', 'primary_registration_list', 'primary_registration_details', 'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list') |
|
88 | + 'shortcodes' => array('organization', 'primary_registration_list', 'primary_registration_details', 'email', 'transaction', 'event_list', 'payment_list', 'venue', 'line_item_list', 'messenger', 'ticket_list') |
|
89 | 89 | ), |
90 | 90 | 'event_list' => array( |
91 | - 'shortcodes' => array( 'event', 'ticket_list', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author' ), |
|
91 | + 'shortcodes' => array('event', 'ticket_list', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author'), |
|
92 | 92 | 'required' => array('[EVENT_LIST]') |
93 | 93 | ), |
94 | 94 | 'ticket_list' => array( |
95 | - 'shortcodes' => array( 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'line_item_list', 'venue'), |
|
95 | + 'shortcodes' => array('attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'line_item_list', 'venue'), |
|
96 | 96 | 'required' => array('[TICKET_LIST]') |
97 | 97 | ), |
98 | 98 | 'ticket_line_item_no_pms' => array( |
99 | - 'shortcodes' => array( 'line_item', 'ticket' ), |
|
99 | + 'shortcodes' => array('line_item', 'ticket'), |
|
100 | 100 | 'required' => array('[TICKET_LINE_ITEM_LIST]') |
101 | 101 | ), |
102 | 102 | 'ticket_line_item_pms' => array( |
103 | - 'shortcodes' => array( 'line_item', 'ticket', 'line_item_list' ), |
|
103 | + 'shortcodes' => array('line_item', 'ticket', 'line_item_list'), |
|
104 | 104 | 'required' => array('[TICKET_LINE_ITEM_LIST]'), |
105 | 105 | ), |
106 | 106 | 'price_modifier_line_item_list' => array( |
107 | - 'shortcodes' => array( 'line_item' ), |
|
107 | + 'shortcodes' => array('line_item'), |
|
108 | 108 | 'required' => array('[PRICE_MODIFIER_LINE_ITEM_LIST]') |
109 | 109 | ), |
110 | 110 | 'datetime_list' => array( |
@@ -132,16 +132,16 @@ discard block |
||
132 | 132 | |
133 | 133 | |
134 | 134 | |
135 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
136 | - if ( $sending_messenger_name = 'pdf' ) { |
|
137 | - add_filter( 'EE_messenger__get_variation__variation', array( $this, 'add_html_css' ), 10, 8 ); |
|
135 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
136 | + if ($sending_messenger_name = 'pdf') { |
|
137 | + add_filter('EE_messenger__get_variation__variation', array($this, 'add_html_css'), 10, 8); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | |
142 | 142 | |
143 | - public function add_html_css( $variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters ) { |
|
144 | - $variation = $template_pack->get_variation( $this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters ); |
|
143 | + public function add_html_css($variation_path, EE_Messages_Template_Pack $template_pack, $messenger_name, $message_type_name, $url, $type, $variation, $skip_filters) { |
|
144 | + $variation = $template_pack->get_variation($this->name, $message_type_name, $type, $variation, $url, '.css', $skip_filters); |
|
145 | 145 | return $variation; |
146 | 146 | } |
147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | public function enqueue_scripts_styles() { |
156 | 156 | parent::enqueue_scripts_styles(); |
157 | - do_action( 'AHEE__EE_Html_messenger__enqueue_scripts_styles'); |
|
157 | + do_action('AHEE__EE_Html_messenger__enqueue_scripts_styles'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | ), |
215 | 215 | 'ticket_line_item_no_pms' => array( |
216 | 216 | 'input' => 'textarea', |
217 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with no Price Modifiers', 'event_espresso'), |
|
217 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with no Price Modifiers', 'event_espresso'), |
|
218 | 218 | 'type' => 'string', |
219 | 219 | 'required' => FALSE, |
220 | 220 | 'validation' => TRUE, |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ), |
226 | 226 | 'ticket_line_item_pms' => array( |
227 | 227 | 'input' => 'textarea', |
228 | - 'label' => '[TICKET_LINE_ITEM_LIST] <br>' . __('Ticket Line Item List with Price Modifiers', 'event_espresso'), |
|
228 | + 'label' => '[TICKET_LINE_ITEM_LIST] <br>'.__('Ticket Line Item List with Price Modifiers', 'event_espresso'), |
|
229 | 229 | 'type' => 'string', |
230 | 230 | 'required' => FALSE, |
231 | 231 | 'validation' => TRUE, |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * |
319 | 319 | */ |
320 | 320 | protected function _set_default_message_types() { |
321 | - $this->_default_message_types = array( 'receipt', 'invoice' ); |
|
321 | + $this->_default_message_types = array('receipt', 'invoice'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @since 4.5.0 |
330 | 330 | */ |
331 | 331 | protected function _set_valid_message_types() { |
332 | - $this->_valid_message_types = array( 'receipt', 'invoice' ); |
|
332 | + $this->_valid_message_types = array('receipt', 'invoice'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -344,15 +344,15 @@ discard block |
||
344 | 344 | */ |
345 | 345 | protected function _send_message() { |
346 | 346 | $this->_template_args = array( |
347 | - 'page_title' => html_entity_decode( stripslashes( $this->_subject ), ENT_QUOTES, "UTF-8"), |
|
348 | - 'base_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation ), |
|
349 | - 'print_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation ), |
|
350 | - 'main_css' => $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation ), |
|
351 | - 'main_body' => apply_filters( 'FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )), $this->_content ) |
|
347 | + 'page_title' => html_entity_decode(stripslashes($this->_subject), ENT_QUOTES, "UTF-8"), |
|
348 | + 'base_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'base', $this->_variation), |
|
349 | + 'print_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'print', $this->_variation), |
|
350 | + 'main_css' => $this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, TRUE, 'main', $this->_variation), |
|
351 | + 'main_body' => apply_filters('FHEE__EE_Html_messenger___send_message__main_body', wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))), $this->_content) |
|
352 | 352 | ); |
353 | 353 | |
354 | 354 | $this->_deregister_wp_hooks(); |
355 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts_styles' ) ); |
|
355 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts_styles')); |
|
356 | 356 | echo $this->_get_main_template(); |
357 | 357 | exit(); |
358 | 358 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | $wp_scripts = $wp_styles = array(); |
377 | 377 | |
378 | 378 | //just add back in wp_enqueue_scripts and wp_print_footer_scripts cause that's all we want to load. |
379 | - add_action( 'wp_footer', 'wp_print_footer_scripts' ); |
|
380 | - add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); |
|
379 | + add_action('wp_footer', 'wp_print_footer_scripts'); |
|
380 | + add_action('wp_print_footer_scripts', '_wp_footer_scripts'); |
|
381 | 381 | add_action('wp_head', 'wp_enqueue_scripts'); |
382 | 382 | } |
383 | 383 | |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return string |
393 | 393 | */ |
394 | - protected function _get_main_template( $preview = FALSE ) { |
|
395 | - $wrapper_template = $this->_tmp_pack->get_wrapper( $this->name, 'main' ); |
|
394 | + protected function _get_main_template($preview = FALSE) { |
|
395 | + $wrapper_template = $this->_tmp_pack->get_wrapper($this->name, 'main'); |
|
396 | 396 | |
397 | 397 | //include message type as a template arg |
398 | 398 | $this->_template_args['message_type'] = $this->_incoming_message_type; |
399 | 399 | |
400 | - return EEH_Template::display_template( $wrapper_template, $this->_template_args, TRUE ); |
|
400 | + return EEH_Template::display_template($wrapper_template, $this->_template_args, TRUE); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 |
@@ -167,44 +167,44 @@ discard block |
||
167 | 167 | public function __construct() { |
168 | 168 | $this->_set_props(); |
169 | 169 | //make sure classname is correct |
170 | - $classname = get_class( $this ); |
|
170 | + $classname = get_class($this); |
|
171 | 171 | //make sure required props have been set |
172 | 172 | |
173 | 173 | //if label is empty then throw an error because we should have it defined by now. |
174 | - if ( ! isset( $this->label ) ) { |
|
175 | - throw new EE_Error( sprintf( __('The label property is not set for %s. Please ensure that is set for the class.', 'event_espresso' ), $classname ) ); |
|
174 | + if ( ! isset($this->label)) { |
|
175 | + throw new EE_Error(sprintf(__('The label property is not set for %s. Please ensure that is set for the class.', 'event_espresso'), $classname)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
179 | 179 | //the reference for this template pack |
180 | - if ( ! isset( $this->dbref ) ) { |
|
181 | - throw new EE_Error( sprintf( __('The dbref property is not set for %s. Please ensure that is set for the class.', 'event_espresso' ), $classname ) ); |
|
180 | + if ( ! isset($this->dbref)) { |
|
181 | + throw new EE_Error(sprintf(__('The dbref property is not set for %s. Please ensure that is set for the class.', 'event_espresso'), $classname)); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | //make sure dbref is safe |
185 | - $this->dbref = str_replace( '-', '_', sanitize_key( $this->dbref ) ); |
|
185 | + $this->dbref = str_replace('-', '_', sanitize_key($this->dbref)); |
|
186 | 186 | |
187 | - $should_be = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $this->dbref ) ) ); |
|
187 | + $should_be = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $this->dbref))); |
|
188 | 188 | |
189 | - if ( $should_be !== $classname ) { |
|
190 | - throw new EE_Error( sprintf( __('The name of the template pack instantiated class is "%s". It should be "%s". Make sure that the name of the template pack class matches is prepended with "EE_Messages_Template_Pack_" and appended with a sentence case iteration of the value for your template pack\'s dbref property.', 'event_espresso' ), $classname, $should_be ) ); |
|
189 | + if ($should_be !== $classname) { |
|
190 | + throw new EE_Error(sprintf(__('The name of the template pack instantiated class is "%s". It should be "%s". Make sure that the name of the template pack class matches is prepended with "EE_Messages_Template_Pack_" and appended with a sentence case iteration of the value for your template pack\'s dbref property.', 'event_espresso'), $classname, $should_be)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | //if _base_path is not set then throw an error because a base path string is needed. |
194 | - if ( empty( $this->_base_path ) ) { |
|
195 | - throw new EE_Error( sprintf( __('The _base_path property is not set for %s. Please ensure that is set for the class.', 'event_espresso' ), $classname ) ); |
|
194 | + if (empty($this->_base_path)) { |
|
195 | + throw new EE_Error(sprintf(__('The _base_path property is not set for %s. Please ensure that is set for the class.', 'event_espresso'), $classname)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
199 | 199 | //if _base_url is not set then throw an error because a string is needed for variations. |
200 | - if ( empty( $this->_base_url ) ) { |
|
201 | - throw new EE_Error( sprintf( __('The _base_url property is not set for %s. Please ensure that is set for the class.', 'event_espresso' ), $classname ) ); |
|
200 | + if (empty($this->_base_url)) { |
|
201 | + throw new EE_Error(sprintf(__('The _base_url property is not set for %s. Please ensure that is set for the class.', 'event_espresso'), $classname)); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | 205 | //if $supports is not set then throw an error because that effectively means this template_pack does not have any templates! |
206 | - if ( empty( $this->_supports ) ) { |
|
207 | - throw new EE_Error( sprintf( __('The supports property is not set for %s. Please ensure that is set for the class.', 'event_espresso' ), $classname ) ); |
|
206 | + if (empty($this->_supports)) { |
|
207 | + throw new EE_Error(sprintf(__('The supports property is not set for %s. Please ensure that is set for the class.', 'event_espresso'), $classname)); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function get_templates( EE_messenger $messenger, EE_message_type $message_type ) { |
|
245 | - return isset( $this->_templates[$messenger->name][$message_type->name] ) ? $this->_templates[$messenger->name][$message_type->name] : $this->_get_templates( $messenger, $message_type ); |
|
244 | + public function get_templates(EE_messenger $messenger, EE_message_type $message_type) { |
|
245 | + return isset($this->_templates[$messenger->name][$message_type->name]) ? $this->_templates[$messenger->name][$message_type->name] : $this->_get_templates($messenger, $message_type); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * @return array Returns an multi-level associative array indexed by template context and field in the format: |
260 | 260 | * array( 'context' => array( 'field' => 'value', 'another-field', 'value' ) ); |
261 | 261 | */ |
262 | - protected function _get_templates( EE_messenger $messenger, EE_message_type $message_type ) { |
|
262 | + protected function _get_templates(EE_messenger $messenger, EE_message_type $message_type) { |
|
263 | 263 | $templates = array(); |
264 | 264 | |
265 | 265 | /** |
@@ -278,28 +278,28 @@ discard block |
||
278 | 278 | $contexts = $message_type->get_contexts(); |
279 | 279 | |
280 | 280 | |
281 | - foreach ( $contexts as $context => $details ) { |
|
282 | - foreach ( $fields as $field => $field_details ) { |
|
283 | - if ( empty( $field_details ) ) |
|
281 | + foreach ($contexts as $context => $details) { |
|
282 | + foreach ($fields as $field => $field_details) { |
|
283 | + if (empty($field_details)) |
|
284 | 284 | continue; |
285 | 285 | /** |
286 | 286 | * is this a field array (linked to a main field)? |
287 | 287 | */ |
288 | - if ( $field == 'extra' ) { |
|
289 | - foreach ( $field_details as $main_field => $sub_fields ) { |
|
290 | - foreach ( $sub_fields as $sub_field => $sub_field_details ) { |
|
288 | + if ($field == 'extra') { |
|
289 | + foreach ($field_details as $main_field => $sub_fields) { |
|
290 | + foreach ($sub_fields as $sub_field => $sub_field_details) { |
|
291 | 291 | //make sure that the template_field_ref matches what the main template field is for this template group. |
292 | 292 | $template_field_ref = $sub_field == 'main' ? $main_field : $sub_field; |
293 | - $templates[ $context ][ $main_field ][ $sub_field ] = $this->_get_specific_template( $default_pack, $messenger, $message_type, $template_field_ref, $context ); |
|
293 | + $templates[$context][$main_field][$sub_field] = $this->_get_specific_template($default_pack, $messenger, $message_type, $template_field_ref, $context); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | } else { |
297 | - $templates[ $context ][ $field ] = $this->_get_specific_template( $default_pack, $messenger, $message_type, $field, $context ); |
|
297 | + $templates[$context][$field] = $this->_get_specific_template($default_pack, $messenger, $message_type, $field, $context); |
|
298 | 298 | } |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | - $templates = apply_filters( 'FHEE__EE_Template_Pack___get_templates__templates', $templates, $messenger, $message_type, $this ); |
|
302 | + $templates = apply_filters('FHEE__EE_Template_Pack___get_templates__templates', $templates, $messenger, $message_type, $this); |
|
303 | 303 | |
304 | 304 | $this->_templates[$messenger->name][$message_type->name] = $templates; |
305 | 305 | return $templates; |
@@ -317,22 +317,22 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return string The template contents. |
319 | 319 | */ |
320 | - protected function _get_specific_template( $default_pack, EE_messenger $messenger, EE_message_type $message_type, $field, $context ) { |
|
320 | + protected function _get_specific_template($default_pack, EE_messenger $messenger, EE_message_type $message_type, $field, $context) { |
|
321 | 321 | |
322 | 322 | //default templates |
323 | - $default_templates = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_templates( $messenger, $message_type ) : array(); |
|
323 | + $default_templates = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_templates($messenger, $message_type) : array(); |
|
324 | 324 | |
325 | 325 | //first we allow for the $_base_path to be filtered. However, we assign this to a new variable so that we have the original base_path as a fallback. |
326 | - $filtered_base_path = apply_filters( 'FHEE__EE_Template_Pack___get_specific_template__filtered_base_path', $this->_base_path, $messenger, $message_type, $field, $context, $this ); |
|
326 | + $filtered_base_path = apply_filters('FHEE__EE_Template_Pack___get_specific_template__filtered_base_path', $this->_base_path, $messenger, $message_type, $field, $context, $this); |
|
327 | 327 | |
328 | 328 | $master_templates = $message_type->get_master_templates(); |
329 | - $master_templates_mt = isset( $master_templates[$messenger->name] ) ? $master_templates[$messenger->name] : $message_type->name; |
|
330 | - $full_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '_' . $context . '.template.php'; |
|
331 | - $fallback_path = $filtered_base_path . $messenger->name . '_' . $message_type->name . '_' . $field . '.template.php'; |
|
332 | - $mt_defined_full_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php'; |
|
333 | - $mt_defined_fallback_path = $filtered_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php'; |
|
334 | - $base_defined_full_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '_' . $context . '.template.php'; |
|
335 | - $base_defined_fallback_path = $this->_base_path . $messenger->name . '_' . $master_templates_mt . '_' . $field . '.template.php'; |
|
329 | + $master_templates_mt = isset($master_templates[$messenger->name]) ? $master_templates[$messenger->name] : $message_type->name; |
|
330 | + $full_path = $filtered_base_path.$messenger->name.'_'.$message_type->name.'_'.$field.'_'.$context.'.template.php'; |
|
331 | + $fallback_path = $filtered_base_path.$messenger->name.'_'.$message_type->name.'_'.$field.'.template.php'; |
|
332 | + $mt_defined_full_path = $filtered_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'_'.$context.'.template.php'; |
|
333 | + $mt_defined_fallback_path = $filtered_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'.template.php'; |
|
334 | + $base_defined_full_path = $this->_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'_'.$context.'.template.php'; |
|
335 | + $base_defined_fallback_path = $this->_base_path.$messenger->name.'_'.$master_templates_mt.'_'.$field.'.template.php'; |
|
336 | 336 | |
337 | 337 | /** |
338 | 338 | * Template checks are done hierarchically in the following order: |
@@ -346,28 +346,28 @@ discard block |
||
346 | 346 | */ |
347 | 347 | |
348 | 348 | |
349 | - if ( is_readable( $full_path ) ) { |
|
349 | + if (is_readable($full_path)) { |
|
350 | 350 | $actual_path = $full_path; |
351 | - } elseif ( is_readable( $fallback_path ) ) { |
|
351 | + } elseif (is_readable($fallback_path)) { |
|
352 | 352 | $actual_path = $fallback_path; |
353 | - } elseif ( is_readable( $mt_defined_full_path ) ) { |
|
353 | + } elseif (is_readable($mt_defined_full_path)) { |
|
354 | 354 | $actual_path = $mt_defined_full_path; |
355 | - } elseif ( is_readable( $mt_defined_fallback_path ) ) { |
|
355 | + } elseif (is_readable($mt_defined_fallback_path)) { |
|
356 | 356 | $actual_path = $mt_defined_fallback_path; |
357 | - } elseif ( is_readable( $base_defined_full_path ) ) { |
|
357 | + } elseif (is_readable($base_defined_full_path)) { |
|
358 | 358 | $actual_path = $base_defined_full_path; |
359 | - } elseif ( is_readable( $base_defined_fallback_path ) ) { |
|
359 | + } elseif (is_readable($base_defined_fallback_path)) { |
|
360 | 360 | $actual_path = $base_defined_fallback_path; |
361 | - } else { |
|
361 | + } else { |
|
362 | 362 | $actual_path = ''; |
363 | 363 | } |
364 | - if ( empty( $actual_path ) ) { |
|
365 | - $contents = isset( $default_templates[$context][$field] ) ? $default_templates[$context][$field] : ''; |
|
364 | + if (empty($actual_path)) { |
|
365 | + $contents = isset($default_templates[$context][$field]) ? $default_templates[$context][$field] : ''; |
|
366 | 366 | } else { |
367 | - $contents = EEH_Template::display_template( $actual_path, array(), TRUE ); |
|
367 | + $contents = EEH_Template::display_template($actual_path, array(), TRUE); |
|
368 | 368 | } |
369 | 369 | |
370 | - return apply_filters( 'FHEE__EE_Messages_Template_Pack__get_specific_template__contents', $contents, $actual_path, $messenger, $message_type, $field, $context, $this ); |
|
370 | + return apply_filters('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', $contents, $actual_path, $messenger, $message_type, $field, $context, $this); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @return array |
383 | 383 | */ |
384 | 384 | public function get_supports() { |
385 | - $supports = apply_filters( 'FHEE__' . get_class( $this ) . '__get_supports', $this->_supports ); |
|
386 | - return apply_filters( 'FHEE__EE_Messages_Template_Pack__get_supports', $supports, $this ); |
|
385 | + $supports = apply_filters('FHEE__'.get_class($this).'__get_supports', $this->_supports); |
|
386 | + return apply_filters('FHEE__EE_Messages_Template_Pack__get_supports', $supports, $this); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -398,11 +398,11 @@ discard block |
||
398 | 398 | * |
399 | 399 | * @return array|string |
400 | 400 | */ |
401 | - public function get_default_variation_labels( $messenger = '' ) { |
|
402 | - $label = empty( $messenger ) ? $this->_default_variation_labels : array(); |
|
403 | - $label = empty( $label ) && ! empty( $this->_default_variation_labels[$messenger] ) ? $this->_default_variation_labels[$messenger] : __('Default', 'event_espresso'); |
|
401 | + public function get_default_variation_labels($messenger = '') { |
|
402 | + $label = empty($messenger) ? $this->_default_variation_labels : array(); |
|
403 | + $label = empty($label) && ! empty($this->_default_variation_labels[$messenger]) ? $this->_default_variation_labels[$messenger] : __('Default', 'event_espresso'); |
|
404 | 404 | |
405 | - return apply_filters( 'FHEE__EE_Messages_Template_Pack__get_default_variation_labels', $label, $this->_default_variation_labels, $messenger ); |
|
405 | + return apply_filters('FHEE__EE_Messages_Template_Pack__get_default_variation_labels', $label, $this->_default_variation_labels, $messenger); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -418,25 +418,25 @@ discard block |
||
418 | 418 | * @param string $message_type if included then css variations matching the message_type are returned (must have $messenger set). Otherwise the array of variations per message type are returned. If message_type is provided but NOT the messenger, then just all variations for all messengers are returned. |
419 | 419 | * @return array |
420 | 420 | */ |
421 | - public function get_variations( $messenger = '', $message_type = '' ) { |
|
422 | - $messenger_variations = ! empty( $messenger ) && isset( $this->_variations[$messenger] ) ? $this->_variations[$messenger] : array(); |
|
421 | + public function get_variations($messenger = '', $message_type = '') { |
|
422 | + $messenger_variations = ! empty($messenger) && isset($this->_variations[$messenger]) ? $this->_variations[$messenger] : array(); |
|
423 | 423 | |
424 | 424 | //message_type provided? IF so, then we've requested a specific set of variations, so we need to make sure we set it as empty if that's not present. |
425 | - $variations = !empty( $messenger ) && !empty( $message_type ) && isset( $messenger_variations[$message_type] ) ? $messenger_variations[$message_type] : array(); |
|
425 | + $variations = ! empty($messenger) && ! empty($message_type) && isset($messenger_variations[$message_type]) ? $messenger_variations[$message_type] : array(); |
|
426 | 426 | |
427 | 427 | //now let's account for the possibility we just want all the variations for a messenger (which is indicated by providing the messenger but not the message type). |
428 | - $variations = empty( $variations ) && !empty( $messenger ) && empty( $message_type ) ? $messenger_variations : $variations; |
|
428 | + $variations = empty($variations) && ! empty($messenger) && empty($message_type) ? $messenger_variations : $variations; |
|
429 | 429 | |
430 | 430 | //filter per template pack and globally. |
431 | - $variations = apply_filters( 'FHEE__' . get_class( $this ) . '__get_variations', $variations, $messenger, $message_type ); |
|
432 | - $variations = apply_filters( 'FHEE__EE_Messages_Template_Pack__get_variations', $variations, $messenger, $message_type, $this ); |
|
431 | + $variations = apply_filters('FHEE__'.get_class($this).'__get_variations', $variations, $messenger, $message_type); |
|
432 | + $variations = apply_filters('FHEE__EE_Messages_Template_Pack__get_variations', $variations, $messenger, $message_type, $this); |
|
433 | 433 | |
434 | 434 | //prepend the _default_variation, but ONLY if we're returning the fully validated array. |
435 | - if ( !empty( $messenger ) && !empty( $message_type ) && ! empty( $variations ) ) { |
|
436 | - $variations = array( 'default' => $this->get_default_variation_labels( $messenger ) ) + $variations; |
|
435 | + if ( ! empty($messenger) && ! empty($message_type) && ! empty($variations)) { |
|
436 | + $variations = array('default' => $this->get_default_variation_labels($messenger)) + $variations; |
|
437 | 437 | } |
438 | 438 | |
439 | - return empty( $variations ) ? array( 'default' => $this->get_default_variation_labels('dft') ): $variations; |
|
439 | + return empty($variations) ? array('default' => $this->get_default_variation_labels('dft')) : $variations; |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -457,39 +457,39 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return string The variation path or url (typically css reference) |
459 | 459 | */ |
460 | - public function get_variation( $messenger, $message_type, $type, $variation, $url = true, $file_extension = '.css', $skip_filters = FALSE ) { |
|
460 | + public function get_variation($messenger, $message_type, $type, $variation, $url = true, $file_extension = '.css', $skip_filters = FALSE) { |
|
461 | 461 | |
462 | 462 | $base = $url ? $this->_base_url : $this->_base_path; |
463 | 463 | $base_path = $this->_base_path; |
464 | 464 | |
465 | - if ( ! $skip_filters ) { |
|
466 | - $base = apply_filters( 'FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this ); |
|
467 | - $base_path = apply_filters( 'FHEE__EE_Messages_Template_Pack__get_variation__base_path', $base_path, $messenger, $message_type, $type, $variation, FALSE, $file_extension, $this ); |
|
465 | + if ( ! $skip_filters) { |
|
466 | + $base = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path_or_url', $base, $messenger, $message_type, $type, $variation, $url, $file_extension, $this); |
|
467 | + $base_path = apply_filters('FHEE__EE_Messages_Template_Pack__get_variation__base_path', $base_path, $messenger, $message_type, $type, $variation, FALSE, $file_extension, $this); |
|
468 | 468 | } |
469 | 469 | |
470 | - $default_pack = get_class( $this ) != 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : $this; |
|
470 | + $default_pack = get_class($this) != 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : $this; |
|
471 | 471 | |
472 | 472 | //possible variation paths considering whether message type is present or not in the file name. |
473 | - $path_string = 'variations/' . $messenger . '_' . $message_type . '_' . $type . '_' . $variation . $file_extension; |
|
474 | - $default_path_string = 'variations/' . $messenger . '_' . $type . '_' . $variation . $file_extension; |
|
473 | + $path_string = 'variations/'.$messenger.'_'.$message_type.'_'.$type.'_'.$variation.$file_extension; |
|
474 | + $default_path_string = 'variations/'.$messenger.'_'.$type.'_'.$variation.$file_extension; |
|
475 | 475 | |
476 | 476 | //first see if fully validated file exists. |
477 | - if ( is_readable( $base_path . $path_string ) ) { |
|
478 | - $variation_path = $base . $path_string; |
|
477 | + if (is_readable($base_path.$path_string)) { |
|
478 | + $variation_path = $base.$path_string; |
|
479 | 479 | //otherwise see if default exists. |
480 | - } elseif ( is_readable( $base_path . $default_path_string ) ) { |
|
481 | - $variation_path = $base . $default_path_string; |
|
480 | + } elseif (is_readable($base_path.$default_path_string)) { |
|
481 | + $variation_path = $base.$default_path_string; |
|
482 | 482 | } else { |
483 | - $variation_path = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_default_variation( $messenger, $message_type, $type, $url, $file_extension ) : ''; |
|
483 | + $variation_path = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_default_variation($messenger, $message_type, $type, $url, $file_extension) : ''; |
|
484 | 484 | } |
485 | 485 | |
486 | - if ( $skip_filters ) { |
|
486 | + if ($skip_filters) { |
|
487 | 487 | return $variation_path; |
488 | 488 | } |
489 | 489 | |
490 | 490 | //filter result |
491 | - $variation_path = apply_filters( 'FHEE__' . get_class( $this ) . '__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url ); |
|
492 | - return apply_filters( 'FHEE__EE_Messages_Template_Pack__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, $this ); |
|
491 | + $variation_path = apply_filters('FHEE__'.get_class($this).'__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url); |
|
492 | + return apply_filters('FHEE__EE_Messages_Template_Pack__get_variation', $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, $this); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | |
@@ -504,19 +504,19 @@ discard block |
||
504 | 504 | * |
505 | 505 | * @return string returns the path for the requested wrapper template. |
506 | 506 | */ |
507 | - public function get_wrapper( $messenger, $type = 'main' ) { |
|
508 | - $default_pack = get_class( $this ) !== 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : NULL; |
|
507 | + public function get_wrapper($messenger, $type = 'main') { |
|
508 | + $default_pack = get_class($this) !== 'EE_Messages_Template_Pack_Default' ? new EE_Messages_Template_Pack_Default() : NULL; |
|
509 | 509 | |
510 | - $path_string = $this->_base_path . $messenger . '_' . $type . '_wrapper.template.php'; |
|
510 | + $path_string = $this->_base_path.$messenger.'_'.$type.'_wrapper.template.php'; |
|
511 | 511 | |
512 | - if ( is_readable( $path_string ) ) { |
|
512 | + if (is_readable($path_string)) { |
|
513 | 513 | $template = $path_string; |
514 | 514 | } else { |
515 | - $template = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_wrapper( $messenger, $type ) : ''; |
|
515 | + $template = $default_pack instanceof EE_Messages_Template_Pack_Default ? $default_pack->get_wrapper($messenger, $type) : ''; |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | //filter |
519 | - $template = apply_filters( 'FHEE__' . get_class( $this ) . '__get_wrapper', $template, $messenger, $type ); |
|
520 | - return apply_filters( 'FHEE__EE_Messages_Template_Pack__get_wrapper', $template, $messenger, $type, $this ); |
|
519 | + $template = apply_filters('FHEE__'.get_class($this).'__get_wrapper', $template, $messenger, $type); |
|
520 | + return apply_filters('FHEE__EE_Messages_Template_Pack__get_wrapper', $template, $messenger, $type, $this); |
|
521 | 521 | } |
522 | 522 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -55,33 +55,33 @@ discard block |
||
55 | 55 | '[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'), |
56 | 56 | '[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'), |
57 | 57 | '[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'), |
58 | - '[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ), |
|
58 | + '[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'), |
|
59 | 59 | '[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'), |
60 | 60 | '[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'), |
61 | 61 | '[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'), |
62 | 62 | '[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'), |
63 | 63 | '[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'), |
64 | 64 | '[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf( |
65 | - __( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ), |
|
65 | + __('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'), |
|
66 | 66 | '<code>', |
67 | 67 | '</code>' |
68 | 68 | ), |
69 | - '[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ), |
|
69 | + '[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'), |
|
70 | 70 | '[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'), |
71 | 71 | '[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'), |
72 | 72 | '[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'), |
73 | - '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ), |
|
73 | + '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'), |
|
74 | 74 | ); |
75 | 75 | } |
76 | 76 | |
77 | 77 | |
78 | - protected function _parser( $shortcode ) { |
|
78 | + protected function _parser($shortcode) { |
|
79 | 79 | |
80 | 80 | |
81 | 81 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
82 | 82 | |
83 | 83 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
84 | - if ( empty( $this->_event ) ) { |
|
84 | + if (empty($this->_event)) { |
|
85 | 85 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
86 | 86 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
87 | 87 | |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | //If there is no event objecdt by now then get out. |
93 | - if ( ! $this->_event instanceof EE_Event ) |
|
93 | + if ( ! $this->_event instanceof EE_Event) |
|
94 | 94 | return ''; |
95 | 95 | |
96 | - switch ( $shortcode ) { |
|
96 | + switch ($shortcode) { |
|
97 | 97 | |
98 | 98 | case '[EVENT_ID]' : |
99 | 99 | return $this->_event->ID(); |
@@ -126,41 +126,41 @@ discard block |
||
126 | 126 | |
127 | 127 | case '[VIRTUAL_URL]' : |
128 | 128 | $venue = $this->_event->get_first_related('Venue'); |
129 | - if ( empty( $venue ) ) |
|
129 | + if (empty($venue)) |
|
130 | 130 | return ''; |
131 | 131 | return $venue->get('VNU_virtual_url'); |
132 | 132 | |
133 | 133 | case '[VIRTUAL_PHONE]' : |
134 | 134 | $venue = $this->_event->get_first_related('Venue'); |
135 | - if ( empty( $venue ) ) |
|
135 | + if (empty($venue)) |
|
136 | 136 | return ''; |
137 | 137 | return $venue->get('VNU_virtual_phone'); |
138 | 138 | break; |
139 | 139 | |
140 | 140 | case '[EVENT_IMAGE]' : |
141 | - $image = $this->_event->feature_image_url(array(600,300) ); |
|
141 | + $image = $this->_event->feature_image_url(array(600, 300)); |
|
142 | 142 | // @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned. |
143 | - return !empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : ''; |
|
143 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : ''; |
|
144 | 144 | break; |
145 | 145 | |
146 | 146 | case '[EVENT_FACEBOOK_URL]' : |
147 | - $facebook_url = $this->_event->get_post_meta('event_facebook', true ); |
|
148 | - return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url; |
|
147 | + $facebook_url = $this->_event->get_post_meta('event_facebook', true); |
|
148 | + return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url; |
|
149 | 149 | break; |
150 | 150 | |
151 | 151 | case '[EVENT_TWITTER_URL]' : |
152 | 152 | $twitter_url = $this->_event->get_post_meta('event_twitter', true); |
153 | - return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url; |
|
153 | + return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url; |
|
154 | 154 | break; |
155 | 155 | |
156 | 156 | case '[EVENT_AUTHOR_EMAIL]' : |
157 | 157 | $author_id = $this->_event->get('EVT_wp_user'); |
158 | - $user_data = get_userdata( (int) $author_id ); |
|
158 | + $user_data = get_userdata((int) $author_id); |
|
159 | 159 | return $user_data->user_email; |
160 | 160 | break; |
161 | 161 | |
162 | 162 | case '[EVENT_TOTAL_SPOTS_TAKEN]' : |
163 | - return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
163 | + return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
164 | 164 | break; |
165 | 165 | |
166 | 166 | case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' : |
@@ -170,26 +170,26 @@ discard block |
||
170 | 170 | 'page' => 'espresso_registrations', |
171 | 171 | 'action' => 'default' |
172 | 172 | ), |
173 | - admin_url( 'admin.php' ), |
|
173 | + admin_url('admin.php'), |
|
174 | 174 | true |
175 | 175 | ); |
176 | 176 | break; |
177 | 177 | } |
178 | 178 | |
179 | - if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) { |
|
180 | - $shortcode = str_replace( '[EVENT_META_*', '', $shortcode ); |
|
181 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
179 | + if (strpos($shortcode, '[EVENT_META_*') !== false) { |
|
180 | + $shortcode = str_replace('[EVENT_META_*', '', $shortcode); |
|
181 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
182 | 182 | |
183 | 183 | //pull the meta value from the event post |
184 | - $event_meta = $this->_event->get_post_meta( $shortcode, true ); |
|
184 | + $event_meta = $this->_event->get_post_meta($shortcode, true); |
|
185 | 185 | |
186 | - return !empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : ''; |
|
186 | + return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : ''; |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
190 | - if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) { |
|
191 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
192 | - $method = empty( $attrs['method'] ) ? 'current' : $attrs['method']; |
|
190 | + if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) { |
|
191 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
192 | + $method = empty($attrs['method']) ? 'current' : $attrs['method']; |
|
193 | 193 | $method = $method === 'current'; |
194 | 194 | $available = $this->_event->total_available_spaces($method); |
195 | 195 | return $available === EE_INF ? '∞' : $available; |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @param boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event. Otherwise we just return the url of the event. |
206 | 206 | * @return string |
207 | 207 | */ |
208 | - private function _get_event_link( $event, $full_link = TRUE ) { |
|
208 | + private function _get_event_link($event, $full_link = TRUE) { |
|
209 | 209 | $url = get_permalink($event->ID()); |
210 | 210 | |
211 | - return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url; |
|
211 | + return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | |
65 | - protected function _parser( $shortcode ) { |
|
65 | + protected function _parser($shortcode) { |
|
66 | 66 | |
67 | - switch ( $shortcode ) { |
|
67 | + switch ($shortcode) { |
|
68 | 68 | |
69 | 69 | case '[VENUE_TITLE]' : |
70 | 70 | return $this->_venue('title'); |
@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | * @param string $what What to retrieve from database |
133 | 133 | * @return string What was retrieved! |
134 | 134 | */ |
135 | - private function _venue( $db_ref ) { |
|
135 | + private function _venue($db_ref) { |
|
136 | 136 | |
137 | 137 | //we need the EE_Event object to get the venue. |
138 | 138 | |
139 | 139 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
140 | 140 | |
141 | 141 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
142 | - if ( empty( $this->_event ) ) { |
|
142 | + if (empty($this->_event)) { |
|
143 | 143 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
144 | 144 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
145 | 145 | |
146 | 146 | $this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->event() : NULL; |
147 | 147 | |
148 | 148 | //if still empty do we have a ticket data item? |
149 | - $this->_event = empty( $this->_event ) && $this->_data instanceof EE_Ticket && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event'] : $this->_event; |
|
149 | + $this->_event = empty($this->_event) && $this->_data instanceof EE_Ticket && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event'] : $this->_event; |
|
150 | 150 | |
151 | 151 | //if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee and use that. |
152 | - $event = $aee instanceof EE_Messages_Addressee ? reset( $aee->events ) : array(); |
|
153 | - $this->_event = empty( $this->_event ) && !empty( $events ) ? $event : $this->_event; |
|
152 | + $event = $aee instanceof EE_Messages_Addressee ? reset($aee->events) : array(); |
|
153 | + $this->_event = empty($this->_event) && ! empty($events) ? $event : $this->_event; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
157 | 157 | //If there is no event objecdt by now then get out. |
158 | - if ( ! $this->_event instanceof EE_Event ) |
|
158 | + if ( ! $this->_event instanceof EE_Event) |
|
159 | 159 | return ''; |
160 | 160 | |
161 | 161 | $venue = $this->_event->get_first_related('Venue'); |
162 | 162 | |
163 | - if ( empty( $venue ) ) |
|
163 | + if (empty($venue)) |
|
164 | 164 | return ''; //no venue so get out. |
165 | 165 | |
166 | - switch ( $db_ref ) { |
|
166 | + switch ($db_ref) { |
|
167 | 167 | case 'title': |
168 | 168 | return $venue->get('VNU_name'); |
169 | 169 | break; |
@@ -174,11 +174,11 @@ discard block |
||
174 | 174 | |
175 | 175 | case 'url': |
176 | 176 | $url = $venue->get('VNU_url'); |
177 | - return empty( $url ) ? $venue->get_permalink() : $url; |
|
177 | + return empty($url) ? $venue->get_permalink() : $url; |
|
178 | 178 | break; |
179 | 179 | |
180 | 180 | case 'image': |
181 | - return '<img src="' . $venue->feature_image_url(array(200,200) ) . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $venue->get('VNU_name') ) . '" />'; |
|
181 | + return '<img src="'.$venue->feature_image_url(array(200, 200)).'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $venue->get('VNU_name')).'" />'; |
|
182 | 182 | break; |
183 | 183 | |
184 | 184 | case 'phone': |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | break; |
213 | 213 | |
214 | 214 | case 'formatted_address' : |
215 | - return EEH_Address::format( $venue ); |
|
215 | + return EEH_Address::format($venue); |
|
216 | 216 | break; |
217 | 217 | |
218 | 218 | case 'gmap_link': |
@@ -223,9 +223,9 @@ discard block |
||
223 | 223 | 'id' => $venue->ID(), |
224 | 224 | 'address' => $venue->get('VNU_address'), |
225 | 225 | 'city' => $venue->get('VNU_city'), |
226 | - 'state' => is_object( $state ) ? $state->get('STA_name') : '', |
|
226 | + 'state' => is_object($state) ? $state->get('STA_name') : '', |
|
227 | 227 | 'zip' => $venue->get('VNU_zip'), |
228 | - 'country' => is_object( $country ) ? $country->get('CNT_name'): '', |
|
228 | + 'country' => is_object($country) ? $country->get('CNT_name') : '', |
|
229 | 229 | 'type' => $db_ref == 'gmap_link' ? 'url' : 'map', |
230 | 230 | 'map_w' => 200, |
231 | 231 | 'map_h' => 200 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -50,38 +50,38 @@ discard block |
||
50 | 50 | '[TICKET_PRICE]' => __('The price of the ticket', 'event_espresso'), |
51 | 51 | '[TICKET_PRICE_WITH_TAXES]' => __('The price of the ticket including any taxes that might be on the ticket', 'event_espresso'), |
52 | 52 | '[TKT_QTY_PURCHASED]' => __('The total quantity of the current ticket in the list that has been purchased in this transaction', 'event_espresso'), |
53 | - '[TKT_USES_*]' => __( 'This attribute based shortcode parses to show the number of uses the ticket has. The optional "schema" attribute can be used to indicate what schema is used when the uses is infinite. Options are:', 'event_espresso' ) . |
|
54 | - '<p><ul>' . |
|
55 | - '<li><strong>symbol</strong>:' . __('This returns the ∞ symbol.', 'event_espresso') . '</li>' . |
|
56 | - '<li><strong>text</strong>:' . __('This returns the word, "Unlimited". This is also the default if the "schema" attribute is not used.', 'event_espresso' ) . '</li>' . |
|
57 | - '<li><strong>{custom}</strong>:' . __('You can put anything you want as a string instead and that will be used. So you could have the world "any" and whenever uses for a ticket is infinity, this shortcode will parse to "any".', 'event_espresso' ) . '</li>' . |
|
53 | + '[TKT_USES_*]' => __('This attribute based shortcode parses to show the number of uses the ticket has. The optional "schema" attribute can be used to indicate what schema is used when the uses is infinite. Options are:', 'event_espresso'). |
|
54 | + '<p><ul>'. |
|
55 | + '<li><strong>symbol</strong>:'.__('This returns the ∞ symbol.', 'event_espresso').'</li>'. |
|
56 | + '<li><strong>text</strong>:'.__('This returns the word, "Unlimited". This is also the default if the "schema" attribute is not used.', 'event_espresso').'</li>'. |
|
57 | + '<li><strong>{custom}</strong>:'.__('You can put anything you want as a string instead and that will be used. So you could have the world "any" and whenever uses for a ticket is infinity, this shortcode will parse to "any".', 'event_espresso').'</li>'. |
|
58 | 58 | '</ul></p>' |
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | 62 | |
63 | - protected function _parser( $shortcode ) { |
|
63 | + protected function _parser($shortcode) { |
|
64 | 64 | |
65 | 65 | $this->_ticket = $this->_data instanceof EE_Ticket ? $this->_data : null; |
66 | 66 | |
67 | 67 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
68 | - $aee = ! $aee instanceof EE_Messages_Addressee && is_array( $this->_extra_data ) && isset( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee; |
|
68 | + $aee = ! $aee instanceof EE_Messages_Addressee && is_array($this->_extra_data) && isset($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $aee; |
|
69 | 69 | |
70 | 70 | |
71 | 71 | //possible EE_Line_Item may be incoming data |
72 | - $this->_ticket = empty( $this->_ticket ) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && ! empty( $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] ) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket; |
|
72 | + $this->_ticket = empty($this->_ticket) && $this->_data instanceof EE_Line_Item && $aee instanceof EE_Messages_Addressee && ! empty($aee->line_items_with_children[$this->_data->ID()]['EE_Ticket']) && $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] instanceof EE_Ticket ? $aee->line_items_with_children[$this->_data->ID()]['EE_Ticket'] : $this->_ticket; |
|
73 | 73 | |
74 | 74 | //if still no ticket, then let's see if there is a reg_obj. If there IS, then we'll try and grab the ticket from the reg_obj instead. |
75 | - if ( empty( $this->_ticket ) ) { |
|
75 | + if (empty($this->_ticket)) { |
|
76 | 76 | $this->_ticket = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration ? $aee->reg_obj->ticket() : NULL; |
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | 80 | //If there is no event object by now then get out. |
81 | - if ( ! $this->_ticket instanceof EE_Ticket ) |
|
81 | + if ( ! $this->_ticket instanceof EE_Ticket) |
|
82 | 82 | return ''; |
83 | 83 | |
84 | - switch ( $shortcode ) { |
|
84 | + switch ($shortcode) { |
|
85 | 85 | |
86 | 86 | case '[TICKET_ID]' : |
87 | 87 | return $this->_ticket->ID(); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | break; |
97 | 97 | |
98 | 98 | case '[TICKET_PRICE]' : |
99 | - return EEH_Template::format_currency( $this->_ticket->get('TKT_price') ); |
|
99 | + return EEH_Template::format_currency($this->_ticket->get('TKT_price')); |
|
100 | 100 | break; |
101 | 101 | |
102 | 102 | case '[TICKET_PRICE_WITH_TAXES]' : |
103 | - return EEH_Template::format_currency( $this->_ticket->get_ticket_total_with_taxes() ); |
|
103 | + return EEH_Template::format_currency($this->_ticket->get_ticket_total_with_taxes()); |
|
104 | 104 | break; |
105 | 105 | |
106 | 106 | case '[TKT_QTY_PURCHASED]' : |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | break; |
109 | 109 | } |
110 | 110 | |
111 | - if ( strpos( $shortcode, '[TKT_USES_*') !== FALSE ) { |
|
112 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
113 | - $schema = empty( $attrs['schema'] ) ? null : $attrs['schema']; |
|
114 | - return $this->_ticket->get_pretty( 'TKT_uses', $schema ); |
|
111 | + if (strpos($shortcode, '[TKT_USES_*') !== FALSE) { |
|
112 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
113 | + $schema = empty($attrs['schema']) ? null : $attrs['schema']; |
|
114 | + return $this->_ticket->get_pretty('TKT_uses', $schema); |
|
115 | 115 | } |
116 | 116 | return ''; |
117 | 117 |
@@ -69,101 +69,101 @@ discard block |
||
69 | 69 | * @param array $options |
70 | 70 | * @return mixed |
71 | 71 | */ |
72 | - public function display_line_item( EE_Line_Item $line_item, $options = array() ) { |
|
72 | + public function display_line_item(EE_Line_Item $line_item, $options = array()) { |
|
73 | 73 | |
74 | 74 | $html = ''; |
75 | 75 | // set some default options and merge with incoming |
76 | 76 | $default_options = array( |
77 | - 'show_desc' => true, // true false |
|
77 | + 'show_desc' => true, // true false |
|
78 | 78 | 'odd' => false |
79 | 79 | ); |
80 | - $options = array_merge( $default_options, (array)$options ); |
|
80 | + $options = array_merge($default_options, (array) $options); |
|
81 | 81 | |
82 | - switch( $line_item->type() ) { |
|
82 | + switch ($line_item->type()) { |
|
83 | 83 | |
84 | 84 | case EEM_Line_Item::type_line_item: |
85 | 85 | $this->_show_taxes = $line_item->is_taxable() ? true : $this->_show_taxes; |
86 | - if ( $line_item->OBJ_type() == 'Ticket' ) { |
|
86 | + if ($line_item->OBJ_type() == 'Ticket') { |
|
87 | 87 | // item row |
88 | - $html .= $this->_ticket_row( $line_item, $options ); |
|
88 | + $html .= $this->_ticket_row($line_item, $options); |
|
89 | 89 | // got any kids? |
90 | - foreach ( $line_item->children() as $child_line_item ) { |
|
91 | - $this->display_line_item( $child_line_item, $options ); |
|
90 | + foreach ($line_item->children() as $child_line_item) { |
|
91 | + $this->display_line_item($child_line_item, $options); |
|
92 | 92 | } |
93 | 93 | } else { |
94 | 94 | // item row |
95 | - $html .= $this->_item_row( $line_item, $options ); |
|
95 | + $html .= $this->_item_row($line_item, $options); |
|
96 | 96 | // got any kids? |
97 | - foreach ( $line_item->children() as $child_line_item ) { |
|
98 | - $this->display_line_item( $child_line_item, $options ); |
|
97 | + foreach ($line_item->children() as $child_line_item) { |
|
98 | + $this->display_line_item($child_line_item, $options); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | break; |
102 | 102 | |
103 | 103 | case EEM_Line_Item::type_sub_line_item: |
104 | - $html .= $this->_sub_item_row( $line_item, $options ); |
|
104 | + $html .= $this->_sub_item_row($line_item, $options); |
|
105 | 105 | break; |
106 | 106 | |
107 | 107 | case EEM_Line_Item::type_sub_total: |
108 | 108 | static $sub_total = 0; |
109 | 109 | $event_sub_total = 0; |
110 | - $text = __( 'Sub-Total', 'event_espresso' ); |
|
111 | - if ( $line_item->OBJ_type() == 'Event' ) { |
|
112 | - $options[ 'event_id' ] = $event_id = $line_item->OBJ_ID(); |
|
113 | - if ( ! isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
114 | - $event = EEM_Event::instance()->get_one_by_ID( $options[ 'event_id' ] ); |
|
115 | - if ( $event instanceof EE_Event ) { |
|
116 | - if ( $event->default_registration_status() == EEM_Registration::status_id_not_approved ) { |
|
110 | + $text = __('Sub-Total', 'event_espresso'); |
|
111 | + if ($line_item->OBJ_type() == 'Event') { |
|
112 | + $options['event_id'] = $event_id = $line_item->OBJ_ID(); |
|
113 | + if ( ! isset($this->_events[$options['event_id']])) { |
|
114 | + $event = EEM_Event::instance()->get_one_by_ID($options['event_id']); |
|
115 | + if ($event instanceof EE_Event) { |
|
116 | + if ($event->default_registration_status() == EEM_Registration::status_id_not_approved) { |
|
117 | 117 | return ''; |
118 | 118 | } |
119 | 119 | } |
120 | - $this->_events[ $options[ 'event_id' ] ] = 0; |
|
121 | - $html .= $this->_event_row( $line_item ); |
|
122 | - $text = __( 'Event Sub-Total', 'event_espresso' ); |
|
120 | + $this->_events[$options['event_id']] = 0; |
|
121 | + $html .= $this->_event_row($line_item); |
|
122 | + $text = __('Event Sub-Total', 'event_espresso'); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | $child_line_items = $line_item->children(); |
126 | 126 | // loop thru children |
127 | - foreach( $child_line_items as $child_line_item ) { |
|
127 | + foreach ($child_line_items as $child_line_item) { |
|
128 | 128 | // recursively feed children back into this method |
129 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
129 | + $html .= $this->display_line_item($child_line_item, $options); |
|
130 | 130 | } |
131 | - $event_sub_total += isset( $options[ 'event_id' ] ) ? $this->_events[ $options[ 'event_id' ] ] : 0; |
|
131 | + $event_sub_total += isset($options['event_id']) ? $this->_events[$options['event_id']] : 0; |
|
132 | 132 | $sub_total += $event_sub_total; |
133 | 133 | if ( |
134 | 134 | ( |
135 | 135 | // event subtotals |
136 | 136 | $line_item->code() != 'pre-tax-subtotal' && |
137 | - count( $child_line_items ) > 1 |
|
137 | + count($child_line_items) > 1 |
|
138 | 138 | ) |
139 | 139 | || |
140 | 140 | ( |
141 | 141 | // pre-tax subtotals |
142 | 142 | $line_item->code() == 'pre-tax-subtotal' && |
143 | - count( $this->_events ) > 1 |
|
143 | + count($this->_events) > 1 |
|
144 | 144 | ) |
145 | 145 | ) { |
146 | 146 | $options['sub_total'] = $line_item->OBJ_type() == 'Event' ? $event_sub_total : $sub_total; |
147 | - $html .= $this->_sub_total_row( $line_item, $text, $options ); |
|
147 | + $html .= $this->_sub_total_row($line_item, $text, $options); |
|
148 | 148 | } |
149 | 149 | break; |
150 | 150 | |
151 | 151 | case EEM_Line_Item::type_tax: |
152 | - if ( $this->_show_taxes ) { |
|
153 | - $this->_taxes_html .= $this->_tax_row( $line_item, $options ); |
|
152 | + if ($this->_show_taxes) { |
|
153 | + $this->_taxes_html .= $this->_tax_row($line_item, $options); |
|
154 | 154 | } |
155 | 155 | break; |
156 | 156 | |
157 | 157 | case EEM_Line_Item::type_tax_sub_total: |
158 | - if ( $this->_show_taxes ) { |
|
158 | + if ($this->_show_taxes) { |
|
159 | 159 | $child_line_items = $line_item->children(); |
160 | 160 | // loop thru children |
161 | - foreach( $child_line_items as $child_line_item ) { |
|
161 | + foreach ($child_line_items as $child_line_item) { |
|
162 | 162 | // recursively feed children back into this method |
163 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
163 | + $html .= $this->display_line_item($child_line_item, $options); |
|
164 | 164 | } |
165 | - if ( count( $child_line_items ) > 1 ) { |
|
166 | - $this->_taxes_html .= $this->_total_tax_row( $line_item, __( 'Tax Total', 'event_espresso' ) ); |
|
165 | + if (count($child_line_items) > 1) { |
|
166 | + $this->_taxes_html .= $this->_total_tax_row($line_item, __('Tax Total', 'event_espresso')); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | break; |
@@ -172,25 +172,25 @@ discard block |
||
172 | 172 | // get all child line items |
173 | 173 | $children = $line_item->children(); |
174 | 174 | // loop thru all non-tax child line items |
175 | - foreach( $children as $child_line_item ) { |
|
176 | - if ( $child_line_item->type() != EEM_Line_Item::type_tax_sub_total ) { |
|
175 | + foreach ($children as $child_line_item) { |
|
176 | + if ($child_line_item->type() != EEM_Line_Item::type_tax_sub_total) { |
|
177 | 177 | // recursively feed children back into this method |
178 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
178 | + $html .= $this->display_line_item($child_line_item, $options); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | 182 | // now loop thru tax child line items |
183 | - foreach( $children as $child_line_item ) { |
|
184 | - if ( $child_line_item->type() == EEM_Line_Item::type_tax_sub_total ) { |
|
183 | + foreach ($children as $child_line_item) { |
|
184 | + if ($child_line_item->type() == EEM_Line_Item::type_tax_sub_total) { |
|
185 | 185 | // recursively feed children back into this method |
186 | - $html .= $this->display_line_item( $child_line_item, $options ); |
|
186 | + $html .= $this->display_line_item($child_line_item, $options); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | $html .= $this->_taxes_html; |
190 | - $html .= $this->_total_row( $line_item, __('Total', 'event_espresso') ); |
|
190 | + $html .= $this->_total_row($line_item, __('Total', 'event_espresso')); |
|
191 | 191 | |
192 | 192 | |
193 | - $html .= $this->_payments_and_amount_owing_rows( $line_item, $options ); |
|
193 | + $html .= $this->_payments_and_amount_owing_rows($line_item, $options); |
|
194 | 194 | break; |
195 | 195 | |
196 | 196 | } |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | * @param EE_Line_Item $line_item |
206 | 206 | * @return mixed |
207 | 207 | */ |
208 | - private function _event_row( EE_Line_Item $line_item ) { |
|
208 | + private function _event_row(EE_Line_Item $line_item) { |
|
209 | 209 | // start of row |
210 | - $html = EEH_HTML::tr( '', 'event-cart-total-row', 'total_tr odd' ); |
|
210 | + $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); |
|
211 | 211 | // event name td |
212 | - $html .= EEH_HTML::td( EEH_HTML::strong( $line_item->name() ), '', 'event-header', '', ' colspan="4"' ); |
|
212 | + $html .= EEH_HTML::td(EEH_HTML::strong($line_item->name()), '', 'event-header', '', ' colspan="4"'); |
|
213 | 213 | // end of row |
214 | 214 | $html .= EEH_HTML::trx(); |
215 | 215 | return $html; |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | * @param array $options |
225 | 225 | * @return mixed |
226 | 226 | */ |
227 | - private function _ticket_row( EE_Line_Item $line_item, $options = array() ) { |
|
227 | + private function _ticket_row(EE_Line_Item $line_item, $options = array()) { |
|
228 | 228 | // start of row |
229 | 229 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
230 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
230 | + $html = EEH_HTML::tr('', '', $row_class); |
|
231 | 231 | // name && desc |
232 | 232 | $name_and_desc = apply_filters( |
233 | 233 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
@@ -236,23 +236,23 @@ discard block |
||
236 | 236 | ); |
237 | 237 | $name_and_desc .= apply_filters( |
238 | 238 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
239 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
239 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
240 | 240 | $line_item, |
241 | 241 | $options |
242 | 242 | ); |
243 | 243 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
244 | 244 | // name td |
245 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
245 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l' ); |
|
246 | 246 | // price td |
247 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
247 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
248 | 248 | // quantity td |
249 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
249 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
250 | 250 | $this->_total_items += $line_item->quantity(); |
251 | 251 | // determine total for line item |
252 | 252 | $total = $line_item->total(); |
253 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
253 | + $this->_events[$options['event_id']] += $total; |
|
254 | 254 | // total td |
255 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
255 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
256 | 256 | // end of row |
257 | 257 | $html .= EEH_HTML::trx(); |
258 | 258 | return $html; |
@@ -267,41 +267,41 @@ discard block |
||
267 | 267 | * @param array $options |
268 | 268 | * @return mixed |
269 | 269 | */ |
270 | - private function _item_row( EE_Line_Item $line_item, $options = array() ) { |
|
270 | + private function _item_row(EE_Line_Item $line_item, $options = array()) { |
|
271 | 271 | // start of row |
272 | 272 | $row_class = $options['odd'] ? 'item odd' : 'item'; |
273 | - $html = EEH_HTML::tr( '', '', $row_class ); |
|
274 | - $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type() . ': ' : ''; |
|
273 | + $html = EEH_HTML::tr('', '', $row_class); |
|
274 | + $obj_name = $line_item->OBJ_type() ? $line_item->OBJ_type().': ' : ''; |
|
275 | 275 | // name && desc |
276 | 276 | $name_and_desc = apply_filters( |
277 | 277 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__name', |
278 | - $obj_name . $line_item->name(), |
|
278 | + $obj_name.$line_item->name(), |
|
279 | 279 | $line_item |
280 | 280 | ); |
281 | 281 | $name_and_desc .= apply_filters( |
282 | 282 | 'FHEE__EE_SPCO_Line_Item_Display_Strategy__item_row__desc', |
283 | - ( $options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '' ), |
|
283 | + ($options['show_desc'] ? '<span class="line-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''), |
|
284 | 284 | $line_item, |
285 | 285 | $options |
286 | 286 | ); |
287 | 287 | $name_and_desc .= $line_item->is_taxable() ? ' * ' : ''; |
288 | 288 | // name td |
289 | - $html .= EEH_HTML::td( $name_and_desc, '', 'item_l' ); |
|
289 | + $html .= EEH_HTML::td($name_and_desc, '', 'item_l'); |
|
290 | 290 | // price td |
291 | - if ( $line_item->is_percent() ) { |
|
292 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c jst-rght' ); |
|
291 | + if ($line_item->is_percent()) { |
|
292 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c jst-rght'); |
|
293 | 293 | } else { |
294 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
294 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
295 | 295 | } |
296 | 296 | // quantity td |
297 | - $html .= EEH_HTML::td( $line_item->quantity(), '', 'item_l jst-rght' ); |
|
297 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l jst-rght'); |
|
298 | 298 | //$total = $line_item->total() * $line_item->quantity(); |
299 | 299 | $total = $line_item->total(); |
300 | - if( isset( $options[ 'event_id' ] ) && isset( $this->_events[ $options[ 'event_id' ] ] ) ) { |
|
301 | - $this->_events[ $options[ 'event_id' ] ] += $total; |
|
300 | + if (isset($options['event_id']) && isset($this->_events[$options['event_id']])) { |
|
301 | + $this->_events[$options['event_id']] += $total; |
|
302 | 302 | } |
303 | 303 | // total td |
304 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $total, false, false ), '', 'item_r jst-rght' ); |
|
304 | + $html .= EEH_HTML::td(EEH_Template::format_currency($total, false, false), '', 'item_r jst-rght'); |
|
305 | 305 | // end of row |
306 | 306 | $html .= EEH_HTML::trx(); |
307 | 307 | return $html; |
@@ -316,22 +316,22 @@ discard block |
||
316 | 316 | * @param array $options |
317 | 317 | * @return mixed |
318 | 318 | */ |
319 | - private function _sub_item_row( EE_Line_Item $line_item, $options = array() ) { |
|
319 | + private function _sub_item_row(EE_Line_Item $line_item, $options = array()) { |
|
320 | 320 | // start of row |
321 | - $html = EEH_HTML::tr( '', 'item sub-item-row' ); |
|
321 | + $html = EEH_HTML::tr('', 'item sub-item-row'); |
|
322 | 322 | // name && desc |
323 | 323 | $name_and_desc = $line_item->name(); |
324 | - $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : ''; |
|
324 | + $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: '.$line_item->desc().'</span>' : ''; |
|
325 | 325 | // name td |
326 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
326 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
327 | 327 | // discount/surcharge td |
328 | - if ( $line_item->is_percent() ) { |
|
329 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', 'item_c' ); |
|
328 | + if ($line_item->is_percent()) { |
|
329 | + $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c'); |
|
330 | 330 | } else { |
331 | - $html .= EEH_HTML::td( $line_item->unit_price_no_code(), '', 'item_c jst-rght' ); |
|
331 | + $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght'); |
|
332 | 332 | } |
333 | 333 | // total td |
334 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
334 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
335 | 335 | // end of row |
336 | 336 | $html .= EEH_HTML::trx(); |
337 | 337 | return $html; |
@@ -346,21 +346,21 @@ discard block |
||
346 | 346 | * @param array $options |
347 | 347 | * @return mixed |
348 | 348 | */ |
349 | - private function _tax_row( EE_Line_Item $line_item, $options = array() ) { |
|
349 | + private function _tax_row(EE_Line_Item $line_item, $options = array()) { |
|
350 | 350 | // start of row |
351 | - $html = EEH_HTML::tr( '', 'item sub-item tax-total' ); |
|
351 | + $html = EEH_HTML::tr('', 'item sub-item tax-total'); |
|
352 | 352 | // name && desc |
353 | 353 | $name_and_desc = $line_item->name(); |
354 | - $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __( ' * taxable items', 'event_espresso' ) . '</span>'; |
|
355 | - $name_and_desc .= $options[ 'show_desc' ] ? '<br/>' . $line_item->desc() : ''; |
|
354 | + $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">'.__(' * taxable items', 'event_espresso').'</span>'; |
|
355 | + $name_and_desc .= $options['show_desc'] ? '<br/>'.$line_item->desc() : ''; |
|
356 | 356 | // name td |
357 | - $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
357 | + $html .= EEH_HTML::td( /*__FUNCTION__ .*/ $name_and_desc, '', 'item_l sub-item' ); |
|
358 | 358 | // percent td |
359 | - $html .= EEH_HTML::td( $line_item->percent() . '%', '', ' jst-rght', '' ); |
|
359 | + $html .= EEH_HTML::td($line_item->percent().'%', '', ' jst-rght', ''); |
|
360 | 360 | // empty td (price) |
361 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
361 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
362 | 362 | // total td |
363 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'item_r jst-rght' ); |
|
363 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght'); |
|
364 | 364 | // end of row |
365 | 365 | $html .= EEH_HTML::trx(); |
366 | 366 | return $html; |
@@ -375,17 +375,17 @@ discard block |
||
375 | 375 | * @param string $text |
376 | 376 | * @return mixed |
377 | 377 | */ |
378 | - private function _total_tax_row( EE_Line_Item $line_item, $text = '' ) { |
|
378 | + private function _total_tax_row(EE_Line_Item $line_item, $text = '') { |
|
379 | 379 | $html = ''; |
380 | - if ( $line_item->total() ) { |
|
380 | + if ($line_item->total()) { |
|
381 | 381 | // start of row |
382 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
382 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
383 | 383 | // total td |
384 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="2"' ); |
|
384 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="2"'); |
|
385 | 385 | // empty td (price) |
386 | - $html .= EEH_HTML::td( EEH_HTML::nbsp() ); |
|
386 | + $html .= EEH_HTML::td(EEH_HTML::nbsp()); |
|
387 | 387 | // total td |
388 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
388 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
389 | 389 | // end of row |
390 | 390 | $html .= EEH_HTML::trx(); |
391 | 391 | } |
@@ -402,15 +402,15 @@ discard block |
||
402 | 402 | * @param array $options |
403 | 403 | * @return mixed |
404 | 404 | */ |
405 | - private function _sub_total_row( EE_Line_Item $line_item, $text = '', $options = array() ) { |
|
405 | + private function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = array()) { |
|
406 | 406 | $html = ''; |
407 | - if ( $line_item->total() ) { |
|
407 | + if ($line_item->total()) { |
|
408 | 408 | // start of row |
409 | - $html = EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
409 | + $html = EEH_HTML::tr('', '', 'total_tr odd'); |
|
410 | 410 | // total td |
411 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
411 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
412 | 412 | // total td |
413 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $options[ 'sub_total' ], false, false ), '', 'total jst-rght' ); |
|
413 | + $html .= EEH_HTML::td(EEH_Template::format_currency($options['sub_total'], false, false), '', 'total jst-rght'); |
|
414 | 414 | // end of row |
415 | 415 | $html .= EEH_HTML::trx(); |
416 | 416 | } |
@@ -427,13 +427,13 @@ discard block |
||
427 | 427 | * @param string $text |
428 | 428 | * @return mixed |
429 | 429 | */ |
430 | - private function _total_row( EE_Line_Item $line_item, $text = '' ) { |
|
430 | + private function _total_row(EE_Line_Item $line_item, $text = '') { |
|
431 | 431 | // start of row |
432 | - $html = EEH_HTML::tr( '', '', 'spco-grand-total total_tr odd' ); |
|
432 | + $html = EEH_HTML::tr('', '', 'spco-grand-total total_tr odd'); |
|
433 | 433 | // total td |
434 | - $html .= EEH_HTML::td( $text, '', 'total_currency total jst-rght', '', ' colspan="3"' ); |
|
434 | + $html .= EEH_HTML::td($text, '', 'total_currency total jst-rght', '', ' colspan="3"'); |
|
435 | 435 | // total td |
436 | - $html .= EEH_HTML::td( EEH_Template::format_currency( $line_item->total(), false, false ), '', 'total jst-rght' ); |
|
436 | + $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'total jst-rght'); |
|
437 | 437 | // end of row |
438 | 438 | $html .= EEH_HTML::trx(); |
439 | 439 | return $html; |
@@ -448,30 +448,30 @@ discard block |
||
448 | 448 | * @param array $options |
449 | 449 | * @return mixed |
450 | 450 | */ |
451 | - private function _payments_and_amount_owing_rows( EE_Line_Item $line_item, $options = array() ) { |
|
451 | + private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array()) { |
|
452 | 452 | $html = ''; |
453 | 453 | $owing = $line_item->total(); |
454 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $line_item->TXN_ID() ); |
|
455 | - if ( $transaction instanceof EE_Transaction ) { |
|
454 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID()); |
|
455 | + if ($transaction instanceof EE_Transaction) { |
|
456 | 456 | $registration_payments = array(); |
457 | - $registrations = ! empty( $options['registrations'] ) |
|
458 | - ? $options[ 'registrations' ] |
|
457 | + $registrations = ! empty($options['registrations']) |
|
458 | + ? $options['registrations'] |
|
459 | 459 | : $transaction->registrations(); |
460 | - foreach ( $registrations as $registration ) { |
|
461 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
460 | + foreach ($registrations as $registration) { |
|
461 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
462 | 462 | $registration_payments = $registration_payments + $registration->registration_payments(); |
463 | 463 | } |
464 | 464 | } |
465 | - if ( ! empty( $registration_payments )) { |
|
466 | - foreach ( $registration_payments as $registration_payment ) { |
|
467 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
465 | + if ( ! empty($registration_payments)) { |
|
466 | + foreach ($registration_payments as $registration_payment) { |
|
467 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
468 | 468 | $owing = $owing - $registration_payment->amount(); |
469 | 469 | $payment = $registration_payment->payment(); |
470 | - if ( $payment instanceof EE_Payment ) { |
|
470 | + if ($payment instanceof EE_Payment) { |
|
471 | 471 | $payment_desc = sprintf( |
472 | - __( 'Payment%1$s Received: %2$s', 'event_espresso' ), |
|
472 | + __('Payment%1$s Received: %2$s', 'event_espresso'), |
|
473 | 473 | $payment->txn_id_chq_nmbr() != '' |
474 | - ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' |
|
474 | + ? ' <span class="small-text">(#'.$payment->txn_id_chq_nmbr().')</span> ' |
|
475 | 475 | : '', |
476 | 476 | $payment->timestamp() |
477 | 477 | ); |
@@ -479,12 +479,12 @@ discard block |
||
479 | 479 | $payment_desc = ''; |
480 | 480 | } |
481 | 481 | // start of row |
482 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
482 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
483 | 483 | // payment desc |
484 | - $html .= EEH_HTML::td( $payment_desc, '', '', '', ' colspan="3"' ); |
|
484 | + $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"'); |
|
485 | 485 | // total td |
486 | 486 | $html .= EEH_HTML::td( |
487 | - EEH_Template::format_currency( $registration_payment->amount(), false, false ), |
|
487 | + EEH_Template::format_currency($registration_payment->amount(), false, false), |
|
488 | 488 | '', |
489 | 489 | 'total jst-rght' |
490 | 490 | ); |
@@ -492,17 +492,17 @@ discard block |
||
492 | 492 | $html .= EEH_HTML::trx(); |
493 | 493 | } |
494 | 494 | } |
495 | - if ( $line_item->total() ) { |
|
495 | + if ($line_item->total()) { |
|
496 | 496 | // start of row |
497 | - $html .= EEH_HTML::tr( '', '', 'total_tr odd' ); |
|
497 | + $html .= EEH_HTML::tr('', '', 'total_tr odd'); |
|
498 | 498 | // total td |
499 | 499 | $html .= EEH_HTML::td( |
500 | 500 | __('Amount Owing', 'event_espresso'), |
501 | - '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
501 | + '', 'total_currency total jst-rght', '', ' colspan="3"' |
|
502 | 502 | ); |
503 | 503 | // total td |
504 | 504 | $html .= EEH_HTML::td( |
505 | - EEH_Template::format_currency( $owing, false, false ), '', 'total jst-rght' |
|
505 | + EEH_Template::format_currency($owing, false, false), '', 'total jst-rght' |
|
506 | 506 | ); |
507 | 507 | // end of row |
508 | 508 | $html .= EEH_HTML::trx(); |