Completed
Branch master (c63335)
by
unknown
17:58 queued 13:20
created
core/helpers/EEH_Event_View.helper.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         }
39 39
         // reset property so that the new event is cached.
40 40
         EEH_Event_View::$_event = null;
41
-        if (! $EVT_ID && $post instanceof EE_Event) {
41
+        if ( ! $EVT_ID && $post instanceof EE_Event) {
42 42
             EEH_Event_View::$_event = $post;
43 43
             return EEH_Event_View::$_event;
44 44
         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             return EEH_Event_View::$_event;
58 58
         }
59 59
         // If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
60
-        if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
60
+        if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
61 61
             EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
62 62
         }
63 63
         return EEH_Event_View::$_event;
@@ -164,18 +164,18 @@  discard block
 block discarded – undo
164 164
                 // admin has chosen "excerpt (short desc)"
165 165
                 // for the "Event Espresso - Events > Templates > Display Description" option
166 166
                 // but NO excerpt actually exists, so we need to create one
167
-                if (! empty($num_words)) {
167
+                if ( ! empty($num_words)) {
168 168
                     if (empty($more)) {
169 169
                         $more_link_text = esc_html__('(more…)', 'event_espresso');
170
-                        $more           = ' <a href="' . get_permalink() . '"';
170
+                        $more           = ' <a href="'.get_permalink().'"';
171 171
                         $more           .= ' class="more-link"';
172 172
                         $more           .= EED_Events_Archive::link_target();
173
-                        $more           .= '>' . $more_link_text . '</a>';
174
-                        $more           = apply_filters('the_content_more_link', $more, $more_link_text);
173
+                        $more           .= '>'.$more_link_text.'</a>';
174
+                        $more = apply_filters('the_content_more_link', $more, $more_link_text);
175 175
                     }
176 176
                     $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
177 177
 
178
-                    $content = wp_trim_words($content, $num_words, ' ') . $more;
178
+                    $content = wp_trim_words($content, $num_words, ' ').$more;
179 179
                 } else {
180 180
                     $content = get_the_content();
181 181
                 }
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
                             || ! $hide_uncategorized
258 258
                         )
259 259
                     ) {
260
-                        $category_links[] = '<a href="' . esc_url_raw($url) . '" '
261
-                                            . 'rel="tag" ' . EED_Events_Archive::link_target() . '>'
260
+                        $category_links[] = '<a href="'.esc_url_raw($url).'" '
261
+                                            . 'rel="tag" '.EED_Events_Archive::link_target().'>'
262 262
                                             . esc_html($term->name)
263 263
                                             . '</a>';
264 264
                     }
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
     {
284 284
         $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
285 285
         $format   = ! empty($date_format) && ! empty($time_format)
286
-                ? $date_format . ' ' . $time_format
287
-                : $date_format . $time_format;
286
+                ? $date_format.' '.$time_format
287
+                : $date_format.$time_format;
288 288
         return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
289 289
     }
290 290
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         $datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
305 305
         $format   =
306 306
             ! empty($date_format) && ! empty($time_format)
307
-                ? $date_format . ' ' . $time_format
307
+                ? $date_format.' '.$time_format
308 308
                 : $date_format
309 309
                   . $time_format;
310 310
         return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
327 327
         $format   =
328 328
             ! empty($date_format) && ! empty($time_format)
329
-                ? $date_format . ' ' . $time_format
329
+                ? $date_format.' '.$time_format
330 330
                 : $date_format
331 331
                   . $time_format;
332 332
         return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
349 349
         $format   =
350 350
             ! empty($date_format) && ! empty($time_format)
351
-                ? $date_format . ' ' . $time_format
351
+                ? $date_format.' '.$time_format
352 352
                 : $date_format
353 353
                   . $time_format;
354 354
         return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
             $url = $event->external_url() !== null && $event->external_url() !== ''
554 554
                 ? $event->external_url()
555 555
                 : get_permalink($event->ID());
556
-            $url = preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'https://' . $url;
556
+            $url = preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'https://'.$url;
557 557
             return esc_url_raw($url);
558 558
         }
559 559
         return '';
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
                 // get edit CPT text
615 615
                 $post_type_obj = get_post_type_object('espresso_events');
616 616
                 // build final link html
617
-                $link = '<a class="post-edit-link" href="' . $url . '" ';
618
-                $link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
617
+                $link = '<a class="post-edit-link" href="'.$url.'" ';
618
+                $link .= ' title="'.esc_attr($post_type_obj->labels->edit_item).'"';
619 619
                 $link .= EED_Events_Archive::link_target();
620
-                $link .= '>' . $link_text . '</a>';
620
+                $link .= '>'.$link_text.'</a>';
621 621
                 // put it all together
622
-                return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
622
+                return $before.apply_filters('edit_post_link', $link, $event->ID()).$after;
623 623
             }
624 624
         }
625 625
         return '';
