@@ -32,18 +32,18 @@ |
||
32 | 32 | |
33 | 33 | // modify just event_list |
34 | 34 | $new_config['event_list'] = array( |
35 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
35 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
36 | 36 | ); |
37 | 37 | $new_config['ticket_list'] = array( |
38 | 38 | 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
39 | 39 | ); |
40 | 40 | $new_config['content'] = array( |
41 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
41 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
42 | 42 | ); |
43 | 43 | $this->_messenger->set_validator_config($new_config); |
44 | 44 | |
45 | 45 | if ($this->_context != 'admin') { |
46 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
46 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -13,37 +13,37 @@ |
||
13 | 13 | */ |
14 | 14 | class EE_Messages_Email_Payment_Refund_Validator extends EE_Messages_Validator |
15 | 15 | { |
16 | - public function __construct($fields, $context) |
|
17 | - { |
|
18 | - $this->_m_name = 'email'; |
|
19 | - $this->_mt_name = 'payment_refund'; |
|
16 | + public function __construct($fields, $context) |
|
17 | + { |
|
18 | + $this->_m_name = 'email'; |
|
19 | + $this->_mt_name = 'payment_refund'; |
|
20 | 20 | |
21 | - parent::__construct($fields, $context); |
|
22 | - } |
|
21 | + parent::__construct($fields, $context); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | - */ |
|
27 | - protected function _modify_validator() |
|
28 | - { |
|
29 | - $new_config = $this->_messenger->get_validator_config(); |
|
24 | + /** |
|
25 | + * at this point no custom validation needed for this messenger/message_type combo. |
|
26 | + */ |
|
27 | + protected function _modify_validator() |
|
28 | + { |
|
29 | + $new_config = $this->_messenger->get_validator_config(); |
|
30 | 30 | |
31 | - // modify just event_list |
|
32 | - $new_config['event_list'] = array( |
|
33 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | - ); |
|
35 | - $new_config['ticket_list'] = array( |
|
36 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | - ); |
|
38 | - $new_config['content'] = array( |
|
39 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | - ); |
|
41 | - $this->_messenger->set_validator_config($new_config); |
|
31 | + // modify just event_list |
|
32 | + $new_config['event_list'] = array( |
|
33 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization','recipient_details', 'recipient_list', 'event_author', 'primary_registration_details', 'primary_registration_list') |
|
34 | + ); |
|
35 | + $new_config['ticket_list'] = array( |
|
36 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'recipient_details', 'transaction') |
|
37 | + ); |
|
38 | + $new_config['content'] = array( |
|
39 | + 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'recipient_details', 'recipient_list', 'transaction', 'primary_registration_details', 'primary_registration_list', 'messenger') |
|
40 | + ); |
|
41 | + $this->_messenger->set_validator_config($new_config); |
|
42 | 42 | |
43 | - if ($this->_context != 'admin') { |
|
44 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | - } |
|
43 | + if ($this->_context != 'admin') { |
|
44 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
45 | + } |
|
46 | 46 | |
47 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | - } |
|
47 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
48 | + } |
|
49 | 49 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->_messenger->set_validator_config($new_config); |
39 | 39 | |
40 | 40 | if ($this->_context != 'admin') { |
41 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
41 | + $this->_valid_shortcodes_modifier[$this->_context]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
@@ -14,31 +14,31 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_Messages_Email_Registration_Summary_Validator extends EE_Messages_Validator |
16 | 16 | { |
17 | - public function __construct($fields, $context) |
|
18 | - { |
|
19 | - $this->_m_name = 'email'; |
|
20 | - $this->_mt_name = 'registration_summary'; |
|
17 | + public function __construct($fields, $context) |
|
18 | + { |
|
19 | + $this->_m_name = 'email'; |
|
20 | + $this->_mt_name = 'registration_summary'; |
|
21 | 21 | |
22 | - parent::__construct($fields, $context); |
|
23 | - } |
|
22 | + parent::__construct($fields, $context); |
|
23 | + } |
|
24 | 24 | |
25 | - /** |
|
26 | - * custom validator (restricting what was originally set by the messenger) |
|
27 | - */ |
|
28 | - protected function _modify_validator() |
|
29 | - { |
|
30 | - $new_config = $this->_messenger->get_validator_config(); |
|
31 | - // modify just event_list |
|
32 | - $new_config['event_list'] = array( |
|
33 | - 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
34 | - 'required' => array('[EVENT_LIST]') |
|
35 | - ); |
|
36 | - $this->_messenger->set_validator_config($new_config); |
|
25 | + /** |
|
26 | + * custom validator (restricting what was originally set by the messenger) |
|
27 | + */ |
|
28 | + protected function _modify_validator() |
|
29 | + { |
|
30 | + $new_config = $this->_messenger->get_validator_config(); |
|
31 | + // modify just event_list |
|
32 | + $new_config['event_list'] = array( |
|
33 | + 'shortcodes' => array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'), |
|
34 | + 'required' => array('[EVENT_LIST]') |
|
35 | + ); |
|
36 | + $this->_messenger->set_validator_config($new_config); |
|
37 | 37 | |
38 | - if ($this->_context != 'admin') { |
|
39 | - $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
40 | - } |
|
38 | + if ($this->_context != 'admin') { |
|
39 | + $this->_valid_shortcodes_modifier[ $this->_context ]['event_list'] = array('event', 'attendee_list', 'ticket_list', 'datetime_list', 'venue', 'organization', 'event_author', 'primary_registration_details', 'primary_registration_list', 'recipient_details', 'recipient_list'); |
|
40 | + } |
|
41 | 41 | |
42 | - $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
43 | - } |
|
42 | + $this->_specific_shortcode_excludes['content'] = array('[DISPLAY_PDF_URL]', '[DISPLAY_PDF_BUTTON]'); |
|
43 | + } |
|
44 | 44 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | */ |
47 | 47 | public function get_key($classname, $data) |
48 | 48 | { |
49 | - return md5($classname . serialize($data)); |
|
49 | + return md5($classname.serialize($data)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 |
@@ -9,69 +9,69 @@ |
||
9 | 9 | */ |
10 | 10 | class EE_Messages_Data_Handler_Collection extends EE_Object_Collection |
11 | 11 | { |
12 | - public function __construct() |
|
13 | - { |
|
14 | - $this->interface = 'EE_Messages_incoming_data'; |
|
15 | - } |
|
12 | + public function __construct() |
|
13 | + { |
|
14 | + $this->interface = 'EE_Messages_incoming_data'; |
|
15 | + } |
|
16 | 16 | |
17 | 17 | |
18 | - /** |
|
19 | - * This adds the EE_Messages_incoming_data data handler object to the collection. |
|
20 | - * |
|
21 | - * @param EE_Messages_incoming_data $data_handler |
|
22 | - * @param mixed $data Usually an array of data used in combination with the $data_handler |
|
23 | - * classname to create an alternative index for retrieving data_handlers. |
|
24 | - * @return bool |
|
25 | - */ |
|
26 | - public function add($data_handler, $data = ''): bool |
|
27 | - { |
|
28 | - $data = $data === null ? array() : (array) $data; |
|
29 | - $info['key'] = $this->get_key(get_class($data_handler), $data); |
|
30 | - return parent::add($data_handler, $info); |
|
31 | - } |
|
18 | + /** |
|
19 | + * This adds the EE_Messages_incoming_data data handler object to the collection. |
|
20 | + * |
|
21 | + * @param EE_Messages_incoming_data $data_handler |
|
22 | + * @param mixed $data Usually an array of data used in combination with the $data_handler |
|
23 | + * classname to create an alternative index for retrieving data_handlers. |
|
24 | + * @return bool |
|
25 | + */ |
|
26 | + public function add($data_handler, $data = ''): bool |
|
27 | + { |
|
28 | + $data = $data === null ? array() : (array) $data; |
|
29 | + $info['key'] = $this->get_key(get_class($data_handler), $data); |
|
30 | + return parent::add($data_handler, $info); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * This returns a key for retrieving data for the given references used to generate the key. |
|
39 | - * Data handlers are cached to the repository along with a md5() generated key using known references. |
|
40 | - * @param string $classname The classname of the datahandler being checked for. |
|
41 | - * @param mixed $data The data that was used to instantiate the data_handler. |
|
42 | - * |
|
43 | - * @return string md5 hash using provided info. |
|
44 | - */ |
|
45 | - public function get_key($classname, $data) |
|
46 | - { |
|
47 | - return md5($classname . serialize($data)); |
|
48 | - } |
|
37 | + /** |
|
38 | + * This returns a key for retrieving data for the given references used to generate the key. |
|
39 | + * Data handlers are cached to the repository along with a md5() generated key using known references. |
|
40 | + * @param string $classname The classname of the datahandler being checked for. |
|
41 | + * @param mixed $data The data that was used to instantiate the data_handler. |
|
42 | + * |
|
43 | + * @return string md5 hash using provided info. |
|
44 | + */ |
|
45 | + public function get_key($classname, $data) |
|
46 | + { |
|
47 | + return md5($classname . serialize($data)); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * This returns a saved EE_Messages_incoming_data object if there is one in the repository indexed by a key matching |
|
57 | - * the given string. |
|
58 | - * |
|
59 | - * @param string $key @see EE_Messages_Data_Handler_Collection::get_key() to setup a key formatted for searching. |
|
60 | - * |
|
61 | - * @return null|EE_Messages_incoming_data |
|
62 | - */ |
|
63 | - public function get_by_key($key) |
|
64 | - { |
|
65 | - $this->rewind(); |
|
66 | - while ($this->valid()) { |
|
67 | - $data = $this->getInfo(); |
|
68 | - if (isset($data['key']) && $data['key'] === $key) { |
|
69 | - $handler = $this->current(); |
|
70 | - $this->rewind(); |
|
71 | - return $handler; |
|
72 | - } |
|
73 | - $this->next(); |
|
74 | - } |
|
75 | - return null; |
|
76 | - } |
|
55 | + /** |
|
56 | + * This returns a saved EE_Messages_incoming_data object if there is one in the repository indexed by a key matching |
|
57 | + * the given string. |
|
58 | + * |
|
59 | + * @param string $key @see EE_Messages_Data_Handler_Collection::get_key() to setup a key formatted for searching. |
|
60 | + * |
|
61 | + * @return null|EE_Messages_incoming_data |
|
62 | + */ |
|
63 | + public function get_by_key($key) |
|
64 | + { |
|
65 | + $this->rewind(); |
|
66 | + while ($this->valid()) { |
|
67 | + $data = $this->getInfo(); |
|
68 | + if (isset($data['key']) && $data['key'] === $key) { |
|
69 | + $handler = $this->current(); |
|
70 | + $this->rewind(); |
|
71 | + return $handler; |
|
72 | + } |
|
73 | + $this->next(); |
|
74 | + } |
|
75 | + return null; |
|
76 | + } |
|
77 | 77 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function _set_admin_pages() |
54 | 54 | { |
55 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
55 | + $this->admin_registered_pages = array('events_edit' => true); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | protected function _set_with_messengers() |
68 | 68 | { |
69 | 69 | $this->_with_messengers = array( |
70 | - 'html' => array( 'pdf' ) |
|
70 | + 'html' => array('pdf') |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // receipt message type data handler is 'Gateways' and it expects a transaction object. |
79 | 79 | $transaction = $registration->transaction(); |
80 | 80 | if ($transaction instanceof EE_Transaction) { |
81 | - return array( $transaction ); |
|
81 | + return array($transaction); |
|
82 | 82 | } |
83 | 83 | return array(); |
84 | 84 | } |
@@ -12,123 +12,123 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Invoice_message_type extends EE_message_type |
14 | 14 | { |
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->name = 'invoice'; |
|
18 | - $this->description = esc_html__('The invoice message type is triggered via a url on the thank you page and via at url generated by the [INVOICE_URL] or [INVOICE_LINK] shortcode.', 'event_espresso'); |
|
19 | - $this->label = array( |
|
20 | - 'singular' => esc_html__('invoice', 'event_espresso'), |
|
21 | - 'plural' => esc_html__('invoices', 'event_espresso') |
|
22 | - ); |
|
23 | - $this->_master_templates = array(); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->name = 'invoice'; |
|
18 | + $this->description = esc_html__('The invoice message type is triggered via a url on the thank you page and via at url generated by the [INVOICE_URL] or [INVOICE_LINK] shortcode.', 'event_espresso'); |
|
19 | + $this->label = array( |
|
20 | + 'singular' => esc_html__('invoice', 'event_espresso'), |
|
21 | + 'plural' => esc_html__('invoices', 'event_espresso') |
|
22 | + ); |
|
23 | + $this->_master_templates = array(); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @see parent::get_priority() for documentation. |
|
31 | - * @return int |
|
32 | - */ |
|
33 | - public function get_priority() |
|
34 | - { |
|
35 | - return EEM_Message::priority_high; |
|
36 | - } |
|
29 | + /** |
|
30 | + * @see parent::get_priority() for documentation. |
|
31 | + * @return int |
|
32 | + */ |
|
33 | + public function get_priority() |
|
34 | + { |
|
35 | + return EEM_Message::priority_high; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * This method returns whether this message type should always generate a new copy |
|
41 | - * when requested, or if links can be to the already generated copy. |
|
42 | - * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
43 | - * Invoices always generate. |
|
44 | - * @return bool false means can link to generated EE_Message. true must regenerate. |
|
45 | - */ |
|
46 | - public function always_generate() |
|
47 | - { |
|
48 | - return true; |
|
49 | - } |
|
39 | + /** |
|
40 | + * This method returns whether this message type should always generate a new copy |
|
41 | + * when requested, or if links can be to the already generated copy. |
|
42 | + * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
43 | + * Invoices always generate. |
|
44 | + * @return bool false means can link to generated EE_Message. true must regenerate. |
|
45 | + */ |
|
46 | + public function always_generate() |
|
47 | + { |
|
48 | + return true; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - protected function _set_admin_pages() |
|
53 | - { |
|
54 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
55 | - } |
|
52 | + protected function _set_admin_pages() |
|
53 | + { |
|
54 | + $this->admin_registered_pages = array( 'events_edit' => true ); |
|
55 | + } |
|
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - protected function _set_data_handler() |
|
60 | - { |
|
61 | - $this->_data_handler = 'Gateways'; |
|
62 | - } |
|
59 | + protected function _set_data_handler() |
|
60 | + { |
|
61 | + $this->_data_handler = 'Gateways'; |
|
62 | + } |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - protected function _set_with_messengers() |
|
67 | - { |
|
68 | - $this->_with_messengers = array( |
|
69 | - 'html' => array( 'pdf' ) |
|
70 | - ); |
|
71 | - } |
|
66 | + protected function _set_with_messengers() |
|
67 | + { |
|
68 | + $this->_with_messengers = array( |
|
69 | + 'html' => array( 'pdf' ) |
|
70 | + ); |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | 74 | |
75 | - protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
76 | - { |
|
77 | - // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
78 | - $transaction = $registration->transaction(); |
|
79 | - if ($transaction instanceof EE_Transaction) { |
|
80 | - return array( $transaction ); |
|
81 | - } |
|
82 | - return array(); |
|
83 | - } |
|
75 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
76 | + { |
|
77 | + // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
78 | + $transaction = $registration->transaction(); |
|
79 | + if ($transaction instanceof EE_Transaction) { |
|
80 | + return array( $transaction ); |
|
81 | + } |
|
82 | + return array(); |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | 86 | |
87 | - protected function _set_admin_settings_fields() |
|
88 | - { |
|
89 | - $this->_admin_settings_fields = array(); |
|
90 | - } |
|
87 | + protected function _set_admin_settings_fields() |
|
88 | + { |
|
89 | + $this->_admin_settings_fields = array(); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | - protected function _set_contexts() |
|
95 | - { |
|
96 | - $this->_context_label = array( |
|
97 | - 'label' => esc_html__('recipient', 'event_espresso'), |
|
98 | - 'plural' => esc_html__('recipients', 'event_espresso'), |
|
99 | - 'description' => esc_html__('Recipient\'s are who will view the invoice.', 'event_espresso') |
|
100 | - ); |
|
94 | + protected function _set_contexts() |
|
95 | + { |
|
96 | + $this->_context_label = array( |
|
97 | + 'label' => esc_html__('recipient', 'event_espresso'), |
|
98 | + 'plural' => esc_html__('recipients', 'event_espresso'), |
|
99 | + 'description' => esc_html__('Recipient\'s are who will view the invoice.', 'event_espresso') |
|
100 | + ); |
|
101 | 101 | |
102 | - $this->_contexts = array( |
|
103 | - 'purchaser' => array( |
|
104 | - 'label' => esc_html__('Purchaser', 'event_espresso'), |
|
105 | - 'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
106 | - ) |
|
107 | - ); |
|
108 | - } |
|
102 | + $this->_contexts = array( |
|
103 | + 'purchaser' => array( |
|
104 | + 'label' => esc_html__('Purchaser', 'event_espresso'), |
|
105 | + 'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
106 | + ) |
|
107 | + ); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | |
111 | 111 | |
112 | 112 | |
113 | - /** |
|
114 | - * used to set the valid shortcodes for the receipt message type |
|
115 | - * |
|
116 | - * @since 4.5.0 |
|
117 | - * |
|
118 | - * @return void |
|
119 | - */ |
|
120 | - protected function _set_valid_shortcodes() |
|
121 | - { |
|
122 | - $this->_valid_shortcodes['purchaser'] = array( |
|
123 | - 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment' |
|
124 | - ); |
|
125 | - } |
|
113 | + /** |
|
114 | + * used to set the valid shortcodes for the receipt message type |
|
115 | + * |
|
116 | + * @since 4.5.0 |
|
117 | + * |
|
118 | + * @return void |
|
119 | + */ |
|
120 | + protected function _set_valid_shortcodes() |
|
121 | + { |
|
122 | + $this->_valid_shortcodes['purchaser'] = array( |
|
123 | + 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event', 'event_meta', 'messenger', 'organization', 'primary_registration_list', 'primary_registration_details', 'ticket_list', 'ticket', 'transaction', 'venue', 'line_item_list', 'payment_list', 'line_item', 'payment' |
|
124 | + ); |
|
125 | + } |
|
126 | 126 | |
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | - protected function _purchaser_addressees() |
|
131 | - { |
|
132 | - return parent::_primary_attendee_addressees(); |
|
133 | - } |
|
130 | + protected function _purchaser_addressees() |
|
131 | + { |
|
132 | + return parent::_primary_attendee_addressees(); |
|
133 | + } |
|
134 | 134 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | protected function _set_admin_pages() |
55 | 55 | { |
56 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
56 | + $this->admin_registered_pages = array('events_edit' => true); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | protected function _set_with_messengers() |
69 | 69 | { |
70 | 70 | $this->_with_messengers = array( |
71 | - 'html' => array( 'pdf' ) |
|
71 | + 'html' => array('pdf') |
|
72 | 72 | ); |
73 | 73 | } |
74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // receipt message type data handler is 'Gateways' and it expects a transaction object. |
80 | 80 | $transaction = $registration->transaction(); |
81 | 81 | if ($transaction instanceof EE_Transaction) { |
82 | - return array( $transaction ); |
|
82 | + return array($transaction); |
|
83 | 83 | } |
84 | 84 | return array(); |
85 | 85 | } |
@@ -12,142 +12,142 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Receipt_message_type extends EE_message_type |
14 | 14 | { |
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->name = 'receipt'; |
|
18 | - $this->description = esc_html__('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso'); |
|
19 | - $this->label = array( |
|
20 | - 'singular' => esc_html__('receipt', 'event_espresso'), |
|
21 | - 'plural' => esc_html__('receipts', 'event_espresso') |
|
22 | - ); |
|
23 | - $this->_master_templates = array(); |
|
24 | - parent::__construct(); |
|
25 | - } |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->name = 'receipt'; |
|
18 | + $this->description = esc_html__('The receipt message type is triggered via a url on the thank you page and via at url generated by the [RECEIPT_URL] shortcode.', 'event_espresso'); |
|
19 | + $this->label = array( |
|
20 | + 'singular' => esc_html__('receipt', 'event_espresso'), |
|
21 | + 'plural' => esc_html__('receipts', 'event_espresso') |
|
22 | + ); |
|
23 | + $this->_master_templates = array(); |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @see parent::get_priority() for documentation. |
|
31 | - * @return int |
|
32 | - */ |
|
33 | - public function get_priority() |
|
34 | - { |
|
35 | - return EEM_Message::priority_high; |
|
36 | - } |
|
37 | - |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * This method returns whether this message type should always generate a new copy |
|
42 | - * when requested, or if links can be to the already generated copy. |
|
43 | - * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
44 | - * Receipts always generate |
|
45 | - * @return bool false means can link to generated EE_Message. true must regenerate. |
|
46 | - */ |
|
47 | - public function always_generate() |
|
48 | - { |
|
49 | - return true; |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - protected function _set_admin_pages() |
|
54 | - { |
|
55 | - $this->admin_registered_pages = array( 'events_edit' => true ); |
|
56 | - } |
|
57 | - |
|
58 | - |
|
59 | - |
|
60 | - protected function _set_data_handler() |
|
61 | - { |
|
62 | - $this->_data_handler = 'Gateways'; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - protected function _set_with_messengers() |
|
68 | - { |
|
69 | - $this->_with_messengers = array( |
|
70 | - 'html' => array( 'pdf' ) |
|
71 | - ); |
|
72 | - } |
|
73 | - |
|
74 | - |
|
75 | - |
|
76 | - protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
77 | - { |
|
78 | - // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
79 | - $transaction = $registration->transaction(); |
|
80 | - if ($transaction instanceof EE_Transaction) { |
|
81 | - return array( $transaction ); |
|
82 | - } |
|
83 | - return array(); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - |
|
88 | - protected function _set_admin_settings_fields() |
|
89 | - { |
|
90 | - $this->_admin_settings_fields = array(); |
|
91 | - } |
|
92 | - |
|
93 | - |
|
94 | - |
|
95 | - protected function _set_contexts() |
|
96 | - { |
|
97 | - $this->_context_label = array( |
|
98 | - 'label' => esc_html__('recipient', 'event_espresso'), |
|
99 | - 'plural' => esc_html__('recipients', 'event_espresso'), |
|
100 | - 'description' => esc_html__('Recipient\'s are who will view the receipt.', 'event_espresso') |
|
101 | - ); |
|
102 | - |
|
103 | - $this->_contexts = array( |
|
104 | - 'purchaser' => array( |
|
105 | - 'label' => esc_html__('Purchaser', 'event_espresso'), |
|
106 | - 'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
107 | - ) |
|
108 | - ); |
|
109 | - } |
|
110 | - |
|
111 | - |
|
112 | - |
|
113 | - |
|
114 | - /** |
|
115 | - * used to set the valid shortcodes for the receipt message type |
|
116 | - * |
|
117 | - * @since 4.5.0 |
|
118 | - * |
|
119 | - * @return void |
|
120 | - */ |
|
121 | - protected function _set_valid_shortcodes() |
|
122 | - { |
|
123 | - $this->_valid_shortcodes['purchaser'] = array( |
|
124 | - 'attendee_list', |
|
125 | - 'attendee', |
|
126 | - 'datetime_list', |
|
127 | - 'datetime', |
|
128 | - 'event_list', |
|
129 | - 'event', |
|
130 | - 'event_meta', |
|
131 | - 'messenger', |
|
132 | - 'organization', |
|
133 | - 'primary_registration_list', |
|
134 | - 'primary_registration_details', |
|
135 | - 'ticket_list', |
|
136 | - 'ticket', |
|
137 | - 'transaction', |
|
138 | - 'venue', |
|
139 | - 'line_item_list', |
|
140 | - 'payment_list', |
|
141 | - 'line_item', |
|
142 | - 'payment' |
|
143 | - ); |
|
144 | - } |
|
145 | - |
|
29 | + /** |
|
30 | + * @see parent::get_priority() for documentation. |
|
31 | + * @return int |
|
32 | + */ |
|
33 | + public function get_priority() |
|
34 | + { |
|
35 | + return EEM_Message::priority_high; |
|
36 | + } |
|
37 | + |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * This method returns whether this message type should always generate a new copy |
|
42 | + * when requested, or if links can be to the already generated copy. |
|
43 | + * Note: this does NOT affect viewing/resending already generated messages in the EE_Message list table. |
|
44 | + * Receipts always generate |
|
45 | + * @return bool false means can link to generated EE_Message. true must regenerate. |
|
46 | + */ |
|
47 | + public function always_generate() |
|
48 | + { |
|
49 | + return true; |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + protected function _set_admin_pages() |
|
54 | + { |
|
55 | + $this->admin_registered_pages = array( 'events_edit' => true ); |
|
56 | + } |
|
57 | + |
|
58 | + |
|
59 | + |
|
60 | + protected function _set_data_handler() |
|
61 | + { |
|
62 | + $this->_data_handler = 'Gateways'; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + protected function _set_with_messengers() |
|
68 | + { |
|
69 | + $this->_with_messengers = array( |
|
70 | + 'html' => array( 'pdf' ) |
|
71 | + ); |
|
72 | + } |
|
73 | + |
|
74 | + |
|
75 | + |
|
76 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) |
|
77 | + { |
|
78 | + // receipt message type data handler is 'Gateways' and it expects a transaction object. |
|
79 | + $transaction = $registration->transaction(); |
|
80 | + if ($transaction instanceof EE_Transaction) { |
|
81 | + return array( $transaction ); |
|
82 | + } |
|
83 | + return array(); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + |
|
88 | + protected function _set_admin_settings_fields() |
|
89 | + { |
|
90 | + $this->_admin_settings_fields = array(); |
|
91 | + } |
|
92 | + |
|
93 | + |
|
94 | + |
|
95 | + protected function _set_contexts() |
|
96 | + { |
|
97 | + $this->_context_label = array( |
|
98 | + 'label' => esc_html__('recipient', 'event_espresso'), |
|
99 | + 'plural' => esc_html__('recipients', 'event_espresso'), |
|
100 | + 'description' => esc_html__('Recipient\'s are who will view the receipt.', 'event_espresso') |
|
101 | + ); |
|
102 | + |
|
103 | + $this->_contexts = array( |
|
104 | + 'purchaser' => array( |
|
105 | + 'label' => esc_html__('Purchaser', 'event_espresso'), |
|
106 | + 'description' => esc_html__('This template goes to the person who conducted the transaction.', 'event_espresso') |
|
107 | + ) |
|
108 | + ); |
|
109 | + } |
|
110 | + |
|
111 | + |
|
112 | + |
|
113 | + |
|
114 | + /** |
|
115 | + * used to set the valid shortcodes for the receipt message type |
|
116 | + * |
|
117 | + * @since 4.5.0 |
|
118 | + * |
|
119 | + * @return void |
|
120 | + */ |
|
121 | + protected function _set_valid_shortcodes() |
|
122 | + { |
|
123 | + $this->_valid_shortcodes['purchaser'] = array( |
|
124 | + 'attendee_list', |
|
125 | + 'attendee', |
|
126 | + 'datetime_list', |
|
127 | + 'datetime', |
|
128 | + 'event_list', |
|
129 | + 'event', |
|
130 | + 'event_meta', |
|
131 | + 'messenger', |
|
132 | + 'organization', |
|
133 | + 'primary_registration_list', |
|
134 | + 'primary_registration_details', |
|
135 | + 'ticket_list', |
|
136 | + 'ticket', |
|
137 | + 'transaction', |
|
138 | + 'venue', |
|
139 | + 'line_item_list', |
|
140 | + 'payment_list', |
|
141 | + 'line_item', |
|
142 | + 'payment' |
|
143 | + ); |
|
144 | + } |
|
145 | + |
|
146 | 146 | |
147 | 147 | |
148 | 148 | |
149 | - protected function _purchaser_addressees() |
|
150 | - { |
|
151 | - return parent::_primary_attendee_addressees(); |
|
152 | - } |
|
149 | + protected function _purchaser_addressees() |
|
150 | + { |
|
151 | + return parent::_primary_attendee_addressees(); |
|
152 | + } |
|
153 | 153 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | */ |
63 | 63 | protected function _get_subject($custom_subject = '') |
64 | 64 | { |
65 | - if (! empty($custom_subject)) { |
|
65 | + if ( ! empty($custom_subject)) { |
|
66 | 66 | return $custom_subject; |
67 | 67 | } |
68 | 68 | $this->queue->get_message_repository()->rewind(); |
@@ -12,90 +12,90 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Message_To_Generate_From_Queue extends EE_Message_To_Generate |
14 | 14 | { |
15 | - /** |
|
16 | - * Will hold an EE_Messages_Queue object |
|
17 | - * @type EE_Messages_Queue |
|
18 | - */ |
|
19 | - public $queue = array(); |
|
15 | + /** |
|
16 | + * Will hold an EE_Messages_Queue object |
|
17 | + * @type EE_Messages_Queue |
|
18 | + */ |
|
19 | + public $queue = array(); |
|
20 | 20 | |
21 | - /** |
|
22 | - * @param string $messenger_name The messenger being used to send the message |
|
23 | - * @param string $message_type_name The message type being used to grab variations etc. |
|
24 | - * @param EE_Messages_Queue $queue |
|
25 | - * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
26 | - */ |
|
27 | - public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
28 | - { |
|
29 | - $this->queue = $queue; |
|
30 | - parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
31 | - if ($this->valid()) { |
|
32 | - $this->_message->set_content($this->_get_content()); |
|
33 | - $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
34 | - $this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo()); |
|
35 | - } |
|
36 | - } |
|
21 | + /** |
|
22 | + * @param string $messenger_name The messenger being used to send the message |
|
23 | + * @param string $message_type_name The message type being used to grab variations etc. |
|
24 | + * @param EE_Messages_Queue $queue |
|
25 | + * @param string $custom_subject Used if a custom subject is desired for the generated aggregate EE_Message object |
|
26 | + */ |
|
27 | + public function __construct($messenger_name, $message_type_name, EE_Messages_Queue $queue, $custom_subject = '') |
|
28 | + { |
|
29 | + $this->queue = $queue; |
|
30 | + parent::__construct($messenger_name, $message_type_name, array(), '', false, EEM_Message::status_idle); |
|
31 | + if ($this->valid()) { |
|
32 | + $this->_message->set_content($this->_get_content()); |
|
33 | + $this->_message->set_subject($this->_get_subject($custom_subject)); |
|
34 | + $this->_message->set_GRP_ID($this->getGroupIdFromMessageRepo()); |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
42 | - * for the single EE_Message aggregate object returned by get_EE_Message |
|
43 | - * @return string; |
|
44 | - */ |
|
45 | - protected function _get_content() |
|
46 | - { |
|
47 | - $content = ''; |
|
48 | - $this->queue->get_message_repository()->rewind(); |
|
49 | - while ($this->queue->get_message_repository()->valid()) { |
|
50 | - $content .= $this->queue->get_message_repository()->current()->content(); |
|
51 | - $this->queue->get_message_repository()->next(); |
|
52 | - } |
|
53 | - return $content; |
|
54 | - } |
|
40 | + /** |
|
41 | + * Uses the EE_Messages_Queue currently set on this object to generate the content |
|
42 | + * for the single EE_Message aggregate object returned by get_EE_Message |
|
43 | + * @return string; |
|
44 | + */ |
|
45 | + protected function _get_content() |
|
46 | + { |
|
47 | + $content = ''; |
|
48 | + $this->queue->get_message_repository()->rewind(); |
|
49 | + while ($this->queue->get_message_repository()->valid()) { |
|
50 | + $content .= $this->queue->get_message_repository()->current()->content(); |
|
51 | + $this->queue->get_message_repository()->next(); |
|
52 | + } |
|
53 | + return $content; |
|
54 | + } |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
59 | - * @param string $custom_subject |
|
60 | - * |
|
61 | - * @return string |
|
62 | - */ |
|
63 | - protected function _get_subject($custom_subject = '') |
|
64 | - { |
|
65 | - if (! empty($custom_subject)) { |
|
66 | - return $custom_subject; |
|
67 | - } |
|
68 | - $this->queue->get_message_repository()->rewind(); |
|
69 | - $count_of_items = $this->queue->get_message_repository()->count(); |
|
57 | + /** |
|
58 | + * Return a subject string to use for `MSG_Subject` in the aggregate EE_Message object. |
|
59 | + * @param string $custom_subject |
|
60 | + * |
|
61 | + * @return string |
|
62 | + */ |
|
63 | + protected function _get_subject($custom_subject = '') |
|
64 | + { |
|
65 | + if (! empty($custom_subject)) { |
|
66 | + return $custom_subject; |
|
67 | + } |
|
68 | + $this->queue->get_message_repository()->rewind(); |
|
69 | + $count_of_items = $this->queue->get_message_repository()->count(); |
|
70 | 70 | |
71 | - // if $count of items in queue == 1, then let's just return the subject for that item. |
|
72 | - if ($count_of_items === 1) { |
|
73 | - return $this->queue->get_message_repository()->current()->subject(); |
|
74 | - } |
|
75 | - // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
76 | - return sprintf( |
|
77 | - _n( |
|
78 | - 'Showing Aggregate output for 1 result', |
|
79 | - 'Showing Aggregate output for %d items', |
|
80 | - $count_of_items, |
|
81 | - 'event_espresso' |
|
82 | - ), |
|
83 | - $count_of_items |
|
84 | - ); |
|
85 | - // phpcs:enable |
|
86 | - } |
|
71 | + // if $count of items in queue == 1, then let's just return the subject for that item. |
|
72 | + if ($count_of_items === 1) { |
|
73 | + return $this->queue->get_message_repository()->current()->subject(); |
|
74 | + } |
|
75 | + // phpcs:disable WordPress.WP.I18n.MissingSingularPlaceholder |
|
76 | + return sprintf( |
|
77 | + _n( |
|
78 | + 'Showing Aggregate output for 1 result', |
|
79 | + 'Showing Aggregate output for %d items', |
|
80 | + $count_of_items, |
|
81 | + 'event_espresso' |
|
82 | + ), |
|
83 | + $count_of_items |
|
84 | + ); |
|
85 | + // phpcs:enable |
|
86 | + } |
|
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID |
|
91 | - * for the single EE_Message aggregate object returned by get_EE_Message |
|
92 | - * @return int; |
|
93 | - */ |
|
94 | - protected function getGroupIdFromMessageRepo() |
|
95 | - { |
|
96 | - $this->queue->get_message_repository()->rewind(); |
|
97 | - if ($this->queue->get_message_repository()->valid()) { |
|
98 | - return $this->queue->get_message_repository()->current()->GRP_ID(); |
|
99 | - } |
|
100 | - } |
|
89 | + /** |
|
90 | + * Uses the EE_Messages_Queue currently set on this object to set the GRP_ID |
|
91 | + * for the single EE_Message aggregate object returned by get_EE_Message |
|
92 | + * @return int; |
|
93 | + */ |
|
94 | + protected function getGroupIdFromMessageRepo() |
|
95 | + { |
|
96 | + $this->queue->get_message_repository()->rewind(); |
|
97 | + if ($this->queue->get_message_repository()->valid()) { |
|
98 | + return $this->queue->get_message_repository()->current()->GRP_ID(); |
|
99 | + } |
|
100 | + } |
|
101 | 101 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->_validate_list_requirements(); |
76 | 76 | |
77 | - if (! $this->_data['data'] instanceof EE_Ticket) { |
|
77 | + if ( ! $this->_data['data'] instanceof EE_Ticket) { |
|
78 | 78 | return ''; |
79 | 79 | } |
80 | 80 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | $addressee_obj = $this->_extra_data['data']; |
86 | 86 | |
87 | 87 | // made it here so we have an EE_Ticket, so we should have what we need. |
88 | - $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
89 | - ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
90 | - $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
91 | - ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
88 | + $ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item']) |
|
89 | + ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null; |
|
90 | + $sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items']) |
|
91 | + ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array(); |
|
92 | 92 | |
93 | 93 | $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
94 | 94 | : $templates['ticket_line_item_pms']; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $this->_validate_list_requirements(); |
121 | 121 | |
122 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
122 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
123 | 123 | return ''; |
124 | 124 | } |
125 | 125 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $this->_validate_list_requirements(); |
155 | 155 | |
156 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
156 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
157 | 157 | return ''; |
158 | 158 | } |
159 | 159 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | $this->_validate_list_requirements(); |
191 | 191 | |
192 | - if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
192 | + if ( ! $this->_data['data'] instanceof EE_Line_Item) { |
|
193 | 193 | return ''; |
194 | 194 | } |
195 | 195 | |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | |
203 | 203 | $main_line_item_id = $main_line_item->ID(); |
204 | 204 | |
205 | - $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
206 | - ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
205 | + $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children']) |
|
206 | + ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array(); |
|
207 | 207 | |
208 | 208 | $line_item_list = ''; |
209 | 209 |
@@ -18,202 +18,202 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Line_Item_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - protected function _init_props() |
|
22 | - { |
|
23 | - $this->label = esc_html__('Line Item List Shortcodes', 'event_espresso'); |
|
24 | - $this->description = esc_html__('All shortcodes specific to line item lists', 'event_espresso'); |
|
25 | - $this->_shortcodes = array( |
|
26 | - '[TICKET_LINE_ITEM_LIST]' => esc_html__('Outputs a list of ticket line items.', 'event_espresso'), |
|
27 | - '[TAX_LINE_ITEM_LIST]' => esc_html__('Outputs a list of tax line items.', 'event_espresso'), |
|
28 | - '[ADDITIONAL_LINE_ITEM_LIST]' => esc_html__( |
|
29 | - 'Outputs a list of additional line items (other charges or discounts)', |
|
30 | - 'event_espresso' |
|
31 | - ), |
|
32 | - '[PRICE_MODIFIER_LINE_ITEM_LIST]' => esc_html__('Outputs a list of price modifier line items', 'event_espresso'), |
|
33 | - ); |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - protected function _parser($shortcode) |
|
38 | - { |
|
39 | - |
|
40 | - switch ($shortcode) { |
|
41 | - case '[TICKET_LINE_ITEM_LIST]': |
|
42 | - return $this->_get_ticket_line_item_list(); |
|
43 | - break; |
|
44 | - |
|
45 | - case '[TAX_LINE_ITEM_LIST]': |
|
46 | - return $this->_get_tax_line_item_list(); |
|
47 | - break; |
|
48 | - |
|
49 | - case '[PRICE_MODIFIER_LINE_ITEM_LIST]': |
|
50 | - return $this->_get_price_mod_line_item_list(); |
|
51 | - break; |
|
52 | - |
|
53 | - case '[ADDITIONAL_LINE_ITEM_LIST]': |
|
54 | - return $this->_get_additional_line_item_list(); |
|
55 | - break; |
|
56 | - |
|
57 | - default: |
|
58 | - return ''; |
|
59 | - break; |
|
60 | - } |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - /** |
|
65 | - * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event. |
|
66 | - * |
|
67 | - * @since 4.5.0 |
|
68 | - * |
|
69 | - * @return string parsed ticket line item list. |
|
70 | - */ |
|
71 | - private function _get_ticket_line_item_list() |
|
72 | - { |
|
73 | - $this->_validate_list_requirements(); |
|
74 | - |
|
75 | - if (! $this->_data['data'] instanceof EE_Ticket) { |
|
76 | - return ''; |
|
77 | - } |
|
78 | - |
|
79 | - $valid_shortcodes = array('line_item', 'line_item_list', 'ticket'); |
|
80 | - |
|
81 | - $ticket = $this->_data['data']; |
|
82 | - $templates = $this->_extra_data['template']; |
|
83 | - $addressee_obj = $this->_extra_data['data']; |
|
84 | - |
|
85 | - // made it here so we have an EE_Ticket, so we should have what we need. |
|
86 | - $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
87 | - ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
88 | - $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
89 | - ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
90 | - |
|
91 | - $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
|
92 | - : $templates['ticket_line_item_pms']; |
|
93 | - |
|
94 | - if (empty($ticket_line_item) || empty($sub_line_items)) { |
|
95 | - return ''; |
|
96 | - } |
|
97 | - |
|
98 | - // now we just return the appropriate template parsed for each ticket. |
|
99 | - return $this->_shortcode_helper->parse_line_item_list_template( |
|
100 | - $template, |
|
101 | - $ticket_line_item, |
|
102 | - $valid_shortcodes, |
|
103 | - $this->_extra_data |
|
104 | - ); |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - /** |
|
109 | - * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction. |
|
110 | - * |
|
111 | - * @since 4.5.0 |
|
112 | - * |
|
113 | - * @return string parsed tax line item list. |
|
114 | - */ |
|
115 | - private function _get_tax_line_item_list() |
|
116 | - { |
|
117 | - |
|
118 | - $this->_validate_list_requirements(); |
|
119 | - |
|
120 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
121 | - return ''; |
|
122 | - } |
|
123 | - |
|
124 | - // made it here so we're good to go. |
|
125 | - $valid_shortcodes = array('line_item'); |
|
126 | - $templates = $this->_data['template']; |
|
127 | - |
|
128 | - $tax_line_items = $this->_data['data']->tax_line_items; |
|
129 | - $line_item_list = ''; |
|
130 | - foreach ($tax_line_items as $line_item) { |
|
131 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
132 | - $templates['tax_line_item_list'], |
|
133 | - $line_item, |
|
134 | - $valid_shortcodes, |
|
135 | - $this->_extra_data |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - return $line_item_list; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction. |
|
144 | - * |
|
145 | - * @since 4.5.0 |
|
146 | - * |
|
147 | - * @return string parsed other line item list. |
|
148 | - */ |
|
149 | - private function _get_additional_line_item_list() |
|
150 | - { |
|
151 | - |
|
152 | - $this->_validate_list_requirements(); |
|
153 | - |
|
154 | - if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
155 | - return ''; |
|
156 | - } |
|
157 | - |
|
158 | - // made it here so we're good to go. |
|
159 | - $valid_shortcodes = array('line_item'); |
|
160 | - $templates = $this->_data['template']; |
|
161 | - |
|
162 | - $additional_line_items = $this->_data['data']->additional_line_items; |
|
163 | - $line_item_list = ''; |
|
164 | - foreach ($additional_line_items as $line_item) { |
|
165 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
166 | - $templates['additional_line_item_list'], |
|
167 | - $line_item, |
|
168 | - $valid_shortcodes, |
|
169 | - $this->_extra_data |
|
170 | - ); |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - return $line_item_list; |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a |
|
180 | - * parent ticket line item. |
|
181 | - * |
|
182 | - * @since 4.5.0 |
|
183 | - * |
|
184 | - * @return string parsed price modifier line item list. |
|
185 | - */ |
|
186 | - private function _get_price_mod_line_item_list() |
|
187 | - { |
|
188 | - $this->_validate_list_requirements(); |
|
189 | - |
|
190 | - if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
191 | - return ''; |
|
192 | - } |
|
193 | - |
|
194 | - // made it here so we're good to go. |
|
195 | - $main_line_item = $this->_data['data']; |
|
196 | - $templates = $this->_extra_data['template']; |
|
197 | - $addressee_obj = $this->_extra_data['data']; |
|
198 | - |
|
199 | - $valid_shortcodes = array('line_item'); |
|
200 | - |
|
201 | - $main_line_item_id = $main_line_item->ID(); |
|
202 | - |
|
203 | - $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
204 | - ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
205 | - |
|
206 | - $line_item_list = ''; |
|
207 | - |
|
208 | - foreach ($price_mod_line_items as $line_item) { |
|
209 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
210 | - $templates['price_modifier_line_item_list'], |
|
211 | - $line_item, |
|
212 | - $valid_shortcodes, |
|
213 | - $this->_extra_data |
|
214 | - ); |
|
215 | - } |
|
216 | - |
|
217 | - return $line_item_list; |
|
218 | - } |
|
21 | + protected function _init_props() |
|
22 | + { |
|
23 | + $this->label = esc_html__('Line Item List Shortcodes', 'event_espresso'); |
|
24 | + $this->description = esc_html__('All shortcodes specific to line item lists', 'event_espresso'); |
|
25 | + $this->_shortcodes = array( |
|
26 | + '[TICKET_LINE_ITEM_LIST]' => esc_html__('Outputs a list of ticket line items.', 'event_espresso'), |
|
27 | + '[TAX_LINE_ITEM_LIST]' => esc_html__('Outputs a list of tax line items.', 'event_espresso'), |
|
28 | + '[ADDITIONAL_LINE_ITEM_LIST]' => esc_html__( |
|
29 | + 'Outputs a list of additional line items (other charges or discounts)', |
|
30 | + 'event_espresso' |
|
31 | + ), |
|
32 | + '[PRICE_MODIFIER_LINE_ITEM_LIST]' => esc_html__('Outputs a list of price modifier line items', 'event_espresso'), |
|
33 | + ); |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + protected function _parser($shortcode) |
|
38 | + { |
|
39 | + |
|
40 | + switch ($shortcode) { |
|
41 | + case '[TICKET_LINE_ITEM_LIST]': |
|
42 | + return $this->_get_ticket_line_item_list(); |
|
43 | + break; |
|
44 | + |
|
45 | + case '[TAX_LINE_ITEM_LIST]': |
|
46 | + return $this->_get_tax_line_item_list(); |
|
47 | + break; |
|
48 | + |
|
49 | + case '[PRICE_MODIFIER_LINE_ITEM_LIST]': |
|
50 | + return $this->_get_price_mod_line_item_list(); |
|
51 | + break; |
|
52 | + |
|
53 | + case '[ADDITIONAL_LINE_ITEM_LIST]': |
|
54 | + return $this->_get_additional_line_item_list(); |
|
55 | + break; |
|
56 | + |
|
57 | + default: |
|
58 | + return ''; |
|
59 | + break; |
|
60 | + } |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + /** |
|
65 | + * verify incoming data contains what is needed for retrieving and parsing each ticket line item for an event. |
|
66 | + * |
|
67 | + * @since 4.5.0 |
|
68 | + * |
|
69 | + * @return string parsed ticket line item list. |
|
70 | + */ |
|
71 | + private function _get_ticket_line_item_list() |
|
72 | + { |
|
73 | + $this->_validate_list_requirements(); |
|
74 | + |
|
75 | + if (! $this->_data['data'] instanceof EE_Ticket) { |
|
76 | + return ''; |
|
77 | + } |
|
78 | + |
|
79 | + $valid_shortcodes = array('line_item', 'line_item_list', 'ticket'); |
|
80 | + |
|
81 | + $ticket = $this->_data['data']; |
|
82 | + $templates = $this->_extra_data['template']; |
|
83 | + $addressee_obj = $this->_extra_data['data']; |
|
84 | + |
|
85 | + // made it here so we have an EE_Ticket, so we should have what we need. |
|
86 | + $ticket_line_item = isset($addressee_obj->tickets[ $ticket->ID() ]['line_item']) |
|
87 | + ? $addressee_obj->tickets[ $ticket->ID() ]['line_item'] : null; |
|
88 | + $sub_line_items = isset($addressee_obj->tickets[ $ticket->ID() ]['sub_line_items']) |
|
89 | + ? $addressee_obj->tickets[ $ticket->ID() ]['sub_line_items'] : array(); |
|
90 | + |
|
91 | + $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] |
|
92 | + : $templates['ticket_line_item_pms']; |
|
93 | + |
|
94 | + if (empty($ticket_line_item) || empty($sub_line_items)) { |
|
95 | + return ''; |
|
96 | + } |
|
97 | + |
|
98 | + // now we just return the appropriate template parsed for each ticket. |
|
99 | + return $this->_shortcode_helper->parse_line_item_list_template( |
|
100 | + $template, |
|
101 | + $ticket_line_item, |
|
102 | + $valid_shortcodes, |
|
103 | + $this->_extra_data |
|
104 | + ); |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + /** |
|
109 | + * Verify incoming data contains what is needed for retrieving and parsing each tax line item for a transaction. |
|
110 | + * |
|
111 | + * @since 4.5.0 |
|
112 | + * |
|
113 | + * @return string parsed tax line item list. |
|
114 | + */ |
|
115 | + private function _get_tax_line_item_list() |
|
116 | + { |
|
117 | + |
|
118 | + $this->_validate_list_requirements(); |
|
119 | + |
|
120 | + if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
121 | + return ''; |
|
122 | + } |
|
123 | + |
|
124 | + // made it here so we're good to go. |
|
125 | + $valid_shortcodes = array('line_item'); |
|
126 | + $templates = $this->_data['template']; |
|
127 | + |
|
128 | + $tax_line_items = $this->_data['data']->tax_line_items; |
|
129 | + $line_item_list = ''; |
|
130 | + foreach ($tax_line_items as $line_item) { |
|
131 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
132 | + $templates['tax_line_item_list'], |
|
133 | + $line_item, |
|
134 | + $valid_shortcodes, |
|
135 | + $this->_extra_data |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + return $line_item_list; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * Verify incoming data contains what is needed for retrieving and parsing each other line item for a transaction. |
|
144 | + * |
|
145 | + * @since 4.5.0 |
|
146 | + * |
|
147 | + * @return string parsed other line item list. |
|
148 | + */ |
|
149 | + private function _get_additional_line_item_list() |
|
150 | + { |
|
151 | + |
|
152 | + $this->_validate_list_requirements(); |
|
153 | + |
|
154 | + if (! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
155 | + return ''; |
|
156 | + } |
|
157 | + |
|
158 | + // made it here so we're good to go. |
|
159 | + $valid_shortcodes = array('line_item'); |
|
160 | + $templates = $this->_data['template']; |
|
161 | + |
|
162 | + $additional_line_items = $this->_data['data']->additional_line_items; |
|
163 | + $line_item_list = ''; |
|
164 | + foreach ($additional_line_items as $line_item) { |
|
165 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
166 | + $templates['additional_line_item_list'], |
|
167 | + $line_item, |
|
168 | + $valid_shortcodes, |
|
169 | + $this->_extra_data |
|
170 | + ); |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + return $line_item_list; |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * Verify incoming data contains what is needed for retrieving and parsing each price modifier line item for a |
|
180 | + * parent ticket line item. |
|
181 | + * |
|
182 | + * @since 4.5.0 |
|
183 | + * |
|
184 | + * @return string parsed price modifier line item list. |
|
185 | + */ |
|
186 | + private function _get_price_mod_line_item_list() |
|
187 | + { |
|
188 | + $this->_validate_list_requirements(); |
|
189 | + |
|
190 | + if (! $this->_data['data'] instanceof EE_Line_Item) { |
|
191 | + return ''; |
|
192 | + } |
|
193 | + |
|
194 | + // made it here so we're good to go. |
|
195 | + $main_line_item = $this->_data['data']; |
|
196 | + $templates = $this->_extra_data['template']; |
|
197 | + $addressee_obj = $this->_extra_data['data']; |
|
198 | + |
|
199 | + $valid_shortcodes = array('line_item'); |
|
200 | + |
|
201 | + $main_line_item_id = $main_line_item->ID(); |
|
202 | + |
|
203 | + $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[ $main_line_item_id ]['children']) |
|
204 | + ? $addressee_obj->line_items_with_children[ $main_line_item_id ]['children'] : array(); |
|
205 | + |
|
206 | + $line_item_list = ''; |
|
207 | + |
|
208 | + foreach ($price_mod_line_items as $line_item) { |
|
209 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( |
|
210 | + $templates['price_modifier_line_item_list'], |
|
211 | + $line_item, |
|
212 | + $valid_shortcodes, |
|
213 | + $this->_extra_data |
|
214 | + ); |
|
215 | + } |
|
216 | + |
|
217 | + return $line_item_list; |
|
218 | + } |
|
219 | 219 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | protected function _parser($shortcode) |
43 | 43 | { |
44 | 44 | // ensure that the incoming object IS a line item. If it isn't then bail early. |
45 | - if (! $this->_data instanceof EE_Line_Item) { |
|
45 | + if ( ! $this->_data instanceof EE_Line_Item) { |
|
46 | 46 | return ''; |
47 | 47 | } |
48 | 48 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | break; |
63 | 63 | |
64 | 64 | case '[LINE_ITEM_AMOUNT]': |
65 | - return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code(); |
|
65 | + return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code(); |
|
66 | 66 | break; |
67 | 67 | |
68 | 68 | case '[LINE_ITEM_TOTAL]': |
@@ -16,65 +16,65 @@ |
||
16 | 16 | */ |
17 | 17 | class EE_Line_Item_Shortcodes extends EE_Shortcodes |
18 | 18 | { |
19 | - protected function _init_props() |
|
20 | - { |
|
21 | - $this->label = esc_html__('Line Item Shortcodes', 'event_espresso'); |
|
22 | - $this->description = esc_html__('All shortcodes specific to line items', 'event_espresso'); |
|
23 | - $this->_shortcodes = array( |
|
24 | - '[LINE_ITEM_NAME]' => esc_html__('Outputs the line item name.', 'event_espresso'), |
|
25 | - '[LINE_ITEM_DESCRIPTION]' => esc_html__('Outputs a the description for the line item.', 'event_espresso'), |
|
26 | - '[LINE_ITEM_QUANTITY]' => esc_html__('Outputs the quantity for this line item.', 'event_espresso'), |
|
27 | - '[LINE_ITEM_AMOUNT]' => esc_html__( |
|
28 | - 'This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - '[LINE_ITEM_TOTAL]' => esc_html__('This outputs the line item total.', 'event_espresso'), |
|
32 | - '[LINE_ITEM_TAXABLE_*]' => esc_html__( |
|
33 | - 'This attribute type shortcode allows users to indicate what to output if a line item is taxable or not. One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item. So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned. The default symbol if no attribute is included is the "*" symbol.', |
|
34 | - 'event_espresso' |
|
35 | - ), |
|
36 | - ); |
|
37 | - } |
|
19 | + protected function _init_props() |
|
20 | + { |
|
21 | + $this->label = esc_html__('Line Item Shortcodes', 'event_espresso'); |
|
22 | + $this->description = esc_html__('All shortcodes specific to line items', 'event_espresso'); |
|
23 | + $this->_shortcodes = array( |
|
24 | + '[LINE_ITEM_NAME]' => esc_html__('Outputs the line item name.', 'event_espresso'), |
|
25 | + '[LINE_ITEM_DESCRIPTION]' => esc_html__('Outputs a the description for the line item.', 'event_espresso'), |
|
26 | + '[LINE_ITEM_QUANTITY]' => esc_html__('Outputs the quantity for this line item.', 'event_espresso'), |
|
27 | + '[LINE_ITEM_AMOUNT]' => esc_html__( |
|
28 | + 'This will either output the unit price for a line item if its not a percent, or the percent of the line item (if it is percent).', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + '[LINE_ITEM_TOTAL]' => esc_html__('This outputs the line item total.', 'event_espresso'), |
|
32 | + '[LINE_ITEM_TAXABLE_*]' => esc_html__( |
|
33 | + 'This attribute type shortcode allows users to indicate what to output if a line item is taxable or not. One can use the key "symbol=" with the shortcode to indicate what they\'d like to represent a taxable line item. So doing something like <code>[LINE_ITEM_TAXABLE_* symbol="*"]</code> means that when the line item is parsed, if it\'s taxable the "*" symbol will be returned. The default symbol if no attribute is included is the "*" symbol.', |
|
34 | + 'event_espresso' |
|
35 | + ), |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - protected function _parser($shortcode) |
|
41 | - { |
|
42 | - // ensure that the incoming object IS a line item. If it isn't then bail early. |
|
43 | - if (! $this->_data instanceof EE_Line_Item) { |
|
44 | - return ''; |
|
45 | - } |
|
40 | + protected function _parser($shortcode) |
|
41 | + { |
|
42 | + // ensure that the incoming object IS a line item. If it isn't then bail early. |
|
43 | + if (! $this->_data instanceof EE_Line_Item) { |
|
44 | + return ''; |
|
45 | + } |
|
46 | 46 | |
47 | - $line_item = $this->_data; |
|
47 | + $line_item = $this->_data; |
|
48 | 48 | |
49 | - switch ($shortcode) { |
|
50 | - case '[LINE_ITEM_NAME]': |
|
51 | - return $line_item->name(); |
|
52 | - break; |
|
49 | + switch ($shortcode) { |
|
50 | + case '[LINE_ITEM_NAME]': |
|
51 | + return $line_item->name(); |
|
52 | + break; |
|
53 | 53 | |
54 | - case '[LINE_ITEM_DESCRIPTION]': |
|
55 | - return $line_item->desc(); |
|
56 | - break; |
|
54 | + case '[LINE_ITEM_DESCRIPTION]': |
|
55 | + return $line_item->desc(); |
|
56 | + break; |
|
57 | 57 | |
58 | - case '[LINE_ITEM_QUANTITY]': |
|
59 | - return $line_item->quantity(); |
|
60 | - break; |
|
58 | + case '[LINE_ITEM_QUANTITY]': |
|
59 | + return $line_item->quantity(); |
|
60 | + break; |
|
61 | 61 | |
62 | - case '[LINE_ITEM_AMOUNT]': |
|
63 | - return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code(); |
|
64 | - break; |
|
62 | + case '[LINE_ITEM_AMOUNT]': |
|
63 | + return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code(); |
|
64 | + break; |
|
65 | 65 | |
66 | - case '[LINE_ITEM_TOTAL]': |
|
67 | - return $line_item->total_no_code(); |
|
68 | - break; |
|
69 | - } |
|
66 | + case '[LINE_ITEM_TOTAL]': |
|
67 | + return $line_item->total_no_code(); |
|
68 | + break; |
|
69 | + } |
|
70 | 70 | |
71 | - if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== false) { |
|
72 | - $attrs = $this->_get_shortcode_attrs($shortcode); |
|
73 | - if ($line_item->is_taxable()) { |
|
74 | - return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*'; |
|
75 | - } |
|
76 | - } |
|
71 | + if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== false) { |
|
72 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
73 | + if ($line_item->is_taxable()) { |
|
74 | + return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*'; |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - return ''; |
|
79 | - } |
|
78 | + return ''; |
|
79 | + } |
|
80 | 80 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | protected function _parser($shortcode) |
55 | 55 | { |
56 | 56 | |
57 | - if (! $this->_data instanceof EE_Datetime) { |
|
57 | + if ( ! $this->_data instanceof EE_Datetime) { |
|
58 | 58 | return ''; // get out cause we can only parse with the datetime object. |
59 | 59 | } |
60 | 60 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
94 | 94 | |
95 | - return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
95 | + return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>'; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return ''; |
@@ -17,83 +17,83 @@ |
||
17 | 17 | */ |
18 | 18 | class EE_Datetime_Shortcodes extends EE_Shortcodes |
19 | 19 | { |
20 | - /** |
|
21 | - * _init_props |
|
22 | - * |
|
23 | - * @access protected |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - protected function _init_props() |
|
27 | - { |
|
28 | - $this->label = esc_html__('Datetime Shortcodes', 'event_espresso'); |
|
29 | - $this->description = esc_html__('All shortcodes specific to datetime related data', 'event_espresso'); |
|
30 | - $this->_shortcodes = array( |
|
31 | - '[DATETIME_START]' => esc_html__('The start date and time.', 'event_espresso'), |
|
32 | - '[DATETIME_END]' => esc_html__('The end date and time.', 'event_espresso'), |
|
33 | - '[DATETIME_TIMEZONE]' => esc_html__('The timezone for the date and time', 'event_espresso'), |
|
34 | - '[DATE_START]' => esc_html__('The datetime start date.', 'event_espresso'), |
|
35 | - '[DATE_END]' => esc_html__('The datetime end date.', 'event_espresso'), |
|
36 | - '[TIME_START]' => esc_html__('The datetime start time.', 'event_espresso'), |
|
37 | - '[TIME_END]' => esc_html__('The datetime end time.', 'event_espresso'), |
|
38 | - '[ICAL_LINK_*]' => esc_html__( |
|
39 | - 'The datetime iCal link. The optional "link_text" attribute can be used to set custom text within the link (Default is "Add to iCal Calendar").', |
|
40 | - 'event_espresso' |
|
41 | - ), |
|
42 | - ); |
|
43 | - } |
|
20 | + /** |
|
21 | + * _init_props |
|
22 | + * |
|
23 | + * @access protected |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + protected function _init_props() |
|
27 | + { |
|
28 | + $this->label = esc_html__('Datetime Shortcodes', 'event_espresso'); |
|
29 | + $this->description = esc_html__('All shortcodes specific to datetime related data', 'event_espresso'); |
|
30 | + $this->_shortcodes = array( |
|
31 | + '[DATETIME_START]' => esc_html__('The start date and time.', 'event_espresso'), |
|
32 | + '[DATETIME_END]' => esc_html__('The end date and time.', 'event_espresso'), |
|
33 | + '[DATETIME_TIMEZONE]' => esc_html__('The timezone for the date and time', 'event_espresso'), |
|
34 | + '[DATE_START]' => esc_html__('The datetime start date.', 'event_espresso'), |
|
35 | + '[DATE_END]' => esc_html__('The datetime end date.', 'event_espresso'), |
|
36 | + '[TIME_START]' => esc_html__('The datetime start time.', 'event_espresso'), |
|
37 | + '[TIME_END]' => esc_html__('The datetime end time.', 'event_espresso'), |
|
38 | + '[ICAL_LINK_*]' => esc_html__( |
|
39 | + 'The datetime iCal link. The optional "link_text" attribute can be used to set custom text within the link (Default is "Add to iCal Calendar").', |
|
40 | + 'event_espresso' |
|
41 | + ), |
|
42 | + ); |
|
43 | + } |
|
44 | 44 | |
45 | 45 | |
46 | - /** |
|
47 | - * _parser |
|
48 | - * |
|
49 | - * @access protected |
|
50 | - * @param string $shortcode |
|
51 | - * @return string |
|
52 | - */ |
|
53 | - protected function _parser($shortcode) |
|
54 | - { |
|
46 | + /** |
|
47 | + * _parser |
|
48 | + * |
|
49 | + * @access protected |
|
50 | + * @param string $shortcode |
|
51 | + * @return string |
|
52 | + */ |
|
53 | + protected function _parser($shortcode) |
|
54 | + { |
|
55 | 55 | |
56 | - if (! $this->_data instanceof EE_Datetime) { |
|
57 | - return ''; // get out cause we can only parse with the datetime object. |
|
58 | - } |
|
56 | + if (! $this->_data instanceof EE_Datetime) { |
|
57 | + return ''; // get out cause we can only parse with the datetime object. |
|
58 | + } |
|
59 | 59 | |
60 | - switch ($shortcode) { |
|
61 | - case '[DATETIME_START]': |
|
62 | - return $this->_data->get_i18n_datetime('DTT_EVT_start'); |
|
63 | - break; |
|
60 | + switch ($shortcode) { |
|
61 | + case '[DATETIME_START]': |
|
62 | + return $this->_data->get_i18n_datetime('DTT_EVT_start'); |
|
63 | + break; |
|
64 | 64 | |
65 | - case '[DATETIME_END]': |
|
66 | - return $this->_data->get_i18n_datetime('DTT_EVT_end'); |
|
67 | - break; |
|
65 | + case '[DATETIME_END]': |
|
66 | + return $this->_data->get_i18n_datetime('DTT_EVT_end'); |
|
67 | + break; |
|
68 | 68 | |
69 | - case '[DATETIME_TIMEZONE]': |
|
70 | - return $this->_data->get_timezone(); |
|
71 | - break; |
|
72 | - case '[DATE_START]': |
|
73 | - return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format')); |
|
74 | - break; |
|
75 | - case '[DATE_END]': |
|
76 | - return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format')); |
|
77 | - break; |
|
78 | - case '[TIME_START]': |
|
79 | - return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format')); |
|
80 | - break; |
|
81 | - case '[TIME_END]': |
|
82 | - return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format')); |
|
83 | - break; |
|
84 | - } |
|
69 | + case '[DATETIME_TIMEZONE]': |
|
70 | + return $this->_data->get_timezone(); |
|
71 | + break; |
|
72 | + case '[DATE_START]': |
|
73 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format')); |
|
74 | + break; |
|
75 | + case '[DATE_END]': |
|
76 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format')); |
|
77 | + break; |
|
78 | + case '[TIME_START]': |
|
79 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format')); |
|
80 | + break; |
|
81 | + case '[TIME_END]': |
|
82 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format')); |
|
83 | + break; |
|
84 | + } |
|
85 | 85 | |
86 | - if (strpos($shortcode, '[ICAL_LINK_*') !== false) { |
|
87 | - $attrs = $this->_get_shortcode_attrs($shortcode); |
|
86 | + if (strpos($shortcode, '[ICAL_LINK_*') !== false) { |
|
87 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
88 | 88 | |
89 | - $link_text = empty($attrs['link_text']) ? esc_html__('Add to iCal Calendar', 'event_espresso') |
|
90 | - : $attrs['link_text']; |
|
89 | + $link_text = empty($attrs['link_text']) ? esc_html__('Add to iCal Calendar', 'event_espresso') |
|
90 | + : $attrs['link_text']; |
|
91 | 91 | |
92 | - $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
|
92 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
|
93 | 93 | |
94 | - return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
95 | - } |
|
94 | + return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
95 | + } |
|
96 | 96 | |
97 | - return ''; |
|
98 | - } |
|
97 | + return ''; |
|
98 | + } |
|
99 | 99 | } |