@@ -17,315 +17,315 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * Will hold the EE_Event if available |
|
22 | - * |
|
23 | - * @var EE_Event |
|
24 | - */ |
|
25 | - protected $_event; |
|
26 | - |
|
27 | - /** |
|
28 | - * Will hold the EE_Venue if available |
|
29 | - * |
|
30 | - * @var EE_Venue |
|
31 | - */ |
|
32 | - protected $_venue; |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * Initialize properties |
|
37 | - */ |
|
38 | - protected function _init_props() |
|
39 | - { |
|
40 | - $this->label = esc_html__('Venue Shortcodes', 'event_espresso'); |
|
41 | - $this->description = esc_html__('All shortcodes specific to venue related data', 'event_espresso'); |
|
42 | - $this->_shortcodes = array( |
|
43 | - '[VENUE_TITLE]' => esc_html__('The title for the event venue', 'event_espresso'), |
|
44 | - '[VENUE_DESCRIPTION]' => esc_html__('The description for the event venue', 'event_espresso'), |
|
45 | - '[VENUE_URL]' => esc_html__('A url to a webpage for the venue', 'event_espresso'), |
|
46 | - '[VENUE_DETAILS_URL]' => sprintf( |
|
47 | - esc_html__( |
|
48 | - 'This shortcode outputs the url or website address to the venue details page on this website. This differs from %s which outputs what is entered in the "url" field in the venue details page.', |
|
49 | - 'event_espresso' |
|
50 | - ), |
|
51 | - '[VENUE_URL]' |
|
52 | - ), |
|
53 | - '[VENUE_IMAGE]' => esc_html__('An image representing the event venue', 'event_espresso'), |
|
54 | - '[VENUE_PHONE]' => esc_html__('The phone number for the venue', 'event_espresso'), |
|
55 | - '[VENUE_ADDRESS]' => esc_html__('The address for the venue', 'event_espresso'), |
|
56 | - '[VENUE_ADDRESS2]' => esc_html__('Address 2 for the venue', 'event_espresso'), |
|
57 | - '[VENUE_CITY]' => esc_html__('The city the venue is in', 'event_espresso'), |
|
58 | - '[VENUE_STATE]' => esc_html__('The state the venue is located in', 'event_espresso'), |
|
59 | - '[VENUE_COUNTRY]' => esc_html__('The country the venue is located in', 'event_espresso'), |
|
60 | - '[VENUE_FORMATTED_ADDRESS]' => esc_html__( |
|
61 | - 'This just outputs the venue address in a semantic address format.', |
|
62 | - 'event_espresso' |
|
63 | - ), |
|
64 | - '[VENUE_ZIP]' => esc_html__('The zip code for the venue address', 'event_espresso'), |
|
65 | - '[VENUE_META_*]' => esc_html__( |
|
66 | - 'This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the venue then it will be output in place of this shortcode.', |
|
67 | - 'event_espresso' |
|
68 | - ), |
|
69 | - '[GOOGLE_MAP_URL]' => esc_html__( |
|
70 | - 'URL for the google map associated with the venue.', |
|
71 | - 'event_espresso' |
|
72 | - ), |
|
73 | - '[GOOGLE_MAP_LINK]' => esc_html__('Link to a google map for the venue', 'event_espresso'), |
|
74 | - '[GOOGLE_MAP_IMAGE]' => esc_html__('Google map for venue wrapped in image tags', 'event_espresso'), |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * Parse incoming shortcode |
|
81 | - * |
|
82 | - * @param string $shortcode |
|
83 | - * @return string |
|
84 | - * @throws EE_Error |
|
85 | - * @throws EntityNotFoundException |
|
86 | - */ |
|
87 | - protected function _parser($shortcode) |
|
88 | - { |
|
89 | - $this->_venue = $this->_get_venue(); |
|
90 | - // If there is no venue object by now then get out. |
|
91 | - if (! $this->_venue instanceof EE_Venue) { |
|
92 | - return ''; |
|
93 | - } |
|
94 | - |
|
95 | - switch ($shortcode) { |
|
96 | - case '[VENUE_TITLE]': |
|
97 | - return $this->_venue('title'); |
|
98 | - break; |
|
99 | - |
|
100 | - case '[VENUE_DESCRIPTION]': |
|
101 | - return $this->_venue('description'); |
|
102 | - break; |
|
103 | - |
|
104 | - case '[VENUE_URL]': |
|
105 | - return $this->_venue('url'); |
|
106 | - break; |
|
107 | - |
|
108 | - case '[VENUE_IMAGE]': |
|
109 | - return $this->_venue('image'); |
|
110 | - break; |
|
111 | - |
|
112 | - case '[VENUE_PHONE]': |
|
113 | - return $this->_venue('phone'); |
|
114 | - break; |
|
115 | - |
|
116 | - case '[VENUE_ADDRESS]': |
|
117 | - return $this->_venue('address'); |
|
118 | - break; |
|
119 | - |
|
120 | - case '[VENUE_ADDRESS2]': |
|
121 | - return $this->_venue('address2'); |
|
122 | - break; |
|
123 | - |
|
124 | - case '[VENUE_CITY]': |
|
125 | - return $this->_venue('city'); |
|
126 | - break; |
|
127 | - |
|
128 | - case '[VENUE_COUNTRY]': |
|
129 | - return $this->_venue('country'); |
|
130 | - break; |
|
131 | - |
|
132 | - case '[VENUE_STATE]': |
|
133 | - return $this->_venue('state'); |
|
134 | - break; |
|
135 | - |
|
136 | - case '[VENUE_ZIP]': |
|
137 | - return $this->_venue('zip'); |
|
138 | - break; |
|
139 | - |
|
140 | - case '[VENUE_FORMATTED_ADDRESS]': |
|
141 | - return $this->_venue('formatted_address'); |
|
142 | - break; |
|
143 | - |
|
144 | - case '[GOOGLE_MAP_URL]': |
|
145 | - return $this->_venue('gmap_url'); |
|
146 | - break; |
|
147 | - |
|
148 | - case '[GOOGLE_MAP_LINK]': |
|
149 | - return $this->_venue('gmap_link'); |
|
150 | - break; |
|
151 | - |
|
152 | - case '[GOOGLE_MAP_IMAGE]': |
|
153 | - return $this->_venue('gmap_link_img'); |
|
154 | - break; |
|
155 | - |
|
156 | - case '[VENUE_DETAILS_URL]': |
|
157 | - return $this->_venue('permalink'); |
|
158 | - break; |
|
159 | - } |
|
160 | - |
|
161 | - if (strpos($shortcode, '[VENUE_META_*') !== false) { |
|
162 | - $shortcode = str_replace('[VENUE_META_*', '', $shortcode); |
|
163 | - $shortcode = trim(str_replace(']', '', $shortcode)); |
|
164 | - |
|
165 | - // pull the meta value from the venue post |
|
166 | - $venue_meta = $this->_venue->get_post_meta($shortcode, true); |
|
167 | - |
|
168 | - return ! empty($venue_meta) ? $venue_meta : ''; |
|
169 | - } |
|
170 | - } |
|
171 | - |
|
172 | - /** |
|
173 | - * This retrieves the EE_Venue from the available data object. |
|
174 | - * |
|
175 | - * @return EE_Venue|null |
|
176 | - * @throws EE_Error |
|
177 | - * @throws EntityNotFoundException |
|
178 | - */ |
|
179 | - private function _get_venue() |
|
180 | - { |
|
181 | - |
|
182 | - // we need the EE_Event object to get the venue. |
|
183 | - $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
|
184 | - |
|
185 | - // if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the |
|
186 | - // reg_obj instead. |
|
187 | - if (! $this->_event instanceof EE_Event) { |
|
188 | - $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
189 | - $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
|
190 | - |
|
191 | - $this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration |
|
192 | - ? $aee->reg_obj->event() |
|
193 | - : null; |
|
194 | - |
|
195 | - // if still empty do we have a ticket data item? |
|
196 | - $this->_event = ! $this->_event instanceof EE_Event |
|
197 | - && $this->_data instanceof EE_Ticket |
|
198 | - && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
199 | - ? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event'] |
|
200 | - : $this->_event; |
|
201 | - |
|
202 | - // if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee |
|
203 | - // and use that. |
|
204 | - $this->_event = ! $this->_event instanceof EE_Event && $aee instanceof EE_Messages_Addressee |
|
205 | - ? reset($aee->events) |
|
206 | - : $this->_event; |
|
207 | - } |
|
208 | - |
|
209 | - // If we have an event object use it to pull the venue. |
|
210 | - if ($this->_event instanceof EE_Event) { |
|
211 | - return $this->_event->get_first_related('Venue'); |
|
212 | - } |
|
213 | - |
|
214 | - return null; |
|
215 | - } |
|
216 | - |
|
217 | - /** |
|
218 | - * This retrieves the specified venue information |
|
219 | - * |
|
220 | - * @param string $field What Venue field to retrieve |
|
221 | - * @return string What was retrieved! |
|
222 | - * @throws EE_Error |
|
223 | - * @throws EntityNotFoundException |
|
224 | - */ |
|
225 | - private function _venue($field) |
|
226 | - { |
|
227 | - |
|
228 | - if (! $this->_venue instanceof EE_Venue) { |
|
229 | - return ''; |
|
230 | - } //no venue so get out. |
|
231 | - |
|
232 | - switch ($field) { |
|
233 | - case 'title': |
|
234 | - return $this->_venue->get('VNU_name'); |
|
235 | - break; |
|
236 | - |
|
237 | - case 'description': |
|
238 | - return $this->_venue->get('VNU_desc'); |
|
239 | - break; |
|
240 | - |
|
241 | - case 'url': |
|
242 | - $url = $this->_venue->get('VNU_url'); |
|
243 | - return empty($url) ? $this->_venue->get_permalink() : $url; |
|
244 | - break; |
|
245 | - |
|
246 | - case 'permalink': |
|
247 | - return $this->_venue->get_permalink(); |
|
248 | - break; |
|
249 | - |
|
250 | - case 'image': |
|
251 | - return '<img src="' . $this->_venue->feature_image_url(array(200, 200,)) |
|
252 | - . '" alt="' . sprintf( |
|
253 | - esc_attr__('%s Feature Image', 'event_espresso'), |
|
254 | - $this->_venue->get('VNU_name') |
|
255 | - ) . '" />'; |
|
256 | - break; |
|
257 | - |
|
258 | - case 'phone': |
|
259 | - return $this->_venue->get('VNU_phone'); |
|
260 | - break; |
|
261 | - |
|
262 | - case 'address': |
|
263 | - return $this->_venue->get('VNU_address'); |
|
264 | - break; |
|
265 | - |
|
266 | - case 'address2': |
|
267 | - return $this->_venue->get('VNU_address2'); |
|
268 | - break; |
|
269 | - |
|
270 | - case 'city': |
|
271 | - return $this->_venue->get('VNU_city'); |
|
272 | - break; |
|
273 | - |
|
274 | - case 'state': |
|
275 | - $state = $this->_venue->state_obj(); |
|
276 | - return is_object($state) ? $state->get('STA_name') : ''; |
|
277 | - break; |
|
278 | - |
|
279 | - case 'country': |
|
280 | - $country = $this->_venue->country_obj(); |
|
281 | - return is_object($country) ? $country->get('CNT_name') : ''; |
|
282 | - break; |
|
283 | - |
|
284 | - case 'zip': |
|
285 | - return $this->_venue->get('VNU_zip'); |
|
286 | - break; |
|
287 | - |
|
288 | - case 'formatted_address': |
|
289 | - return EEH_Address::format($this->_venue); |
|
290 | - break; |
|
291 | - |
|
292 | - case 'gmap_link': |
|
293 | - case 'gmap_url': |
|
294 | - case 'gmap_link_img': |
|
295 | - $atts = $this->get_map_attributes($this->_venue, $field); |
|
296 | - return EEH_Maps::google_map_link($atts); |
|
297 | - break; |
|
298 | - } |
|
299 | - return ''; |
|
300 | - } |
|
301 | - |
|
302 | - |
|
303 | - /** |
|
304 | - * Generates the attributes for retrieving a google_map artifact. |
|
305 | - * |
|
306 | - * @param EE_Venue $venue |
|
307 | - * @param string $field |
|
308 | - * @return array |
|
309 | - * @throws EE_Error |
|
310 | - */ |
|
311 | - protected function get_map_attributes(EE_Venue $venue, $field = 'gmap_link') |
|
312 | - { |
|
313 | - $state = $venue->state_obj(); |
|
314 | - $country = $venue->country_obj(); |
|
315 | - $atts = array( |
|
316 | - 'id' => $venue->ID(), |
|
317 | - 'address' => $venue->get('VNU_address'), |
|
318 | - 'city' => $venue->get('VNU_city'), |
|
319 | - 'state' => is_object($state) ? $state->get('STA_name') : '', |
|
320 | - 'zip' => $venue->get('VNU_zip'), |
|
321 | - 'country' => is_object($country) ? $country->get('CNT_name') : '', |
|
322 | - 'type' => $field === 'gmap_link' ? 'url' : 'map', |
|
323 | - 'map_w' => 200, |
|
324 | - 'map_h' => 200, |
|
325 | - ); |
|
326 | - if ($field === 'gmap_url') { |
|
327 | - $atts['type'] = 'url_only'; |
|
328 | - } |
|
329 | - return $atts; |
|
330 | - } |
|
20 | + /** |
|
21 | + * Will hold the EE_Event if available |
|
22 | + * |
|
23 | + * @var EE_Event |
|
24 | + */ |
|
25 | + protected $_event; |
|
26 | + |
|
27 | + /** |
|
28 | + * Will hold the EE_Venue if available |
|
29 | + * |
|
30 | + * @var EE_Venue |
|
31 | + */ |
|
32 | + protected $_venue; |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * Initialize properties |
|
37 | + */ |
|
38 | + protected function _init_props() |
|
39 | + { |
|
40 | + $this->label = esc_html__('Venue Shortcodes', 'event_espresso'); |
|
41 | + $this->description = esc_html__('All shortcodes specific to venue related data', 'event_espresso'); |
|
42 | + $this->_shortcodes = array( |
|
43 | + '[VENUE_TITLE]' => esc_html__('The title for the event venue', 'event_espresso'), |
|
44 | + '[VENUE_DESCRIPTION]' => esc_html__('The description for the event venue', 'event_espresso'), |
|
45 | + '[VENUE_URL]' => esc_html__('A url to a webpage for the venue', 'event_espresso'), |
|
46 | + '[VENUE_DETAILS_URL]' => sprintf( |
|
47 | + esc_html__( |
|
48 | + 'This shortcode outputs the url or website address to the venue details page on this website. This differs from %s which outputs what is entered in the "url" field in the venue details page.', |
|
49 | + 'event_espresso' |
|
50 | + ), |
|
51 | + '[VENUE_URL]' |
|
52 | + ), |
|
53 | + '[VENUE_IMAGE]' => esc_html__('An image representing the event venue', 'event_espresso'), |
|
54 | + '[VENUE_PHONE]' => esc_html__('The phone number for the venue', 'event_espresso'), |
|
55 | + '[VENUE_ADDRESS]' => esc_html__('The address for the venue', 'event_espresso'), |
|
56 | + '[VENUE_ADDRESS2]' => esc_html__('Address 2 for the venue', 'event_espresso'), |
|
57 | + '[VENUE_CITY]' => esc_html__('The city the venue is in', 'event_espresso'), |
|
58 | + '[VENUE_STATE]' => esc_html__('The state the venue is located in', 'event_espresso'), |
|
59 | + '[VENUE_COUNTRY]' => esc_html__('The country the venue is located in', 'event_espresso'), |
|
60 | + '[VENUE_FORMATTED_ADDRESS]' => esc_html__( |
|
61 | + 'This just outputs the venue address in a semantic address format.', |
|
62 | + 'event_espresso' |
|
63 | + ), |
|
64 | + '[VENUE_ZIP]' => esc_html__('The zip code for the venue address', 'event_espresso'), |
|
65 | + '[VENUE_META_*]' => esc_html__( |
|
66 | + 'This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the venue then it will be output in place of this shortcode.', |
|
67 | + 'event_espresso' |
|
68 | + ), |
|
69 | + '[GOOGLE_MAP_URL]' => esc_html__( |
|
70 | + 'URL for the google map associated with the venue.', |
|
71 | + 'event_espresso' |
|
72 | + ), |
|
73 | + '[GOOGLE_MAP_LINK]' => esc_html__('Link to a google map for the venue', 'event_espresso'), |
|
74 | + '[GOOGLE_MAP_IMAGE]' => esc_html__('Google map for venue wrapped in image tags', 'event_espresso'), |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * Parse incoming shortcode |
|
81 | + * |
|
82 | + * @param string $shortcode |
|
83 | + * @return string |
|
84 | + * @throws EE_Error |
|
85 | + * @throws EntityNotFoundException |
|
86 | + */ |
|
87 | + protected function _parser($shortcode) |
|
88 | + { |
|
89 | + $this->_venue = $this->_get_venue(); |
|
90 | + // If there is no venue object by now then get out. |
|
91 | + if (! $this->_venue instanceof EE_Venue) { |
|
92 | + return ''; |
|
93 | + } |
|
94 | + |
|
95 | + switch ($shortcode) { |
|
96 | + case '[VENUE_TITLE]': |
|
97 | + return $this->_venue('title'); |
|
98 | + break; |
|
99 | + |
|
100 | + case '[VENUE_DESCRIPTION]': |
|
101 | + return $this->_venue('description'); |
|
102 | + break; |
|
103 | + |
|
104 | + case '[VENUE_URL]': |
|
105 | + return $this->_venue('url'); |
|
106 | + break; |
|
107 | + |
|
108 | + case '[VENUE_IMAGE]': |
|
109 | + return $this->_venue('image'); |
|
110 | + break; |
|
111 | + |
|
112 | + case '[VENUE_PHONE]': |
|
113 | + return $this->_venue('phone'); |
|
114 | + break; |
|
115 | + |
|
116 | + case '[VENUE_ADDRESS]': |
|
117 | + return $this->_venue('address'); |
|
118 | + break; |
|
119 | + |
|
120 | + case '[VENUE_ADDRESS2]': |
|
121 | + return $this->_venue('address2'); |
|
122 | + break; |
|
123 | + |
|
124 | + case '[VENUE_CITY]': |
|
125 | + return $this->_venue('city'); |
|
126 | + break; |
|
127 | + |
|
128 | + case '[VENUE_COUNTRY]': |
|
129 | + return $this->_venue('country'); |
|
130 | + break; |
|
131 | + |
|
132 | + case '[VENUE_STATE]': |
|
133 | + return $this->_venue('state'); |
|
134 | + break; |
|
135 | + |
|
136 | + case '[VENUE_ZIP]': |
|
137 | + return $this->_venue('zip'); |
|
138 | + break; |
|
139 | + |
|
140 | + case '[VENUE_FORMATTED_ADDRESS]': |
|
141 | + return $this->_venue('formatted_address'); |
|
142 | + break; |
|
143 | + |
|
144 | + case '[GOOGLE_MAP_URL]': |
|
145 | + return $this->_venue('gmap_url'); |
|
146 | + break; |
|
147 | + |
|
148 | + case '[GOOGLE_MAP_LINK]': |
|
149 | + return $this->_venue('gmap_link'); |
|
150 | + break; |
|
151 | + |
|
152 | + case '[GOOGLE_MAP_IMAGE]': |
|
153 | + return $this->_venue('gmap_link_img'); |
|
154 | + break; |
|
155 | + |
|
156 | + case '[VENUE_DETAILS_URL]': |
|
157 | + return $this->_venue('permalink'); |
|
158 | + break; |
|
159 | + } |
|
160 | + |
|
161 | + if (strpos($shortcode, '[VENUE_META_*') !== false) { |
|
162 | + $shortcode = str_replace('[VENUE_META_*', '', $shortcode); |
|
163 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
164 | + |
|
165 | + // pull the meta value from the venue post |
|
166 | + $venue_meta = $this->_venue->get_post_meta($shortcode, true); |
|
167 | + |
|
168 | + return ! empty($venue_meta) ? $venue_meta : ''; |
|
169 | + } |
|
170 | + } |
|
171 | + |
|
172 | + /** |
|
173 | + * This retrieves the EE_Venue from the available data object. |
|
174 | + * |
|
175 | + * @return EE_Venue|null |
|
176 | + * @throws EE_Error |
|
177 | + * @throws EntityNotFoundException |
|
178 | + */ |
|
179 | + private function _get_venue() |
|
180 | + { |
|
181 | + |
|
182 | + // we need the EE_Event object to get the venue. |
|
183 | + $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
|
184 | + |
|
185 | + // if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the |
|
186 | + // reg_obj instead. |
|
187 | + if (! $this->_event instanceof EE_Event) { |
|
188 | + $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
189 | + $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
|
190 | + |
|
191 | + $this->_event = $aee instanceof EE_Messages_Addressee && $aee->reg_obj instanceof EE_Registration |
|
192 | + ? $aee->reg_obj->event() |
|
193 | + : null; |
|
194 | + |
|
195 | + // if still empty do we have a ticket data item? |
|
196 | + $this->_event = ! $this->_event instanceof EE_Event |
|
197 | + && $this->_data instanceof EE_Ticket |
|
198 | + && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
199 | + ? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event'] |
|
200 | + : $this->_event; |
|
201 | + |
|
202 | + // if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee |
|
203 | + // and use that. |
|
204 | + $this->_event = ! $this->_event instanceof EE_Event && $aee instanceof EE_Messages_Addressee |
|
205 | + ? reset($aee->events) |
|
206 | + : $this->_event; |
|
207 | + } |
|
208 | + |
|
209 | + // If we have an event object use it to pull the venue. |
|
210 | + if ($this->_event instanceof EE_Event) { |
|
211 | + return $this->_event->get_first_related('Venue'); |
|
212 | + } |
|
213 | + |
|
214 | + return null; |
|
215 | + } |
|
216 | + |
|
217 | + /** |
|
218 | + * This retrieves the specified venue information |
|
219 | + * |
|
220 | + * @param string $field What Venue field to retrieve |
|
221 | + * @return string What was retrieved! |
|
222 | + * @throws EE_Error |
|
223 | + * @throws EntityNotFoundException |
|
224 | + */ |
|
225 | + private function _venue($field) |
|
226 | + { |
|
227 | + |
|
228 | + if (! $this->_venue instanceof EE_Venue) { |
|
229 | + return ''; |
|
230 | + } //no venue so get out. |
|
231 | + |
|
232 | + switch ($field) { |
|
233 | + case 'title': |
|
234 | + return $this->_venue->get('VNU_name'); |
|
235 | + break; |
|
236 | + |
|
237 | + case 'description': |
|
238 | + return $this->_venue->get('VNU_desc'); |
|
239 | + break; |
|
240 | + |
|
241 | + case 'url': |
|
242 | + $url = $this->_venue->get('VNU_url'); |
|
243 | + return empty($url) ? $this->_venue->get_permalink() : $url; |
|
244 | + break; |
|
245 | + |
|
246 | + case 'permalink': |
|
247 | + return $this->_venue->get_permalink(); |
|
248 | + break; |
|
249 | + |
|
250 | + case 'image': |
|
251 | + return '<img src="' . $this->_venue->feature_image_url(array(200, 200,)) |
|
252 | + . '" alt="' . sprintf( |
|
253 | + esc_attr__('%s Feature Image', 'event_espresso'), |
|
254 | + $this->_venue->get('VNU_name') |
|
255 | + ) . '" />'; |
|
256 | + break; |
|
257 | + |
|
258 | + case 'phone': |
|
259 | + return $this->_venue->get('VNU_phone'); |
|
260 | + break; |
|
261 | + |
|
262 | + case 'address': |
|
263 | + return $this->_venue->get('VNU_address'); |
|
264 | + break; |
|
265 | + |
|
266 | + case 'address2': |
|
267 | + return $this->_venue->get('VNU_address2'); |
|
268 | + break; |
|
269 | + |
|
270 | + case 'city': |
|
271 | + return $this->_venue->get('VNU_city'); |
|
272 | + break; |
|
273 | + |
|
274 | + case 'state': |
|
275 | + $state = $this->_venue->state_obj(); |
|
276 | + return is_object($state) ? $state->get('STA_name') : ''; |
|
277 | + break; |
|
278 | + |
|
279 | + case 'country': |
|
280 | + $country = $this->_venue->country_obj(); |
|
281 | + return is_object($country) ? $country->get('CNT_name') : ''; |
|
282 | + break; |
|
283 | + |
|
284 | + case 'zip': |
|
285 | + return $this->_venue->get('VNU_zip'); |
|
286 | + break; |
|
287 | + |
|
288 | + case 'formatted_address': |
|
289 | + return EEH_Address::format($this->_venue); |
|
290 | + break; |
|
291 | + |
|
292 | + case 'gmap_link': |
|
293 | + case 'gmap_url': |
|
294 | + case 'gmap_link_img': |
|
295 | + $atts = $this->get_map_attributes($this->_venue, $field); |
|
296 | + return EEH_Maps::google_map_link($atts); |
|
297 | + break; |
|
298 | + } |
|
299 | + return ''; |
|
300 | + } |
|
301 | + |
|
302 | + |
|
303 | + /** |
|
304 | + * Generates the attributes for retrieving a google_map artifact. |
|
305 | + * |
|
306 | + * @param EE_Venue $venue |
|
307 | + * @param string $field |
|
308 | + * @return array |
|
309 | + * @throws EE_Error |
|
310 | + */ |
|
311 | + protected function get_map_attributes(EE_Venue $venue, $field = 'gmap_link') |
|
312 | + { |
|
313 | + $state = $venue->state_obj(); |
|
314 | + $country = $venue->country_obj(); |
|
315 | + $atts = array( |
|
316 | + 'id' => $venue->ID(), |
|
317 | + 'address' => $venue->get('VNU_address'), |
|
318 | + 'city' => $venue->get('VNU_city'), |
|
319 | + 'state' => is_object($state) ? $state->get('STA_name') : '', |
|
320 | + 'zip' => $venue->get('VNU_zip'), |
|
321 | + 'country' => is_object($country) ? $country->get('CNT_name') : '', |
|
322 | + 'type' => $field === 'gmap_link' ? 'url' : 'map', |
|
323 | + 'map_w' => 200, |
|
324 | + 'map_h' => 200, |
|
325 | + ); |
|
326 | + if ($field === 'gmap_url') { |
|
327 | + $atts['type'] = 'url_only'; |
|
328 | + } |
|
329 | + return $atts; |
|
330 | + } |
|
331 | 331 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | { |
89 | 89 | $this->_venue = $this->_get_venue(); |
90 | 90 | // If there is no venue object by now then get out. |
91 | - if (! $this->_venue instanceof EE_Venue) { |
|
91 | + if ( ! $this->_venue instanceof EE_Venue) { |
|
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | // if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the |
186 | 186 | // reg_obj instead. |
187 | - if (! $this->_event instanceof EE_Event) { |
|
187 | + if ( ! $this->_event instanceof EE_Event) { |
|
188 | 188 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
189 | 189 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
190 | 190 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $this->_event = ! $this->_event instanceof EE_Event |
197 | 197 | && $this->_data instanceof EE_Ticket |
198 | 198 | && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
199 | - ? $this->_extra_data['data']->tickets[ $this->_data->ID() ]['EE_Event'] |
|
199 | + ? $this->_extra_data['data']->tickets[$this->_data->ID()]['EE_Event'] |
|
200 | 200 | : $this->_event; |
201 | 201 | |
202 | 202 | // if STILL empty event, let's try to get the first event in the list of events via EE_Messages_Addressee |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | private function _venue($field) |
226 | 226 | { |
227 | 227 | |
228 | - if (! $this->_venue instanceof EE_Venue) { |
|
228 | + if ( ! $this->_venue instanceof EE_Venue) { |
|
229 | 229 | return ''; |
230 | 230 | } //no venue so get out. |
231 | 231 | |
@@ -248,11 +248,11 @@ discard block |
||
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'image': |
251 | - return '<img src="' . $this->_venue->feature_image_url(array(200, 200,)) |
|
252 | - . '" alt="' . sprintf( |
|
251 | + return '<img src="'.$this->_venue->feature_image_url(array(200, 200,)) |
|
252 | + . '" alt="'.sprintf( |
|
253 | 253 | esc_attr__('%s Feature Image', 'event_espresso'), |
254 | 254 | $this->_venue->get('VNU_name') |
255 | - ) . '" />'; |
|
255 | + ).'" />'; |
|
256 | 256 | break; |
257 | 257 | |
258 | 258 | case 'phone': |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return '<img src="' |
105 | 105 | . EE_Registry::instance()->CFG->organization->get_pretty( |
106 | 106 | 'logo_url' |
107 | - ) . '" id="headerImage" />'; |
|
107 | + ).'" id="headerImage" />'; |
|
108 | 108 | break; |
109 | 109 | |
110 | 110 | case '[CO_LOGO_URL]': |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // set custom attrs if present (or default) |
151 | 151 | $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
152 | - return $prefix . $tax_number; |
|
152 | + return $prefix.$tax_number; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return ''; |
@@ -19,139 +19,139 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _init_props() |
|
29 | - { |
|
30 | - $this->label = esc_html__('Organization Shortcodes', 'event_espresso'); |
|
31 | - $this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso'); |
|
32 | - $this->_shortcodes = array( |
|
33 | - '[COMPANY]' => esc_html__('Event organization name', 'event_espresso'), |
|
34 | - '[CO_ADD1]' => esc_html__('Address 1 value for the organization', 'event_espresso'), |
|
35 | - '[CO_ADD2]' => esc_html__('Address 2 value for the organization', 'event_espresso'), |
|
36 | - '[CO_CITY]' => esc_html__('City the organization is in', 'event_espresso'), |
|
37 | - '[CO_STATE]' => esc_html__('State the organization is located in', 'event_espresso'), |
|
38 | - '[CO_ZIP]' => esc_html__('The zip code for the organization', 'event_espresso'), |
|
39 | - '[CO_LOGO]' => esc_html__('The logo image for the organization', 'event_espresso'), |
|
40 | - '[CO_EMAIL]' => esc_html__('The primary email address for the organization', 'event_espresso'), |
|
41 | - '[CO_PHONE]' => esc_html__('The phone number for the organization', 'event_espresso'), |
|
42 | - '[CO_LOGO_URL]' => esc_html__( |
|
43 | - 'Just the link to the image used as the logo for the organization', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - '[CO_FACEBOOK_URL]' => esc_html__('Link to organization Facebook page', 'event_espresso'), |
|
47 | - '[CO_TWITTER_URL]' => esc_html__('Link to organization Twitter page', 'event_espresso'), |
|
48 | - '[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'), |
|
49 | - '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
|
50 | - '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
|
51 | - '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
|
52 | - '[CO_TAX_NUMBER_*]' => sprintf( |
|
53 | - esc_html__( |
|
54 | - 'This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', |
|
55 | - 'event_espresso' |
|
56 | - ), |
|
57 | - '<strong>', |
|
58 | - '</strong>' |
|
59 | - ), |
|
60 | - ); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _parser($shortcode) |
|
65 | - { |
|
66 | - |
|
67 | - switch ($shortcode) { |
|
68 | - case '[COMPANY]': |
|
69 | - return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
70 | - break; |
|
71 | - |
|
72 | - case '[CO_ADD1]': |
|
73 | - return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
74 | - break; |
|
75 | - |
|
76 | - case '[CO_ADD2]': |
|
77 | - return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
78 | - break; |
|
79 | - |
|
80 | - case '[CO_CITY]': |
|
81 | - return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
82 | - break; |
|
83 | - |
|
84 | - case '[CO_STATE]': |
|
85 | - $state = EE_Registry::instance()->load_model('State')->get_one_by_ID( |
|
86 | - EE_Registry::instance()->CFG->organization->STA_ID |
|
87 | - ); |
|
88 | - return $state instanceof EE_State ? $state->name() : ''; |
|
89 | - break; |
|
90 | - |
|
91 | - case '[CO_ZIP]': |
|
92 | - return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | - break; |
|
94 | - |
|
95 | - case '[CO_EMAIL]': |
|
96 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | - break; |
|
98 | - |
|
99 | - case '[CO_PHONE]': |
|
100 | - return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | - break; |
|
102 | - |
|
103 | - case '[CO_LOGO]': |
|
104 | - return '<img src="' |
|
105 | - . EE_Registry::instance()->CFG->organization->get_pretty( |
|
106 | - 'logo_url' |
|
107 | - ) . '" id="headerImage" />'; |
|
108 | - break; |
|
109 | - |
|
110 | - case '[CO_LOGO_URL]': |
|
111 | - return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
112 | - break; |
|
113 | - |
|
114 | - case '[CO_FACEBOOK_URL]': |
|
115 | - return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
116 | - break; |
|
117 | - |
|
118 | - case '[CO_TWITTER_URL]': |
|
119 | - return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
120 | - break; |
|
121 | - |
|
122 | - case '[CO_PINTEREST_URL]': |
|
123 | - return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
124 | - break; |
|
125 | - |
|
126 | - case '[CO_LINKEDIN_URL]': |
|
127 | - return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
128 | - break; |
|
129 | - |
|
130 | - case '[CO_GOOGLE_URL]': |
|
131 | - return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
132 | - break; |
|
133 | - |
|
134 | - case '[CO_INSTAGRAM_URL]': |
|
135 | - return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
136 | - break; |
|
137 | - } |
|
138 | - |
|
139 | - // also allow for parameter shortcode |
|
140 | - if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) { |
|
141 | - // first see if there is any company tax number set and bail early if not |
|
142 | - $tax_number = EE_Registry::instance()->CFG->organization->vat; |
|
143 | - if (empty($tax_number)) { |
|
144 | - return ''; |
|
145 | - } |
|
146 | - |
|
147 | - // see if there are any attributes. |
|
148 | - $attrs = $this->_get_shortcode_attrs($shortcode); |
|
149 | - |
|
150 | - // set custom attrs if present (or default) |
|
151 | - $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
152 | - return $prefix . $tax_number; |
|
153 | - } |
|
154 | - |
|
155 | - return ''; |
|
156 | - } |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _init_props() |
|
29 | + { |
|
30 | + $this->label = esc_html__('Organization Shortcodes', 'event_espresso'); |
|
31 | + $this->description = esc_html__('All shortcodes specific to organization related data', 'event_espresso'); |
|
32 | + $this->_shortcodes = array( |
|
33 | + '[COMPANY]' => esc_html__('Event organization name', 'event_espresso'), |
|
34 | + '[CO_ADD1]' => esc_html__('Address 1 value for the organization', 'event_espresso'), |
|
35 | + '[CO_ADD2]' => esc_html__('Address 2 value for the organization', 'event_espresso'), |
|
36 | + '[CO_CITY]' => esc_html__('City the organization is in', 'event_espresso'), |
|
37 | + '[CO_STATE]' => esc_html__('State the organization is located in', 'event_espresso'), |
|
38 | + '[CO_ZIP]' => esc_html__('The zip code for the organization', 'event_espresso'), |
|
39 | + '[CO_LOGO]' => esc_html__('The logo image for the organization', 'event_espresso'), |
|
40 | + '[CO_EMAIL]' => esc_html__('The primary email address for the organization', 'event_espresso'), |
|
41 | + '[CO_PHONE]' => esc_html__('The phone number for the organization', 'event_espresso'), |
|
42 | + '[CO_LOGO_URL]' => esc_html__( |
|
43 | + 'Just the link to the image used as the logo for the organization', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + '[CO_FACEBOOK_URL]' => esc_html__('Link to organization Facebook page', 'event_espresso'), |
|
47 | + '[CO_TWITTER_URL]' => esc_html__('Link to organization Twitter page', 'event_espresso'), |
|
48 | + '[CO_PINTEREST_URL]' => esc_html__('Link to organization Pinterest page', 'event_espresso'), |
|
49 | + '[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'), |
|
50 | + '[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'), |
|
51 | + '[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'), |
|
52 | + '[CO_TAX_NUMBER_*]' => sprintf( |
|
53 | + esc_html__( |
|
54 | + 'This is the shortcode used for displaying any tax number for the company. %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is. It defaults to "VAT/Tax Number:". To change this prefix you do the following format for this shortcode: [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56. Also take note that if you have NO number in your settings, the prefix is not output either.', |
|
55 | + 'event_espresso' |
|
56 | + ), |
|
57 | + '<strong>', |
|
58 | + '</strong>' |
|
59 | + ), |
|
60 | + ); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _parser($shortcode) |
|
65 | + { |
|
66 | + |
|
67 | + switch ($shortcode) { |
|
68 | + case '[COMPANY]': |
|
69 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
70 | + break; |
|
71 | + |
|
72 | + case '[CO_ADD1]': |
|
73 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_1'); |
|
74 | + break; |
|
75 | + |
|
76 | + case '[CO_ADD2]': |
|
77 | + return EE_Registry::instance()->CFG->organization->get_pretty('address_2'); |
|
78 | + break; |
|
79 | + |
|
80 | + case '[CO_CITY]': |
|
81 | + return EE_Registry::instance()->CFG->organization->get_pretty('city'); |
|
82 | + break; |
|
83 | + |
|
84 | + case '[CO_STATE]': |
|
85 | + $state = EE_Registry::instance()->load_model('State')->get_one_by_ID( |
|
86 | + EE_Registry::instance()->CFG->organization->STA_ID |
|
87 | + ); |
|
88 | + return $state instanceof EE_State ? $state->name() : ''; |
|
89 | + break; |
|
90 | + |
|
91 | + case '[CO_ZIP]': |
|
92 | + return EE_Registry::instance()->CFG->organization->get_pretty('zip'); |
|
93 | + break; |
|
94 | + |
|
95 | + case '[CO_EMAIL]': |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | + break; |
|
98 | + |
|
99 | + case '[CO_PHONE]': |
|
100 | + return EE_Registry::instance()->CFG->organization->get_pretty('phone'); |
|
101 | + break; |
|
102 | + |
|
103 | + case '[CO_LOGO]': |
|
104 | + return '<img src="' |
|
105 | + . EE_Registry::instance()->CFG->organization->get_pretty( |
|
106 | + 'logo_url' |
|
107 | + ) . '" id="headerImage" />'; |
|
108 | + break; |
|
109 | + |
|
110 | + case '[CO_LOGO_URL]': |
|
111 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
112 | + break; |
|
113 | + |
|
114 | + case '[CO_FACEBOOK_URL]': |
|
115 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
116 | + break; |
|
117 | + |
|
118 | + case '[CO_TWITTER_URL]': |
|
119 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
120 | + break; |
|
121 | + |
|
122 | + case '[CO_PINTEREST_URL]': |
|
123 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
124 | + break; |
|
125 | + |
|
126 | + case '[CO_LINKEDIN_URL]': |
|
127 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
128 | + break; |
|
129 | + |
|
130 | + case '[CO_GOOGLE_URL]': |
|
131 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
132 | + break; |
|
133 | + |
|
134 | + case '[CO_INSTAGRAM_URL]': |
|
135 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
136 | + break; |
|
137 | + } |
|
138 | + |
|
139 | + // also allow for parameter shortcode |
|
140 | + if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== false) { |
|
141 | + // first see if there is any company tax number set and bail early if not |
|
142 | + $tax_number = EE_Registry::instance()->CFG->organization->vat; |
|
143 | + if (empty($tax_number)) { |
|
144 | + return ''; |
|
145 | + } |
|
146 | + |
|
147 | + // see if there are any attributes. |
|
148 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
149 | + |
|
150 | + // set custom attrs if present (or default) |
|
151 | + $prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso'); |
|
152 | + return $prefix . $tax_number; |
|
153 | + } |
|
154 | + |
|
155 | + return ''; |
|
156 | + } |
|
157 | 157 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | protected function _parser($shortcode) |
50 | 50 | { |
51 | 51 | // ensure that the incoming object is an EE_Payment object. If it isn't then bail early. |
52 | - if (! $this->_data instanceof EE_Payment) { |
|
52 | + if ( ! $this->_data instanceof EE_Payment) { |
|
53 | 53 | return ''; |
54 | 54 | } |
55 | 55 |
@@ -18,93 +18,93 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - protected function _init_props() |
|
22 | - { |
|
23 | - $this->label = esc_html__('Payment Shortcodes', 'event_espresso'); |
|
24 | - $this->description = esc_html__('All shortcodes specific to payments.', 'event_espresso'); |
|
25 | - $this->_shortcodes = array( |
|
26 | - '[PAYMENT_TIMESTAMP]' => esc_html__( |
|
27 | - 'Outputs the date of the payment (using the default date format).', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - '[PAYMENT_METHOD]' => esc_html__('Outputs a the payment method.', 'event_espresso'), |
|
31 | - '[PAYMENT_AMOUNT]' => esc_html__('Outputs the payment amount (with currency symbol).', 'event_espresso'), |
|
32 | - '[PAYMENT_GATEWAY]' => esc_html__('Outputs the gateway used for the payment.', 'event_espresso'), |
|
33 | - '[PAYMENT_GATEWAY_RESPONSE]' => esc_html__('Outputs the payment gateway response.', 'event_espresso'), |
|
34 | - '[PAYMENT_GATEWAY_TXN_ID]' => esc_html__( |
|
35 | - 'This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.', |
|
36 | - 'event_espresso' |
|
37 | - ), |
|
38 | - '[PAYMENT_PO_NUMBER]' => esc_html__('Purchase Order number (if present)', 'event_espresso'), |
|
39 | - '[PAYMENT_EXTRA_ACCOUNTING]' => esc_html__( |
|
40 | - 'Any extra accounting messages. Typically added with payments made via the admin.', |
|
41 | - 'event_espresso' |
|
42 | - ), |
|
43 | - '[PAYMENT_STATUS]' => esc_html__('The status of the payment.', 'event_espresso'), |
|
44 | - // '[PAYMENT_STATUS_WITH_ICONS]' => esc_html__('The status of the payment including icons representing the status.', 'event_espresso') |
|
45 | - ); |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - protected function _parser($shortcode) |
|
50 | - { |
|
51 | - // ensure that the incoming object is an EE_Payment object. If it isn't then bail early. |
|
52 | - if (! $this->_data instanceof EE_Payment) { |
|
53 | - return ''; |
|
54 | - } |
|
55 | - |
|
56 | - $payment = $this->_data; |
|
57 | - |
|
58 | - switch ($shortcode) { |
|
59 | - case '[PAYMENT_TIMESTAMP]': |
|
60 | - return $payment->timestamp(); |
|
61 | - break; |
|
62 | - |
|
63 | - case '[PAYMENT_METHOD]': |
|
64 | - // previously the column 'PAY_source' was known as 'PAY_method' |
|
65 | - return $payment->source(); |
|
66 | - break; |
|
67 | - |
|
68 | - case '[PAYMENT_AMOUNT]': |
|
69 | - return $payment->amount_no_code(); |
|
70 | - break; |
|
71 | - |
|
72 | - case '[PAYMENT_GATEWAY]': |
|
73 | - // previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
|
74 | - if ($payment->payment_method() instanceof EE_Payment_Method) { |
|
75 | - return $payment->payment_method()->name(); |
|
76 | - } else { |
|
77 | - return esc_html__('Unknown', 'event_espresso'); |
|
78 | - } |
|
79 | - break; |
|
80 | - |
|
81 | - case '[PAYMENT_GATEWAY_RESPONSE]': |
|
82 | - return $payment->gateway_response(); |
|
83 | - break; |
|
84 | - |
|
85 | - case '[PAYMENT_GATEWAY_TXN_ID]': |
|
86 | - return $payment->txn_id_chq_nmbr(); |
|
87 | - break; |
|
88 | - |
|
89 | - case '[PAYMENT_PO_NUMBER]': |
|
90 | - return $payment->po_number(); |
|
91 | - break; |
|
92 | - |
|
93 | - case '[PAYMENT_EXTRA_ACCOUNTING]': |
|
94 | - return $payment->extra_accntng(); |
|
95 | - break; |
|
96 | - |
|
97 | - case '[PAYMENT_STATUS]': |
|
98 | - return $payment->pretty_status(); |
|
99 | - break; |
|
100 | - |
|
101 | - case '[PAYMENT_STATUS_WITH_ICONS]': |
|
102 | - return $payment->pretty_status(true); |
|
103 | - break; |
|
104 | - |
|
105 | - default: |
|
106 | - return ''; |
|
107 | - break; |
|
108 | - } |
|
109 | - } |
|
21 | + protected function _init_props() |
|
22 | + { |
|
23 | + $this->label = esc_html__('Payment Shortcodes', 'event_espresso'); |
|
24 | + $this->description = esc_html__('All shortcodes specific to payments.', 'event_espresso'); |
|
25 | + $this->_shortcodes = array( |
|
26 | + '[PAYMENT_TIMESTAMP]' => esc_html__( |
|
27 | + 'Outputs the date of the payment (using the default date format).', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + '[PAYMENT_METHOD]' => esc_html__('Outputs a the payment method.', 'event_espresso'), |
|
31 | + '[PAYMENT_AMOUNT]' => esc_html__('Outputs the payment amount (with currency symbol).', 'event_espresso'), |
|
32 | + '[PAYMENT_GATEWAY]' => esc_html__('Outputs the gateway used for the payment.', 'event_espresso'), |
|
33 | + '[PAYMENT_GATEWAY_RESPONSE]' => esc_html__('Outputs the payment gateway response.', 'event_espresso'), |
|
34 | + '[PAYMENT_GATEWAY_TXN_ID]' => esc_html__( |
|
35 | + 'This will either be the gateway transaction ID, or the manual ID added with payment applied via the admin.', |
|
36 | + 'event_espresso' |
|
37 | + ), |
|
38 | + '[PAYMENT_PO_NUMBER]' => esc_html__('Purchase Order number (if present)', 'event_espresso'), |
|
39 | + '[PAYMENT_EXTRA_ACCOUNTING]' => esc_html__( |
|
40 | + 'Any extra accounting messages. Typically added with payments made via the admin.', |
|
41 | + 'event_espresso' |
|
42 | + ), |
|
43 | + '[PAYMENT_STATUS]' => esc_html__('The status of the payment.', 'event_espresso'), |
|
44 | + // '[PAYMENT_STATUS_WITH_ICONS]' => esc_html__('The status of the payment including icons representing the status.', 'event_espresso') |
|
45 | + ); |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + protected function _parser($shortcode) |
|
50 | + { |
|
51 | + // ensure that the incoming object is an EE_Payment object. If it isn't then bail early. |
|
52 | + if (! $this->_data instanceof EE_Payment) { |
|
53 | + return ''; |
|
54 | + } |
|
55 | + |
|
56 | + $payment = $this->_data; |
|
57 | + |
|
58 | + switch ($shortcode) { |
|
59 | + case '[PAYMENT_TIMESTAMP]': |
|
60 | + return $payment->timestamp(); |
|
61 | + break; |
|
62 | + |
|
63 | + case '[PAYMENT_METHOD]': |
|
64 | + // previously the column 'PAY_source' was known as 'PAY_method' |
|
65 | + return $payment->source(); |
|
66 | + break; |
|
67 | + |
|
68 | + case '[PAYMENT_AMOUNT]': |
|
69 | + return $payment->amount_no_code(); |
|
70 | + break; |
|
71 | + |
|
72 | + case '[PAYMENT_GATEWAY]': |
|
73 | + // previously teh column 'PMD_ID' was more-or-less 'PAY_gateway' |
|
74 | + if ($payment->payment_method() instanceof EE_Payment_Method) { |
|
75 | + return $payment->payment_method()->name(); |
|
76 | + } else { |
|
77 | + return esc_html__('Unknown', 'event_espresso'); |
|
78 | + } |
|
79 | + break; |
|
80 | + |
|
81 | + case '[PAYMENT_GATEWAY_RESPONSE]': |
|
82 | + return $payment->gateway_response(); |
|
83 | + break; |
|
84 | + |
|
85 | + case '[PAYMENT_GATEWAY_TXN_ID]': |
|
86 | + return $payment->txn_id_chq_nmbr(); |
|
87 | + break; |
|
88 | + |
|
89 | + case '[PAYMENT_PO_NUMBER]': |
|
90 | + return $payment->po_number(); |
|
91 | + break; |
|
92 | + |
|
93 | + case '[PAYMENT_EXTRA_ACCOUNTING]': |
|
94 | + return $payment->extra_accntng(); |
|
95 | + break; |
|
96 | + |
|
97 | + case '[PAYMENT_STATUS]': |
|
98 | + return $payment->pretty_status(); |
|
99 | + break; |
|
100 | + |
|
101 | + case '[PAYMENT_STATUS_WITH_ICONS]': |
|
102 | + return $payment->pretty_status(true); |
|
103 | + break; |
|
104 | + |
|
105 | + default: |
|
106 | + return ''; |
|
107 | + break; |
|
108 | + } |
|
109 | + } |
|
110 | 110 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | // now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
60 | 60 | $event = $this->_data instanceof EE_Event ? $this->_data : null; |
61 | 61 | |
62 | - if (! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) { |
|
62 | + if ( ! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) { |
|
63 | 63 | return ''; |
64 | 64 | } |
65 | 65 | |
@@ -83,22 +83,22 @@ discard block |
||
83 | 83 | break; |
84 | 84 | |
85 | 85 | case '[EVENT_AUTHOR_FORMATTED_EMAIL]': |
86 | - if (! empty($recipient)) { |
|
86 | + if ( ! empty($recipient)) { |
|
87 | 87 | $email = ! empty($recipient->fname) |
88 | - ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' |
|
88 | + ? $recipient->fname.' '.$recipient->lname.'<'.$recipient->admin_email.'>' |
|
89 | 89 | : EE_Registry::instance()->CFG->organization->get_pretty( |
90 | 90 | 'name' |
91 | - ) . '<' . $recipient->admin_email . '>'; |
|
91 | + ).'<'.$recipient->admin_email.'>'; |
|
92 | 92 | } else { |
93 | 93 | $email = null; |
94 | 94 | } |
95 | 95 | if (empty($email) && ! empty($event)) { |
96 | 96 | $user = $this->_get_author_for_event($event); |
97 | 97 | $email = ! empty($user->first_name) |
98 | - ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' |
|
98 | + ? $user->first_name.' '.$user->last_name.'<'.$user->user_email.'>' |
|
99 | 99 | : EE_Registry::instance()->CFG->organization->get_pretty( |
100 | 100 | 'name' |
101 | - ) . '<' . $user->user_email . '>'; |
|
101 | + ).'<'.$user->user_email.'>'; |
|
102 | 102 | } |
103 | 103 | return $email; |
104 | 104 | break; |
@@ -20,116 +20,116 @@ |
||
20 | 20 | class EE_Event_Author_Shortcodes extends EE_Shortcodes |
21 | 21 | { |
22 | 22 | |
23 | - public function __construct() |
|
24 | - { |
|
25 | - parent::__construct(); |
|
26 | - } |
|
23 | + public function __construct() |
|
24 | + { |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - protected function _init_props() |
|
30 | - { |
|
31 | - $this->label = esc_html__('Event Author Details Shortcodes', 'event_espresso'); |
|
32 | - $this->description = esc_html__('All shortcodes specific to event_author data', 'event_espresso'); |
|
33 | - $this->_shortcodes = array( |
|
34 | - '[EVENT_AUTHOR_FNAME]' => esc_html__('Parses to the first name of the event author.', 'event_espresso'), |
|
35 | - '[EVENT_AUTHOR_LNAME]' => esc_html__('Parses to the last name of the event author.', 'event_espresso'), |
|
36 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]' => esc_html__( |
|
37 | - 'Parses to a formatted email address of the event author (fname lname <[email protected]>). <strong>NOTE:</strong> If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - '[EVENT_AUTHOR_EMAIL]' => esc_html__( |
|
41 | - 'Parses to the unformatted email address of the event author', |
|
42 | - 'event_espresso' |
|
43 | - ), |
|
44 | - ); |
|
45 | - } |
|
29 | + protected function _init_props() |
|
30 | + { |
|
31 | + $this->label = esc_html__('Event Author Details Shortcodes', 'event_espresso'); |
|
32 | + $this->description = esc_html__('All shortcodes specific to event_author data', 'event_espresso'); |
|
33 | + $this->_shortcodes = array( |
|
34 | + '[EVENT_AUTHOR_FNAME]' => esc_html__('Parses to the first name of the event author.', 'event_espresso'), |
|
35 | + '[EVENT_AUTHOR_LNAME]' => esc_html__('Parses to the last name of the event author.', 'event_espresso'), |
|
36 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]' => esc_html__( |
|
37 | + 'Parses to a formatted email address of the event author (fname lname <[email protected]>). <strong>NOTE:</strong> If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + '[EVENT_AUTHOR_EMAIL]' => esc_html__( |
|
41 | + 'Parses to the unformatted email address of the event author', |
|
42 | + 'event_espresso' |
|
43 | + ), |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function _parser($shortcode) |
|
49 | - { |
|
50 | - // make sure we end up with a copy of the EE_Messages_Addressee object |
|
51 | - $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
52 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array( |
|
53 | - $this->_data |
|
54 | - ) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] |
|
55 | - : $recipient; |
|
56 | - $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
57 | - ? $this->_extra_data['data'] : $recipient; |
|
48 | + protected function _parser($shortcode) |
|
49 | + { |
|
50 | + // make sure we end up with a copy of the EE_Messages_Addressee object |
|
51 | + $recipient = $this->_data instanceof EE_Messages_Addressee ? $this->_data : null; |
|
52 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && is_array( |
|
53 | + $this->_data |
|
54 | + ) && isset($this->_data['data']) && $this->_data['data'] instanceof EE_Messages_Addressee ? $this->_data['data'] |
|
55 | + : $recipient; |
|
56 | + $recipient = ! $recipient instanceof EE_Messages_Addressee && ! empty($this->_extra_data['data']) && $this->_extra_data['data'] instanceof EE_Messages_Addressee |
|
57 | + ? $this->_extra_data['data'] : $recipient; |
|
58 | 58 | |
59 | - // now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
|
60 | - $event = $this->_data instanceof EE_Event ? $this->_data : null; |
|
59 | + // now it's possible that $recipient is not an instance of EE_Messages_Addressee in which case we need to see if $this->_data is an instance of $event. |
|
60 | + $event = $this->_data instanceof EE_Event ? $this->_data : null; |
|
61 | 61 | |
62 | - if (! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) { |
|
63 | - return ''; |
|
64 | - } |
|
62 | + if (! $recipient instanceof EE_Messages_Addressee && ! $event instanceof EE_Event) { |
|
63 | + return ''; |
|
64 | + } |
|
65 | 65 | |
66 | - switch ($shortcode) { |
|
67 | - case '[EVENT_AUTHOR_FNAME]': |
|
68 | - $fname = ! empty($recipient) ? $recipient->fname : null; |
|
69 | - if (empty($fname) && ! empty($event)) { |
|
70 | - $user = $this->_get_author_for_event($event); |
|
71 | - $fname = $user->first_name; |
|
72 | - } |
|
73 | - return $fname; |
|
74 | - break; |
|
66 | + switch ($shortcode) { |
|
67 | + case '[EVENT_AUTHOR_FNAME]': |
|
68 | + $fname = ! empty($recipient) ? $recipient->fname : null; |
|
69 | + if (empty($fname) && ! empty($event)) { |
|
70 | + $user = $this->_get_author_for_event($event); |
|
71 | + $fname = $user->first_name; |
|
72 | + } |
|
73 | + return $fname; |
|
74 | + break; |
|
75 | 75 | |
76 | - case '[EVENT_AUTHOR_LNAME]': |
|
77 | - $lname = ! empty($recipient) ? $recipient->lname : null; |
|
78 | - if (empty($lname) && ! empty($event)) { |
|
79 | - $user = $this->_get_author_for_event($event); |
|
80 | - $lname = $user->last_name; |
|
81 | - } |
|
82 | - return $lname; |
|
83 | - break; |
|
76 | + case '[EVENT_AUTHOR_LNAME]': |
|
77 | + $lname = ! empty($recipient) ? $recipient->lname : null; |
|
78 | + if (empty($lname) && ! empty($event)) { |
|
79 | + $user = $this->_get_author_for_event($event); |
|
80 | + $lname = $user->last_name; |
|
81 | + } |
|
82 | + return $lname; |
|
83 | + break; |
|
84 | 84 | |
85 | - case '[EVENT_AUTHOR_FORMATTED_EMAIL]': |
|
86 | - if (! empty($recipient)) { |
|
87 | - $email = ! empty($recipient->fname) |
|
88 | - ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' |
|
89 | - : EE_Registry::instance()->CFG->organization->get_pretty( |
|
90 | - 'name' |
|
91 | - ) . '<' . $recipient->admin_email . '>'; |
|
92 | - } else { |
|
93 | - $email = null; |
|
94 | - } |
|
95 | - if (empty($email) && ! empty($event)) { |
|
96 | - $user = $this->_get_author_for_event($event); |
|
97 | - $email = ! empty($user->first_name) |
|
98 | - ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' |
|
99 | - : EE_Registry::instance()->CFG->organization->get_pretty( |
|
100 | - 'name' |
|
101 | - ) . '<' . $user->user_email . '>'; |
|
102 | - } |
|
103 | - return $email; |
|
104 | - break; |
|
85 | + case '[EVENT_AUTHOR_FORMATTED_EMAIL]': |
|
86 | + if (! empty($recipient)) { |
|
87 | + $email = ! empty($recipient->fname) |
|
88 | + ? $recipient->fname . ' ' . $recipient->lname . '<' . $recipient->admin_email . '>' |
|
89 | + : EE_Registry::instance()->CFG->organization->get_pretty( |
|
90 | + 'name' |
|
91 | + ) . '<' . $recipient->admin_email . '>'; |
|
92 | + } else { |
|
93 | + $email = null; |
|
94 | + } |
|
95 | + if (empty($email) && ! empty($event)) { |
|
96 | + $user = $this->_get_author_for_event($event); |
|
97 | + $email = ! empty($user->first_name) |
|
98 | + ? $user->first_name . ' ' . $user->last_name . '<' . $user->user_email . '>' |
|
99 | + : EE_Registry::instance()->CFG->organization->get_pretty( |
|
100 | + 'name' |
|
101 | + ) . '<' . $user->user_email . '>'; |
|
102 | + } |
|
103 | + return $email; |
|
104 | + break; |
|
105 | 105 | |
106 | - case '[EVENT_AUTHOR_EMAIL]': |
|
107 | - $email = ! empty($recipient) ? $recipient->admin_email : null; |
|
108 | - if (empty($email) && ! empty($event)) { |
|
109 | - $user = $this->_get_author_for_event($event); |
|
110 | - $email = $user->user_email; |
|
111 | - } |
|
112 | - return $email; |
|
113 | - break; |
|
106 | + case '[EVENT_AUTHOR_EMAIL]': |
|
107 | + $email = ! empty($recipient) ? $recipient->admin_email : null; |
|
108 | + if (empty($email) && ! empty($event)) { |
|
109 | + $user = $this->_get_author_for_event($event); |
|
110 | + $email = $user->user_email; |
|
111 | + } |
|
112 | + return $email; |
|
113 | + break; |
|
114 | 114 | |
115 | - default: |
|
116 | - return ''; |
|
117 | - break; |
|
118 | - } |
|
119 | - } |
|
115 | + default: |
|
116 | + return ''; |
|
117 | + break; |
|
118 | + } |
|
119 | + } |
|
120 | 120 | |
121 | 121 | |
122 | - /** |
|
123 | - * Helper method to return the user object for the author of the given EE_Event |
|
124 | - * |
|
125 | - * @param EE_Event $event |
|
126 | - * |
|
127 | - * @return WP_User |
|
128 | - */ |
|
129 | - private function _get_author_for_event(EE_Event $event) |
|
130 | - { |
|
131 | - $author_id = $event->wp_user(); |
|
132 | - $user_data = get_userdata((int) $author_id); |
|
133 | - return $user_data; |
|
134 | - } |
|
122 | + /** |
|
123 | + * Helper method to return the user object for the author of the given EE_Event |
|
124 | + * |
|
125 | + * @param EE_Event $event |
|
126 | + * |
|
127 | + * @return WP_User |
|
128 | + */ |
|
129 | + private function _get_author_for_event(EE_Event $event) |
|
130 | + { |
|
131 | + $author_id = $event->wp_user(); |
|
132 | + $user_data = get_userdata((int) $author_id); |
|
133 | + return $user_data; |
|
134 | + } |
|
135 | 135 | } |
@@ -19,167 +19,167 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - public function __construct() |
|
23 | - { |
|
24 | - parent::__construct(); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _init_props() |
|
29 | - { |
|
30 | - $this->label = esc_html__('Email Shortcodes', 'event_espresso'); |
|
31 | - $this->description = esc_html__('All shortcodes related to emails', 'event_espresso'); |
|
32 | - $this->_shortcodes = array( |
|
33 | - '[SITE_ADMIN_EMAIL]' => esc_html__( |
|
34 | - 'Will be replaced with the admin email for the site that Event Espresso is installed on', |
|
35 | - 'event_espresso' |
|
36 | - ), |
|
37 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( |
|
38 | - esc_html__( |
|
39 | - 'This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', |
|
40 | - 'event_espresso' |
|
41 | - ), |
|
42 | - '<strong>', |
|
43 | - '</strong>' |
|
44 | - ), |
|
45 | - '[EVENT_AUTHOR_EMAIL]' => sprintf( |
|
46 | - esc_html__( |
|
47 | - 'This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', |
|
48 | - 'event_espresso' |
|
49 | - ), |
|
50 | - '[EVENT_AUTHOR_FORMATTED_EMAIL]' |
|
51 | - ), |
|
52 | - '[CO_FORMATTED_EMAIL]' => esc_html__( |
|
53 | - 'This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', |
|
54 | - 'event_espresso' |
|
55 | - ), |
|
56 | - '[CO_EMAIL]' => esc_html__( |
|
57 | - 'This will parse to the email address only for the organization set in Your Organization Settings.', |
|
58 | - 'event_espresso' |
|
59 | - ), |
|
60 | - '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__( |
|
61 | - 'This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', |
|
62 | - 'event_espresso' |
|
63 | - ), |
|
64 | - '[ESPRESSO_ADMIN_EMAIL]' => esc_html__( |
|
65 | - 'This parses to the email address only for the organization set in Your Organization Settings page.', |
|
66 | - 'event_espresso' |
|
67 | - ), |
|
68 | - ); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - protected function _parser($shortcode) |
|
73 | - { |
|
74 | - |
|
75 | - switch ($shortcode) { |
|
76 | - case '[SITE_ADMIN_EMAIL]': |
|
77 | - return $this->_get_site_admin_email(); |
|
78 | - break; |
|
79 | - |
|
80 | - case '[EVENT_AUTHOR_FORMATTED_EMAIL]': |
|
81 | - return $this->_get_event_admin_emails(); |
|
82 | - break; |
|
83 | - |
|
84 | - case '[EVENT_AUTHOR_EMAIL]': |
|
85 | - return $this->_get_event_admin_emails(false); |
|
86 | - break; |
|
87 | - |
|
88 | - case '[CO_FORMATTED_EMAIL]': |
|
89 | - case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]': |
|
90 | - return EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' |
|
91 | - . EE_Registry::instance()->CFG->organization->get_pretty('email') . '>'; |
|
92 | - break; |
|
93 | - |
|
94 | - case '[CO_EMAIL]': |
|
95 | - case '[ESPRESSO_ADMIN_EMAIL]': |
|
96 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | - break; |
|
98 | - |
|
99 | - default: |
|
100 | - return ''; |
|
101 | - break; |
|
102 | - } |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * This simply returns the site admin email (result for parsing "[SITE_ADMIN_EMAIL]" shortcode) |
|
108 | - * |
|
109 | - * @access private |
|
110 | - * @return string email address of site admin |
|
111 | - */ |
|
112 | - private function _get_site_admin_email() |
|
113 | - { |
|
114 | - return get_bloginfo('admin_email'); |
|
115 | - } |
|
116 | - |
|
117 | - |
|
118 | - private function _get_event_admin_emails($fancy_headers = true) |
|
119 | - { |
|
120 | - |
|
121 | - if (! empty($this->_data->admin_email)) { |
|
122 | - if (! $fancy_headers) { |
|
123 | - return $this->_data->admin_email; |
|
124 | - } |
|
125 | - return ! empty($this->_data->fname) |
|
126 | - ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' |
|
127 | - : EE_Registry::instance()->CFG->organization->get_pretty( |
|
128 | - 'name' |
|
129 | - ) . ' <' . $this->_data->admin_email . '>'; |
|
130 | - } |
|
131 | - |
|
132 | - // k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!. |
|
133 | - |
|
134 | - $admin_email = array(); |
|
135 | - |
|
136 | - // loop through events and set the list of event_ids to retrieve so we can do ONE query. |
|
137 | - foreach ($this->_data->events as $event) { |
|
138 | - $ids[] = $event['ID']; |
|
139 | - } |
|
140 | - |
|
141 | - // get all the events |
|
142 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids)))); |
|
143 | - |
|
144 | - // now loop through each event and setup the details |
|
145 | - $admin_details = array(); |
|
146 | - $cnt = 0; |
|
147 | - foreach ($events as $event) { |
|
148 | - $user = get_userdata($event->get('EVT_wp_user')); |
|
149 | - $admin_details[ $cnt ] = new stdClass(); |
|
150 | - $admin_details[ $cnt ]->email = $user->user_email; |
|
151 | - $admin_details[ $cnt ]->first_name = $user->user_firstname; |
|
152 | - $admin_details[ $cnt ]->last_name = $user->user_lastname; |
|
153 | - $cnt++; |
|
154 | - } |
|
155 | - |
|
156 | - // results? |
|
157 | - if (empty($admin_details) || ! is_array($admin_details)) { |
|
158 | - $msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso'); |
|
159 | - $msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql); |
|
160 | - $msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, true)); |
|
161 | - $msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, true)); |
|
162 | - $msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details)); |
|
163 | - do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser'); |
|
164 | - } |
|
165 | - |
|
166 | - foreach ($admin_details as $admin) { |
|
167 | - // only add an admin email if it is present. |
|
168 | - if (empty($admin->email) || $admin->email == '') { |
|
169 | - continue; |
|
170 | - } |
|
171 | - |
|
172 | - if (! $fancy_headers) { |
|
173 | - $admin_email[] = $admin->email; |
|
174 | - continue; |
|
175 | - } |
|
176 | - |
|
177 | - $admin_email[] = ! empty($admin->first_name) |
|
178 | - ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' |
|
179 | - : EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' . $admin->email . '>'; |
|
180 | - } |
|
181 | - |
|
182 | - $admin_email = implode(',', $admin_email); |
|
183 | - return $admin_email; |
|
184 | - } |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | + parent::__construct(); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _init_props() |
|
29 | + { |
|
30 | + $this->label = esc_html__('Email Shortcodes', 'event_espresso'); |
|
31 | + $this->description = esc_html__('All shortcodes related to emails', 'event_espresso'); |
|
32 | + $this->_shortcodes = array( |
|
33 | + '[SITE_ADMIN_EMAIL]' => esc_html__( |
|
34 | + 'Will be replaced with the admin email for the site that Event Espresso is installed on', |
|
35 | + 'event_espresso' |
|
36 | + ), |
|
37 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]' => sprintf( |
|
38 | + esc_html__( |
|
39 | + 'This will be replaced with a properly formatted list of Event Creator emails for the events in a registration. %1$sNOTE:%2$s If the event author has not filled out their WordPress user profile then the organization name will be used as the "From" name.', |
|
40 | + 'event_espresso' |
|
41 | + ), |
|
42 | + '<strong>', |
|
43 | + '</strong>' |
|
44 | + ), |
|
45 | + '[EVENT_AUTHOR_EMAIL]' => sprintf( |
|
46 | + esc_html__( |
|
47 | + 'This is the same as %1$s shortcode except it is just a list of emails (not fancy headers).', |
|
48 | + 'event_espresso' |
|
49 | + ), |
|
50 | + '[EVENT_AUTHOR_FORMATTED_EMAIL]' |
|
51 | + ), |
|
52 | + '[CO_FORMATTED_EMAIL]' => esc_html__( |
|
53 | + 'This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', |
|
54 | + 'event_espresso' |
|
55 | + ), |
|
56 | + '[CO_EMAIL]' => esc_html__( |
|
57 | + 'This will parse to the email address only for the organization set in Your Organization Settings.', |
|
58 | + 'event_espresso' |
|
59 | + ), |
|
60 | + '[ESPRESSO_ADMIN_FORMATTED_EMAIL]' => esc_html__( |
|
61 | + 'This parses to the formatted email address of the organization name set in Your Organization Settings. "My Organization <[email protected]>"', |
|
62 | + 'event_espresso' |
|
63 | + ), |
|
64 | + '[ESPRESSO_ADMIN_EMAIL]' => esc_html__( |
|
65 | + 'This parses to the email address only for the organization set in Your Organization Settings page.', |
|
66 | + 'event_espresso' |
|
67 | + ), |
|
68 | + ); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + protected function _parser($shortcode) |
|
73 | + { |
|
74 | + |
|
75 | + switch ($shortcode) { |
|
76 | + case '[SITE_ADMIN_EMAIL]': |
|
77 | + return $this->_get_site_admin_email(); |
|
78 | + break; |
|
79 | + |
|
80 | + case '[EVENT_AUTHOR_FORMATTED_EMAIL]': |
|
81 | + return $this->_get_event_admin_emails(); |
|
82 | + break; |
|
83 | + |
|
84 | + case '[EVENT_AUTHOR_EMAIL]': |
|
85 | + return $this->_get_event_admin_emails(false); |
|
86 | + break; |
|
87 | + |
|
88 | + case '[CO_FORMATTED_EMAIL]': |
|
89 | + case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]': |
|
90 | + return EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' |
|
91 | + . EE_Registry::instance()->CFG->organization->get_pretty('email') . '>'; |
|
92 | + break; |
|
93 | + |
|
94 | + case '[CO_EMAIL]': |
|
95 | + case '[ESPRESSO_ADMIN_EMAIL]': |
|
96 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
97 | + break; |
|
98 | + |
|
99 | + default: |
|
100 | + return ''; |
|
101 | + break; |
|
102 | + } |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * This simply returns the site admin email (result for parsing "[SITE_ADMIN_EMAIL]" shortcode) |
|
108 | + * |
|
109 | + * @access private |
|
110 | + * @return string email address of site admin |
|
111 | + */ |
|
112 | + private function _get_site_admin_email() |
|
113 | + { |
|
114 | + return get_bloginfo('admin_email'); |
|
115 | + } |
|
116 | + |
|
117 | + |
|
118 | + private function _get_event_admin_emails($fancy_headers = true) |
|
119 | + { |
|
120 | + |
|
121 | + if (! empty($this->_data->admin_email)) { |
|
122 | + if (! $fancy_headers) { |
|
123 | + return $this->_data->admin_email; |
|
124 | + } |
|
125 | + return ! empty($this->_data->fname) |
|
126 | + ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' |
|
127 | + : EE_Registry::instance()->CFG->organization->get_pretty( |
|
128 | + 'name' |
|
129 | + ) . ' <' . $this->_data->admin_email . '>'; |
|
130 | + } |
|
131 | + |
|
132 | + // k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!. |
|
133 | + |
|
134 | + $admin_email = array(); |
|
135 | + |
|
136 | + // loop through events and set the list of event_ids to retrieve so we can do ONE query. |
|
137 | + foreach ($this->_data->events as $event) { |
|
138 | + $ids[] = $event['ID']; |
|
139 | + } |
|
140 | + |
|
141 | + // get all the events |
|
142 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array(array('EVT_ID' => array('IN', $ids)))); |
|
143 | + |
|
144 | + // now loop through each event and setup the details |
|
145 | + $admin_details = array(); |
|
146 | + $cnt = 0; |
|
147 | + foreach ($events as $event) { |
|
148 | + $user = get_userdata($event->get('EVT_wp_user')); |
|
149 | + $admin_details[ $cnt ] = new stdClass(); |
|
150 | + $admin_details[ $cnt ]->email = $user->user_email; |
|
151 | + $admin_details[ $cnt ]->first_name = $user->user_firstname; |
|
152 | + $admin_details[ $cnt ]->last_name = $user->user_lastname; |
|
153 | + $cnt++; |
|
154 | + } |
|
155 | + |
|
156 | + // results? |
|
157 | + if (empty($admin_details) || ! is_array($admin_details)) { |
|
158 | + $msg[] = esc_html__('The admin details could not be retrieved from the database.', 'event_espresso'); |
|
159 | + $msg[] = sprintf(esc_html__('Query: %s', 'event_espresso'), $sql); |
|
160 | + $msg[] = sprintf(esc_html__('Events Data: %s', 'event_espresso'), var_export($this->_data->events, true)); |
|
161 | + $msg[] = sprintf(esc_html__('Event IDS: %s', 'event_espresso'), var_export($ids, true)); |
|
162 | + $msg[] = sprintf(esc_html__('Query Results: %s', 'event_espresso'), var_export($admin_details)); |
|
163 | + do_action('AHEE_log', __FILE__, __FUNCTION__, implode(PHP_EOL, $msg), 'shortcode_parser'); |
|
164 | + } |
|
165 | + |
|
166 | + foreach ($admin_details as $admin) { |
|
167 | + // only add an admin email if it is present. |
|
168 | + if (empty($admin->email) || $admin->email == '') { |
|
169 | + continue; |
|
170 | + } |
|
171 | + |
|
172 | + if (! $fancy_headers) { |
|
173 | + $admin_email[] = $admin->email; |
|
174 | + continue; |
|
175 | + } |
|
176 | + |
|
177 | + $admin_email[] = ! empty($admin->first_name) |
|
178 | + ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' |
|
179 | + : EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' . $admin->email . '>'; |
|
180 | + } |
|
181 | + |
|
182 | + $admin_email = implode(',', $admin_email); |
|
183 | + return $admin_email; |
|
184 | + } |
|
185 | 185 | } |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | case '[CO_FORMATTED_EMAIL]': |
89 | 89 | case '[ESPRESSO_ADMIN_FORMATTED_EMAIL]': |
90 | - return EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' |
|
91 | - . EE_Registry::instance()->CFG->organization->get_pretty('email') . '>'; |
|
90 | + return EE_Registry::instance()->CFG->organization->get_pretty('name').' <' |
|
91 | + . EE_Registry::instance()->CFG->organization->get_pretty('email').'>'; |
|
92 | 92 | break; |
93 | 93 | |
94 | 94 | case '[CO_EMAIL]': |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | private function _get_event_admin_emails($fancy_headers = true) |
119 | 119 | { |
120 | 120 | |
121 | - if (! empty($this->_data->admin_email)) { |
|
122 | - if (! $fancy_headers) { |
|
121 | + if ( ! empty($this->_data->admin_email)) { |
|
122 | + if ( ! $fancy_headers) { |
|
123 | 123 | return $this->_data->admin_email; |
124 | 124 | } |
125 | 125 | return ! empty($this->_data->fname) |
126 | - ? $this->_data->fname . ' ' . $this->_data->lname . ' <' . $this->_data->admin_email . '>' |
|
126 | + ? $this->_data->fname.' '.$this->_data->lname.' <'.$this->_data->admin_email.'>' |
|
127 | 127 | : EE_Registry::instance()->CFG->organization->get_pretty( |
128 | 128 | 'name' |
129 | - ) . ' <' . $this->_data->admin_email . '>'; |
|
129 | + ).' <'.$this->_data->admin_email.'>'; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // k this shortcode has been used else where. Since we don't know what particular event this is for, let's loop through the events and get an array of event admins for the events. We'll return the formatted list of admin emails and let the messenger make sure we only pick one if this is for a field that can only have ONE!. |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | $cnt = 0; |
147 | 147 | foreach ($events as $event) { |
148 | 148 | $user = get_userdata($event->get('EVT_wp_user')); |
149 | - $admin_details[ $cnt ] = new stdClass(); |
|
150 | - $admin_details[ $cnt ]->email = $user->user_email; |
|
151 | - $admin_details[ $cnt ]->first_name = $user->user_firstname; |
|
152 | - $admin_details[ $cnt ]->last_name = $user->user_lastname; |
|
149 | + $admin_details[$cnt] = new stdClass(); |
|
150 | + $admin_details[$cnt]->email = $user->user_email; |
|
151 | + $admin_details[$cnt]->first_name = $user->user_firstname; |
|
152 | + $admin_details[$cnt]->last_name = $user->user_lastname; |
|
153 | 153 | $cnt++; |
154 | 154 | } |
155 | 155 | |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
172 | - if (! $fancy_headers) { |
|
172 | + if ( ! $fancy_headers) { |
|
173 | 173 | $admin_email[] = $admin->email; |
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $admin_email[] = ! empty($admin->first_name) |
178 | - ? $admin->first_name . ' ' . $admin->last_name . ' <' . $admin->email . '>' |
|
179 | - : EE_Registry::instance()->CFG->organization->get_pretty('name') . ' <' . $admin->email . '>'; |
|
178 | + ? $admin->first_name.' '.$admin->last_name.' <'.$admin->email.'>' |
|
179 | + : EE_Registry::instance()->CFG->organization->get_pretty('name').' <'.$admin->email.'>'; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $admin_email = implode(',', $admin_email); |
@@ -19,206 +19,206 @@ |
||
19 | 19 | interface FormHandlerInterface |
20 | 20 | { |
21 | 21 | |
22 | - /** |
|
23 | - * the absolute top level form section being used on the page |
|
24 | - * |
|
25 | - * @return \EE_Form_Section_Proper |
|
26 | - */ |
|
27 | - public function form(); |
|
22 | + /** |
|
23 | + * the absolute top level form section being used on the page |
|
24 | + * |
|
25 | + * @return \EE_Form_Section_Proper |
|
26 | + */ |
|
27 | + public function form(); |
|
28 | 28 | |
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @param \EE_Form_Section_Proper $form |
|
33 | - */ |
|
34 | - public function setForm(\EE_Form_Section_Proper $form); |
|
31 | + /** |
|
32 | + * @param \EE_Form_Section_Proper $form |
|
33 | + */ |
|
34 | + public function setForm(\EE_Form_Section_Proper $form); |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * if set to false, then this form has no displayable content, |
|
40 | - * and will only be used for processing data sent passed via GET or POST |
|
41 | - * |
|
42 | - * @return boolean |
|
43 | - */ |
|
44 | - public function displayable(); |
|
38 | + /** |
|
39 | + * if set to false, then this form has no displayable content, |
|
40 | + * and will only be used for processing data sent passed via GET or POST |
|
41 | + * |
|
42 | + * @return boolean |
|
43 | + */ |
|
44 | + public function displayable(); |
|
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param boolean $displayable |
|
50 | - */ |
|
51 | - public function setDisplayable($displayable = false); |
|
48 | + /** |
|
49 | + * @param boolean $displayable |
|
50 | + */ |
|
51 | + public function setDisplayable($displayable = false); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * a public name for the form that can be displayed on the frontend of a site |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function formName(); |
|
55 | + /** |
|
56 | + * a public name for the form that can be displayed on the frontend of a site |
|
57 | + * |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function formName(); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * a public name for the form that can be displayed, but only in the admin |
|
66 | - * |
|
67 | - * @return string |
|
68 | - */ |
|
69 | - public function adminName(); |
|
64 | + /** |
|
65 | + * a public name for the form that can be displayed, but only in the admin |
|
66 | + * |
|
67 | + * @return string |
|
68 | + */ |
|
69 | + public function adminName(); |
|
70 | 70 | |
71 | 71 | |
72 | 72 | |
73 | - /** |
|
74 | - * a URL friendly string that can be used for identifying the form |
|
75 | - * |
|
76 | - * @return string |
|
77 | - */ |
|
78 | - public function slug(); |
|
73 | + /** |
|
74 | + * a URL friendly string that can be used for identifying the form |
|
75 | + * |
|
76 | + * @return string |
|
77 | + */ |
|
78 | + public function slug(); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | |
82 | - /** |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function submitBtnText(); |
|
82 | + /** |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function submitBtnText(); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
89 | - /** |
|
90 | - * @param string $submit_btn_text |
|
91 | - */ |
|
92 | - public function setSubmitBtnText($submit_btn_text); |
|
89 | + /** |
|
90 | + * @param string $submit_btn_text |
|
91 | + */ |
|
92 | + public function setSubmitBtnText($submit_btn_text); |
|
93 | 93 | |
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function formAction(); |
|
96 | + /** |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function formAction(); |
|
100 | 100 | |
101 | 101 | |
102 | 102 | |
103 | - /** |
|
104 | - * @param string $form_action |
|
105 | - */ |
|
106 | - public function setFormAction($form_action); |
|
103 | + /** |
|
104 | + * @param string $form_action |
|
105 | + */ |
|
106 | + public function setFormAction($form_action); |
|
107 | 107 | |
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * @param array $form_args |
|
112 | - */ |
|
113 | - public function addFormActionArgs($form_args = array()); |
|
110 | + /** |
|
111 | + * @param array $form_args |
|
112 | + */ |
|
113 | + public function addFormActionArgs($form_args = array()); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | |
117 | - /** |
|
118 | - * if data regarding the form's state needs to be persisted, |
|
119 | - * then this method can be used to retrieve that data |
|
120 | - * |
|
121 | - * @return string |
|
122 | - */ |
|
123 | - public function formConfig(); |
|
117 | + /** |
|
118 | + * if data regarding the form's state needs to be persisted, |
|
119 | + * then this method can be used to retrieve that data |
|
120 | + * |
|
121 | + * @return string |
|
122 | + */ |
|
123 | + public function formConfig(); |
|
124 | 124 | |
125 | 125 | |
126 | 126 | |
127 | - /** |
|
128 | - * if data regarding the form's state needs to be persisted, |
|
129 | - * the this method can be used for setting the persisted data locally |
|
130 | - * |
|
131 | - * @param string $form_config |
|
132 | - */ |
|
133 | - public function setFormConfig($form_config); |
|
127 | + /** |
|
128 | + * if data regarding the form's state needs to be persisted, |
|
129 | + * the this method can be used for setting the persisted data locally |
|
130 | + * |
|
131 | + * @param string $form_config |
|
132 | + */ |
|
133 | + public function setFormConfig($form_config); |
|
134 | 134 | |
135 | 135 | |
136 | 136 | |
137 | - /** |
|
138 | - * called after the form is instantiated |
|
139 | - * and used for performing any logic that needs to occur early |
|
140 | - * before any of the other methods are called. |
|
141 | - * returns true if everything is ok to proceed, |
|
142 | - * and false if no further form logic should be implemented |
|
143 | - * |
|
144 | - * @return boolean |
|
145 | - */ |
|
146 | - public function initialize(); |
|
137 | + /** |
|
138 | + * called after the form is instantiated |
|
139 | + * and used for performing any logic that needs to occur early |
|
140 | + * before any of the other methods are called. |
|
141 | + * returns true if everything is ok to proceed, |
|
142 | + * and false if no further form logic should be implemented |
|
143 | + * |
|
144 | + * @return boolean |
|
145 | + */ |
|
146 | + public function initialize(); |
|
147 | 147 | |
148 | 148 | |
149 | 149 | |
150 | - /** |
|
151 | - * used for setting up css and js |
|
152 | - * |
|
153 | - * @return void |
|
154 | - */ |
|
155 | - public function enqueueStylesAndScripts(); |
|
150 | + /** |
|
151 | + * used for setting up css and js |
|
152 | + * |
|
153 | + * @return void |
|
154 | + */ |
|
155 | + public function enqueueStylesAndScripts(); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | |
159 | - /** |
|
160 | - * creates and returns the actual form |
|
161 | - * |
|
162 | - * @return EE_Form_Section_Proper |
|
163 | - */ |
|
164 | - public function generate(); |
|
159 | + /** |
|
160 | + * creates and returns the actual form |
|
161 | + * |
|
162 | + * @return EE_Form_Section_Proper |
|
163 | + */ |
|
164 | + public function generate(); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | |
168 | - /** |
|
169 | - * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
170 | - * returns a string of HTML that can be directly echoed in a template |
|
171 | - * |
|
172 | - * @return string |
|
173 | - */ |
|
174 | - public function display(); |
|
168 | + /** |
|
169 | + * takes the generated form and displays it along with ony other non-form HTML that may be required |
|
170 | + * returns a string of HTML that can be directly echoed in a template |
|
171 | + * |
|
172 | + * @return string |
|
173 | + */ |
|
174 | + public function display(); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | |
178 | - /** |
|
179 | - * handles processing the form submission |
|
180 | - * returns true or false depending on whether the form was processed successfully or not |
|
181 | - * |
|
182 | - * @param array $submitted_form_data |
|
183 | - * @return bool |
|
184 | - */ |
|
185 | - public function process($submitted_form_data = array()); |
|
178 | + /** |
|
179 | + * handles processing the form submission |
|
180 | + * returns true or false depending on whether the form was processed successfully or not |
|
181 | + * |
|
182 | + * @param array $submitted_form_data |
|
183 | + * @return bool |
|
184 | + */ |
|
185 | + public function process($submitted_form_data = array()); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | |
189 | - /** |
|
190 | - * creates and returns an EE_Submit_Input labeled "Submit" |
|
191 | - * |
|
192 | - * @param string $text |
|
193 | - * @return \EE_Submit_Input |
|
194 | - */ |
|
195 | - public function generateSubmitButton($text = ''); |
|
189 | + /** |
|
190 | + * creates and returns an EE_Submit_Input labeled "Submit" |
|
191 | + * |
|
192 | + * @param string $text |
|
193 | + * @return \EE_Submit_Input |
|
194 | + */ |
|
195 | + public function generateSubmitButton($text = ''); |
|
196 | 196 | |
197 | 197 | |
198 | 198 | |
199 | - /** |
|
200 | - * calls generateSubmitButton() and appends it onto the form along with a float clearing div |
|
201 | - * |
|
202 | - * @return void |
|
203 | - */ |
|
204 | - public function appendSubmitButton(); |
|
199 | + /** |
|
200 | + * calls generateSubmitButton() and appends it onto the form along with a float clearing div |
|
201 | + * |
|
202 | + * @return void |
|
203 | + */ |
|
204 | + public function appendSubmitButton(); |
|
205 | 205 | |
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * creates and returns an EE_Submit_Input labeled "Cancel" |
|
210 | - * |
|
211 | - * @param string $text |
|
212 | - * @return \EE_Submit_Input |
|
213 | - */ |
|
214 | - public function generateCancelButton($text = ''); |
|
208 | + /** |
|
209 | + * creates and returns an EE_Submit_Input labeled "Cancel" |
|
210 | + * |
|
211 | + * @param string $text |
|
212 | + * @return \EE_Submit_Input |
|
213 | + */ |
|
214 | + public function generateCancelButton($text = ''); |
|
215 | 215 | |
216 | 216 | |
217 | 217 | |
218 | - /** |
|
219 | - * appends a float clearing div onto end of form |
|
220 | - * |
|
221 | - * @return void |
|
222 | - */ |
|
223 | - public function clearFormButtonFloats(); |
|
218 | + /** |
|
219 | + * appends a float clearing div onto end of form |
|
220 | + * |
|
221 | + * @return void |
|
222 | + */ |
|
223 | + public function clearFormButtonFloats(); |
|
224 | 224 | } |
@@ -16,55 +16,55 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @return int |
|
21 | - */ |
|
22 | - public function order(); |
|
19 | + /** |
|
20 | + * @return int |
|
21 | + */ |
|
22 | + public function order(); |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * @param int $order |
|
28 | - * @throws InvalidArgumentException |
|
29 | - */ |
|
30 | - public function setOrder($order); |
|
26 | + /** |
|
27 | + * @param int $order |
|
28 | + * @throws InvalidArgumentException |
|
29 | + */ |
|
30 | + public function setOrder($order); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function redirectUrl(); |
|
34 | + /** |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function redirectUrl(); |
|
38 | 38 | |
39 | 39 | |
40 | 40 | |
41 | - /** |
|
42 | - * @param string $redirect_url |
|
43 | - * @throws InvalidDataTypeException |
|
44 | - * @throws InvalidArgumentException |
|
45 | - */ |
|
46 | - public function setRedirectUrl($redirect_url); |
|
41 | + /** |
|
42 | + * @param string $redirect_url |
|
43 | + * @throws InvalidDataTypeException |
|
44 | + * @throws InvalidArgumentException |
|
45 | + */ |
|
46 | + public function setRedirectUrl($redirect_url); |
|
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param array $redirect_args |
|
52 | - * @throws InvalidDataTypeException |
|
53 | - * @throws InvalidArgumentException |
|
54 | - */ |
|
55 | - public function addRedirectArgs($redirect_args = array()); |
|
50 | + /** |
|
51 | + * @param array $redirect_args |
|
52 | + * @throws InvalidDataTypeException |
|
53 | + * @throws InvalidArgumentException |
|
54 | + */ |
|
55 | + public function addRedirectArgs($redirect_args = array()); |
|
56 | 56 | |
57 | 57 | |
58 | 58 | |
59 | - /** |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function redirectTo(); |
|
59 | + /** |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function redirectTo(); |
|
63 | 63 | |
64 | 64 | |
65 | 65 | |
66 | - /** |
|
67 | - * @param string $redirect_to |
|
68 | - */ |
|
69 | - public function setRedirectTo($redirect_to); |
|
66 | + /** |
|
67 | + * @param string $redirect_to |
|
68 | + */ |
|
69 | + public function setRedirectTo($redirect_to); |
|
70 | 70 | } |
@@ -12,68 +12,68 @@ |
||
12 | 12 | class EE_Checkbox_Dropdown_Selector_Input extends EE_Form_Input_With_Options_Base |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * @var string text to display on the select button itself |
|
17 | - */ |
|
18 | - protected $_select_button_text; |
|
15 | + /** |
|
16 | + * @var string text to display on the select button itself |
|
17 | + */ |
|
18 | + protected $_select_button_text; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @param array $answer_options |
|
22 | - * @param array $input_settings |
|
23 | - */ |
|
24 | - public function __construct($answer_options, $input_settings = array()) |
|
25 | - { |
|
26 | - $this->_select_button_text = EEH_Array::is_set( |
|
27 | - $input_settings, |
|
28 | - 'select_button_text', |
|
29 | - esc_html__('Select', 'event_espresso') |
|
30 | - ); |
|
31 | - $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy(); |
|
32 | - $this->_set_display_strategy($display_strategy); |
|
33 | - $this->load_iframe_assets($display_strategy); |
|
34 | - $this->_add_validation_strategy( |
|
35 | - new EE_Many_Valued_Validation_Strategy( |
|
36 | - array( |
|
37 | - new EE_Enum_Validation_Strategy( |
|
38 | - isset($input_settings['validation_error_message']) |
|
39 | - ? $input_settings['validation_error_message'] |
|
40 | - : null |
|
41 | - ), |
|
42 | - ) |
|
43 | - ) |
|
44 | - ); |
|
45 | - $this->_multiple_selections = true; |
|
46 | - parent::__construct($answer_options, $input_settings); |
|
47 | - } |
|
20 | + /** |
|
21 | + * @param array $answer_options |
|
22 | + * @param array $input_settings |
|
23 | + */ |
|
24 | + public function __construct($answer_options, $input_settings = array()) |
|
25 | + { |
|
26 | + $this->_select_button_text = EEH_Array::is_set( |
|
27 | + $input_settings, |
|
28 | + 'select_button_text', |
|
29 | + esc_html__('Select', 'event_espresso') |
|
30 | + ); |
|
31 | + $display_strategy = new EE_Checkbox_Dropdown_Selector_Display_Strategy(); |
|
32 | + $this->_set_display_strategy($display_strategy); |
|
33 | + $this->load_iframe_assets($display_strategy); |
|
34 | + $this->_add_validation_strategy( |
|
35 | + new EE_Many_Valued_Validation_Strategy( |
|
36 | + array( |
|
37 | + new EE_Enum_Validation_Strategy( |
|
38 | + isset($input_settings['validation_error_message']) |
|
39 | + ? $input_settings['validation_error_message'] |
|
40 | + : null |
|
41 | + ), |
|
42 | + ) |
|
43 | + ) |
|
44 | + ); |
|
45 | + $this->_multiple_selections = true; |
|
46 | + parent::__construct($answer_options, $input_settings); |
|
47 | + } |
|
48 | 48 | |
49 | - /* |
|
49 | + /* |
|
50 | 50 | * Returns the text to display in the select button |
51 | 51 | */ |
52 | - public function select_button_text() |
|
53 | - { |
|
54 | - return $this->_select_button_text; |
|
55 | - } |
|
52 | + public function select_button_text() |
|
53 | + { |
|
54 | + return $this->_select_button_text; |
|
55 | + } |
|
56 | 56 | |
57 | - /* |
|
57 | + /* |
|
58 | 58 | * add css and js for iframes |
59 | 59 | */ |
60 | - protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
61 | - { |
|
62 | - add_filter( |
|
63 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
64 | - array($display_strategy, 'iframe_css') |
|
65 | - ); |
|
66 | - add_filter( |
|
67 | - 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
68 | - array($display_strategy, 'iframe_js') |
|
69 | - ); |
|
70 | - add_filter( |
|
71 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
72 | - array($display_strategy, 'iframe_css') |
|
73 | - ); |
|
74 | - add_filter( |
|
75 | - 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
76 | - array($display_strategy, 'iframe_js') |
|
77 | - ); |
|
78 | - } |
|
60 | + protected function load_iframe_assets(EE_Checkbox_Dropdown_Selector_Display_Strategy $display_strategy) |
|
61 | + { |
|
62 | + add_filter( |
|
63 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
|
64 | + array($display_strategy, 'iframe_css') |
|
65 | + ); |
|
66 | + add_filter( |
|
67 | + 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
|
68 | + array($display_strategy, 'iframe_js') |
|
69 | + ); |
|
70 | + add_filter( |
|
71 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__css', |
|
72 | + array($display_strategy, 'iframe_css') |
|
73 | + ); |
|
74 | + add_filter( |
|
75 | + 'FHEE__EventEspresso_modules_events_archive_EventsArchiveIframe__display__js', |
|
76 | + array($display_strategy, 'iframe_js') |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | } |
@@ -11,42 +11,42 @@ |
||
11 | 11 | class EE_Button_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @var string of HTML to put between the button tags |
|
16 | - */ |
|
17 | - protected $_button_content; |
|
18 | - /** |
|
19 | - * @param array $options |
|
20 | - */ |
|
21 | - public function __construct($options = array()) |
|
22 | - { |
|
23 | - if (empty($options['button_content'])) { |
|
24 | - $options['button_content'] = esc_html__('Button', 'event_espresso'); |
|
25 | - } |
|
26 | - $this->_set_display_strategy(new EE_Button_Display_Strategy()); |
|
27 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
28 | - $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
29 | - parent::__construct($options); |
|
30 | - } |
|
14 | + /** |
|
15 | + * @var string of HTML to put between the button tags |
|
16 | + */ |
|
17 | + protected $_button_content; |
|
18 | + /** |
|
19 | + * @param array $options |
|
20 | + */ |
|
21 | + public function __construct($options = array()) |
|
22 | + { |
|
23 | + if (empty($options['button_content'])) { |
|
24 | + $options['button_content'] = esc_html__('Button', 'event_espresso'); |
|
25 | + } |
|
26 | + $this->_set_display_strategy(new EE_Button_Display_Strategy()); |
|
27 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
28 | + $this->_add_validation_strategy(new EE_Plaintext_Validation_Strategy()); |
|
29 | + parent::__construct($options); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Sets the button content |
|
36 | - * @see EE_Button_Input::$_button_content |
|
37 | - * @param string $new_content |
|
38 | - */ |
|
39 | - public function set_button_content($new_content) |
|
40 | - { |
|
41 | - $this->_button_content = $new_content; |
|
42 | - } |
|
34 | + /** |
|
35 | + * Sets the button content |
|
36 | + * @see EE_Button_Input::$_button_content |
|
37 | + * @param string $new_content |
|
38 | + */ |
|
39 | + public function set_button_content($new_content) |
|
40 | + { |
|
41 | + $this->_button_content = $new_content; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Gets the button content |
|
46 | - * @return string |
|
47 | - */ |
|
48 | - public function button_content() |
|
49 | - { |
|
50 | - return $this->_button_content; |
|
51 | - } |
|
44 | + /** |
|
45 | + * Gets the button content |
|
46 | + * @return string |
|
47 | + */ |
|
48 | + public function button_content() |
|
49 | + { |
|
50 | + return $this->_button_content; |
|
51 | + } |
|
52 | 52 | } |