Please login to merge, or discard this patch.
Indentation   +629 added lines, -629 removed lines patch added patch discarded remove patch
@@ -9,364 +9,364 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class EEH_Event_View extends EEH_Base
11 11
 {
12
-    /**
13
-     * @var EE_Event $_event
14
-     */
15
-    private static $_event = null;
16
-
17
-
18
-    /**
19
-     * get_event
20
-     * attempts to retrieve an EE_Event object any way it can
21
-     *
22
-     * @param int|WP_Post $EVT_ID
23
-     * @return EE_Event|null
24
-     * @throws EE_Error
25
-     * @throws ReflectionException
26
-     */
27
-    public static function get_event($EVT_ID = 0)
28
-    {
29
-        // international newspaper?
30
-        global $post;
31
-        $EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events'
32
-            ? $EVT_ID->ID
33
-            : absint($EVT_ID);
34
-        // do we already have the Event  you are looking for?
35
-        if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
36
-            return EEH_Event_View::$_event;
37
-        }
38
-        // reset property so that the new event is cached.
39
-        EEH_Event_View::$_event = null;
40
-        if (! $EVT_ID && $post instanceof EE_Event) {
41
-            EEH_Event_View::$_event = $post;
42
-            return EEH_Event_View::$_event;
43
-        }
44
-        // if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID
45
-        // then let's just use that cached event on the $post object.
46
-        if (
47
-            $post instanceof WP_Post
48
-            && $post->post_type === 'espresso_events'
49
-            && isset($post->EE_Event)
50
-            && (
51
-                $EVT_ID === 0
52
-                || $EVT_ID === $post->ID
53
-            )
54
-        ) {
55
-            EEH_Event_View::$_event = $post->EE_Event;
56
-            return EEH_Event_View::$_event;
57
-        }
58
-        // If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
59
-        if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
60
-            EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
61
-        }
62
-        return EEH_Event_View::$_event;
63
-    }
64
-
65
-
66
-    /**
67
-     *    display_ticket_selector
68
-     *
69
-     * @param int $EVT_ID
70
-     * @return    boolean
71
-     * @throws EE_Error
72
-     * @throws EE_Error
73
-     * @throws ReflectionException
74
-     */
75
-    public static function display_ticket_selector($EVT_ID = 0)
76
-    {
77
-        $event = EEH_Event_View::get_event($EVT_ID);
78
-        return $event instanceof EE_Event && $event->display_ticket_selector();
79
-    }
80
-
81
-
82
-    /**
83
-     *    event_status
84
-     *
85
-     * @param int $EVT_ID
86
-     * @return    string
87
-     * @throws EE_Error
88
-     * @throws EE_Error
89
-     * @throws ReflectionException
90
-     */
91
-    public static function event_status($EVT_ID = 0)
92
-    {
93
-        $event = EEH_Event_View::get_event($EVT_ID);
94
-        return $event instanceof EE_Event ? $event->pretty_active_status(false) : '';
95
-    }
96
-
97
-
98
-    /**
99
-     *  event_active_status
100
-     *
101
-     * @param int $EVT_ID
102
-     * @return     string
103
-     * @throws EE_Error
104
-     * @throws EE_Error
105
-     * @throws ReflectionException
106
-     */
107
-    public static function event_active_status($EVT_ID = 0, $echo = true)
108
-    {
109
-        $event = EEH_Event_View::get_event($EVT_ID);
110
-        return $event instanceof EE_Event ? $event->pretty_active_status($echo) : 'inactive';
111
-    }
112
-
113
-
114
-    /**
115
-     *  event_has_content_or_excerpt
116
-     *
117
-     * @param int $EVT_ID
118
-     * @return     bool
119
-     * @throws EE_Error
120
-     * @throws EE_Error
121
-     * @throws ReflectionException
122
-     */
123
-    public static function event_has_content_or_excerpt($EVT_ID = 0)
124
-    {
125
-        $event                  = EEH_Event_View::get_event($EVT_ID);
126
-        $has_content_or_excerpt = false;
127
-        if ($event instanceof EE_Event) {
128
-            $has_content_or_excerpt = $event->description() != '' || $event->short_description(null, null, true) != '';
129
-        }
130
-        if (
131
-            is_archive()
132
-            && ! (espresso_display_full_description_in_event_list()
133
-                  || espresso_display_excerpt_in_event_list())
134
-        ) {
135
-            $has_content_or_excerpt = false;
136
-        }
137
-        return $has_content_or_excerpt;
138
-    }
139
-
140
-
141
-    /**
142
-     *    event_active_status
143
-     *
144
-     * @param null $num_words
145
-     * @param null $more
146
-     * @return    string
147
-     */
148
-    public static function event_content_or_excerpt($num_words = null, $more = null)
149
-    {
150
-        global $post;
151
-        ob_start();
152
-        if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
153
-            // admin has chosen "full description"
154
-            // for the "Event Espresso - Events > Templates > Display Description" option
155
-            the_content();
156
-        } elseif ((is_archive() && espresso_display_excerpt_in_event_list())) {
157
-            if (has_excerpt($post->ID)) {
158
-                // admin has chosen "excerpt (short desc)"
159
-                // for the "Event Espresso - Events > Templates > Display Description" option
160
-                // AND an excerpt actually exists
161
-                the_excerpt();
162
-            } else {
163
-                // admin has chosen "excerpt (short desc)"
164
-                // for the "Event Espresso - Events > Templates > Display Description" option
165
-                // but NO excerpt actually exists, so we need to create one
166
-                if (! empty($num_words)) {
167
-                    if (empty($more)) {
168
-                        $more_link_text = esc_html__('(more&hellip;)', 'event_espresso');
169
-                        $more           = ' <a href="' . get_permalink() . '"';
170
-                        $more           .= ' class="more-link"';
171
-                        $more           .= EED_Events_Archive::link_target();
172
-                        $more           .= '>' . $more_link_text . '</a>';
173
-                        $more           = apply_filters('the_content_more_link', $more, $more_link_text);
174
-                    }
175
-                    $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
176
-
177
-                    $content = wp_trim_words($content, $num_words, ' ') . $more;
178
-                } else {
179
-                    $content = get_the_content();
180
-                }
181
-                global $allowedtags;
182
-                // make sure links are allowed
183
-                $allowedtags['a'] = isset($allowedtags['a'])
184
-                    ? $allowedtags['a']
185
-                    : [];
186
-                // as well as target attribute
187
-                $allowedtags['a']['target'] = isset($allowedtags['a']['target'])
188
-                    ? $allowedtags['a']['target']
189
-                    : false;
190
-                // but get previous value so we can reset it
191
-                $prev_value                 = $allowedtags['a']['target'];
192
-                $allowedtags['a']['target'] = true;
193
-                $content                    = wp_kses($content, $allowedtags);
194
-                $content                    = strip_shortcodes($content);
195
-                echo apply_filters('the_content', $content);
196
-                $allowedtags['a']['target'] = $prev_value;
197
-            }
198
-        } else {
199
-            // admin has chosen "none"
200
-            // for the "Event Espresso - Events > Templates > Display Description" option
201
-            echo apply_filters('the_content', '');
202
-        }
203
-        return ob_get_clean();
204
-    }
205
-
206
-
207
-    /**
208
-     *  event_tickets_available
209
-     *
210
-     * @param int $EVT_ID
211
-     * @return     EE_Ticket[]
212
-     * @throws EE_Error
213
-     * @throws ReflectionException
214
-     */
215
-    public static function event_tickets_available($EVT_ID = 0)
216
-    {
217
-        $event                          = EEH_Event_View::get_event($EVT_ID);
218
-        $tickets_available_for_purchase = [];
219
-        if ($event instanceof EE_Event) {
220
-            $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, false);
221
-            foreach ($datetimes as $datetime) {
222
-                $tickets_available_for_purchase =
223
-                    array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
224
-            }
225
-        }
226
-        return $tickets_available_for_purchase;
227
-    }
228
-
229
-
230
-    /**
231
-     *    the_event_date
232
-     *
233
-     * @param int  $EVT_ID
234
-     * @param bool $hide_uncategorized
235
-     * @return    string
236
-     * @throws EE_Error
237
-     * @throws ReflectionException
238
-     */
239
-    public static function event_categories($EVT_ID = 0, $hide_uncategorized = true)
240
-    {
241
-        $category_links = [];
242
-        $event          = EEH_Event_View::get_event($EVT_ID);
243
-        if ($event instanceof EE_Event) {
244
-            $event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
245
-            if ($event_categories) {
246
-                // loop thru terms and create links
247
-                foreach ($event_categories as $term) {
248
-                    $url = get_term_link($term, 'espresso_venue_categories');
249
-                    if (
250
-                        ! is_wp_error($url)
251
-                        && (
252
-                            (
253
-                                $hide_uncategorized
254
-                                && strtolower($term->name) != esc_html__('uncategorized', 'event_espresso')
255
-                            )
256
-                            || ! $hide_uncategorized
257
-                        )
258
-                    ) {
259
-                        $category_links[] = '<a href="' . esc_url_raw($url) . '" '
260
-                                            . 'rel="tag" ' . EED_Events_Archive::link_target() . '>'
261
-                                            . esc_html($term->name)
262
-                                            . '</a>';
263
-                    }
264
-                }
265
-            }
266
-        }
267
-        return implode(', ', $category_links);
268
-    }
269
-
270
-
271
-    /**
272
-     *    the_event_date - first date by date order
273
-     *
274
-     * @param string $date_format
275
-     * @param string $time_format
276
-     * @param int    $EVT_ID
277
-     * @return    string
278
-     * @throws EE_Error
279
-     * @throws ReflectionException
280
-     */
281
-    public static function the_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
282
-    {
283
-        $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
284
-        $format   = ! empty($date_format) && ! empty($time_format)
285
-                ? $date_format . ' ' . $time_format
286
-                : $date_format . $time_format;
287
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
288
-    }
289
-
290
-
291
-    /**
292
-     *    the_event_end_date - last date by date order
293
-     *
294
-     * @param string $date_format
295
-     * @param string $time_format
296
-     * @param int    $EVT_ID
297
-     * @return    string
298
-     * @throws EE_Error
299
-     * @throws ReflectionException
300
-     */
301
-    public static function the_event_end_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
302
-    {
303
-        $datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
304
-        $format   =
305
-            ! empty($date_format) && ! empty($time_format)
306
-                ? $date_format . ' ' . $time_format
307
-                : $date_format
308
-                  . $time_format;
309
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
310
-    }
311
-
312
-
313
-    /**
314
-     *    the_earliest_event_date - first date chronologically
315
-     *
316
-     * @param string $date_format
317
-     * @param string $time_format
318
-     * @param int    $EVT_ID
319
-     * @return    string
320
-     * @throws EE_Error
321
-     * @throws ReflectionException
322
-     */
323
-    public static function the_earliest_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
324
-    {
325
-        $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
326
-        $format   =
327
-            ! empty($date_format) && ! empty($time_format)
328
-                ? $date_format . ' ' . $time_format
329
-                : $date_format
330
-                  . $time_format;
331
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
332
-    }
333
-
334
-
335
-    /**
336
-     *    the_latest_event_date - latest date chronologically
337
-     *
338
-     * @param string $date_format
339
-     * @param string $time_format
340
-     * @param int    $EVT_ID
341
-     * @return    string
342
-     * @throws EE_Error
343
-     * @throws ReflectionException
344
-     */
345
-    public static function the_latest_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
346
-    {
347
-        $datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
348
-        $format   =
349
-            ! empty($date_format) && ! empty($time_format)
350
-                ? $date_format . ' ' . $time_format
351
-                : $date_format
352
-                  . $time_format;
353
-        return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
354
-    }
355
-
356
-
357
-    /**
358
-     *    event_date_as_calendar_page
359
-     *
360
-     * @param int $EVT_ID
361
-     * @return    void
362
-     * @throws EE_Error
363
-     * @throws ReflectionException
364
-     */
365
-    public static function event_date_as_calendar_page($EVT_ID = 0)
366
-    {
367
-        $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
368
-        if ($datetime instanceof EE_Datetime) {
369
-            ?>
12
+	/**
13
+	 * @var EE_Event $_event
14
+	 */
15
+	private static $_event = null;
16
+
17
+
18
+	/**
19
+	 * get_event
20
+	 * attempts to retrieve an EE_Event object any way it can
21
+	 *
22
+	 * @param int|WP_Post $EVT_ID
23
+	 * @return EE_Event|null
24
+	 * @throws EE_Error
25
+	 * @throws ReflectionException
26
+	 */
27
+	public static function get_event($EVT_ID = 0)
28
+	{
29
+		// international newspaper?
30
+		global $post;
31
+		$EVT_ID = $EVT_ID instanceof WP_Post && $EVT_ID->post_type === 'espresso_events'
32
+			? $EVT_ID->ID
33
+			: absint($EVT_ID);
34
+		// do we already have the Event  you are looking for?
35
+		if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) {
36
+			return EEH_Event_View::$_event;
37
+		}
38
+		// reset property so that the new event is cached.
39
+		EEH_Event_View::$_event = null;
40
+		if (! $EVT_ID && $post instanceof EE_Event) {
41
+			EEH_Event_View::$_event = $post;
42
+			return EEH_Event_View::$_event;
43
+		}
44
+		// if the post type is for an event and it has a cached event and we don't have a different incoming $EVT_ID
45
+		// then let's just use that cached event on the $post object.
46
+		if (
47
+			$post instanceof WP_Post
48
+			&& $post->post_type === 'espresso_events'
49
+			&& isset($post->EE_Event)
50
+			&& (
51
+				$EVT_ID === 0
52
+				|| $EVT_ID === $post->ID
53
+			)
54
+		) {
55
+			EEH_Event_View::$_event = $post->EE_Event;
56
+			return EEH_Event_View::$_event;
57
+		}
58
+		// If the event we have isn't an event but we do have an EVT_ID, let's try getting the event using the ID.
59
+		if (! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) {
60
+			EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
61
+		}
62
+		return EEH_Event_View::$_event;
63
+	}
64
+
65
+
66
+	/**
67
+	 *    display_ticket_selector
68
+	 *
69
+	 * @param int $EVT_ID
70
+	 * @return    boolean
71
+	 * @throws EE_Error
72
+	 * @throws EE_Error
73
+	 * @throws ReflectionException
74
+	 */
75
+	public static function display_ticket_selector($EVT_ID = 0)
76
+	{
77
+		$event = EEH_Event_View::get_event($EVT_ID);
78
+		return $event instanceof EE_Event && $event->display_ticket_selector();
79
+	}
80
+
81
+
82
+	/**
83
+	 *    event_status
84
+	 *
85
+	 * @param int $EVT_ID
86
+	 * @return    string
87
+	 * @throws EE_Error
88
+	 * @throws EE_Error
89
+	 * @throws ReflectionException
90
+	 */
91
+	public static function event_status($EVT_ID = 0)
92
+	{
93
+		$event = EEH_Event_View::get_event($EVT_ID);
94
+		return $event instanceof EE_Event ? $event->pretty_active_status(false) : '';
95
+	}
96
+
97
+
98
+	/**
99
+	 *  event_active_status
100
+	 *
101
+	 * @param int $EVT_ID
102
+	 * @return     string
103
+	 * @throws EE_Error
104
+	 * @throws EE_Error
105
+	 * @throws ReflectionException
106
+	 */
107
+	public static function event_active_status($EVT_ID = 0, $echo = true)
108
+	{
109
+		$event = EEH_Event_View::get_event($EVT_ID);
110
+		return $event instanceof EE_Event ? $event->pretty_active_status($echo) : 'inactive';
111
+	}
112
+
113
+
114
+	/**
115
+	 *  event_has_content_or_excerpt
116
+	 *
117
+	 * @param int $EVT_ID
118
+	 * @return     bool
119
+	 * @throws EE_Error
120
+	 * @throws EE_Error
121
+	 * @throws ReflectionException
122
+	 */
123
+	public static function event_has_content_or_excerpt($EVT_ID = 0)
124
+	{
125
+		$event                  = EEH_Event_View::get_event($EVT_ID);
126
+		$has_content_or_excerpt = false;
127
+		if ($event instanceof EE_Event) {
128
+			$has_content_or_excerpt = $event->description() != '' || $event->short_description(null, null, true) != '';
129
+		}
130
+		if (
131
+			is_archive()
132
+			&& ! (espresso_display_full_description_in_event_list()
133
+				  || espresso_display_excerpt_in_event_list())
134
+		) {
135
+			$has_content_or_excerpt = false;
136
+		}
137
+		return $has_content_or_excerpt;
138
+	}
139
+
140
+
141
+	/**
142
+	 *    event_active_status
143
+	 *
144
+	 * @param null $num_words
145
+	 * @param null $more
146
+	 * @return    string
147
+	 */
148
+	public static function event_content_or_excerpt($num_words = null, $more = null)
149
+	{
150
+		global $post;
151
+		ob_start();
152
+		if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) {
153
+			// admin has chosen "full description"
154
+			// for the "Event Espresso - Events > Templates > Display Description" option
155
+			the_content();
156
+		} elseif ((is_archive() && espresso_display_excerpt_in_event_list())) {
157
+			if (has_excerpt($post->ID)) {
158
+				// admin has chosen "excerpt (short desc)"
159
+				// for the "Event Espresso - Events > Templates > Display Description" option
160
+				// AND an excerpt actually exists
161
+				the_excerpt();
162
+			} else {
163
+				// admin has chosen "excerpt (short desc)"
164
+				// for the "Event Espresso - Events > Templates > Display Description" option
165
+				// but NO excerpt actually exists, so we need to create one
166
+				if (! empty($num_words)) {
167
+					if (empty($more)) {
168
+						$more_link_text = esc_html__('(more&hellip;)', 'event_espresso');
169
+						$more           = ' <a href="' . get_permalink() . '"';
170
+						$more           .= ' class="more-link"';
171
+						$more           .= EED_Events_Archive::link_target();
172
+						$more           .= '>' . $more_link_text . '</a>';
173
+						$more           = apply_filters('the_content_more_link', $more, $more_link_text);
174
+					}
175
+					$content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK'));
176
+
177
+					$content = wp_trim_words($content, $num_words, ' ') . $more;
178
+				} else {
179
+					$content = get_the_content();
180
+				}
181
+				global $allowedtags;
182
+				// make sure links are allowed
183
+				$allowedtags['a'] = isset($allowedtags['a'])
184
+					? $allowedtags['a']
185
+					: [];
186
+				// as well as target attribute
187
+				$allowedtags['a']['target'] = isset($allowedtags['a']['target'])
188
+					? $allowedtags['a']['target']
189
+					: false;
190
+				// but get previous value so we can reset it
191
+				$prev_value                 = $allowedtags['a']['target'];
192
+				$allowedtags['a']['target'] = true;
193
+				$content                    = wp_kses($content, $allowedtags);
194
+				$content                    = strip_shortcodes($content);
195
+				echo apply_filters('the_content', $content);
196
+				$allowedtags['a']['target'] = $prev_value;
197
+			}
198
+		} else {
199
+			// admin has chosen "none"
200
+			// for the "Event Espresso - Events > Templates > Display Description" option
201
+			echo apply_filters('the_content', '');
202
+		}
203
+		return ob_get_clean();
204
+	}
205
+
206
+
207
+	/**
208
+	 *  event_tickets_available
209
+	 *
210
+	 * @param int $EVT_ID
211
+	 * @return     EE_Ticket[]
212
+	 * @throws EE_Error
213
+	 * @throws ReflectionException
214
+	 */
215
+	public static function event_tickets_available($EVT_ID = 0)
216
+	{
217
+		$event                          = EEH_Event_View::get_event($EVT_ID);
218
+		$tickets_available_for_purchase = [];
219
+		if ($event instanceof EE_Event) {
220
+			$datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, false);
221
+			foreach ($datetimes as $datetime) {
222
+				$tickets_available_for_purchase =
223
+					array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase());
224
+			}
225
+		}
226
+		return $tickets_available_for_purchase;
227
+	}
228
+
229
+
230
+	/**
231
+	 *    the_event_date
232
+	 *
233
+	 * @param int  $EVT_ID
234
+	 * @param bool $hide_uncategorized
235
+	 * @return    string
236
+	 * @throws EE_Error
237
+	 * @throws ReflectionException
238
+	 */
239
+	public static function event_categories($EVT_ID = 0, $hide_uncategorized = true)
240
+	{
241
+		$category_links = [];
242
+		$event          = EEH_Event_View::get_event($EVT_ID);
243
+		if ($event instanceof EE_Event) {
244
+			$event_categories = get_the_terms($event->ID(), 'espresso_event_categories');
245
+			if ($event_categories) {
246
+				// loop thru terms and create links
247
+				foreach ($event_categories as $term) {
248
+					$url = get_term_link($term, 'espresso_venue_categories');
249
+					if (
250
+						! is_wp_error($url)
251
+						&& (
252
+							(
253
+								$hide_uncategorized
254
+								&& strtolower($term->name) != esc_html__('uncategorized', 'event_espresso')
255
+							)
256
+							|| ! $hide_uncategorized
257
+						)
258
+					) {
259
+						$category_links[] = '<a href="' . esc_url_raw($url) . '" '
260
+											. 'rel="tag" ' . EED_Events_Archive::link_target() . '>'
261
+											. esc_html($term->name)
262
+											. '</a>';
263
+					}
264
+				}
265
+			}
266
+		}
267
+		return implode(', ', $category_links);
268
+	}
269
+
270
+
271
+	/**
272
+	 *    the_event_date - first date by date order
273
+	 *
274
+	 * @param string $date_format
275
+	 * @param string $time_format
276
+	 * @param int    $EVT_ID
277
+	 * @return    string
278
+	 * @throws EE_Error
279
+	 * @throws ReflectionException
280
+	 */
281
+	public static function the_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
282
+	{
283
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
284
+		$format   = ! empty($date_format) && ! empty($time_format)
285
+				? $date_format . ' ' . $time_format
286
+				: $date_format . $time_format;
287
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
288
+	}
289
+
290
+
291
+	/**
292
+	 *    the_event_end_date - last date by date order
293
+	 *
294
+	 * @param string $date_format
295
+	 * @param string $time_format
296
+	 * @param int    $EVT_ID
297
+	 * @return    string
298
+	 * @throws EE_Error
299
+	 * @throws ReflectionException
300
+	 */
301
+	public static function the_event_end_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
302
+	{
303
+		$datetime = EEH_Event_View::get_last_date_obj($EVT_ID);
304
+		$format   =
305
+			! empty($date_format) && ! empty($time_format)
306
+				? $date_format . ' ' . $time_format
307
+				: $date_format
308
+				  . $time_format;
309
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
310
+	}
311
+
312
+
313
+	/**
314
+	 *    the_earliest_event_date - first date chronologically
315
+	 *
316
+	 * @param string $date_format
317
+	 * @param string $time_format
318
+	 * @param int    $EVT_ID
319
+	 * @return    string
320
+	 * @throws EE_Error
321
+	 * @throws ReflectionException
322
+	 */
323
+	public static function the_earliest_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
324
+	{
325
+		$datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID);
326
+		$format   =
327
+			! empty($date_format) && ! empty($time_format)
328
+				? $date_format . ' ' . $time_format
329
+				: $date_format
330
+				  . $time_format;
331
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_start', $format) : '';
332
+	}
333
+
334
+
335
+	/**
336
+	 *    the_latest_event_date - latest date chronologically
337
+	 *
338
+	 * @param string $date_format
339
+	 * @param string $time_format
340
+	 * @param int    $EVT_ID
341
+	 * @return    string
342
+	 * @throws EE_Error
343
+	 * @throws ReflectionException
344
+	 */
345
+	public static function the_latest_event_date($date_format = 'D M jS', $time_format = 'g:i a', $EVT_ID = 0)
346
+	{
347
+		$datetime = EEH_Event_View::get_latest_date_obj($EVT_ID);
348
+		$format   =
349
+			! empty($date_format) && ! empty($time_format)
350
+				? $date_format . ' ' . $time_format
351
+				: $date_format
352
+				  . $time_format;
353
+		return $datetime instanceof EE_Datetime ? $datetime->get_i18n_datetime('DTT_EVT_end', $format) : '';
354
+	}
355
+
356
+
357
+	/**
358
+	 *    event_date_as_calendar_page
359
+	 *
360
+	 * @param int $EVT_ID
361
+	 * @return    void
362
+	 * @throws EE_Error
363
+	 * @throws ReflectionException
364
+	 */
365
+	public static function event_date_as_calendar_page($EVT_ID = 0)
366
+	{
367
+		$datetime = EEH_Event_View::get_primary_date_obj($EVT_ID);
368
+		if ($datetime instanceof EE_Datetime) {
369
+			?>
370 370
             <div class="event-date-calendar-page-dv">
371 371
                 <div class="event-date-calendar-page-month-dv">
372 372
                     <?php echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', 'M')); ?>
@@ -376,275 +376,275 @@  discard block
 block discarded – undo
376 376
                 </div>
377 377
             </div>
378 378
             <?php
379
-        }
380
-    }
381
-
382
-
383
-    /**
384
-     *    get_primary_date_obj - orders date by DTT_order
385
-     *
386
-     * @param int $EVT_ID
387
-     * @return EE_Datetime
388
-     * @throws EE_Error
389
-     * @throws ReflectionException
390
-     */
391
-    public static function get_primary_date_obj($EVT_ID = 0)
392
-    {
393
-        $event = EEH_Event_View::get_event($EVT_ID);
394
-        if ($event instanceof EE_Event) {
395
-            $datetimes = $event->get_many_related(
396
-                'Datetime',
397
-                [
398
-                    'limit'    => 1,
399
-                    'order_by' => ['DTT_order' => 'ASC'],
400
-                ]
401
-            );
402
-            return reset($datetimes);
403
-        }
404
-        return null;
405
-    }
406
-
407
-
408
-    /**
409
-     *    get_last_date_obj - orders date by DTT_order
410
-     *
411
-     * @param int $EVT_ID
412
-     * @return EE_Datetime
413
-     * @throws EE_Error
414
-     * @throws ReflectionException
415
-     */
416
-    public static function get_last_date_obj($EVT_ID = 0)
417
-    {
418
-        $event = EEH_Event_View::get_event($EVT_ID);
419
-        if ($event instanceof EE_Event) {
420
-            $datetimes = $event->get_many_related(
421
-                'Datetime',
422
-                [
423
-                    'limit'    => 1,
424
-                    'order_by' => ['DTT_order' => 'DESC'],
425
-                ]
426
-            );
427
-            return end($datetimes);
428
-        }
429
-        return null;
430
-    }
431
-
432
-
433
-    /**
434
-     *    get_earliest_date_obj - orders date chronologically
435
-     *
436
-     * @param int $EVT_ID
437
-     * @return EE_Datetime
438
-     * @throws EE_Error
439
-     * @throws ReflectionException
440
-     */
441
-    public static function get_earliest_date_obj($EVT_ID = 0)
442
-    {
443
-        $event = EEH_Event_View::get_event($EVT_ID);
444
-        if ($event instanceof EE_Event) {
445
-            $datetimes = $event->get_many_related(
446
-                'Datetime',
447
-                [
448
-                    'limit'    => 1,
449
-                    'order_by' => ['DTT_EVT_start' => 'ASC'],
450
-                ]
451
-            );
452
-            return reset($datetimes);
453
-        }
454
-        return null;
455
-    }
456
-
457
-
458
-    /**
459
-     *    get_latest_date_obj - orders date chronologically
460
-     *
461
-     * @param int $EVT_ID
462
-     * @return EE_Datetime
463
-     * @throws EE_Error
464
-     * @throws ReflectionException
465
-     */
466
-    public static function get_latest_date_obj($EVT_ID = 0)
467
-    {
468
-        $event = EEH_Event_View::get_event($EVT_ID);
469
-        if ($event instanceof EE_Event) {
470
-            $datetimes = $event->get_many_related(
471
-                'Datetime',
472
-                [
473
-                    'limit'    => 1,
474
-                    'order_by' => ['DTT_EVT_start' => 'DESC'],
475
-                ]
476
-            );
477
-            return end($datetimes);
478
-        }
479
-        return null;
480
-    }
481
-
482
-
483
-    /**
484
-     *    get_next_upcoming_date_obj - return the next upcoming datetime
485
-     *
486
-     * @param int $EVT_ID
487
-     * @return    EE_Datetime|null
488
-     * @throws EE_Error
489
-     * @throws EE_Error
490
-     */
491
-    public static function get_next_upcoming_date_obj($EVT_ID = 0)
492
-    {
493
-        $datetime = EEM_Datetime::instance()->get_one(
494
-            [
495
-                [
496
-                    'Event.EVT_ID'  => $EVT_ID,
497
-                    'DTT_EVT_start' => ['>=', current_time('mysql', true)],
498
-                ],
499
-                'order_by' => ['DTT_EVT_start' => 'asc'],
500
-            ]
501
-        );
502
-        return $datetime instanceof EE_Datetime ? $datetime : null;
503
-    }
504
-
505
-
506
-    /**
507
-     *    get_next_upcoming_date_obj - return the next upcoming datetime
508
-     *
509
-     * @param int $DTT_ID
510
-     * @return EE_Datetime|null
511
-     * @throws EE_Error
512
-     * @throws ReflectionException
513
-     */
514
-    public static function get_date_obj(int $DTT_ID = 0): ?EE_Datetime
515
-    {
516
-        $datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
517
-        return $datetime instanceof EE_Datetime ? $datetime : null;
518
-    }
519
-
520
-
521
-    /**
522
-     *    get_all_date_obj
523
-     *
524
-     * @param int  $EVT_ID
525
-     * @param null $include_expired
526
-     * @param bool $include_deleted
527
-     * @param null $limit
528
-     * @return EE_Datetime[]
529
-     * @throws EE_Error
530
-     * @throws EE_Error
531
-     * @throws ReflectionException
532
-     */
533
-    public static function get_all_date_obj(
534
-        $EVT_ID = 0,
535
-        $include_expired = null,
536
-        $include_deleted = false,
537
-        $limit = null
538
-    ) {
539
-        $event = EEH_Event_View::get_event($EVT_ID);
540
-        if ($include_expired === null) {
541
-            if ($event instanceof EE_Event && $event->is_expired()) {
542
-                $include_expired = true;
543
-            } else {
544
-                $include_expired = false;
545
-            }
546
-        }
547
-
548
-        if ($event instanceof EE_Event) {
549
-            return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
550
-        }
551
-        return [];
552
-    }
553
-
554
-
555
-    /**
556
-     *    event_link_url
557
-     *
558
-     * @param int $EVT_ID
559
-     * @return string
560
-     * @throws EE_Error
561
-     * @throws ReflectionException
562
-     */
563
-    public static function event_link_url($EVT_ID = 0)
564
-    {
565
-        $event = EEH_Event_View::get_event($EVT_ID);
566
-        if ($event instanceof EE_Event) {
567
-            $url = $event->external_url() !== null && $event->external_url() !== ''
568
-                ? $event->external_url()
569
-                : get_permalink($event->ID());
570
-            $url = preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'https://' . $url;
571
-            return esc_url_raw($url);
572
-        }
573
-        return '';
574
-    }
575
-
576
-
577
-    /**
578
-     *    event_phone
579
-     *
580
-     * @param int $EVT_ID
581
-     * @return    string
582
-     * @throws EE_Error
583
-     * @throws EE_Error
584
-     * @throws ReflectionException
585
-     */
586
-    public static function event_phone($EVT_ID = 0)
587
-    {
588
-        $event = EEH_Event_View::get_event($EVT_ID);
589
-        if ($event instanceof EE_Event) {
590
-            return EEH_Schema::telephone($event->phone());
591
-        }
592
-        return null;
593
-    }
594
-
595
-
596
-    /**
597
-     *    edit_event_link
598
-     *
599
-     * @param int    $EVT_ID
600
-     * @param string $link
601
-     * @param string $before
602
-     * @param string $after
603
-     * @return    string
604
-     * @throws EE_Error
605
-     * @throws ReflectionException
606
-     */
607
-    public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '')
608
-    {
609
-        $event = EEH_Event_View::get_event($EVT_ID);
610
-        if ($event instanceof EE_Event) {
611
-            // can the user edit this post ?
612
-            if (current_user_can('edit_post', $event->ID())) {
613
-                // set link text
614
-                $link_text = ! empty($link) ? $link : esc_html__('edit this event', 'event_espresso');
615
-                // generate nonce
616
-                $nonce = wp_create_nonce('edit_nonce');
617
-                // generate url to event editor for this event
618
-                $url =
619
-                    add_query_arg(
620
-                        [
621
-                            'page'       => 'espresso_events',
622
-                            'action'     => 'edit',
623
-                            'post'       => $event->ID(),
624
-                            'edit_nonce' => $nonce,
625
-                        ],
626
-                        admin_url()
627
-                    );
628
-                // get edit CPT text
629
-                $post_type_obj = get_post_type_object('espresso_events');
630
-                // build final link html
631
-                $link = '<a class="post-edit-link" href="' . $url . '" ';
632
-                $link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
633
-                $link .= EED_Events_Archive::link_target();
634
-                $link .= '>' . $link_text . '</a>';
635
-                // put it all together
636
-                return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
637
-            }
638
-        }
639
-        return '';
640
-    }
641
-
642
-
643
-    /**
644
-     * @return string
645
-     */
646
-    public static function event_archive_url()
647
-    {
648
-        return get_post_type_archive_link('espresso_events');
649
-    }
379
+		}
380
+	}
381
+
382
+
383
+	/**
384
+	 *    get_primary_date_obj - orders date by DTT_order
385
+	 *
386
+	 * @param int $EVT_ID
387
+	 * @return EE_Datetime
388
+	 * @throws EE_Error
389
+	 * @throws ReflectionException
390
+	 */
391
+	public static function get_primary_date_obj($EVT_ID = 0)
392
+	{
393
+		$event = EEH_Event_View::get_event($EVT_ID);
394
+		if ($event instanceof EE_Event) {
395
+			$datetimes = $event->get_many_related(
396
+				'Datetime',
397
+				[
398
+					'limit'    => 1,
399
+					'order_by' => ['DTT_order' => 'ASC'],
400
+				]
401
+			);
402
+			return reset($datetimes);
403
+		}
404
+		return null;
405
+	}
406
+
407
+
408
+	/**
409
+	 *    get_last_date_obj - orders date by DTT_order
410
+	 *
411
+	 * @param int $EVT_ID
412
+	 * @return EE_Datetime
413
+	 * @throws EE_Error
414
+	 * @throws ReflectionException
415
+	 */
416
+	public static function get_last_date_obj($EVT_ID = 0)
417
+	{
418
+		$event = EEH_Event_View::get_event($EVT_ID);
419
+		if ($event instanceof EE_Event) {
420
+			$datetimes = $event->get_many_related(
421
+				'Datetime',
422
+				[
423
+					'limit'    => 1,
424
+					'order_by' => ['DTT_order' => 'DESC'],
425
+				]
426
+			);
427
+			return end($datetimes);
428
+		}
429
+		return null;
430
+	}
431
+
432
+
433
+	/**
434
+	 *    get_earliest_date_obj - orders date chronologically
435
+	 *
436
+	 * @param int $EVT_ID
437
+	 * @return EE_Datetime
438
+	 * @throws EE_Error
439
+	 * @throws ReflectionException
440
+	 */
441
+	public static function get_earliest_date_obj($EVT_ID = 0)
442
+	{
443
+		$event = EEH_Event_View::get_event($EVT_ID);
444
+		if ($event instanceof EE_Event) {
445
+			$datetimes = $event->get_many_related(
446
+				'Datetime',
447
+				[
448
+					'limit'    => 1,
449
+					'order_by' => ['DTT_EVT_start' => 'ASC'],
450
+				]
451
+			);
452
+			return reset($datetimes);
453
+		}
454
+		return null;
455
+	}
456
+
457
+
458
+	/**
459
+	 *    get_latest_date_obj - orders date chronologically
460
+	 *
461
+	 * @param int $EVT_ID
462
+	 * @return EE_Datetime
463
+	 * @throws EE_Error
464
+	 * @throws ReflectionException
465
+	 */
466
+	public static function get_latest_date_obj($EVT_ID = 0)
467
+	{
468
+		$event = EEH_Event_View::get_event($EVT_ID);
469
+		if ($event instanceof EE_Event) {
470
+			$datetimes = $event->get_many_related(
471
+				'Datetime',
472
+				[
473
+					'limit'    => 1,
474
+					'order_by' => ['DTT_EVT_start' => 'DESC'],
475
+				]
476
+			);
477
+			return end($datetimes);
478
+		}
479
+		return null;
480
+	}
481
+
482
+
483
+	/**
484
+	 *    get_next_upcoming_date_obj - return the next upcoming datetime
485
+	 *
486
+	 * @param int $EVT_ID
487
+	 * @return    EE_Datetime|null
488
+	 * @throws EE_Error
489
+	 * @throws EE_Error
490
+	 */
491
+	public static function get_next_upcoming_date_obj($EVT_ID = 0)
492
+	{
493
+		$datetime = EEM_Datetime::instance()->get_one(
494
+			[
495
+				[
496
+					'Event.EVT_ID'  => $EVT_ID,
497
+					'DTT_EVT_start' => ['>=', current_time('mysql', true)],
498
+				],
499
+				'order_by' => ['DTT_EVT_start' => 'asc'],
500
+			]
501
+		);
502
+		return $datetime instanceof EE_Datetime ? $datetime : null;
503
+	}
504
+
505
+
506
+	/**
507
+	 *    get_next_upcoming_date_obj - return the next upcoming datetime
508
+	 *
509
+	 * @param int $DTT_ID
510
+	 * @return EE_Datetime|null
511
+	 * @throws EE_Error
512
+	 * @throws ReflectionException
513
+	 */
514
+	public static function get_date_obj(int $DTT_ID = 0): ?EE_Datetime
515
+	{
516
+		$datetime = EEM_Datetime::instance()->get_one_by_ID($DTT_ID);
517
+		return $datetime instanceof EE_Datetime ? $datetime : null;
518
+	}
519
+
520
+
521
+	/**
522
+	 *    get_all_date_obj
523
+	 *
524
+	 * @param int  $EVT_ID
525
+	 * @param null $include_expired
526
+	 * @param bool $include_deleted
527
+	 * @param null $limit
528
+	 * @return EE_Datetime[]
529
+	 * @throws EE_Error
530
+	 * @throws EE_Error
531
+	 * @throws ReflectionException
532
+	 */
533
+	public static function get_all_date_obj(
534
+		$EVT_ID = 0,
535
+		$include_expired = null,
536
+		$include_deleted = false,
537
+		$limit = null
538
+	) {
539
+		$event = EEH_Event_View::get_event($EVT_ID);
540
+		if ($include_expired === null) {
541
+			if ($event instanceof EE_Event && $event->is_expired()) {
542
+				$include_expired = true;
543
+			} else {
544
+				$include_expired = false;
545
+			}
546
+		}
547
+
548
+		if ($event instanceof EE_Event) {
549
+			return $event->datetimes_ordered($include_expired, $include_deleted, $limit);
550
+		}
551
+		return [];
552
+	}
553
+
554
+
555
+	/**
556
+	 *    event_link_url
557
+	 *
558
+	 * @param int $EVT_ID
559
+	 * @return string
560
+	 * @throws EE_Error
561
+	 * @throws ReflectionException
562
+	 */
563
+	public static function event_link_url($EVT_ID = 0)
564
+	{
565
+		$event = EEH_Event_View::get_event($EVT_ID);
566
+		if ($event instanceof EE_Event) {
567
+			$url = $event->external_url() !== null && $event->external_url() !== ''
568
+				? $event->external_url()
569
+				: get_permalink($event->ID());
570
+			$url = preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'https://' . $url;
571
+			return esc_url_raw($url);
572
+		}
573
+		return '';
574
+	}
575
+
576
+
577
+	/**
578
+	 *    event_phone
579
+	 *
580
+	 * @param int $EVT_ID
581
+	 * @return    string
582
+	 * @throws EE_Error
583
+	 * @throws EE_Error
584
+	 * @throws ReflectionException
585
+	 */
586
+	public static function event_phone($EVT_ID = 0)
587
+	{
588
+		$event = EEH_Event_View::get_event($EVT_ID);
589
+		if ($event instanceof EE_Event) {
590
+			return EEH_Schema::telephone($event->phone());
591
+		}
592
+		return null;
593
+	}
594
+
595
+
596
+	/**
597
+	 *    edit_event_link
598
+	 *
599
+	 * @param int    $EVT_ID
600
+	 * @param string $link
601
+	 * @param string $before
602
+	 * @param string $after
603
+	 * @return    string
604
+	 * @throws EE_Error
605
+	 * @throws ReflectionException
606
+	 */
607
+	public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '')
608
+	{
609
+		$event = EEH_Event_View::get_event($EVT_ID);
610
+		if ($event instanceof EE_Event) {
611
+			// can the user edit this post ?
612
+			if (current_user_can('edit_post', $event->ID())) {
613
+				// set link text
614
+				$link_text = ! empty($link) ? $link : esc_html__('edit this event', 'event_espresso');
615
+				// generate nonce
616
+				$nonce = wp_create_nonce('edit_nonce');
617
+				// generate url to event editor for this event
618
+				$url =
619
+					add_query_arg(
620
+						[
621
+							'page'       => 'espresso_events',
622
+							'action'     => 'edit',
623
+							'post'       => $event->ID(),
624
+							'edit_nonce' => $nonce,
625
+						],
626
+						admin_url()
627
+					);
628
+				// get edit CPT text
629
+				$post_type_obj = get_post_type_object('espresso_events');
630
+				// build final link html
631
+				$link = '<a class="post-edit-link" href="' . $url . '" ';
632
+				$link .= ' title="' . esc_attr($post_type_obj->labels->edit_item) . '"';
633
+				$link .= EED_Events_Archive::link_target();
634
+				$link .= '>' . $link_text . '</a>';
635
+				// put it all together
636
+				return $before . apply_filters('edit_post_link', $link, $event->ID()) . $after;
637
+			}
638
+		}
639
+		return '';
640
+	}
641
+
642
+
643
+	/**
644
+	 * @return string
645
+	 */
646
+	public static function event_archive_url()
647
+	{
648
+		return get_post_type_archive_link('espresso_events');
649
+	}
650 650
 }
