@@ -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 | /** |
@@ -34,16 +34,16 @@ discard block |
||
34 | 34 | $this->_shortcodes = array( |
35 | 35 | '[TICKET_LINE_ITEM_LIST]' => __('Outputs a list of ticket line items.', 'event_espresso'), |
36 | 36 | '[TAX_LINE_ITEM_LIST]' => __('Outputs a list of tax line items.', 'event_espresso'), |
37 | - '[ADDITIONAL_LINE_ITEM_LIST]' => __( 'Outputs a list of additional line items (other charges or discounts)', 'event_espresso' ), |
|
37 | + '[ADDITIONAL_LINE_ITEM_LIST]' => __('Outputs a list of additional line items (other charges or discounts)', 'event_espresso'), |
|
38 | 38 | '[PRICE_MODIFIER_LINE_ITEM_LIST]' => __('Outputs a list of price modifier line items', 'event_espresso') |
39 | 39 | ); |
40 | 40 | } |
41 | 41 | |
42 | 42 | |
43 | 43 | |
44 | - protected function _parser( $shortcode ) { |
|
44 | + protected function _parser($shortcode) { |
|
45 | 45 | |
46 | - switch ( $shortcode ) { |
|
46 | + switch ($shortcode) { |
|
47 | 47 | case '[TICKET_LINE_ITEM_LIST]' : |
48 | 48 | return $this->_get_ticket_line_item_list(); |
49 | 49 | break; |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | $this->_validate_list_requirements(); |
81 | 81 | $this->_set_shortcode_helper(); |
82 | 82 | |
83 | - if ( ! $this->_data['data'] instanceof EE_Ticket ) { |
|
83 | + if ( ! $this->_data['data'] instanceof EE_Ticket) { |
|
84 | 84 | return ''; |
85 | 85 | } |
86 | 86 | |
87 | - $valid_shortcodes = array( 'line_item', 'line_item_list', 'ticket' ); |
|
87 | + $valid_shortcodes = array('line_item', 'line_item_list', 'ticket'); |
|
88 | 88 | |
89 | 89 | $ticket = $this->_data['data']; |
90 | 90 | $templates = $this->_extra_data['template']; |
91 | 91 | $addressee_obj = $this->_extra_data['data']; |
92 | 92 | |
93 | 93 | //made it here so we have an EE_Ticket, so we should have what we need. |
94 | - $ticket_line_item = isset( $addressee_obj->tickets[$ticket->ID()]['line_item'] ) ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null; |
|
95 | - $sub_line_items = isset( $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] ) ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array(); |
|
94 | + $ticket_line_item = isset($addressee_obj->tickets[$ticket->ID()]['line_item']) ? $addressee_obj->tickets[$ticket->ID()]['line_item'] : null; |
|
95 | + $sub_line_items = isset($addressee_obj->tickets[$ticket->ID()]['sub_line_items']) ? $addressee_obj->tickets[$ticket->ID()]['sub_line_items'] : array(); |
|
96 | 96 | |
97 | - $template = count( $sub_line_items ) < 2 ? $templates['ticket_line_item_no_pms'] : $templates['ticket_line_item_pms']; |
|
97 | + $template = count($sub_line_items) < 2 ? $templates['ticket_line_item_no_pms'] : $templates['ticket_line_item_pms']; |
|
98 | 98 | |
99 | - if ( empty( $ticket_line_item ) || empty( $sub_line_items ) ) { |
|
99 | + if (empty($ticket_line_item) || empty($sub_line_items)) { |
|
100 | 100 | return ''; |
101 | 101 | } |
102 | 102 | |
103 | 103 | //now we just return the appropriate template parsed for each ticket. |
104 | - return $this->_shortcode_helper->parse_line_item_list_template( $template, $ticket_line_item, $valid_shortcodes, $this->_extra_data ); |
|
104 | + return $this->_shortcode_helper->parse_line_item_list_template($template, $ticket_line_item, $valid_shortcodes, $this->_extra_data); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | $this->_validate_list_requirements(); |
120 | 120 | $this->_set_shortcode_helper(); |
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 | |
126 | 126 | //made it here so we're good to go. |
127 | - $valid_shortcodes = array( 'line_item' ); |
|
127 | + $valid_shortcodes = array('line_item'); |
|
128 | 128 | $templates = $this->_data['template']; |
129 | 129 | |
130 | 130 | $tax_line_items = $this->_data['data']->tax_line_items; |
131 | 131 | $line_item_list = ''; |
132 | - foreach ( $tax_line_items as $line_item ) { |
|
133 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['tax_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data ); |
|
132 | + foreach ($tax_line_items as $line_item) { |
|
133 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['tax_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $line_item_list; |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | $this->_validate_list_requirements(); |
149 | 149 | $this->_set_shortcode_helper(); |
150 | 150 | |
151 | - if ( ! $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
151 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
152 | 152 | return ''; |
153 | 153 | } |
154 | 154 | |
155 | 155 | //made it here so we're good to go. |
156 | - $valid_shortcodes = array( 'line_item' ); |
|
156 | + $valid_shortcodes = array('line_item'); |
|
157 | 157 | $templates = $this->_data['template']; |
158 | 158 | |
159 | 159 | $additional_line_items = $this->_data['data']->additional_line_items; |
160 | 160 | $line_item_list = ''; |
161 | - foreach ( $additional_line_items as $line_item ) { |
|
162 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['additional_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data ); |
|
161 | + foreach ($additional_line_items as $line_item) { |
|
162 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['additional_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->_validate_list_requirements(); |
183 | 183 | $this->_set_shortcode_helper(); |
184 | 184 | |
185 | - if ( ! $this->_data['data'] instanceof EE_Line_Item ) { |
|
185 | + if ( ! $this->_data['data'] instanceof EE_Line_Item) { |
|
186 | 186 | return ''; |
187 | 187 | } |
188 | 188 | |
@@ -191,16 +191,16 @@ discard block |
||
191 | 191 | $templates = $this->_extra_data['template']; |
192 | 192 | $addressee_obj = $this->_extra_data['data']; |
193 | 193 | |
194 | - $valid_shortcodes = array( 'line_item' ); |
|
194 | + $valid_shortcodes = array('line_item'); |
|
195 | 195 | |
196 | 196 | $main_line_item_id = $main_line_item->ID(); |
197 | 197 | |
198 | - $price_mod_line_items = ! empty( $addressee_obj->line_items_with_children[$main_line_item_id]['children'] ) ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array(); |
|
198 | + $price_mod_line_items = ! empty($addressee_obj->line_items_with_children[$main_line_item_id]['children']) ? $addressee_obj->line_items_with_children[$main_line_item_id]['children'] : array(); |
|
199 | 199 | |
200 | 200 | $line_item_list = ''; |
201 | 201 | |
202 | - foreach( $price_mod_line_items as $line_item ) { |
|
203 | - $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template( $templates['price_modifier_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data ); |
|
202 | + foreach ($price_mod_line_items as $line_item) { |
|
203 | + $line_item_list .= $this->_shortcode_helper->parse_line_item_list_template($templates['price_modifier_line_item_list'], $line_item, $valid_shortcodes, $this->_extra_data); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | return $line_item_list; |
@@ -6,8 +6,9 @@ |
||
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 | 13 | /** |
13 | 14 | * |
@@ -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 | /** |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | '[LINE_ITEM_NAME]' => __('Outputs the line item name.', 'event_espresso'), |
35 | 35 | '[LINE_ITEM_DESCRIPTION]' => __('Outputs a the description for the line item.', 'event_espresso'), |
36 | 36 | '[LINE_ITEM_QUANTITY]' => __('Outputs the quantity for this line item.', 'event_espresso'), |
37 | - '[LINE_ITEM_AMOUNT]' => __('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).', 'event_espresso' ), |
|
37 | + '[LINE_ITEM_AMOUNT]' => __('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).', 'event_espresso'), |
|
38 | 38 | '[LINE_ITEM_TOTAL]' => __('This outputs the line item total.', 'event_espresso'), |
39 | - '[LINE_ITEM_TAXABLE_*]' => __('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.', 'event_espresso' ) |
|
39 | + '[LINE_ITEM_TAXABLE_*]' => __('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.', 'event_espresso') |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 | |
43 | 43 | |
44 | 44 | |
45 | - protected function _parser( $shortcode ) { |
|
45 | + protected function _parser($shortcode) { |
|
46 | 46 | //ensure that the incoming object IS a line item. If it isn't then bail early. |
47 | - if ( ! $this->_data instanceof EE_Line_Item ) { |
|
47 | + if ( ! $this->_data instanceof EE_Line_Item) { |
|
48 | 48 | return ''; |
49 | 49 | } |
50 | 50 | |
51 | 51 | $line_item = $this->_data; |
52 | 52 | |
53 | - switch ( $shortcode ) { |
|
53 | + switch ($shortcode) { |
|
54 | 54 | case '[LINE_ITEM_NAME]' : |
55 | 55 | return $line_item->name(); |
56 | 56 | break; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | break; |
65 | 65 | |
66 | 66 | case '[LINE_ITEM_AMOUNT]' : |
67 | - return $line_item->is_percent() ? $line_item->percent() . '%' : $line_item->unit_price_no_code(); |
|
67 | + return $line_item->is_percent() ? $line_item->percent().'%' : $line_item->unit_price_no_code(); |
|
68 | 68 | break; |
69 | 69 | |
70 | 70 | case '[LINE_ITEM_TOTAL]' : |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | break; |
73 | 73 | } |
74 | 74 | |
75 | - if ( strpos( $shortcode, '[LINE_ITEM_TAXABLE_*' ) !== FALSE ) { |
|
76 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
77 | - if ( $line_item->is_taxable() ) { |
|
78 | - return !empty( $attrs['symbol'] ) ? $attrs['symbol'] : '*'; |
|
75 | + if (strpos($shortcode, '[LINE_ITEM_TAXABLE_*') !== FALSE) { |
|
76 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
77 | + if ($line_item->is_taxable()) { |
|
78 | + return ! empty($attrs['symbol']) ? $attrs['symbol'] : '*'; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 |
@@ -6,8 +6,9 @@ |
||
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 | 13 | /** |
13 | 14 | * |
@@ -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 | /** |
@@ -63,91 +63,91 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | |
66 | - protected function _parser( $shortcode ) { |
|
66 | + protected function _parser($shortcode) { |
|
67 | 67 | |
68 | - switch ( $shortcode ) { |
|
68 | + switch ($shortcode) { |
|
69 | 69 | |
70 | 70 | case '[COMPANY]' : |
71 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'name' ); |
|
71 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
72 | 72 | break; |
73 | 73 | |
74 | 74 | case '[CO_ADD1]' : |
75 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ); |
|
75 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
76 | 76 | break; |
77 | 77 | |
78 | 78 | case '[CO_ADD2]' : |
79 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ); |
|
79 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
80 | 80 | break; |
81 | 81 | |
82 | 82 | case '[CO_CITY]' : |
83 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'city' ); |
|
83 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
84 | 84 | break; |
85 | 85 | |
86 | 86 | case '[CO_STATE]' : |
87 | - $state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID ); |
|
87 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID); |
|
88 | 88 | return $state->name(); |
89 | 89 | break; |
90 | 90 | |
91 | 91 | case '[CO_ZIP]' : |
92 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ); |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | 93 | break; |
94 | 94 | |
95 | 95 | case '[CO_EMAIL]' : |
96 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'email' ); |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | 97 | break; |
98 | 98 | |
99 | 99 | case '[CO_PHONE]' : |
100 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ); |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | 101 | break; |
102 | 102 | |
103 | 103 | case '[CO_LOGO]' : |
104 | - return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />'; |
|
104 | + return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />'; |
|
105 | 105 | break; |
106 | 106 | |
107 | 107 | case '[CO_LOGO_URL]' : |
108 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ); |
|
108 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
109 | 109 | break; |
110 | 110 | |
111 | 111 | case '[CO_FACEBOOK_URL]' : |
112 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ); |
|
112 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
113 | 113 | break; |
114 | 114 | |
115 | 115 | case '[CO_TWITTER_URL]' : |
116 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ); |
|
116 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
117 | 117 | break; |
118 | 118 | |
119 | 119 | case '[CO_PINTEREST_URL]' : |
120 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ); |
|
120 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
121 | 121 | break; |
122 | 122 | |
123 | 123 | case '[CO_LINKEDIN_URL]' : |
124 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ); |
|
124 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
125 | 125 | break; |
126 | 126 | |
127 | 127 | case '[CO_GOOGLE_URL]' : |
128 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'google' ); |
|
128 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | case '[CO_INSTAGRAM_URL]' : |
132 | - return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ); |
|
132 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
133 | 133 | break; |
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | 137 | //also allow for parameter shortcode |
138 | - if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) { |
|
138 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) { |
|
139 | 139 | //first see if there is any company tax number set and bail early if not |
140 | 140 | $tax_number = EE_Registry::instance()->CFG->organization->vat; |
141 | - if ( empty( $tax_number ) ) { |
|
141 | + if (empty($tax_number)) { |
|
142 | 142 | return ''; |
143 | 143 | } |
144 | 144 | |
145 | 145 | //see if there are any attributes. |
146 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
146 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
147 | 147 | |
148 | 148 | //set custom attrs if present (or default) |
149 | - $prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso'); |
|
150 | - return $prefix . $tax_number; |
|
149 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : __('VAT/Tax Number: ', 'event_espresso'); |
|
150 | + return $prefix.$tax_number; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | return ''; |
@@ -6,8 +6,9 @@ |
||
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 | 13 | /** |
13 | 14 | * |
@@ -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 | /** |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | $this->label = __('Payment List Shortcodes', 'event_espresso'); |
33 | 33 | $this->description = __('All shortcodes specific to payment lists', 'event_espresso'); |
34 | 34 | $this->_shortcodes = array( |
35 | - '[PAYMENT_LIST_*]' => __('Outputs a list of payment items. Note, this is a dynamic shortcode in that it accepts some attributes for setting certain defaults. Attributes that are available are:', 'event_espresso') . '<p><ul>' . |
|
36 | - '<li><strong>no_payments</strong>:' . sprintf( __('Indicate with this attribute what will be used if there are no payments present. Default is: "%sNo approved payments have been received.%s"', 'event_espresso'), htmlspecialchars('<td class="aln-cntr" colspan="6">'), htmlspecialchars('</td>') ) . '</li>' . |
|
35 | + '[PAYMENT_LIST_*]' => __('Outputs a list of payment items. Note, this is a dynamic shortcode in that it accepts some attributes for setting certain defaults. Attributes that are available are:', 'event_espresso').'<p><ul>'. |
|
36 | + '<li><strong>no_payments</strong>:'.sprintf(__('Indicate with this attribute what will be used if there are no payments present. Default is: "%sNo approved payments have been received.%s"', 'event_espresso'), htmlspecialchars('<td class="aln-cntr" colspan="6">'), htmlspecialchars('</td>')).'</li>'. |
|
37 | 37 | '</ul></p>' |
38 | 38 | ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | - protected function _parser( $shortcode ) { |
|
43 | + protected function _parser($shortcode) { |
|
44 | 44 | |
45 | - if ( strpos( $shortcode, '[PAYMENT_LIST_*' ) !== FALSE ) { |
|
46 | - return $this->_get_payment_list( $shortcode ); |
|
45 | + if (strpos($shortcode, '[PAYMENT_LIST_*') !== FALSE) { |
|
46 | + return $this->_get_payment_list($shortcode); |
|
47 | 47 | } |
48 | 48 | return ''; |
49 | 49 | } |
@@ -60,33 +60,33 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string parsed ticket line item list. |
62 | 62 | */ |
63 | - private function _get_payment_list( $shortcode ) { |
|
63 | + private function _get_payment_list($shortcode) { |
|
64 | 64 | $this->_validate_list_requirements(); |
65 | 65 | $this->_set_shortcode_helper(); |
66 | 66 | |
67 | 67 | |
68 | - if ( ! $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
68 | + if ( ! $this->_data['data'] instanceof EE_Messages_Addressee) { |
|
69 | 69 | return ''; |
70 | 70 | } |
71 | 71 | |
72 | - $valid_shortcodes = array( 'payment' ); |
|
72 | + $valid_shortcodes = array('payment'); |
|
73 | 73 | |
74 | 74 | $addressee_obj = $this->_data['data']; |
75 | 75 | $templates = $this->_extra_data['template']; |
76 | 76 | $payments = $addressee_obj->payments; |
77 | 77 | |
78 | 78 | //let's get any attributes that may be present and set the defaults. |
79 | - $atts = $this->_get_shortcode_attrs( $shortcode ); |
|
79 | + $atts = $this->_get_shortcode_attrs($shortcode); |
|
80 | 80 | |
81 | - $no_payments_msg = empty( $atts['no_payments'] ) ? __('No approved payments have been received.','event_espresso') : $atts['no_payments']; |
|
81 | + $no_payments_msg = empty($atts['no_payments']) ? __('No approved payments have been received.', 'event_espresso') : $atts['no_payments']; |
|
82 | 82 | |
83 | 83 | //made it here so we have an array of paymnets, so we should have what we need. |
84 | - $payment_content = empty( $payments ) ? $no_payments_msg : ''; |
|
84 | + $payment_content = empty($payments) ? $no_payments_msg : ''; |
|
85 | 85 | |
86 | 86 | $payments = (array) $payments; |
87 | 87 | |
88 | - foreach ( $payments as $payment ) { |
|
89 | - $payment_content .= $this->_shortcode_helper->parse_payment_list_template( $templates['payment_list'], $payment, $valid_shortcodes, $this->_extra_data ); |
|
88 | + foreach ($payments as $payment) { |
|
89 | + $payment_content .= $this->_shortcode_helper->parse_payment_list_template($templates['payment_list'], $payment, $valid_shortcodes, $this->_extra_data); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $payment_content; |
@@ -6,8 +6,9 @@ |
||
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 | 13 | /** |
13 | 14 | * |
@@ -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 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | '[PAYMENT_TIMESTAMP]' => __('Outputs the date of the payment (using the default date format).', 'event_espresso'), |
35 | 35 | '[PAYMENT_METHOD]' => __('Outputs a the payment method.', 'event_espresso'), |
36 | 36 | '[PAYMENT_AMOUNT]' => __('Outputs the payment amount (with currency symbol).', 'event_espresso'), |
37 | - '[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso' ), |
|
37 | + '[PAYMENT_GATEWAY]' => __('Outputs the gateway used for the payment.', 'event_espresso'), |
|
38 | 38 | '[PAYMENT_GATEWAY_RESPONSE]' => __('Outputs the payment gateway response.', 'event_espresso'), |
39 | 39 | '[PAYMENT_GATEWAY_TXN_ID]' => __('This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.', 'event_espresso'), |
40 | 40 | '[PAYMENT_PO_NUMBER]' => __('Purchase Order number (if present)', 'event_espresso'), |
@@ -46,15 +46,15 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | - protected function _parser( $shortcode ) { |
|
49 | + protected function _parser($shortcode) { |
|
50 | 50 | //ensure that the incoming object is an EE_Payment object. If it isn't then bail early. |
51 | - if ( ! $this->_data instanceof EE_Payment ) { |
|
51 | + if ( ! $this->_data instanceof EE_Payment) { |
|
52 | 52 | return ''; |
53 | 53 | } |
54 | 54 | |
55 | 55 | $payment = $this->_data; |
56 | 56 | |
57 | - switch ( $shortcode ) { |
|
57 | + switch ($shortcode) { |
|
58 | 58 | case '[PAYMENT_TIMESTAMP]' : |
59 | 59 | return $payment->timestamp(); |
60 | 60 | break; |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | |
71 | 71 | case '[PAYMENT_GATEWAY]' : |
72 | 72 | //previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
73 | - if( $payment->payment_method() instanceof EE_Payment_Method ){ |
|
73 | + if ($payment->payment_method() instanceof EE_Payment_Method) { |
|
74 | 74 | return $payment->payment_method()->name(); |
75 | - }else{ |
|
76 | - return __( 'Unknown', 'event_espresso' ); |
|
75 | + } else { |
|
76 | + return __('Unknown', 'event_espresso'); |
|
77 | 77 | } |
78 | 78 | break; |
79 | 79 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | break; |
99 | 99 | |
100 | 100 | case '[PAYMENT_STATUS_WITH_ICONS]' : |
101 | - return $payment->pretty_status( TRUE ); |
|
101 | + return $payment->pretty_status(TRUE); |
|
102 | 102 | break; |
103 | 103 | |
104 | 104 | default : |
@@ -6,8 +6,9 @@ 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 | 13 | /** |
13 | 14 | * |
@@ -72,7 +73,7 @@ discard block |
||
72 | 73 | //previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
73 | 74 | if( $payment->payment_method() instanceof EE_Payment_Method ){ |
74 | 75 | return $payment->payment_method()->name(); |
75 | - }else{ |
|
76 | + } else{ |
|
76 | 77 | return __( 'Unknown', 'event_espresso' ); |
77 | 78 | } |
78 | 79 | break; |
@@ -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 | /** |
@@ -45,32 +45,32 @@ discard block |
||
45 | 45 | '[PRIMARY_REGISTRANT_ADDRESS2]' => __('Whatever was in the address 2 field for the primary registrant for the transaction.', 'event_espresso'), |
46 | 46 | '[PRIMARY_REGISTRANT_CITY]' => __('The city for the primary registrant for the transaction.', 'event_espresso'), |
47 | 47 | '[PRIMARY_REGISTRANT_ZIP_PC]' => __('The ZIP (or Postal) Code for the primary registrant for the transaction.', 'event_espresso'), |
48 | - '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso' ), |
|
48 | + '[PRIMARY_REGISTRANT_ADDRESS_STATE]' => __('The state/province for the primary registrant for the transaction.', 'event_espresso'), |
|
49 | 49 | '[PRIMARY_REGISTRANT_COUNTRY]' => __('The country for the primary registrant for the transaction.', 'event_espresso'), |
50 | 50 | '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' => __('The date the registration occured for the primary registration.', 'event_espresso'), |
51 | 51 | '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' => __('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'), |
52 | - '[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso' ) |
|
52 | + '[PRIMARY_REGISTRANT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this primary registrant, then it will be output in place of this shortcode.', 'event_espresso') |
|
53 | 53 | ); |
54 | 54 | } |
55 | 55 | |
56 | 56 | |
57 | 57 | |
58 | - protected function _parser( $shortcode ) { |
|
58 | + protected function _parser($shortcode) { |
|
59 | 59 | //make sure we end up with a copy of the EE_Messages_Addressee object |
60 | 60 | $primary_registration = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
61 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
|
62 | - $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
|
61 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
|
62 | + $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
|
63 | 63 | |
64 | - if ( ! $primary_registration instanceof EE_Messages_Addressee ) |
|
64 | + if ( ! $primary_registration instanceof EE_Messages_Addressee) |
|
65 | 65 | return ''; |
66 | 66 | |
67 | 67 | $attendee = $primary_registration->primary_att_obj; |
68 | 68 | $primary_reg = $primary_registration->primary_reg_obj; |
69 | 69 | |
70 | - if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) |
|
70 | + if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration) |
|
71 | 71 | return ''; |
72 | 72 | |
73 | - switch ( $shortcode ) { |
|
73 | + switch ($shortcode) { |
|
74 | 74 | case '[PRIMARY_REGISTRANT_FNAME]' : |
75 | 75 | return $attendee->fname(); |
76 | 76 | break; |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | break; |
119 | 119 | |
120 | 120 | case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' : |
121 | - if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) |
|
121 | + if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration) |
|
122 | 122 | return ''; |
123 | - return $primary_registration->primary_reg_obj->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ); |
|
123 | + return $primary_registration->primary_reg_obj->get_i18n_datetime('REG_date', get_option('date_format')); |
|
124 | 124 | break; |
125 | 125 | |
126 | 126 | case '[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]' : |
@@ -128,19 +128,19 @@ discard block |
||
128 | 128 | break; |
129 | 129 | } |
130 | 130 | |
131 | - if ( strpos( $shortcode, '[PRIMARY_REGISTRANT_ANSWER_*' ) !== false ) { |
|
132 | - $shortcode = str_replace( '[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode ); |
|
133 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
131 | + if (strpos($shortcode, '[PRIMARY_REGISTRANT_ANSWER_*') !== false) { |
|
132 | + $shortcode = str_replace('[PRIMARY_REGISTRANT_ANSWER_*', '', $shortcode); |
|
133 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | //now let's figure out what question has this text |
137 | - if ( empty( $primary_registration->questions ) ) { |
|
137 | + if (empty($primary_registration->questions)) { |
|
138 | 138 | return ''; |
139 | 139 | } |
140 | 140 | |
141 | - foreach ( $primary_registration->questions as $ansid => $question ) { |
|
142 | - if ( $question->get('QST_display_text') == $shortcode && isset( $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid] ) ) { |
|
143 | - return $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
141 | + foreach ($primary_registration->questions as $ansid => $question) { |
|
142 | + if ($question->get('QST_display_text') == $shortcode && isset($primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid])) { |
|
143 | + return $primary_registration->registrations[$primary_reg->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -61,14 +62,16 @@ discard block |
||
61 | 62 | $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $primary_registration; |
62 | 63 | $primary_registration = ! $primary_registration instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $primary_registration; |
63 | 64 | |
64 | - if ( ! $primary_registration instanceof EE_Messages_Addressee ) |
|
65 | - return ''; |
|
65 | + if ( ! $primary_registration instanceof EE_Messages_Addressee ) { |
|
66 | + return ''; |
|
67 | + } |
|
66 | 68 | |
67 | 69 | $attendee = $primary_registration->primary_att_obj; |
68 | 70 | $primary_reg = $primary_registration->primary_reg_obj; |
69 | 71 | |
70 | - if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) |
|
71 | - return ''; |
|
72 | + if ( ! $attendee instanceof EE_Attendee || ! $primary_reg instanceof EE_Registration ) { |
|
73 | + return ''; |
|
74 | + } |
|
72 | 75 | |
73 | 76 | switch ( $shortcode ) { |
74 | 77 | case '[PRIMARY_REGISTRANT_FNAME]' : |
@@ -118,8 +121,9 @@ discard block |
||
118 | 121 | break; |
119 | 122 | |
120 | 123 | case '[PRIMARY_REGISTRANT_REGISTRATION_DATE]' : |
121 | - if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) |
|
122 | - return ''; |
|
124 | + if ( ! $primary_registration->primary_reg_obj instanceof EE_Registration ) { |
|
125 | + return ''; |
|
126 | + } |
|
123 | 127 | return $primary_registration->primary_reg_obj->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ); |
124 | 128 | break; |
125 | 129 |
@@ -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,31 +50,31 @@ discard block |
||
50 | 50 | '[RECIPIENT_ADDRESS2]' => __('Whatever was in the address 2 field for the recipient of the message.', 'event_espresso'), |
51 | 51 | '[RECIPIENT_CITY]' => __('The city for the recipient of the message.', 'event_espresso'), |
52 | 52 | '[RECIPIENT_ZIP_PC]' => __('The ZIP (or Postal) Code for the recipient of the message.', 'event_espresso'), |
53 | - '[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso' ), |
|
53 | + '[RECIPIENT_ADDRESS_STATE]' => __('The state/province for the recipient of the message.', 'event_espresso'), |
|
54 | 54 | '[RECIPIENT_COUNTRY]' => __('The country for the recipient of the message.', 'event_espresso'), |
55 | - '[RECIPIENT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso' ) |
|
55 | + '[RECIPIENT_ANSWER_*]' => __('This is a special dynamic shortcode. After the "*", add the exact text of an existing question, and if there is an answer for that question for this recipient, then it will be output in place of this shortcode.', 'event_espresso') |
|
56 | 56 | ); |
57 | 57 | } |
58 | 58 | |
59 | 59 | |
60 | 60 | |
61 | - protected function _parser( $shortcode ) { |
|
61 | + protected function _parser($shortcode) { |
|
62 | 62 | |
63 | 63 | //make sure we end up with a copy of the EE_Messages_Addressee object |
64 | 64 | $this->_recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
65 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient; |
|
66 | - $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient; |
|
65 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient; |
|
66 | + $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient; |
|
67 | 67 | |
68 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) |
|
68 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee) |
|
69 | 69 | return ''; |
70 | 70 | |
71 | 71 | $attendee = $this->_recipient->att_obj; |
72 | - if ( ! $attendee instanceof EE_Attendee ) |
|
72 | + if ( ! $attendee instanceof EE_Attendee) |
|
73 | 73 | return ''; |
74 | 74 | |
75 | - $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] : array(); |
|
75 | + $this->_registrations_for_recipient = isset($this->_recipient->attendees[$attendee->ID()]['reg_objs']) ? $this->_recipient->attendees[$attendee->ID()]['reg_objs'] : array(); |
|
76 | 76 | |
77 | - switch ( $shortcode ) { |
|
77 | + switch ($shortcode) { |
|
78 | 78 | case '[RECIPIENT_FNAME]' : |
79 | 79 | return $attendee->fname(); |
80 | 80 | break; |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | break; |
89 | 89 | |
90 | 90 | case '[RECIPIENT_REGISTRATION_CODE]' : |
91 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
91 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) |
|
92 | 92 | return ''; |
93 | 93 | return $this->_get_reg_code(); |
94 | 94 | break; |
95 | 95 | |
96 | 96 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
97 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
97 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration) |
|
98 | 98 | return ''; |
99 | 99 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
100 | 100 | break; |
@@ -130,19 +130,19 @@ discard block |
||
130 | 130 | break; |
131 | 131 | } |
132 | 132 | |
133 | - if ( strpos( $shortcode, '[RECIPIENT_ANSWER_*' ) !== false ) { |
|
134 | - $shortcode = str_replace( '[RECIPIENT_ANSWER_*', '', $shortcode ); |
|
135 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
133 | + if (strpos($shortcode, '[RECIPIENT_ANSWER_*') !== false) { |
|
134 | + $shortcode = str_replace('[RECIPIENT_ANSWER_*', '', $shortcode); |
|
135 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | //now let's figure out what question has this text |
139 | - if ( empty( $this->_recipient->questions ) || ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
139 | + if (empty($this->_recipient->questions) || ! $this->_recipient->reg_obj instanceof EE_Registration) { |
|
140 | 140 | return ''; |
141 | 141 | } |
142 | 142 | |
143 | - foreach ( $this->_recipient->questions as $ansid => $question ) { |
|
144 | - if ( $question instanceof EE_Question && $question->display_text() == $shortcode && isset( $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid] ) ) { |
|
145 | - return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty( 'ANS_value', 'no_wpautop' ); |
|
143 | + foreach ($this->_recipient->questions as $ansid => $question) { |
|
144 | + if ($question instanceof EE_Question && $question->display_text() == $shortcode && isset($this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid])) { |
|
145 | + return $this->_recipient->registrations[$this->_recipient->reg_obj->ID()]['ans_objs'][$ansid]->get_pretty('ANS_value', 'no_wpautop'); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | } |
@@ -173,48 +173,48 @@ discard block |
||
173 | 173 | protected function _get_reg_code() { |
174 | 174 | |
175 | 175 | //if only one related registration for the recipient then just return that reg code. |
176 | - if ( count( $this->_registrations_for_recipient ) <= 1 ) { |
|
176 | + if (count($this->_registrations_for_recipient) <= 1) { |
|
177 | 177 | return $this->_recipient->reg_obj->reg_code(); |
178 | 178 | } |
179 | 179 | |
180 | 180 | //k more than one registration so let's see if we can get specific to context |
181 | 181 | //are we parsing event_list? |
182 | - if ( $this->_data instanceof EE_Event ) { |
|
182 | + if ($this->_data instanceof EE_Event) { |
|
183 | 183 | $reg_code = array(); |
184 | 184 | //loop through registrations for recipient and see if there is a match for this event |
185 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
186 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID() ) { |
|
185 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
186 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $this->_data->ID()) { |
|
187 | 187 | $reg_code[] = $reg->reg_code(); |
188 | 188 | } |
189 | 189 | } |
190 | - return implode( ', ', $reg_code ); |
|
190 | + return implode(', ', $reg_code); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | //are we parsing ticket list? |
194 | - if ( $this->_data instanceof EE_Ticket ) { |
|
194 | + if ($this->_data instanceof EE_Ticket) { |
|
195 | 195 | $reg_code = array(); |
196 | 196 | //loop through each registration for recipient and see if there is a match for this ticket |
197 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
198 | - if ( $reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID() ) { |
|
197 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
198 | + if ($reg instanceof EE_Registration && $reg->ticket_ID() == $this->_data->ID()) { |
|
199 | 199 | $reg_code = $reg->reg_code(); |
200 | 200 | } |
201 | 201 | } |
202 | - return implode( ', ', $reg_code ); |
|
202 | + return implode(', ', $reg_code); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | //do we have a specific reg_obj? Let's use it |
206 | - if ( $this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration ) { |
|
206 | + if ($this->_data instanceof EE_Messages_Addressee && $this->_data->reg_obj instanceof EE_Registration) { |
|
207 | 207 | return $this->_data->reg_obj->reg_code(); |
208 | 208 | } |
209 | 209 | |
210 | 210 | //not able to determine the single reg code so let's return a comma delimited list of reg codes. |
211 | 211 | $reg_code = array(); |
212 | - foreach ( $this->_registrations_for_recipient as $reg ) { |
|
213 | - if ( $reg instanceof EE_Registration ) { |
|
212 | + foreach ($this->_registrations_for_recipient as $reg) { |
|
213 | + if ($reg instanceof EE_Registration) { |
|
214 | 214 | $reg_code[] = $reg->reg_code(); |
215 | 215 | } |
216 | 216 | } |
217 | - return implode(', ', $reg_code ); |
|
217 | + return implode(', ', $reg_code); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -65,12 +66,14 @@ discard block |
||
65 | 66 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && is_array($this->_data) && isset( $this->_data['data'] ) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] : $this->_recipient; |
66 | 67 | $this->_recipient = ! $this->_recipient instanceof EE_Messages_Addressee && !empty( $this->_extra_data['data'] ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee ? $this->_extra_data['data'] : $this->_recipient; |
67 | 68 | |
68 | - if ( ! $this->_recipient instanceof EE_Messages_Addressee ) |
|
69 | - return ''; |
|
69 | + if ( ! $this->_recipient instanceof EE_Messages_Addressee ) { |
|
70 | + return ''; |
|
71 | + } |
|
70 | 72 | |
71 | 73 | $attendee = $this->_recipient->att_obj; |
72 | - if ( ! $attendee instanceof EE_Attendee ) |
|
73 | - return ''; |
|
74 | + if ( ! $attendee instanceof EE_Attendee ) { |
|
75 | + return ''; |
|
76 | + } |
|
74 | 77 | |
75 | 78 | $this->_registrations_for_recipient = isset( $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] ) ? $this->_recipient->attendees[ $attendee->ID() ]['reg_objs'] : array(); |
76 | 79 | |
@@ -88,14 +91,16 @@ discard block |
||
88 | 91 | break; |
89 | 92 | |
90 | 93 | case '[RECIPIENT_REGISTRATION_CODE]' : |
91 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
92 | - return ''; |
|
94 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
95 | + return ''; |
|
96 | + } |
|
93 | 97 | return $this->_get_reg_code(); |
94 | 98 | break; |
95 | 99 | |
96 | 100 | case '[RECIPIENT_EDIT_REGISTRATION_LINK]' : |
97 | - if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) |
|
98 | - return ''; |
|
101 | + if ( ! $this->_recipient->reg_obj instanceof EE_Registration ) { |
|
102 | + return ''; |
|
103 | + } |
|
99 | 104 | return $this->_recipient->reg_obj->edit_attendee_information_url(); |
100 | 105 | break; |
101 | 106 |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | |
46 | - protected function _parser( $shortcode ) { |
|
47 | - switch ( $shortcode ) { |
|
46 | + protected function _parser($shortcode) { |
|
47 | + switch ($shortcode) { |
|
48 | 48 | case '[RECIPIENT_TICKET_LIST]' : |
49 | 49 | return $this->_get_recipient_ticket_list(); |
50 | 50 | break; |
@@ -67,34 +67,34 @@ discard block |
||
67 | 67 | $this->_validate_list_requirements(); |
68 | 68 | $this->_set_shortcode_helper(); |
69 | 69 | |
70 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
71 | - return $this->_get_recipient_ticket_list_parsed( $this->_data['data'] ); |
|
72 | - } else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
73 | - return $this->_get_recipient_ticket_list_parsed( $this->_extra_data['data'] ); |
|
70 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
71 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
72 | + } else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
73 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
74 | 74 | } else { |
75 | 75 | return ''; |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | |
80 | - private function _get_recipient_ticket_list_parsed( EE_Messages_Addressee $data ) { |
|
80 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) { |
|
81 | 81 | //first get registrations just for this attendee. |
82 | 82 | $att = $data->att_obj; |
83 | 83 | $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
84 | - $registrations_on_attendee = empty( $registrations_on_attendee ) && $data->reg_obj instanceof EE_Registration ? array( $data->reg_obj ) : $registrations_on_attendee; |
|
84 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration ? array($data->reg_obj) : $registrations_on_attendee; |
|
85 | 85 | $tkts = array(); |
86 | 86 | |
87 | 87 | //if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
88 | 88 | //which means we want to get tickets for all events this addressee is a part of. |
89 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
90 | - $valid_shortcodes = array('ticket', 'event_list', 'attendee_list','datetime_list', 'registration_details', 'attendee', 'recipient_details'); |
|
89 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
90 | + $valid_shortcodes = array('ticket', 'event_list', 'attendee_list', 'datetime_list', 'registration_details', 'attendee', 'recipient_details'); |
|
91 | 91 | $template = $this->_data['template']; |
92 | 92 | |
93 | 93 | //tickets will be tickets for all registrations on this attendee. |
94 | - foreach ( $registrations_on_attendee as $reg ) { |
|
95 | - if ( $reg instanceof EE_Registration ) { |
|
96 | - $ticket = isset( $data->registrations[$reg->ID()] ) && is_array( $data->registrations[$reg->ID()] ) && isset( $data->registrations[$reg->ID()]['tkt_obj'] ) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
97 | - if ( $ticket instanceof EE_Ticket ) { |
|
94 | + foreach ($registrations_on_attendee as $reg) { |
|
95 | + if ($reg instanceof EE_Registration) { |
|
96 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array($data->registrations[$reg->ID()]) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
97 | + if ($ticket instanceof EE_Ticket) { |
|
98 | 98 | $tkts[$ticket->ID()] = $ticket; |
99 | 99 | } |
100 | 100 | } |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | |
104 | 104 | //if coming from the context of the event list parser, then let's return just the tickets for that event. |
105 | 105 | $event = $this->_data['data']; |
106 | - if ( $event instanceof EE_Event ) { |
|
106 | + if ($event instanceof EE_Event) { |
|
107 | 107 | $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
108 | - $template = is_array($this->_data['template'] ) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
108 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
109 | 109 | //let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
110 | 110 | $template = str_replace('[EVENT_LIST]', '', $template); |
111 | 111 | //data will be tickets for this event for this recipient. |
112 | - foreach ( $registrations_on_attendee as $reg ) { |
|
113 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) { |
|
114 | - $ticket = isset( $data->registrations[$reg->ID()] ) && is_array( $data->registrations[$reg->ID()] ) && isset( $data->registrations[$reg->ID()]['tkt_obj'] ) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
115 | - if ( $ticket instanceof EE_Ticket ) { |
|
112 | + foreach ($registrations_on_attendee as $reg) { |
|
113 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
114 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array($data->registrations[$reg->ID()]) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
115 | + if ($ticket instanceof EE_Ticket) { |
|
116 | 116 | $tkts[$ticket->ID()] = $ticket; |
117 | 117 | } |
118 | 118 | } |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | $tkt_parsed = ''; |
123 | - foreach ( $tkts as $ticket ) { |
|
124 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( $template, $ticket, $valid_shortcodes, $this->_extra_data ); |
|
123 | + foreach ($tkts as $ticket) { |
|
124 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template($template, $ticket, $valid_shortcodes, $this->_extra_data); |
|
125 | 125 | } |
126 | 126 | return $tkt_parsed; |
127 | 127 | } |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | $this->_validate_list_requirements(); |
138 | 138 | $this->_set_shortcode_helper(); |
139 | 139 | |
140 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
141 | - return $this->_get_recipient_datetime_list_parsed( $this->_data['data'] ); |
|
140 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) |
|
141 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
142 | 142 | |
143 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
144 | - return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'] ); |
|
143 | + else if ($this->_extra_data['data'] instanceof EE_Messages_Addressee) |
|
144 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
145 | 145 | |
146 | 146 | else |
147 | 147 | return ''; |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | |
152 | - private function _get_recipient_datetime_list_parsed( EE_Messages_Addressee $data ) { |
|
152 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) { |
|
153 | 153 | //first get registrations just for this attendee. |
154 | 154 | $att = $data->att_obj; |
155 | 155 | $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : null; |
156 | - $registrations_on_attendee = empty( $registrations_on_attendee ) && $data->reg_obj instanceof EE_Registration ? array( $data->reg_obj ) : array(); |
|
157 | - $valid_shortcodes = array( 'datetime', 'attendee', 'recipient_details' ); |
|
156 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration ? array($data->reg_obj) : array(); |
|
157 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
158 | 158 | $template = ''; |
159 | 159 | $dtts = array(); |
160 | 160 | |
161 | 161 | //setup valid shortcodes depending on what the status of the $this->_data property is |
162 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
162 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
163 | 163 | $template = $this->_data['template']; |
164 | 164 | |
165 | 165 | //dtts will be datetimes for all registrations on this attendee |
166 | - foreach ( $registrations_on_attendee as $reg ) { |
|
167 | - if ( $reg instanceof EE_Registration ) { |
|
168 | - $dtt_objs = isset( $data->registrations[$reg->ID()] ) && is_array( $data->registrations[$reg->ID()] ) && isset( $data->registrations[$reg->ID()]['dtt_objs'] ) ? $data->registrations[$reg->ID()]['dtt_objs'] : array(); |
|
166 | + foreach ($registrations_on_attendee as $reg) { |
|
167 | + if ($reg instanceof EE_Registration) { |
|
168 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array($data->registrations[$reg->ID()]) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID()]['dtt_objs'] : array(); |
|
169 | 169 | $dtt_objs = (array) $dtt_objs; |
170 | - foreach ( $dtt_objs as $dtt_obj ) { |
|
171 | - if ( $dtt_obj instanceof EE_Datetime ) { |
|
170 | + foreach ($dtt_objs as $dtt_obj) { |
|
171 | + if ($dtt_obj instanceof EE_Datetime) { |
|
172 | 172 | $dtts[$dtt_obj->ID()] = $dtt_obj; |
173 | 173 | } |
174 | 174 | } |
@@ -178,18 +178,18 @@ discard block |
||
178 | 178 | |
179 | 179 | //if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
180 | 180 | $event = $this->_data['data']; |
181 | - if ( $event instanceof EE_Event ) { |
|
182 | - $template = is_array( $this->_data['template'] ) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
181 | + if ($event instanceof EE_Event) { |
|
182 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
183 | 183 | |
184 | 184 | //data will be datetimes for this event for this recipient |
185 | - foreach ( $registrations_on_attendee as $reg ) { |
|
186 | - if ( $reg instanceof EE_Registration && $reg->event_ID() == $event->ID() ) { |
|
187 | - $ticket = isset( $data->registrations[$reg->ID()] ) && is_array( $data->registrations[$reg->ID()] ) && isset( $data->registrations[$reg->ID()]['tkt_obj'] ) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
188 | - if ( $ticket instanceof EE_Ticket ) { |
|
189 | - $dtt_objs = isset( $data->tickets[$ticket->ID()] ) && is_array( $data->tickets[$ticket->ID()] ) && isset( $data->tickets[$ticket->ID()]['dtt_objs'] ) ? $data->tickets[$ticket->ID()]['dtt_objs'] : array(); |
|
185 | + foreach ($registrations_on_attendee as $reg) { |
|
186 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
187 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array($data->registrations[$reg->ID()]) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID()]['tkt_obj'] : null; |
|
188 | + if ($ticket instanceof EE_Ticket) { |
|
189 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array($data->tickets[$ticket->ID()]) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID()]['dtt_objs'] : array(); |
|
190 | 190 | $dtt_objs = (array) $dtt_objs; |
191 | - foreach ( $dtt_objs as $dtt_obj ) { |
|
192 | - if ( $dtt_obj instanceof EE_Datetime ) { |
|
191 | + foreach ($dtt_objs as $dtt_obj) { |
|
192 | + if ($dtt_obj instanceof EE_Datetime) { |
|
193 | 193 | $dtts[$dtt_obj->ID()] = $dtt_obj; |
194 | 194 | } |
195 | 195 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | $dtt_parsed = ''; |
202 | - foreach ( $dtts as $datetime ) { |
|
203 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( $template, $datetime, $valid_shortcodes, $this->_extra_data ); |
|
202 | + foreach ($dtts as $datetime) { |
|
203 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template($template, $datetime, $valid_shortcodes, $this->_extra_data); |
|
204 | 204 | } |
205 | 205 | return $dtt_parsed; |
206 | 206 | } |
@@ -137,14 +137,13 @@ |
||
137 | 137 | $this->_validate_list_requirements(); |
138 | 138 | $this->_set_shortcode_helper(); |
139 | 139 | |
140 | - if ( $this->_data['data'] instanceof EE_Messages_Addressee ) |
|
141 | - return $this->_get_recipient_datetime_list_parsed( $this->_data['data'] ); |
|
142 | - |
|
143 | - else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) |
|
144 | - return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'] ); |
|
145 | - |
|
146 | - else |
|
147 | - return ''; |
|
140 | + if ( $this->_data['data'] instanceof EE_Messages_Addressee ) { |
|
141 | + return $this->_get_recipient_datetime_list_parsed( $this->_data['data'] ); |
|
142 | + } else if ( $this->_extra_data['data'] instanceof EE_Messages_Addressee ) { |
|
143 | + return $this->_get_recipient_datetime_list_parsed( $this->_extra_data['data'] ); |
|
144 | + } else { |
|
145 | + return ''; |
|
146 | + } |
|
148 | 147 | |
149 | 148 | } |
150 | 149 |
@@ -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 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function _set_shortcode_helper() { |
159 | 159 | //shortcode helper |
160 | - EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ); |
|
160 | + EE_Registry::instance()->load_helper('Parse_Shortcodes'); |
|
161 | 161 | //get shortcode_replace instance- set when _get_messages is called in child... |
162 | 162 | $this->_shortcode_helper = new EEH_Parse_Shortcodes(); |
163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | |
167 | 167 | public function get_shortcode_helper() { |
168 | - if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes ) |
|
168 | + if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) |
|
169 | 169 | $this->_set_shortcode_helper(); |
170 | 170 | return $this->_shortcode_helper; |
171 | 171 | } |
@@ -178,25 +178,25 @@ discard block |
||
178 | 178 | * @param mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee) |
179 | 179 | * @return string parsed shortcode. |
180 | 180 | */ |
181 | - public function parser($shortcode, $data, $extra_data = array() ) { |
|
181 | + public function parser($shortcode, $data, $extra_data = array()) { |
|
182 | 182 | |
183 | 183 | //filter setup shortcodes |
184 | 184 | $this->_shortcodes = $this->get_shortcodes(); |
185 | 185 | |
186 | 186 | //we need to setup any dynamic shortcodes so that they work with the array_key_exists |
187 | - $sc = preg_match_all( '/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches ); |
|
188 | - $sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode; |
|
187 | + $sc = preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches); |
|
188 | + $sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode; |
|
189 | 189 | |
190 | 190 | //first we want to make sure this is a valid shortcode |
191 | - if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) |
|
191 | + if ( ! array_key_exists($sc_to_verify, $this->_shortcodes)) |
|
192 | 192 | return false; //get out, this parser doesn't handle the incoming shortcode. |
193 | 193 | $this->_data = $data; |
194 | 194 | $this->_extra_data = $extra_data; |
195 | 195 | $this->_set_messages_properties(); |
196 | - $parsed = apply_filters( 'FHEE__' . get_class($this) . '__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this ); |
|
196 | + $parsed = apply_filters('FHEE__'.get_class($this).'__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this); |
|
197 | 197 | |
198 | 198 | //note the below filter applies to ALL shortcode parsers... be careful! |
199 | - $parsed = apply_filters( 'FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this ); |
|
199 | + $parsed = apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this); |
|
200 | 200 | return $parsed; |
201 | 201 | } |
202 | 202 | |
@@ -212,10 +212,10 @@ discard block |
||
212 | 212 | * @return array array of shortcodes => description pairs |
213 | 213 | */ |
214 | 214 | public function get_shortcodes() { |
215 | - $this->_shortcodes = apply_filters( 'FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this ); |
|
215 | + $this->_shortcodes = apply_filters('FHEE__'.get_class($this).'__shortcodes', $this->_shortcodes, $this); |
|
216 | 216 | |
217 | 217 | //note the below filter applies to ALL shortcode parsers... be careful! |
218 | - $this->_shortcodes = apply_filters( 'FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this ); |
|
218 | + $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this); |
|
219 | 219 | |
220 | 220 | return $this->_shortcodes; |
221 | 221 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @param mixed (object|array) $data incoming data for the parser. The data could be either an object or array because there are some shortcodes that might be replaced by prepared data that has multiple items in a list (i.e. list of attendees in an event and we're showing fname/lname for each attendee). In this case data will be in an array. Otherwise the data shoudl be in a properly formatted object. The EEH_Parse_Shortcodes.helper.php describes the data object we're expecting. |
246 | 246 | * @return string parsed shortcode |
247 | 247 | */ |
248 | - abstract protected function _parser( $shortcode ); |
|
248 | + abstract protected function _parser($shortcode); |
|
249 | 249 | |
250 | 250 | |
251 | 251 | |
@@ -257,22 +257,22 @@ discard block |
||
257 | 257 | protected function _validate_list_requirements() { |
258 | 258 | |
259 | 259 | //first test to make sure we've got an array! |
260 | - if ( !is_array($this->_data) ) { |
|
261 | - throw new EE_Error( sprintf( __('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype( $this->_data ) ) ); |
|
260 | + if ( ! is_array($this->_data)) { |
|
261 | + throw new EE_Error(sprintf(__('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype($this->_data))); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | //next test to make sure we've got the required template in the index! |
265 | - if ( !isset( $this->_data['template'] ) ) { |
|
266 | - throw new EE_Error( sprintf( __('The incoming data does not have the required template index in its array', 'event_espresso') ) ); |
|
265 | + if ( ! isset($this->_data['template'])) { |
|
266 | + throw new EE_Error(sprintf(__('The incoming data does not have the required template index in its array', 'event_espresso'))); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | //next test to make sure we've got got a data index in the incoming data array |
270 | - if ( !isset( $this->_data['data'] ) ) |
|
271 | - throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
270 | + if ( ! isset($this->_data['data'])) |
|
271 | + throw new EE_Error(__('The incoming data does not have the required data index in its array', 'event_espresso')); |
|
272 | 272 | |
273 | 273 | //all is well let's make sure _extra_data always has the values needed. |
274 | 274 | //let's make sure that extra_data includes all templates (for later parsing if necessary) |
275 | - if ( empty( $this->_extra_data ) || ( empty( $this->_extra_data['data'] ) && empty( $this->_extra_data['template'] ) ) ) { |
|
275 | + if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) { |
|
276 | 276 | $this->_extra_data['data'] = $this->_data['data']; |
277 | 277 | $this->_extra_data['template'] = $this->_data['template']; |
278 | 278 | } |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * |
290 | 290 | * @return array An array with the attributes |
291 | 291 | */ |
292 | - protected function _get_shortcode_attrs( $shortcode ) { |
|
292 | + protected function _get_shortcode_attrs($shortcode) { |
|
293 | 293 | //make sure the required wp helper function is present |
294 | 294 | //require the shortcode file if necessary |
295 | - if ( ! function_exists( 'shortcode_parse_atts' ) ) { |
|
296 | - require_once( ABSPATH . WPINC . '/shortcodes.php'); |
|
295 | + if ( ! function_exists('shortcode_parse_atts')) { |
|
296 | + require_once(ABSPATH.WPINC.'/shortcodes.php'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | //let's get any attributes that may be present and set the defaults. |
300 | - $shortcode_to_parse = str_replace( '[', '', str_replace( ']', '', $shortcode ) ); |
|
301 | - return shortcode_parse_atts( $shortcode_to_parse ); |
|
300 | + $shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode)); |
|
301 | + return shortcode_parse_atts($shortcode_to_parse); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | */ |
314 | 314 | protected function _set_messages_properties() { |
315 | 315 | //should be in _extra_data |
316 | - if ( isset( $this->_extra_data['messenger'] ) ) { |
|
316 | + if (isset($this->_extra_data['messenger'])) { |
|
317 | 317 | $this->_messenger = $this->_extra_data['messenger']; |
318 | 318 | $this->_message_type = $this->_extra_data['message_type']; |
319 | 319 | $this->_context = $this->_extra_data['context']; |
@@ -1,7 +1,8 @@ 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 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -165,8 +166,9 @@ discard block |
||
165 | 166 | |
166 | 167 | |
167 | 168 | public function get_shortcode_helper() { |
168 | - if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes ) |
|
169 | - $this->_set_shortcode_helper(); |
|
169 | + if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes ) { |
|
170 | + $this->_set_shortcode_helper(); |
|
171 | + } |
|
170 | 172 | return $this->_shortcode_helper; |
171 | 173 | } |
172 | 174 | |
@@ -188,8 +190,10 @@ discard block |
||
188 | 190 | $sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode; |
189 | 191 | |
190 | 192 | //first we want to make sure this is a valid shortcode |
191 | - if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) |
|
192 | - return false; //get out, this parser doesn't handle the incoming shortcode. |
|
193 | + if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) { |
|
194 | + return false; |
|
195 | + } |
|
196 | + //get out, this parser doesn't handle the incoming shortcode. |
|
193 | 197 | $this->_data = $data; |
194 | 198 | $this->_extra_data = $extra_data; |
195 | 199 | $this->_set_messages_properties(); |
@@ -267,8 +271,9 @@ discard block |
||
267 | 271 | } |
268 | 272 | |
269 | 273 | //next test to make sure we've got got a data index in the incoming data array |
270 | - if ( !isset( $this->_data['data'] ) ) |
|
271 | - throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
274 | + if ( !isset( $this->_data['data'] ) ) { |
|
275 | + throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
276 | + } |
|
272 | 277 | |
273 | 278 | //all is well let's make sure _extra_data always has the values needed. |
274 | 279 | //let's make sure that extra_data includes all templates (for later parsing if necessary) |