@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | <li data-datetime-row="<?php echo esc_attr($dtt_row); ?>" data-context="datetime-ticket" data-ticket-row="<?php echo esc_attr($tkt_row); ?>" |
16 | 16 | class="datetime-ticket clickable<?php echo $ticket_selected; |
17 | - echo $tkt_status_class; ?>"> |
|
17 | + echo $tkt_status_class; ?>"> |
|
18 | 18 | <input type="checkbox" name="datetime_ticket[<?php echo esc_attr($dtt_row); ?>][<?php echo esc_attr($tkt_row); ?>]" |
19 | 19 | class="datetime-ticket-checkbox" value="1"<?php echo $datetime_ticket_checked; ?>> |
20 | 20 | <span class="ee-icon ee-icon-tickets ticket-list-ticket-name"><?php echo $TKT_name; ?></span> |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | placeholder="Datetime Description (optional)"><?php echo esc_textarea($DTT_description); ?></textarea> |
24 | 24 | </div> |
25 | 25 | <?php do_action( |
26 | - 'AHEE__event_tickets_datetime_attached_tickets_row_template__advanced_details_after_dtt_description', |
|
27 | - $dtt_row, |
|
28 | - $DTT_ID |
|
29 | - ); ?> |
|
26 | + 'AHEE__event_tickets_datetime_attached_tickets_row_template__advanced_details_after_dtt_description', |
|
27 | + $dtt_row, |
|
28 | + $DTT_ID |
|
29 | + ); ?> |
|
30 | 30 | <h4 class="datetime-tickets-heading"><?php esc_html_e('Assigned Tickets', 'event_espresso'); ?></h4> |
31 | 31 | |
32 | 32 | <ul class="datetime-tickets-list"> |
@@ -36,28 +36,28 @@ discard block |
||
36 | 36 | |
37 | 37 | <div class="add-datetime-ticket-container"> |
38 | 38 | <h4 class="datetime-tickets-heading"><?php |
39 | - esc_html_e( |
|
40 | - 'Add New Ticket', |
|
41 | - 'event_espresso' |
|
42 | - ); ?></h4><?php echo $add_new_datetime_ticket_help_link; ?><br> |
|
39 | + esc_html_e( |
|
40 | + 'Add New Ticket', |
|
41 | + 'event_espresso' |
|
42 | + ); ?></h4><?php echo $add_new_datetime_ticket_help_link; ?><br> |
|
43 | 43 | <table class="add-new-ticket-table"> |
44 | 44 | <thead> |
45 | 45 | <tr valign="top"> |
46 | 46 | <td><span class="ANT_TKT_name_label"><?php |
47 | - esc_html_e( |
|
48 | - 'Ticket Name', |
|
49 | - 'event_espresso' |
|
50 | - ); ?></span></td> |
|
47 | + esc_html_e( |
|
48 | + 'Ticket Name', |
|
49 | + 'event_espresso' |
|
50 | + ); ?></span></td> |
|
51 | 51 | <td><span class="ANT_TKT_goes_on_sale_label"><?php |
52 | - esc_html_e( |
|
53 | - 'Sale Starts', |
|
54 | - 'event_espresso' |
|
55 | - ); ?></span></td> |
|
52 | + esc_html_e( |
|
53 | + 'Sale Starts', |
|
54 | + 'event_espresso' |
|
55 | + ); ?></span></td> |
|
56 | 56 | <td><span class="ANT_TKT_sell_until_label"><?php |
57 | - esc_html_e( |
|
58 | - 'Sell Until', |
|
59 | - 'event_espresso' |
|
60 | - ); ?></span></td> |
|
57 | + esc_html_e( |
|
58 | + 'Sell Until', |
|
59 | + 'event_espresso' |
|
60 | + ); ?></span></td> |
|
61 | 61 | <td><span class="ANT_TKT_price_label"><?php esc_html_e('Price', 'event_espresso'); ?></span> |
62 | 62 | </td> |
63 | 63 | <td><span class="ANT_TKT_qty_label"><?php esc_html_e('Qty', 'event_espresso'); ?></span></td> |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | <div class="ee-editor-footer-container"> |
108 | 108 | <div class="ee-editor-id-container"> |
109 | 109 | <span class="ee-item-id"><?php |
110 | - echo $DTT_ID |
|
111 | - ? sprintf( |
|
112 | - esc_html__('Datetime ID: %d', 'event_espresso'), |
|
113 | - $DTT_ID |
|
114 | - ) |
|
115 | - : ''; ?></span> |
|
110 | + echo $DTT_ID |
|
111 | + ? sprintf( |
|
112 | + esc_html__('Datetime ID: %d', 'event_espresso'), |
|
113 | + $DTT_ID |
|
114 | + ) |
|
115 | + : ''; ?></span> |
|
116 | 116 | </div> |
117 | 117 | <div class="save-cancel-button-container"> |
118 | 118 | <button data-context="short-ticket" data-datetime-row="<?php echo esc_attr($dtt_row); ?>" |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function is_espresso_event($event = null) |
21 | 21 | { |
22 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
23 | - // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
24 | - $event = EEH_Event_View::get_event($event); |
|
25 | - // do we have a valid event ? |
|
26 | - return $event instanceof EE_Event; |
|
27 | - } |
|
28 | - return false; |
|
22 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
23 | + // extract EE_Event object from passed param regardless of what it is (within reason of course) |
|
24 | + $event = EEH_Event_View::get_event($event); |
|
25 | + // do we have a valid event ? |
|
26 | + return $event instanceof EE_Event; |
|
27 | + } |
|
28 | + return false; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | */ |
37 | 37 | function is_espresso_event_single() |
38 | 38 | { |
39 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
40 | - global $wp_query; |
|
41 | - // return conditionals set by CPTs |
|
42 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false; |
|
43 | - } |
|
44 | - return false; |
|
39 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
40 | + global $wp_query; |
|
41 | + // return conditionals set by CPTs |
|
42 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false; |
|
43 | + } |
|
44 | + return false; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function is_espresso_event_archive() |
54 | 54 | { |
55 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
56 | - global $wp_query; |
|
57 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false; |
|
58 | - } |
|
59 | - return false; |
|
55 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
56 | + global $wp_query; |
|
57 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false; |
|
58 | + } |
|
59 | + return false; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function is_espresso_event_taxonomy() |
69 | 69 | { |
70 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
71 | - global $wp_query; |
|
72 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false; |
|
73 | - } |
|
74 | - return false; |
|
70 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
71 | + global $wp_query; |
|
72 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false; |
|
73 | + } |
|
74 | + return false; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function is_espresso_venue($venue = null) |
87 | 87 | { |
88 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
89 | - // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
90 | - $venue = EEH_Venue_View::get_venue($venue, false); |
|
91 | - // do we have a valid event ? |
|
92 | - return $venue instanceof EE_Venue; |
|
93 | - } |
|
94 | - return false; |
|
88 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
89 | + // extract EE_Venue object from passed param regardless of what it is (within reason of course) |
|
90 | + $venue = EEH_Venue_View::get_venue($venue, false); |
|
91 | + // do we have a valid event ? |
|
92 | + return $venue instanceof EE_Venue; |
|
93 | + } |
|
94 | + return false; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -102,11 +102,11 @@ discard block |
||
102 | 102 | */ |
103 | 103 | function is_espresso_venue_single() |
104 | 104 | { |
105 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
106 | - global $wp_query; |
|
107 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false; |
|
108 | - } |
|
109 | - return false; |
|
105 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
106 | + global $wp_query; |
|
107 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false; |
|
108 | + } |
|
109 | + return false; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /** |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | function is_espresso_venue_archive() |
119 | 119 | { |
120 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
121 | - global $wp_query; |
|
122 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false; |
|
123 | - } |
|
124 | - return false; |
|
120 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
121 | + global $wp_query; |
|
122 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false; |
|
123 | + } |
|
124 | + return false; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function is_espresso_venue_taxonomy() |
134 | 134 | { |
135 | - if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | - global $wp_query; |
|
137 | - return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false; |
|
138 | - } |
|
139 | - return false; |
|
135 | + if (can_use_espresso_conditionals(__FUNCTION__)) { |
|
136 | + global $wp_query; |
|
137 | + return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false; |
|
138 | + } |
|
139 | + return false; |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -148,62 +148,62 @@ discard block |
||
148 | 148 | */ |
149 | 149 | function can_use_espresso_conditionals($conditional_tag) |
150 | 150 | { |
151 | - if (! did_action('AHEE__EE_System__initialize')) { |
|
152 | - EE_Error::doing_it_wrong( |
|
153 | - __FUNCTION__, |
|
154 | - sprintf( |
|
155 | - esc_html__( |
|
156 | - 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
157 | - 'event_espresso' |
|
158 | - ), |
|
159 | - $conditional_tag |
|
160 | - ), |
|
161 | - '4.4.0' |
|
162 | - ); |
|
163 | - return false; |
|
164 | - } |
|
165 | - return true; |
|
151 | + if (! did_action('AHEE__EE_System__initialize')) { |
|
152 | + EE_Error::doing_it_wrong( |
|
153 | + __FUNCTION__, |
|
154 | + sprintf( |
|
155 | + esc_html__( |
|
156 | + 'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.', |
|
157 | + 'event_espresso' |
|
158 | + ), |
|
159 | + $conditional_tag |
|
160 | + ), |
|
161 | + '4.4.0' |
|
162 | + ); |
|
163 | + return false; |
|
164 | + } |
|
165 | + return true; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
169 | 169 | /*************************** Event Queries ***************************/ |
170 | 170 | |
171 | 171 | if (! function_exists('espresso_get_events')) { |
172 | - /** |
|
173 | - * espresso_get_events |
|
174 | - * |
|
175 | - * @param array $params |
|
176 | - * @return array |
|
177 | - */ |
|
178 | - function espresso_get_events($params = []) |
|
179 | - { |
|
180 | - //set default params |
|
181 | - $default_espresso_events_params = [ |
|
182 | - 'limit' => 10, |
|
183 | - 'show_expired' => false, |
|
184 | - 'month' => null, |
|
185 | - 'category_slug' => null, |
|
186 | - 'order_by' => 'start_date', |
|
187 | - 'sort' => 'ASC', |
|
188 | - ]; |
|
189 | - // allow the defaults to be filtered |
|
190 | - $default_espresso_events_params = apply_filters( |
|
191 | - 'espresso_get_events__default_espresso_events_params', |
|
192 | - $default_espresso_events_params |
|
193 | - ); |
|
194 | - // grab params and merge with defaults, then extract |
|
195 | - $params = array_merge($default_espresso_events_params, $params); |
|
196 | - // run the query |
|
197 | - $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
198 | - // assign results to a variable so we can return it |
|
199 | - $events = $events_query->have_posts() ? $events_query->posts : []; |
|
200 | - // but first reset the query and postdata |
|
201 | - wp_reset_query(); |
|
202 | - wp_reset_postdata(); |
|
203 | - EED_Events_Archive::remove_all_events_archive_filters(); |
|
204 | - unset($events_query); |
|
205 | - return $events; |
|
206 | - } |
|
172 | + /** |
|
173 | + * espresso_get_events |
|
174 | + * |
|
175 | + * @param array $params |
|
176 | + * @return array |
|
177 | + */ |
|
178 | + function espresso_get_events($params = []) |
|
179 | + { |
|
180 | + //set default params |
|
181 | + $default_espresso_events_params = [ |
|
182 | + 'limit' => 10, |
|
183 | + 'show_expired' => false, |
|
184 | + 'month' => null, |
|
185 | + 'category_slug' => null, |
|
186 | + 'order_by' => 'start_date', |
|
187 | + 'sort' => 'ASC', |
|
188 | + ]; |
|
189 | + // allow the defaults to be filtered |
|
190 | + $default_espresso_events_params = apply_filters( |
|
191 | + 'espresso_get_events__default_espresso_events_params', |
|
192 | + $default_espresso_events_params |
|
193 | + ); |
|
194 | + // grab params and merge with defaults, then extract |
|
195 | + $params = array_merge($default_espresso_events_params, $params); |
|
196 | + // run the query |
|
197 | + $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params); |
|
198 | + // assign results to a variable so we can return it |
|
199 | + $events = $events_query->have_posts() ? $events_query->posts : []; |
|
200 | + // but first reset the query and postdata |
|
201 | + wp_reset_query(); |
|
202 | + wp_reset_postdata(); |
|
203 | + EED_Events_Archive::remove_all_events_archive_filters(); |
|
204 | + unset($events_query); |
|
205 | + return $events; |
|
206 | + } |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -218,357 +218,357 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function espresso_load_ticket_selector() |
220 | 220 | { |
221 | - EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
221 | + EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | if (! function_exists('espresso_ticket_selector')) { |
225 | - /** |
|
226 | - * espresso_ticket_selector |
|
227 | - * |
|
228 | - * @param null $event |
|
229 | - * @throws EE_Error |
|
230 | - * @throws ReflectionException |
|
231 | - */ |
|
232 | - function espresso_ticket_selector($event = null) |
|
233 | - { |
|
234 | - if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
235 | - espresso_load_ticket_selector(); |
|
236 | - EED_Ticket_Selector::set_definitions(); |
|
237 | - echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
238 | - } |
|
239 | - } |
|
225 | + /** |
|
226 | + * espresso_ticket_selector |
|
227 | + * |
|
228 | + * @param null $event |
|
229 | + * @throws EE_Error |
|
230 | + * @throws ReflectionException |
|
231 | + */ |
|
232 | + function espresso_ticket_selector($event = null) |
|
233 | + { |
|
234 | + if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) { |
|
235 | + espresso_load_ticket_selector(); |
|
236 | + EED_Ticket_Selector::set_definitions(); |
|
237 | + echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped |
|
238 | + } |
|
239 | + } |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
243 | 243 | if (! function_exists('espresso_view_details_btn')) { |
244 | - /** |
|
245 | - * espresso_view_details_btn |
|
246 | - * |
|
247 | - * @param null $event |
|
248 | - * @throws EE_Error |
|
249 | - * @throws ReflectionException |
|
250 | - */ |
|
251 | - function espresso_view_details_btn($event = null) |
|
252 | - { |
|
253 | - if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
254 | - espresso_load_ticket_selector(); |
|
255 | - echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
256 | - } |
|
257 | - } |
|
244 | + /** |
|
245 | + * espresso_view_details_btn |
|
246 | + * |
|
247 | + * @param null $event |
|
248 | + * @throws EE_Error |
|
249 | + * @throws ReflectionException |
|
250 | + */ |
|
251 | + function espresso_view_details_btn($event = null) |
|
252 | + { |
|
253 | + if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) { |
|
254 | + espresso_load_ticket_selector(); |
|
255 | + echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped |
|
256 | + } |
|
257 | + } |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
261 | 261 | /*************************** EEH_Event_View ***************************/ |
262 | 262 | |
263 | 263 | if (! function_exists('espresso_load_event_list_assets')) { |
264 | - /** |
|
265 | - * espresso_load_event_list_assets |
|
266 | - * ensures that event list styles and scripts are loaded |
|
267 | - * |
|
268 | - * @return void |
|
269 | - */ |
|
270 | - function espresso_load_event_list_assets() |
|
271 | - { |
|
272 | - $event_list = EED_Events_Archive::instance(); |
|
273 | - add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
274 | - add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
275 | - } |
|
264 | + /** |
|
265 | + * espresso_load_event_list_assets |
|
266 | + * ensures that event list styles and scripts are loaded |
|
267 | + * |
|
268 | + * @return void |
|
269 | + */ |
|
270 | + function espresso_load_event_list_assets() |
|
271 | + { |
|
272 | + $event_list = EED_Events_Archive::instance(); |
|
273 | + add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10); |
|
274 | + add_filter('FHEE_enable_default_espresso_css', '__return_true'); |
|
275 | + } |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
279 | 279 | if (! function_exists('espresso_event_reg_button')) { |
280 | - /** |
|
281 | - * espresso_event_reg_button |
|
282 | - * returns the "Register Now" button if event is active, |
|
283 | - * an inactive button like status banner if the event is not active |
|
284 | - * or a "Read More" button if so desired |
|
285 | - * |
|
286 | - * @param null $btn_text_if_active |
|
287 | - * @param bool $btn_text_if_inactive |
|
288 | - * @param bool $EVT_ID |
|
289 | - * @return void |
|
290 | - * @throws EE_Error |
|
291 | - * @throws ReflectionException |
|
292 | - */ |
|
293 | - function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
294 | - { |
|
295 | - $event = EEH_Event_View::get_event($EVT_ID); |
|
296 | - if (! $event instanceof EE_Event) { |
|
297 | - return; |
|
298 | - } |
|
299 | - $event_status = $event->get_active_status(); |
|
300 | - switch ($event_status) { |
|
301 | - case EE_Datetime::sold_out : |
|
302 | - $btn_text = __('Sold Out', 'event_espresso'); |
|
303 | - $class = 'ee-pink'; |
|
304 | - break; |
|
305 | - case EE_Datetime::expired : |
|
306 | - $btn_text = __('Event is Over', 'event_espresso'); |
|
307 | - $class = 'ee-grey'; |
|
308 | - break; |
|
309 | - case EE_Datetime::inactive : |
|
310 | - $btn_text = __('Event Not Active', 'event_espresso'); |
|
311 | - $class = 'ee-grey'; |
|
312 | - break; |
|
313 | - case EE_Datetime::cancelled : |
|
314 | - $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
315 | - $class = 'ee-red'; |
|
316 | - break; |
|
317 | - case EE_Datetime::upcoming : |
|
318 | - case EE_Datetime::active : |
|
319 | - default : |
|
320 | - $btn_text = ! empty($btn_text_if_active) |
|
321 | - ? $btn_text_if_active |
|
322 | - : __('Register Now', 'event_espresso'); |
|
323 | - $class = 'ee-green'; |
|
324 | - } |
|
325 | - if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
326 | - $btn_text = $btn_text_if_inactive; |
|
327 | - $class = 'ee-grey'; |
|
328 | - } |
|
329 | - ?> |
|
280 | + /** |
|
281 | + * espresso_event_reg_button |
|
282 | + * returns the "Register Now" button if event is active, |
|
283 | + * an inactive button like status banner if the event is not active |
|
284 | + * or a "Read More" button if so desired |
|
285 | + * |
|
286 | + * @param null $btn_text_if_active |
|
287 | + * @param bool $btn_text_if_inactive |
|
288 | + * @param bool $EVT_ID |
|
289 | + * @return void |
|
290 | + * @throws EE_Error |
|
291 | + * @throws ReflectionException |
|
292 | + */ |
|
293 | + function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false) |
|
294 | + { |
|
295 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
296 | + if (! $event instanceof EE_Event) { |
|
297 | + return; |
|
298 | + } |
|
299 | + $event_status = $event->get_active_status(); |
|
300 | + switch ($event_status) { |
|
301 | + case EE_Datetime::sold_out : |
|
302 | + $btn_text = __('Sold Out', 'event_espresso'); |
|
303 | + $class = 'ee-pink'; |
|
304 | + break; |
|
305 | + case EE_Datetime::expired : |
|
306 | + $btn_text = __('Event is Over', 'event_espresso'); |
|
307 | + $class = 'ee-grey'; |
|
308 | + break; |
|
309 | + case EE_Datetime::inactive : |
|
310 | + $btn_text = __('Event Not Active', 'event_espresso'); |
|
311 | + $class = 'ee-grey'; |
|
312 | + break; |
|
313 | + case EE_Datetime::cancelled : |
|
314 | + $btn_text = __('Event was Cancelled', 'event_espresso'); |
|
315 | + $class = 'ee-red'; |
|
316 | + break; |
|
317 | + case EE_Datetime::upcoming : |
|
318 | + case EE_Datetime::active : |
|
319 | + default : |
|
320 | + $btn_text = ! empty($btn_text_if_active) |
|
321 | + ? $btn_text_if_active |
|
322 | + : __('Register Now', 'event_espresso'); |
|
323 | + $class = 'ee-green'; |
|
324 | + } |
|
325 | + if ($event_status < 1 && ! empty($btn_text_if_inactive)) { |
|
326 | + $btn_text = $btn_text_if_inactive; |
|
327 | + $class = 'ee-grey'; |
|
328 | + } |
|
329 | + ?> |
|
330 | 330 | <a class="ee-button ee-register-button <?php echo esc_attr($class); ?>" |
331 | 331 | href="<?php espresso_event_link_url($EVT_ID); ?>" |
332 | 332 | <?php echo EED_Events_Archive::link_target(); // already escaped |
333 | - ?> |
|
333 | + ?> |
|
334 | 334 | > |
335 | 335 | <?php echo esc_html($btn_text); ?> |
336 | 336 | </a> |
337 | 337 | <?php |
338 | - } |
|
338 | + } |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | |
342 | 342 | if (! function_exists('espresso_display_ticket_selector')) { |
343 | - /** |
|
344 | - * espresso_display_ticket_selector |
|
345 | - * whether or not to display the Ticket Selector for an event |
|
346 | - * |
|
347 | - * @param bool $EVT_ID |
|
348 | - * @return boolean |
|
349 | - * @throws EE_Error |
|
350 | - * @throws ReflectionException |
|
351 | - */ |
|
352 | - function espresso_display_ticket_selector($EVT_ID = false) |
|
353 | - { |
|
354 | - return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
355 | - } |
|
343 | + /** |
|
344 | + * espresso_display_ticket_selector |
|
345 | + * whether or not to display the Ticket Selector for an event |
|
346 | + * |
|
347 | + * @param bool $EVT_ID |
|
348 | + * @return boolean |
|
349 | + * @throws EE_Error |
|
350 | + * @throws ReflectionException |
|
351 | + */ |
|
352 | + function espresso_display_ticket_selector($EVT_ID = false) |
|
353 | + { |
|
354 | + return EEH_Event_View::display_ticket_selector($EVT_ID); |
|
355 | + } |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
359 | 359 | if (! function_exists('espresso_event_status_banner')) { |
360 | - /** |
|
361 | - * espresso_event_status |
|
362 | - * returns a banner showing the event status if it is sold out, expired, or inactive |
|
363 | - * |
|
364 | - * @param bool $EVT_ID |
|
365 | - * @return string |
|
366 | - * @throws EE_Error |
|
367 | - * @throws ReflectionException |
|
368 | - */ |
|
369 | - function espresso_event_status_banner($EVT_ID = false) |
|
370 | - { |
|
371 | - return EEH_Event_View::event_status($EVT_ID); |
|
372 | - } |
|
360 | + /** |
|
361 | + * espresso_event_status |
|
362 | + * returns a banner showing the event status if it is sold out, expired, or inactive |
|
363 | + * |
|
364 | + * @param bool $EVT_ID |
|
365 | + * @return string |
|
366 | + * @throws EE_Error |
|
367 | + * @throws ReflectionException |
|
368 | + */ |
|
369 | + function espresso_event_status_banner($EVT_ID = false) |
|
370 | + { |
|
371 | + return EEH_Event_View::event_status($EVT_ID); |
|
372 | + } |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | |
376 | 376 | if (! function_exists('espresso_event_status')) { |
377 | - /** |
|
378 | - * espresso_event_status |
|
379 | - * returns the event status if it is sold out, expired, or inactive |
|
380 | - * |
|
381 | - * @param int $EVT_ID |
|
382 | - * @param bool $echo |
|
383 | - * @return string |
|
384 | - * @throws EE_Error |
|
385 | - * @throws ReflectionException |
|
386 | - */ |
|
387 | - function espresso_event_status($EVT_ID = 0, $echo = true) |
|
388 | - { |
|
389 | - return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
390 | - } |
|
377 | + /** |
|
378 | + * espresso_event_status |
|
379 | + * returns the event status if it is sold out, expired, or inactive |
|
380 | + * |
|
381 | + * @param int $EVT_ID |
|
382 | + * @param bool $echo |
|
383 | + * @return string |
|
384 | + * @throws EE_Error |
|
385 | + * @throws ReflectionException |
|
386 | + */ |
|
387 | + function espresso_event_status($EVT_ID = 0, $echo = true) |
|
388 | + { |
|
389 | + return EEH_Event_View::event_active_status($EVT_ID, $echo); |
|
390 | + } |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | |
394 | 394 | if (! function_exists('espresso_event_categories')) { |
395 | - /** |
|
396 | - * espresso_event_categories |
|
397 | - * returns the terms associated with an event |
|
398 | - * |
|
399 | - * @param int $EVT_ID |
|
400 | - * @param bool $hide_uncategorized |
|
401 | - * @param bool $echo |
|
402 | - * @return string |
|
403 | - * @throws EE_Error |
|
404 | - * @throws ReflectionException |
|
405 | - */ |
|
406 | - function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
407 | - { |
|
408 | - if ($echo) { |
|
409 | - echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped |
|
410 | - return ''; |
|
411 | - } |
|
412 | - return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
413 | - } |
|
395 | + /** |
|
396 | + * espresso_event_categories |
|
397 | + * returns the terms associated with an event |
|
398 | + * |
|
399 | + * @param int $EVT_ID |
|
400 | + * @param bool $hide_uncategorized |
|
401 | + * @param bool $echo |
|
402 | + * @return string |
|
403 | + * @throws EE_Error |
|
404 | + * @throws ReflectionException |
|
405 | + */ |
|
406 | + function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true) |
|
407 | + { |
|
408 | + if ($echo) { |
|
409 | + echo EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); // already escaped |
|
410 | + return ''; |
|
411 | + } |
|
412 | + return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized); |
|
413 | + } |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | |
417 | 417 | if (! function_exists('espresso_event_tickets_available')) { |
418 | - /** |
|
419 | - * espresso_event_tickets_available |
|
420 | - * returns the ticket types available for purchase for an event |
|
421 | - * |
|
422 | - * @param int $EVT_ID |
|
423 | - * @param bool $echo |
|
424 | - * @param bool $format |
|
425 | - * @return string |
|
426 | - * @throws EE_Error |
|
427 | - * @throws ReflectionException |
|
428 | - */ |
|
429 | - function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
430 | - { |
|
431 | - $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
432 | - if (is_array($tickets) && ! empty($tickets)) { |
|
433 | - // if formatting then $html will be a string, else it will be an array of ticket objects |
|
434 | - $html = |
|
435 | - $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
436 | - foreach ($tickets as $ticket) { |
|
437 | - if ($ticket instanceof EE_Ticket) { |
|
438 | - if ($format) { |
|
439 | - $html .= '<li id="ee-event-tickets-li-' |
|
440 | - . esc_attr($ticket->ID()) |
|
441 | - . '" class="ee-event-tickets-li">'; |
|
442 | - $html .= esc_html($ticket->name()) . ' '; |
|
443 | - $html .= EEH_Template::format_currency( |
|
444 | - $ticket->get_ticket_total_with_taxes() |
|
445 | - ); // already escaped |
|
446 | - $html .= '</li>'; |
|
447 | - } else { |
|
448 | - $html[] = $ticket; |
|
449 | - } |
|
450 | - } |
|
451 | - } |
|
452 | - if ($format) { |
|
453 | - $html .= '</ul>'; |
|
454 | - } |
|
455 | - if ($echo && $format) { |
|
456 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
457 | - return ''; |
|
458 | - } |
|
459 | - return $html; |
|
460 | - } |
|
461 | - return ''; |
|
462 | - } |
|
418 | + /** |
|
419 | + * espresso_event_tickets_available |
|
420 | + * returns the ticket types available for purchase for an event |
|
421 | + * |
|
422 | + * @param int $EVT_ID |
|
423 | + * @param bool $echo |
|
424 | + * @param bool $format |
|
425 | + * @return string |
|
426 | + * @throws EE_Error |
|
427 | + * @throws ReflectionException |
|
428 | + */ |
|
429 | + function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true) |
|
430 | + { |
|
431 | + $tickets = EEH_Event_View::event_tickets_available($EVT_ID); |
|
432 | + if (is_array($tickets) && ! empty($tickets)) { |
|
433 | + // if formatting then $html will be a string, else it will be an array of ticket objects |
|
434 | + $html = |
|
435 | + $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : []; |
|
436 | + foreach ($tickets as $ticket) { |
|
437 | + if ($ticket instanceof EE_Ticket) { |
|
438 | + if ($format) { |
|
439 | + $html .= '<li id="ee-event-tickets-li-' |
|
440 | + . esc_attr($ticket->ID()) |
|
441 | + . '" class="ee-event-tickets-li">'; |
|
442 | + $html .= esc_html($ticket->name()) . ' '; |
|
443 | + $html .= EEH_Template::format_currency( |
|
444 | + $ticket->get_ticket_total_with_taxes() |
|
445 | + ); // already escaped |
|
446 | + $html .= '</li>'; |
|
447 | + } else { |
|
448 | + $html[] = $ticket; |
|
449 | + } |
|
450 | + } |
|
451 | + } |
|
452 | + if ($format) { |
|
453 | + $html .= '</ul>'; |
|
454 | + } |
|
455 | + if ($echo && $format) { |
|
456 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
457 | + return ''; |
|
458 | + } |
|
459 | + return $html; |
|
460 | + } |
|
461 | + return ''; |
|
462 | + } |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | if (! function_exists('espresso_event_date_obj')) { |
466 | - /** |
|
467 | - * espresso_event_date_obj |
|
468 | - * returns the primary date object for an event |
|
469 | - * |
|
470 | - * @param bool $EVT_ID |
|
471 | - * @return EE_Datetime|null |
|
472 | - * @throws EE_Error |
|
473 | - * @throws ReflectionException |
|
474 | - */ |
|
475 | - function espresso_event_date_obj($EVT_ID = false) |
|
476 | - { |
|
477 | - return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
478 | - } |
|
466 | + /** |
|
467 | + * espresso_event_date_obj |
|
468 | + * returns the primary date object for an event |
|
469 | + * |
|
470 | + * @param bool $EVT_ID |
|
471 | + * @return EE_Datetime|null |
|
472 | + * @throws EE_Error |
|
473 | + * @throws ReflectionException |
|
474 | + */ |
|
475 | + function espresso_event_date_obj($EVT_ID = false) |
|
476 | + { |
|
477 | + return EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
478 | + } |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | |
482 | 482 | if (! function_exists('espresso_event_date')) { |
483 | - /** |
|
484 | - * espresso_event_date |
|
485 | - * returns the primary date for an event |
|
486 | - * |
|
487 | - * @param string $date_format |
|
488 | - * @param string $time_format |
|
489 | - * @param bool $EVT_ID |
|
490 | - * @param bool $echo |
|
491 | - * @return string |
|
492 | - * @throws EE_Error |
|
493 | - * @throws ReflectionException |
|
494 | - */ |
|
495 | - function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
496 | - { |
|
497 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
498 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
499 | - $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
500 | - $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
501 | - if ($echo) { |
|
502 | - echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped |
|
503 | - return ''; |
|
504 | - } |
|
505 | - return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
506 | - |
|
507 | - } |
|
483 | + /** |
|
484 | + * espresso_event_date |
|
485 | + * returns the primary date for an event |
|
486 | + * |
|
487 | + * @param string $date_format |
|
488 | + * @param string $time_format |
|
489 | + * @param bool $EVT_ID |
|
490 | + * @param bool $echo |
|
491 | + * @return string |
|
492 | + * @throws EE_Error |
|
493 | + * @throws ReflectionException |
|
494 | + */ |
|
495 | + function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
496 | + { |
|
497 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
498 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
499 | + $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format); |
|
500 | + $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format); |
|
501 | + if ($echo) { |
|
502 | + echo EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); // already escaped |
|
503 | + return ''; |
|
504 | + } |
|
505 | + return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID); |
|
506 | + |
|
507 | + } |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
511 | 511 | if (! function_exists('espresso_list_of_event_dates')) { |
512 | - /** |
|
513 | - * espresso_list_of_event_dates |
|
514 | - * returns a unordered list of dates for an event |
|
515 | - * |
|
516 | - * @param int $EVT_ID |
|
517 | - * @param string $date_format |
|
518 | - * @param string $time_format |
|
519 | - * @param bool $echo |
|
520 | - * @param null $show_expired |
|
521 | - * @param bool $format |
|
522 | - * @param bool $add_breaks |
|
523 | - * @param null $limit |
|
524 | - * @return string |
|
525 | - * @throws EE_Error |
|
526 | - * @throws ReflectionException |
|
527 | - */ |
|
528 | - function espresso_list_of_event_dates( |
|
529 | - $EVT_ID = 0, |
|
530 | - $date_format = '', |
|
531 | - $time_format = '', |
|
532 | - $echo = true, |
|
533 | - $show_expired = null, |
|
534 | - $format = true, |
|
535 | - $add_breaks = true, |
|
536 | - $limit = null |
|
537 | - ) { |
|
538 | - $allowedtags = AllowedTags::getAllowedTags(); |
|
539 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
540 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
541 | - $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
542 | - $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
543 | - $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit); |
|
544 | - if (! $format) { |
|
545 | - return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
546 | - } |
|
547 | - $newline = $add_breaks ? '<br />' : ''; |
|
548 | - if (is_array($datetimes) && ! empty($datetimes)) { |
|
549 | - global $post; |
|
550 | - $html = |
|
551 | - '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">'; |
|
552 | - foreach ($datetimes as $datetime) { |
|
553 | - if ($datetime instanceof EE_Datetime) { |
|
554 | - |
|
555 | - $datetime_name = $datetime->name(); |
|
556 | - $datetime_html = ! empty($datetime_name) |
|
557 | - ? ' |
|
512 | + /** |
|
513 | + * espresso_list_of_event_dates |
|
514 | + * returns a unordered list of dates for an event |
|
515 | + * |
|
516 | + * @param int $EVT_ID |
|
517 | + * @param string $date_format |
|
518 | + * @param string $time_format |
|
519 | + * @param bool $echo |
|
520 | + * @param null $show_expired |
|
521 | + * @param bool $format |
|
522 | + * @param bool $add_breaks |
|
523 | + * @param null $limit |
|
524 | + * @return string |
|
525 | + * @throws EE_Error |
|
526 | + * @throws ReflectionException |
|
527 | + */ |
|
528 | + function espresso_list_of_event_dates( |
|
529 | + $EVT_ID = 0, |
|
530 | + $date_format = '', |
|
531 | + $time_format = '', |
|
532 | + $echo = true, |
|
533 | + $show_expired = null, |
|
534 | + $format = true, |
|
535 | + $add_breaks = true, |
|
536 | + $limit = null |
|
537 | + ) { |
|
538 | + $allowedtags = AllowedTags::getAllowedTags(); |
|
539 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
540 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
541 | + $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format); |
|
542 | + $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format); |
|
543 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit); |
|
544 | + if (! $format) { |
|
545 | + return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes); |
|
546 | + } |
|
547 | + $newline = $add_breaks ? '<br />' : ''; |
|
548 | + if (is_array($datetimes) && ! empty($datetimes)) { |
|
549 | + global $post; |
|
550 | + $html = |
|
551 | + '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">'; |
|
552 | + foreach ($datetimes as $datetime) { |
|
553 | + if ($datetime instanceof EE_Datetime) { |
|
554 | + |
|
555 | + $datetime_name = $datetime->name(); |
|
556 | + $datetime_html = ! empty($datetime_name) |
|
557 | + ? ' |
|
558 | 558 | <strong class="ee-event-datetimes-li-date-name"> |
559 | 559 | ' . esc_html($datetime_name) . ' |
560 | 560 | </strong>' . $newline |
561 | - : ''; |
|
561 | + : ''; |
|
562 | 562 | |
563 | - $datetime_description = $datetime->description(); |
|
564 | - $datetime_html .= ! empty($datetime_description) |
|
565 | - ? ' |
|
563 | + $datetime_description = $datetime->description(); |
|
564 | + $datetime_html .= ! empty($datetime_description) |
|
565 | + ? ' |
|
566 | 566 | <span class="ee-event-datetimes-li-date-desc"> |
567 | 567 | ' . wp_kses($datetime_description, $allowedtags) . ' |
568 | 568 | </span>' . $newline |
569 | - : ''; |
|
569 | + : ''; |
|
570 | 570 | |
571 | - $datetime_html .= ' |
|
571 | + $datetime_html .= ' |
|
572 | 572 | <span class="dashicons dashicons-calendar"></span> |
573 | 573 | <span class="ee-event-datetimes-li-daterange">' . $datetime->date_range($date_format) . '</span> |
574 | 574 | <br/> |
@@ -576,482 +576,482 @@ discard block |
||
576 | 576 | <span class="ee-event-datetimes-li-timerange">' . $datetime->time_range($time_format) . '</span> |
577 | 577 | '; |
578 | 578 | |
579 | - $datetime_html = apply_filters( |
|
580 | - 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
581 | - $datetime_html, |
|
582 | - $datetime |
|
583 | - ); |
|
579 | + $datetime_html = apply_filters( |
|
580 | + 'FHEE__espresso_list_of_event_dates__datetime_html', |
|
581 | + $datetime_html, |
|
582 | + $datetime |
|
583 | + ); |
|
584 | 584 | |
585 | - $DTD_ID = esc_attr($datetime->ID()); |
|
586 | - $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
585 | + $DTD_ID = esc_attr($datetime->ID()); |
|
586 | + $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status()); |
|
587 | 587 | |
588 | - $html .= ' |
|
588 | + $html .= ' |
|
589 | 589 | <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li' . $active_status . '"> |
590 | 590 | ' . $datetime_html . ' |
591 | 591 | </li>'; |
592 | - } |
|
593 | - } |
|
594 | - $html .= '</ul>'; |
|
595 | - } else { |
|
596 | - $html = |
|
597 | - ' |
|
592 | + } |
|
593 | + } |
|
594 | + $html .= '</ul>'; |
|
595 | + } else { |
|
596 | + $html = |
|
597 | + ' |
|
598 | 598 | <p> |
599 | 599 | <span class="dashicons dashicons-marker pink-text"></span> |
600 | 600 | ' . esc_html__( |
601 | - 'There are no upcoming dates for this event.', |
|
602 | - 'event_espresso' |
|
603 | - ) . ' |
|
601 | + 'There are no upcoming dates for this event.', |
|
602 | + 'event_espresso' |
|
603 | + ) . ' |
|
604 | 604 | </p> |
605 | 605 | <br/>'; |
606 | - } |
|
607 | - if ($echo) { |
|
608 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
609 | - return ''; |
|
610 | - } |
|
611 | - return $html; |
|
612 | - } |
|
606 | + } |
|
607 | + if ($echo) { |
|
608 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
609 | + return ''; |
|
610 | + } |
|
611 | + return $html; |
|
612 | + } |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | |
616 | 616 | if (! function_exists('espresso_event_end_date')) { |
617 | - /** |
|
618 | - * espresso_event_end_date |
|
619 | - * returns the last date for an event |
|
620 | - * |
|
621 | - * @param string $date_format |
|
622 | - * @param string $time_format |
|
623 | - * @param bool $EVT_ID |
|
624 | - * @param bool $echo |
|
625 | - * @return string |
|
626 | - * @throws EE_Error |
|
627 | - * @throws ReflectionException |
|
628 | - */ |
|
629 | - function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
630 | - { |
|
631 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
632 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
633 | - $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
634 | - $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
635 | - if ($echo) { |
|
636 | - echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped |
|
637 | - return ''; |
|
638 | - } |
|
639 | - return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
640 | - } |
|
617 | + /** |
|
618 | + * espresso_event_end_date |
|
619 | + * returns the last date for an event |
|
620 | + * |
|
621 | + * @param string $date_format |
|
622 | + * @param string $time_format |
|
623 | + * @param bool $EVT_ID |
|
624 | + * @param bool $echo |
|
625 | + * @return string |
|
626 | + * @throws EE_Error |
|
627 | + * @throws ReflectionException |
|
628 | + */ |
|
629 | + function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true) |
|
630 | + { |
|
631 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
632 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
633 | + $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format); |
|
634 | + $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format); |
|
635 | + if ($echo) { |
|
636 | + echo EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); // already escaped |
|
637 | + return ''; |
|
638 | + } |
|
639 | + return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID); |
|
640 | + } |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | if (! function_exists('espresso_event_date_range')) { |
644 | - /** |
|
645 | - * espresso_event_date_range |
|
646 | - * returns the first and last chronologically ordered dates for an event (if different) |
|
647 | - * |
|
648 | - * @param string $date_format |
|
649 | - * @param string $time_format |
|
650 | - * @param string $single_date_format |
|
651 | - * @param string $single_time_format |
|
652 | - * @param bool $EVT_ID |
|
653 | - * @param bool $echo |
|
654 | - * @return string |
|
655 | - * @throws EE_Error |
|
656 | - * @throws ReflectionException |
|
657 | - */ |
|
658 | - function espresso_event_date_range( |
|
659 | - $date_format = '', |
|
660 | - $time_format = '', |
|
661 | - $single_date_format = '', |
|
662 | - $single_time_format = '', |
|
663 | - $EVT_ID = false, |
|
664 | - $echo = true |
|
665 | - ) { |
|
666 | - // set and filter date and time formats when a range is returned |
|
667 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
668 | - $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
669 | - // get the start and end date with NO time portion |
|
670 | - $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
671 | - $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
672 | - // now we can determine if date range spans more than one day |
|
673 | - if ($the_event_date != $the_event_end_date) { |
|
674 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
675 | - $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
676 | - $html = sprintf( |
|
677 | - /* translators: 1: first event date, 2: last event date */ |
|
678 | - esc_html__('%1$s - %2$s', 'event_espresso'), |
|
679 | - EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
680 | - EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
681 | - ); |
|
682 | - } else { |
|
683 | - // set and filter date and time formats when only a single datetime is returned |
|
684 | - $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
685 | - $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
686 | - $single_date_format = |
|
687 | - apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
688 | - $single_time_format = |
|
689 | - apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
690 | - $html = |
|
691 | - EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
692 | - } |
|
693 | - if ($echo) { |
|
694 | - echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
695 | - return ''; |
|
696 | - } |
|
697 | - return $html; |
|
698 | - } |
|
644 | + /** |
|
645 | + * espresso_event_date_range |
|
646 | + * returns the first and last chronologically ordered dates for an event (if different) |
|
647 | + * |
|
648 | + * @param string $date_format |
|
649 | + * @param string $time_format |
|
650 | + * @param string $single_date_format |
|
651 | + * @param string $single_time_format |
|
652 | + * @param bool $EVT_ID |
|
653 | + * @param bool $echo |
|
654 | + * @return string |
|
655 | + * @throws EE_Error |
|
656 | + * @throws ReflectionException |
|
657 | + */ |
|
658 | + function espresso_event_date_range( |
|
659 | + $date_format = '', |
|
660 | + $time_format = '', |
|
661 | + $single_date_format = '', |
|
662 | + $single_time_format = '', |
|
663 | + $EVT_ID = false, |
|
664 | + $echo = true |
|
665 | + ) { |
|
666 | + // set and filter date and time formats when a range is returned |
|
667 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
668 | + $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format); |
|
669 | + // get the start and end date with NO time portion |
|
670 | + $the_event_date = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID); |
|
671 | + $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID); |
|
672 | + // now we can determine if date range spans more than one day |
|
673 | + if ($the_event_date != $the_event_end_date) { |
|
674 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
675 | + $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format); |
|
676 | + $html = sprintf( |
|
677 | + /* translators: 1: first event date, 2: last event date */ |
|
678 | + esc_html__('%1$s - %2$s', 'event_espresso'), |
|
679 | + EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID), |
|
680 | + EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID) |
|
681 | + ); |
|
682 | + } else { |
|
683 | + // set and filter date and time formats when only a single datetime is returned |
|
684 | + $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format'); |
|
685 | + $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format'); |
|
686 | + $single_date_format = |
|
687 | + apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format); |
|
688 | + $single_time_format = |
|
689 | + apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format); |
|
690 | + $html = |
|
691 | + EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID); |
|
692 | + } |
|
693 | + if ($echo) { |
|
694 | + echo wp_kses($html, AllowedTags::getAllowedTags()); |
|
695 | + return ''; |
|
696 | + } |
|
697 | + return $html; |
|
698 | + } |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | if (! function_exists('espresso_next_upcoming_datetime_obj')) { |
702 | - /** |
|
703 | - * espresso_next_upcoming_datetime_obj |
|
704 | - * returns the next upcoming datetime object for an event |
|
705 | - * |
|
706 | - * @param int $EVT_ID |
|
707 | - * @return EE_Datetime|null |
|
708 | - * @throws EE_Error |
|
709 | - */ |
|
710 | - function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
711 | - { |
|
712 | - return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
713 | - } |
|
702 | + /** |
|
703 | + * espresso_next_upcoming_datetime_obj |
|
704 | + * returns the next upcoming datetime object for an event |
|
705 | + * |
|
706 | + * @param int $EVT_ID |
|
707 | + * @return EE_Datetime|null |
|
708 | + * @throws EE_Error |
|
709 | + */ |
|
710 | + function espresso_next_upcoming_datetime_obj($EVT_ID = 0) |
|
711 | + { |
|
712 | + return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID); |
|
713 | + } |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | if (! function_exists('espresso_next_upcoming_datetime')) { |
717 | - /** |
|
718 | - * espresso_next_upcoming_datetime |
|
719 | - * returns the start date and time for the next upcoming event. |
|
720 | - * |
|
721 | - * @param string $date_format |
|
722 | - * @param string $time_format |
|
723 | - * @param int $EVT_ID |
|
724 | - * @param bool $echo |
|
725 | - * @return string |
|
726 | - * @throws EE_Error |
|
727 | - * @throws ReflectionException |
|
728 | - */ |
|
729 | - function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
730 | - { |
|
731 | - |
|
732 | - $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
733 | - $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
734 | - |
|
735 | - $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
736 | - $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
737 | - |
|
738 | - $datetime_format = trim($date_format . ' ' . $time_format); |
|
739 | - |
|
740 | - $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
741 | - |
|
742 | - if (! $datetime instanceof EE_Datetime) { |
|
743 | - return ''; |
|
744 | - } |
|
745 | - if ($echo) { |
|
746 | - echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
747 | - return ''; |
|
748 | - } |
|
749 | - return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
750 | - } |
|
717 | + /** |
|
718 | + * espresso_next_upcoming_datetime |
|
719 | + * returns the start date and time for the next upcoming event. |
|
720 | + * |
|
721 | + * @param string $date_format |
|
722 | + * @param string $time_format |
|
723 | + * @param int $EVT_ID |
|
724 | + * @param bool $echo |
|
725 | + * @return string |
|
726 | + * @throws EE_Error |
|
727 | + * @throws ReflectionException |
|
728 | + */ |
|
729 | + function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true) |
|
730 | + { |
|
731 | + |
|
732 | + $date_format = ! empty($date_format) ? $date_format : get_option('date_format'); |
|
733 | + $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format); |
|
734 | + |
|
735 | + $time_format = ! empty($time_format) ? $time_format : get_option('time_format'); |
|
736 | + $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format); |
|
737 | + |
|
738 | + $datetime_format = trim($date_format . ' ' . $time_format); |
|
739 | + |
|
740 | + $datetime = espresso_next_upcoming_datetime_obj($EVT_ID); |
|
741 | + |
|
742 | + if (! $datetime instanceof EE_Datetime) { |
|
743 | + return ''; |
|
744 | + } |
|
745 | + if ($echo) { |
|
746 | + echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format)); |
|
747 | + return ''; |
|
748 | + } |
|
749 | + return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format); |
|
750 | + } |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | if (! function_exists('espresso_event_date_as_calendar_page')) { |
754 | - /** |
|
755 | - * espresso_event_date_as_calendar_page |
|
756 | - * returns the primary date for an event, stylized to appear as the page of a calendar |
|
757 | - * |
|
758 | - * @param bool $EVT_ID |
|
759 | - * @return void |
|
760 | - * @throws EE_Error |
|
761 | - * @throws ReflectionException |
|
762 | - */ |
|
763 | - function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
764 | - { |
|
765 | - EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
766 | - } |
|
754 | + /** |
|
755 | + * espresso_event_date_as_calendar_page |
|
756 | + * returns the primary date for an event, stylized to appear as the page of a calendar |
|
757 | + * |
|
758 | + * @param bool $EVT_ID |
|
759 | + * @return void |
|
760 | + * @throws EE_Error |
|
761 | + * @throws ReflectionException |
|
762 | + */ |
|
763 | + function espresso_event_date_as_calendar_page($EVT_ID = false) |
|
764 | + { |
|
765 | + EEH_Event_View::event_date_as_calendar_page($EVT_ID); |
|
766 | + } |
|
767 | 767 | } |
768 | 768 | |
769 | 769 | |
770 | 770 | if (! function_exists('espresso_event_link_url')) { |
771 | - /** |
|
772 | - * espresso_event_link_url |
|
773 | - * |
|
774 | - * @param int $EVT_ID |
|
775 | - * @param bool $echo |
|
776 | - * @return string |
|
777 | - * @throws EE_Error |
|
778 | - * @throws ReflectionException |
|
779 | - */ |
|
780 | - function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
781 | - { |
|
782 | - if ($echo) { |
|
783 | - echo EEH_Event_View::event_link_url($EVT_ID); // already escaped |
|
784 | - return ''; |
|
785 | - } |
|
786 | - return EEH_Event_View::event_link_url($EVT_ID); |
|
787 | - } |
|
771 | + /** |
|
772 | + * espresso_event_link_url |
|
773 | + * |
|
774 | + * @param int $EVT_ID |
|
775 | + * @param bool $echo |
|
776 | + * @return string |
|
777 | + * @throws EE_Error |
|
778 | + * @throws ReflectionException |
|
779 | + */ |
|
780 | + function espresso_event_link_url($EVT_ID = 0, $echo = true) |
|
781 | + { |
|
782 | + if ($echo) { |
|
783 | + echo EEH_Event_View::event_link_url($EVT_ID); // already escaped |
|
784 | + return ''; |
|
785 | + } |
|
786 | + return EEH_Event_View::event_link_url($EVT_ID); |
|
787 | + } |
|
788 | 788 | } |
789 | 789 | |
790 | 790 | |
791 | 791 | if (! function_exists('espresso_event_has_content_or_excerpt')) { |
792 | - /** |
|
793 | - * espresso_event_has_content_or_excerpt |
|
794 | - * |
|
795 | - * @access public |
|
796 | - * @param bool $EVT_ID |
|
797 | - * @return boolean |
|
798 | - * @throws EE_Error |
|
799 | - * @throws ReflectionException |
|
800 | - */ |
|
801 | - function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
802 | - { |
|
803 | - return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
804 | - } |
|
792 | + /** |
|
793 | + * espresso_event_has_content_or_excerpt |
|
794 | + * |
|
795 | + * @access public |
|
796 | + * @param bool $EVT_ID |
|
797 | + * @return boolean |
|
798 | + * @throws EE_Error |
|
799 | + * @throws ReflectionException |
|
800 | + */ |
|
801 | + function espresso_event_has_content_or_excerpt($EVT_ID = false) |
|
802 | + { |
|
803 | + return EEH_Event_View::event_has_content_or_excerpt($EVT_ID); |
|
804 | + } |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | |
808 | 808 | if (! function_exists('espresso_event_content_or_excerpt')) { |
809 | - /** |
|
810 | - * espresso_event_content_or_excerpt |
|
811 | - * |
|
812 | - * @param int $num_words |
|
813 | - * @param null $more |
|
814 | - * @param bool $echo |
|
815 | - * @return string |
|
816 | - */ |
|
817 | - function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
818 | - { |
|
819 | - if ($echo) { |
|
820 | - echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped |
|
821 | - return ''; |
|
822 | - } |
|
823 | - return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
824 | - } |
|
809 | + /** |
|
810 | + * espresso_event_content_or_excerpt |
|
811 | + * |
|
812 | + * @param int $num_words |
|
813 | + * @param null $more |
|
814 | + * @param bool $echo |
|
815 | + * @return string |
|
816 | + */ |
|
817 | + function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true) |
|
818 | + { |
|
819 | + if ($echo) { |
|
820 | + echo EEH_Event_View::event_content_or_excerpt($num_words, $more); // already escaped |
|
821 | + return ''; |
|
822 | + } |
|
823 | + return EEH_Event_View::event_content_or_excerpt($num_words, $more); |
|
824 | + } |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | |
828 | 828 | if (! function_exists('espresso_event_phone')) { |
829 | - /** |
|
830 | - * espresso_event_phone |
|
831 | - * |
|
832 | - * @param int $EVT_ID |
|
833 | - * @param bool $echo |
|
834 | - * @return string |
|
835 | - * @throws EE_Error |
|
836 | - * @throws ReflectionException |
|
837 | - */ |
|
838 | - function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
839 | - { |
|
840 | - if ($echo) { |
|
841 | - echo EEH_Event_View::event_phone($EVT_ID); // already escaped |
|
842 | - return ''; |
|
843 | - } |
|
844 | - return EEH_Event_View::event_phone($EVT_ID); |
|
845 | - } |
|
829 | + /** |
|
830 | + * espresso_event_phone |
|
831 | + * |
|
832 | + * @param int $EVT_ID |
|
833 | + * @param bool $echo |
|
834 | + * @return string |
|
835 | + * @throws EE_Error |
|
836 | + * @throws ReflectionException |
|
837 | + */ |
|
838 | + function espresso_event_phone($EVT_ID = 0, $echo = true) |
|
839 | + { |
|
840 | + if ($echo) { |
|
841 | + echo EEH_Event_View::event_phone($EVT_ID); // already escaped |
|
842 | + return ''; |
|
843 | + } |
|
844 | + return EEH_Event_View::event_phone($EVT_ID); |
|
845 | + } |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
849 | 849 | if (! function_exists('espresso_edit_event_link')) { |
850 | - /** |
|
851 | - * espresso_edit_event_link |
|
852 | - * returns a link to edit an event |
|
853 | - * |
|
854 | - * @param int $EVT_ID |
|
855 | - * @param bool $echo |
|
856 | - * @return string |
|
857 | - * @throws EE_Error |
|
858 | - * @throws ReflectionException |
|
859 | - */ |
|
860 | - function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
861 | - { |
|
862 | - if ($echo) { |
|
863 | - echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped |
|
864 | - return ''; |
|
865 | - } |
|
866 | - return EEH_Event_View::edit_event_link($EVT_ID); |
|
867 | - } |
|
850 | + /** |
|
851 | + * espresso_edit_event_link |
|
852 | + * returns a link to edit an event |
|
853 | + * |
|
854 | + * @param int $EVT_ID |
|
855 | + * @param bool $echo |
|
856 | + * @return string |
|
857 | + * @throws EE_Error |
|
858 | + * @throws ReflectionException |
|
859 | + */ |
|
860 | + function espresso_edit_event_link($EVT_ID = 0, $echo = true) |
|
861 | + { |
|
862 | + if ($echo) { |
|
863 | + echo EEH_Event_View::edit_event_link($EVT_ID); // already escaped |
|
864 | + return ''; |
|
865 | + } |
|
866 | + return EEH_Event_View::edit_event_link($EVT_ID); |
|
867 | + } |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | |
871 | 871 | if (! function_exists('espresso_organization_name')) { |
872 | - /** |
|
873 | - * espresso_organization_name |
|
874 | - * |
|
875 | - * @param bool $echo |
|
876 | - * @return string |
|
877 | - * @throws EE_Error |
|
878 | - */ |
|
879 | - function espresso_organization_name($echo = true) |
|
880 | - { |
|
881 | - if ($echo) { |
|
882 | - echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped |
|
883 | - return ''; |
|
884 | - } |
|
885 | - return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
886 | - } |
|
872 | + /** |
|
873 | + * espresso_organization_name |
|
874 | + * |
|
875 | + * @param bool $echo |
|
876 | + * @return string |
|
877 | + * @throws EE_Error |
|
878 | + */ |
|
879 | + function espresso_organization_name($echo = true) |
|
880 | + { |
|
881 | + if ($echo) { |
|
882 | + echo EE_Registry::instance()->CFG->organization->get_pretty('name'); // already escaped |
|
883 | + return ''; |
|
884 | + } |
|
885 | + return EE_Registry::instance()->CFG->organization->get_pretty('name'); |
|
886 | + } |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | if (! function_exists('espresso_organization_address')) { |
890 | - /** |
|
891 | - * espresso_organization_address |
|
892 | - * |
|
893 | - * @param string $type |
|
894 | - * @return string |
|
895 | - */ |
|
896 | - function espresso_organization_address($type = 'inline') |
|
897 | - { |
|
898 | - if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
899 | - $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
900 | - EE_Registry::instance()->CFG->organization->address_1, |
|
901 | - EE_Registry::instance()->CFG->organization->address_2, |
|
902 | - EE_Registry::instance()->CFG->organization->city, |
|
903 | - EE_Registry::instance()->CFG->organization->STA_ID, |
|
904 | - EE_Registry::instance()->CFG->organization->zip, |
|
905 | - EE_Registry::instance()->CFG->organization->CNT_ISO |
|
906 | - ); |
|
907 | - return EEH_Address::format($address, $type); |
|
908 | - } |
|
909 | - return ''; |
|
910 | - } |
|
890 | + /** |
|
891 | + * espresso_organization_address |
|
892 | + * |
|
893 | + * @param string $type |
|
894 | + * @return string |
|
895 | + */ |
|
896 | + function espresso_organization_address($type = 'inline') |
|
897 | + { |
|
898 | + if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) { |
|
899 | + $address = new EventEspresso\core\domain\entities\GenericAddress( |
|
900 | + EE_Registry::instance()->CFG->organization->address_1, |
|
901 | + EE_Registry::instance()->CFG->organization->address_2, |
|
902 | + EE_Registry::instance()->CFG->organization->city, |
|
903 | + EE_Registry::instance()->CFG->organization->STA_ID, |
|
904 | + EE_Registry::instance()->CFG->organization->zip, |
|
905 | + EE_Registry::instance()->CFG->organization->CNT_ISO |
|
906 | + ); |
|
907 | + return EEH_Address::format($address, $type); |
|
908 | + } |
|
909 | + return ''; |
|
910 | + } |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | if (! function_exists('espresso_organization_email')) { |
914 | - /** |
|
915 | - * espresso_organization_email |
|
916 | - * |
|
917 | - * @param bool $echo |
|
918 | - * @return string |
|
919 | - * @throws EE_Error |
|
920 | - */ |
|
921 | - function espresso_organization_email($echo = true) |
|
922 | - { |
|
923 | - if ($echo) { |
|
924 | - echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped |
|
925 | - return ''; |
|
926 | - } |
|
927 | - return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
928 | - } |
|
914 | + /** |
|
915 | + * espresso_organization_email |
|
916 | + * |
|
917 | + * @param bool $echo |
|
918 | + * @return string |
|
919 | + * @throws EE_Error |
|
920 | + */ |
|
921 | + function espresso_organization_email($echo = true) |
|
922 | + { |
|
923 | + if ($echo) { |
|
924 | + echo EE_Registry::instance()->CFG->organization->get_pretty('email'); // already escaped |
|
925 | + return ''; |
|
926 | + } |
|
927 | + return EE_Registry::instance()->CFG->organization->get_pretty('email'); |
|
928 | + } |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | if (! function_exists('espresso_organization_logo_url')) { |
932 | - /** |
|
933 | - * espresso_organization_logo_url |
|
934 | - * |
|
935 | - * @param bool $echo |
|
936 | - * @return string |
|
937 | - * @throws EE_Error |
|
938 | - */ |
|
939 | - function espresso_organization_logo_url($echo = true) |
|
940 | - { |
|
941 | - if ($echo) { |
|
942 | - echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped |
|
943 | - return ''; |
|
944 | - } |
|
945 | - return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
946 | - } |
|
932 | + /** |
|
933 | + * espresso_organization_logo_url |
|
934 | + * |
|
935 | + * @param bool $echo |
|
936 | + * @return string |
|
937 | + * @throws EE_Error |
|
938 | + */ |
|
939 | + function espresso_organization_logo_url($echo = true) |
|
940 | + { |
|
941 | + if ($echo) { |
|
942 | + echo EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); // already escaped |
|
943 | + return ''; |
|
944 | + } |
|
945 | + return EE_Registry::instance()->CFG->organization->get_pretty('logo_url'); |
|
946 | + } |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | if (! function_exists('espresso_organization_facebook')) { |
950 | - /** |
|
951 | - * espresso_organization_facebook |
|
952 | - * |
|
953 | - * @param bool $echo |
|
954 | - * @return string |
|
955 | - * @throws EE_Error |
|
956 | - */ |
|
957 | - function espresso_organization_facebook($echo = true) |
|
958 | - { |
|
959 | - if ($echo) { |
|
960 | - echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped |
|
961 | - return ''; |
|
962 | - } |
|
963 | - return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
964 | - } |
|
950 | + /** |
|
951 | + * espresso_organization_facebook |
|
952 | + * |
|
953 | + * @param bool $echo |
|
954 | + * @return string |
|
955 | + * @throws EE_Error |
|
956 | + */ |
|
957 | + function espresso_organization_facebook($echo = true) |
|
958 | + { |
|
959 | + if ($echo) { |
|
960 | + echo EE_Registry::instance()->CFG->organization->get_pretty('facebook'); // already escaped |
|
961 | + return ''; |
|
962 | + } |
|
963 | + return EE_Registry::instance()->CFG->organization->get_pretty('facebook'); |
|
964 | + } |
|
965 | 965 | } |
966 | 966 | |
967 | 967 | if (! function_exists('espresso_organization_twitter')) { |
968 | - /** |
|
969 | - * espresso_organization_twitter |
|
970 | - * |
|
971 | - * @param bool $echo |
|
972 | - * @return string |
|
973 | - * @throws EE_Error |
|
974 | - */ |
|
975 | - function espresso_organization_twitter($echo = true) |
|
976 | - { |
|
977 | - if ($echo) { |
|
978 | - echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped |
|
979 | - return ''; |
|
980 | - } |
|
981 | - return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
982 | - } |
|
968 | + /** |
|
969 | + * espresso_organization_twitter |
|
970 | + * |
|
971 | + * @param bool $echo |
|
972 | + * @return string |
|
973 | + * @throws EE_Error |
|
974 | + */ |
|
975 | + function espresso_organization_twitter($echo = true) |
|
976 | + { |
|
977 | + if ($echo) { |
|
978 | + echo EE_Registry::instance()->CFG->organization->get_pretty('twitter'); // already escaped |
|
979 | + return ''; |
|
980 | + } |
|
981 | + return EE_Registry::instance()->CFG->organization->get_pretty('twitter'); |
|
982 | + } |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | if (! function_exists('espresso_organization_linkedin')) { |
986 | - /** |
|
987 | - * espresso_organization_linkedin |
|
988 | - * |
|
989 | - * @param bool $echo |
|
990 | - * @return string |
|
991 | - * @throws EE_Error |
|
992 | - */ |
|
993 | - function espresso_organization_linkedin($echo = true) |
|
994 | - { |
|
995 | - if ($echo) { |
|
996 | - echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped |
|
997 | - return ''; |
|
998 | - } |
|
999 | - return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
1000 | - } |
|
986 | + /** |
|
987 | + * espresso_organization_linkedin |
|
988 | + * |
|
989 | + * @param bool $echo |
|
990 | + * @return string |
|
991 | + * @throws EE_Error |
|
992 | + */ |
|
993 | + function espresso_organization_linkedin($echo = true) |
|
994 | + { |
|
995 | + if ($echo) { |
|
996 | + echo EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); // already escaped |
|
997 | + return ''; |
|
998 | + } |
|
999 | + return EE_Registry::instance()->CFG->organization->get_pretty('linkedin'); |
|
1000 | + } |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | if (! function_exists('espresso_organization_pinterest')) { |
1004 | - /** |
|
1005 | - * espresso_organization_pinterest |
|
1006 | - * |
|
1007 | - * @param bool $echo |
|
1008 | - * @return string |
|
1009 | - * @throws EE_Error |
|
1010 | - */ |
|
1011 | - function espresso_organization_pinterest($echo = true) |
|
1012 | - { |
|
1013 | - if ($echo) { |
|
1014 | - echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped |
|
1015 | - return ''; |
|
1016 | - } |
|
1017 | - return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
1018 | - } |
|
1004 | + /** |
|
1005 | + * espresso_organization_pinterest |
|
1006 | + * |
|
1007 | + * @param bool $echo |
|
1008 | + * @return string |
|
1009 | + * @throws EE_Error |
|
1010 | + */ |
|
1011 | + function espresso_organization_pinterest($echo = true) |
|
1012 | + { |
|
1013 | + if ($echo) { |
|
1014 | + echo EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); // already escaped |
|
1015 | + return ''; |
|
1016 | + } |
|
1017 | + return EE_Registry::instance()->CFG->organization->get_pretty('pinterest'); |
|
1018 | + } |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | if (! function_exists('espresso_organization_google')) { |
1022 | - /** |
|
1023 | - * espresso_organization_google |
|
1024 | - * |
|
1025 | - * @param bool $echo |
|
1026 | - * @return string |
|
1027 | - * @throws EE_Error |
|
1028 | - */ |
|
1029 | - function espresso_organization_google($echo = true) |
|
1030 | - { |
|
1031 | - if ($echo) { |
|
1032 | - echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped |
|
1033 | - return ''; |
|
1034 | - } |
|
1035 | - return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
1036 | - } |
|
1022 | + /** |
|
1023 | + * espresso_organization_google |
|
1024 | + * |
|
1025 | + * @param bool $echo |
|
1026 | + * @return string |
|
1027 | + * @throws EE_Error |
|
1028 | + */ |
|
1029 | + function espresso_organization_google($echo = true) |
|
1030 | + { |
|
1031 | + if ($echo) { |
|
1032 | + echo EE_Registry::instance()->CFG->organization->get_pretty('google'); // already escaped |
|
1033 | + return ''; |
|
1034 | + } |
|
1035 | + return EE_Registry::instance()->CFG->organization->get_pretty('google'); |
|
1036 | + } |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | if (! function_exists('espresso_organization_instagram')) { |
1040 | - /** |
|
1041 | - * espresso_organization_instagram |
|
1042 | - * |
|
1043 | - * @param bool $echo |
|
1044 | - * @return string |
|
1045 | - * @throws EE_Error |
|
1046 | - */ |
|
1047 | - function espresso_organization_instagram($echo = true) |
|
1048 | - { |
|
1049 | - if ($echo) { |
|
1050 | - echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped |
|
1051 | - return ''; |
|
1052 | - } |
|
1053 | - return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
1054 | - } |
|
1040 | + /** |
|
1041 | + * espresso_organization_instagram |
|
1042 | + * |
|
1043 | + * @param bool $echo |
|
1044 | + * @return string |
|
1045 | + * @throws EE_Error |
|
1046 | + */ |
|
1047 | + function espresso_organization_instagram($echo = true) |
|
1048 | + { |
|
1049 | + if ($echo) { |
|
1050 | + echo EE_Registry::instance()->CFG->organization->get_pretty('instagram'); // already escaped |
|
1051 | + return ''; |
|
1052 | + } |
|
1053 | + return EE_Registry::instance()->CFG->organization->get_pretty('instagram'); |
|
1054 | + } |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | |
@@ -1059,345 +1059,345 @@ discard block |
||
1059 | 1059 | |
1060 | 1060 | |
1061 | 1061 | if (! function_exists('espresso_event_venues')) { |
1062 | - /** |
|
1063 | - * espresso_event_venues |
|
1064 | - * |
|
1065 | - * @return array all venues related to an event |
|
1066 | - * @throws EE_Error |
|
1067 | - * @throws ReflectionException |
|
1068 | - */ |
|
1069 | - function espresso_event_venues() |
|
1070 | - { |
|
1071 | - return EEH_Venue_View::get_event_venues(); |
|
1072 | - } |
|
1062 | + /** |
|
1063 | + * espresso_event_venues |
|
1064 | + * |
|
1065 | + * @return array all venues related to an event |
|
1066 | + * @throws EE_Error |
|
1067 | + * @throws ReflectionException |
|
1068 | + */ |
|
1069 | + function espresso_event_venues() |
|
1070 | + { |
|
1071 | + return EEH_Venue_View::get_event_venues(); |
|
1072 | + } |
|
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | |
1076 | 1076 | if (! function_exists('espresso_venue_id')) { |
1077 | - /** |
|
1078 | - * espresso_venue_name |
|
1079 | - * |
|
1080 | - * @access public |
|
1081 | - * @param int $EVT_ID |
|
1082 | - * @return string |
|
1083 | - * @throws EE_Error |
|
1084 | - * @throws ReflectionException |
|
1085 | - */ |
|
1086 | - function espresso_venue_id($EVT_ID = 0) |
|
1087 | - { |
|
1088 | - $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
1089 | - return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
1090 | - } |
|
1077 | + /** |
|
1078 | + * espresso_venue_name |
|
1079 | + * |
|
1080 | + * @access public |
|
1081 | + * @param int $EVT_ID |
|
1082 | + * @return string |
|
1083 | + * @throws EE_Error |
|
1084 | + * @throws ReflectionException |
|
1085 | + */ |
|
1086 | + function espresso_venue_id($EVT_ID = 0) |
|
1087 | + { |
|
1088 | + $venue = EEH_Venue_View::get_venue($EVT_ID); |
|
1089 | + return $venue instanceof EE_Venue ? $venue->ID() : 0; |
|
1090 | + } |
|
1091 | 1091 | } |
1092 | 1092 | |
1093 | 1093 | |
1094 | 1094 | if (! function_exists('espresso_is_venue_private')) { |
1095 | - /** |
|
1096 | - * Return whether a venue is private or not. |
|
1097 | - * |
|
1098 | - * @param int $VNU_ID optional, the venue id to check. |
|
1099 | - * |
|
1100 | - * @return bool | null |
|
1101 | - * @throws EE_Error |
|
1102 | - * @throws ReflectionException |
|
1103 | - * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
1104 | - */ |
|
1105 | - function espresso_is_venue_private($VNU_ID = 0) |
|
1106 | - { |
|
1107 | - return EEH_Venue_View::is_venue_private($VNU_ID); |
|
1108 | - } |
|
1095 | + /** |
|
1096 | + * Return whether a venue is private or not. |
|
1097 | + * |
|
1098 | + * @param int $VNU_ID optional, the venue id to check. |
|
1099 | + * |
|
1100 | + * @return bool | null |
|
1101 | + * @throws EE_Error |
|
1102 | + * @throws ReflectionException |
|
1103 | + * @see EEH_Venue_View::get_venue() for more info on expected return results. |
|
1104 | + */ |
|
1105 | + function espresso_is_venue_private($VNU_ID = 0) |
|
1106 | + { |
|
1107 | + return EEH_Venue_View::is_venue_private($VNU_ID); |
|
1108 | + } |
|
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | if (! function_exists('espresso_venue_is_password_protected')) { |
1113 | - /** |
|
1114 | - * returns true or false if a venue is password protected or not |
|
1115 | - * |
|
1116 | - * @param int $VNU_ID optional, the venue id to check. |
|
1117 | - * @return bool |
|
1118 | - * @throws EE_Error |
|
1119 | - * @throws ReflectionException |
|
1120 | - */ |
|
1121 | - function espresso_venue_is_password_protected($VNU_ID = 0) |
|
1122 | - { |
|
1123 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
1124 | - return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
1125 | - } |
|
1113 | + /** |
|
1114 | + * returns true or false if a venue is password protected or not |
|
1115 | + * |
|
1116 | + * @param int $VNU_ID optional, the venue id to check. |
|
1117 | + * @return bool |
|
1118 | + * @throws EE_Error |
|
1119 | + * @throws ReflectionException |
|
1120 | + */ |
|
1121 | + function espresso_venue_is_password_protected($VNU_ID = 0) |
|
1122 | + { |
|
1123 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1124 | + return EEH_Venue_View::is_venue_password_protected($VNU_ID); |
|
1125 | + } |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | if (! function_exists('espresso_password_protected_venue_form')) { |
1130 | - /** |
|
1131 | - * Returns a password form if venue is password protected. |
|
1132 | - * |
|
1133 | - * @param int $VNU_ID optional, the venue id to check. |
|
1134 | - * @return string |
|
1135 | - * @throws EE_Error |
|
1136 | - * @throws ReflectionException |
|
1137 | - */ |
|
1138 | - function espresso_password_protected_venue_form($VNU_ID = 0) |
|
1139 | - { |
|
1140 | - EE_Registry::instance()->load_helper('Venue_View'); |
|
1141 | - return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
1142 | - } |
|
1130 | + /** |
|
1131 | + * Returns a password form if venue is password protected. |
|
1132 | + * |
|
1133 | + * @param int $VNU_ID optional, the venue id to check. |
|
1134 | + * @return string |
|
1135 | + * @throws EE_Error |
|
1136 | + * @throws ReflectionException |
|
1137 | + */ |
|
1138 | + function espresso_password_protected_venue_form($VNU_ID = 0) |
|
1139 | + { |
|
1140 | + EE_Registry::instance()->load_helper('Venue_View'); |
|
1141 | + return EEH_Venue_View::password_protected_venue_form($VNU_ID); |
|
1142 | + } |
|
1143 | 1143 | } |
1144 | 1144 | |
1145 | 1145 | |
1146 | 1146 | if (! function_exists('espresso_venue_name')) { |
1147 | - /** |
|
1148 | - * espresso_venue_name |
|
1149 | - * |
|
1150 | - * @access public |
|
1151 | - * @param int $VNU_ID |
|
1152 | - * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
1153 | - * @param bool $echo |
|
1154 | - * @return string |
|
1155 | - * @throws EE_Error |
|
1156 | - * @throws ReflectionException |
|
1157 | - */ |
|
1158 | - function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
1159 | - { |
|
1160 | - if ($echo) { |
|
1161 | - echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped |
|
1162 | - return ''; |
|
1163 | - } |
|
1164 | - return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
1165 | - } |
|
1147 | + /** |
|
1148 | + * espresso_venue_name |
|
1149 | + * |
|
1150 | + * @access public |
|
1151 | + * @param int $VNU_ID |
|
1152 | + * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website |
|
1153 | + * @param bool $echo |
|
1154 | + * @return string |
|
1155 | + * @throws EE_Error |
|
1156 | + * @throws ReflectionException |
|
1157 | + */ |
|
1158 | + function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true) |
|
1159 | + { |
|
1160 | + if ($echo) { |
|
1161 | + echo EEH_Venue_View::venue_name($link_to, $VNU_ID); // already escaped |
|
1162 | + return ''; |
|
1163 | + } |
|
1164 | + return EEH_Venue_View::venue_name($link_to, $VNU_ID); |
|
1165 | + } |
|
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | |
1169 | 1169 | if (! function_exists('espresso_venue_link')) { |
1170 | - /** |
|
1171 | - * espresso_venue_link |
|
1172 | - * |
|
1173 | - * @access public |
|
1174 | - * @param int $VNU_ID |
|
1175 | - * @param string $text |
|
1176 | - * @return string |
|
1177 | - * @throws EE_Error |
|
1178 | - * @throws ReflectionException |
|
1179 | - */ |
|
1180 | - function espresso_venue_link($VNU_ID = 0, $text = '') |
|
1181 | - { |
|
1182 | - return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
1183 | - } |
|
1170 | + /** |
|
1171 | + * espresso_venue_link |
|
1172 | + * |
|
1173 | + * @access public |
|
1174 | + * @param int $VNU_ID |
|
1175 | + * @param string $text |
|
1176 | + * @return string |
|
1177 | + * @throws EE_Error |
|
1178 | + * @throws ReflectionException |
|
1179 | + */ |
|
1180 | + function espresso_venue_link($VNU_ID = 0, $text = '') |
|
1181 | + { |
|
1182 | + return EEH_Venue_View::venue_details_link($VNU_ID, $text); |
|
1183 | + } |
|
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | |
1187 | 1187 | if (! function_exists('espresso_venue_description')) { |
1188 | - /** |
|
1189 | - * espresso_venue_description |
|
1190 | - * |
|
1191 | - * @access public |
|
1192 | - * @param bool $VNU_ID |
|
1193 | - * @param bool $echo |
|
1194 | - * @return string |
|
1195 | - * @throws EE_Error |
|
1196 | - * @throws ReflectionException |
|
1197 | - */ |
|
1198 | - function espresso_venue_description($VNU_ID = false, $echo = true) |
|
1199 | - { |
|
1200 | - if ($echo) { |
|
1201 | - echo EEH_Venue_View::venue_description($VNU_ID); // already escaped |
|
1202 | - return ''; |
|
1203 | - } |
|
1204 | - return EEH_Venue_View::venue_description($VNU_ID); |
|
1205 | - } |
|
1188 | + /** |
|
1189 | + * espresso_venue_description |
|
1190 | + * |
|
1191 | + * @access public |
|
1192 | + * @param bool $VNU_ID |
|
1193 | + * @param bool $echo |
|
1194 | + * @return string |
|
1195 | + * @throws EE_Error |
|
1196 | + * @throws ReflectionException |
|
1197 | + */ |
|
1198 | + function espresso_venue_description($VNU_ID = false, $echo = true) |
|
1199 | + { |
|
1200 | + if ($echo) { |
|
1201 | + echo EEH_Venue_View::venue_description($VNU_ID); // already escaped |
|
1202 | + return ''; |
|
1203 | + } |
|
1204 | + return EEH_Venue_View::venue_description($VNU_ID); |
|
1205 | + } |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | |
1209 | 1209 | if (! function_exists('espresso_venue_excerpt')) { |
1210 | - /** |
|
1211 | - * espresso_venue_excerpt |
|
1212 | - * |
|
1213 | - * @access public |
|
1214 | - * @param int $VNU_ID |
|
1215 | - * @param bool $echo |
|
1216 | - * @return string |
|
1217 | - * @throws EE_Error |
|
1218 | - * @throws ReflectionException |
|
1219 | - */ |
|
1220 | - function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
1221 | - { |
|
1222 | - if ($echo) { |
|
1223 | - echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped |
|
1224 | - return ''; |
|
1225 | - } |
|
1226 | - return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1227 | - } |
|
1210 | + /** |
|
1211 | + * espresso_venue_excerpt |
|
1212 | + * |
|
1213 | + * @access public |
|
1214 | + * @param int $VNU_ID |
|
1215 | + * @param bool $echo |
|
1216 | + * @return string |
|
1217 | + * @throws EE_Error |
|
1218 | + * @throws ReflectionException |
|
1219 | + */ |
|
1220 | + function espresso_venue_excerpt($VNU_ID = 0, $echo = true) |
|
1221 | + { |
|
1222 | + if ($echo) { |
|
1223 | + echo EEH_Venue_View::venue_excerpt($VNU_ID); // already escaped |
|
1224 | + return ''; |
|
1225 | + } |
|
1226 | + return EEH_Venue_View::venue_excerpt($VNU_ID); |
|
1227 | + } |
|
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | |
1231 | 1231 | if (! function_exists('espresso_venue_categories')) { |
1232 | - /** |
|
1233 | - * espresso_venue_categories |
|
1234 | - * returns the terms associated with a venue |
|
1235 | - * |
|
1236 | - * @param int $VNU_ID |
|
1237 | - * @param bool $hide_uncategorized |
|
1238 | - * @param bool $echo |
|
1239 | - * @return string |
|
1240 | - * @throws EE_Error |
|
1241 | - * @throws ReflectionException |
|
1242 | - */ |
|
1243 | - function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
1244 | - { |
|
1245 | - if ($echo) { |
|
1246 | - echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped |
|
1247 | - return ''; |
|
1248 | - } |
|
1249 | - return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1250 | - } |
|
1232 | + /** |
|
1233 | + * espresso_venue_categories |
|
1234 | + * returns the terms associated with a venue |
|
1235 | + * |
|
1236 | + * @param int $VNU_ID |
|
1237 | + * @param bool $hide_uncategorized |
|
1238 | + * @param bool $echo |
|
1239 | + * @return string |
|
1240 | + * @throws EE_Error |
|
1241 | + * @throws ReflectionException |
|
1242 | + */ |
|
1243 | + function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true) |
|
1244 | + { |
|
1245 | + if ($echo) { |
|
1246 | + echo EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); // already escaped |
|
1247 | + return ''; |
|
1248 | + } |
|
1249 | + return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized); |
|
1250 | + } |
|
1251 | 1251 | } |
1252 | 1252 | |
1253 | 1253 | |
1254 | 1254 | if (! function_exists('espresso_venue_address')) { |
1255 | - /** |
|
1256 | - * espresso_venue_address |
|
1257 | - * returns a formatted block of html for displaying a venue's address |
|
1258 | - * |
|
1259 | - * @param string $type 'inline' or 'multiline' |
|
1260 | - * @param int $VNU_ID |
|
1261 | - * @param bool $echo |
|
1262 | - * @return string |
|
1263 | - * @throws EE_Error |
|
1264 | - * @throws ReflectionException |
|
1265 | - */ |
|
1266 | - function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1267 | - { |
|
1268 | - if ($echo) { |
|
1269 | - echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped |
|
1270 | - return ''; |
|
1271 | - } |
|
1272 | - return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1273 | - } |
|
1255 | + /** |
|
1256 | + * espresso_venue_address |
|
1257 | + * returns a formatted block of html for displaying a venue's address |
|
1258 | + * |
|
1259 | + * @param string $type 'inline' or 'multiline' |
|
1260 | + * @param int $VNU_ID |
|
1261 | + * @param bool $echo |
|
1262 | + * @return string |
|
1263 | + * @throws EE_Error |
|
1264 | + * @throws ReflectionException |
|
1265 | + */ |
|
1266 | + function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1267 | + { |
|
1268 | + if ($echo) { |
|
1269 | + echo EEH_Venue_View::venue_address($type, $VNU_ID); // already escaped |
|
1270 | + return ''; |
|
1271 | + } |
|
1272 | + return EEH_Venue_View::venue_address($type, $VNU_ID); |
|
1273 | + } |
|
1274 | 1274 | } |
1275 | 1275 | |
1276 | 1276 | |
1277 | 1277 | if (! function_exists('espresso_venue_raw_address')) { |
1278 | - /** |
|
1279 | - * espresso_venue_address |
|
1280 | - * returns an UN-formatted string containing a venue's address |
|
1281 | - * |
|
1282 | - * @param string $type 'inline' or 'multiline' |
|
1283 | - * @param int $VNU_ID |
|
1284 | - * @param bool $echo |
|
1285 | - * @return string |
|
1286 | - * @throws EE_Error |
|
1287 | - * @throws ReflectionException |
|
1288 | - */ |
|
1289 | - function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1290 | - { |
|
1291 | - if ($echo) { |
|
1292 | - echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped |
|
1293 | - return ''; |
|
1294 | - } |
|
1295 | - return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
1296 | - } |
|
1278 | + /** |
|
1279 | + * espresso_venue_address |
|
1280 | + * returns an UN-formatted string containing a venue's address |
|
1281 | + * |
|
1282 | + * @param string $type 'inline' or 'multiline' |
|
1283 | + * @param int $VNU_ID |
|
1284 | + * @param bool $echo |
|
1285 | + * @return string |
|
1286 | + * @throws EE_Error |
|
1287 | + * @throws ReflectionException |
|
1288 | + */ |
|
1289 | + function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true) |
|
1290 | + { |
|
1291 | + if ($echo) { |
|
1292 | + echo EEH_Venue_View::venue_address($type, $VNU_ID, false, false); // already escaped |
|
1293 | + return ''; |
|
1294 | + } |
|
1295 | + return EEH_Venue_View::venue_address($type, $VNU_ID, false, false); |
|
1296 | + } |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | |
1300 | 1300 | if (! function_exists('espresso_venue_has_address')) { |
1301 | - /** |
|
1302 | - * espresso_venue_has_address |
|
1303 | - * returns TRUE or FALSE if a Venue has address information |
|
1304 | - * |
|
1305 | - * @param int $VNU_ID |
|
1306 | - * @return bool |
|
1307 | - * @throws EE_Error |
|
1308 | - * @throws ReflectionException |
|
1309 | - */ |
|
1310 | - function espresso_venue_has_address($VNU_ID = 0) |
|
1311 | - { |
|
1312 | - return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1313 | - } |
|
1301 | + /** |
|
1302 | + * espresso_venue_has_address |
|
1303 | + * returns TRUE or FALSE if a Venue has address information |
|
1304 | + * |
|
1305 | + * @param int $VNU_ID |
|
1306 | + * @return bool |
|
1307 | + * @throws EE_Error |
|
1308 | + * @throws ReflectionException |
|
1309 | + */ |
|
1310 | + function espresso_venue_has_address($VNU_ID = 0) |
|
1311 | + { |
|
1312 | + return EEH_Venue_View::venue_has_address($VNU_ID); |
|
1313 | + } |
|
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | |
1317 | 1317 | if (! function_exists('espresso_venue_gmap')) { |
1318 | - /** |
|
1319 | - * espresso_venue_gmap |
|
1320 | - * returns a google map for the venue address |
|
1321 | - * |
|
1322 | - * @param int $VNU_ID |
|
1323 | - * @param bool $map_ID |
|
1324 | - * @param array $gmap |
|
1325 | - * @param bool $echo |
|
1326 | - * @return string |
|
1327 | - * @throws EE_Error |
|
1328 | - * @throws ReflectionException |
|
1329 | - */ |
|
1330 | - function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
1331 | - { |
|
1332 | - if ($echo) { |
|
1333 | - echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
1334 | - return ''; |
|
1335 | - } |
|
1336 | - return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1337 | - } |
|
1318 | + /** |
|
1319 | + * espresso_venue_gmap |
|
1320 | + * returns a google map for the venue address |
|
1321 | + * |
|
1322 | + * @param int $VNU_ID |
|
1323 | + * @param bool $map_ID |
|
1324 | + * @param array $gmap |
|
1325 | + * @param bool $echo |
|
1326 | + * @return string |
|
1327 | + * @throws EE_Error |
|
1328 | + * @throws ReflectionException |
|
1329 | + */ |
|
1330 | + function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true) |
|
1331 | + { |
|
1332 | + if ($echo) { |
|
1333 | + echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped |
|
1334 | + return ''; |
|
1335 | + } |
|
1336 | + return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); |
|
1337 | + } |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | |
1341 | 1341 | if (! function_exists('espresso_venue_phone')) { |
1342 | - /** |
|
1343 | - * espresso_venue_phone |
|
1344 | - * |
|
1345 | - * @param int $VNU_ID |
|
1346 | - * @param bool $echo |
|
1347 | - * @return string |
|
1348 | - * @throws EE_Error |
|
1349 | - * @throws ReflectionException |
|
1350 | - */ |
|
1351 | - function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
1352 | - { |
|
1353 | - if ($echo) { |
|
1354 | - echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped |
|
1355 | - return ''; |
|
1356 | - } |
|
1357 | - return EEH_Venue_View::venue_phone($VNU_ID); |
|
1358 | - } |
|
1342 | + /** |
|
1343 | + * espresso_venue_phone |
|
1344 | + * |
|
1345 | + * @param int $VNU_ID |
|
1346 | + * @param bool $echo |
|
1347 | + * @return string |
|
1348 | + * @throws EE_Error |
|
1349 | + * @throws ReflectionException |
|
1350 | + */ |
|
1351 | + function espresso_venue_phone($VNU_ID = 0, $echo = true) |
|
1352 | + { |
|
1353 | + if ($echo) { |
|
1354 | + echo EEH_Venue_View::venue_phone($VNU_ID); // already escaped |
|
1355 | + return ''; |
|
1356 | + } |
|
1357 | + return EEH_Venue_View::venue_phone($VNU_ID); |
|
1358 | + } |
|
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | |
1362 | 1362 | if (! function_exists('espresso_venue_website')) { |
1363 | - /** |
|
1364 | - * espresso_venue_website |
|
1365 | - * |
|
1366 | - * @param int $VNU_ID |
|
1367 | - * @param bool $echo |
|
1368 | - * @return string |
|
1369 | - * @throws EE_Error |
|
1370 | - * @throws ReflectionException |
|
1371 | - */ |
|
1372 | - function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
1373 | - { |
|
1374 | - if ($echo) { |
|
1375 | - echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped |
|
1376 | - return ''; |
|
1377 | - } |
|
1378 | - return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1379 | - } |
|
1363 | + /** |
|
1364 | + * espresso_venue_website |
|
1365 | + * |
|
1366 | + * @param int $VNU_ID |
|
1367 | + * @param bool $echo |
|
1368 | + * @return string |
|
1369 | + * @throws EE_Error |
|
1370 | + * @throws ReflectionException |
|
1371 | + */ |
|
1372 | + function espresso_venue_website($VNU_ID = 0, $echo = true) |
|
1373 | + { |
|
1374 | + if ($echo) { |
|
1375 | + echo EEH_Venue_View::venue_website_link($VNU_ID); // already escaped |
|
1376 | + return ''; |
|
1377 | + } |
|
1378 | + return EEH_Venue_View::venue_website_link($VNU_ID); |
|
1379 | + } |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | |
1383 | 1383 | if (! function_exists('espresso_edit_venue_link')) { |
1384 | - /** |
|
1385 | - * espresso_edit_venue_link |
|
1386 | - * |
|
1387 | - * @param int $VNU_ID |
|
1388 | - * @param bool $echo |
|
1389 | - * @return string |
|
1390 | - * @throws EE_Error |
|
1391 | - * @throws ReflectionException |
|
1392 | - */ |
|
1393 | - function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
1394 | - { |
|
1395 | - if ($echo) { |
|
1396 | - echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped |
|
1397 | - return ''; |
|
1398 | - } |
|
1399 | - return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1400 | - } |
|
1384 | + /** |
|
1385 | + * espresso_edit_venue_link |
|
1386 | + * |
|
1387 | + * @param int $VNU_ID |
|
1388 | + * @param bool $echo |
|
1389 | + * @return string |
|
1390 | + * @throws EE_Error |
|
1391 | + * @throws ReflectionException |
|
1392 | + */ |
|
1393 | + function espresso_edit_venue_link($VNU_ID = 0, $echo = true) |
|
1394 | + { |
|
1395 | + if ($echo) { |
|
1396 | + echo EEH_Venue_View::edit_venue_link($VNU_ID); // already escaped |
|
1397 | + return ''; |
|
1398 | + } |
|
1399 | + return EEH_Venue_View::edit_venue_link($VNU_ID); |
|
1400 | + } |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 |
@@ -5,43 +5,43 @@ |
||
5 | 5 | global $post; |
6 | 6 | ?> |
7 | 7 | <div class="venue-content"> |
8 | -<?php if ( apply_filters( 'FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE )): ?> |
|
8 | +<?php if (apply_filters('FHEE__content_espresso_venues_details_template__display_entry_meta', TRUE)): ?> |
|
9 | 9 | <div class="entry-meta"> |
10 | - <span class="tags-links"><?php espresso_venue_categories( $post->ID, TRUE, TRUE ); ?></span> |
|
10 | + <span class="tags-links"><?php espresso_venue_categories($post->ID, TRUE, TRUE); ?></span> |
|
11 | 11 | <?php |
12 | - if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : |
|
12 | + if ( ! post_password_required() && (comments_open() || get_comments_number())) : |
|
13 | 13 | ?> |
14 | - <span class="comments-link"><?php comments_popup_link( esc_html__( 'Leave a comment', 'event_espresso' ), esc_html__( '1 Comment', 'event_espresso' ), esc_html__( '% Comments', 'event_espresso' ) ); ?></span> |
|
14 | + <span class="comments-link"><?php comments_popup_link(esc_html__('Leave a comment', 'event_espresso'), esc_html__('1 Comment', 'event_espresso'), esc_html__('% Comments', 'event_espresso')); ?></span> |
|
15 | 15 | <?php |
16 | 16 | endif; |
17 | 17 | |
18 | - edit_post_link( esc_html__( 'Edit', 'event_espresso' ), '<span class="edit-link">', '</span>' ); |
|
18 | + edit_post_link(esc_html__('Edit', 'event_espresso'), '<span class="edit-link">', '</span>'); |
|
19 | 19 | ?> |
20 | 20 | </div> |
21 | 21 | <?php endif; ?> |
22 | 22 | |
23 | 23 | <h3 class="event-venues-h3 ee-event-h3"> |
24 | - <?php esc_html_e( 'Details', 'event_espresso' ); ?> |
|
24 | + <?php esc_html_e('Details', 'event_espresso'); ?> |
|
25 | 25 | </h3> |
26 | 26 | |
27 | - <?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
27 | + <?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
28 | 28 | <p> |
29 | - <span class="small-text"><strong><?php esc_html_e( 'Venue Phone:', 'event_espresso' ); ?> </strong></span><?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?> |
|
29 | + <span class="small-text"><strong><?php esc_html_e('Venue Phone:', 'event_espresso'); ?> </strong></span><?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?> |
|
30 | 30 | </p> |
31 | 31 | <?php endif; ?> |
32 | - <?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
32 | + <?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
33 | 33 | <p> |
34 | - <span class="small-text"><strong><?php esc_html_e( 'Venue Website:', 'event_espresso' ); ?> </strong></span><?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?> |
|
34 | + <span class="small-text"><strong><?php esc_html_e('Venue Website:', 'event_espresso'); ?> </strong></span><?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?> |
|
35 | 35 | </p> |
36 | 36 | <?php endif; ?> |
37 | 37 | <?php |
38 | - do_action( 'AHEE__content_espresso_venues_details_template__before_the_content', $post ); |
|
39 | - if ( is_archive() && has_excerpt( $post->ID )) { |
|
38 | + do_action('AHEE__content_espresso_venues_details_template__before_the_content', $post); |
|
39 | + if (is_archive() && has_excerpt($post->ID)) { |
|
40 | 40 | the_excerpt(); |
41 | 41 | } else { |
42 | 42 | the_content(); |
43 | 43 | } |
44 | - do_action( 'AHEE__content_espresso_venues_details_template__after_the_content', $post ); |
|
44 | + do_action('AHEE__content_espresso_venues_details_template__after_the_content', $post); |
|
45 | 45 | ?> |
46 | 46 | </div> |
47 | 47 | <!-- .venue-content --> |
@@ -3,75 +3,75 @@ |
||
3 | 3 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
4 | 4 | |
5 | 5 | if ( |
6 | - ( is_single() && espresso_display_venue_in_event_details() ) |
|
7 | - || ( is_archive() && espresso_display_venue_in_event_list() ) |
|
6 | + (is_single() && espresso_display_venue_in_event_details()) |
|
7 | + || (is_archive() && espresso_display_venue_in_event_list()) |
|
8 | 8 | ) : |
9 | 9 | global $post; |
10 | - do_action( 'AHEE_event_details_before_venue_details', $post ); |
|
11 | - $venue_name = espresso_venue_name( 0, 'details', FALSE ); |
|
12 | - if ( empty( $venue_name ) && espresso_is_venue_private() ) { |
|
13 | - do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
10 | + do_action('AHEE_event_details_before_venue_details', $post); |
|
11 | + $venue_name = espresso_venue_name(0, 'details', FALSE); |
|
12 | + if (empty($venue_name) && espresso_is_venue_private()) { |
|
13 | + do_action('AHEE_event_details_after_venue_details', $post); |
|
14 | 14 | return ''; |
15 | 15 | } |
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div class="espresso-venue-dv<?php echo espresso_is_venue_private() ? ' espresso-private-venue-dv' : ''; ?>"> |
19 | 19 | <h4> |
20 | - <strong><?php esc_html_e( 'Venue:', 'event_espresso' ); ?></strong> |
|
20 | + <strong><?php esc_html_e('Venue:', 'event_espresso'); ?></strong> |
|
21 | 21 | <strong> <?php echo wp_kses($venue_name, AllowedTags::getAllowedTags()); ?></strong> |
22 | 22 | </h4> |
23 | 23 | <p><span class="smaller-text tags-links"><?php echo espresso_venue_categories(); ?></span></p> |
24 | -<?php if ( $venue_phone = espresso_venue_phone( $post->ID, FALSE )) : ?> |
|
24 | +<?php if ($venue_phone = espresso_venue_phone($post->ID, FALSE)) : ?> |
|
25 | 25 | <p> |
26 | 26 | <span class="small-text"> |
27 | - <strong><?php esc_html_e( 'Venue Phone:', 'event_espresso' ); ?></strong> |
|
27 | + <strong><?php esc_html_e('Venue Phone:', 'event_espresso'); ?></strong> |
|
28 | 28 | </span> |
29 | 29 | <?php echo wp_kses($venue_phone, AllowedTags::getAllowedTags()); ?> |
30 | 30 | </p> |
31 | -<?php endif; ?> |
|
32 | -<?php if ( $venue_website = espresso_venue_website( $post->ID, FALSE )) : ?> |
|
31 | +<?php endif; ?> |
|
32 | +<?php if ($venue_website = espresso_venue_website($post->ID, FALSE)) : ?> |
|
33 | 33 | <p> |
34 | 34 | <span class="small-text"> |
35 | - <strong><?php esc_html_e( 'Venue Website:', 'event_espresso' ); ?></strong> |
|
35 | + <strong><?php esc_html_e('Venue Website:', 'event_espresso'); ?></strong> |
|
36 | 36 | </span> |
37 | 37 | <?php echo wp_kses($venue_website, AllowedTags::getAllowedTags()); ?> |
38 | 38 | </p> |
39 | 39 | <?php endif; ?> |
40 | -<?php if ( espresso_venue_has_address( $post->ID )) : ?> |
|
41 | - <strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e( 'Address:', 'event_espresso' ); ?></strong> |
|
42 | - <?php espresso_venue_address( 'inline' ); // already escaped ?> |
|
43 | - <?php espresso_venue_gmap( $post->ID ); // already escaped ?> |
|
40 | +<?php if (espresso_venue_has_address($post->ID)) : ?> |
|
41 | + <strong><span class="dashicons dashicons-location-alt"></span><?php esc_html_e('Address:', 'event_espresso'); ?></strong> |
|
42 | + <?php espresso_venue_address('inline'); // already escaped ?> |
|
43 | + <?php espresso_venue_gmap($post->ID); // already escaped ?> |
|
44 | 44 | <div class="clear"><br/></div> |
45 | -<?php endif; ?> |
|
45 | +<?php endif; ?> |
|
46 | 46 | |
47 | - <?php $VNU_ID = espresso_venue_id( $post->ID ); ?> |
|
48 | - <?php if ( is_single() ) : ?> |
|
49 | - <?php $venue_description = espresso_venue_description( $VNU_ID, FALSE ); ?> |
|
50 | - <?php if ( $venue_description ) : ?> |
|
47 | + <?php $VNU_ID = espresso_venue_id($post->ID); ?> |
|
48 | + <?php if (is_single()) : ?> |
|
49 | + <?php $venue_description = espresso_venue_description($VNU_ID, FALSE); ?> |
|
50 | + <?php if ($venue_description) : ?> |
|
51 | 51 | <p> |
52 | - <strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
53 | - <?php echo do_shortcode( $venue_description ); ?> |
|
52 | + <strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/> |
|
53 | + <?php echo do_shortcode($venue_description); ?> |
|
54 | 54 | </p> |
55 | - <?php endif; ?> |
|
55 | + <?php endif; ?> |
|
56 | 56 | <?php else : ?> |
57 | - <?php $venue_excerpt = espresso_venue_excerpt( $VNU_ID, FALSE ); ?> |
|
58 | - <?php if ( $venue_excerpt ) : ?> |
|
57 | + <?php $venue_excerpt = espresso_venue_excerpt($VNU_ID, FALSE); ?> |
|
58 | + <?php if ($venue_excerpt) : ?> |
|
59 | 59 | <p> |
60 | - <strong><?php esc_html_e( 'Description:', 'event_espresso' ); ?></strong><br/> |
|
60 | + <strong><?php esc_html_e('Description:', 'event_espresso'); ?></strong><br/> |
|
61 | 61 | <?php echo wp_kses($venue_excerpt, AllowedTags::getAllowedTags()); ?> |
62 | 62 | </p> |
63 | - <?php endif; ?> |
|
64 | - <?php endif; ?> |
|
63 | + <?php endif; ?> |
|
64 | + <?php endif; ?> |
|
65 | 65 | </div> |
66 | 66 | <!-- .espresso-venue-dv --> |
67 | 67 | <?php |
68 | -do_action( 'AHEE_event_details_after_venue_details', $post ); |
|
68 | +do_action('AHEE_event_details_after_venue_details', $post); |
|
69 | 69 | else : |
70 | - if ( espresso_venue_is_password_protected() ) : |
|
70 | + if (espresso_venue_is_password_protected()) : |
|
71 | 71 | ?> |
72 | 72 | <div class="espresso-venue-dv espresso-password-protected-venue-dv" > |
73 | 73 | <h3 class="event-venues-h3 ee-event-h3"> |
74 | - <?php esc_html_e( 'Location', 'event_espresso' );?> |
|
74 | + <?php esc_html_e('Location', 'event_espresso'); ?> |
|
75 | 75 | </h3> |
76 | 76 | <?php echo espresso_password_protected_venue_form(); ?> |
77 | 77 | </div> |
@@ -15,11 +15,11 @@ |
||
15 | 15 | use EventEspresso\core\services\request\sanitizers\AllowedTags; |
16 | 16 | |
17 | 17 | $gravatar = $show_gravatar |
18 | - ? get_avatar( |
|
19 | - $contact->email(), |
|
20 | - (int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32) |
|
21 | - ) |
|
22 | - : ''; |
|
18 | + ? get_avatar( |
|
19 | + $contact->email(), |
|
20 | + (int) apply_filters('FHEE__loop-espresso_attendees-shortcode__template__avatar_size', 32) |
|
21 | + ) |
|
22 | + : ''; |
|
23 | 23 | ?> |
24 | 24 | <?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?> |
25 | 25 | <li><?php echo wp_kses($gravatar . ' ' . $contact->full_name(true), AllowedTags::getAllowedTags()); ?></li> |
@@ -21,8 +21,8 @@ |
||
21 | 21 | ) |
22 | 22 | : ''; |
23 | 23 | ?> |
24 | -<?php do_action( 'AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar ); ?> |
|
25 | -<li><?php echo wp_kses($gravatar . ' ' . $contact->full_name(true), AllowedTags::getAllowedTags()); ?></li> |
|
26 | -<?php do_action( 'AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar ); ?> |
|
24 | +<?php do_action('AHEE__content-espresso_event_attendees__before', $contact, $show_gravatar); ?> |
|
25 | +<li><?php echo wp_kses($gravatar.' '.$contact->full_name(true), AllowedTags::getAllowedTags()); ?></li> |
|
26 | +<?php do_action('AHEE__content-espresso_event_attendees__after', $contact, $show_gravatar); ?> |
|
27 | 27 | |
28 | 28 | <!--<br >--> |
@@ -4,27 +4,27 @@ discard block |
||
4 | 4 | <div class="event-content"> |
5 | 5 | <?php use EventEspresso\core\services\request\sanitizers\AllowedTags; |
6 | 6 | |
7 | -if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_entry_meta', TRUE )): ?> |
|
7 | +if (apply_filters('FHEE__content_espresso_events_details_template__display_entry_meta', TRUE)): ?> |
|
8 | 8 | |
9 | 9 | <div class="entry-meta"> |
10 | 10 | |
11 | 11 | <span class="tags-links"> |
12 | - <?php espresso_event_categories( $post->ID, TRUE, TRUE ); ?> |
|
12 | + <?php espresso_event_categories($post->ID, TRUE, TRUE); ?> |
|
13 | 13 | </span> |
14 | 14 | |
15 | - <?php if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : ?> |
|
15 | + <?php if ( ! post_password_required() && (comments_open() || get_comments_number())) : ?> |
|
16 | 16 | <span class="comments-link"> |
17 | 17 | <?php comments_popup_link( |
18 | - esc_html__( 'Leave a comment', 'event_espresso' ), |
|
19 | - esc_html__( '1 Comment', 'event_espresso' ), |
|
20 | - esc_html__( '% Comments', 'event_espresso' ) |
|
18 | + esc_html__('Leave a comment', 'event_espresso'), |
|
19 | + esc_html__('1 Comment', 'event_espresso'), |
|
20 | + esc_html__('% Comments', 'event_espresso') |
|
21 | 21 | ); ?> |
22 | 22 | </span> |
23 | 23 | |
24 | 24 | <?php |
25 | 25 | endif; |
26 | 26 | edit_post_link( |
27 | - esc_html__( 'Edit', 'event_espresso' ), |
|
27 | + esc_html__('Edit', 'event_espresso'), |
|
28 | 28 | '<span class="edit-link">', |
29 | 29 | '</span>' |
30 | 30 | ); |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | </div> |
33 | 33 | |
34 | 34 | <?php endif; |
35 | - $event_phone = espresso_event_phone( $post->ID, FALSE ); |
|
35 | + $event_phone = espresso_event_phone($post->ID, FALSE); |
|
36 | 36 | |
37 | - if ( $event_phone != '' ) : ?> |
|
37 | + if ($event_phone != '') : ?> |
|
38 | 38 | <p class="event-phone"> |
39 | 39 | <span class="small-text"> |
40 | - <strong><?php esc_html_e( 'Event Phone:', 'event_espresso' ); ?> </strong> |
|
40 | + <strong><?php esc_html_e('Event Phone:', 'event_espresso'); ?> </strong> |
|
41 | 41 | </span> |
42 | 42 | <?php echo wp_kses($event_phone, AllowedTags::getAllowedTags()); ?> |
43 | 43 | </p> |
44 | -<?php endif; ?> |
|
44 | +<?php endif; ?> |
|
45 | 45 | |
46 | 46 | <?php |
47 | - if ( apply_filters( 'FHEE__content_espresso_events_details_template__display_the_content', true ) ) { |
|
48 | - do_action( 'AHEE_event_details_before_the_content', $post ); |
|
47 | + if (apply_filters('FHEE__content_espresso_events_details_template__display_the_content', true)) { |
|
48 | + do_action('AHEE_event_details_before_the_content', $post); |
|
49 | 49 | echo apply_filters( |
50 | 50 | 'FHEE__content_espresso_events_details_template__the_content', |
51 | - espresso_event_content_or_excerpt( 55, null, false ) |
|
51 | + espresso_event_content_or_excerpt(55, null, false) |
|
52 | 52 | ); |
53 | - do_action( 'AHEE_event_details_after_the_content', $post ); |
|
53 | + do_action('AHEE_event_details_after_the_content', $post); |
|
54 | 54 | } |
55 | 55 | ?> |
56 | 56 | </div> |
@@ -13,109 +13,109 @@ discard block |
||
13 | 13 | class EEW_Upcoming_Events extends EspressoWidget |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @var string |
|
18 | - */ |
|
19 | - private $title; |
|
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - private $events_category; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var bool |
|
27 | - */ |
|
28 | - private $show_expired; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string |
|
32 | - */ |
|
33 | - private $image_size; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var bool |
|
37 | - */ |
|
38 | - private $show_desc; |
|
39 | - |
|
40 | - /** |
|
41 | - * @var bool |
|
42 | - */ |
|
43 | - private $show_dates; |
|
44 | - |
|
45 | - /** |
|
46 | - * @var string |
|
47 | - */ |
|
48 | - private $date_limit; |
|
49 | - |
|
50 | - /** |
|
51 | - * @var string |
|
52 | - */ |
|
53 | - private $date_range; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var string |
|
57 | - */ |
|
58 | - private $limit; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var string |
|
62 | - */ |
|
63 | - private $order; |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Register widget with WordPress. |
|
68 | - */ |
|
69 | - public function __construct() |
|
70 | - { |
|
71 | - parent::__construct( |
|
72 | - esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
73 | - ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
74 | - ); |
|
75 | - } |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * Back-end widget form. |
|
80 | - * |
|
81 | - * @param array $instance Previously saved values from database. |
|
82 | - * @return void |
|
83 | - * @throws EE_Error |
|
84 | - * @throws ReflectionException |
|
85 | - * @see WP_Widget::form() |
|
86 | - */ |
|
87 | - public function form($instance) |
|
88 | - { |
|
89 | - |
|
90 | - EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
91 | - // Set up some default widget settings. |
|
92 | - $defaults = [ |
|
93 | - 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
94 | - 'category_name' => '', |
|
95 | - 'show_expired' => 0, |
|
96 | - 'show_desc' => true, |
|
97 | - 'show_dates' => true, |
|
98 | - 'show_everywhere' => false, |
|
99 | - 'date_limit' => 2, |
|
100 | - 'limit' => 10, |
|
101 | - 'sort' => 'ASC', |
|
102 | - 'date_range' => false, |
|
103 | - 'image_size' => 'medium', |
|
104 | - ]; |
|
105 | - |
|
106 | - $instance = wp_parse_args((array) $instance, $defaults); |
|
107 | - // don't add HTML labels for EE_Form_Fields generated inputs |
|
108 | - add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
109 | - $yes_no_values = [ |
|
110 | - EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
111 | - EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
112 | - ]; |
|
113 | - $sort_values = [ |
|
114 | - EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
115 | - EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
116 | - ]; |
|
117 | - |
|
118 | - ?> |
|
16 | + /** |
|
17 | + * @var string |
|
18 | + */ |
|
19 | + private $title; |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + private $events_category; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var bool |
|
27 | + */ |
|
28 | + private $show_expired; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string |
|
32 | + */ |
|
33 | + private $image_size; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var bool |
|
37 | + */ |
|
38 | + private $show_desc; |
|
39 | + |
|
40 | + /** |
|
41 | + * @var bool |
|
42 | + */ |
|
43 | + private $show_dates; |
|
44 | + |
|
45 | + /** |
|
46 | + * @var string |
|
47 | + */ |
|
48 | + private $date_limit; |
|
49 | + |
|
50 | + /** |
|
51 | + * @var string |
|
52 | + */ |
|
53 | + private $date_range; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var string |
|
57 | + */ |
|
58 | + private $limit; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var string |
|
62 | + */ |
|
63 | + private $order; |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Register widget with WordPress. |
|
68 | + */ |
|
69 | + public function __construct() |
|
70 | + { |
|
71 | + parent::__construct( |
|
72 | + esc_html__('Event Espresso Upcoming Events', 'event_espresso'), |
|
73 | + ['description' => esc_html__('A widget to display your upcoming events.', 'event_espresso')] |
|
74 | + ); |
|
75 | + } |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * Back-end widget form. |
|
80 | + * |
|
81 | + * @param array $instance Previously saved values from database. |
|
82 | + * @return void |
|
83 | + * @throws EE_Error |
|
84 | + * @throws ReflectionException |
|
85 | + * @see WP_Widget::form() |
|
86 | + */ |
|
87 | + public function form($instance) |
|
88 | + { |
|
89 | + |
|
90 | + EE_Registry::instance()->load_class('Question_Option', [], false, false, true); |
|
91 | + // Set up some default widget settings. |
|
92 | + $defaults = [ |
|
93 | + 'title' => esc_html__('Upcoming Events', 'event_espresso'), |
|
94 | + 'category_name' => '', |
|
95 | + 'show_expired' => 0, |
|
96 | + 'show_desc' => true, |
|
97 | + 'show_dates' => true, |
|
98 | + 'show_everywhere' => false, |
|
99 | + 'date_limit' => 2, |
|
100 | + 'limit' => 10, |
|
101 | + 'sort' => 'ASC', |
|
102 | + 'date_range' => false, |
|
103 | + 'image_size' => 'medium', |
|
104 | + ]; |
|
105 | + |
|
106 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
107 | + // don't add HTML labels for EE_Form_Fields generated inputs |
|
108 | + add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string'); |
|
109 | + $yes_no_values = [ |
|
110 | + EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
|
111 | + EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
|
112 | + ]; |
|
113 | + $sort_values = [ |
|
114 | + EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
|
115 | + EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
|
116 | + ]; |
|
117 | + |
|
118 | + ?> |
|
119 | 119 | |
120 | 120 | <!-- Widget Title: Text Input --> |
121 | 121 | |
@@ -152,32 +152,32 @@ discard block |
||
152 | 152 | <?php esc_html_e('Show Expired Events:', 'event_espresso'); ?> |
153 | 153 | </label> |
154 | 154 | <?php |
155 | - $show_expired_options = $yes_no_values; |
|
156 | - $show_expired_options[] = EE_Question_Option::new_instance( |
|
157 | - ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
158 | - ); |
|
159 | - echo EEH_Form_Fields::select( |
|
160 | - esc_html__('Show Expired Events:', 'event_espresso'), |
|
161 | - $instance['show_expired'], |
|
162 | - $show_expired_options, |
|
163 | - $this->fieldName('show_expired'), |
|
164 | - $this->fieldID('show_expired') |
|
165 | - ); |
|
166 | - ?> |
|
155 | + $show_expired_options = $yes_no_values; |
|
156 | + $show_expired_options[] = EE_Question_Option::new_instance( |
|
157 | + ['QSO_value' => 2, 'QSO_desc' => esc_html__('Show Only Expired', 'event_espresso')] |
|
158 | + ); |
|
159 | + echo EEH_Form_Fields::select( |
|
160 | + esc_html__('Show Expired Events:', 'event_espresso'), |
|
161 | + $instance['show_expired'], |
|
162 | + $show_expired_options, |
|
163 | + $this->fieldName('show_expired'), |
|
164 | + $this->fieldID('show_expired') |
|
165 | + ); |
|
166 | + ?> |
|
167 | 167 | </p> |
168 | 168 | <p> |
169 | 169 | <label for="<?php echo esc_attr($this->fieldID('sort')); ?>"> |
170 | 170 | <?php esc_html_e('Sort Events:', 'event_espresso'); ?> |
171 | 171 | </label> |
172 | 172 | <?php |
173 | - echo EEH_Form_Fields::select( |
|
174 | - esc_html__('Sort Events:', 'event_espresso'), |
|
175 | - $instance['sort'], |
|
176 | - $sort_values, |
|
177 | - $this->fieldName('sort'), |
|
178 | - $this->fieldID('sort') |
|
179 | - ); |
|
180 | - ?> |
|
173 | + echo EEH_Form_Fields::select( |
|
174 | + esc_html__('Sort Events:', 'event_espresso'), |
|
175 | + $instance['sort'], |
|
176 | + $sort_values, |
|
177 | + $this->fieldName('sort'), |
|
178 | + $this->fieldID('sort') |
|
179 | + ); |
|
180 | + ?> |
|
181 | 181 | </p> |
182 | 182 | <p> |
183 | 183 | <label for="<?php echo esc_attr($this->fieldID('image_size')); ?>"> |
@@ -191,42 +191,42 @@ discard block |
||
191 | 191 | <?php esc_html_e('Show Description:', 'event_espresso'); ?> |
192 | 192 | </label> |
193 | 193 | <?php |
194 | - echo EEH_Form_Fields::select( |
|
195 | - esc_html__('Show Description:', 'event_espresso'), |
|
196 | - $instance['show_desc'], |
|
197 | - $yes_no_values, |
|
198 | - $this->fieldName('show_desc'), |
|
199 | - $this->fieldID('show_desc') |
|
200 | - ); |
|
201 | - ?> |
|
194 | + echo EEH_Form_Fields::select( |
|
195 | + esc_html__('Show Description:', 'event_espresso'), |
|
196 | + $instance['show_desc'], |
|
197 | + $yes_no_values, |
|
198 | + $this->fieldName('show_desc'), |
|
199 | + $this->fieldID('show_desc') |
|
200 | + ); |
|
201 | + ?> |
|
202 | 202 | </p> |
203 | 203 | <p> |
204 | 204 | <label for="<?php echo esc_attr($this->fieldID('show_dates')); ?>"> |
205 | 205 | <?php esc_html_e('Show Dates:', 'event_espresso'); ?> |
206 | 206 | </label> |
207 | 207 | <?php |
208 | - echo EEH_Form_Fields::select( |
|
209 | - esc_html__('Show Dates:', 'event_espresso'), |
|
210 | - $instance['show_dates'], |
|
211 | - $yes_no_values, |
|
212 | - $this->fieldName('show_dates'), |
|
213 | - $this->fieldID('show_dates') |
|
214 | - ); |
|
215 | - ?> |
|
208 | + echo EEH_Form_Fields::select( |
|
209 | + esc_html__('Show Dates:', 'event_espresso'), |
|
210 | + $instance['show_dates'], |
|
211 | + $yes_no_values, |
|
212 | + $this->fieldName('show_dates'), |
|
213 | + $this->fieldID('show_dates') |
|
214 | + ); |
|
215 | + ?> |
|
216 | 216 | </p> |
217 | 217 | <p> |
218 | 218 | <label for="<?php echo esc_attr($this->fieldID('show_everywhere')); ?>"> |
219 | 219 | <?php esc_html_e('Show on all Pages:', 'event_espresso'); ?> |
220 | 220 | </label> |
221 | 221 | <?php |
222 | - echo EEH_Form_Fields::select( |
|
223 | - esc_html__('Show on all Pages:', 'event_espresso'), |
|
224 | - $instance['show_everywhere'], |
|
225 | - $yes_no_values, |
|
226 | - $this->fieldName('show_everywhere'), |
|
227 | - $this->fieldID('show_everywhere') |
|
228 | - ); |
|
229 | - ?> |
|
222 | + echo EEH_Form_Fields::select( |
|
223 | + esc_html__('Show on all Pages:', 'event_espresso'), |
|
224 | + $instance['show_everywhere'], |
|
225 | + $yes_no_values, |
|
226 | + $this->fieldName('show_everywhere'), |
|
227 | + $this->fieldID('show_everywhere') |
|
228 | + ); |
|
229 | + ?> |
|
230 | 230 | </p> |
231 | 231 | <p> |
232 | 232 | <label for="<?php echo esc_attr($this->fieldID('date_limit')); ?>"> |
@@ -244,278 +244,278 @@ discard block |
||
244 | 244 | <?php esc_html_e('Show Date Range:', 'event_espresso'); ?> |
245 | 245 | </label> |
246 | 246 | <?php |
247 | - echo EEH_Form_Fields::select( |
|
248 | - esc_html__('Show Date Range:', 'event_espresso'), |
|
249 | - $instance['date_range'], |
|
250 | - $yes_no_values, |
|
251 | - $this->fieldName('date_range'), |
|
252 | - $this->fieldID('date_range') |
|
253 | - ); |
|
254 | - ?> |
|
247 | + echo EEH_Form_Fields::select( |
|
248 | + esc_html__('Show Date Range:', 'event_espresso'), |
|
249 | + $instance['date_range'], |
|
250 | + $yes_no_values, |
|
251 | + $this->fieldName('date_range'), |
|
252 | + $this->fieldID('date_range') |
|
253 | + ); |
|
254 | + ?> |
|
255 | 255 | <span class="description"> |
256 | 256 | <br /> |
257 | 257 | <?php esc_html_e( |
258 | - 'This setting will replace the list of dates in the widget.', |
|
259 | - 'event_espresso' |
|
260 | - ); ?> |
|
258 | + 'This setting will replace the list of dates in the widget.', |
|
259 | + 'event_espresso' |
|
260 | + ); ?> |
|
261 | 261 | </span> |
262 | 262 | </p> |
263 | 263 | |
264 | 264 | <?php |
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - /** |
|
269 | - * Sanitize widget form values as they are saved. |
|
270 | - * |
|
271 | - * @param array $new_instance Values just sent to be saved. |
|
272 | - * @param array $old_instance Previously saved values from database. |
|
273 | - * |
|
274 | - * @return array Updated safe values to be saved. |
|
275 | - * @see WP_Widget::update() |
|
276 | - * |
|
277 | - */ |
|
278 | - public function update($new_instance, $old_instance) |
|
279 | - { |
|
280 | - $instance = $old_instance; |
|
281 | - $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
282 | - $instance['category_name'] = $new_instance['category_name']; |
|
283 | - $instance['show_expired'] = $new_instance['show_expired']; |
|
284 | - $instance['limit'] = $new_instance['limit']; |
|
285 | - $instance['sort'] = $new_instance['sort']; |
|
286 | - $instance['image_size'] = $new_instance['image_size']; |
|
287 | - $instance['show_desc'] = $new_instance['show_desc']; |
|
288 | - $instance['show_dates'] = $new_instance['show_dates']; |
|
289 | - $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
290 | - $instance['date_limit'] = $new_instance['date_limit']; |
|
291 | - $instance['date_range'] = $new_instance['date_range']; |
|
292 | - return $instance; |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - /** |
|
297 | - * Front-end display of widget. |
|
298 | - * |
|
299 | - * @param array $args Widget arguments. |
|
300 | - * @param array $instance Saved values from database. |
|
301 | - * @throws EE_Error |
|
302 | - * @throws ReflectionException |
|
303 | - * @see WP_Widget::widget() |
|
304 | - * |
|
305 | - */ |
|
306 | - public function widget($args, $instance) |
|
307 | - { |
|
308 | - |
|
309 | - global $post; |
|
310 | - // make sure there is some kinda post object |
|
311 | - if ($post instanceof WP_Post) { |
|
312 | - $before_widget = ''; |
|
313 | - $before_title = ''; |
|
314 | - $after_title = ''; |
|
315 | - $after_widget = ''; |
|
316 | - // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
317 | - $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
318 | - if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
319 | - // let's use some of the event helper functions' |
|
320 | - // make separate vars out of attributes |
|
321 | - extract($args); |
|
322 | - |
|
323 | - // grab widget settings |
|
324 | - $this->parseWidgetSettings($instance); |
|
325 | - $title = $this->widgetTitle(); |
|
326 | - |
|
327 | - // Before widget (defined by themes). |
|
328 | - echo wp_kses($before_widget, AllowedTags::getAllowedTags()); |
|
329 | - // Display the widget title if one was input (before and after defined by themes). |
|
330 | - if (! empty($title)) { |
|
331 | - echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags()); |
|
332 | - } |
|
333 | - echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags()); |
|
334 | - // After widget (defined by themes). |
|
335 | - echo wp_kses($after_widget, AllowedTags::getAllowedTags()); |
|
336 | - } |
|
337 | - } |
|
338 | - } |
|
339 | - |
|
340 | - |
|
341 | - /** |
|
342 | - * make_the_title_a_link |
|
343 | - * callback for widget_title filter |
|
344 | - * |
|
345 | - * @param $title |
|
346 | - * @return string |
|
347 | - */ |
|
348 | - public function make_the_title_a_link($title) |
|
349 | - { |
|
350 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
351 | - } |
|
352 | - |
|
353 | - |
|
354 | - /** |
|
355 | - * @param string $field_name |
|
356 | - * @return string |
|
357 | - * @since 4.10.14.p |
|
358 | - */ |
|
359 | - public function fieldID($field_name) |
|
360 | - { |
|
361 | - return parent::get_field_id($field_name); |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * @param string $field_name |
|
367 | - * @return string |
|
368 | - * @since 4.10.14.p |
|
369 | - */ |
|
370 | - public function fieldName($field_name) |
|
371 | - { |
|
372 | - return parent::get_field_name($field_name); |
|
373 | - } |
|
374 | - |
|
375 | - |
|
376 | - /** |
|
377 | - * @param array $instance |
|
378 | - * @throws EE_Error |
|
379 | - * @throws ReflectionException |
|
380 | - * @since 4.10.14.p |
|
381 | - */ |
|
382 | - private function eventCategoriesSelector(array $instance) |
|
383 | - { |
|
384 | - $event_categories = []; |
|
385 | - $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
386 | - if ($categories) { |
|
387 | - foreach ($categories as $category) { |
|
388 | - if ($category instanceof EE_Term) { |
|
389 | - $event_categories[] = |
|
390 | - EE_Question_Option::new_instance( |
|
391 | - [ |
|
392 | - 'QSO_value' => $category->get('slug'), |
|
393 | - 'QSO_desc' => $category->get('name'), |
|
394 | - ] |
|
395 | - ); |
|
396 | - } |
|
397 | - } |
|
398 | - } |
|
399 | - array_unshift( |
|
400 | - $event_categories, |
|
401 | - EE_Question_Option::new_instance( |
|
402 | - [ |
|
403 | - 'QSO_value' => '', |
|
404 | - 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
405 | - ] |
|
406 | - ) |
|
407 | - ); |
|
408 | - echo EEH_Form_Fields::select( |
|
409 | - esc_html__('Event Category:', 'event_espresso'), |
|
410 | - $instance['category_name'], |
|
411 | - $event_categories, |
|
412 | - $this->fieldName('category_name'), |
|
413 | - $this->fieldID('category_name') |
|
414 | - ); |
|
415 | - } |
|
416 | - |
|
417 | - |
|
418 | - /** |
|
419 | - * @param array $instance |
|
420 | - * @since 4.10.14.p |
|
421 | - */ |
|
422 | - private function imageSizeSelector(array $instance) |
|
423 | - { |
|
424 | - $image_sizes = []; |
|
425 | - $sizes = get_intermediate_image_sizes(); |
|
426 | - if ($sizes) { |
|
427 | - // loop thru images and create option objects out of them |
|
428 | - foreach ($sizes as $image_size) { |
|
429 | - $image_size = trim($image_size); |
|
430 | - // no big images plz |
|
431 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
432 | - $image_sizes[] = |
|
433 | - EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
434 | - } |
|
435 | - } |
|
436 | - $image_sizes[] = |
|
437 | - EE_Question_Option::new_instance( |
|
438 | - ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
439 | - ); |
|
440 | - } |
|
441 | - echo EEH_Form_Fields::select( |
|
442 | - esc_html__('Image Size:', 'event_espresso'), |
|
443 | - $instance['image_size'], |
|
444 | - $image_sizes, |
|
445 | - $this->fieldName('image_size'), |
|
446 | - $this->fieldID('image_size') |
|
447 | - ); |
|
448 | - } |
|
449 | - |
|
450 | - |
|
451 | - /** |
|
452 | - * @param array $instance |
|
453 | - * @since 4.10.14.p |
|
454 | - */ |
|
455 | - private function parseWidgetSettings(array $instance) |
|
456 | - { |
|
457 | - $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
458 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
459 | - ? $instance['category_name'] |
|
460 | - : false; |
|
461 | - $this->show_expired = isset($instance['show_expired']) |
|
462 | - ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
463 | - : 0; |
|
464 | - $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
465 | - ? $instance['image_size'] |
|
466 | - : 'medium'; |
|
467 | - $this->show_desc = ! isset($instance['show_desc']) |
|
468 | - || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
469 | - $this->show_dates = ! isset($instance['show_dates']) |
|
470 | - || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
471 | - $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
472 | - ? $instance['date_limit'] |
|
473 | - : null; |
|
474 | - $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
475 | - ? $instance['date_range'] |
|
476 | - : false; |
|
477 | - $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
478 | - $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
479 | - ? 'DESC' |
|
480 | - : 'ASC'; |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - /** |
|
485 | - * @return mixed|void |
|
486 | - * @since 4.10.14.p |
|
487 | - */ |
|
488 | - private function widgetTitle() |
|
489 | - { |
|
490 | - // add function to make the title a link |
|
491 | - add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
492 | - // filter the title |
|
493 | - $title = apply_filters('widget_title', $this->title); |
|
494 | - // remove the function from the filter, so it does not affect other widgets |
|
495 | - remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
496 | - return $title; |
|
497 | - } |
|
498 | - |
|
499 | - |
|
500 | - /** |
|
501 | - * @param WP_Post $post |
|
502 | - * @return string |
|
503 | - * @throws EE_Error |
|
504 | - * @throws ReflectionException |
|
505 | - * @since 4.10.14.p |
|
506 | - */ |
|
507 | - private function widgetContent(WP_Post $post) |
|
508 | - { |
|
509 | - // run the query |
|
510 | - $events = $this->getUpcomingEvents(); |
|
511 | - if (empty($events)) { |
|
512 | - return ''; |
|
513 | - } |
|
514 | - $list_items = ''; |
|
515 | - foreach ($events as $event) { |
|
516 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
517 | - $event_url = $this->eventUrl($event); |
|
518 | - $list_items .= ' |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + /** |
|
269 | + * Sanitize widget form values as they are saved. |
|
270 | + * |
|
271 | + * @param array $new_instance Values just sent to be saved. |
|
272 | + * @param array $old_instance Previously saved values from database. |
|
273 | + * |
|
274 | + * @return array Updated safe values to be saved. |
|
275 | + * @see WP_Widget::update() |
|
276 | + * |
|
277 | + */ |
|
278 | + public function update($new_instance, $old_instance) |
|
279 | + { |
|
280 | + $instance = $old_instance; |
|
281 | + $instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : ''; |
|
282 | + $instance['category_name'] = $new_instance['category_name']; |
|
283 | + $instance['show_expired'] = $new_instance['show_expired']; |
|
284 | + $instance['limit'] = $new_instance['limit']; |
|
285 | + $instance['sort'] = $new_instance['sort']; |
|
286 | + $instance['image_size'] = $new_instance['image_size']; |
|
287 | + $instance['show_desc'] = $new_instance['show_desc']; |
|
288 | + $instance['show_dates'] = $new_instance['show_dates']; |
|
289 | + $instance['show_everywhere'] = $new_instance['show_everywhere']; |
|
290 | + $instance['date_limit'] = $new_instance['date_limit']; |
|
291 | + $instance['date_range'] = $new_instance['date_range']; |
|
292 | + return $instance; |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + /** |
|
297 | + * Front-end display of widget. |
|
298 | + * |
|
299 | + * @param array $args Widget arguments. |
|
300 | + * @param array $instance Saved values from database. |
|
301 | + * @throws EE_Error |
|
302 | + * @throws ReflectionException |
|
303 | + * @see WP_Widget::widget() |
|
304 | + * |
|
305 | + */ |
|
306 | + public function widget($args, $instance) |
|
307 | + { |
|
308 | + |
|
309 | + global $post; |
|
310 | + // make sure there is some kinda post object |
|
311 | + if ($post instanceof WP_Post) { |
|
312 | + $before_widget = ''; |
|
313 | + $before_title = ''; |
|
314 | + $after_title = ''; |
|
315 | + $after_widget = ''; |
|
316 | + // but NOT an events archives page, cuz that would be like two event lists on the same page |
|
317 | + $show_everywhere = ! isset($instance['show_everywhere']) || absint($instance['show_everywhere']); |
|
318 | + if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) { |
|
319 | + // let's use some of the event helper functions' |
|
320 | + // make separate vars out of attributes |
|
321 | + extract($args); |
|
322 | + |
|
323 | + // grab widget settings |
|
324 | + $this->parseWidgetSettings($instance); |
|
325 | + $title = $this->widgetTitle(); |
|
326 | + |
|
327 | + // Before widget (defined by themes). |
|
328 | + echo wp_kses($before_widget, AllowedTags::getAllowedTags()); |
|
329 | + // Display the widget title if one was input (before and after defined by themes). |
|
330 | + if (! empty($title)) { |
|
331 | + echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags()); |
|
332 | + } |
|
333 | + echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags()); |
|
334 | + // After widget (defined by themes). |
|
335 | + echo wp_kses($after_widget, AllowedTags::getAllowedTags()); |
|
336 | + } |
|
337 | + } |
|
338 | + } |
|
339 | + |
|
340 | + |
|
341 | + /** |
|
342 | + * make_the_title_a_link |
|
343 | + * callback for widget_title filter |
|
344 | + * |
|
345 | + * @param $title |
|
346 | + * @return string |
|
347 | + */ |
|
348 | + public function make_the_title_a_link($title) |
|
349 | + { |
|
350 | + return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
351 | + } |
|
352 | + |
|
353 | + |
|
354 | + /** |
|
355 | + * @param string $field_name |
|
356 | + * @return string |
|
357 | + * @since 4.10.14.p |
|
358 | + */ |
|
359 | + public function fieldID($field_name) |
|
360 | + { |
|
361 | + return parent::get_field_id($field_name); |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * @param string $field_name |
|
367 | + * @return string |
|
368 | + * @since 4.10.14.p |
|
369 | + */ |
|
370 | + public function fieldName($field_name) |
|
371 | + { |
|
372 | + return parent::get_field_name($field_name); |
|
373 | + } |
|
374 | + |
|
375 | + |
|
376 | + /** |
|
377 | + * @param array $instance |
|
378 | + * @throws EE_Error |
|
379 | + * @throws ReflectionException |
|
380 | + * @since 4.10.14.p |
|
381 | + */ |
|
382 | + private function eventCategoriesSelector(array $instance) |
|
383 | + { |
|
384 | + $event_categories = []; |
|
385 | + $categories = EEM_Term::instance()->get_all_ee_categories(true); |
|
386 | + if ($categories) { |
|
387 | + foreach ($categories as $category) { |
|
388 | + if ($category instanceof EE_Term) { |
|
389 | + $event_categories[] = |
|
390 | + EE_Question_Option::new_instance( |
|
391 | + [ |
|
392 | + 'QSO_value' => $category->get('slug'), |
|
393 | + 'QSO_desc' => $category->get('name'), |
|
394 | + ] |
|
395 | + ); |
|
396 | + } |
|
397 | + } |
|
398 | + } |
|
399 | + array_unshift( |
|
400 | + $event_categories, |
|
401 | + EE_Question_Option::new_instance( |
|
402 | + [ |
|
403 | + 'QSO_value' => '', |
|
404 | + 'QSO_desc' => esc_html__(' - display all - ', 'event_espresso'), |
|
405 | + ] |
|
406 | + ) |
|
407 | + ); |
|
408 | + echo EEH_Form_Fields::select( |
|
409 | + esc_html__('Event Category:', 'event_espresso'), |
|
410 | + $instance['category_name'], |
|
411 | + $event_categories, |
|
412 | + $this->fieldName('category_name'), |
|
413 | + $this->fieldID('category_name') |
|
414 | + ); |
|
415 | + } |
|
416 | + |
|
417 | + |
|
418 | + /** |
|
419 | + * @param array $instance |
|
420 | + * @since 4.10.14.p |
|
421 | + */ |
|
422 | + private function imageSizeSelector(array $instance) |
|
423 | + { |
|
424 | + $image_sizes = []; |
|
425 | + $sizes = get_intermediate_image_sizes(); |
|
426 | + if ($sizes) { |
|
427 | + // loop thru images and create option objects out of them |
|
428 | + foreach ($sizes as $image_size) { |
|
429 | + $image_size = trim($image_size); |
|
430 | + // no big images plz |
|
431 | + if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
432 | + $image_sizes[] = |
|
433 | + EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
|
434 | + } |
|
435 | + } |
|
436 | + $image_sizes[] = |
|
437 | + EE_Question_Option::new_instance( |
|
438 | + ['QSO_value' => 'none', 'QSO_desc' => esc_html__('don\'t show images', 'event_espresso')] |
|
439 | + ); |
|
440 | + } |
|
441 | + echo EEH_Form_Fields::select( |
|
442 | + esc_html__('Image Size:', 'event_espresso'), |
|
443 | + $instance['image_size'], |
|
444 | + $image_sizes, |
|
445 | + $this->fieldName('image_size'), |
|
446 | + $this->fieldID('image_size') |
|
447 | + ); |
|
448 | + } |
|
449 | + |
|
450 | + |
|
451 | + /** |
|
452 | + * @param array $instance |
|
453 | + * @since 4.10.14.p |
|
454 | + */ |
|
455 | + private function parseWidgetSettings(array $instance) |
|
456 | + { |
|
457 | + $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
|
458 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
459 | + ? $instance['category_name'] |
|
460 | + : false; |
|
461 | + $this->show_expired = isset($instance['show_expired']) |
|
462 | + ? filter_var($instance['show_expired'], FILTER_VALIDATE_BOOLEAN) |
|
463 | + : 0; |
|
464 | + $this->image_size = isset($instance['image_size']) && ! empty($instance['image_size']) |
|
465 | + ? $instance['image_size'] |
|
466 | + : 'medium'; |
|
467 | + $this->show_desc = ! isset($instance['show_desc']) |
|
468 | + || filter_var($instance['show_desc'], FILTER_VALIDATE_BOOLEAN); |
|
469 | + $this->show_dates = ! isset($instance['show_dates']) |
|
470 | + || filter_var($instance['show_dates'], FILTER_VALIDATE_BOOLEAN); |
|
471 | + $this->date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) |
|
472 | + ? $instance['date_limit'] |
|
473 | + : null; |
|
474 | + $this->date_range = isset($instance['date_range']) && ! empty($instance['date_range']) |
|
475 | + ? $instance['date_range'] |
|
476 | + : false; |
|
477 | + $this->limit = isset($instance['limit']) ? absint($instance['limit']) : 10; |
|
478 | + $this->order = isset($instance['sort']) && $instance['sort'] === 'DESC' |
|
479 | + ? 'DESC' |
|
480 | + : 'ASC'; |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + /** |
|
485 | + * @return mixed|void |
|
486 | + * @since 4.10.14.p |
|
487 | + */ |
|
488 | + private function widgetTitle() |
|
489 | + { |
|
490 | + // add function to make the title a link |
|
491 | + add_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
492 | + // filter the title |
|
493 | + $title = apply_filters('widget_title', $this->title); |
|
494 | + // remove the function from the filter, so it does not affect other widgets |
|
495 | + remove_filter('widget_title', [$this, 'make_the_title_a_link'], 15); |
|
496 | + return $title; |
|
497 | + } |
|
498 | + |
|
499 | + |
|
500 | + /** |
|
501 | + * @param WP_Post $post |
|
502 | + * @return string |
|
503 | + * @throws EE_Error |
|
504 | + * @throws ReflectionException |
|
505 | + * @since 4.10.14.p |
|
506 | + */ |
|
507 | + private function widgetContent(WP_Post $post) |
|
508 | + { |
|
509 | + // run the query |
|
510 | + $events = $this->getUpcomingEvents(); |
|
511 | + if (empty($events)) { |
|
512 | + return ''; |
|
513 | + } |
|
514 | + $list_items = ''; |
|
515 | + foreach ($events as $event) { |
|
516 | + if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
517 | + $event_url = $this->eventUrl($event); |
|
518 | + $list_items .= ' |
|
519 | 519 | <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" |
520 | 520 | class="ee-upcoming-events-widget-li" |
521 | 521 | > |
@@ -526,194 +526,194 @@ discard block |
||
526 | 526 | </h5> |
527 | 527 | ' . $this->eventWidgetContent($event, $event_url) . ' |
528 | 528 | </li>'; |
529 | - } |
|
530 | - } |
|
531 | - return ' |
|
529 | + } |
|
530 | + } |
|
531 | + return ' |
|
532 | 532 | <ul class="ee-upcoming-events-widget-ul"> |
533 | 533 | ' . $list_items . ' |
534 | 534 | </ul>'; |
535 | - } |
|
536 | - |
|
537 | - |
|
538 | - /** |
|
539 | - * @param EE_Event $event |
|
540 | - * @return string|null |
|
541 | - * @throws EE_Error |
|
542 | - * @since 4.10.14.p |
|
543 | - */ |
|
544 | - private function eventUrl(EE_Event $event) |
|
545 | - { |
|
546 | - return esc_url_raw( |
|
547 | - apply_filters( |
|
548 | - 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
549 | - $event->get_permalink(), |
|
550 | - $event |
|
551 | - ) |
|
552 | - ); |
|
553 | - } |
|
554 | - |
|
555 | - |
|
556 | - /** |
|
557 | - * @return EE_Base_Class[] |
|
558 | - * @throws EE_Error |
|
559 | - */ |
|
560 | - private function getUpcomingEvents() |
|
561 | - { |
|
562 | - return EEM_Event::instance()->get_all( |
|
563 | - [ |
|
564 | - $this->queryWhereParams(), |
|
565 | - 'limit' => '0,' . $this->limit, |
|
566 | - 'order_by' => 'Datetime.DTT_EVT_start', |
|
567 | - 'order' => $this->order, |
|
568 | - 'group_by' => 'EVT_ID', |
|
569 | - ] |
|
570 | - ); |
|
571 | - } |
|
572 | - |
|
573 | - |
|
574 | - /** |
|
575 | - * @return mixed|void |
|
576 | - * @throws EE_Error |
|
577 | - * @since 4.10.14.p |
|
578 | - */ |
|
579 | - private function queryWhereParams() |
|
580 | - { |
|
581 | - // start to build our where clause |
|
582 | - $where = [ |
|
583 | - 'status' => ['IN', ['publish', 'sold_out']], |
|
584 | - ]; |
|
585 | - // add category |
|
586 | - if ($this->events_category) { |
|
587 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
588 | - $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
589 | - } |
|
590 | - // if NOT expired then we want events that start today or in the future |
|
591 | - // if NOT show expired then we want events that start today or in the future |
|
592 | - if ($this->show_expired == 0) { |
|
593 | - $where['Datetime.DTT_EVT_end'] = [ |
|
594 | - '>=', |
|
595 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
596 | - ]; |
|
597 | - } |
|
598 | - // if show ONLY expired we want events that ended prior to today |
|
599 | - if ($this->show_expired == 2) { |
|
600 | - $where['Datetime.DTT_EVT_end'] = [ |
|
601 | - '<=', |
|
602 | - EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
603 | - ]; |
|
604 | - } |
|
605 | - // allow $where to be filtered |
|
606 | - return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
607 | - } |
|
608 | - |
|
609 | - |
|
610 | - /** |
|
611 | - * @param EE_Event $event |
|
612 | - * @return string |
|
613 | - * @throws EE_Error |
|
614 | - * @throws ReflectionException |
|
615 | - * @since 4.10.14.p |
|
616 | - */ |
|
617 | - private function linkClass(EE_Event $event) |
|
618 | - { |
|
619 | - // how big is the event name ? |
|
620 | - $name_length = strlen($event->name()); |
|
621 | - switch ($name_length) { |
|
622 | - case $name_length > 70: |
|
623 | - return ' three-line'; |
|
624 | - case $name_length > 35: |
|
625 | - return ' two-line'; |
|
626 | - } |
|
627 | - return ' one-line'; |
|
628 | - } |
|
629 | - |
|
630 | - |
|
631 | - /** |
|
632 | - * @param EE_Event $event |
|
633 | - * @param string $event_url |
|
634 | - * @return mixed|string|void |
|
635 | - * @throws EE_Error |
|
636 | - * @throws ReflectionException |
|
637 | - * @since 4.10.14.p |
|
638 | - */ |
|
639 | - private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
640 | - { |
|
641 | - if (post_password_required($event->ID())) { |
|
642 | - return apply_filters( |
|
643 | - 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
644 | - get_the_password_form($event->ID()), |
|
645 | - $event |
|
646 | - ); |
|
647 | - } |
|
648 | - |
|
649 | - $content = ''; |
|
650 | - if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
651 | - $content .= ' |
|
535 | + } |
|
536 | + |
|
537 | + |
|
538 | + /** |
|
539 | + * @param EE_Event $event |
|
540 | + * @return string|null |
|
541 | + * @throws EE_Error |
|
542 | + * @since 4.10.14.p |
|
543 | + */ |
|
544 | + private function eventUrl(EE_Event $event) |
|
545 | + { |
|
546 | + return esc_url_raw( |
|
547 | + apply_filters( |
|
548 | + 'FHEE_EEW_Upcoming_Events__widget__event_url', |
|
549 | + $event->get_permalink(), |
|
550 | + $event |
|
551 | + ) |
|
552 | + ); |
|
553 | + } |
|
554 | + |
|
555 | + |
|
556 | + /** |
|
557 | + * @return EE_Base_Class[] |
|
558 | + * @throws EE_Error |
|
559 | + */ |
|
560 | + private function getUpcomingEvents() |
|
561 | + { |
|
562 | + return EEM_Event::instance()->get_all( |
|
563 | + [ |
|
564 | + $this->queryWhereParams(), |
|
565 | + 'limit' => '0,' . $this->limit, |
|
566 | + 'order_by' => 'Datetime.DTT_EVT_start', |
|
567 | + 'order' => $this->order, |
|
568 | + 'group_by' => 'EVT_ID', |
|
569 | + ] |
|
570 | + ); |
|
571 | + } |
|
572 | + |
|
573 | + |
|
574 | + /** |
|
575 | + * @return mixed|void |
|
576 | + * @throws EE_Error |
|
577 | + * @since 4.10.14.p |
|
578 | + */ |
|
579 | + private function queryWhereParams() |
|
580 | + { |
|
581 | + // start to build our where clause |
|
582 | + $where = [ |
|
583 | + 'status' => ['IN', ['publish', 'sold_out']], |
|
584 | + ]; |
|
585 | + // add category |
|
586 | + if ($this->events_category) { |
|
587 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
588 | + $where['Term_Taxonomy.Term.slug'] = $this->events_category; |
|
589 | + } |
|
590 | + // if NOT expired then we want events that start today or in the future |
|
591 | + // if NOT show expired then we want events that start today or in the future |
|
592 | + if ($this->show_expired == 0) { |
|
593 | + $where['Datetime.DTT_EVT_end'] = [ |
|
594 | + '>=', |
|
595 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'), |
|
596 | + ]; |
|
597 | + } |
|
598 | + // if show ONLY expired we want events that ended prior to today |
|
599 | + if ($this->show_expired == 2) { |
|
600 | + $where['Datetime.DTT_EVT_end'] = [ |
|
601 | + '<=', |
|
602 | + EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'), |
|
603 | + ]; |
|
604 | + } |
|
605 | + // allow $where to be filtered |
|
606 | + return apply_filters('FHEE__EEW_Upcoming_Events__widget__where', $where, $this->events_category, $this->show_expired); |
|
607 | + } |
|
608 | + |
|
609 | + |
|
610 | + /** |
|
611 | + * @param EE_Event $event |
|
612 | + * @return string |
|
613 | + * @throws EE_Error |
|
614 | + * @throws ReflectionException |
|
615 | + * @since 4.10.14.p |
|
616 | + */ |
|
617 | + private function linkClass(EE_Event $event) |
|
618 | + { |
|
619 | + // how big is the event name ? |
|
620 | + $name_length = strlen($event->name()); |
|
621 | + switch ($name_length) { |
|
622 | + case $name_length > 70: |
|
623 | + return ' three-line'; |
|
624 | + case $name_length > 35: |
|
625 | + return ' two-line'; |
|
626 | + } |
|
627 | + return ' one-line'; |
|
628 | + } |
|
629 | + |
|
630 | + |
|
631 | + /** |
|
632 | + * @param EE_Event $event |
|
633 | + * @param string $event_url |
|
634 | + * @return mixed|string|void |
|
635 | + * @throws EE_Error |
|
636 | + * @throws ReflectionException |
|
637 | + * @since 4.10.14.p |
|
638 | + */ |
|
639 | + private function eventWidgetContent(EE_Event $event, $event_url = '') |
|
640 | + { |
|
641 | + if (post_password_required($event->ID())) { |
|
642 | + return apply_filters( |
|
643 | + 'FHEE_EEW_Upcoming_Events__widget__password_form', |
|
644 | + get_the_password_form($event->ID()), |
|
645 | + $event |
|
646 | + ); |
|
647 | + } |
|
648 | + |
|
649 | + $content = ''; |
|
650 | + if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
|
651 | + $content .= ' |
|
652 | 652 | <div class="ee-upcoming-events-widget-img-dv"> |
653 | 653 | <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
654 | 654 | ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
655 | 655 | </a> |
656 | 656 | </div>'; |
657 | - } |
|
658 | - |
|
659 | - if ($this->show_dates) { |
|
660 | - $content .= $this->eventDates($event); |
|
661 | - } |
|
662 | - |
|
663 | - if ($this->show_desc) { |
|
664 | - $allowedtags = AllowedTags::getAllowedTags(); |
|
665 | - $desc = $event->short_description(25); |
|
666 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
667 | - } |
|
668 | - |
|
669 | - return $content; |
|
670 | - } |
|
671 | - |
|
672 | - |
|
673 | - /** |
|
674 | - * @param EE_Event $event |
|
675 | - * @return string |
|
676 | - * @throws EE_Error |
|
677 | - * @throws ReflectionException |
|
678 | - * @since 4.10.14.p |
|
679 | - */ |
|
680 | - private function eventDates(EE_Event $event) |
|
681 | - { |
|
682 | - $date_format = apply_filters( |
|
683 | - 'FHEE__espresso_event_date_range__date_format', |
|
684 | - get_option('date_format') |
|
685 | - ); |
|
686 | - $time_format = apply_filters( |
|
687 | - 'FHEE__espresso_event_date_range__time_format', |
|
688 | - get_option('time_format') |
|
689 | - ); |
|
690 | - $single_date_format = apply_filters( |
|
691 | - 'FHEE__espresso_event_date_range__single_date_format', |
|
692 | - get_option('date_format') |
|
693 | - ); |
|
694 | - $single_time_format = apply_filters( |
|
695 | - 'FHEE__espresso_event_date_range__single_time_format', |
|
696 | - get_option('time_format') |
|
697 | - ); |
|
698 | - if ($this->date_range == true) { |
|
699 | - return espresso_event_date_range( |
|
700 | - $date_format, |
|
701 | - $time_format, |
|
702 | - $single_date_format, |
|
703 | - $single_time_format, |
|
704 | - $event->ID(), |
|
705 | - false |
|
706 | - ); |
|
707 | - } |
|
708 | - return espresso_list_of_event_dates( |
|
709 | - $event->ID(), |
|
710 | - $date_format, |
|
711 | - $time_format, |
|
712 | - false, |
|
713 | - null, |
|
714 | - true, |
|
715 | - true, |
|
716 | - $this->date_limit |
|
717 | - ); |
|
718 | - } |
|
657 | + } |
|
658 | + |
|
659 | + if ($this->show_dates) { |
|
660 | + $content .= $this->eventDates($event); |
|
661 | + } |
|
662 | + |
|
663 | + if ($this->show_desc) { |
|
664 | + $allowedtags = AllowedTags::getAllowedTags(); |
|
665 | + $desc = $event->short_description(25); |
|
666 | + $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
667 | + } |
|
668 | + |
|
669 | + return $content; |
|
670 | + } |
|
671 | + |
|
672 | + |
|
673 | + /** |
|
674 | + * @param EE_Event $event |
|
675 | + * @return string |
|
676 | + * @throws EE_Error |
|
677 | + * @throws ReflectionException |
|
678 | + * @since 4.10.14.p |
|
679 | + */ |
|
680 | + private function eventDates(EE_Event $event) |
|
681 | + { |
|
682 | + $date_format = apply_filters( |
|
683 | + 'FHEE__espresso_event_date_range__date_format', |
|
684 | + get_option('date_format') |
|
685 | + ); |
|
686 | + $time_format = apply_filters( |
|
687 | + 'FHEE__espresso_event_date_range__time_format', |
|
688 | + get_option('time_format') |
|
689 | + ); |
|
690 | + $single_date_format = apply_filters( |
|
691 | + 'FHEE__espresso_event_date_range__single_date_format', |
|
692 | + get_option('date_format') |
|
693 | + ); |
|
694 | + $single_time_format = apply_filters( |
|
695 | + 'FHEE__espresso_event_date_range__single_time_format', |
|
696 | + get_option('time_format') |
|
697 | + ); |
|
698 | + if ($this->date_range == true) { |
|
699 | + return espresso_event_date_range( |
|
700 | + $date_format, |
|
701 | + $time_format, |
|
702 | + $single_date_format, |
|
703 | + $single_time_format, |
|
704 | + $event->ID(), |
|
705 | + false |
|
706 | + ); |
|
707 | + } |
|
708 | + return espresso_list_of_event_dates( |
|
709 | + $event->ID(), |
|
710 | + $date_format, |
|
711 | + $time_format, |
|
712 | + false, |
|
713 | + null, |
|
714 | + true, |
|
715 | + true, |
|
716 | + $this->date_limit |
|
717 | + ); |
|
718 | + } |
|
719 | 719 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | EE_Question_Option::new_instance(['QSO_value' => false, 'QSO_desc' => esc_html__('No', 'event_espresso')]), |
111 | 111 | EE_Question_Option::new_instance(['QSO_value' => true, 'QSO_desc' => esc_html__('Yes', 'event_espresso')]), |
112 | 112 | ]; |
113 | - $sort_values = [ |
|
113 | + $sort_values = [ |
|
114 | 114 | EE_Question_Option::new_instance(['QSO_value' => 'ASC', 'QSO_desc' => esc_html__('ASC', 'event_espresso')]), |
115 | 115 | EE_Question_Option::new_instance(['QSO_value' => 'DESC', 'QSO_desc' => esc_html__('DESC', 'event_espresso')]), |
116 | 116 | ]; |
@@ -327,8 +327,8 @@ discard block |
||
327 | 327 | // Before widget (defined by themes). |
328 | 328 | echo wp_kses($before_widget, AllowedTags::getAllowedTags()); |
329 | 329 | // Display the widget title if one was input (before and after defined by themes). |
330 | - if (! empty($title)) { |
|
331 | - echo wp_kses($before_title . $title . $after_title, AllowedTags::getAllowedTags()); |
|
330 | + if ( ! empty($title)) { |
|
331 | + echo wp_kses($before_title.$title.$after_title, AllowedTags::getAllowedTags()); |
|
332 | 332 | } |
333 | 333 | echo wp_kses($this->widgetContent($post), AllowedTags::getAllowedTags()); |
334 | 334 | // After widget (defined by themes). |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | public function make_the_title_a_link($title) |
349 | 349 | { |
350 | - return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>'; |
|
350 | + return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>'; |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | foreach ($sizes as $image_size) { |
429 | 429 | $image_size = trim($image_size); |
430 | 430 | // no big images plz |
431 | - if (! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
431 | + if ( ! in_array($image_size, ['large', 'post-thumbnail'])) { |
|
432 | 432 | $image_sizes[] = |
433 | 433 | EE_Question_Option::new_instance(['QSO_value' => $image_size, 'QSO_desc' => $image_size]); |
434 | 434 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | private function parseWidgetSettings(array $instance) |
456 | 456 | { |
457 | 457 | $this->title = isset($instance['title']) && ! empty($instance['title']) ? $instance['title'] : ''; |
458 | - $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
458 | + $this->events_category = isset($instance['category_name']) && ! empty($instance['category_name']) |
|
459 | 459 | ? $instance['category_name'] |
460 | 460 | : false; |
461 | 461 | $this->show_expired = isset($instance['show_expired']) |
@@ -513,24 +513,24 @@ discard block |
||
513 | 513 | } |
514 | 514 | $list_items = ''; |
515 | 515 | foreach ($events as $event) { |
516 | - if ($event instanceof EE_Event && (! is_single() || $post->ID != $event->ID())) { |
|
516 | + if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) { |
|
517 | 517 | $event_url = $this->eventUrl($event); |
518 | 518 | $list_items .= ' |
519 | - <li id="ee-upcoming-events-widget-li-' . absint($event->ID()) . '" |
|
519 | + <li id="ee-upcoming-events-widget-li-' . absint($event->ID()).'" |
|
520 | 520 | class="ee-upcoming-events-widget-li" |
521 | 521 | > |
522 | 522 | <h5 class="ee-upcoming-events-widget-title-h5"> |
523 | - <a class="ee-widget-event-name-a' . $this->linkClass($event) . '" href="' . $event_url . '"> |
|
524 | - ' . esc_html($event->name()) . ' |
|
523 | + <a class="ee-widget-event-name-a' . $this->linkClass($event).'" href="'.$event_url.'"> |
|
524 | + ' . esc_html($event->name()).' |
|
525 | 525 | </a> |
526 | 526 | </h5> |
527 | - ' . $this->eventWidgetContent($event, $event_url) . ' |
|
527 | + ' . $this->eventWidgetContent($event, $event_url).' |
|
528 | 528 | </li>'; |
529 | 529 | } |
530 | 530 | } |
531 | 531 | return ' |
532 | 532 | <ul class="ee-upcoming-events-widget-ul"> |
533 | - ' . $list_items . ' |
|
533 | + ' . $list_items.' |
|
534 | 534 | </ul>'; |
535 | 535 | } |
536 | 536 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | return EEM_Event::instance()->get_all( |
563 | 563 | [ |
564 | 564 | $this->queryWhereParams(), |
565 | - 'limit' => '0,' . $this->limit, |
|
565 | + 'limit' => '0,'.$this->limit, |
|
566 | 566 | 'order_by' => 'Datetime.DTT_EVT_start', |
567 | 567 | 'order' => $this->order, |
568 | 568 | 'group_by' => 'EVT_ID', |
@@ -650,8 +650,8 @@ discard block |
||
650 | 650 | if (has_post_thumbnail($event->ID()) && $this->image_size != 'none') { |
651 | 651 | $content .= ' |
652 | 652 | <div class="ee-upcoming-events-widget-img-dv"> |
653 | - <a class="ee-upcoming-events-widget-img" href="' . $event_url . '"> |
|
654 | - ' . get_the_post_thumbnail($event->ID(), $this->image_size) . ' |
|
653 | + <a class="ee-upcoming-events-widget-img" href="' . $event_url.'"> |
|
654 | + ' . get_the_post_thumbnail($event->ID(), $this->image_size).' |
|
655 | 655 | </a> |
656 | 656 | </div>'; |
657 | 657 | } |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | |
663 | 663 | if ($this->show_desc) { |
664 | 664 | $allowedtags = AllowedTags::getAllowedTags(); |
665 | - $desc = $event->short_description(25); |
|
666 | - $content .= $desc ? '<p style="margin-top: .5em">' . wp_kses($desc, $allowedtags) . '</p>' : ''; |
|
665 | + $desc = $event->short_description(25); |
|
666 | + $content .= $desc ? '<p style="margin-top: .5em">'.wp_kses($desc, $allowedtags).'</p>' : ''; |
|
667 | 667 | } |
668 | 668 | |
669 | 669 | return $content; |
@@ -679,11 +679,11 @@ discard block |
||
679 | 679 | */ |
680 | 680 | private function eventDates(EE_Event $event) |
681 | 681 | { |
682 | - $date_format = apply_filters( |
|
682 | + $date_format = apply_filters( |
|
683 | 683 | 'FHEE__espresso_event_date_range__date_format', |
684 | 684 | get_option('date_format') |
685 | 685 | ); |
686 | - $time_format = apply_filters( |
|
686 | + $time_format = apply_filters( |
|
687 | 687 | 'FHEE__espresso_event_date_range__time_format', |
688 | 688 | get_option('time_format') |
689 | 689 | ); |
@@ -14,9 +14,9 @@ discard block |
||
14 | 14 | |
15 | 15 | <h2 class="ee-admin-settings-hdr"> |
16 | 16 | <?php |
17 | - echo esc_html__('Countries and States/Provinces', 'event_espresso'); |
|
18 | - echo EEH_Template::get_help_tab_link('country_select_info'); // already escaped |
|
19 | - ?> |
|
17 | + echo esc_html__('Countries and States/Provinces', 'event_espresso'); |
|
18 | + echo EEH_Template::get_help_tab_link('country_select_info'); // already escaped |
|
19 | + ?> |
|
20 | 20 | </h2> |
21 | 21 | <table class="form-table"> |
22 | 22 | <tbody> |
@@ -26,27 +26,27 @@ discard block |
||
26 | 26 | <br/> |
27 | 27 | <p> |
28 | 28 | <?php esc_html_e( |
29 | - 'The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.', |
|
30 | - 'event_espresso' |
|
31 | - ); ?> |
|
29 | + 'The country that is selected above will populate the Country Details settings and the options for States/Provinces. This information will be used throughout Event Espresso including for registration purposes and how currency is displayed. If you make a change to the country on this page, it is important that you also update your Contact Information on the Your Organization tab.', |
|
30 | + 'event_espresso' |
|
31 | + ); ?> |
|
32 | 32 | </p> |
33 | 33 | <p id="country-currency-setting-disabled-pg" style="display: none;"> |
34 | 34 | <span class="reminder-spn"> |
35 | 35 | <?php printf( |
36 | - esc_html__( |
|
37 | - 'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.', |
|
38 | - 'event_espresso' |
|
39 | - ), |
|
40 | - $CNT_name_for_site |
|
41 | - ); ?> |
|
36 | + esc_html__( |
|
37 | + 'Currency setting inputs are currently only enabled for the country "%1$s" which is the selected country for the site. This can be changed in the "Contact Information" section under the "Your Organization" tab of the Event Espresso - General Settings.', |
|
38 | + 'event_espresso' |
|
39 | + ), |
|
40 | + $CNT_name_for_site |
|
41 | + ); ?> |
|
42 | 42 | </span> |
43 | 43 | </p> |
44 | 44 | <div id="country-details-settings-dv"> |
45 | 45 | <h2 class="ee-admin-settings-hdr"> |
46 | 46 | <?php |
47 | - echo esc_html__('Country Details', 'event_espresso'); |
|
48 | - echo EEH_Template::get_help_tab_link('country_details_info'); // already escaped |
|
49 | - ?> |
|
47 | + echo esc_html__('Country Details', 'event_espresso'); |
|
48 | + echo EEH_Template::get_help_tab_link('country_details_info'); // already escaped |
|
49 | + ?> |
|
50 | 50 | </h2> |
51 | 51 | <div id="country-details-dv"><?php echo wp_kses($country_details_settings, AllowedTags::getAllowedTags()); ?></div> |
52 | 52 | </div> |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | <div id="country-states-settings-dv"> |
55 | 55 | <h2 class="ee-admin-settings-hdr"> |
56 | 56 | <?php |
57 | - echo esc_html__('States/Provinces', 'event_espresso'); |
|
58 | - echo EEH_Template::get_help_tab_link('country_states_info'); // already escaped |
|
59 | - ?> |
|
57 | + echo esc_html__('States/Provinces', 'event_espresso'); |
|
58 | + echo EEH_Template::get_help_tab_link('country_states_info'); // already escaped |
|
59 | + ?> |
|
60 | 60 | </h2> |
61 | 61 | <div id="country-states-dv"><?php echo wp_kses($country_states_settings, AllowedTags::getAllowedTags()); ?></div> |
62 | 62 | </div> |