Please login to merge, or discard this patch.
core/services/progress_steps/ProgressStep.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     protected function setId($id = '')
123 123
     {
124
-        if (! is_string($id)) {
124
+        if ( ! is_string($id)) {
125 125
             throw new InvalidDataTypeException('$id', $id, 'string');
126 126
         }
127 127
         $this->id = $id;
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     protected function setOrder($order = 0)
146 146
     {
147
-        if (! is_int($order)) {
147
+        if ( ! is_int($order)) {
148 148
             throw new InvalidDataTypeException('$order', $order, 'integer');
149 149
         }
150 150
         $this->order = absint($order);
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
      */
174 174
     protected function setHtmlClass($html_class)
175 175
     {
176
-        if (! is_string($html_class)) {
176
+        if ( ! is_string($html_class)) {
177 177
             throw new InvalidDataTypeException('$html_class', $html_class, 'string');
178 178
         }
179 179
         if (strpos($html_class, 'progress-step-') === false) {
180
-            $html_class = 'progress-step-' . $html_class;
180
+            $html_class = 'progress-step-'.$html_class;
181 181
         }
182 182
         $this->html_class = $html_class;
183 183
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
      */
200 200
     protected function setText($text)
201 201
     {
202
-        if (! is_string($text)) {
202
+        if ( ! is_string($text)) {
203 203
             throw new InvalidDataTypeException('$text', $text, 'string');
204 204
         }
205 205
         $this->text = sanitize_text_field($text);
Please login to merge, or discard this patch.
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -16,190 +16,190 @@
 block discarded – undo
16 16
  */
17 17
 class ProgressStep implements ProgressStepInterface
18 18
 {
19
-    /**
20
-     * @var boolean $current
21
-     */
22
-    private $current = false;
23
-
24
-
25
-    /**
26
-     * @var boolean $completed
27
-     */
28
-    private $completed = false;
29
-
30
-
31
-    /**
32
-     * @var string $html_class
33
-     */
34
-    private $html_class;
35
-
36
-    /**
37
-     * @var string $id
38
-     */
39
-    private $id = '';
40
-
41
-    /**
42
-     * @var int $order
43
-     */
44
-    private $order = 0;
45
-
46
-    /**
47
-     * @var string $text
48
-     */
49
-    private $text = '';
50
-
51
-
52
-    /**
53
-     * ProgressStep constructor
54
-     *
55
-     * @param int    $order
56
-     * @param string $id
57
-     * @param string $html_class
58
-     * @param string $text
59
-     * @throws InvalidDataTypeException
60
-     */
61
-    public function __construct($order, $id, $html_class, $text)
62
-    {
63
-        $this->setOrder($order);
64
-        $this->setId($id);
65
-        $this->setHtmlClass($html_class);
66
-        $this->setText($text);
67
-    }
68
-
69
-
70
-    /**
71
-     * @return boolean
72
-     */
73
-    public function isCurrent()
74
-    {
75
-        return $this->current;
76
-    }
77
-
78
-
79
-    /**
80
-     * @param boolean $current
81
-     */
82
-    public function setIsCurrent($current = true)
83
-    {
84
-        $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN);
85
-    }
86
-
87
-
88
-    /**
89
-     * @return boolean
90
-     */
91
-    public function isCompleted()
92
-    {
93
-        return $this->completed;
94
-    }
95
-
96
-
97
-    /**
98
-     * @param boolean $completed
99
-     */
100
-    public function setIsCompleted($completed = true)
101
-    {
102
-        $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN);
103
-    }
104
-
105
-
106
-    /**
107
-     * @return string
108
-     */
109
-    public function id()
110
-    {
111
-        return $this->id;
112
-    }
113
-
114
-
115
-    /**
116
-     * @access protected
117
-     * @param string $id
118
-     * @throws InvalidDataTypeException
119
-     */
120
-    protected function setId($id = '')
121
-    {
122
-        if (! is_string($id)) {
123
-            throw new InvalidDataTypeException('$id', $id, 'string');
124
-        }
125
-        $this->id = $id;
126
-    }
127
-
128
-
129
-    /**
130
-     * @return int
131
-     */
132
-    public function order()
133
-    {
134
-        return $this->order;
135
-    }
136
-
137
-
138
-    /**
139
-     * @access protected
140
-     * @param int $order
141
-     * @throws InvalidDataTypeException
142
-     */
143
-    protected function setOrder($order = 0)
144
-    {
145
-        if (! is_int($order)) {
146
-            throw new InvalidDataTypeException('$order', $order, 'integer');
147
-        }
148
-        $this->order = absint($order);
149
-    }
150
-
151
-
152
-    /**
153
-     * @return string
154
-     */
155
-    public function htmlClass()
156
-    {
157
-        $html_class = $this->html_class;
158
-        if ($this->isCurrent()) {
159
-            $html_class .= ' progress-step-active';
160
-        } elseif ($this->isCompleted()) {
161
-            $html_class .= ' progress-step-completed';
162
-        }
163
-        return $html_class;
164
-    }
165
-
166
-
167
-    /**
168
-     * @access protected
169
-     * @param string $html_class
170
-     * @throws InvalidDataTypeException
171
-     */
172
-    protected function setHtmlClass($html_class)
173
-    {
174
-        if (! is_string($html_class)) {
175
-            throw new InvalidDataTypeException('$html_class', $html_class, 'string');
176
-        }
177
-        if (strpos($html_class, 'progress-step-') === false) {
178
-            $html_class = 'progress-step-' . $html_class;
179
-        }
180
-        $this->html_class = $html_class;
181
-    }
182
-
183
-
184
-    /**
185
-     * @return string
186
-     */
187
-    public function text()
188
-    {
189
-        return $this->text;
190
-    }
191
-
192
-
193
-    /**
194
-     * @access protected
195
-     * @param string $text
196
-     * @throws InvalidDataTypeException
197
-     */
198
-    protected function setText($text)
199
-    {
200
-        if (! is_string($text)) {
201
-            throw new InvalidDataTypeException('$text', $text, 'string');
202
-        }
203
-        $this->text = sanitize_text_field($text);
204
-    }
19
+	/**
20
+	 * @var boolean $current
21
+	 */
22
+	private $current = false;
23
+
24
+
25
+	/**
26
+	 * @var boolean $completed
27
+	 */
28
+	private $completed = false;
29
+
30
+
31
+	/**
32
+	 * @var string $html_class
33
+	 */
34
+	private $html_class;
35
+
36
+	/**
37
+	 * @var string $id
38
+	 */
39
+	private $id = '';
40
+
41
+	/**
42
+	 * @var int $order
43
+	 */
44
+	private $order = 0;
45
+
46
+	/**
47
+	 * @var string $text
48
+	 */
49
+	private $text = '';
50
+
51
+
52
+	/**
53
+	 * ProgressStep constructor
54
+	 *
55
+	 * @param int    $order
56
+	 * @param string $id
57
+	 * @param string $html_class
58
+	 * @param string $text
59
+	 * @throws InvalidDataTypeException
60
+	 */
61
+	public function __construct($order, $id, $html_class, $text)
62
+	{
63
+		$this->setOrder($order);
64
+		$this->setId($id);
65
+		$this->setHtmlClass($html_class);
66
+		$this->setText($text);
67
+	}
68
+
69
+
70
+	/**
71
+	 * @return boolean
72
+	 */
73
+	public function isCurrent()
74
+	{
75
+		return $this->current;
76
+	}
77
+
78
+
79
+	/**
80
+	 * @param boolean $current
81
+	 */
82
+	public function setIsCurrent($current = true)
83
+	{
84
+		$this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN);
85
+	}
86
+
87
+
88
+	/**
89
+	 * @return boolean
90
+	 */
91
+	public function isCompleted()
92
+	{
93
+		return $this->completed;
94
+	}
95
+
96
+
97
+	/**
98
+	 * @param boolean $completed
99
+	 */
100
+	public function setIsCompleted($completed = true)
101
+	{
102
+		$this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN);
103
+	}
104
+
105
+
106
+	/**
107
+	 * @return string
108
+	 */
109
+	public function id()
110
+	{
111
+		return $this->id;
112
+	}
113
+
114
+
115
+	/**
116
+	 * @access protected
117
+	 * @param string $id
118
+	 * @throws InvalidDataTypeException
119
+	 */
120
+	protected function setId($id = '')
121
+	{
122
+		if (! is_string($id)) {
123
+			throw new InvalidDataTypeException('$id', $id, 'string');
124
+		}
125
+		$this->id = $id;
126
+	}
127
+
128
+
129
+	/**
130
+	 * @return int
131
+	 */
132
+	public function order()
133
+	{
134
+		return $this->order;
135
+	}
136
+
137
+
138
+	/**
139
+	 * @access protected
140
+	 * @param int $order
141
+	 * @throws InvalidDataTypeException
142
+	 */
143
+	protected function setOrder($order = 0)
144
+	{
145
+		if (! is_int($order)) {
146
+			throw new InvalidDataTypeException('$order', $order, 'integer');
147
+		}
148
+		$this->order = absint($order);
149
+	}
150
+
151
+
152
+	/**
153
+	 * @return string
154
+	 */
155
+	public function htmlClass()
156
+	{
157
+		$html_class = $this->html_class;
158
+		if ($this->isCurrent()) {
159
+			$html_class .= ' progress-step-active';
160
+		} elseif ($this->isCompleted()) {
161
+			$html_class .= ' progress-step-completed';
162
+		}
163
+		return $html_class;
164
+	}
165
+
166
+
167
+	/**
168
+	 * @access protected
169
+	 * @param string $html_class
170
+	 * @throws InvalidDataTypeException
171
+	 */
172
+	protected function setHtmlClass($html_class)
173
+	{
174
+		if (! is_string($html_class)) {
175
+			throw new InvalidDataTypeException('$html_class', $html_class, 'string');
176
+		}
177
+		if (strpos($html_class, 'progress-step-') === false) {
178
+			$html_class = 'progress-step-' . $html_class;
179
+		}
180
+		$this->html_class = $html_class;
181
+	}
182
+
183
+
184
+	/**
185
+	 * @return string
186
+	 */
187
+	public function text()
188
+	{
189
+		return $this->text;
190
+	}
191
+
192
+
193
+	/**
194
+	 * @access protected
195
+	 * @param string $text
196
+	 * @throws InvalidDataTypeException
197
+	 */
198
+	protected function setText($text)
199
+	{
200
+		if (! is_string($text)) {
201
+			throw new InvalidDataTypeException('$text', $text, 'string');
202
+		}
203
+		$this->text = sanitize_text_field($text);
204
+	}
205 205
 }
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Shortcodes.lib.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     public function get_shortcode_helper()
148 148
     {
149
-        if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) {
149
+        if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) {
150 150
             $this->_set_shortcode_helper();
151 151
         }
152 152
         return $this->_shortcode_helper;
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 
171 171
         // we need to setup any dynamic shortcodes so that they work with the array_key_exists
172 172
         preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
173
-        $sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode;
173
+        $sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode;
174 174
 
175 175
         // first we want to make sure this is a valid shortcode
176
-        if (! array_key_exists($sc_to_verify, $this->_shortcodes)) {
176
+        if ( ! array_key_exists($sc_to_verify, $this->_shortcodes)) {
177 177
             return false;
178 178
         } //get out, this parser doesn't handle the incoming shortcode.
179 179
         $this->_data = $data;
180 180
         $this->_extra_data = $extra_data;
181 181
         $this->_set_messages_properties();
182 182
         $parsed = apply_filters(
183
-            'FHEE__' . get_class($this) . '__parser_after',
183
+            'FHEE__'.get_class($this).'__parser_after',
184 184
             $this->_parser($shortcode),
185 185
             $shortcode,
186 186
             $data,
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function get_shortcodes()
203 203
     {
204
-        $this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this);
204
+        $this->_shortcodes = apply_filters('FHEE__'.get_class($this).'__shortcodes', $this->_shortcodes, $this);
205 205
 
206 206
         // note the below filter applies to ALL shortcode parsers... be careful!
207 207
         $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     {
249 249
 
250 250
         // first test to make sure we've got an array!
251
-        if (! is_array($this->_data)) {
251
+        if ( ! is_array($this->_data)) {
252 252
             throw new EE_Error(
253 253
                 sprintf(
254 254
                     esc_html__(
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         }
263 263
 
264 264
         // next test to make sure we've got the required template in the index!
265
-        if (! isset($this->_data['template'])) {
265
+        if ( ! isset($this->_data['template'])) {
266 266
             throw new EE_Error(
267 267
                 sprintf(
268 268
                     esc_html__(
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
         }
275 275
 
276 276
         // next test to make sure we've got got a data index in the incoming data array
277
-        if (! isset($this->_data['data'])) {
277
+        if ( ! isset($this->_data['data'])) {
278 278
             throw new EE_Error(
279 279
                 esc_html__(
280 280
                     'The incoming data does not have the required data index in its array',
@@ -303,8 +303,8 @@  discard block
 block discarded – undo
303 303
     {
304 304
         // make sure the required wp helper function is present
305 305
         // require the shortcode file if necessary
306
-        if (! function_exists('shortcode_parse_atts')) {
307
-            require_once(ABSPATH . WPINC . '/shortcodes.php');
306
+        if ( ! function_exists('shortcode_parse_atts')) {
307
+            require_once(ABSPATH.WPINC.'/shortcodes.php');
308 308
         }
309 309
 
310 310
         // let's get any attributes that may be present and set the defaults.
@@ -329,15 +329,15 @@  discard block
 block discarded – undo
329 329
     protected function _mutate_conditional_block_in_template($shortcode, $show = true)
330 330
     {
331 331
         // first let's get all the matches in the template for this particular shortcode.
332
-        preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches);
332
+        preg_match_all('~'.$this->_get_conditional_block_regex($shortcode).'~', $this->_data['template'], $matches);
333 333
 
334 334
         if ($matches && is_array($matches[0]) && ! empty($matches[0])) {
335 335
             // we need to hide all instances of the matches
336 336
             foreach ($matches[0] as $index => $content_to_show_or_hide) {
337 337
                 $content_to_show_or_hide = preg_quote($content_to_show_or_hide);
338
-                $replacement = $show ? $matches[4][ $index ] : '';
338
+                $replacement = $show ? $matches[4][$index] : '';
339 339
                 $this->_data['template'] = preg_replace(
340
-                    '~' . $content_to_show_or_hide . '~',
340
+                    '~'.$content_to_show_or_hide.'~',
341 341
                     $replacement,
342 342
                     $this->_data['template']
343 343
                 );
Please login to merge, or discard this patch.
Indentation   +452 added lines, -452 removed lines patch added patch discarded remove patch
@@ -16,456 +16,456 @@
 block discarded – undo
16 16
  */
17 17
 abstract class EE_Shortcodes extends EE_Base
18 18
 {
19
-    /**
20
-     * holds label for library
21
-     * This is used for referencing the library label
22
-     *
23
-     * @access public
24
-     * @var string
25
-     */
26
-    public $label;
27
-
28
-
29
-    /**
30
-     * This property is used for referencing a short description of the library
31
-     *
32
-     * @access public
33
-     * @var string
34
-     */
35
-    public $description;
36
-
37
-
38
-    /**
39
-     * This will hold an array of shortcodes with the key as the shortcode ([shortcode]) and the value as a
40
-     * label/description for the shortcode.
41
-     *
42
-     * @access protected
43
-     * @var array
44
-     */
45
-    protected $_shortcodes;
46
-
47
-
48
-    /**
49
-     * This will hold the incoming data item sent to the parser method
50
-     *
51
-     * @access protected
52
-     * @var mixed (array|object)
53
-     */
54
-    protected $_data;
55
-
56
-
57
-    /**
58
-     * some shortcodes may require extra data to parse.  This property is provided for that.
59
-     *
60
-     * @var array
61
-     */
62
-    protected $_extra_data;
63
-
64
-
65
-    /**
66
-     * EE_messenger used to generate the template being parsed.
67
-     *
68
-     * @since 4.5.0
69
-     * @var EE_messenger
70
-     */
71
-    protected $_messenger;
72
-
73
-
74
-    /**
75
-     * message type used to generate the template being parsed.
76
-     *
77
-     * @since 4.5.0
78
-     * @var EE_message_type
79
-     */
80
-    protected $_message_type;
81
-
82
-
83
-    /**
84
-     * context used for the template being parsed
85
-     *
86
-     * @since 4.5.0
87
-     * @var string
88
-     */
89
-    protected $_context;
90
-
91
-
92
-    /**
93
-     * Specific Message Template Group ID
94
-     *
95
-     * @since 4.5.0
96
-     * @var int
97
-     */
98
-    protected $_GRP_ID;
99
-
100
-
101
-    /**
102
-     * @since 4.9.0
103
-     * @type EE_Message
104
-     */
105
-    protected $_message;
106
-
107
-
108
-    /**
109
-     * This will hold an instance of the EEH_Parse_Shortcodes helper that will be used when handling list type
110
-     * shortcodes
111
-     *
112
-     * @var EEH_Parse_Shortcodes
113
-     */
114
-    protected $_shortcode_helper;
115
-
116
-
117
-    public function __construct()
118
-    {
119
-        $this->_set_defaults();
120
-        $this->_init_props();
121
-    }
122
-
123
-
124
-    /**
125
-     * This sets the defaults for the properties.  Child classes will override these properties in their _init_props
126
-     * method
127
-     */
128
-    private function _set_defaults()
129
-    {
130
-        $this->name = $this->description = '';
131
-        $this->_shortcodes = array();
132
-        $this->_set_shortcode_helper();
133
-    }
134
-
135
-
136
-    /**
137
-     * loads an instance of the EE_Shortcode_Parser helper when requested
138
-     */
139
-    protected function _set_shortcode_helper()
140
-    {
141
-        // get shortcode_replace instance- set when _get_messages is called in child...
142
-        $this->_shortcode_helper = new EEH_Parse_Shortcodes();
143
-    }
144
-
145
-
146
-    public function get_shortcode_helper()
147
-    {
148
-        if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) {
149
-            $this->_set_shortcode_helper();
150
-        }
151
-        return $this->_shortcode_helper;
152
-    }
153
-
154
-
155
-    /**
156
-     * This is the public method for kicking of the parser included with each child.  It can be overridden by child
157
-     * classes if necessary (see EE_Questions_Answers for example)
158
-     *
159
-     * @param  string $shortcode incoming shortcode to be parsed
160
-     * @param  mixed (object|array) $data       incoming data to be be used for parsing
161
-     * @param  mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee)
162
-     * @return string            parsed shortcode.
163
-     */
164
-    public function parser($shortcode, $data, $extra_data = array())
165
-    {
166
-
167
-        // filter setup shortcodes
168
-        $this->_shortcodes = $this->get_shortcodes();
169
-
170
-        // we need to setup any dynamic shortcodes so that they work with the array_key_exists
171
-        preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
172
-        $sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode;
173
-
174
-        // first we want to make sure this is a valid shortcode
175
-        if (! array_key_exists($sc_to_verify, $this->_shortcodes)) {
176
-            return false;
177
-        } //get out, this parser doesn't handle the incoming shortcode.
178
-        $this->_data = $data;
179
-        $this->_extra_data = $extra_data;
180
-        $this->_set_messages_properties();
181
-        $parsed = apply_filters(
182
-            'FHEE__' . get_class($this) . '__parser_after',
183
-            $this->_parser($shortcode),
184
-            $shortcode,
185
-            $data,
186
-            $extra_data,
187
-            $this
188
-        );
189
-
190
-        // note the below filter applies to ALL shortcode parsers... be careful!
191
-        return apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this);
192
-    }
193
-
194
-
195
-    /**
196
-     * This method just returns the shortcodes in the $_shortcodes array property.
197
-     *
198
-     * @access public
199
-     * @return array array of shortcodes => description pairs
200
-     */
201
-    public function get_shortcodes()
202
-    {
203
-        $this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this);
204
-
205
-        // note the below filter applies to ALL shortcode parsers... be careful!
206
-        $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this);
207
-
208
-        return $this->_shortcodes;
209
-    }
210
-
211
-
212
-    /**
213
-     * Child classes use this method to set the $name, $description, and $_shortcodes properties.
214
-     *
215
-     * @abstract
216
-     * @access protected
217
-     * @return void
218
-     */
219
-    abstract protected function _init_props();
220
-
221
-
222
-    /**
223
-     * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
224
-     * will have to take care of handling.
225
-     *
226
-     * @abstract
227
-     * @access protected
228
-     * @param string $shortcode    the shortcode to be parsed.
229
-     * @param mixed (object|array) $data      incoming data for the parser.  The data could be either an object or
230
-     *                             array because there are some shortcodes that might be replaced by prepared data that
231
-     *                             has multiple items in a list (i.e. list of attendees in an event and we're showing
232
-     *                             fname/lname for each attendee).  In this case data will be in an array.  Otherwise
233
-     *                             the data shoudl be in a properly formatted object.  The
234
-     *                             EEH_Parse_Shortcodes.helper.php describes the data object we're expecting.
235
-     * @return string parsed shortcode
236
-     */
237
-    abstract protected function _parser($shortcode);
238
-
239
-
240
-    /**
241
-     * This just validates incoming data for list type shortcode parsers (and they call this method) to make sure it
242
-     * meets their requirements
243
-     *
244
-     * @return mixed (void|exception) If validation fails we'll throw an exception.
245
-     */
246
-    protected function _validate_list_requirements()
247
-    {
248
-
249
-        // first test to make sure we've got an array!
250
-        if (! is_array($this->_data)) {
251
-            throw new EE_Error(
252
-                sprintf(
253
-                    esc_html__(
254
-                        'Expecting an array for the data sent to %s. Instead it was %s',
255
-                        'event_espresso'
256
-                    ),
257
-                    get_class($this),
258
-                    gettype($this->_data)
259
-                )
260
-            );
261
-        }
262
-
263
-        // next test to make sure we've got the required template in the index!
264
-        if (! isset($this->_data['template'])) {
265
-            throw new EE_Error(
266
-                sprintf(
267
-                    esc_html__(
268
-                        'The incoming data does not have the required template index in its array',
269
-                        'event_espresso'
270
-                    )
271
-                )
272
-            );
273
-        }
274
-
275
-        // next test to make sure we've got got a data index in the incoming data array
276
-        if (! isset($this->_data['data'])) {
277
-            throw new EE_Error(
278
-                esc_html__(
279
-                    'The incoming data does not have the required data index in its array',
280
-                    'event_espresso'
281
-                )
282
-            );
283
-        }
284
-
285
-        // all is well let's make sure _extra_data always has the values needed.
286
-        // let's make sure that extra_data includes all templates (for later parsing if necessary)
287
-        if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) {
288
-            $this->_extra_data['data'] = $this->_data['data'];
289
-            $this->_extra_data['template'] = $this->_data['template'];
290
-        }
291
-    }
292
-
293
-
294
-    /**
295
-     * This returns any attributes that may be existing on an EE_Shortcode
296
-     *
297
-     * @since 4.5.0
298
-     * @param string $shortcode incoming shortcode
299
-     * @return array An array with the attributes
300
-     */
301
-    protected function _get_shortcode_attrs($shortcode)
302
-    {
303
-        // make sure the required wp helper function is present
304
-        // require the shortcode file if necessary
305
-        if (! function_exists('shortcode_parse_atts')) {
306
-            require_once(ABSPATH . WPINC . '/shortcodes.php');
307
-        }
308
-
309
-        // let's get any attributes that may be present and set the defaults.
310
-        $shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode));
311
-        return shortcode_parse_atts($shortcode_to_parse);
312
-    }
313
-
314
-
315
-    /**
316
-     * Conditional blocks are shortcode patterns with an opening conditional tag `[IF_*]` and a corresponding
317
-     * closing tag (eg `[/IF_*]`).  The content within the tags will be displayed/hidden depending on whatever
318
-     * conditions existed in the opening tag.  This method handles parsing the actual template to show/hide this
319
-     * conditional content.
320
-     *
321
-     * @since 4.9.32
322
-     *
323
-     * @param string $shortcode This should be original shortcode as used in the template and passed to the parser.
324
-     * @param bool   $show      true means the opening and closing tags are removed and the content is left showing,
325
-     *                          false means the opening and closing tags and the contained content are removed.
326
-     * @return string     The template for the shortcode is returned.
327
-     */
328
-    protected function _mutate_conditional_block_in_template($shortcode, $show = true)
329
-    {
330
-        // first let's get all the matches in the template for this particular shortcode.
331
-        preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches);
332
-
333
-        if ($matches && is_array($matches[0]) && ! empty($matches[0])) {
334
-            // we need to hide all instances of the matches
335
-            foreach ($matches[0] as $index => $content_to_show_or_hide) {
336
-                $content_to_show_or_hide = preg_quote($content_to_show_or_hide);
337
-                $replacement = $show ? $matches[4][ $index ] : '';
338
-                $this->_data['template'] = preg_replace(
339
-                    '~' . $content_to_show_or_hide . '~',
340
-                    $replacement,
341
-                    $this->_data['template']
342
-                );
343
-            }
344
-        }
345
-        // return $template
346
-        return $this->_data['template'];
347
-    }
348
-
349
-
350
-    /**
351
-     * This returns the regex pattern to use for conditional shortcodes parsing.
352
-     *
353
-     * Note: regex comes in part from the WP `get_shortcode_regex` expression in \wp-includes\shortcodes.php
354
-     *
355
-     * @param $shortcode
356
-     * @since 4.9.32
357
-     * @return string
358
-     */
359
-    private function _get_conditional_block_regex($shortcode)
360
-    {
361
-        // get just the shortcode tag for the match
362
-        preg_match('@\[([^<>&/\[\]\x00-\x20=]++)@', $shortcode, $shortcode_tag_matches);
363
-        if (empty($shortcode_tag_matches[1])) {
364
-            return $this->_data['template'];
365
-        }
366
-
367
-        $shortcode_tag = $shortcode_tag_matches[1];
368
-        // get attributes_part_of_tag
369
-        $attributes_part = preg_quote(str_replace(array($shortcode_tag, '[', ']'), '', $shortcode));
370
-        // escape
371
-        $shortcode_tag = preg_quote($shortcode_tag);
372
-
373
-        return
374
-            '\['                                  // Opening Bracket
375
-            . "($shortcode_tag)$attributes_part"    // 1: Shortcode Name
376
-            . '(?![\w-])'                           // Not followed by word character or hyphen
377
-            . '('                                   // 2: Unroll the loop: Inside the opening shortcode tag
378
-            . '[^\]\/]*'                          // Not a closing bracket or forward slash
379
-            . '(?:'
380
-            . '\/(?!\])'                      // A forward slash not followed by a closing bracket
381
-            . '[^\]\/]*'                      // Not a closing bracket or forward slash.
382
-            . ')*?'
383
-            . ')'
384
-            . '(?:'
385
-            . '(\/)'                              // 3. Self closing tag ...
386
-            . '\]'                                // ... and closing bracket
387
-            . '|'
388
-            . '\]'                                // Closing bracket
389
-            . '(?:'
390
-            . '('                             // 4: Unroll the loop: Optionally, anything between the opening and closing brackets
391
-            . '[^\[]*+'                   // Not an opening bracket
392
-            . '(?:'
393
-            . '\[(?!\/\1\])'          // An opening bracket not followed by the closing shortcode tag.
394
-            . '[^\[]*+'               // Not an opening bracket
395
-            . ')*+'
396
-            . ')'
397
-            . '\[\/\1\]'                      // Closing shortcode tag
398
-            . ')?'
399
-            . ')';
400
-    }
401
-
402
-
403
-    /**
404
-     * This sets the properties related to the messages system
405
-     *
406
-     * @since 4.5.0
407
-     * @return void
408
-     */
409
-    protected function _set_messages_properties()
410
-    {
411
-        // should be in _extra_data
412
-        if (isset($this->_extra_data['messenger'])) {
413
-            $this->_messenger = $this->_extra_data['messenger'];
414
-            $this->_message_type = $this->_extra_data['message_type'];
415
-            $this->_context = $this->_extra_data['message'] instanceof EE_Message
416
-                ? $this->_extra_data['message']->context() : '';
417
-            $this->_GRP_ID = $this->_extra_data['message'] instanceof EE_Message
418
-                ? $this->_extra_data['message']->GRP_ID() : 0;
419
-            $this->_message = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message']
420
-                : null;
421
-        }
422
-    }
423
-
424
-
425
-    /**
426
-     * This returns whatever the set message type object is that was set on this shortcode parser.
427
-     *
428
-     * @since 4.5.0
429
-     * @return EE_message_type
430
-     */
431
-    public function get_set_message_type()
432
-    {
433
-        return $this->_message_type;
434
-    }
435
-
436
-
437
-    /**
438
-     * This returns whatever the set messenger object is that was set on this shortcode parser
439
-     *
440
-     * @since 4.5.0
441
-     * @return EE_messenger
442
-     */
443
-    public function get_set_messenger()
444
-    {
445
-        return $this->_messenger;
446
-    }
447
-
448
-
449
-    /**
450
-     * This returns whatever the set context string is on this shortcode parser.
451
-     *
452
-     * @since 4.5.0
453
-     * @return string
454
-     */
455
-    public function get_set_context()
456
-    {
457
-        return $this->_context;
458
-    }
459
-
460
-
461
-    /**
462
-     * This returns whatever the set EE_Message object is on this shortcode.
463
-     *
464
-     * @since 4.9.0
465
-     * @return EE_Message
466
-     */
467
-    public function get_set_message()
468
-    {
469
-        return $this->_message;
470
-    }
19
+	/**
20
+	 * holds label for library
21
+	 * This is used for referencing the library label
22
+	 *
23
+	 * @access public
24
+	 * @var string
25
+	 */
26
+	public $label;
27
+
28
+
29
+	/**
30
+	 * This property is used for referencing a short description of the library
31
+	 *
32
+	 * @access public
33
+	 * @var string
34
+	 */
35
+	public $description;
36
+
37
+
38
+	/**
39
+	 * This will hold an array of shortcodes with the key as the shortcode ([shortcode]) and the value as a
40
+	 * label/description for the shortcode.
41
+	 *
42
+	 * @access protected
43
+	 * @var array
44
+	 */
45
+	protected $_shortcodes;
46
+
47
+
48
+	/**
49
+	 * This will hold the incoming data item sent to the parser method
50
+	 *
51
+	 * @access protected
52
+	 * @var mixed (array|object)
53
+	 */
54
+	protected $_data;
55
+
56
+
57
+	/**
58
+	 * some shortcodes may require extra data to parse.  This property is provided for that.
59
+	 *
60
+	 * @var array
61
+	 */
62
+	protected $_extra_data;
63
+
64
+
65
+	/**
66
+	 * EE_messenger used to generate the template being parsed.
67
+	 *
68
+	 * @since 4.5.0
69
+	 * @var EE_messenger
70
+	 */
71
+	protected $_messenger;
72
+
73
+
74
+	/**
75
+	 * message type used to generate the template being parsed.
76
+	 *
77
+	 * @since 4.5.0
78
+	 * @var EE_message_type
79
+	 */
80
+	protected $_message_type;
81
+
82
+
83
+	/**
84
+	 * context used for the template being parsed
85
+	 *
86
+	 * @since 4.5.0
87
+	 * @var string
88
+	 */
89
+	protected $_context;
90
+
91
+
92
+	/**
93
+	 * Specific Message Template Group ID
94
+	 *
95
+	 * @since 4.5.0
96
+	 * @var int
97
+	 */
98
+	protected $_GRP_ID;
99
+
100
+
101
+	/**
102
+	 * @since 4.9.0
103
+	 * @type EE_Message
104
+	 */
105
+	protected $_message;
106
+
107
+
108
+	/**
109
+	 * This will hold an instance of the EEH_Parse_Shortcodes helper that will be used when handling list type
110
+	 * shortcodes
111
+	 *
112
+	 * @var EEH_Parse_Shortcodes
113
+	 */
114
+	protected $_shortcode_helper;
115
+
116
+
117
+	public function __construct()
118
+	{
119
+		$this->_set_defaults();
120
+		$this->_init_props();
121
+	}
122
+
123
+
124
+	/**
125
+	 * This sets the defaults for the properties.  Child classes will override these properties in their _init_props
126
+	 * method
127
+	 */
128
+	private function _set_defaults()
129
+	{
130
+		$this->name = $this->description = '';
131
+		$this->_shortcodes = array();
132
+		$this->_set_shortcode_helper();
133
+	}
134
+
135
+
136
+	/**
137
+	 * loads an instance of the EE_Shortcode_Parser helper when requested
138
+	 */
139
+	protected function _set_shortcode_helper()
140
+	{
141
+		// get shortcode_replace instance- set when _get_messages is called in child...
142
+		$this->_shortcode_helper = new EEH_Parse_Shortcodes();
143
+	}
144
+
145
+
146
+	public function get_shortcode_helper()
147
+	{
148
+		if (! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) {
149
+			$this->_set_shortcode_helper();
150
+		}
151
+		return $this->_shortcode_helper;
152
+	}
153
+
154
+
155
+	/**
156
+	 * This is the public method for kicking of the parser included with each child.  It can be overridden by child
157
+	 * classes if necessary (see EE_Questions_Answers for example)
158
+	 *
159
+	 * @param  string $shortcode incoming shortcode to be parsed
160
+	 * @param  mixed (object|array) $data       incoming data to be be used for parsing
161
+	 * @param  mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee)
162
+	 * @return string            parsed shortcode.
163
+	 */
164
+	public function parser($shortcode, $data, $extra_data = array())
165
+	{
166
+
167
+		// filter setup shortcodes
168
+		$this->_shortcodes = $this->get_shortcodes();
169
+
170
+		// we need to setup any dynamic shortcodes so that they work with the array_key_exists
171
+		preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches);
172
+		$sc_to_verify = ! empty($matches[0]) ? $matches[0][0] . ']' : $shortcode;
173
+
174
+		// first we want to make sure this is a valid shortcode
175
+		if (! array_key_exists($sc_to_verify, $this->_shortcodes)) {
176
+			return false;
177
+		} //get out, this parser doesn't handle the incoming shortcode.
178
+		$this->_data = $data;
179
+		$this->_extra_data = $extra_data;
180
+		$this->_set_messages_properties();
181
+		$parsed = apply_filters(
182
+			'FHEE__' . get_class($this) . '__parser_after',
183
+			$this->_parser($shortcode),
184
+			$shortcode,
185
+			$data,
186
+			$extra_data,
187
+			$this
188
+		);
189
+
190
+		// note the below filter applies to ALL shortcode parsers... be careful!
191
+		return apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this);
192
+	}
193
+
194
+
195
+	/**
196
+	 * This method just returns the shortcodes in the $_shortcodes array property.
197
+	 *
198
+	 * @access public
199
+	 * @return array array of shortcodes => description pairs
200
+	 */
201
+	public function get_shortcodes()
202
+	{
203
+		$this->_shortcodes = apply_filters('FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this);
204
+
205
+		// note the below filter applies to ALL shortcode parsers... be careful!
206
+		$this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this);
207
+
208
+		return $this->_shortcodes;
209
+	}
210
+
211
+
212
+	/**
213
+	 * Child classes use this method to set the $name, $description, and $_shortcodes properties.
214
+	 *
215
+	 * @abstract
216
+	 * @access protected
217
+	 * @return void
218
+	 */
219
+	abstract protected function _init_props();
220
+
221
+
222
+	/**
223
+	 * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
224
+	 * will have to take care of handling.
225
+	 *
226
+	 * @abstract
227
+	 * @access protected
228
+	 * @param string $shortcode    the shortcode to be parsed.
229
+	 * @param mixed (object|array) $data      incoming data for the parser.  The data could be either an object or
230
+	 *                             array because there are some shortcodes that might be replaced by prepared data that
231
+	 *                             has multiple items in a list (i.e. list of attendees in an event and we're showing
232
+	 *                             fname/lname for each attendee).  In this case data will be in an array.  Otherwise
233
+	 *                             the data shoudl be in a properly formatted object.  The
234
+	 *                             EEH_Parse_Shortcodes.helper.php describes the data object we're expecting.
235
+	 * @return string parsed shortcode
236
+	 */
237
+	abstract protected function _parser($shortcode);
238
+
239
+
240
+	/**
241
+	 * This just validates incoming data for list type shortcode parsers (and they call this method) to make sure it
242
+	 * meets their requirements
243
+	 *
244
+	 * @return mixed (void|exception) If validation fails we'll throw an exception.
245
+	 */
246
+	protected function _validate_list_requirements()
247
+	{
248
+
249
+		// first test to make sure we've got an array!
250
+		if (! is_array($this->_data)) {
251
+			throw new EE_Error(
252
+				sprintf(
253
+					esc_html__(
254
+						'Expecting an array for the data sent to %s. Instead it was %s',
255
+						'event_espresso'
256
+					),
257
+					get_class($this),
258
+					gettype($this->_data)
259
+				)
260
+			);
261
+		}
262
+
263
+		// next test to make sure we've got the required template in the index!
264
+		if (! isset($this->_data['template'])) {
265
+			throw new EE_Error(
266
+				sprintf(
267
+					esc_html__(
268
+						'The incoming data does not have the required template index in its array',
269
+						'event_espresso'
270
+					)
271
+				)
272
+			);
273
+		}
274
+
275
+		// next test to make sure we've got got a data index in the incoming data array
276
+		if (! isset($this->_data['data'])) {
277
+			throw new EE_Error(
278
+				esc_html__(
279
+					'The incoming data does not have the required data index in its array',
280
+					'event_espresso'
281
+				)
282
+			);
283
+		}
284
+
285
+		// all is well let's make sure _extra_data always has the values needed.
286
+		// let's make sure that extra_data includes all templates (for later parsing if necessary)
287
+		if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) {
288
+			$this->_extra_data['data'] = $this->_data['data'];
289
+			$this->_extra_data['template'] = $this->_data['template'];
290
+		}
291
+	}
292
+
293
+
294
+	/**
295
+	 * This returns any attributes that may be existing on an EE_Shortcode
296
+	 *
297
+	 * @since 4.5.0
298
+	 * @param string $shortcode incoming shortcode
299
+	 * @return array An array with the attributes
300
+	 */
301
+	protected function _get_shortcode_attrs($shortcode)
302
+	{
303
+		// make sure the required wp helper function is present
304
+		// require the shortcode file if necessary
305
+		if (! function_exists('shortcode_parse_atts')) {
306
+			require_once(ABSPATH . WPINC . '/shortcodes.php');
307
+		}
308
+
309
+		// let's get any attributes that may be present and set the defaults.
310
+		$shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode));
311
+		return shortcode_parse_atts($shortcode_to_parse);
312
+	}
313
+
314
+
315
+	/**
316
+	 * Conditional blocks are shortcode patterns with an opening conditional tag `[IF_*]` and a corresponding
317
+	 * closing tag (eg `[/IF_*]`).  The content within the tags will be displayed/hidden depending on whatever
318
+	 * conditions existed in the opening tag.  This method handles parsing the actual template to show/hide this
319
+	 * conditional content.
320
+	 *
321
+	 * @since 4.9.32
322
+	 *
323
+	 * @param string $shortcode This should be original shortcode as used in the template and passed to the parser.
324
+	 * @param bool   $show      true means the opening and closing tags are removed and the content is left showing,
325
+	 *                          false means the opening and closing tags and the contained content are removed.
326
+	 * @return string     The template for the shortcode is returned.
327
+	 */
328
+	protected function _mutate_conditional_block_in_template($shortcode, $show = true)
329
+	{
330
+		// first let's get all the matches in the template for this particular shortcode.
331
+		preg_match_all('~' . $this->_get_conditional_block_regex($shortcode) . '~', $this->_data['template'], $matches);
332
+
333
+		if ($matches && is_array($matches[0]) && ! empty($matches[0])) {
334
+			// we need to hide all instances of the matches
335
+			foreach ($matches[0] as $index => $content_to_show_or_hide) {
336
+				$content_to_show_or_hide = preg_quote($content_to_show_or_hide);
337
+				$replacement = $show ? $matches[4][ $index ] : '';
338
+				$this->_data['template'] = preg_replace(
339
+					'~' . $content_to_show_or_hide . '~',
340
+					$replacement,
341
+					$this->_data['template']
342
+				);
343
+			}
344
+		}
345
+		// return $template
346
+		return $this->_data['template'];
347
+	}
348
+
349
+
350
+	/**
351
+	 * This returns the regex pattern to use for conditional shortcodes parsing.
352
+	 *
353
+	 * Note: regex comes in part from the WP `get_shortcode_regex` expression in \wp-includes\shortcodes.php
354
+	 *
355
+	 * @param $shortcode
356
+	 * @since 4.9.32
357
+	 * @return string
358
+	 */
359
+	private function _get_conditional_block_regex($shortcode)
360
+	{
361
+		// get just the shortcode tag for the match
362
+		preg_match('@\[([^<>&/\[\]\x00-\x20=]++)@', $shortcode, $shortcode_tag_matches);
363
+		if (empty($shortcode_tag_matches[1])) {
364
+			return $this->_data['template'];
365
+		}
366
+
367
+		$shortcode_tag = $shortcode_tag_matches[1];
368
+		// get attributes_part_of_tag
369
+		$attributes_part = preg_quote(str_replace(array($shortcode_tag, '[', ']'), '', $shortcode));
370
+		// escape
371
+		$shortcode_tag = preg_quote($shortcode_tag);
372
+
373
+		return
374
+			'\['                                  // Opening Bracket
375
+			. "($shortcode_tag)$attributes_part"    // 1: Shortcode Name
376
+			. '(?![\w-])'                           // Not followed by word character or hyphen
377
+			. '('                                   // 2: Unroll the loop: Inside the opening shortcode tag
378
+			. '[^\]\/]*'                          // Not a closing bracket or forward slash
379
+			. '(?:'
380
+			. '\/(?!\])'                      // A forward slash not followed by a closing bracket
381
+			. '[^\]\/]*'                      // Not a closing bracket or forward slash.
382
+			. ')*?'
383
+			. ')'
384
+			. '(?:'
385
+			. '(\/)'                              // 3. Self closing tag ...
386
+			. '\]'                                // ... and closing bracket
387
+			. '|'
388
+			. '\]'                                // Closing bracket
389
+			. '(?:'
390
+			. '('                             // 4: Unroll the loop: Optionally, anything between the opening and closing brackets
391
+			. '[^\[]*+'                   // Not an opening bracket
392
+			. '(?:'
393
+			. '\[(?!\/\1\])'          // An opening bracket not followed by the closing shortcode tag.
394
+			. '[^\[]*+'               // Not an opening bracket
395
+			. ')*+'
396
+			. ')'
397
+			. '\[\/\1\]'                      // Closing shortcode tag
398
+			. ')?'
399
+			. ')';
400
+	}
401
+
402
+
403
+	/**
404
+	 * This sets the properties related to the messages system
405
+	 *
406
+	 * @since 4.5.0
407
+	 * @return void
408
+	 */
409
+	protected function _set_messages_properties()
410
+	{
411
+		// should be in _extra_data
412
+		if (isset($this->_extra_data['messenger'])) {
413
+			$this->_messenger = $this->_extra_data['messenger'];
414
+			$this->_message_type = $this->_extra_data['message_type'];
415
+			$this->_context = $this->_extra_data['message'] instanceof EE_Message
416
+				? $this->_extra_data['message']->context() : '';
417
+			$this->_GRP_ID = $this->_extra_data['message'] instanceof EE_Message
418
+				? $this->_extra_data['message']->GRP_ID() : 0;
419
+			$this->_message = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message']
420
+				: null;
421
+		}
422
+	}
423
+
424
+
425
+	/**
426
+	 * This returns whatever the set message type object is that was set on this shortcode parser.
427
+	 *
428
+	 * @since 4.5.0
429
+	 * @return EE_message_type
430
+	 */
431
+	public function get_set_message_type()
432
+	{
433
+		return $this->_message_type;
434
+	}
435
+
436
+
437
+	/**
438
+	 * This returns whatever the set messenger object is that was set on this shortcode parser
439
+	 *
440
+	 * @since 4.5.0
441
+	 * @return EE_messenger
442
+	 */
443
+	public function get_set_messenger()
444
+	{
445
+		return $this->_messenger;
446
+	}
447
+
448
+
449
+	/**
450
+	 * This returns whatever the set context string is on this shortcode parser.
451
+	 *
452
+	 * @since 4.5.0
453
+	 * @return string
454
+	 */
455
+	public function get_set_context()
456
+	{
457
+		return $this->_context;
458
+	}
459
+
460
+
461
+	/**
462
+	 * This returns whatever the set EE_Message object is on this shortcode.
463
+	 *
464
+	 * @since 4.9.0
465
+	 * @return EE_Message
466
+	 */
467
+	public function get_set_message()
468
+	{
469
+		return $this->_message;
470
+	}
471 471
 }
Please login to merge, or discard this patch.
core/libraries/messages/EE_Message_Type_Collection.lib.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@
 block discarded – undo
174 174
             $this->rewind();
175 175
             while ($this->valid()) {
176 176
                 echo '<h5 style="color:#2EA2CC;">
177
-                    ' . __CLASS__ . ' class : <span style="color:#E76700">' . esc_html($this->getInfo()) . '</span>
177
+                    ' . __CLASS__.' class : <span style="color:#E76700">'.esc_html($this->getInfo()).'</span>
178 178
                     </h5>';
179 179
                 $this->next();
180 180
             }
Please login to merge, or discard this patch.
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -13,143 +13,143 @@
 block discarded – undo
13 13
  */
14 14
 class EE_Message_Type_Collection extends EE_Object_Collection
15 15
 {
16
-    /**
17
-     * EE_Message_Type_Collection constructor.
18
-     */
19
-    public function __construct()
20
-    {
21
-        $this->interface = 'EE_message_type';
22
-    }
23
-
24
-
25
-
26
-    /**
27
-     * attaches an object to the Collection
28
-     * and sets any supplied data associated with the current iterator entry
29
-     * by calling EE_Object_Collection::set_info()
30
-     *
31
-     * @param object $object
32
-     * @param mixed  $info
33
-     * @return bool
34
-     */
35
-    public function add($object, $info = ''): bool
36
-    {
37
-        $info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
38
-        return parent::add($object, $info);
39
-    }
40
-
41
-
42
-
43
-    /**
44
-     * Sets the data associated with an object in the Collection
45
-     * if no $info is supplied, then the spl_object_hash() is used
46
-     *
47
-     * @param object $object
48
-     * @param mixed  $info
49
-     * @return bool
50
-     */
51
-    public function set_info($object, $info = ''): bool
52
-    {
53
-        $info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
54
-        return parent::set_info($object, $info);
55
-    }
56
-
57
-
58
-
59
-    /**
60
-     * finds and returns an object in the Collection based on the info that was set using addObject()
61
-     * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
62
-     *
63
-     * @param mixed
64
-     * @return null | object
65
-     */
66
-    public function get_by_info($info = '')
67
-    {
68
-        return parent::get_by_info(str_replace(' ', '_', strtolower($info)));
69
-    }
70
-
71
-
72
-
73
-    /**
74
-     * returns TRUE or FALSE depending on whether the supplied object is within the Collection
75
-     *
76
-     * @param object $object
77
-     * @return bool
78
-     */
79
-    public function has($object): bool
80
-    {
81
-        return parent::has($object);
82
-    }
83
-
84
-
85
-
86
-    /**
87
-     * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection
88
-     *
89
-     * @param string $message_type_name
90
-     * @return bool
91
-     */
92
-    public function has_by_name(string $message_type_name): bool
93
-    {
94
-        return $this->get_by_info($message_type_name) instanceof $this->interface;
95
-    }
96
-
97
-
98
-
99
-    /**
100
-     * detaches an object from the Collection
101
-     *
102
-     * @param $object
103
-     * @return bool
104
-     */
105
-    public function remove($object): bool
106
-    {
107
-        return parent::remove($object);
108
-    }
109
-
110
-
111
-
112
-    /**
113
-     * advances pointer to the provided object
114
-     *
115
-     * @param $object
116
-     * @return void
117
-     */
118
-    public function set_current($object)
119
-    {
120
-        parent::set_current($object);
121
-    }
122
-
123
-
124
-
125
-    /**
126
-     * advances pointer to the object whose info matches that which was provided
127
-     *
128
-     * @param $info
129
-     * @return void
130
-     */
131
-    public function set_current_by_info($info)
132
-    {
133
-        parent::set_current_by_info($info);
134
-    }
135
-
136
-
137
-
138
-    /**
139
-     * displays list of collection classes if WP_DEBUG is on
140
-     *
141
-     * @return void
142
-     */
143
-    public function show_collection_classes()
144
-    {
145
-        if (WP_DEBUG) {
146
-            $this->rewind();
147
-            while ($this->valid()) {
148
-                echo '<h5 style="color:#2EA2CC;">
16
+	/**
17
+	 * EE_Message_Type_Collection constructor.
18
+	 */
19
+	public function __construct()
20
+	{
21
+		$this->interface = 'EE_message_type';
22
+	}
23
+
24
+
25
+
26
+	/**
27
+	 * attaches an object to the Collection
28
+	 * and sets any supplied data associated with the current iterator entry
29
+	 * by calling EE_Object_Collection::set_info()
30
+	 *
31
+	 * @param object $object
32
+	 * @param mixed  $info
33
+	 * @return bool
34
+	 */
35
+	public function add($object, $info = ''): bool
36
+	{
37
+		$info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
38
+		return parent::add($object, $info);
39
+	}
40
+
41
+
42
+
43
+	/**
44
+	 * Sets the data associated with an object in the Collection
45
+	 * if no $info is supplied, then the spl_object_hash() is used
46
+	 *
47
+	 * @param object $object
48
+	 * @param mixed  $info
49
+	 * @return bool
50
+	 */
51
+	public function set_info($object, $info = ''): bool
52
+	{
53
+		$info = empty($info) && $object instanceof $this->interface ? $object->name : $info;
54
+		return parent::set_info($object, $info);
55
+	}
56
+
57
+
58
+
59
+	/**
60
+	 * finds and returns an object in the Collection based on the info that was set using addObject()
61
+	 * PLZ NOTE: the pointer is reset to the beginning of the collection before returning
62
+	 *
63
+	 * @param mixed
64
+	 * @return null | object
65
+	 */
66
+	public function get_by_info($info = '')
67
+	{
68
+		return parent::get_by_info(str_replace(' ', '_', strtolower($info)));
69
+	}
70
+
71
+
72
+
73
+	/**
74
+	 * returns TRUE or FALSE depending on whether the supplied object is within the Collection
75
+	 *
76
+	 * @param object $object
77
+	 * @return bool
78
+	 */
79
+	public function has($object): bool
80
+	{
81
+		return parent::has($object);
82
+	}
83
+
84
+
85
+
86
+	/**
87
+	 * returns TRUE or FALSE depending on whether the supplied message_type classname is within the Collection
88
+	 *
89
+	 * @param string $message_type_name
90
+	 * @return bool
91
+	 */
92
+	public function has_by_name(string $message_type_name): bool
93
+	{
94
+		return $this->get_by_info($message_type_name) instanceof $this->interface;
95
+	}
96
+
97
+
98
+
99
+	/**
100
+	 * detaches an object from the Collection
101
+	 *
102
+	 * @param $object
103
+	 * @return bool
104
+	 */
105
+	public function remove($object): bool
106
+	{
107
+		return parent::remove($object);
108
+	}
109
+
110
+
111
+
112
+	/**
113
+	 * advances pointer to the provided object
114
+	 *
115
+	 * @param $object
116
+	 * @return void
117
+	 */
118
+	public function set_current($object)
119
+	{
120
+		parent::set_current($object);
121
+	}
122
+
123
+
124
+
125
+	/**
126
+	 * advances pointer to the object whose info matches that which was provided
127
+	 *
128
+	 * @param $info
129
+	 * @return void
130
+	 */
131
+	public function set_current_by_info($info)
132
+	{
133
+		parent::set_current_by_info($info);
134
+	}
135
+
136
+
137
+
138
+	/**
139
+	 * displays list of collection classes if WP_DEBUG is on
140
+	 *
141
+	 * @return void
142
+	 */
143
+	public function show_collection_classes()
144
+	{
145
+		if (WP_DEBUG) {
146
+			$this->rewind();
147
+			while ($this->valid()) {
148
+				echo '<h5 style="color:#2EA2CC;">
149 149
                     ' . __CLASS__ . ' class : <span style="color:#E76700">' . esc_html($this->getInfo()) . '</span>
150 150
                     </h5>';
151
-                $this->next();
152
-            }
153
-        }
154
-    }
151
+				$this->next();
152
+			}
153
+		}
154
+	}
155 155
 }
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_ticket_list.template.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
         <div class="ticket-time-and-place-details">
25 25
             <div class="ticket-time-details">
26 26
                 <h4 class="sub-section-title no-bottom-margin">
27
-                    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'clock-16x16.png'); ?>">
27
+                    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'clock-16x16.png'); ?>">
28 28
                     <?php esc_html_e('Date/Time:', 'event_espresso'); ?>
29 29
                 </h4>
30 30
                 <ul class="event-dates">[DATETIME_LIST]</ul>
31 31
             </div>
32 32
             <div class="ticket-place-details">
33 33
                 <h4 class="sub-section-title no-bottom-margin">
34
-                    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'location-pin-16x16.png'); ?>">
34
+                    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'location-pin-16x16.png'); ?>">
35 35
                     <?php esc_html_e('Venue', 'event_espresso'); ?>
36 36
                 </h4>
37 37
                 <ul class="event-venues">
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         </div>
46 46
         <div class="ticket-registrations-area">
47 47
             <h4 class="sub-section-title">
48
-                <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'users-16x16.png'); ?>">
48
+                <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'users-16x16.png'); ?>">
49 49
                 <?php esc_html_e("Registration Details", "event_espresso"); ?>
50 50
                 <span class="small-text link">
51 51
                     ( <a class="print_button noPrint" href="[PRIMARY_REGISTRANT_FRONTEND_EDIT_REG_LINK]">
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_event_list.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 ?>
8 8
 <h3 class="section-title event-name">
9
-    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL . 'calendar_year-24x24.png'); ?>">
9
+    <img class="icon" src="<?php echo esc_url_raw(EE_IMAGES_URL.'calendar_year-24x24.png'); ?>">
10 10
     <?php esc_html_e("Event Name:", "event_espresso") ?>
11 11
     <span class="plain-text">[EVENT_NAME]</span>
12 12
     <span class="small-text link">
Please login to merge, or discard this patch.
libraries/messages/defaults/default/html_receipt_attendee_list.template.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@
 block discarded – undo
8 8
 <li class="ticket-registration">
9 9
     <table class="registration-details">
10 10
         <tr class="odd">
11
-            <th><?php	_e('Attendee', 'event_espresso');?></th>
11
+            <th><?php	_e('Attendee', 'event_espresso'); ?></th>
12 12
             <td>[FNAME] [LNAME] ([ATTENDEE_EMAIL])</td>
13 13
         </tr>
14 14
         <tr>
15
-            <th><?php esc_html_e("Registration Code:", "event_espresso");?></th>
15
+            <th><?php esc_html_e("Registration Code:", "event_espresso"); ?></th>
16 16
             <td>[REGISTRATION_CODE] - <span class="[REGISTRATION_STATUS_ID]">[REGISTRATION_STATUS_LABEL]</span></td>
17 17
         </tr>
18 18
     </table>
Please login to merge, or discard this patch.
thank_you_page/templates/thank-you-page-registration-details.template.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     $event_name    = '';
22 22
     $wait_list     = false;
23 23
     foreach ($registrations as $registration) {
24
-        if (! $registration instanceof EE_Registration) {
24
+        if ( ! $registration instanceof EE_Registration) {
25 25
             continue;
26 26
         }
27 27
         if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
             <tbody>
56 56
             <?php
57 57
         }
58
-        if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
58
+        if ($is_primary || ( ! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
59 59
             <tr>
60 60
                 <td width="40%">
61 61
                     <?php
Please login to merge, or discard this patch.
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -14,24 +14,24 @@  discard block
 block discarded – undo
14 14
 
15 15
 <div class="ee-registration-details-dv">
16 16
     <?php
17
-    $registrations = $transaction->registrations();
18
-    $registrations = is_array($registrations) ? $registrations : [];
19
-    $reg_count     = count($registrations);
20
-    $reg_cntr      = 0;
21
-    $event_name    = '';
22
-    $wait_list     = false;
23
-    foreach ($registrations as $registration) {
24
-        if (! $registration instanceof EE_Registration) {
25
-            continue;
26
-        }
27
-        if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
17
+	$registrations = $transaction->registrations();
18
+	$registrations = is_array($registrations) ? $registrations : [];
19
+	$reg_count     = count($registrations);
20
+	$reg_cntr      = 0;
21
+	$event_name    = '';
22
+	$wait_list     = false;
23
+	foreach ($registrations as $registration) {
24
+		if (! $registration instanceof EE_Registration) {
25
+			continue;
26
+		}
27
+		if ($event_name != $registration->event_name() && ! empty($event_name)) { ?>
28 28
             </tbody>
29 29
             </table>
30 30
             <?php
31
-        }
32
-        $reg_cntr++;
33
-        if ($event_name != $registration->event_name()) {
34
-            ?>
31
+		}
32
+		$reg_cntr++;
33
+		if ($event_name != $registration->event_name()) {
34
+			?>
35 35
             <h5>
36 36
                 <span class="smaller-text grey-text">
37 37
                     <?php esc_html_e('for', 'event_espresso'); ?> :
@@ -54,23 +54,23 @@  discard block
 block discarded – undo
54 54
             </thead>
55 55
             <tbody>
56 56
             <?php
57
-        }
58
-        if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
57
+		}
58
+		if ($is_primary || (! $is_primary && $reg_url_link == $registration->reg_url_link())) { ?>
59 59
             <tr>
60 60
                 <td width="40%">
61 61
                     <?php
62
-                    if ($registration->attendee() instanceof EE_Attendee) {
63
-                        echo esc_html($registration->attendee()->full_name(true));
64
-                    }
65
-                    ?>
62
+					if ($registration->attendee() instanceof EE_Attendee) {
63
+						echo esc_html($registration->attendee()->full_name(true));
64
+					}
65
+					?>
66 66
                     <p class="tiny-text" style="margin: .75em 0 0;">
67 67
                         <?php if ($registration->count_question_groups()) { ?>
68 68
                             <a class="ee-icon-only-lnk"
69 69
                                href="<?php echo esc_url_raw($registration->edit_attendee_information_url()); ?>"
70 70
                                title="<?php esc_attr_e(
71
-                                   'Click here to edit Attendee Information',
72
-                                   'event_espresso'
73
-                               ); ?>"
71
+								   'Click here to edit Attendee Information',
72
+								   'event_espresso'
73
+							   ); ?>"
74 74
                             >
75 75
                                 <span class="dashicons dashicons-groups"></span>
76 76
                                 <?php esc_html_e('edit info', 'event_espresso'); ?>
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
                         <?php } ?>
79 79
                         <a class="ee-resend-reg-confirmation-email ee-icon-only-lnk"
80 80
                            href="<?php echo esc_url_raw(
81
-                               add_query_arg(
82
-                                   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
83
-                                   EE_Registry::instance()->CFG->core->thank_you_page_url()
84
-                               )
85
-                           ); ?>"
81
+							   add_query_arg(
82
+								   ['token' => $registration->reg_url_link(), 'resend_reg_confirmation' => 'true'],
83
+								   EE_Registry::instance()->CFG->core->thank_you_page_url()
84
+							   )
85
+						   ); ?>"
86 86
                            title="<?php esc_attr_e(
87
-                               'Click here to resend the Registration Confirmation email',
88
-                               'event_espresso'
89
-                           ); ?>"
87
+							   'Click here to resend the Registration Confirmation email',
88
+							   'event_espresso'
89
+						   ); ?>"
90 90
                            rel="<?php echo esc_attr($registration->reg_url_link()); ?>"
91 91
                         >
92 92
                             <span class="dashicons dashicons-email-alt"></span>
@@ -100,27 +100,27 @@  discard block
 block discarded – undo
100 100
                 <td width="35%" class="jst-left">
101 101
                     <?php $registration->e_pretty_status(true) ?>
102 102
                     <?php
103
-                    if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
104
-                        $wait_list = true;
105
-                    }
106
-                    ?>
103
+					if ($registration->status_ID() === EEM_Registration::status_id_wait_list) {
104
+						$wait_list = true;
105
+					}
106
+					?>
107 107
                 </td>
108 108
             </tr>
109 109
             <?php do_action(
110
-                'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
111
-                $registration
112
-            ); ?>
110
+				'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
111
+				$registration
112
+			); ?>
113 113
             <?php
114
-            $event_name = $registration->event_name();
115
-        }
116
-        if ($reg_cntr >= $reg_count) {
117
-            ?>
114
+			$event_name = $registration->event_name();
115
+		}
116
+		if ($reg_cntr >= $reg_count) {
117
+			?>
118 118
             </tbody>
119 119
             </table>
120 120
             <?php
121
-        }
122
-    }
123
-    ?>
121
+		}
122
+	}
123
+	?>
124 124
     <?php if ($is_primary && $SPCO_attendee_information_url) { ?>
125 125
         <p class="small-text jst-rght">
126 126
             <a href='<?php echo esc_url_raw($SPCO_attendee_information_url) ?>'>
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
         </p>
130 130
     <?php } ?>
131 131
     <?php
132
-    if ($wait_list) {
133
-        echo apply_filters(
134
-            'AFEE__thank_you_page_registration_details_template__wait_list_notice',
135
-            sprintf(
136
-                esc_html__(
137
-                    '%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
138
-                    'event_espresso'
139
-                ),
140
-                '<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
141
-                '</h6 ><p class="ee-wait-list-notice">',
142
-                '</p ><br />'
143
-            )
144
-        );
145
-    }
146
-    do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
-    ?>
132
+	if ($wait_list) {
133
+		echo apply_filters(
134
+			'AFEE__thank_you_page_registration_details_template__wait_list_notice',
135
+			sprintf(
136
+				esc_html__(
137
+					'%1$sre: Wait List Registrations%2$sPlease note that the total cost listed below in the Transaction Details is for ALL registrations, including those that are on the wait list, even though they can not be currently paid for. If any spaces become available however, you may be notified by the Event admin and have the opportunity to secure the remaining tickets by making a payment for them.%3$s',
138
+					'event_espresso'
139
+				),
140
+				'<h6 class="" style="margin-bottom:.25em;"><span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>',
141
+				'</h6 ><p class="ee-wait-list-notice">',
142
+				'</p ><br />'
143
+			)
144
+		);
145
+	}
146
+	do_action('AHEE__thank_you_page_registration_details_template__after_registration_details');
147
+	?>
148 148
 
149 149
 </div>
150 150
 <!-- end of .registration-details -->
Please login to merge, or discard this patch.
single_page_checkout/templates/registration_page_wrapper.template.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 <div id="ee-single-page-checkout-dv" class="">
16 16
     <?php
17
-    if (! $empty_cart) {
17
+    if ( ! $empty_cart) {
18 18
         if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
19 19
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
20 20
                style="display: none;">
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
32 32
             </p>
33 33
         <?php }
34
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
34
+        if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
35 35
             ?>
36 36
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr">
37 37
                 <?php esc_html_e(' Steps', 'event_espresso'); ?>
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         foreach ($reg_steps as $reg_step) {
78 78
             if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
79 79
                 $slug = $reg_step->slug();
80
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
80
+                do_action('AHEE__'.$slug.'__reg_step_start', $reg_step);
81 81
                 // todo: deprecate hook AHEE__registration_page_attendee_information__start
82 82
                 ?>
83 83
                 <div id="spco-<?php echo esc_attr($slug); ?>-dv"
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,38 +16,38 @@  discard block
 block discarded – undo
16 16
 
17 17
 <div id="ee-single-page-checkout-dv" class="">
18 18
     <?php
19
-    if (! $empty_cart) {
20
-        if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
19
+	if (! $empty_cart) {
20
+		if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
21 21
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
22 22
                style="display: none;">
23 23
                 <?php echo sprintf(
24
-                    apply_filters(
25
-                        'FHEE__registration_page_wrapper_template___time_limit',
26
-                        esc_html__('You have %1$s to complete your registration.', 'event_espresso')
27
-                    ),
28
-                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'
29
-                    . $registration_time_limit
30
-                    . '</span>'
31
-                );
32
-                ?>
24
+					apply_filters(
25
+						'FHEE__registration_page_wrapper_template___time_limit',
26
+						esc_html__('You have %1$s to complete your registration.', 'event_espresso')
27
+					),
28
+					'<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'
29
+					. $registration_time_limit
30
+					. '</span>'
31
+				);
32
+				?>
33 33
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
34 34
             </p>
35 35
         <?php }
36
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
37
-            ?>
36
+		if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
37
+			?>
38 38
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr">
39 39
                 <?php esc_html_e(' Steps', 'event_espresso'); ?>
40 40
             </h2>
41 41
 
42 42
             <div id="spco-steps-display-dv">
43 43
                 <?php
44
-                $step_nmbr = 1;
45
-                $total_steps = count($reg_steps) - 1;
46
-                foreach ($reg_steps as $reg_step) {
47
-                    if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
48
-                        $slug = $reg_step->slug();
49
-                        $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
50
-                        ?>
44
+				$step_nmbr = 1;
45
+				$total_steps = count($reg_steps) - 1;
46
+				foreach ($reg_steps as $reg_step) {
47
+					if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
48
+						$slug = $reg_step->slug();
49
+						$step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
50
+						?>
51 51
                         <div id="spco-step-<?php echo esc_attr($slug); ?>-display-dv"
52 52
                              class="spco-step-display-dv <?php echo esc_attr($step_display_dv_class); ?> steps-<?php echo esc_attr($total_steps); ?>"
53 53
                         >
@@ -60,28 +60,28 @@  discard block
 block discarded – undo
60 60
                         </div>
61 61
 
62 62
                         <?php
63
-                        if ($step_nmbr < $total_steps) { ?>
63
+						if ($step_nmbr < $total_steps) { ?>
64 64
                             <div class="spco-step-arrow-dv">&raquo;</div>
65 65
                             <?php
66
-                        }
67
-                        $step_nmbr++;
68
-                    }
69
-                }
70
-                ?>
66
+						}
67
+						$step_nmbr++;
68
+					}
69
+				}
70
+				?>
71 71
                 <div class="clear-float"></div>
72 72
             </div>
73 73
 
74 74
             <?php
75
-        }
75
+		}
76 76
 
77
-        do_action('AHEE__SPCO__before_registration_steps');
78
-        $step_nmbr = 1;
79
-        foreach ($reg_steps as $reg_step) {
80
-            if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
81
-                $slug = $reg_step->slug();
82
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
83
-                // todo: deprecate hook AHEE__registration_page_attendee_information__start
84
-                ?>
77
+		do_action('AHEE__SPCO__before_registration_steps');
78
+		$step_nmbr = 1;
79
+		foreach ($reg_steps as $reg_step) {
80
+			if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
81
+				$slug = $reg_step->slug();
82
+				do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
83
+				// todo: deprecate hook AHEE__registration_page_attendee_information__start
84
+				?>
85 85
                 <div id="spco-<?php echo esc_attr($slug); ?>-dv"
86 86
                      class="spco-step-dv <?php echo esc_attr($reg_step->div_class()); ?>"
87 87
                 >
@@ -89,20 +89,20 @@  discard block
 block discarded – undo
89 89
                     <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?>
90 90
                 </div>
91 91
                 <?php $step_nmbr++;
92
-            }
93
-        }
94
-        do_action('AHEE__SPCO__after_registration_steps');
95
-    } else {
96
-        ?>
92
+			}
93
+		}
94
+		do_action('AHEE__SPCO__after_registration_steps');
95
+	} else {
96
+		?>
97 97
         <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr">
98 98
             <?php esc_html_e('Nothing in your Event Queue', 'event_espresso'); ?>
99 99
         </h3>
100 100
         <p><?php echo wp_kses($empty_msg, AllowedTags::getWithFormTags()); ?></p>
101 101
         <?php echo wp_kses($cookies_not_set_msg, AllowedTags::getWithFormTags()); ?>
102 102
         <?php
103
-    }
104
-    do_action('AHEE__SPCO__reg_form_footer');
105
-    ?>
103
+	}
104
+	do_action('AHEE__SPCO__reg_form_footer');
105
+	?>
106 106
 
107 107
 </div>
108 108
 
Please login to merge, or discard this patch.