Completed
Branch updates-from-cafe (85364e)
by
unknown
10:08 queued 02:37
created
registration_form/templates/question_groups_main_meta_box.template.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
             <td>
96 96
                 <label for="QSG_show_group_name">
97 97
                     <?php echo wp_kses(
98
-                        EEH_Form_Fields::select_input(
99
-                            'QSG_show_group_name',
100
-                            $values,
101
-                            $question_group->show_group_name()
102
-                        ),
103
-                        AllowedTags::getWithFormTags()
104
-                    ); ?>
98
+						EEH_Form_Fields::select_input(
99
+							'QSG_show_group_name',
100
+							$values,
101
+							$question_group->show_group_name()
102
+						),
103
+						AllowedTags::getWithFormTags()
104
+					); ?>
105 105
                     <p class="description"><?php esc_html_e('Show Group Name on Registration Page?', 'event_espresso'); ?></p>
106 106
                 </label>
107 107
             </td>
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
             <td>
118 118
                 <label for="QSG_show_group_order">
119 119
                     <?php echo wp_kses(
120
-                        EEH_Form_Fields::select_input(
121
-                            'QSG_show_group_desc',
122
-                            $values,
123
-                            $question_group->show_group_desc()
124
-                        ),
125
-                        AllowedTags::getWithFormTags()
126
-                    ); ?>
120
+						EEH_Form_Fields::select_input(
121
+							'QSG_show_group_desc',
122
+							$values,
123
+							$question_group->show_group_desc()
124
+						),
125
+						AllowedTags::getWithFormTags()
126
+					); ?>
127 127
                     <p class="description"><?php
128
-                        esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
129
-                    ?></p>
128
+						esc_html_e(' Show Group Description on Registration Page?', 'event_espresso');
129
+					?></p>
130 130
                 </label>
131 131
                 <input type="hidden" name="QSG_system" value="<?php echo esc_attr($question_group->system_group()); ?>">
132 132
             </td>
@@ -142,85 +142,85 @@  discard block
 block discarded – undo
142 142
     <div class="form-table question-group-questions inside">
143 143
         <div class="padding">
144 144
             <p><span class="description"><?php
145
-                    esc_html_e(
146
-                        'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
147
-                        'event_espresso'
148
-                    ); ?></span></p>
145
+					esc_html_e(
146
+						'Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.',
147
+						'event_espresso'
148
+					); ?></span></p>
149 149
             <div>
150 150
                 <ul class="question-list-sortable">
151 151
                     <?php
152
-                    $question_order = 0;
153
-                    $question_group_questions = $question_group->questions();
154
-                    foreach ($all_questions as $question_ID => $question) {
155
-                        if ($question instanceof EE_Question) {
156
-                            /*@var $question EE_Question*/
157
-                            $checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : '';
158
-                            // disable questions from the personal information question group
159
-                            // is it required in the current question group? if so don't allow admins to remove it
160
-                            $disabled = in_array(
161
-                                $question->system_ID(),
162
-                                EEM_Question::instance()->required_system_questions_in_system_question_group(
163
-                                    $QSG_system
164
-                                )
165
-                            ) ? 'disabled' : '';
166
-                            // limit where system questions can appear
167
-                            if (
168
-                                $question->system_ID() &&
169
-                                ! in_array(
170
-                                    $question->system_ID(),
171
-                                    EEM_Question::instance()->allowed_system_questions_in_system_question_group(
172
-                                        $QSG_system
173
-                                    )
174
-                                )
175
-                            ) {
176
-                                continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions).  The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions.
177
-                            }
178
-                            ?>
152
+					$question_order = 0;
153
+					$question_group_questions = $question_group->questions();
154
+					foreach ($all_questions as $question_ID => $question) {
155
+						if ($question instanceof EE_Question) {
156
+							/*@var $question EE_Question*/
157
+							$checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : '';
158
+							// disable questions from the personal information question group
159
+							// is it required in the current question group? if so don't allow admins to remove it
160
+							$disabled = in_array(
161
+								$question->system_ID(),
162
+								EEM_Question::instance()->required_system_questions_in_system_question_group(
163
+									$QSG_system
164
+								)
165
+							) ? 'disabled' : '';
166
+							// limit where system questions can appear
167
+							if (
168
+								$question->system_ID() &&
169
+								! in_array(
170
+									$question->system_ID(),
171
+									EEM_Question::instance()->allowed_system_questions_in_system_question_group(
172
+										$QSG_system
173
+									)
174
+								)
175
+							) {
176
+								continue; // skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions).  The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions.
177
+							}
178
+							?>
179 179
                             <li class="ee-question-sortable">
180 180
                                 <label for="question-<?php echo absint($question_ID); ?>">
181 181
                                     <input type="checkbox" name="questions[<?php echo absint($question_ID); ?>]"
182 182
                                            id="question-<?php echo absint($question_ID); ?>"
183 183
                                            value="<?php echo absint($question_ID); ?>" <?php echo esc_attr($disabled); ?> <?php echo esc_attr($checked); ?>>
184 184
                                     <span class="question-text"><?php
185
-                                        echo wp_kses(trim($question->display_text()), AllowedTags::getAllowedTags())
186
-                                             . (95 <= strlen(trim($question->display_text()))
187
-                                                ? "&hellip;"
188
-                                                : '');
189
-                                                                ?>
185
+										echo wp_kses(trim($question->display_text()), AllowedTags::getAllowedTags())
186
+											 . (95 <= strlen(trim($question->display_text()))
187
+												? "&hellip;"
188
+												: '');
189
+																?>
190 190
                                     </span>
191 191
                                     <input class="question-group-QGQ_order" type="hidden"
192 192
                                            name="question_orders[<?php echo absint($question_ID); ?>]"
193 193
                                            value="<?php echo esc_attr($question_order); ?>">
194 194
                                 </label>
195 195
                                 <?php
196
-                                if (
197
-                                    EE_Registry::instance()->CAP->current_user_can(
198
-                                        'ee_edit_question',
199
-                                        'espresso_registration_form_edit_question',
200
-                                        $question->ID()
201
-                                    )
202
-                                ) {
203
-                                    $edit_query_args = array(
204
-                                        'action' => 'edit_question',
205
-                                        'QST_ID' => $question->ID(),
206
-                                    );
207
-                                    $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
208
-
209
-                                    echo '<a href="' . $edit_link . '" target="_blank" aria-label="' .
210
-                                        sprintf(
211
-                                            esc_attr__('Edit %s', 'event_espresso'),
212
-                                            $question->admin_label()
213
-                                        )
214
-                                        . '"><span class="dashicons dashicons-edit"></span>
196
+								if (
197
+									EE_Registry::instance()->CAP->current_user_can(
198
+										'ee_edit_question',
199
+										'espresso_registration_form_edit_question',
200
+										$question->ID()
201
+									)
202
+								) {
203
+									$edit_query_args = array(
204
+										'action' => 'edit_question',
205
+										'QST_ID' => $question->ID(),
206
+									);
207
+									$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
208
+
209
+									echo '<a href="' . $edit_link . '" target="_blank" aria-label="' .
210
+										sprintf(
211
+											esc_attr__('Edit %s', 'event_espresso'),
212
+											$question->admin_label()
213
+										)
214
+										. '"><span class="dashicons dashicons-edit"></span>
215 215
                                         </a>';
216
-                                }
217
-                                ?>
216
+								}
217
+								?>
218 218
                             </li>
219 219
                             <?php
220
-                            $question_order++;
221
-                        }
222
-                    }
223
-                    ?>
220
+							$question_order++;
221
+						}
222
+					}
223
+					?>
224 224
                 </ul>
225 225
             </div>
226 226
         </div>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
                 <input id="QSG_identifier" name="QSG_identifier<?php echo esc_attr($id); ?>"
52 52
                        value="<?php echo esc_attr($question_group->get_f('QSG_identifier')); ?>" type="text"
53 53
                        class="regular-text" <?php echo esc_attr($disabled); ?>>
54
-                <?php if (! empty($QSG_system)) { ?>
54
+                <?php if ( ! empty($QSG_system)) { ?>
55 55
                     <p><span class="description" style="color:#D54E21;">
56 56
                             <?php esc_html_e('System question group! This field cannot be changed.', 'event_espresso') ?>
57 57
                     </span><br/></p>
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     foreach ($all_questions as $question_ID => $question) {
155 155
                         if ($question instanceof EE_Question) {
156 156
                             /*@var $question EE_Question*/
157
-                            $checked = isset($question_group_questions[ $question_ID ]) ? 'checked' : '';
157
+                            $checked = isset($question_group_questions[$question_ID]) ? 'checked' : '';
158 158
                             // disable questions from the personal information question group
159 159
                             // is it required in the current question group? if so don't allow admins to remove it
160 160
                             $disabled = in_array(
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                                     );
207 207
                                     $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
208 208
 
209
-                                    echo '<a href="' . $edit_link . '" target="_blank" aria-label="' .
209
+                                    echo '<a href="'.$edit_link.'" target="_blank" aria-label="'.
210 210
                                         sprintf(
211 211
                                             esc_attr__('Edit %s', 'event_espresso'),
212 212
                                             $question->admin_label()
Please login to merge, or discard this patch.
modules/ticket_selector/DisplayTicketSelector.php 1 patch
Indentation   +818 added lines, -818 removed lines patch added patch discarded remove patch
@@ -39,825 +39,825 @@
 block discarded – undo
39 39
  */
40 40
 class DisplayTicketSelector
41 41
 {
42
-    /**
43
-     * @var RequestInterface
44
-     */
45
-    protected $request;
46
-
47
-    /**
48
-     * @var EE_Ticket_Selector_Config
49
-     */
50
-    protected $config;
51
-
52
-    /**
53
-     * event that ticket selector is being generated for
54
-     *
55
-     * @access protected
56
-     * @var EE_Event $event
57
-     */
58
-    protected $event;
59
-
60
-    /**
61
-     * Used to flag when the ticket selector is being called from an external iframe.
62
-     *
63
-     * @var bool $iframe
64
-     */
65
-    protected $iframe = false;
66
-
67
-    /**
68
-     * max attendees that can register for event at one time
69
-     *
70
-     * @var int $max_attendees
71
-     */
72
-    private $max_attendees = EE_INF;
73
-
74
-    /**
75
-     * @var string $date_format
76
-     */
77
-    private $date_format;
78
-
79
-    /**
80
-     * @var string $time_format
81
-     */
82
-    private $time_format;
83
-
84
-    /**
85
-     * @var boolean $display_full_ui
86
-     */
87
-    private $display_full_ui;
88
-
89
-
90
-    /**
91
-     * DisplayTicketSelector constructor.
92
-     *
93
-     * @param RequestInterface          $request
94
-     * @param EE_Ticket_Selector_Config $config
95
-     * @param bool                      $iframe
96
-     */
97
-    public function __construct(RequestInterface $request, EE_Ticket_Selector_Config $config, $iframe = false)
98
-    {
99
-        $this->request     = $request;
100
-        $this->config      = $config;
101
-        $this->iframe      = $iframe;
102
-        $this->date_format = apply_filters(
103
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
104
-            get_option('date_format')
105
-        );
106
-        $this->time_format = apply_filters(
107
-            'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
108
-            get_option('time_format')
109
-        );
110
-    }
111
-
112
-
113
-    /**
114
-     * @return bool
115
-     */
116
-    public function isIframe()
117
-    {
118
-        return $this->iframe;
119
-    }
120
-
121
-
122
-    /**
123
-     * @param boolean $iframe
124
-     */
125
-    public function setIframe($iframe = true)
126
-    {
127
-        $this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
128
-    }
129
-
130
-
131
-    /**
132
-     * finds and sets the \EE_Event object for use throughout class
133
-     *
134
-     * @param mixed $event
135
-     * @return bool
136
-     * @throws EE_Error
137
-     * @throws InvalidDataTypeException
138
-     * @throws InvalidInterfaceException
139
-     * @throws InvalidArgumentException
140
-     */
141
-    protected function setEvent($event = null)
142
-    {
143
-        if ($event === null) {
144
-            global $post;
145
-            $event = $post;
146
-        }
147
-        if ($event instanceof EE_Event) {
148
-            $this->event = $event;
149
-        } elseif ($event instanceof WP_Post) {
150
-            if (isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
151
-                $this->event = $event->EE_Event;
152
-            } elseif ($event->post_type === 'espresso_events') {
153
-                $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
154
-                $this->event     = $event->EE_Event;
155
-            }
156
-        } else {
157
-            $user_msg = esc_html__('No Event object or an invalid Event object was supplied.', 'event_espresso');
158
-            $dev_msg  = $user_msg . esc_html__(
159
-                'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
160
-                'event_espresso'
161
-            );
162
-            EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
163
-            return false;
164
-        }
165
-        return true;
166
-    }
167
-
168
-
169
-    /**
170
-     * @return int
171
-     */
172
-    public function getMaxAttendees()
173
-    {
174
-        return $this->max_attendees;
175
-    }
176
-
177
-
178
-    /**
179
-     * @param int $max_attendees
180
-     */
181
-    public function setMaxAttendees($max_attendees)
182
-    {
183
-        $this->max_attendees = absint(
184
-            apply_filters(
185
-                'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
186
-                $max_attendees
187
-            )
188
-        );
189
-    }
190
-
191
-
192
-    /**
193
-     * Returns whether or not the full ticket selector should be shown or not.
194
-     * Currently, it displays on the frontend (including ajax requests) but not the backend
195
-     *
196
-     * @return bool
197
-     */
198
-    private function display_full_ui()
199
-    {
200
-        if ($this->display_full_ui === null) {
201
-            $this->display_full_ui = ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX);
202
-        }
203
-        return $this->display_full_ui;
204
-    }
205
-
206
-
207
-    /**
208
-     * creates buttons for selecting number of attendees for an event
209
-     *
210
-     * @param WP_Post|int $event
211
-     * @param bool        $view_details
212
-     * @return string
213
-     * @throws EE_Error
214
-     * @throws InvalidArgumentException
215
-     * @throws InvalidDataTypeException
216
-     * @throws InvalidInterfaceException
217
-     * @throws ReflectionException
218
-     * @throws Exception
219
-     */
220
-    public function display($event = null, $view_details = false)
221
-    {
222
-        // reset filter for displaying submit button
223
-        remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
224
-        // poke and prod incoming event till it tells us what it is
225
-        if (! $this->setEvent($event)) {
226
-            return $this->handleMissingEvent();
227
-        }
228
-        // is the event expired ?
229
-        $template_args['event_is_expired'] = ! is_admin() && $this->event->is_expired();
230
-        if ($template_args['event_is_expired']) {
231
-            return is_single()
232
-                ? $this->expiredEventMessage()
233
-                : $this->expiredEventMessage()
234
-                  . $this->displayViewDetailsButton();
235
-        }
236
-        // begin gathering template arguments by getting event status
237
-        $template_args = ['event_status' => $this->event->get_active_status()];
238
-        if (
239
-            $this->activeEventAndShowTicketSelector(
240
-                $event,
241
-                $template_args['event_status'],
242
-                $view_details
243
-            )
244
-        ) {
245
-            return ! is_single() ? $this->displayViewDetailsButton() : '';
246
-        }
247
-        // filter the maximum qty that can appear in the Ticket Selector qty dropdowns
248
-        $this->setMaxAttendees($this->event->additional_limit());
249
-        if ($this->getMaxAttendees() < 1) {
250
-            return $this->ticketSalesClosedMessage();
251
-        }
252
-        // get all tickets for this event ordered by the datetime
253
-        $tickets = $this->getTickets();
254
-        if (count($tickets) < 1) {
255
-            return $this->noTicketAvailableMessage();
256
-        }
257
-        // redirecting to another site for registration ??
258
-        $external_url = (string) $this->event->external_url()
259
-                        && $this->event->external_url() !== get_the_permalink()
260
-            ? $this->event->external_url()
261
-            : '';
262
-        // if redirecting to another site for registration, then we don't load the TS
263
-        $ticket_selector = $external_url
264
-            ? $this->externalEventRegistration()
265
-            : $this->loadTicketSelector($tickets, $template_args);
266
-        // now set up the form (but not for the admin)
267
-        $ticket_selector = $this->display_full_ui()
268
-            ? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
269
-            : $ticket_selector;
270
-        // submit button and form close tag
271
-        $ticket_selector .= $this->display_full_ui() ? $this->displaySubmitButton($external_url) : '';
272
-        return $ticket_selector;
273
-    }
274
-
275
-
276
-    /**
277
-     * displayTicketSelector
278
-     * examines the event properties and determines whether a Ticket Selector should be displayed
279
-     *
280
-     * @param WP_Post|int $event
281
-     * @param string      $_event_active_status
282
-     * @param bool        $view_details
283
-     * @return bool
284
-     * @throws EE_Error
285
-     * @throws ReflectionException
286
-     */
287
-    protected function activeEventAndShowTicketSelector($event, $_event_active_status, $view_details)
288
-    {
289
-        $event_post = $this->event instanceof EE_Event ? $this->event->ID() : $event;
290
-        return $this->display_full_ui()
291
-               && (
292
-                   ! $this->event->display_ticket_selector()
293
-                   || $view_details
294
-                   || post_password_required($event_post)
295
-                   || (
296
-                       $_event_active_status !== EE_Datetime::active
297
-                       && $_event_active_status !== EE_Datetime::upcoming
298
-                       && $_event_active_status !== EE_Datetime::sold_out
299
-                       && ! (
300
-                           $_event_active_status === EE_Datetime::inactive
301
-                           && is_user_logged_in()
302
-                       )
303
-                   )
304
-               );
305
-    }
306
-
307
-
308
-    /**
309
-     * noTicketAvailableMessage
310
-     * notice displayed if event is expired
311
-     *
312
-     * @return string
313
-     */
314
-    protected function expiredEventMessage()
315
-    {
316
-        return '<div class="ee-event-expired-notice"><span class="important-notice">' . esc_html__(
317
-            'We\'re sorry, but all tickets sales have ended because the event is expired.',
318
-            'event_espresso'
319
-        ) . '</span></div><!-- .ee-event-expired-notice -->';
320
-    }
321
-
322
-
323
-    /**
324
-     * noTicketAvailableMessage
325
-     * notice displayed if event has no more tickets available
326
-     *
327
-     * @return string
328
-     * @throws EE_Error
329
-     * @throws ReflectionException
330
-     */
331
-    protected function noTicketAvailableMessage()
332
-    {
333
-        $no_ticket_available_msg = esc_html__('We\'re sorry, but all ticket sales have ended.', 'event_espresso');
334
-        if (current_user_can('edit_post', $this->event->ID())) {
335
-            $no_ticket_available_msg .= sprintf(
336
-                esc_html__(
337
-                    '%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s',
338
-                    'event_espresso'
339
-                ),
340
-                '<div class="ee-attention" style="text-align: left;"><b>',
341
-                '</b><br />',
342
-                '<span class="edit-link"><a class="post-edit-link" href="'
343
-                . get_edit_post_link($this->event->ID())
344
-                . '">',
345
-                '</a></span></div><!-- .ee-attention noTicketAvailableMessage -->'
346
-            );
347
-        }
348
-        return '
42
+	/**
43
+	 * @var RequestInterface
44
+	 */
45
+	protected $request;
46
+
47
+	/**
48
+	 * @var EE_Ticket_Selector_Config
49
+	 */
50
+	protected $config;
51
+
52
+	/**
53
+	 * event that ticket selector is being generated for
54
+	 *
55
+	 * @access protected
56
+	 * @var EE_Event $event
57
+	 */
58
+	protected $event;
59
+
60
+	/**
61
+	 * Used to flag when the ticket selector is being called from an external iframe.
62
+	 *
63
+	 * @var bool $iframe
64
+	 */
65
+	protected $iframe = false;
66
+
67
+	/**
68
+	 * max attendees that can register for event at one time
69
+	 *
70
+	 * @var int $max_attendees
71
+	 */
72
+	private $max_attendees = EE_INF;
73
+
74
+	/**
75
+	 * @var string $date_format
76
+	 */
77
+	private $date_format;
78
+
79
+	/**
80
+	 * @var string $time_format
81
+	 */
82
+	private $time_format;
83
+
84
+	/**
85
+	 * @var boolean $display_full_ui
86
+	 */
87
+	private $display_full_ui;
88
+
89
+
90
+	/**
91
+	 * DisplayTicketSelector constructor.
92
+	 *
93
+	 * @param RequestInterface          $request
94
+	 * @param EE_Ticket_Selector_Config $config
95
+	 * @param bool                      $iframe
96
+	 */
97
+	public function __construct(RequestInterface $request, EE_Ticket_Selector_Config $config, $iframe = false)
98
+	{
99
+		$this->request     = $request;
100
+		$this->config      = $config;
101
+		$this->iframe      = $iframe;
102
+		$this->date_format = apply_filters(
103
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format',
104
+			get_option('date_format')
105
+		);
106
+		$this->time_format = apply_filters(
107
+			'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format',
108
+			get_option('time_format')
109
+		);
110
+	}
111
+
112
+
113
+	/**
114
+	 * @return bool
115
+	 */
116
+	public function isIframe()
117
+	{
118
+		return $this->iframe;
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param boolean $iframe
124
+	 */
125
+	public function setIframe($iframe = true)
126
+	{
127
+		$this->iframe = filter_var($iframe, FILTER_VALIDATE_BOOLEAN);
128
+	}
129
+
130
+
131
+	/**
132
+	 * finds and sets the \EE_Event object for use throughout class
133
+	 *
134
+	 * @param mixed $event
135
+	 * @return bool
136
+	 * @throws EE_Error
137
+	 * @throws InvalidDataTypeException
138
+	 * @throws InvalidInterfaceException
139
+	 * @throws InvalidArgumentException
140
+	 */
141
+	protected function setEvent($event = null)
142
+	{
143
+		if ($event === null) {
144
+			global $post;
145
+			$event = $post;
146
+		}
147
+		if ($event instanceof EE_Event) {
148
+			$this->event = $event;
149
+		} elseif ($event instanceof WP_Post) {
150
+			if (isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
151
+				$this->event = $event->EE_Event;
152
+			} elseif ($event->post_type === 'espresso_events') {
153
+				$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
154
+				$this->event     = $event->EE_Event;
155
+			}
156
+		} else {
157
+			$user_msg = esc_html__('No Event object or an invalid Event object was supplied.', 'event_espresso');
158
+			$dev_msg  = $user_msg . esc_html__(
159
+				'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.',
160
+				'event_espresso'
161
+			);
162
+			EE_Error::add_error($user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__);
163
+			return false;
164
+		}
165
+		return true;
166
+	}
167
+
168
+
169
+	/**
170
+	 * @return int
171
+	 */
172
+	public function getMaxAttendees()
173
+	{
174
+		return $this->max_attendees;
175
+	}
176
+
177
+
178
+	/**
179
+	 * @param int $max_attendees
180
+	 */
181
+	public function setMaxAttendees($max_attendees)
182
+	{
183
+		$this->max_attendees = absint(
184
+			apply_filters(
185
+				'FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets',
186
+				$max_attendees
187
+			)
188
+		);
189
+	}
190
+
191
+
192
+	/**
193
+	 * Returns whether or not the full ticket selector should be shown or not.
194
+	 * Currently, it displays on the frontend (including ajax requests) but not the backend
195
+	 *
196
+	 * @return bool
197
+	 */
198
+	private function display_full_ui()
199
+	{
200
+		if ($this->display_full_ui === null) {
201
+			$this->display_full_ui = ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX);
202
+		}
203
+		return $this->display_full_ui;
204
+	}
205
+
206
+
207
+	/**
208
+	 * creates buttons for selecting number of attendees for an event
209
+	 *
210
+	 * @param WP_Post|int $event
211
+	 * @param bool        $view_details
212
+	 * @return string
213
+	 * @throws EE_Error
214
+	 * @throws InvalidArgumentException
215
+	 * @throws InvalidDataTypeException
216
+	 * @throws InvalidInterfaceException
217
+	 * @throws ReflectionException
218
+	 * @throws Exception
219
+	 */
220
+	public function display($event = null, $view_details = false)
221
+	{
222
+		// reset filter for displaying submit button
223
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
224
+		// poke and prod incoming event till it tells us what it is
225
+		if (! $this->setEvent($event)) {
226
+			return $this->handleMissingEvent();
227
+		}
228
+		// is the event expired ?
229
+		$template_args['event_is_expired'] = ! is_admin() && $this->event->is_expired();
230
+		if ($template_args['event_is_expired']) {
231
+			return is_single()
232
+				? $this->expiredEventMessage()
233
+				: $this->expiredEventMessage()
234
+				  . $this->displayViewDetailsButton();
235
+		}
236
+		// begin gathering template arguments by getting event status
237
+		$template_args = ['event_status' => $this->event->get_active_status()];
238
+		if (
239
+			$this->activeEventAndShowTicketSelector(
240
+				$event,
241
+				$template_args['event_status'],
242
+				$view_details
243
+			)
244
+		) {
245
+			return ! is_single() ? $this->displayViewDetailsButton() : '';
246
+		}
247
+		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
248
+		$this->setMaxAttendees($this->event->additional_limit());
249
+		if ($this->getMaxAttendees() < 1) {
250
+			return $this->ticketSalesClosedMessage();
251
+		}
252
+		// get all tickets for this event ordered by the datetime
253
+		$tickets = $this->getTickets();
254
+		if (count($tickets) < 1) {
255
+			return $this->noTicketAvailableMessage();
256
+		}
257
+		// redirecting to another site for registration ??
258
+		$external_url = (string) $this->event->external_url()
259
+						&& $this->event->external_url() !== get_the_permalink()
260
+			? $this->event->external_url()
261
+			: '';
262
+		// if redirecting to another site for registration, then we don't load the TS
263
+		$ticket_selector = $external_url
264
+			? $this->externalEventRegistration()
265
+			: $this->loadTicketSelector($tickets, $template_args);
266
+		// now set up the form (but not for the admin)
267
+		$ticket_selector = $this->display_full_ui()
268
+			? $this->formOpen($this->event->ID(), $external_url) . $ticket_selector
269
+			: $ticket_selector;
270
+		// submit button and form close tag
271
+		$ticket_selector .= $this->display_full_ui() ? $this->displaySubmitButton($external_url) : '';
272
+		return $ticket_selector;
273
+	}
274
+
275
+
276
+	/**
277
+	 * displayTicketSelector
278
+	 * examines the event properties and determines whether a Ticket Selector should be displayed
279
+	 *
280
+	 * @param WP_Post|int $event
281
+	 * @param string      $_event_active_status
282
+	 * @param bool        $view_details
283
+	 * @return bool
284
+	 * @throws EE_Error
285
+	 * @throws ReflectionException
286
+	 */
287
+	protected function activeEventAndShowTicketSelector($event, $_event_active_status, $view_details)
288
+	{
289
+		$event_post = $this->event instanceof EE_Event ? $this->event->ID() : $event;
290
+		return $this->display_full_ui()
291
+			   && (
292
+				   ! $this->event->display_ticket_selector()
293
+				   || $view_details
294
+				   || post_password_required($event_post)
295
+				   || (
296
+					   $_event_active_status !== EE_Datetime::active
297
+					   && $_event_active_status !== EE_Datetime::upcoming
298
+					   && $_event_active_status !== EE_Datetime::sold_out
299
+					   && ! (
300
+						   $_event_active_status === EE_Datetime::inactive
301
+						   && is_user_logged_in()
302
+					   )
303
+				   )
304
+			   );
305
+	}
306
+
307
+
308
+	/**
309
+	 * noTicketAvailableMessage
310
+	 * notice displayed if event is expired
311
+	 *
312
+	 * @return string
313
+	 */
314
+	protected function expiredEventMessage()
315
+	{
316
+		return '<div class="ee-event-expired-notice"><span class="important-notice">' . esc_html__(
317
+			'We\'re sorry, but all tickets sales have ended because the event is expired.',
318
+			'event_espresso'
319
+		) . '</span></div><!-- .ee-event-expired-notice -->';
320
+	}
321
+
322
+
323
+	/**
324
+	 * noTicketAvailableMessage
325
+	 * notice displayed if event has no more tickets available
326
+	 *
327
+	 * @return string
328
+	 * @throws EE_Error
329
+	 * @throws ReflectionException
330
+	 */
331
+	protected function noTicketAvailableMessage()
332
+	{
333
+		$no_ticket_available_msg = esc_html__('We\'re sorry, but all ticket sales have ended.', 'event_espresso');
334
+		if (current_user_can('edit_post', $this->event->ID())) {
335
+			$no_ticket_available_msg .= sprintf(
336
+				esc_html__(
337
+					'%1$sNote to Event Admin:%2$sNo tickets were found for this event. This effectively turns off ticket sales. Please ensure that at least one ticket is available for if you want people to be able to register.%3$s(click to edit this event)%4$s',
338
+					'event_espresso'
339
+				),
340
+				'<div class="ee-attention" style="text-align: left;"><b>',
341
+				'</b><br />',
342
+				'<span class="edit-link"><a class="post-edit-link" href="'
343
+				. get_edit_post_link($this->event->ID())
344
+				. '">',
345
+				'</a></span></div><!-- .ee-attention noTicketAvailableMessage -->'
346
+			);
347
+		}
348
+		return '
349 349
             <div class="ee-event-expired-notice">
350 350
                 <span class="important-notice">' . $no_ticket_available_msg . '</span>
351 351
             </div><!-- .ee-event-expired-notice -->';
352
-    }
353
-
354
-
355
-    /**
356
-     * ticketSalesClosed
357
-     * notice displayed if event ticket sales are turned off
358
-     *
359
-     * @return string
360
-     * @throws EE_Error
361
-     * @throws ReflectionException
362
-     */
363
-    protected function ticketSalesClosedMessage()
364
-    {
365
-        $sales_closed_msg = esc_html__(
366
-            'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
367
-            'event_espresso'
368
-        );
369
-        if (current_user_can('edit_post', $this->event->ID())) {
370
-            $sales_closed_msg .= sprintf(
371
-                esc_html__(
372
-                    '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
373
-                    'event_espresso'
374
-                ),
375
-                '<div class="ee-attention" style="text-align: left;"><b>',
376
-                '</b><br />',
377
-                '<span class="edit-link"><a class="post-edit-link" href="'
378
-                . get_edit_post_link($this->event->ID())
379
-                . '">',
380
-                '</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
381
-            );
382
-        }
383
-        return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
384
-    }
385
-
386
-
387
-    /**
388
-     * getTickets
389
-     *
390
-     * @return EE_Base_Class[]|EE_Ticket[]
391
-     * @throws EE_Error
392
-     * @throws InvalidDataTypeException
393
-     * @throws InvalidInterfaceException
394
-     * @throws InvalidArgumentException
395
-     * @throws ReflectionException
396
-     */
397
-    protected function getTickets()
398
-    {
399
-        $show_expired_tickets = is_admin() || $this->config->show_expired_tickets;
400
-
401
-        $ticket_query_args = [
402
-            ['Datetime.EVT_ID' => $this->event->ID()],
403
-            'order_by' => [
404
-                'TKT_order'              => 'ASC',
405
-                'TKT_required'           => 'DESC',
406
-                'TKT_start_date'         => 'ASC',
407
-                'TKT_end_date'           => 'ASC',
408
-                'Datetime.DTT_EVT_start' => 'DESC',
409
-            ],
410
-        ];
411
-        if (! $show_expired_tickets) {
412
-            // use the correct applicable time query depending on what version of core is being run.
413
-            $current_time                         = method_exists('EEM_Datetime', 'current_time_for_query')
414
-                ? time()
415
-                : current_time('timestamp');
416
-            $ticket_query_args[0]['TKT_end_date'] = ['>', $current_time];
417
-        }
418
-        /** @var EE_Ticket[] $tickets */
419
-        $tickets = EEM_Ticket::instance()->get_all($ticket_query_args);
420
-
421
-        return (array) apply_filters(
422
-            'FHEE__EventEspresso_modules_ticketSelector_DisplayTicketSelector__getTickets',
423
-            $tickets,
424
-            $ticket_query_args,
425
-            $this
426
-        );
427
-    }
428
-
429
-
430
-    /**
431
-     * loadTicketSelector
432
-     * begins to assemble template arguments
433
-     * and decides whether to load a "simple" ticket selector, or the standard
434
-     *
435
-     * @param EE_Ticket[] $tickets
436
-     * @param array       $template_args
437
-     * @return TicketSelectorSimple|TicketSelectorStandard
438
-     * @throws EE_Error
439
-     * @throws ReflectionException
440
-     */
441
-    protected function loadTicketSelector(array $tickets, array $template_args)
442
-    {
443
-        $template_args['event']            = $this->event;
444
-        $template_args['EVT_ID']           = $this->event->ID();
445
-        $template_args['event_is_expired'] = $this->event->is_expired();
446
-        $template_args['max_atndz']        = $this->getMaxAttendees();
447
-        $template_args['date_format']      = $this->date_format;
448
-        $template_args['time_format']      = $this->time_format;
449
-        /**
450
-         * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected
451
-         *
452
-         * @param string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
453
-         * @param int $EVT_ID The Event ID
454
-         * @since 4.9.13
455
-         */
456
-        $template_args['anchor_id']    = apply_filters(
457
-            'FHEE__EE_Ticket_Selector__redirect_anchor_id',
458
-            '#tkt-slctr-tbl-' . $this->event->ID(),
459
-            $this->event->ID()
460
-        );
461
-        $template_args['tickets']      = $tickets;
462
-        $template_args['ticket_count'] = count($tickets);
463
-        $ticket_selector               = $this->simpleTicketSelector($tickets, $template_args);
464
-        if ($ticket_selector instanceof TicketSelectorSimple) {
465
-            return $ticket_selector;
466
-        }
467
-        return new TicketSelectorStandard(
468
-            $this->config,
469
-            $this->getTaxConfig(),
470
-            $this->event,
471
-            $tickets,
472
-            $this->getMaxAttendees(),
473
-            $template_args,
474
-            $this->date_format,
475
-            $this->time_format
476
-        );
477
-    }
478
-
479
-
480
-    /**
481
-     * simpleTicketSelector
482
-     * there's one ticket, and max attendees is set to one,
483
-     * so if the event is free, then this is a "simple" ticket selector
484
-     * a.k.a. "Dude Where's my Ticket Selector?"
485
-     *
486
-     * @param EE_Ticket[] $tickets
487
-     * @param array       $template_args
488
-     * @return string
489
-     * @throws EE_Error
490
-     * @throws ReflectionException
491
-     */
492
-    protected function simpleTicketSelector($tickets, array $template_args)
493
-    {
494
-        // if there is only ONE ticket with a max qty of ONE
495
-        if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) {
496
-            return '';
497
-        }
498
-        /** @var EE_Ticket $ticket */
499
-        $ticket = reset($tickets);
500
-        // if the ticket is free... then not much need for the ticket selector
501
-        if (
502
-            apply_filters(
503
-                'FHEE__ticket_selector_chart_template__hide_ticket_selector',
504
-                $ticket->is_free(),
505
-                $this->event->ID()
506
-            )
507
-        ) {
508
-            return new TicketSelectorSimple(
509
-                $this->event,
510
-                $ticket,
511
-                $this->getMaxAttendees(),
512
-                $template_args
513
-            );
514
-        }
515
-        return '';
516
-    }
517
-
518
-
519
-    /**
520
-     * externalEventRegistration
521
-     *
522
-     * @return string
523
-     */
524
-    public function externalEventRegistration()
525
-    {
526
-        // if not we still need to trigger the display of the submit button
527
-        add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
528
-        // display notice to admin that registration is external
529
-        return $this->display_full_ui()
530
-            ? esc_html__(
531
-                'Registration is at an external URL for this event.',
532
-                'event_espresso'
533
-            )
534
-            : '';
535
-    }
536
-
537
-
538
-    /**
539
-     * formOpen
540
-     *
541
-     * @param int    $ID
542
-     * @param string $external_url
543
-     * @return        string
544
-     */
545
-    public function formOpen($ID = 0, $external_url = '')
546
-    {
547
-        // if redirecting, we don't need any anything else
548
-        if ($external_url) {
549
-            $html = '<form method="GET" ';
550
-            $html .= 'action="' . EEH_URL::refactor_url($external_url) . '" ';
551
-            $html .= 'name="ticket-selector-form-' . $ID . '"';
552
-            // open link in new window ?
553
-            $html       .= apply_filters(
554
-                'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
555
-                $this->isIframe(),
556
-                $this
557
-            )
558
-                ? ' target="_blank"'
559
-                : '';
560
-            $html       .= '>';
561
-            $query_args = EEH_URL::get_query_string($external_url);
562
-            foreach ((array) $query_args as $query_arg => $value) {
563
-                $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
564
-            }
565
-            return $html;
566
-        }
567
-        // if there is no submit button, then don't start building a form
568
-        // because the "View Details" button will build its own form
569
-        if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
570
-            return '';
571
-        }
572
-        $checkout_url = EEH_Event_View::event_link_url($ID);
573
-        if (! $checkout_url) {
574
-            EE_Error::add_error(
575
-                esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
576
-                __FILE__,
577
-                __FUNCTION__,
578
-                __LINE__
579
-            );
580
-        }
581
-        // set no cache headers and constants
582
-        EE_System::do_not_cache();
583
-        $html = '<form method="POST" ';
584
-        $html .= 'action="' . $checkout_url . '" ';
585
-        $html .= 'name="ticket-selector-form-' . $ID . '"';
586
-        $html .= $this->iframe ? ' target="_blank"' : '';
587
-        $html .= '>';
588
-        $html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
589
-        return apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
590
-    }
591
-
592
-
593
-    /**
594
-     * displaySubmitButton
595
-     *
596
-     * @param string $external_url
597
-     * @return string
598
-     * @throws EE_Error
599
-     * @throws ReflectionException
600
-     */
601
-    public function displaySubmitButton($external_url = '')
602
-    {
603
-        $html = '';
604
-        if ($this->display_full_ui()) {
605
-            // standard TS displayed with submit button, ie: "Register Now"
606
-            if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
607
-                $html .= $this->displayRegisterNowButton();
608
-                $html .= empty($external_url)
609
-                    ? $this->ticketSelectorEndDiv()
610
-                    : $this->clearTicketSelector();
611
-                $html .= '<br/>' . $this->formClose();
612
-            } elseif ($this->getMaxAttendees() === 1) {
613
-                // its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
614
-                if ($this->event->is_sold_out()) {
615
-                    // then instead of a View Details or Submit button, just display a "Sold Out" message
616
-                    $html .= apply_filters(
617
-                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg',
618
-                        sprintf(
619
-                            esc_html__(
620
-                                '%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s',
621
-                                'event_espresso'
622
-                            ),
623
-                            '<p class="no-ticket-selector-msg clear-float">',
624
-                            $this->event->name(),
625
-                            '</p>',
626
-                            '<br />'
627
-                        ),
628
-                        $this->event
629
-                    );
630
-                    if (
631
-                        apply_filters(
632
-                            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
633
-                            false,
634
-                            $this->event
635
-                        )
636
-                    ) {
637
-                        $html .= $this->displayRegisterNowButton();
638
-                    }
639
-                    // sold out DWMTS event, no TS, no submit or view details button, but has additional content
640
-                    $html .= $this->ticketSelectorEndDiv();
641
-                } elseif (
642
-                    apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
643
-                          && ! is_single()
644
-                ) {
645
-                    // this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
646
-                    // but no tickets are available, so display event's "View Details" button.
647
-                    // it is being viewed via somewhere other than a single post
648
-                    $html .= $this->displayViewDetailsButton(true);
649
-                } else {
650
-                    $html .= $this->ticketSelectorEndDiv();
651
-                }
652
-            } elseif (is_archive()) {
653
-                // event list, no tickets available so display event's "View Details" button
654
-                $html .= $this->ticketSelectorEndDiv();
655
-                $html .= $this->displayViewDetailsButton();
656
-            } else {
657
-                if (
658
-                    apply_filters(
659
-                        'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
660
-                        false,
661
-                        $this->event
662
-                    )
663
-                ) {
664
-                    $html .= $this->displayRegisterNowButton();
665
-                }
666
-                // no submit or view details button, and no additional content
667
-                $html .= $this->ticketSelectorEndDiv();
668
-            }
669
-            if (! $this->iframe && ! is_archive()) {
670
-                $html .= EEH_Template::powered_by_event_espresso('', '', ['utm_content' => 'ticket_selector']);
671
-            }
672
-        }
673
-        return apply_filters(
674
-            'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displaySubmitButton__html',
675
-            $html,
676
-            $this->event,
677
-            $this
678
-        );
679
-    }
680
-
681
-
682
-    /**
683
-     * @return string
684
-     * @throws EE_Error
685
-     * @throws ReflectionException
686
-     */
687
-    public function displayRegisterNowButton()
688
-    {
689
-        $btn_text     = apply_filters(
690
-            'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
691
-            esc_html__('Register Now', 'event_espresso'),
692
-            $this->event
693
-        );
694
-        $external_url = (string) $this->event->external_url()
695
-                        && $this->event->external_url() !== get_the_permalink()
696
-            ? $this->event->external_url()
697
-            : '';
698
-        $html         = EEH_HTML::div(
699
-            '',
700
-            'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap',
701
-            'ticket-selector-submit-btn-wrap'
702
-        );
703
-        $html         .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
704
-        $html         .= ' class="ticket-selector-submit-btn ';
705
-        $html         .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
706
-        $html         .= ' type="submit" value="' . $btn_text . '" data-ee-disable-after-recaptcha="true" />';
707
-        $html         .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
708
-        $html         .= apply_filters(
709
-            'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
710
-            '',
711
-            $this->event,
712
-            $this->iframe
713
-        );
714
-        return $html;
715
-    }
716
-
717
-
718
-    /**
719
-     * displayViewDetailsButton
720
-     *
721
-     * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event
722
-     *                    (ie: $_max_atndz === 1) where there are no available tickets,
723
-     *                    either because they are sold out, expired, or not yet on sale.
724
-     *                    In this case, we need to close the form BEFORE adding any closing divs
725
-     * @return string
726
-     * @throws EE_Error
727
-     * @throws ReflectionException
728
-     */
729
-    public function displayViewDetailsButton($DWMTS = false)
730
-    {
731
-        if (! $this->event->get_permalink()) {
732
-            EE_Error::add_error(
733
-                esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
734
-                __FILE__,
735
-                __FUNCTION__,
736
-                __LINE__
737
-            );
738
-        }
739
-        $view_details_btn = '<form method="GET" action="';
740
-        $view_details_btn .= apply_filters(
741
-            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url',
742
-            $this->event->get_permalink(),
743
-            $this->event
744
-        );
745
-        $view_details_btn .= '"';
746
-        // open link in new window ?
747
-        $view_details_btn .= apply_filters(
748
-            'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank',
749
-            $this->isIframe(),
750
-            $this
751
-        )
752
-            ? ' target="_blank"'
753
-            : '';
754
-        $view_details_btn .= '>';
755
-        $btn_text         = apply_filters(
756
-            'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
757
-            esc_html__('View Details', 'event_espresso'),
758
-            $this->event
759
-        );
760
-        $view_details_btn .= '<input id="ticket-selector-submit-'
761
-                             . $this->event->ID()
762
-                             . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
763
-                             . $btn_text
764
-                             . '" />';
765
-        $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
766
-        if ($DWMTS) {
767
-            $view_details_btn .= $this->formClose();
768
-            $view_details_btn .= $this->ticketSelectorEndDiv();
769
-            $view_details_btn .= '<br/>';
770
-        } else {
771
-            $view_details_btn .= $this->clearTicketSelector();
772
-            $view_details_btn .= '<br/>';
773
-            $view_details_btn .= $this->formClose();
774
-        }
775
-        return $view_details_btn;
776
-    }
777
-
778
-
779
-    /**
780
-     * @return string
781
-     */
782
-    public function ticketSelectorEndDiv()
783
-    {
784
-        return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
785
-    }
786
-
787
-
788
-    /**
789
-     * @return string
790
-     */
791
-    public function clearTicketSelector()
792
-    {
793
-        // standard TS displayed, appears after a "Register Now" or "view Details" button
794
-        return '<div class="clear"></div><!-- clearTicketSelector -->';
795
-    }
796
-
797
-
798
-    /**
799
-     * @access        public
800
-     * @return        string
801
-     */
802
-    public function formClose()
803
-    {
804
-        return '</form>';
805
-    }
806
-
807
-
808
-    /**
809
-     * handleMissingEvent
810
-     * Returns either false or an error to display when no valid event is passed.
811
-     *
812
-     * @return string
813
-     * @throws ExceptionStackTraceDisplay
814
-     * @throws InvalidInterfaceException
815
-     * @throws Exception
816
-     */
817
-    protected function handleMissingEvent()
818
-    {
819
-        // If this is not an iFrame request, simply return false.
820
-        if (! $this->isIframe()) {
821
-            return '';
822
-        }
823
-        // This is an iFrame so return an error.
824
-        // Display stack trace if WP_DEBUG is enabled.
825
-        if (WP_DEBUG === true && current_user_can('edit_pages')) {
826
-            $event_id = $this->request->getRequestParam('event', 0, 'int');
827
-            new ExceptionStackTraceDisplay(
828
-                new InvalidArgumentException(
829
-                    sprintf(
830
-                        esc_html__(
831
-                            'A valid Event ID is required to display the ticket selector.%3$sAn Event with an ID of "%1$s" could not be found.%3$sPlease verify that the embed code added to this post\'s content includes an "%2$s" argument and that its value corresponds to a valid Event ID.',
832
-                            'event_espresso'
833
-                        ),
834
-                        $event_id,
835
-                        'event',
836
-                        '<br />'
837
-                    )
838
-                )
839
-            );
840
-            return '';
841
-        }
842
-        // If WP_DEBUG is not enabled, display a message stating the event could not be found.
843
-        return EEH_HTML::p(
844
-            esc_html__(
845
-                'A valid Event could not be found. Please contact the event administrator for assistance.',
846
-                'event_espresso'
847
-            )
848
-        );
849
-    }
850
-
851
-
852
-    /**
853
-     * @return EE_Tax_Config
854
-     * @since   4.10.14.p
855
-     */
856
-    protected function getTaxConfig()
857
-    {
858
-        return isset(EE_Registry::instance()->CFG->tax_settings)
859
-               && EE_Registry::instance()->CFG->tax_settings instanceof EE_Tax_Config
860
-            ? EE_Registry::instance()->CFG->tax_settings
861
-            : new EE_Tax_Config();
862
-    }
352
+	}
353
+
354
+
355
+	/**
356
+	 * ticketSalesClosed
357
+	 * notice displayed if event ticket sales are turned off
358
+	 *
359
+	 * @return string
360
+	 * @throws EE_Error
361
+	 * @throws ReflectionException
362
+	 */
363
+	protected function ticketSalesClosedMessage()
364
+	{
365
+		$sales_closed_msg = esc_html__(
366
+			'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.',
367
+			'event_espresso'
368
+		);
369
+		if (current_user_can('edit_post', $this->event->ID())) {
370
+			$sales_closed_msg .= sprintf(
371
+				esc_html__(
372
+					'%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s',
373
+					'event_espresso'
374
+				),
375
+				'<div class="ee-attention" style="text-align: left;"><b>',
376
+				'</b><br />',
377
+				'<span class="edit-link"><a class="post-edit-link" href="'
378
+				. get_edit_post_link($this->event->ID())
379
+				. '">',
380
+				'</a></span></div><!-- .ee-attention ticketSalesClosedMessage -->'
381
+			);
382
+		}
383
+		return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
384
+	}
385
+
386
+
387
+	/**
388
+	 * getTickets
389
+	 *
390
+	 * @return EE_Base_Class[]|EE_Ticket[]
391
+	 * @throws EE_Error
392
+	 * @throws InvalidDataTypeException
393
+	 * @throws InvalidInterfaceException
394
+	 * @throws InvalidArgumentException
395
+	 * @throws ReflectionException
396
+	 */
397
+	protected function getTickets()
398
+	{
399
+		$show_expired_tickets = is_admin() || $this->config->show_expired_tickets;
400
+
401
+		$ticket_query_args = [
402
+			['Datetime.EVT_ID' => $this->event->ID()],
403
+			'order_by' => [
404
+				'TKT_order'              => 'ASC',
405
+				'TKT_required'           => 'DESC',
406
+				'TKT_start_date'         => 'ASC',
407
+				'TKT_end_date'           => 'ASC',
408
+				'Datetime.DTT_EVT_start' => 'DESC',
409
+			],
410
+		];
411
+		if (! $show_expired_tickets) {
412
+			// use the correct applicable time query depending on what version of core is being run.
413
+			$current_time                         = method_exists('EEM_Datetime', 'current_time_for_query')
414
+				? time()
415
+				: current_time('timestamp');
416
+			$ticket_query_args[0]['TKT_end_date'] = ['>', $current_time];
417
+		}
418
+		/** @var EE_Ticket[] $tickets */
419
+		$tickets = EEM_Ticket::instance()->get_all($ticket_query_args);
420
+
421
+		return (array) apply_filters(
422
+			'FHEE__EventEspresso_modules_ticketSelector_DisplayTicketSelector__getTickets',
423
+			$tickets,
424
+			$ticket_query_args,
425
+			$this
426
+		);
427
+	}
428
+
429
+
430
+	/**
431
+	 * loadTicketSelector
432
+	 * begins to assemble template arguments
433
+	 * and decides whether to load a "simple" ticket selector, or the standard
434
+	 *
435
+	 * @param EE_Ticket[] $tickets
436
+	 * @param array       $template_args
437
+	 * @return TicketSelectorSimple|TicketSelectorStandard
438
+	 * @throws EE_Error
439
+	 * @throws ReflectionException
440
+	 */
441
+	protected function loadTicketSelector(array $tickets, array $template_args)
442
+	{
443
+		$template_args['event']            = $this->event;
444
+		$template_args['EVT_ID']           = $this->event->ID();
445
+		$template_args['event_is_expired'] = $this->event->is_expired();
446
+		$template_args['max_atndz']        = $this->getMaxAttendees();
447
+		$template_args['date_format']      = $this->date_format;
448
+		$template_args['time_format']      = $this->time_format;
449
+		/**
450
+		 * Filters the anchor ID used when redirecting to the Ticket Selector if no quantity selected
451
+		 *
452
+		 * @param string  '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to
453
+		 * @param int $EVT_ID The Event ID
454
+		 * @since 4.9.13
455
+		 */
456
+		$template_args['anchor_id']    = apply_filters(
457
+			'FHEE__EE_Ticket_Selector__redirect_anchor_id',
458
+			'#tkt-slctr-tbl-' . $this->event->ID(),
459
+			$this->event->ID()
460
+		);
461
+		$template_args['tickets']      = $tickets;
462
+		$template_args['ticket_count'] = count($tickets);
463
+		$ticket_selector               = $this->simpleTicketSelector($tickets, $template_args);
464
+		if ($ticket_selector instanceof TicketSelectorSimple) {
465
+			return $ticket_selector;
466
+		}
467
+		return new TicketSelectorStandard(
468
+			$this->config,
469
+			$this->getTaxConfig(),
470
+			$this->event,
471
+			$tickets,
472
+			$this->getMaxAttendees(),
473
+			$template_args,
474
+			$this->date_format,
475
+			$this->time_format
476
+		);
477
+	}
478
+
479
+
480
+	/**
481
+	 * simpleTicketSelector
482
+	 * there's one ticket, and max attendees is set to one,
483
+	 * so if the event is free, then this is a "simple" ticket selector
484
+	 * a.k.a. "Dude Where's my Ticket Selector?"
485
+	 *
486
+	 * @param EE_Ticket[] $tickets
487
+	 * @param array       $template_args
488
+	 * @return string
489
+	 * @throws EE_Error
490
+	 * @throws ReflectionException
491
+	 */
492
+	protected function simpleTicketSelector($tickets, array $template_args)
493
+	{
494
+		// if there is only ONE ticket with a max qty of ONE
495
+		if (count($tickets) > 1 || $this->getMaxAttendees() !== 1) {
496
+			return '';
497
+		}
498
+		/** @var EE_Ticket $ticket */
499
+		$ticket = reset($tickets);
500
+		// if the ticket is free... then not much need for the ticket selector
501
+		if (
502
+			apply_filters(
503
+				'FHEE__ticket_selector_chart_template__hide_ticket_selector',
504
+				$ticket->is_free(),
505
+				$this->event->ID()
506
+			)
507
+		) {
508
+			return new TicketSelectorSimple(
509
+				$this->event,
510
+				$ticket,
511
+				$this->getMaxAttendees(),
512
+				$template_args
513
+			);
514
+		}
515
+		return '';
516
+	}
517
+
518
+
519
+	/**
520
+	 * externalEventRegistration
521
+	 *
522
+	 * @return string
523
+	 */
524
+	public function externalEventRegistration()
525
+	{
526
+		// if not we still need to trigger the display of the submit button
527
+		add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
528
+		// display notice to admin that registration is external
529
+		return $this->display_full_ui()
530
+			? esc_html__(
531
+				'Registration is at an external URL for this event.',
532
+				'event_espresso'
533
+			)
534
+			: '';
535
+	}
536
+
537
+
538
+	/**
539
+	 * formOpen
540
+	 *
541
+	 * @param int    $ID
542
+	 * @param string $external_url
543
+	 * @return        string
544
+	 */
545
+	public function formOpen($ID = 0, $external_url = '')
546
+	{
547
+		// if redirecting, we don't need any anything else
548
+		if ($external_url) {
549
+			$html = '<form method="GET" ';
550
+			$html .= 'action="' . EEH_URL::refactor_url($external_url) . '" ';
551
+			$html .= 'name="ticket-selector-form-' . $ID . '"';
552
+			// open link in new window ?
553
+			$html       .= apply_filters(
554
+				'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__formOpen__external_url_target_blank',
555
+				$this->isIframe(),
556
+				$this
557
+			)
558
+				? ' target="_blank"'
559
+				: '';
560
+			$html       .= '>';
561
+			$query_args = EEH_URL::get_query_string($external_url);
562
+			foreach ((array) $query_args as $query_arg => $value) {
563
+				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
564
+			}
565
+			return $html;
566
+		}
567
+		// if there is no submit button, then don't start building a form
568
+		// because the "View Details" button will build its own form
569
+		if (! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
570
+			return '';
571
+		}
572
+		$checkout_url = EEH_Event_View::event_link_url($ID);
573
+		if (! $checkout_url) {
574
+			EE_Error::add_error(
575
+				esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
576
+				__FILE__,
577
+				__FUNCTION__,
578
+				__LINE__
579
+			);
580
+		}
581
+		// set no cache headers and constants
582
+		EE_System::do_not_cache();
583
+		$html = '<form method="POST" ';
584
+		$html .= 'action="' . $checkout_url . '" ';
585
+		$html .= 'name="ticket-selector-form-' . $ID . '"';
586
+		$html .= $this->iframe ? ' target="_blank"' : '';
587
+		$html .= '>';
588
+		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
589
+		return apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, $this->event);
590
+	}
591
+
592
+
593
+	/**
594
+	 * displaySubmitButton
595
+	 *
596
+	 * @param string $external_url
597
+	 * @return string
598
+	 * @throws EE_Error
599
+	 * @throws ReflectionException
600
+	 */
601
+	public function displaySubmitButton($external_url = '')
602
+	{
603
+		$html = '';
604
+		if ($this->display_full_ui()) {
605
+			// standard TS displayed with submit button, ie: "Register Now"
606
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) {
607
+				$html .= $this->displayRegisterNowButton();
608
+				$html .= empty($external_url)
609
+					? $this->ticketSelectorEndDiv()
610
+					: $this->clearTicketSelector();
611
+				$html .= '<br/>' . $this->formClose();
612
+			} elseif ($this->getMaxAttendees() === 1) {
613
+				// its a "Dude Where's my Ticket Selector?" (DWMTS) type event (ie: $_max_atndz === 1)
614
+				if ($this->event->is_sold_out()) {
615
+					// then instead of a View Details or Submit button, just display a "Sold Out" message
616
+					$html .= apply_filters(
617
+						'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__sold_out_msg',
618
+						sprintf(
619
+							esc_html__(
620
+								'%1$s"%2$s" is currently sold out.%4$sPlease check back again later, as spots may become available.%3$s',
621
+								'event_espresso'
622
+							),
623
+							'<p class="no-ticket-selector-msg clear-float">',
624
+							$this->event->name(),
625
+							'</p>',
626
+							'<br />'
627
+						),
628
+						$this->event
629
+					);
630
+					if (
631
+						apply_filters(
632
+							'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
633
+							false,
634
+							$this->event
635
+						)
636
+					) {
637
+						$html .= $this->displayRegisterNowButton();
638
+					}
639
+					// sold out DWMTS event, no TS, no submit or view details button, but has additional content
640
+					$html .= $this->ticketSelectorEndDiv();
641
+				} elseif (
642
+					apply_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector', false)
643
+						  && ! is_single()
644
+				) {
645
+					// this is a "Dude Where's my Ticket Selector?" (DWMTS) type event,
646
+					// but no tickets are available, so display event's "View Details" button.
647
+					// it is being viewed via somewhere other than a single post
648
+					$html .= $this->displayViewDetailsButton(true);
649
+				} else {
650
+					$html .= $this->ticketSelectorEndDiv();
651
+				}
652
+			} elseif (is_archive()) {
653
+				// event list, no tickets available so display event's "View Details" button
654
+				$html .= $this->ticketSelectorEndDiv();
655
+				$html .= $this->displayViewDetailsButton();
656
+			} else {
657
+				if (
658
+					apply_filters(
659
+						'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__no_tickets_but_display_register_now_button',
660
+						false,
661
+						$this->event
662
+					)
663
+				) {
664
+					$html .= $this->displayRegisterNowButton();
665
+				}
666
+				// no submit or view details button, and no additional content
667
+				$html .= $this->ticketSelectorEndDiv();
668
+			}
669
+			if (! $this->iframe && ! is_archive()) {
670
+				$html .= EEH_Template::powered_by_event_espresso('', '', ['utm_content' => 'ticket_selector']);
671
+			}
672
+		}
673
+		return apply_filters(
674
+			'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displaySubmitButton__html',
675
+			$html,
676
+			$this->event,
677
+			$this
678
+		);
679
+	}
680
+
681
+
682
+	/**
683
+	 * @return string
684
+	 * @throws EE_Error
685
+	 * @throws ReflectionException
686
+	 */
687
+	public function displayRegisterNowButton()
688
+	{
689
+		$btn_text     = apply_filters(
690
+			'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
691
+			esc_html__('Register Now', 'event_espresso'),
692
+			$this->event
693
+		);
694
+		$external_url = (string) $this->event->external_url()
695
+						&& $this->event->external_url() !== get_the_permalink()
696
+			? $this->event->external_url()
697
+			: '';
698
+		$html         = EEH_HTML::div(
699
+			'',
700
+			'ticket-selector-submit-' . $this->event->ID() . '-btn-wrap',
701
+			'ticket-selector-submit-btn-wrap'
702
+		);
703
+		$html         .= '<input id="ticket-selector-submit-' . $this->event->ID() . '-btn"';
704
+		$html         .= ' class="ticket-selector-submit-btn ';
705
+		$html         .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
706
+		$html         .= ' type="submit" value="' . $btn_text . '" data-ee-disable-after-recaptcha="true" />';
707
+		$html         .= EEH_HTML::divx() . '<!-- .ticket-selector-submit-btn-wrap -->';
708
+		$html         .= apply_filters(
709
+			'FHEE__EE_Ticket_Selector__after_ticket_selector_submit',
710
+			'',
711
+			$this->event,
712
+			$this->iframe
713
+		);
714
+		return $html;
715
+	}
716
+
717
+
718
+	/**
719
+	 * displayViewDetailsButton
720
+	 *
721
+	 * @param bool $DWMTS indicates a "Dude Where's my Ticket Selector?" (DWMTS) type event
722
+	 *                    (ie: $_max_atndz === 1) where there are no available tickets,
723
+	 *                    either because they are sold out, expired, or not yet on sale.
724
+	 *                    In this case, we need to close the form BEFORE adding any closing divs
725
+	 * @return string
726
+	 * @throws EE_Error
727
+	 * @throws ReflectionException
728
+	 */
729
+	public function displayViewDetailsButton($DWMTS = false)
730
+	{
731
+		if (! $this->event->get_permalink()) {
732
+			EE_Error::add_error(
733
+				esc_html__('The URL for the Event Details page could not be retrieved.', 'event_espresso'),
734
+				__FILE__,
735
+				__FUNCTION__,
736
+				__LINE__
737
+			);
738
+		}
739
+		$view_details_btn = '<form method="GET" action="';
740
+		$view_details_btn .= apply_filters(
741
+			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_url',
742
+			$this->event->get_permalink(),
743
+			$this->event
744
+		);
745
+		$view_details_btn .= '"';
746
+		// open link in new window ?
747
+		$view_details_btn .= apply_filters(
748
+			'FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank',
749
+			$this->isIframe(),
750
+			$this
751
+		)
752
+			? ' target="_blank"'
753
+			: '';
754
+		$view_details_btn .= '>';
755
+		$btn_text         = apply_filters(
756
+			'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
757
+			esc_html__('View Details', 'event_espresso'),
758
+			$this->event
759
+		);
760
+		$view_details_btn .= '<input id="ticket-selector-submit-'
761
+							 . $this->event->ID()
762
+							 . '-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'
763
+							 . $btn_text
764
+							 . '" />';
765
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', $this->event);
766
+		if ($DWMTS) {
767
+			$view_details_btn .= $this->formClose();
768
+			$view_details_btn .= $this->ticketSelectorEndDiv();
769
+			$view_details_btn .= '<br/>';
770
+		} else {
771
+			$view_details_btn .= $this->clearTicketSelector();
772
+			$view_details_btn .= '<br/>';
773
+			$view_details_btn .= $this->formClose();
774
+		}
775
+		return $view_details_btn;
776
+	}
777
+
778
+
779
+	/**
780
+	 * @return string
781
+	 */
782
+	public function ticketSelectorEndDiv()
783
+	{
784
+		return $this->clearTicketSelector() . '</div><!-- ticketSelectorEndDiv -->';
785
+	}
786
+
787
+
788
+	/**
789
+	 * @return string
790
+	 */
791
+	public function clearTicketSelector()
792
+	{
793
+		// standard TS displayed, appears after a "Register Now" or "view Details" button
794
+		return '<div class="clear"></div><!-- clearTicketSelector -->';
795
+	}
796
+
797
+
798
+	/**
799
+	 * @access        public
800
+	 * @return        string
801
+	 */
802
+	public function formClose()
803
+	{
804
+		return '</form>';
805
+	}
806
+
807
+
808
+	/**
809
+	 * handleMissingEvent
810
+	 * Returns either false or an error to display when no valid event is passed.
811
+	 *
812
+	 * @return string
813
+	 * @throws ExceptionStackTraceDisplay
814
+	 * @throws InvalidInterfaceException
815
+	 * @throws Exception
816
+	 */
817
+	protected function handleMissingEvent()
818
+	{
819
+		// If this is not an iFrame request, simply return false.
820
+		if (! $this->isIframe()) {
821
+			return '';
822
+		}
823
+		// This is an iFrame so return an error.
824
+		// Display stack trace if WP_DEBUG is enabled.
825
+		if (WP_DEBUG === true && current_user_can('edit_pages')) {
826
+			$event_id = $this->request->getRequestParam('event', 0, 'int');
827
+			new ExceptionStackTraceDisplay(
828
+				new InvalidArgumentException(
829
+					sprintf(
830
+						esc_html__(
831
+							'A valid Event ID is required to display the ticket selector.%3$sAn Event with an ID of "%1$s" could not be found.%3$sPlease verify that the embed code added to this post\'s content includes an "%2$s" argument and that its value corresponds to a valid Event ID.',
832
+							'event_espresso'
833
+						),
834
+						$event_id,
835
+						'event',
836
+						'<br />'
837
+					)
838
+				)
839
+			);
840
+			return '';
841
+		}
842
+		// If WP_DEBUG is not enabled, display a message stating the event could not be found.
843
+		return EEH_HTML::p(
844
+			esc_html__(
845
+				'A valid Event could not be found. Please contact the event administrator for assistance.',
846
+				'event_espresso'
847
+			)
848
+		);
849
+	}
850
+
851
+
852
+	/**
853
+	 * @return EE_Tax_Config
854
+	 * @since   4.10.14.p
855
+	 */
856
+	protected function getTaxConfig()
857
+	{
858
+		return isset(EE_Registry::instance()->CFG->tax_settings)
859
+			   && EE_Registry::instance()->CFG->tax_settings instanceof EE_Tax_Config
860
+			? EE_Registry::instance()->CFG->tax_settings
861
+			: new EE_Tax_Config();
862
+	}
863 863
 }
Please login to merge, or discard this patch.
templates/txn_admin_details_main_meta_box_txn_details.template.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
                     <?php if ($payments) :
128 128
                         $payment_total = 0;
129 129
                         foreach ($payments as $PAY_ID => $payment) :
130
-                            if (! $payment instanceof EE_Payment) {
130
+                            if ( ! $payment instanceof EE_Payment) {
131 131
                                 continue;
132 132
                             }
133 133
                             $PAY_ID = absint($PAY_ID);
134
-                            $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
135
-                                ? wp_json_encode($existing_reg_payments[ $PAY_ID ])
134
+                            $existing_reg_payment_json = isset($existing_reg_payments[$PAY_ID])
135
+                                ? wp_json_encode($existing_reg_payments[$PAY_ID])
136 136
                                 : '{}';
137 137
                     ?>
138 138
                     <tr id="txn-admin-payment-tr-<?php echo absint($PAY_ID); ?>">
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                         <td class=" jst-rght">
220 220
                             <?php
221 221
                             $payment_class = $payment->amount() > 0
222
-                                ? 'txn-admin-payment-status-' . $payment->STS_ID()
222
+                                ? 'txn-admin-payment-status-'.$payment->STS_ID()
223 223
                                 : 'txn-admin-payment-status-PDC';
224 224
                             ?>
225 225
                             <span class="<?php echo esc_attr($payment_class); ?>">
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
                                 $overpaid
264 264
                                 . sprintf(
265 265
                                     __('Payments Total %s', 'event_espresso'),
266
-                                    '(' . EE_Registry::instance()->CFG->currency->code . ')'
266
+                                    '('.EE_Registry::instance()->CFG->currency->code.')'
267 267
                                 ),
268 268
                                 AllowedTags::getAllowedTags()
269 269
                             ); ?></span>
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
             >
401 401
                 <div class="ee-icon ee-icon-cash-add float-left"></div>
402 402
                 <?php
403
-                echo esc_html__('Apply a Payment to Transaction #', 'event_espresso') . esc_html($txn_nmbr['value']); ?>
403
+                echo esc_html__('Apply a Payment to Transaction #', 'event_espresso').esc_html($txn_nmbr['value']); ?>
404 404
             </h2>
405 405
 
406 406
             <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon"
@@ -911,7 +911,7 @@  discard block
 block discarded – undo
911 911
 
912 912
     <?php if (WP_DEBUG) {
913 913
         $delivered_messages = get_option('EED_Messages__payment', []);
914
-        if (isset($delivered_messages[ $TXN_ID ])) { ?>
914
+        if (isset($delivered_messages[$TXN_ID])) { ?>
915 915
             <h4 class="admin-primary-mbox-h4 hdr-has-icon">
916 916
                 <span class="dashicons dashicons-email-alt"></span>
917 917
                 <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?>
@@ -931,13 +931,13 @@  discard block
 block discarded – undo
931 931
                     </thead>
932 932
                     <tbody>
933 933
                         <?php
934
-                        foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
934
+                        foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) :
935 935
                             ?>
936 936
                             <tr>
937 937
                                 <td class="jst-left">
938 938
                                     <?php echo esc_html(
939 939
                                         date(
940
-                                            get_option('date_format') . ' ' . get_option('time_format'),
940
+                                            get_option('date_format').' '.get_option('time_format'),
941 941
                                             ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
942 942
                                         )
943 943
                                     ); ?>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -280,11 +280,13 @@  discard block
 block discarded – undo
280 280
                             ); ?></span>
281 281
                         </th>
282 282
                     </tr>
283
-                    <?php else : ?>
283
+                    <?php else {
284
+	: ?>
284 285
                     <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr">
285 286
                         <td class=" jst-rght" colspan="10">
286 287
                             <span class="important-notice"><?php
287 288
                                 echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
289
+}
288 290
                             ?></span>
289 291
                         </td>
290 292
                     </tr>
@@ -376,10 +378,13 @@  discard block
 block discarded – undo
376 378
                         <?php esc_html_e('Apply Refund', 'event_espresso'); ?>
377 379
                     </a>
378 380
                 </li>
379
-            <?php else : ?>
381
+            <?php else {
382
+	: ?>
380 383
                 <li>
381 384
                     <p>
382
-                        <?php esc_html__('You do not have access to apply payments or refunds.', 'event_espresso'); ?>
385
+                        <?php esc_html__('You do not have access to apply payments or refunds.', 'event_espresso');
386
+}
387
+?>
383 388
                     </p>
384 389
                 </li>
385 390
             <?php endif; ?>
Please login to merge, or discard this patch.
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -83,25 +83,25 @@  discard block
 block discarded – undo
83 83
     </div>
84 84
     <br class="clear" />
85 85
     <?php
86
-    $no_payments = $grand_raw_total > 0
87
-                   || $TXN_status !== EEM_Transaction::complete_status_code
88
-                   || ! empty($payments);
89
-    ?>
86
+	$no_payments = $grand_raw_total > 0
87
+				   || $TXN_status !== EEM_Transaction::complete_status_code
88
+				   || ! empty($payments);
89
+	?>
90 90
     <?php if ($attendee instanceof EE_Attendee && $no_payments) : ?>
91 91
         <?php $no_payment_text = $can_edit_payments
92
-            ? esc_html__(
93
-                'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.',
94
-                'event_espresso'
95
-            )
96
-            : esc_html__(
97
-                'No payments have been applied to this transaction yet.',
98
-                'event_espresso'
99
-            );
100
-        ?>
92
+			? esc_html__(
93
+				'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.',
94
+				'event_espresso'
95
+			)
96
+			: esc_html__(
97
+				'No payments have been applied to this transaction yet.',
98
+				'event_espresso'
99
+			);
100
+		?>
101 101
 
102 102
         <h3 class="admin-primary-mbox-h4 hdr-has-icon">
103 103
             <span class="ee-icon ee-icon-cash"></span><?php
104
-            esc_html_e('Payment Details', 'event_espresso'); ?>
104
+			esc_html_e('Payment Details', 'event_espresso'); ?>
105 105
         </h3>
106 106
 
107 107
         <div class="admin-primary-mbox-tbl-wrap">
@@ -117,37 +117,37 @@  discard block
 block discarded – undo
117 117
                         <th class="jst-left"><?php esc_html_e('TXN&nbsp;ID / CHQ&nbsp;#', 'event_espresso'); ?></th>
118 118
                         <th class="jst-left"><?php esc_html_e('P.O. / S.O.&nbsp;#', 'event_espresso'); ?></th>
119 119
                         <th class="jst-left"><?php esc_html_e(
120
-                            'Notes / Extra&nbsp;Accounting',
121
-                            'event_espresso'
122
-                        ); ?></th>
120
+							'Notes / Extra&nbsp;Accounting',
121
+							'event_espresso'
122
+						); ?></th>
123 123
                         <th class="jst-cntr"><?php esc_html_e('Amount', 'event_espresso'); ?></th>
124 124
                     </tr>
125 125
                 </thead>
126 126
                 <tbody>
127 127
                     <?php if ($payments) :
128
-                        $payment_total = 0;
129
-                        foreach ($payments as $PAY_ID => $payment) :
130
-                            if (! $payment instanceof EE_Payment) {
131
-                                continue;
132
-                            }
133
-                            $PAY_ID = absint($PAY_ID);
134
-                            $existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
135
-                                ? wp_json_encode($existing_reg_payments[ $PAY_ID ])
136
-                                : '{}';
137
-                    ?>
128
+						$payment_total = 0;
129
+						foreach ($payments as $PAY_ID => $payment) :
130
+							if (! $payment instanceof EE_Payment) {
131
+								continue;
132
+							}
133
+							$PAY_ID = absint($PAY_ID);
134
+							$existing_reg_payment_json = isset($existing_reg_payments[ $PAY_ID ])
135
+								? wp_json_encode($existing_reg_payments[ $PAY_ID ])
136
+								: '{}';
137
+					?>
138 138
                     <tr id="txn-admin-payment-tr-<?php echo absint($PAY_ID); ?>">
139 139
                         <td>
140 140
                             <span id="payment-status-<?php echo absint($PAY_ID); ?>"
141 141
                                   class="ee-status-strip-td ee-status-strip pymt-status-<?php
142
-                                  echo esc_attr($payment->STS_ID()); ?>"
142
+								  echo esc_attr($payment->STS_ID()); ?>"
143 143
                             >
144 144
                             </span>
145 145
                             <div id="payment-STS_ID-<?php echo absint($PAY_ID); ?>" class="hidden"><?php
146
-                                echo esc_html($payment->STS_ID());
147
-                                ?></div>
146
+								echo esc_html($payment->STS_ID());
147
+								?></div>
148 148
                             <div id="reg-payments-<?php echo absint($PAY_ID); ?>" class="hidden"><?php
149
-                                echo esc_html($existing_reg_payment_json);
150
-                                ?></div>
149
+								echo esc_html($existing_reg_payment_json);
150
+								?></div>
151 151
                         </td>
152 152
                         <td class=" jst-cntr">
153 153
                             <ul class="txn-overview-actions-ul">
@@ -178,79 +178,79 @@  discard block
 block discarded – undo
178 178
                         </td>
179 179
                         <td class=" jst-left">
180 180
                             <div id="payment-date-<?php echo absint($PAY_ID); ?>" class="payment-date-dv"><?php
181
-                                echo esc_html($payment->timestamp('Y-m-d', 'g:i a'));
182
-                                ?></div>
181
+								echo esc_html($payment->timestamp('Y-m-d', 'g:i a'));
182
+								?></div>
183 183
                         </td>
184 184
                         <td class=" jst-left">
185 185
                             <div id="payment-method-<?php echo absint($PAY_ID); ?>"><?php
186
-                                echo esc_html($payment->source());
187
-                                ?></div>
186
+								echo esc_html($payment->source());
187
+								?></div>
188 188
                             <div id="payment-gateway-<?php echo absint($PAY_ID); ?>"><?php
189
-                                echo esc_html(
190
-                                    $payment->payment_method() instanceof EE_Payment_Method
191
-                                        ? $payment->payment_method()->admin_name()
192
-                                        : __("Unknown", 'event_espresso')
193
-                                );
194
-                            ?></div>
189
+								echo esc_html(
190
+									$payment->payment_method() instanceof EE_Payment_Method
191
+										? $payment->payment_method()->admin_name()
192
+										: __("Unknown", 'event_espresso')
193
+								);
194
+							?></div>
195 195
                             <div id="payment-gateway-id-<?php echo absint($PAY_ID); ?>" class="hidden"><?php
196
-                                echo esc_html(
197
-                                    $payment->payment_method() instanceof EE_Payment_Method
198
-                                        ? $payment->payment_method()->ID()
199
-                                        : 0
200
-                                );
201
-                            ?></div>
196
+								echo esc_html(
197
+									$payment->payment_method() instanceof EE_Payment_Method
198
+										? $payment->payment_method()->ID()
199
+										: 0
200
+								);
201
+							?></div>
202 202
                         </td>
203 203
                         <td class=" jst-left">
204 204
                             <div id="payment-response-<?php echo absint($PAY_ID); ?>"><?php
205
-                                echo esc_html($payment->gateway_response());
206
-                                ?></div>
205
+								echo esc_html($payment->gateway_response());
206
+								?></div>
207 207
                         </td>
208 208
                         <td class=" jst-left payment-txn-id-chq-nmbr">
209 209
                             <div id="payment-txn-id-chq-nmbr-<?php echo absint($PAY_ID); ?>"><?php
210
-                                echo esc_html($payment->txn_id_chq_nmbr());
211
-                                ?></div>
210
+								echo esc_html($payment->txn_id_chq_nmbr());
211
+								?></div>
212 212
                         </td>
213 213
                         <td class=" jst-left">
214 214
                             <div id="payment-po-nmbr-<?php echo absint($PAY_ID); ?>"><?php
215
-                                echo esc_html($payment->po_number());
216
-                                ?></div>
215
+								echo esc_html($payment->po_number());
216
+								?></div>
217 217
                         </td>
218 218
                         <td class=" jst-left">
219 219
                             <div id="payment-accntng-<?php echo absint($PAY_ID); ?>"><?php
220
-                                echo esc_html($payment->extra_accntng());
221
-                                ?></div>
220
+								echo esc_html($payment->extra_accntng());
221
+								?></div>
222 222
                         </td>
223 223
                         <td class=" jst-rght">
224 224
                             <?php
225
-                            $payment_class = $payment->amount() > 0
226
-                                ? 'txn-admin-payment-status-' . $payment->STS_ID()
227
-                                : 'txn-admin-payment-status-PDC';
228
-                            ?>
225
+							$payment_class = $payment->amount() > 0
226
+								? 'txn-admin-payment-status-' . $payment->STS_ID()
227
+								: 'txn-admin-payment-status-PDC';
228
+							?>
229 229
                             <span class="<?php echo esc_attr($payment_class); ?>">
230 230
                                 <span id="payment-amount-<?php echo absint($PAY_ID); ?>" style="display:inline;"><?php
231
-                                    echo wp_kses(
232
-                                    EEH_Template::format_currency(
233
-                                        $payment->amount(),
234
-                                        false,
235
-                                        false
236
-                                    ),
237
-                                    AllowedTags::getAllowedTags()
238
-                                );
239
-                                ?></span>
231
+									echo wp_kses(
232
+									EEH_Template::format_currency(
233
+										$payment->amount(),
234
+										false,
235
+										false
236
+									),
237
+									AllowedTags::getAllowedTags()
238
+								);
239
+								?></span>
240 240
                             </span>
241 241
                         </td>
242 242
                     </tr>
243 243
                             <?php $payment_total += $payment->STS_ID() == 'PAP' ? $payment->amount() : 0; ?>
244 244
                         <?php endforeach; ?>
245 245
                         <?php $pay_totals_class = $payment_total > $grand_raw_total
246
-                            ? ' important-notice'
247
-                            : '';
248
-                        ?>
246
+							? ' important-notice'
247
+							: '';
248
+						?>
249 249
                     <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden">
250 250
                         <td class=" jst-rght" colspan="10">
251 251
                             <span class="important-notice"><?php
252
-                                echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
253
-                            ?></span>
252
+								echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
253
+							?></span>
254 254
                         </td>
255 255
                     </tr>
256 256
                     <tr id="txn-admin-payments-total-tr"
@@ -258,45 +258,45 @@  discard block
 block discarded – undo
258 258
                     >
259 259
                         <th class=" jst-rght" colspan="9">
260 260
                             <span id="payments-total-spn"><?php
261
-                            $overpaid = $payment_total > $grand_raw_total
262
-                                ? '<span id="overpaid">'
263
-                                  . __('This transaction has been overpaid ! ', 'event_espresso')
264
-                                  . '</span>'
265
-                                : '';
266
-                            echo wp_kses(
267
-                                $overpaid
268
-                                . sprintf(
269
-                                    __('Payments Total %s', 'event_espresso'),
270
-                                    '(' . EE_Registry::instance()->CFG->currency->code . ')'
271
-                                ),
272
-                                AllowedTags::getAllowedTags()
273
-                            ); ?></span>
261
+							$overpaid = $payment_total > $grand_raw_total
262
+								? '<span id="overpaid">'
263
+								  . __('This transaction has been overpaid ! ', 'event_espresso')
264
+								  . '</span>'
265
+								: '';
266
+							echo wp_kses(
267
+								$overpaid
268
+								. sprintf(
269
+									__('Payments Total %s', 'event_espresso'),
270
+									'(' . EE_Registry::instance()->CFG->currency->code . ')'
271
+								),
272
+								AllowedTags::getAllowedTags()
273
+							); ?></span>
274 274
                         </th>
275 275
                         <th class=" jst-rght">
276 276
                             <span id="txn-admin-payment-total"><?php
277
-                            echo wp_kses(
278
-                                EEH_Template::format_currency(
279
-                                    $payment_total,
280
-                                    false,
281
-                                    false
282
-                                ),
283
-                                AllowedTags::getAllowedTags()
284
-                            ); ?></span>
277
+							echo wp_kses(
278
+								EEH_Template::format_currency(
279
+									$payment_total,
280
+									false,
281
+									false
282
+								),
283
+								AllowedTags::getAllowedTags()
284
+							); ?></span>
285 285
                         </th>
286 286
                     </tr>
287 287
                     <?php else : ?>
288 288
                     <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr">
289 289
                         <td class=" jst-rght" colspan="10">
290 290
                             <span class="important-notice"><?php
291
-                                echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
292
-                            ?></span>
291
+								echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
292
+							?></span>
293 293
                         </td>
294 294
                     </tr>
295 295
                     <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden">
296 296
                         <th class=" jst-rght" colspan="9">
297 297
                             <span id="payments-total-spn"><?php
298
-                            echo esc_html__('Payments Total', 'event_espresso');
299
-                            ?></span>
298
+							echo esc_html__('Payments Total', 'event_espresso');
299
+							?></span>
300 300
                         </th>
301 301
                         <th class=" jst-rght">
302 302
                             <span id="txn-admin-payment-total"></span>
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
         <ul id="txn-admin-payment-options-ul">
365 365
             <?php if ($can_edit_payments) :
366
-                ?>
366
+				?>
367 367
                 <li>
368 368
                     <a id="display-txn-admin-apply-payment"
369 369
                        class="button-primary no-icon no-hide"
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
                 </li>
389 389
             <?php endif; ?>
390 390
             <?php
391
-            // Allows extend the fields at actions area.
392
-            do_action(
393
-                'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
394
-                $can_edit_payments
395
-            );
396
-            ?>
391
+			// Allows extend the fields at actions area.
392
+			do_action(
393
+				'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
394
+				$can_edit_payments
395
+			);
396
+			?>
397 397
         </ul>
398 398
         <br class="clear" />
399 399
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
             >
405 405
                 <div class="ee-icon ee-icon-cash-add float-left"></div>
406 406
                 <?php
407
-                echo esc_html__('Apply a Payment to Transaction #', 'event_espresso') . esc_html($txn_nmbr['value']); ?>
407
+				echo esc_html__('Apply a Payment to Transaction #', 'event_espresso') . esc_html($txn_nmbr['value']); ?>
408 408
             </h2>
409 409
 
410 410
             <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon"
@@ -412,23 +412,23 @@  discard block
 block discarded – undo
412 412
             >
413 413
                 <div class="ee-icon ee-icon-cash-edit float-left"></div>
414 414
                 <?php
415
-                printf(
416
-                    esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
417
-                    '<span></span>',
418
-                    $txn_nmbr['value']
419
-                );
420
-                ?>
415
+				printf(
416
+					esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
417
+					'<span></span>',
418
+					$txn_nmbr['value']
419
+				);
420
+				?>
421 421
             </h2>
422 422
 
423 423
             <h2 id="admin-modal-dialog-edit-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;">
424 424
                 <div class="ee-icon ee-icon-cash-edit float-left"></div>
425 425
                 <?php
426
-                printf(
427
-                    esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
428
-                    '<span></span>',
429
-                    $txn_nmbr['value']
430
-                );
431
-                ?>
426
+				printf(
427
+					esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
428
+					'<span></span>',
429
+					$txn_nmbr['value']
430
+				);
431
+				?>
432 432
             </h2>
433 433
 
434 434
             <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon"
@@ -436,9 +436,9 @@  discard block
 block discarded – undo
436 436
             >
437 437
                 <div class="ee-icon ee-icon-cash-remove float-left"></div>
438 438
                 <?php
439
-                echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
440
-                echo esc_html($txn_nmbr['value']);
441
-                ?>
439
+				echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
440
+				echo esc_html($txn_nmbr['value']);
441
+				?>
442 442
             </h2>
443 443
 
444 444
             <form name="txn-admin-apply-payment-frm"
@@ -537,29 +537,29 @@  discard block
 block discarded – undo
537 537
                             >
538 538
                                 <?php foreach ($payment_methods as $method) : ?>
539 539
                                     <?php
540
-                                    $selected = $method->slug() == 'cash'
541
-                                        ? ' selected'
542
-                                        : '';
543
-                                    ?>
540
+									$selected = $method->slug() == 'cash'
541
+										? ' selected'
542
+										: '';
543
+									?>
544 544
                                     <option id="payment-method-opt-<?php echo esc_attr($method->slug()); ?>"
545 545
                                             value="<?php echo esc_attr($method->ID()); ?>"
546 546
                                         <?php echo esc_attr($selected); ?>
547 547
                                     >
548 548
                                         <?php
549
-                                        echo esc_html(
550
-                                            sanitize_key($method->admin_desc())
551
-                                                ? substr($method->admin_desc(), 0, 128)
552
-                                                : $method->admin_name()
553
-                                        );
554
-                                        ?>&nbsp;&nbsp;
549
+										echo esc_html(
550
+											sanitize_key($method->admin_desc())
551
+												? substr($method->admin_desc(), 0, 128)
552
+												: $method->admin_name()
553
+										);
554
+										?>&nbsp;&nbsp;
555 555
                                     </option>
556 556
                                 <?php endforeach; ?>
557 557
                             </select>
558 558
                             <p class="description">
559 559
                                 <?php esc_html_e(
560
-                                    'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
561
-                                    'event_espresso'
562
-                                ); ?>
560
+									'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
561
+									'event_espresso'
562
+								); ?>
563 563
                             </p>
564 564
                         </div>
565 565
 
@@ -567,9 +567,9 @@  discard block
 block discarded – undo
567 567
                             <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row">
568 568
                                 <label for="txn-admin-payment-txn-id-chq-nmbr-inp" class="">
569 569
                                     <?php esc_html_e(
570
-                                        'TXN ID / CHQ #',
571
-                                        'event_espresso'
572
-                                    ); ?>
570
+										'TXN ID / CHQ #',
571
+										'event_espresso'
572
+									); ?>
573 573
                                 </label>
574 574
                                 <input name="txn_admin_payment[txn_id_chq_nmbr]"
575 575
                                        id="txn-admin-payment-txn-id-chq-nmbr-inp"
@@ -578,9 +578,9 @@  discard block
 block discarded – undo
578 578
                                 />
579 579
                                 <p class="description">
580 580
                                     <?php esc_html_e(
581
-                                        'The Transaction ID sent back from the payment gateway, or the Cheque #',
582
-                                        'event_espresso'
583
-                                    ); ?>
581
+										'The Transaction ID sent back from the payment gateway, or the Cheque #',
582
+										'event_espresso'
583
+									); ?>
584 584
                                 </p>
585 585
                             </div>
586 586
                         </div>
@@ -597,9 +597,9 @@  discard block
 block discarded – undo
597 597
                                 />
598 598
                                 <p class="description">
599 599
                                     <?php esc_html_e(
600
-                                        'The gateway response string (optional)',
601
-                                        'event_espresso'
602
-                                    ); ?>
600
+										'The gateway response string (optional)',
601
+										'event_espresso'
602
+									); ?>
603 603
                                 </p>
604 604
                             </div>
605 605
                         </div>
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
                             <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row">
609 609
                                 <label for="txn-admin-payment-status-slct" class="">
610 610
                                     <?php esc_html_e(
611
-                                        'Payment Status',
612
-                                        'event_espresso'
613
-                                    ); ?>
611
+										'Payment Status',
612
+										'event_espresso'
613
+									); ?>
614 614
                                 </label>
615 615
                                 <select name="txn_admin_payment[status]"
616 616
                                         id="txn-admin-payment-status-slct"
@@ -619,10 +619,10 @@  discard block
 block discarded – undo
619 619
                                 >
620 620
                                     <?php foreach ($payment_status as $STS_ID => $STS_code) : ?>
621 621
                                         <?php
622
-                                        $selected = $STS_ID == 'PAP'
623
-                                            ? 'selected'
624
-                                            : '';
625
-                                        ?>
622
+										$selected = $STS_ID == 'PAP'
623
+											? 'selected'
624
+											: '';
625
+										?>
626 626
                                         <option id="payment-status-opt-<?php echo esc_attr($STS_ID); ?>"
627 627
                                                 value="<?php echo esc_attr($STS_ID); ?>"
628 628
                                             <?php echo esc_attr($selected); ?>
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
                                 </select>
634 634
                                 <p class="description">
635 635
                                     <?php
636
-                                    esc_html_e(
637
-                                        'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
638
-                                        'event_espresso'
639
-                                    ); ?>
636
+									esc_html_e(
637
+										'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
638
+										'event_espresso'
639
+									); ?>
640 640
                                 </p>
641 641
                             </div>
642 642
                         </div>
@@ -653,9 +653,9 @@  discard block
 block discarded – undo
653 653
                             />
654 654
                             <p class="description">
655 655
                                 <?php esc_html_e(
656
-                                    'The Purchase or Sales Order Number if any (optional)',
657
-                                    'event_espresso'
658
-                                ); ?>
656
+									'The Purchase or Sales Order Number if any (optional)',
657
+									'event_espresso'
658
+								); ?>
659 659
                             </p>
660 660
                         </div>
661 661
 
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
                             />
677 677
                             <p class="description">
678 678
                                 <?php esc_html_e(
679
-                                    'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
680
-                                    'event_espresso'
681
-                                ); ?>
679
+									'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
680
+									'event_espresso'
681
+								); ?>
682 682
                             </p>
683 683
                         </div>
684 684
 
@@ -713,9 +713,9 @@  discard block
 block discarded – undo
713 713
                             <?php echo wp_kses($status_change_select, AllowedTags::getWithFormTags()); ?>
714 714
                             <p class="description">
715 715
                                 <?php esc_html_e(
716
-                                    'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
717
-                                    'event_espresso'
718
-                                ); ?>
716
+									'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
717
+									'event_espresso'
718
+								); ?>
719 719
                             </p>
720 720
                             <br />
721 721
                         </div>
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
                             <br class="clear-float" />
747 747
                             <p class="description">
748 748
                                 <?php printf(
749
-                                    esc_html__(
750
-                                        'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.',
751
-                                        'event_espresso'
752
-                                    ),
753
-                                    '<strong>',
754
-                                    '</strong>',
755
-                                    '<br />'
756
-                                ); ?>
749
+									esc_html__(
750
+										'By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.',
751
+										'event_espresso'
752
+									),
753
+									'<strong>',
754
+									'</strong>',
755
+									'<br />'
756
+								); ?>
757 757
                             </p>
758 758
                         </div>
759 759
                         <div class="clear"></div>
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
             >
819 819
                 <span class="ee-icon ee-icon-cash-add"></span>
820 820
                 <?php printf(
821
-                    esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
822
-                    $txn_nmbr['value']
823
-                );
824
-                ?>
821
+					esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
822
+					$txn_nmbr['value']
823
+				);
824
+				?>
825 825
             </h2>
826 826
 
827 827
             <form name="txn-admin-delete-payment-frm"
@@ -857,13 +857,13 @@  discard block
 block discarded – undo
857 857
                             <?php echo wp_kses($delete_status_change_select, AllowedTags::getWithFormTags()); ?>
858 858
                             <p class="description">
859 859
                                 <?php printf(
860
-                                    esc_html__(
861
-                                        'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s',
862
-                                        'event_espresso'
863
-                                    ),
864
-                                    '<strong>',
865
-                                    '</strong>'
866
-                                ); ?>
860
+									esc_html__(
861
+										'If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s',
862
+										'event_espresso'
863
+									),
864
+									'<strong>',
865
+									'</strong>'
866
+								); ?>
867 867
                             </p>
868 868
                         </div>
869 869
 
@@ -878,10 +878,10 @@  discard block
 block discarded – undo
878 878
                             />
879 879
                             <p class="description">
880 880
                                 <?php
881
-                                esc_html_e(
882
-                                    'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.',
883
-                                    'event_espresso'
884
-                                ); ?>
881
+								esc_html_e(
882
+									'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.',
883
+									'event_espresso'
884
+								); ?>
885 885
                             </p>
886 886
                         </div>
887 887
                         <div class="clear"></div>
@@ -914,8 +914,8 @@  discard block
 block discarded – undo
914 914
     <?php endif; // $grand_raw_total > 0?>
915 915
 
916 916
     <?php if (WP_DEBUG) {
917
-        $delivered_messages = get_option('EED_Messages__payment', []);
918
-        if (isset($delivered_messages[ $TXN_ID ])) { ?>
917
+		$delivered_messages = get_option('EED_Messages__payment', []);
918
+		if (isset($delivered_messages[ $TXN_ID ])) { ?>
919 919
             <h4 class="admin-primary-mbox-h4 hdr-has-icon">
920 920
                 <span class="dashicons dashicons-email-alt"></span>
921 921
                 <?php esc_html_e('Messages Sent to Primary Registrant', 'event_espresso'); ?>
@@ -927,39 +927,39 @@  discard block
 block discarded – undo
927 927
                             <th class="jst-left"><?php esc_html_e('Date & Time', 'event_espresso'); ?></th>
928 928
                             <th class="jst-left"><?php esc_html_e('Message Type', 'event_espresso'); ?></th>
929 929
                             <th class="jst-left"><?php esc_html_e(
930
-                                'Payment Status Upon Sending',
931
-                                'event_espresso'
932
-                            ); ?></th>
930
+								'Payment Status Upon Sending',
931
+								'event_espresso'
932
+							); ?></th>
933 933
                             <th class="jst-left"><?php esc_html_e('TXN Status Upon Sending', 'event_espresso'); ?></th>
934 934
                         </tr>
935 935
                     </thead>
936 936
                     <tbody>
937 937
                         <?php
938
-                        foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
939
-                            ?>
938
+						foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
939
+							?>
940 940
                             <tr>
941 941
                                 <td class="jst-left">
942 942
                                     <?php echo esc_html(
943
-                                        date(
944
-                                            get_option('date_format') . ' ' . get_option('time_format'),
945
-                                            ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
946
-                                        )
947
-                                    ); ?>
943
+										date(
944
+											get_option('date_format') . ' ' . get_option('time_format'),
945
+											($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
946
+										)
947
+									); ?>
948 948
                                 </td>
949 949
                                 <td class="jst-left"><?php
950
-                                    echo isset($delivered_message['message_type'])
951
-                                        ? esc_html($delivered_message['message_type'])
952
-                                        : ''; ?>
950
+									echo isset($delivered_message['message_type'])
951
+										? esc_html($delivered_message['message_type'])
952
+										: ''; ?>
953 953
                                 </td>
954 954
                                 <td class="jst-left"><?php
955
-                                    echo isset($delivered_message['pay_status'])
956
-                                        ? esc_html($delivered_message['pay_status'])
957
-                                        : ''; ?>
955
+									echo isset($delivered_message['pay_status'])
956
+										? esc_html($delivered_message['pay_status'])
957
+										: ''; ?>
958 958
                                 </td>
959 959
                                 <td class="jst-left"><?php
960
-                                    echo isset($delivered_message['txn_status'])
961
-                                        ? esc_html($delivered_message['txn_status'])
962
-                                        : ''; ?>
960
+									echo isset($delivered_message['txn_status'])
961
+										? esc_html($delivered_message['txn_status'])
962
+										: ''; ?>
963 963
                                 </td>
964 964
                             </tr>
965 965
                         <?php endforeach; // $delivered_messages?>
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
                 </table>
968 968
             </div>
969 969
             <?php
970
-        }
971
-    }
972
-    ?>
970
+		}
971
+	}
972
+	?>
973 973
 </div>
Please login to merge, or discard this patch.
admin_pages/general_settings/OrganizationSettings.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -424,8 +424,8 @@
 block discarded – undo
424 424
         $this->organization_config->instagram = isset($form_data['organization_instagram'])
425 425
             ? esc_url_raw($form_data['organization_instagram'])
426 426
             : $this->organization_config->instagram;
427
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
428
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
427
+        $this->core_config->ee_ueip_optin = isset($form_data[EE_Core_Config::OPTION_NAME_UXIP][0])
428
+            ? filter_var($form_data[EE_Core_Config::OPTION_NAME_UXIP][0], FILTER_VALIDATE_BOOLEAN)
429 429
             : false;
430 430
         $this->core_config->ee_ueip_has_notified = true;
431 431
 
Please login to merge, or discard this patch.
Indentation   +401 added lines, -401 removed lines patch added patch discarded remove patch
@@ -40,417 +40,417 @@
 block discarded – undo
40 40
  */
41 41
 class OrganizationSettings extends FormHandler
42 42
 {
43
-    /**
44
-     * @var EE_Organization_Config
45
-     */
46
-    protected $organization_config;
43
+	/**
44
+	 * @var EE_Organization_Config
45
+	 */
46
+	protected $organization_config;
47 47
 
48
-    /**
49
-     * @var EE_Core_Config
50
-     */
51
-    protected $core_config;
48
+	/**
49
+	 * @var EE_Core_Config
50
+	 */
51
+	protected $core_config;
52 52
 
53
-    /**
54
-     * @var EE_Network_Core_Config
55
-     */
56
-    protected $network_core_config;
53
+	/**
54
+	 * @var EE_Network_Core_Config
55
+	 */
56
+	protected $network_core_config;
57 57
 
58
-    /**
59
-     * @var CountrySubRegionDao
60
-     */
61
-    protected $countrySubRegionDao;
58
+	/**
59
+	 * @var CountrySubRegionDao
60
+	 */
61
+	protected $countrySubRegionDao;
62 62
 
63
-    /**
64
-     * Form constructor.
65
-     *
66
-     * @param EE_Registry             $registry
67
-     * @param EE_Organization_Config  $organization_config
68
-     * @param EE_Core_Config          $core_config
69
-     * @param EE_Network_Core_Config $network_core_config
70
-     * @param CountrySubRegionDao $countrySubRegionDao
71
-     * @throws InvalidArgumentException
72
-     * @throws InvalidDataTypeException
73
-     * @throws DomainException
74
-     */
75
-    public function __construct(
76
-        EE_Registry $registry,
77
-        EE_Organization_Config $organization_config,
78
-        EE_Core_Config $core_config,
79
-        EE_Network_Core_Config $network_core_config,
80
-        CountrySubRegionDao $countrySubRegionDao
81
-    ) {
82
-        $this->organization_config = $organization_config;
83
-        $this->core_config = $core_config;
84
-        $this->network_core_config = $network_core_config;
85
-        $this->countrySubRegionDao = $countrySubRegionDao;
86
-        parent::__construct(
87
-            esc_html__('Your Organization Settings', 'event_espresso'),
88
-            esc_html__('Your Organization Settings', 'event_espresso'),
89
-            'organization_settings',
90
-            '',
91
-            FormHandler::DO_NOT_SETUP_FORM,
92
-            $registry
93
-        );
94
-    }
63
+	/**
64
+	 * Form constructor.
65
+	 *
66
+	 * @param EE_Registry             $registry
67
+	 * @param EE_Organization_Config  $organization_config
68
+	 * @param EE_Core_Config          $core_config
69
+	 * @param EE_Network_Core_Config $network_core_config
70
+	 * @param CountrySubRegionDao $countrySubRegionDao
71
+	 * @throws InvalidArgumentException
72
+	 * @throws InvalidDataTypeException
73
+	 * @throws DomainException
74
+	 */
75
+	public function __construct(
76
+		EE_Registry $registry,
77
+		EE_Organization_Config $organization_config,
78
+		EE_Core_Config $core_config,
79
+		EE_Network_Core_Config $network_core_config,
80
+		CountrySubRegionDao $countrySubRegionDao
81
+	) {
82
+		$this->organization_config = $organization_config;
83
+		$this->core_config = $core_config;
84
+		$this->network_core_config = $network_core_config;
85
+		$this->countrySubRegionDao = $countrySubRegionDao;
86
+		parent::__construct(
87
+			esc_html__('Your Organization Settings', 'event_espresso'),
88
+			esc_html__('Your Organization Settings', 'event_espresso'),
89
+			'organization_settings',
90
+			'',
91
+			FormHandler::DO_NOT_SETUP_FORM,
92
+			$registry
93
+		);
94
+	}
95 95
 
96 96
 
97
-    /**
98
-     * creates and returns the actual form
99
-     *
100
-     * @return EE_Form_Section_Proper
101
-     * @throws EE_Error
102
-     * @throws InvalidArgumentException
103
-     * @throws InvalidDataTypeException
104
-     * @throws InvalidInterfaceException
105
-     * @throws ReflectionException
106
-     */
107
-    public function generate(): EE_Form_Section_Proper
108
-    {
109
-        $has_sub_regions = EEM_State::instance()->count(
110
-            array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
111
-        );
112
-        return apply_filters(
113
-            'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
114
-            new EE_Form_Section_Proper(
115
-                array(
116
-                    'name'            => 'organization_settings',
117
-                    'html_id'         => 'organization_settings',
118
-                    'layout_strategy' => new EE_Admin_Two_Column_Layout(),
119
-                    'subsections'     => array(
120
-                        'contact_information_hdr'        => new EE_Form_Section_HTML(
121
-                            EEH_HTML::h2(
122
-                                esc_html__('Contact Information', 'event_espresso')
123
-                                . ' '
124
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
125
-                                '',
126
-                                'contact-information-hdr'
127
-                            )
128
-                        ),
129
-                        'organization_name'      => new EE_Text_Input(
130
-                            array(
131
-                                'html_name' => 'organization_name',
132
-                                'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
133
-                                'html_help_text'  => esc_html__(
134
-                                    'Displayed on all emails and invoices.',
135
-                                    'event_espresso'
136
-                                ),
137
-                                'default'         => $this->organization_config->get_pretty('name'),
138
-                                'required'        => false,
139
-                            )
140
-                        ),
141
-                        'organization_address_1'      => new EE_Text_Input(
142
-                            array(
143
-                                'html_name' => 'organization_address_1',
144
-                                'html_label_text' => esc_html__('Street Address', 'event_espresso'),
145
-                                'default'         => $this->organization_config->get_pretty('address_1'),
146
-                                'required'        => false,
147
-                            )
148
-                        ),
149
-                        'organization_address_2'      => new EE_Text_Input(
150
-                            array(
151
-                                'html_name' => 'organization_address_2',
152
-                                'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
153
-                                'default'         => $this->organization_config->get_pretty('address_2'),
154
-                                'required'        => false,
155
-                            )
156
-                        ),
157
-                        'organization_city'      => new EE_Text_Input(
158
-                            array(
159
-                                'html_name' => 'organization_city',
160
-                                'html_label_text' => esc_html__('City', 'event_espresso'),
161
-                                'default'         => $this->organization_config->get_pretty('city'),
162
-                                'required'        => false,
163
-                            )
164
-                        ),
165
-                        'organization_country'      => new EE_Country_Select_Input(
166
-                            null,
167
-                            array(
168
-                                EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
169
-                                'html_name'       => 'organization_country',
170
-                                'html_label_text' => esc_html__('Country', 'event_espresso'),
171
-                                'default'         => $this->organization_config->CNT_ISO,
172
-                                'required'        => false,
173
-                                'html_help_text'  => sprintf(
174
-                                    esc_html__(
175
-                                        '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
176
-                                        'event_espresso'
177
-                                    ),
178
-                                    '<span class="reminder-spn">',
179
-                                    '</span>'
180
-                                ),
181
-                            )
182
-                        ),
183
-                        'organization_state' => new EE_State_Select_Input(
184
-                            null,
185
-                            array(
186
-                                'html_name'       => 'organization_state',
187
-                                'html_label_text' => esc_html__('State/Province', 'event_espresso'),
188
-                                'default'         => $this->organization_config->STA_ID,
189
-                                'required'        => false,
190
-                                'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
191
-                                    ? sprintf(
192
-                                        esc_html__(
193
-                                            'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
194
-                                            'event_espresso'
195
-                                        ),
196
-                                        '<span class="reminder-spn">',
197
-                                        '</span>',
198
-                                        '<br />'
199
-                                    )
200
-                                    : '',
201
-                            )
202
-                        ),
203
-                        'organization_zip'      => new EE_Text_Input(
204
-                            array(
205
-                                'html_name' => 'organization_zip',
206
-                                'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
207
-                                'default'         => $this->organization_config->get_pretty('zip'),
208
-                                'required'        => false,
209
-                            )
210
-                        ),
211
-                        'organization_email'      => new EE_Text_Input(
212
-                            array(
213
-                                'html_name' => 'organization_email',
214
-                                'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
215
-                                'html_help_text'  => sprintf(
216
-                                    esc_html__(
217
-                                        'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
218
-                                        'event_espresso'
219
-                                    ),
220
-                                    '<code>[CO_FORMATTED_EMAIL]</code>',
221
-                                    '<code>[CO_EMAIL]</code>'
222
-                                ),
223
-                                'default'         => $this->organization_config->get_pretty('email'),
224
-                                'required'        => false,
225
-                            )
226
-                        ),
227
-                        'organization_phone'      => new EE_Text_Input(
228
-                            array(
229
-                                'html_name' => 'organization_phone',
230
-                                'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
231
-                                'html_help_text'  => esc_html__(
232
-                                    'The phone number for your organization.',
233
-                                    'event_espresso'
234
-                                ),
235
-                                'default'         => $this->organization_config->get_pretty('phone'),
236
-                                'required'        => false,
237
-                            )
238
-                        ),
239
-                        'organization_vat'      => new EE_Text_Input(
240
-                            array(
241
-                                'html_name' => 'organization_vat',
242
-                                'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
243
-                                'html_help_text'  => esc_html__(
244
-                                    'The VAT/Tax Number may be displayed on invoices and receipts.',
245
-                                    'event_espresso'
246
-                                ),
247
-                                'default'         => $this->organization_config->get_pretty('vat'),
248
-                                'required'        => false,
249
-                            )
250
-                        ),
251
-                        'company_logo_hdr'        => new EE_Form_Section_HTML(
252
-                            EEH_HTML::h2(
253
-                                esc_html__('Company Logo', 'event_espresso')
254
-                                . ' '
255
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
256
-                                '',
257
-                                'company-logo-hdr'
258
-                            )
259
-                        ),
260
-                        'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
261
-                            array(
262
-                                'html_name' => 'organization_logo_url',
263
-                                'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
264
-                                'html_help_text'  => esc_html__(
265
-                                    'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
266
-                                    'event_espresso'
267
-                                ),
268
-                                'default'         => $this->organization_config->get_pretty('logo_url'),
269
-                                'required'        => false,
270
-                            )
271
-                        ),
272
-                        'social_links_hdr'        => new EE_Form_Section_HTML(
273
-                            EEH_HTML::h2(
274
-                                esc_html__('Social Links', 'event_espresso')
275
-                                . ' '
276
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
277
-                                . EEH_HTML::br()
278
-                                . EEH_HTML::p(
279
-                                    esc_html__(
280
-                                        'Enter any links to social accounts for your organization here',
281
-                                        'event_espresso'
282
-                                    ),
283
-                                    '',
284
-                                    'description'
285
-                                ),
286
-                                '',
287
-                                'social-links-hdr'
288
-                            )
289
-                        ),
290
-                        'organization_facebook'      => new EE_Text_Input(
291
-                            array(
292
-                                'html_name' => 'organization_facebook',
293
-                                'html_label_text' => esc_html__('Facebook', 'event_espresso'),
294
-                                'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
295
-                                'default'         => $this->organization_config->get_pretty('facebook'),
296
-                                'required'        => false,
297
-                            )
298
-                        ),
299
-                        'organization_twitter'      => new EE_Text_Input(
300
-                            array(
301
-                                'html_name' => 'organization_twitter',
302
-                                'html_label_text' => esc_html__('Twitter', 'event_espresso'),
303
-                                'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
304
-                                'default'         => $this->organization_config->get_pretty('twitter'),
305
-                                'required'        => false,
306
-                            )
307
-                        ),
308
-                        'organization_linkedin'      => new EE_Text_Input(
309
-                            array(
310
-                                'html_name' => 'organization_linkedin',
311
-                                'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
312
-                                'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
313
-                                'default'         => $this->organization_config->get_pretty('linkedin'),
314
-                                'required'        => false,
315
-                            )
316
-                        ),
317
-                        'organization_pinterest'      => new EE_Text_Input(
318
-                            array(
319
-                                'html_name' => 'organization_pinterest',
320
-                                'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
321
-                                'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
322
-                                'default'         => $this->organization_config->get_pretty('pinterest'),
323
-                                'required'        => false,
324
-                            )
325
-                        ),
326
-                        'organization_instagram'      => new EE_Text_Input(
327
-                            array(
328
-                                'html_name' => 'organization_instagram',
329
-                                'html_label_text' => esc_html__('Instagram', 'event_espresso'),
330
-                                'other_html_attributes' => ' placeholder="instagram.com/handle"',
331
-                                'default'         => $this->organization_config->get_pretty('instagram'),
332
-                                'required'        => false,
333
-                            )
334
-                        ),
335
-                    ),
336
-                )
337
-            ),
338
-            $this,
339
-            $has_sub_regions
340
-        );
341
-    }
97
+	/**
98
+	 * creates and returns the actual form
99
+	 *
100
+	 * @return EE_Form_Section_Proper
101
+	 * @throws EE_Error
102
+	 * @throws InvalidArgumentException
103
+	 * @throws InvalidDataTypeException
104
+	 * @throws InvalidInterfaceException
105
+	 * @throws ReflectionException
106
+	 */
107
+	public function generate(): EE_Form_Section_Proper
108
+	{
109
+		$has_sub_regions = EEM_State::instance()->count(
110
+			array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
111
+		);
112
+		return apply_filters(
113
+			'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
114
+			new EE_Form_Section_Proper(
115
+				array(
116
+					'name'            => 'organization_settings',
117
+					'html_id'         => 'organization_settings',
118
+					'layout_strategy' => new EE_Admin_Two_Column_Layout(),
119
+					'subsections'     => array(
120
+						'contact_information_hdr'        => new EE_Form_Section_HTML(
121
+							EEH_HTML::h2(
122
+								esc_html__('Contact Information', 'event_espresso')
123
+								. ' '
124
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
125
+								'',
126
+								'contact-information-hdr'
127
+							)
128
+						),
129
+						'organization_name'      => new EE_Text_Input(
130
+							array(
131
+								'html_name' => 'organization_name',
132
+								'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
133
+								'html_help_text'  => esc_html__(
134
+									'Displayed on all emails and invoices.',
135
+									'event_espresso'
136
+								),
137
+								'default'         => $this->organization_config->get_pretty('name'),
138
+								'required'        => false,
139
+							)
140
+						),
141
+						'organization_address_1'      => new EE_Text_Input(
142
+							array(
143
+								'html_name' => 'organization_address_1',
144
+								'html_label_text' => esc_html__('Street Address', 'event_espresso'),
145
+								'default'         => $this->organization_config->get_pretty('address_1'),
146
+								'required'        => false,
147
+							)
148
+						),
149
+						'organization_address_2'      => new EE_Text_Input(
150
+							array(
151
+								'html_name' => 'organization_address_2',
152
+								'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
153
+								'default'         => $this->organization_config->get_pretty('address_2'),
154
+								'required'        => false,
155
+							)
156
+						),
157
+						'organization_city'      => new EE_Text_Input(
158
+							array(
159
+								'html_name' => 'organization_city',
160
+								'html_label_text' => esc_html__('City', 'event_espresso'),
161
+								'default'         => $this->organization_config->get_pretty('city'),
162
+								'required'        => false,
163
+							)
164
+						),
165
+						'organization_country'      => new EE_Country_Select_Input(
166
+							null,
167
+							array(
168
+								EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
169
+								'html_name'       => 'organization_country',
170
+								'html_label_text' => esc_html__('Country', 'event_espresso'),
171
+								'default'         => $this->organization_config->CNT_ISO,
172
+								'required'        => false,
173
+								'html_help_text'  => sprintf(
174
+									esc_html__(
175
+										'%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
176
+										'event_espresso'
177
+									),
178
+									'<span class="reminder-spn">',
179
+									'</span>'
180
+								),
181
+							)
182
+						),
183
+						'organization_state' => new EE_State_Select_Input(
184
+							null,
185
+							array(
186
+								'html_name'       => 'organization_state',
187
+								'html_label_text' => esc_html__('State/Province', 'event_espresso'),
188
+								'default'         => $this->organization_config->STA_ID,
189
+								'required'        => false,
190
+								'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
191
+									? sprintf(
192
+										esc_html__(
193
+											'If the States/Provinces for the selected Country do not appear in this list, then click "Save".%3$sIf data exists, then the list will be populated when the page reloads and you will be able to make a selection at that time.%3$s%1$sMake sure you click "Save" again after selecting a State/Province that has just been loaded in order to keep that selection.%2$s',
194
+											'event_espresso'
195
+										),
196
+										'<span class="reminder-spn">',
197
+										'</span>',
198
+										'<br />'
199
+									)
200
+									: '',
201
+							)
202
+						),
203
+						'organization_zip'      => new EE_Text_Input(
204
+							array(
205
+								'html_name' => 'organization_zip',
206
+								'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
207
+								'default'         => $this->organization_config->get_pretty('zip'),
208
+								'required'        => false,
209
+							)
210
+						),
211
+						'organization_email'      => new EE_Text_Input(
212
+							array(
213
+								'html_name' => 'organization_email',
214
+								'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
215
+								'html_help_text'  => sprintf(
216
+									esc_html__(
217
+										'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
218
+										'event_espresso'
219
+									),
220
+									'<code>[CO_FORMATTED_EMAIL]</code>',
221
+									'<code>[CO_EMAIL]</code>'
222
+								),
223
+								'default'         => $this->organization_config->get_pretty('email'),
224
+								'required'        => false,
225
+							)
226
+						),
227
+						'organization_phone'      => new EE_Text_Input(
228
+							array(
229
+								'html_name' => 'organization_phone',
230
+								'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
231
+								'html_help_text'  => esc_html__(
232
+									'The phone number for your organization.',
233
+									'event_espresso'
234
+								),
235
+								'default'         => $this->organization_config->get_pretty('phone'),
236
+								'required'        => false,
237
+							)
238
+						),
239
+						'organization_vat'      => new EE_Text_Input(
240
+							array(
241
+								'html_name' => 'organization_vat',
242
+								'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
243
+								'html_help_text'  => esc_html__(
244
+									'The VAT/Tax Number may be displayed on invoices and receipts.',
245
+									'event_espresso'
246
+								),
247
+								'default'         => $this->organization_config->get_pretty('vat'),
248
+								'required'        => false,
249
+							)
250
+						),
251
+						'company_logo_hdr'        => new EE_Form_Section_HTML(
252
+							EEH_HTML::h2(
253
+								esc_html__('Company Logo', 'event_espresso')
254
+								. ' '
255
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
256
+								'',
257
+								'company-logo-hdr'
258
+							)
259
+						),
260
+						'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
261
+							array(
262
+								'html_name' => 'organization_logo_url',
263
+								'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
264
+								'html_help_text'  => esc_html__(
265
+									'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
266
+									'event_espresso'
267
+								),
268
+								'default'         => $this->organization_config->get_pretty('logo_url'),
269
+								'required'        => false,
270
+							)
271
+						),
272
+						'social_links_hdr'        => new EE_Form_Section_HTML(
273
+							EEH_HTML::h2(
274
+								esc_html__('Social Links', 'event_espresso')
275
+								. ' '
276
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
277
+								. EEH_HTML::br()
278
+								. EEH_HTML::p(
279
+									esc_html__(
280
+										'Enter any links to social accounts for your organization here',
281
+										'event_espresso'
282
+									),
283
+									'',
284
+									'description'
285
+								),
286
+								'',
287
+								'social-links-hdr'
288
+							)
289
+						),
290
+						'organization_facebook'      => new EE_Text_Input(
291
+							array(
292
+								'html_name' => 'organization_facebook',
293
+								'html_label_text' => esc_html__('Facebook', 'event_espresso'),
294
+								'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
295
+								'default'         => $this->organization_config->get_pretty('facebook'),
296
+								'required'        => false,
297
+							)
298
+						),
299
+						'organization_twitter'      => new EE_Text_Input(
300
+							array(
301
+								'html_name' => 'organization_twitter',
302
+								'html_label_text' => esc_html__('Twitter', 'event_espresso'),
303
+								'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
304
+								'default'         => $this->organization_config->get_pretty('twitter'),
305
+								'required'        => false,
306
+							)
307
+						),
308
+						'organization_linkedin'      => new EE_Text_Input(
309
+							array(
310
+								'html_name' => 'organization_linkedin',
311
+								'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
312
+								'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
313
+								'default'         => $this->organization_config->get_pretty('linkedin'),
314
+								'required'        => false,
315
+							)
316
+						),
317
+						'organization_pinterest'      => new EE_Text_Input(
318
+							array(
319
+								'html_name' => 'organization_pinterest',
320
+								'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
321
+								'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
322
+								'default'         => $this->organization_config->get_pretty('pinterest'),
323
+								'required'        => false,
324
+							)
325
+						),
326
+						'organization_instagram'      => new EE_Text_Input(
327
+							array(
328
+								'html_name' => 'organization_instagram',
329
+								'html_label_text' => esc_html__('Instagram', 'event_espresso'),
330
+								'other_html_attributes' => ' placeholder="instagram.com/handle"',
331
+								'default'         => $this->organization_config->get_pretty('instagram'),
332
+								'required'        => false,
333
+							)
334
+						),
335
+					),
336
+				)
337
+			),
338
+			$this,
339
+			$has_sub_regions
340
+		);
341
+	}
342 342
 
343 343
 
344
-    /**
345
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
346
-     * returns a string of HTML that can be directly echoed in a template
347
-     *
348
-     * @return string
349
-     * @throws EE_Error
350
-     * @throws InvalidArgumentException
351
-     * @throws InvalidDataTypeException
352
-     * @throws InvalidInterfaceException
353
-     * @throws LogicException
354
-     */
355
-    public function display()
356
-    {
357
-        $this->form()->enqueue_js();
358
-        return parent::display();
359
-    }
344
+	/**
345
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
346
+	 * returns a string of HTML that can be directly echoed in a template
347
+	 *
348
+	 * @return string
349
+	 * @throws EE_Error
350
+	 * @throws InvalidArgumentException
351
+	 * @throws InvalidDataTypeException
352
+	 * @throws InvalidInterfaceException
353
+	 * @throws LogicException
354
+	 */
355
+	public function display()
356
+	{
357
+		$this->form()->enqueue_js();
358
+		return parent::display();
359
+	}
360 360
 
361 361
 
362
-    /**
363
-     * handles processing the form submission
364
-     * returns true or false depending on whether the form was processed successfully or not
365
-     *
366
-     * @param array $form_data
367
-     * @return bool
368
-     * @throws InvalidFormSubmissionException
369
-     * @throws EE_Error
370
-     * @throws LogicException
371
-     * @throws InvalidArgumentException
372
-     * @throws InvalidDataTypeException
373
-     * @throws ReflectionException
374
-     */
375
-    public function process($form_data = array()): bool
376
-    {
377
-        // process form
378
-        $valid_data = (array) parent::process($form_data);
379
-        if (empty($valid_data)) {
380
-            return false;
381
-        }
362
+	/**
363
+	 * handles processing the form submission
364
+	 * returns true or false depending on whether the form was processed successfully or not
365
+	 *
366
+	 * @param array $form_data
367
+	 * @return bool
368
+	 * @throws InvalidFormSubmissionException
369
+	 * @throws EE_Error
370
+	 * @throws LogicException
371
+	 * @throws InvalidArgumentException
372
+	 * @throws InvalidDataTypeException
373
+	 * @throws ReflectionException
374
+	 */
375
+	public function process($form_data = array()): bool
376
+	{
377
+		// process form
378
+		$valid_data = (array) parent::process($form_data);
379
+		if (empty($valid_data)) {
380
+			return false;
381
+		}
382 382
 
383
-        if (is_main_site()) {
384
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
385
-                ? sanitize_text_field($form_data['ee_site_license_key'])
386
-                : $this->network_core_config->site_license_key;
387
-        }
388
-        $this->organization_config->name = isset($form_data['organization_name'])
389
-            ? sanitize_text_field($form_data['organization_name'])
390
-            : $this->organization_config->name;
391
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
392
-            ? sanitize_text_field($form_data['organization_address_1'])
393
-            : $this->organization_config->address_1;
394
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
395
-            ? sanitize_text_field($form_data['organization_address_2'])
396
-            : $this->organization_config->address_2;
397
-        $this->organization_config->city = isset($form_data['organization_city'])
398
-            ? sanitize_text_field($form_data['organization_city'])
399
-            : $this->organization_config->city;
400
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
401
-            ? absint($form_data['organization_state'])
402
-            : $this->organization_config->STA_ID;
403
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
404
-            ? sanitize_text_field($form_data['organization_country'])
405
-            : $this->organization_config->CNT_ISO;
406
-        $this->organization_config->zip = isset($form_data['organization_zip'])
407
-            ? sanitize_text_field($form_data['organization_zip'])
408
-            : $this->organization_config->zip;
409
-        $this->organization_config->email = isset($form_data['organization_email'])
410
-            ? sanitize_email($form_data['organization_email'])
411
-            : $this->organization_config->email;
412
-        $this->organization_config->vat = isset($form_data['organization_vat'])
413
-            ? sanitize_text_field($form_data['organization_vat'])
414
-            : $this->organization_config->vat;
415
-        $this->organization_config->phone = isset($form_data['organization_phone'])
416
-            ? sanitize_text_field($form_data['organization_phone'])
417
-            : $this->organization_config->phone;
418
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
419
-            ? esc_url_raw($form_data['organization_logo_url'])
420
-            : $this->organization_config->logo_url;
421
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
422
-            ? esc_url_raw($form_data['organization_facebook'])
423
-            : $this->organization_config->facebook;
424
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
425
-            ? esc_url_raw($form_data['organization_twitter'])
426
-            : $this->organization_config->twitter;
427
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
428
-            ? esc_url_raw($form_data['organization_linkedin'])
429
-            : $this->organization_config->linkedin;
430
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
431
-            ? esc_url_raw($form_data['organization_pinterest'])
432
-            : $this->organization_config->pinterest;
433
-        $this->organization_config->google = isset($form_data['organization_google'])
434
-            ? esc_url_raw($form_data['organization_google'])
435
-            : $this->organization_config->google;
436
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
437
-            ? esc_url_raw($form_data['organization_instagram'])
438
-            : $this->organization_config->instagram;
439
-        $this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
440
-            ? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
441
-            : false;
442
-        $this->core_config->ee_ueip_has_notified = true;
383
+		if (is_main_site()) {
384
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
385
+				? sanitize_text_field($form_data['ee_site_license_key'])
386
+				: $this->network_core_config->site_license_key;
387
+		}
388
+		$this->organization_config->name = isset($form_data['organization_name'])
389
+			? sanitize_text_field($form_data['organization_name'])
390
+			: $this->organization_config->name;
391
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
392
+			? sanitize_text_field($form_data['organization_address_1'])
393
+			: $this->organization_config->address_1;
394
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
395
+			? sanitize_text_field($form_data['organization_address_2'])
396
+			: $this->organization_config->address_2;
397
+		$this->organization_config->city = isset($form_data['organization_city'])
398
+			? sanitize_text_field($form_data['organization_city'])
399
+			: $this->organization_config->city;
400
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
401
+			? absint($form_data['organization_state'])
402
+			: $this->organization_config->STA_ID;
403
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
404
+			? sanitize_text_field($form_data['organization_country'])
405
+			: $this->organization_config->CNT_ISO;
406
+		$this->organization_config->zip = isset($form_data['organization_zip'])
407
+			? sanitize_text_field($form_data['organization_zip'])
408
+			: $this->organization_config->zip;
409
+		$this->organization_config->email = isset($form_data['organization_email'])
410
+			? sanitize_email($form_data['organization_email'])
411
+			: $this->organization_config->email;
412
+		$this->organization_config->vat = isset($form_data['organization_vat'])
413
+			? sanitize_text_field($form_data['organization_vat'])
414
+			: $this->organization_config->vat;
415
+		$this->organization_config->phone = isset($form_data['organization_phone'])
416
+			? sanitize_text_field($form_data['organization_phone'])
417
+			: $this->organization_config->phone;
418
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
419
+			? esc_url_raw($form_data['organization_logo_url'])
420
+			: $this->organization_config->logo_url;
421
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
422
+			? esc_url_raw($form_data['organization_facebook'])
423
+			: $this->organization_config->facebook;
424
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
425
+			? esc_url_raw($form_data['organization_twitter'])
426
+			: $this->organization_config->twitter;
427
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
428
+			? esc_url_raw($form_data['organization_linkedin'])
429
+			: $this->organization_config->linkedin;
430
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
431
+			? esc_url_raw($form_data['organization_pinterest'])
432
+			: $this->organization_config->pinterest;
433
+		$this->organization_config->google = isset($form_data['organization_google'])
434
+			? esc_url_raw($form_data['organization_google'])
435
+			: $this->organization_config->google;
436
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
437
+			? esc_url_raw($form_data['organization_instagram'])
438
+			: $this->organization_config->instagram;
439
+		$this->core_config->ee_ueip_optin = isset($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0])
440
+			? filter_var($form_data[ EE_Core_Config::OPTION_NAME_UXIP ][0], FILTER_VALIDATE_BOOLEAN)
441
+			: false;
442
+		$this->core_config->ee_ueip_has_notified = true;
443 443
 
444
-        $this->registry->CFG->currency = new EE_Currency_Config(
445
-            $this->organization_config->CNT_ISO
446
-        );
447
-        /** @var EE_Country $country */
448
-        $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
449
-        if ($country instanceof EE_Country) {
450
-            $country->set('CNT_active', 1);
451
-            $country->save();
452
-            $this->countrySubRegionDao->saveCountrySubRegions($country);
453
-        }
454
-        return true;
455
-    }
444
+		$this->registry->CFG->currency = new EE_Currency_Config(
445
+			$this->organization_config->CNT_ISO
446
+		);
447
+		/** @var EE_Country $country */
448
+		$country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
449
+		if ($country instanceof EE_Country) {
450
+			$country->set('CNT_active', 1);
451
+			$country->save();
452
+			$this->countrySubRegionDao->saveCountrySubRegions($country);
453
+		}
454
+		return true;
455
+	}
456 456
 }
Please login to merge, or discard this patch.
public/template_tags.php 1 patch
Indentation   +1056 added lines, -1056 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function is_espresso_event($event = null)
22 22
 {
23
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
24
-        // extract EE_Event object from passed param regardless of what it is (within reason of course)
25
-        $event = EEH_Event_View::get_event($event);
26
-        // do we have a valid event ?
27
-        return $event instanceof EE_Event;
28
-    }
29
-    return false;
23
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
24
+		// extract EE_Event object from passed param regardless of what it is (within reason of course)
25
+		$event = EEH_Event_View::get_event($event);
26
+		// do we have a valid event ?
27
+		return $event instanceof EE_Event;
28
+	}
29
+	return false;
30 30
 }
31 31
 
32 32
 /**
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function is_espresso_event_single()
39 39
 {
40
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
41
-        global $wp_query;
42
-        // return conditionals set by CPTs
43
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false;
44
-    }
45
-    return false;
40
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
41
+		global $wp_query;
42
+		// return conditionals set by CPTs
43
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_single : false;
44
+	}
45
+	return false;
46 46
 }
47 47
 
48 48
 /**
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
  */
54 54
 function is_espresso_event_archive()
55 55
 {
56
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
57
-        global $wp_query;
58
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false;
59
-    }
60
-    return false;
56
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
57
+		global $wp_query;
58
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_archive : false;
59
+	}
60
+	return false;
61 61
 }
62 62
 
63 63
 /**
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
  */
69 69
 function is_espresso_event_taxonomy()
70 70
 {
71
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
72
-        global $wp_query;
73
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false;
74
-    }
75
-    return false;
71
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
72
+		global $wp_query;
73
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_event_taxonomy : false;
74
+	}
75
+	return false;
76 76
 }
77 77
 
78 78
 /**
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
  */
87 87
 function is_espresso_venue($venue = null)
88 88
 {
89
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
90
-        // extract EE_Venue object from passed param regardless of what it is (within reason of course)
91
-        $venue = EEH_Venue_View::get_venue($venue, false);
92
-        // do we have a valid event ?
93
-        return $venue instanceof EE_Venue;
94
-    }
95
-    return false;
89
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
90
+		// extract EE_Venue object from passed param regardless of what it is (within reason of course)
91
+		$venue = EEH_Venue_View::get_venue($venue, false);
92
+		// do we have a valid event ?
93
+		return $venue instanceof EE_Venue;
94
+	}
95
+	return false;
96 96
 }
97 97
 
98 98
 /**
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function is_espresso_venue_single()
105 105
 {
106
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
107
-        global $wp_query;
108
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false;
109
-    }
110
-    return false;
106
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
107
+		global $wp_query;
108
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_single : false;
109
+	}
110
+	return false;
111 111
 }
112 112
 
113 113
 /**
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
  */
119 119
 function is_espresso_venue_archive()
120 120
 {
121
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
122
-        global $wp_query;
123
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false;
124
-    }
125
-    return false;
121
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
122
+		global $wp_query;
123
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_archive : false;
124
+	}
125
+	return false;
126 126
 }
127 127
 
128 128
 /**
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
  */
134 134
 function is_espresso_venue_taxonomy()
135 135
 {
136
-    if (can_use_espresso_conditionals(__FUNCTION__)) {
137
-        global $wp_query;
138
-        return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false;
139
-    }
140
-    return false;
136
+	if (can_use_espresso_conditionals(__FUNCTION__)) {
137
+		global $wp_query;
138
+		return $wp_query instanceof WP_Query ? $wp_query->is_espresso_venue_taxonomy : false;
139
+	}
140
+	return false;
141 141
 }
142 142
 
143 143
 /**
@@ -149,62 +149,62 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function can_use_espresso_conditionals($conditional_tag)
151 151
 {
152
-    if (! did_action('AHEE__EE_System__initialize')) {
153
-        EE_Error::doing_it_wrong(
154
-            __FUNCTION__,
155
-            sprintf(
156
-                esc_html__(
157
-                    'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.',
158
-                    'event_espresso'
159
-                ),
160
-                $conditional_tag
161
-            ),
162
-            '4.4.0'
163
-        );
164
-        return false;
165
-    }
166
-    return true;
152
+	if (! did_action('AHEE__EE_System__initialize')) {
153
+		EE_Error::doing_it_wrong(
154
+			__FUNCTION__,
155
+			sprintf(
156
+				esc_html__(
157
+					'The "%s" conditional tag can not be used until after the "init" hook has run, but works best when used within a theme\'s template files.',
158
+					'event_espresso'
159
+				),
160
+				$conditional_tag
161
+			),
162
+			'4.4.0'
163
+		);
164
+		return false;
165
+	}
166
+	return true;
167 167
 }
168 168
 
169 169
 
170 170
 /*************************** Event Queries ***************************/
171 171
 
172 172
 if (! function_exists('espresso_get_events')) {
173
-    /**
174
-     *    espresso_get_events
175
-     *
176
-     * @param array $params
177
-     * @return array
178
-     */
179
-    function espresso_get_events($params = [])
180
-    {
181
-        //set default params
182
-        $default_espresso_events_params = [
183
-            'limit'         => 10,
184
-            'show_expired'  => false,
185
-            'month'         => null,
186
-            'category_slug' => null,
187
-            'order_by'      => 'start_date',
188
-            'sort'          => 'ASC',
189
-        ];
190
-        // allow the defaults to be filtered
191
-        $default_espresso_events_params = apply_filters(
192
-            'espresso_get_events__default_espresso_events_params',
193
-            $default_espresso_events_params
194
-        );
195
-        // grab params and merge with defaults, then extract
196
-        $params = array_merge($default_espresso_events_params, $params);
197
-        // run the query
198
-        $events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params);
199
-        // assign results to a variable so we can return it
200
-        $events = $events_query->have_posts() ? $events_query->posts : [];
201
-        // but first reset the query and postdata
202
-        wp_reset_query();
203
-        wp_reset_postdata();
204
-        EED_Events_Archive::remove_all_events_archive_filters();
205
-        unset($events_query);
206
-        return $events;
207
-    }
173
+	/**
174
+	 *    espresso_get_events
175
+	 *
176
+	 * @param array $params
177
+	 * @return array
178
+	 */
179
+	function espresso_get_events($params = [])
180
+	{
181
+		//set default params
182
+		$default_espresso_events_params = [
183
+			'limit'         => 10,
184
+			'show_expired'  => false,
185
+			'month'         => null,
186
+			'category_slug' => null,
187
+			'order_by'      => 'start_date',
188
+			'sort'          => 'ASC',
189
+		];
190
+		// allow the defaults to be filtered
191
+		$default_espresso_events_params = apply_filters(
192
+			'espresso_get_events__default_espresso_events_params',
193
+			$default_espresso_events_params
194
+		);
195
+		// grab params and merge with defaults, then extract
196
+		$params = array_merge($default_espresso_events_params, $params);
197
+		// run the query
198
+		$events_query = new EventEspresso\core\domain\services\wp_queries\EventListQuery($params);
199
+		// assign results to a variable so we can return it
200
+		$events = $events_query->have_posts() ? $events_query->posts : [];
201
+		// but first reset the query and postdata
202
+		wp_reset_query();
203
+		wp_reset_postdata();
204
+		EED_Events_Archive::remove_all_events_archive_filters();
205
+		unset($events_query);
206
+		return $events;
207
+	}
208 208
 }
209 209
 
210 210
 
@@ -219,115 +219,115 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function espresso_load_ticket_selector()
221 221
 {
222
-    EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module');
222
+	EE_Registry::instance()->load_file(EE_MODULES . 'ticket_selector', 'EED_Ticket_Selector', 'module');
223 223
 }
224 224
 
225 225
 if (! function_exists('espresso_ticket_selector')) {
226
-    /**
227
-     * espresso_ticket_selector
228
-     *
229
-     * @param null $event
230
-     * @throws EE_Error
231
-     * @throws ReflectionException
232
-     */
233
-    function espresso_ticket_selector($event = null)
234
-    {
235
-        if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) {
236
-            espresso_load_ticket_selector();
237
-            EED_Ticket_Selector::set_definitions();
238
-            echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped
239
-        }
240
-    }
226
+	/**
227
+	 * espresso_ticket_selector
228
+	 *
229
+	 * @param null $event
230
+	 * @throws EE_Error
231
+	 * @throws ReflectionException
232
+	 */
233
+	function espresso_ticket_selector($event = null)
234
+	{
235
+		if (! apply_filters('FHEE_disable_espresso_ticket_selector', false)) {
236
+			espresso_load_ticket_selector();
237
+			EED_Ticket_Selector::set_definitions();
238
+			echo EED_Ticket_Selector::display_ticket_selector($event); // already escaped
239
+		}
240
+	}
241 241
 }
242 242
 
243 243
 
244 244
 if (! function_exists('espresso_view_details_btn')) {
245
-    /**
246
-     * espresso_view_details_btn
247
-     *
248
-     * @param null $event
249
-     * @throws EE_Error
250
-     * @throws ReflectionException
251
-     */
252
-    function espresso_view_details_btn($event = null)
253
-    {
254
-        if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) {
255
-            espresso_load_ticket_selector();
256
-            echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped
257
-        }
258
-    }
245
+	/**
246
+	 * espresso_view_details_btn
247
+	 *
248
+	 * @param null $event
249
+	 * @throws EE_Error
250
+	 * @throws ReflectionException
251
+	 */
252
+	function espresso_view_details_btn($event = null)
253
+	{
254
+		if (! apply_filters('FHEE_disable_espresso_view_details_btn', false)) {
255
+			espresso_load_ticket_selector();
256
+			echo EED_Ticket_Selector::display_ticket_selector($event, true); // already escaped
257
+		}
258
+	}
259 259
 }
260 260
 
261 261
 
262 262
 /*************************** EEH_Event_View ***************************/
263 263
 
264 264
 if (! function_exists('espresso_load_event_list_assets')) {
265
-    /**
266
-     * espresso_load_event_list_assets
267
-     * ensures that event list styles and scripts are loaded
268
-     *
269
-     * @return void
270
-     */
271
-    function espresso_load_event_list_assets()
272
-    {
273
-        $event_list = EED_Events_Archive::instance();
274
-        add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10);
275
-        add_filter('FHEE_enable_default_espresso_css', '__return_true');
276
-    }
265
+	/**
266
+	 * espresso_load_event_list_assets
267
+	 * ensures that event list styles and scripts are loaded
268
+	 *
269
+	 * @return void
270
+	 */
271
+	function espresso_load_event_list_assets()
272
+	{
273
+		$event_list = EED_Events_Archive::instance();
274
+		add_action('AHEE__EE_System__initialize_last', [$event_list, 'load_event_list_assets'], 10);
275
+		add_filter('FHEE_enable_default_espresso_css', '__return_true');
276
+	}
277 277
 }
278 278
 
279 279
 
280 280
 if (! function_exists('espresso_event_reg_button')) {
281
-    /**
282
-     * espresso_event_reg_button
283
-     * returns the "Register Now" button if event is active,
284
-     * an inactive button like status banner if the event is not active
285
-     * or a "Read More" button if so desired
286
-     *
287
-     * @param null $btn_text_if_active
288
-     * @param bool $btn_text_if_inactive
289
-     * @param bool $EVT_ID
290
-     * @return void
291
-     * @throws EE_Error
292
-     * @throws ReflectionException
293
-     */
294
-    function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false)
295
-    {
296
-        $event = EEH_Event_View::get_event($EVT_ID);
297
-        if (! $event instanceof EE_Event) {
298
-            return;
299
-        }
300
-        $event_status = $event->get_active_status();
301
-        switch ($event_status) {
302
-            case EE_Datetime::sold_out :
303
-                $btn_text = __('Sold Out', 'event_espresso');
304
-                $class    = 'ee-pink';
305
-                break;
306
-            case EE_Datetime::expired :
307
-                $btn_text = __('Event is Over', 'event_espresso');
308
-                $class    = 'ee-grey';
309
-                break;
310
-            case EE_Datetime::inactive :
311
-                $btn_text = __('Event Not Active', 'event_espresso');
312
-                $class    = 'ee-grey';
313
-                break;
314
-            case EE_Datetime::cancelled :
315
-                $btn_text = __('Event was Cancelled', 'event_espresso');
316
-                $class    = 'ee-red';
317
-                break;
318
-            case EE_Datetime::upcoming :
319
-            case EE_Datetime::active :
320
-            default :
321
-                $btn_text = ! empty($btn_text_if_active)
322
-                    ? $btn_text_if_active
323
-                    : __('Register Now', 'event_espresso');
324
-                $class    = 'ee-green';
325
-        }
326
-        if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
327
-            $btn_text = $btn_text_if_inactive;
328
-            $class    = 'ee-grey';
329
-        }
330
-        ?>
281
+	/**
282
+	 * espresso_event_reg_button
283
+	 * returns the "Register Now" button if event is active,
284
+	 * an inactive button like status banner if the event is not active
285
+	 * or a "Read More" button if so desired
286
+	 *
287
+	 * @param null $btn_text_if_active
288
+	 * @param bool $btn_text_if_inactive
289
+	 * @param bool $EVT_ID
290
+	 * @return void
291
+	 * @throws EE_Error
292
+	 * @throws ReflectionException
293
+	 */
294
+	function espresso_event_reg_button($btn_text_if_active = null, $btn_text_if_inactive = false, $EVT_ID = false)
295
+	{
296
+		$event = EEH_Event_View::get_event($EVT_ID);
297
+		if (! $event instanceof EE_Event) {
298
+			return;
299
+		}
300
+		$event_status = $event->get_active_status();
301
+		switch ($event_status) {
302
+			case EE_Datetime::sold_out :
303
+				$btn_text = __('Sold Out', 'event_espresso');
304
+				$class    = 'ee-pink';
305
+				break;
306
+			case EE_Datetime::expired :
307
+				$btn_text = __('Event is Over', 'event_espresso');
308
+				$class    = 'ee-grey';
309
+				break;
310
+			case EE_Datetime::inactive :
311
+				$btn_text = __('Event Not Active', 'event_espresso');
312
+				$class    = 'ee-grey';
313
+				break;
314
+			case EE_Datetime::cancelled :
315
+				$btn_text = __('Event was Cancelled', 'event_espresso');
316
+				$class    = 'ee-red';
317
+				break;
318
+			case EE_Datetime::upcoming :
319
+			case EE_Datetime::active :
320
+			default :
321
+				$btn_text = ! empty($btn_text_if_active)
322
+					? $btn_text_if_active
323
+					: __('Register Now', 'event_espresso');
324
+				$class    = 'ee-green';
325
+		}
326
+		if ($event_status < 1 && ! empty($btn_text_if_inactive)) {
327
+			$btn_text = $btn_text_if_inactive;
328
+			$class    = 'ee-grey';
329
+		}
330
+		?>
331 331
         <a class="ee-button ee-register-button <?php echo esc_attr($class); ?>"
332 332
             href="<?php espresso_event_link_url($EVT_ID); ?>"
333 333
             <?php echo AttributesSanitizer::clean(EED_Events_Archive::link_target(), AllowedTags::getAllowedTags(), 'a'); ?>
@@ -335,240 +335,240 @@  discard block
 block discarded – undo
335 335
             <?php echo esc_html($btn_text); ?>
336 336
         </a>
337 337
         <?php
338
-    }
338
+	}
339 339
 }
340 340
 
341 341
 
342 342
 if (! function_exists('espresso_display_ticket_selector')) {
343
-    /**
344
-     * espresso_display_ticket_selector
345
-     * whether or not to display the Ticket Selector for an event
346
-     *
347
-     * @param bool $EVT_ID
348
-     * @return boolean
349
-     * @throws EE_Error
350
-     * @throws ReflectionException
351
-     */
352
-    function espresso_display_ticket_selector($EVT_ID = false)
353
-    {
354
-        return EEH_Event_View::display_ticket_selector($EVT_ID);
355
-    }
343
+	/**
344
+	 * espresso_display_ticket_selector
345
+	 * whether or not to display the Ticket Selector for an event
346
+	 *
347
+	 * @param bool $EVT_ID
348
+	 * @return boolean
349
+	 * @throws EE_Error
350
+	 * @throws ReflectionException
351
+	 */
352
+	function espresso_display_ticket_selector($EVT_ID = false)
353
+	{
354
+		return EEH_Event_View::display_ticket_selector($EVT_ID);
355
+	}
356 356
 }
357 357
 
358 358
 
359 359
 if (! function_exists('espresso_event_status_banner')) {
360
-    /**
361
-     * espresso_event_status
362
-     * returns a banner showing the event status if it is sold out, expired, or inactive
363
-     *
364
-     * @param bool $EVT_ID
365
-     * @return string
366
-     * @throws EE_Error
367
-     * @throws ReflectionException
368
-     */
369
-    function espresso_event_status_banner($EVT_ID = false)
370
-    {
371
-        return EEH_Event_View::event_status($EVT_ID);
372
-    }
360
+	/**
361
+	 * espresso_event_status
362
+	 * returns a banner showing the event status if it is sold out, expired, or inactive
363
+	 *
364
+	 * @param bool $EVT_ID
365
+	 * @return string
366
+	 * @throws EE_Error
367
+	 * @throws ReflectionException
368
+	 */
369
+	function espresso_event_status_banner($EVT_ID = false)
370
+	{
371
+		return EEH_Event_View::event_status($EVT_ID);
372
+	}
373 373
 }
374 374
 
375 375
 
376 376
 if (! function_exists('espresso_event_status')) {
377
-    /**
378
-     * espresso_event_status
379
-     * returns the event status if it is sold out, expired, or inactive
380
-     *
381
-     * @param int  $EVT_ID
382
-     * @param bool $echo
383
-     * @return string
384
-     * @throws EE_Error
385
-     * @throws ReflectionException
386
-     */
387
-    function espresso_event_status($EVT_ID = 0, $echo = true)
388
-    {
389
-        return EEH_Event_View::event_active_status($EVT_ID, $echo);
390
-    }
377
+	/**
378
+	 * espresso_event_status
379
+	 * returns the event status if it is sold out, expired, or inactive
380
+	 *
381
+	 * @param int  $EVT_ID
382
+	 * @param bool $echo
383
+	 * @return string
384
+	 * @throws EE_Error
385
+	 * @throws ReflectionException
386
+	 */
387
+	function espresso_event_status($EVT_ID = 0, $echo = true)
388
+	{
389
+		return EEH_Event_View::event_active_status($EVT_ID, $echo);
390
+	}
391 391
 }
392 392
 
393 393
 
394 394
 if (! function_exists('espresso_event_categories')) {
395
-    /**
396
-     * espresso_event_categories
397
-     * returns the terms associated with an event
398
-     *
399
-     * @param int  $EVT_ID
400
-     * @param bool $hide_uncategorized
401
-     * @param bool $echo
402
-     * @return string
403
-     * @throws EE_Error
404
-     * @throws ReflectionException
405
-     */
406
-    function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true)
407
-    {
408
-        if ($echo) {
409
-            echo wp_kses(EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized), AllowedTags::getWithFormTags());
410
-            return '';
411
-        }
412
-        return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
413
-    }
395
+	/**
396
+	 * espresso_event_categories
397
+	 * returns the terms associated with an event
398
+	 *
399
+	 * @param int  $EVT_ID
400
+	 * @param bool $hide_uncategorized
401
+	 * @param bool $echo
402
+	 * @return string
403
+	 * @throws EE_Error
404
+	 * @throws ReflectionException
405
+	 */
406
+	function espresso_event_categories($EVT_ID = 0, $hide_uncategorized = true, $echo = true)
407
+	{
408
+		if ($echo) {
409
+			echo wp_kses(EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized), AllowedTags::getWithFormTags());
410
+			return '';
411
+		}
412
+		return EEH_Event_View::event_categories($EVT_ID, $hide_uncategorized);
413
+	}
414 414
 }
415 415
 
416 416
 
417 417
 if (! function_exists('espresso_event_tickets_available')) {
418
-    /**
419
-     * espresso_event_tickets_available
420
-     * returns the ticket types available for purchase for an event
421
-     *
422
-     * @param int  $EVT_ID
423
-     * @param bool $echo
424
-     * @param bool $format
425
-     * @return string
426
-     * @throws EE_Error
427
-     * @throws ReflectionException
428
-     */
429
-    function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true)
430
-    {
431
-        $tickets = EEH_Event_View::event_tickets_available($EVT_ID);
432
-        if (is_array($tickets) && ! empty($tickets)) {
433
-            // if formatting then $html will be a string, else it will be an array of ticket objects
434
-            $html =
435
-                $format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : [];
436
-            foreach ($tickets as $ticket) {
437
-                if ($ticket instanceof EE_Ticket) {
438
-                    if ($format) {
439
-                        $html .= '<li id="ee-event-tickets-li-'
440
-                                 . esc_attr($ticket->ID())
441
-                                 . '" class="ee-event-tickets-li">';
442
-                        $html .= esc_html($ticket->name()) . ' ';
443
-                        $html .= EEH_Template::format_currency(
444
-                            $ticket->get_ticket_total_with_taxes()
445
-                        ); // already escaped
446
-                        $html .= '</li>';
447
-                    } else {
448
-                        $html[] = $ticket;
449
-                    }
450
-                }
451
-            }
452
-            if ($format) {
453
-                $html .= '</ul>';
454
-            }
455
-            if ($echo && $format) {
456
-                echo wp_kses($html, AllowedTags::getAllowedTags());
457
-                return '';
458
-            }
459
-            return $html;
460
-        }
461
-        return '';
462
-    }
418
+	/**
419
+	 * espresso_event_tickets_available
420
+	 * returns the ticket types available for purchase for an event
421
+	 *
422
+	 * @param int  $EVT_ID
423
+	 * @param bool $echo
424
+	 * @param bool $format
425
+	 * @return string
426
+	 * @throws EE_Error
427
+	 * @throws ReflectionException
428
+	 */
429
+	function espresso_event_tickets_available($EVT_ID = 0, $echo = true, $format = true)
430
+	{
431
+		$tickets = EEH_Event_View::event_tickets_available($EVT_ID);
432
+		if (is_array($tickets) && ! empty($tickets)) {
433
+			// if formatting then $html will be a string, else it will be an array of ticket objects
434
+			$html =
435
+				$format ? '<ul id="ee-event-tickets-ul-' . esc_attr($EVT_ID) . '" class="ee-event-tickets-ul">' : [];
436
+			foreach ($tickets as $ticket) {
437
+				if ($ticket instanceof EE_Ticket) {
438
+					if ($format) {
439
+						$html .= '<li id="ee-event-tickets-li-'
440
+								 . esc_attr($ticket->ID())
441
+								 . '" class="ee-event-tickets-li">';
442
+						$html .= esc_html($ticket->name()) . ' ';
443
+						$html .= EEH_Template::format_currency(
444
+							$ticket->get_ticket_total_with_taxes()
445
+						); // already escaped
446
+						$html .= '</li>';
447
+					} else {
448
+						$html[] = $ticket;
449
+					}
450
+				}
451
+			}
452
+			if ($format) {
453
+				$html .= '</ul>';
454
+			}
455
+			if ($echo && $format) {
456
+				echo wp_kses($html, AllowedTags::getAllowedTags());
457
+				return '';
458
+			}
459
+			return $html;
460
+		}
461
+		return '';
462
+	}
463 463
 }
464 464
 
465 465
 if (! function_exists('espresso_event_date_obj')) {
466
-    /**
467
-     * espresso_event_date_obj
468
-     * returns the primary date object for an event
469
-     *
470
-     * @param bool $EVT_ID
471
-     * @return EE_Datetime|null
472
-     * @throws EE_Error
473
-     * @throws ReflectionException
474
-     */
475
-    function espresso_event_date_obj($EVT_ID = false)
476
-    {
477
-        return EEH_Event_View::get_primary_date_obj($EVT_ID);
478
-    }
466
+	/**
467
+	 * espresso_event_date_obj
468
+	 * returns the primary date object for an event
469
+	 *
470
+	 * @param bool $EVT_ID
471
+	 * @return EE_Datetime|null
472
+	 * @throws EE_Error
473
+	 * @throws ReflectionException
474
+	 */
475
+	function espresso_event_date_obj($EVT_ID = false)
476
+	{
477
+		return EEH_Event_View::get_primary_date_obj($EVT_ID);
478
+	}
479 479
 }
480 480
 
481 481
 
482 482
 if (! function_exists('espresso_event_date')) {
483
-    /**
484
-     * espresso_event_date
485
-     * returns the primary date for an event
486
-     *
487
-     * @param string $date_format
488
-     * @param string $time_format
489
-     * @param bool   $EVT_ID
490
-     * @param bool   $echo
491
-     * @return string
492
-     * @throws EE_Error
493
-     * @throws ReflectionException
494
-     */
495
-    function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
496
-    {
497
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
498
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
499
-        $date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
500
-        $time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
501
-        if ($echo) {
502
-            echo wp_kses(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags());
503
-            return '';
504
-        }
505
-        return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
506
-
507
-    }
483
+	/**
484
+	 * espresso_event_date
485
+	 * returns the primary date for an event
486
+	 *
487
+	 * @param string $date_format
488
+	 * @param string $time_format
489
+	 * @param bool   $EVT_ID
490
+	 * @param bool   $echo
491
+	 * @return string
492
+	 * @throws EE_Error
493
+	 * @throws ReflectionException
494
+	 */
495
+	function espresso_event_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
496
+	{
497
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
498
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
499
+		$date_format = apply_filters('FHEE__espresso_event_date__date_format', $date_format);
500
+		$time_format = apply_filters('FHEE__espresso_event_date__time_format', $time_format);
501
+		if ($echo) {
502
+			echo wp_kses(EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags());
503
+			return '';
504
+		}
505
+		return EEH_Event_View::the_event_date($date_format, $time_format, $EVT_ID);
506
+
507
+	}
508 508
 }
509 509
 
510 510
 
511 511
 if (! function_exists('espresso_list_of_event_dates')) {
512
-    /**
513
-     * espresso_list_of_event_dates
514
-     * returns a unordered list of dates for an event
515
-     *
516
-     * @param int    $EVT_ID
517
-     * @param string $date_format
518
-     * @param string $time_format
519
-     * @param bool   $echo
520
-     * @param null   $show_expired
521
-     * @param bool   $format
522
-     * @param bool   $add_breaks
523
-     * @param null   $limit
524
-     * @return string
525
-     * @throws EE_Error
526
-     * @throws ReflectionException
527
-     */
528
-    function espresso_list_of_event_dates(
529
-        $EVT_ID = 0,
530
-        $date_format = '',
531
-        $time_format = '',
532
-        $echo = true,
533
-        $show_expired = null,
534
-        $format = true,
535
-        $add_breaks = true,
536
-        $limit = null
537
-    ) {
538
-        $allowedtags = AllowedTags::getAllowedTags();
539
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
540
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
541
-        $date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
542
-        $time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
543
-        $datetimes   = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit);
544
-        if (! $format) {
545
-            return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
546
-        }
547
-        $newline = $add_breaks ? '<br />' : '';
548
-        if (is_array($datetimes) && ! empty($datetimes)) {
549
-            global $post;
550
-            $html =
551
-                '<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">';
552
-            foreach ($datetimes as $datetime) {
553
-                if ($datetime instanceof EE_Datetime) {
554
-
555
-                    $datetime_name        = $datetime->name();
556
-                    $datetime_html        = ! empty($datetime_name)
557
-                        ? '
512
+	/**
513
+	 * espresso_list_of_event_dates
514
+	 * returns a unordered list of dates for an event
515
+	 *
516
+	 * @param int    $EVT_ID
517
+	 * @param string $date_format
518
+	 * @param string $time_format
519
+	 * @param bool   $echo
520
+	 * @param null   $show_expired
521
+	 * @param bool   $format
522
+	 * @param bool   $add_breaks
523
+	 * @param null   $limit
524
+	 * @return string
525
+	 * @throws EE_Error
526
+	 * @throws ReflectionException
527
+	 */
528
+	function espresso_list_of_event_dates(
529
+		$EVT_ID = 0,
530
+		$date_format = '',
531
+		$time_format = '',
532
+		$echo = true,
533
+		$show_expired = null,
534
+		$format = true,
535
+		$add_breaks = true,
536
+		$limit = null
537
+	) {
538
+		$allowedtags = AllowedTags::getAllowedTags();
539
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
540
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
541
+		$date_format = apply_filters('FHEE__espresso_list_of_event_dates__date_format', $date_format);
542
+		$time_format = apply_filters('FHEE__espresso_list_of_event_dates__time_format', $time_format);
543
+		$datetimes   = EEH_Event_View::get_all_date_obj($EVT_ID, $show_expired, false, $limit);
544
+		if (! $format) {
545
+			return apply_filters('FHEE__espresso_list_of_event_dates__datetimes', $datetimes);
546
+		}
547
+		$newline = $add_breaks ? '<br />' : '';
548
+		if (is_array($datetimes) && ! empty($datetimes)) {
549
+			global $post;
550
+			$html =
551
+				'<ul id="ee-event-datetimes-ul-' . esc_attr($post->ID) . '" class="ee-event-datetimes-ul ee-clearfix">';
552
+			foreach ($datetimes as $datetime) {
553
+				if ($datetime instanceof EE_Datetime) {
554
+
555
+					$datetime_name        = $datetime->name();
556
+					$datetime_html        = ! empty($datetime_name)
557
+						? '
558 558
                         <strong class="ee-event-datetimes-li-date-name">
559 559
                           ' . esc_html($datetime_name) . '
560 560
                        </strong>' . $newline
561
-                        : '';
561
+						: '';
562 562
 
563
-                    $datetime_description = $datetime->description();
564
-                    $datetime_html .= ! empty($datetime_description)
565
-                        ? '
563
+					$datetime_description = $datetime->description();
564
+					$datetime_html .= ! empty($datetime_description)
565
+						? '
566 566
                         <span class="ee-event-datetimes-li-date-desc">
567 567
                             ' . wp_kses($datetime_description, $allowedtags) . '
568 568
                         </span>' . $newline
569
-                        : '';
569
+						: '';
570 570
 
571
-                    $datetime_html .= '
571
+					$datetime_html .= '
572 572
                         <span class="dashicons dashicons-calendar"></span>
573 573
                         <span class="ee-event-datetimes-li-daterange">' . $datetime->date_range($date_format) . '</span>
574 574
                         <br/>
@@ -576,482 +576,482 @@  discard block
 block discarded – undo
576 576
                         <span class="ee-event-datetimes-li-timerange">' . $datetime->time_range($time_format) . '</span>
577 577
                         ';
578 578
 
579
-                    $datetime_html = apply_filters(
580
-                        'FHEE__espresso_list_of_event_dates__datetime_html',
581
-                        $datetime_html,
582
-                        $datetime
583
-                    );
579
+					$datetime_html = apply_filters(
580
+						'FHEE__espresso_list_of_event_dates__datetime_html',
581
+						$datetime_html,
582
+						$datetime
583
+					);
584 584
 
585
-                    $DTD_ID        = esc_attr($datetime->ID());
586
-                    $active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status());
585
+					$DTD_ID        = esc_attr($datetime->ID());
586
+					$active_status = esc_attr(' ee-event-datetimes-li-' . $datetime->get_active_status());
587 587
 
588
-                    $html .= '
588
+					$html .= '
589 589
                     <li id="ee-event-datetimes-li-' . $DTD_ID . '" class="ee-event-datetimes-li' . $active_status . '">
590 590
                         ' . $datetime_html . '
591 591
                     </li>';
592
-                }
593
-            }
594
-            $html .= '</ul>';
595
-        } else {
596
-            $html =
597
-                '
592
+				}
593
+			}
594
+			$html .= '</ul>';
595
+		} else {
596
+			$html =
597
+				'
598 598
             <p>
599 599
                 <span class="dashicons dashicons-marker pink-text"></span>
600 600
                 ' . esc_html__(
601
-                    'There are no upcoming dates for this event.',
602
-                    'event_espresso'
603
-                ) . '
601
+					'There are no upcoming dates for this event.',
602
+					'event_espresso'
603
+				) . '
604 604
             </p>
605 605
             <br/>';
606
-        }
607
-        if ($echo) {
608
-            echo wp_kses($html, AllowedTags::getWithFormTags());
609
-            return '';
610
-        }
611
-        return $html;
612
-    }
606
+		}
607
+		if ($echo) {
608
+			echo wp_kses($html, AllowedTags::getWithFormTags());
609
+			return '';
610
+		}
611
+		return $html;
612
+	}
613 613
 }
614 614
 
615 615
 
616 616
 if (! function_exists('espresso_event_end_date')) {
617
-    /**
618
-     * espresso_event_end_date
619
-     * returns the last date for an event
620
-     *
621
-     * @param string $date_format
622
-     * @param string $time_format
623
-     * @param bool   $EVT_ID
624
-     * @param bool   $echo
625
-     * @return string
626
-     * @throws EE_Error
627
-     * @throws ReflectionException
628
-     */
629
-    function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
630
-    {
631
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
632
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
633
-        $date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
634
-        $time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
635
-        if ($echo) {
636
-            echo wp_kses(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags());
637
-            return '';
638
-        }
639
-        return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
640
-    }
617
+	/**
618
+	 * espresso_event_end_date
619
+	 * returns the last date for an event
620
+	 *
621
+	 * @param string $date_format
622
+	 * @param string $time_format
623
+	 * @param bool   $EVT_ID
624
+	 * @param bool   $echo
625
+	 * @return string
626
+	 * @throws EE_Error
627
+	 * @throws ReflectionException
628
+	 */
629
+	function espresso_event_end_date($date_format = '', $time_format = '', $EVT_ID = false, $echo = true)
630
+	{
631
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
632
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
633
+		$date_format = apply_filters('FHEE__espresso_event_end_date__date_format', $date_format);
634
+		$time_format = apply_filters('FHEE__espresso_event_end_date__time_format', $time_format);
635
+		if ($echo) {
636
+			echo wp_kses(EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID), AllowedTags::getWithFormTags());
637
+			return '';
638
+		}
639
+		return EEH_Event_View::the_event_end_date($date_format, $time_format, $EVT_ID);
640
+	}
641 641
 }
642 642
 
643 643
 if (! function_exists('espresso_event_date_range')) {
644
-    /**
645
-     * espresso_event_date_range
646
-     * returns the first and last chronologically ordered dates for an event (if different)
647
-     *
648
-     * @param string $date_format
649
-     * @param string $time_format
650
-     * @param string $single_date_format
651
-     * @param string $single_time_format
652
-     * @param bool   $EVT_ID
653
-     * @param bool   $echo
654
-     * @return string
655
-     * @throws EE_Error
656
-     * @throws ReflectionException
657
-     */
658
-    function espresso_event_date_range(
659
-        $date_format = '',
660
-        $time_format = '',
661
-        $single_date_format = '',
662
-        $single_time_format = '',
663
-        $EVT_ID = false,
664
-        $echo = true
665
-    ) {
666
-        // set and filter date and time formats when a range is returned
667
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
668
-        $date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
669
-        // get the start and end date with NO time portion
670
-        $the_event_date     = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
671
-        $the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
672
-        // now we can determine if date range spans more than one day
673
-        if ($the_event_date != $the_event_end_date) {
674
-            $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
675
-            $time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
676
-            $html        = sprintf(
677
-            /* translators: 1: first event date, 2: last event date */
678
-                esc_html__('%1$s - %2$s', 'event_espresso'),
679
-                EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
680
-                EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
681
-            );
682
-        } else {
683
-            // set and filter date and time formats when only a single datetime is returned
684
-            $single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
685
-            $single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
686
-            $single_date_format =
687
-                apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
688
-            $single_time_format =
689
-                apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
690
-            $html               =
691
-                EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
692
-        }
693
-        if ($echo) {
694
-            echo wp_kses($html, AllowedTags::getAllowedTags());
695
-            return '';
696
-        }
697
-        return $html;
698
-    }
644
+	/**
645
+	 * espresso_event_date_range
646
+	 * returns the first and last chronologically ordered dates for an event (if different)
647
+	 *
648
+	 * @param string $date_format
649
+	 * @param string $time_format
650
+	 * @param string $single_date_format
651
+	 * @param string $single_time_format
652
+	 * @param bool   $EVT_ID
653
+	 * @param bool   $echo
654
+	 * @return string
655
+	 * @throws EE_Error
656
+	 * @throws ReflectionException
657
+	 */
658
+	function espresso_event_date_range(
659
+		$date_format = '',
660
+		$time_format = '',
661
+		$single_date_format = '',
662
+		$single_time_format = '',
663
+		$EVT_ID = false,
664
+		$echo = true
665
+	) {
666
+		// set and filter date and time formats when a range is returned
667
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
668
+		$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', $date_format);
669
+		// get the start and end date with NO time portion
670
+		$the_event_date     = EEH_Event_View::the_earliest_event_date($date_format, '', $EVT_ID);
671
+		$the_event_end_date = EEH_Event_View::the_latest_event_date($date_format, '', $EVT_ID);
672
+		// now we can determine if date range spans more than one day
673
+		if ($the_event_date != $the_event_end_date) {
674
+			$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
675
+			$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', $time_format);
676
+			$html        = sprintf(
677
+			/* translators: 1: first event date, 2: last event date */
678
+				esc_html__('%1$s - %2$s', 'event_espresso'),
679
+				EEH_Event_View::the_earliest_event_date($date_format, $time_format, $EVT_ID),
680
+				EEH_Event_View::the_latest_event_date($date_format, $time_format, $EVT_ID)
681
+			);
682
+		} else {
683
+			// set and filter date and time formats when only a single datetime is returned
684
+			$single_date_format = ! empty($single_date_format) ? $single_date_format : get_option('date_format');
685
+			$single_time_format = ! empty($single_time_format) ? $single_time_format : get_option('time_format');
686
+			$single_date_format =
687
+				apply_filters('FHEE__espresso_event_date_range__single_date_format', $single_date_format);
688
+			$single_time_format =
689
+				apply_filters('FHEE__espresso_event_date_range__single_time_format', $single_time_format);
690
+			$html               =
691
+				EEH_Event_View::the_earliest_event_date($single_date_format, $single_time_format, $EVT_ID);
692
+		}
693
+		if ($echo) {
694
+			echo wp_kses($html, AllowedTags::getAllowedTags());
695
+			return '';
696
+		}
697
+		return $html;
698
+	}
699 699
 }
700 700
 
701 701
 if (! function_exists('espresso_next_upcoming_datetime_obj')) {
702
-    /**
703
-     * espresso_next_upcoming_datetime_obj
704
-     * returns the next upcoming datetime object for an event
705
-     *
706
-     * @param int $EVT_ID
707
-     * @return EE_Datetime|null
708
-     * @throws EE_Error
709
-     */
710
-    function espresso_next_upcoming_datetime_obj($EVT_ID = 0)
711
-    {
712
-        return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID);
713
-    }
702
+	/**
703
+	 * espresso_next_upcoming_datetime_obj
704
+	 * returns the next upcoming datetime object for an event
705
+	 *
706
+	 * @param int $EVT_ID
707
+	 * @return EE_Datetime|null
708
+	 * @throws EE_Error
709
+	 */
710
+	function espresso_next_upcoming_datetime_obj($EVT_ID = 0)
711
+	{
712
+		return EEH_Event_View::get_next_upcoming_date_obj($EVT_ID);
713
+	}
714 714
 }
715 715
 
716 716
 if (! function_exists('espresso_next_upcoming_datetime')) {
717
-    /**
718
-     * espresso_next_upcoming_datetime
719
-     * returns the start date and time for the next upcoming event.
720
-     *
721
-     * @param string $date_format
722
-     * @param string $time_format
723
-     * @param int    $EVT_ID
724
-     * @param bool   $echo
725
-     * @return string
726
-     * @throws EE_Error
727
-     * @throws ReflectionException
728
-     */
729
-    function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true)
730
-    {
731
-
732
-        $date_format = ! empty($date_format) ? $date_format : get_option('date_format');
733
-        $date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format);
734
-
735
-        $time_format = ! empty($time_format) ? $time_format : get_option('time_format');
736
-        $time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format);
737
-
738
-        $datetime_format = trim($date_format . ' ' . $time_format);
739
-
740
-        $datetime = espresso_next_upcoming_datetime_obj($EVT_ID);
741
-
742
-        if (! $datetime instanceof EE_Datetime) {
743
-            return '';
744
-        }
745
-        if ($echo) {
746
-            echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format));
747
-            return '';
748
-        }
749
-        return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format);
750
-    }
717
+	/**
718
+	 * espresso_next_upcoming_datetime
719
+	 * returns the start date and time for the next upcoming event.
720
+	 *
721
+	 * @param string $date_format
722
+	 * @param string $time_format
723
+	 * @param int    $EVT_ID
724
+	 * @param bool   $echo
725
+	 * @return string
726
+	 * @throws EE_Error
727
+	 * @throws ReflectionException
728
+	 */
729
+	function espresso_next_upcoming_datetime($date_format = '', $time_format = '', $EVT_ID = 0, $echo = true)
730
+	{
731
+
732
+		$date_format = ! empty($date_format) ? $date_format : get_option('date_format');
733
+		$date_format = apply_filters('FHEE__espresso_next_upcoming_datetime__date_format', $date_format);
734
+
735
+		$time_format = ! empty($time_format) ? $time_format : get_option('time_format');
736
+		$time_format = apply_filters('FHEE__espresso_next_upcoming_datetime__time_format', $time_format);
737
+
738
+		$datetime_format = trim($date_format . ' ' . $time_format);
739
+
740
+		$datetime = espresso_next_upcoming_datetime_obj($EVT_ID);
741
+
742
+		if (! $datetime instanceof EE_Datetime) {
743
+			return '';
744
+		}
745
+		if ($echo) {
746
+			echo esc_html($datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format));
747
+			return '';
748
+		}
749
+		return $datetime->get_i18n_datetime('DTT_EVT_start', $datetime_format);
750
+	}
751 751
 }
752 752
 
753 753
 if (! function_exists('espresso_event_date_as_calendar_page')) {
754
-    /**
755
-     * espresso_event_date_as_calendar_page
756
-     * returns the primary date for an event, stylized to appear as the page of a calendar
757
-     *
758
-     * @param bool $EVT_ID
759
-     * @return void
760
-     * @throws EE_Error
761
-     * @throws ReflectionException
762
-     */
763
-    function espresso_event_date_as_calendar_page($EVT_ID = false)
764
-    {
765
-        EEH_Event_View::event_date_as_calendar_page($EVT_ID);
766
-    }
754
+	/**
755
+	 * espresso_event_date_as_calendar_page
756
+	 * returns the primary date for an event, stylized to appear as the page of a calendar
757
+	 *
758
+	 * @param bool $EVT_ID
759
+	 * @return void
760
+	 * @throws EE_Error
761
+	 * @throws ReflectionException
762
+	 */
763
+	function espresso_event_date_as_calendar_page($EVT_ID = false)
764
+	{
765
+		EEH_Event_View::event_date_as_calendar_page($EVT_ID);
766
+	}
767 767
 }
768 768
 
769 769
 
770 770
 if (! function_exists('espresso_event_link_url')) {
771
-    /**
772
-     * espresso_event_link_url
773
-     *
774
-     * @param int  $EVT_ID
775
-     * @param bool $echo
776
-     * @return string
777
-     * @throws EE_Error
778
-     * @throws ReflectionException
779
-     */
780
-    function espresso_event_link_url($EVT_ID = 0, $echo = true)
781
-    {
782
-        if ($echo) {
783
-            echo wp_kses(EEH_Event_View::event_link_url($EVT_ID), AllowedTags::getWithFormTags());
784
-            return '';
785
-        }
786
-        return EEH_Event_View::event_link_url($EVT_ID);
787
-    }
771
+	/**
772
+	 * espresso_event_link_url
773
+	 *
774
+	 * @param int  $EVT_ID
775
+	 * @param bool $echo
776
+	 * @return string
777
+	 * @throws EE_Error
778
+	 * @throws ReflectionException
779
+	 */
780
+	function espresso_event_link_url($EVT_ID = 0, $echo = true)
781
+	{
782
+		if ($echo) {
783
+			echo wp_kses(EEH_Event_View::event_link_url($EVT_ID), AllowedTags::getWithFormTags());
784
+			return '';
785
+		}
786
+		return EEH_Event_View::event_link_url($EVT_ID);
787
+	}
788 788
 }
789 789
 
790 790
 
791 791
 if (! function_exists('espresso_event_has_content_or_excerpt')) {
792
-    /**
793
-     *    espresso_event_has_content_or_excerpt
794
-     *
795
-     * @access    public
796
-     * @param bool $EVT_ID
797
-     * @return    boolean
798
-     * @throws EE_Error
799
-     * @throws ReflectionException
800
-     */
801
-    function espresso_event_has_content_or_excerpt($EVT_ID = false)
802
-    {
803
-        return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
804
-    }
792
+	/**
793
+	 *    espresso_event_has_content_or_excerpt
794
+	 *
795
+	 * @access    public
796
+	 * @param bool $EVT_ID
797
+	 * @return    boolean
798
+	 * @throws EE_Error
799
+	 * @throws ReflectionException
800
+	 */
801
+	function espresso_event_has_content_or_excerpt($EVT_ID = false)
802
+	{
803
+		return EEH_Event_View::event_has_content_or_excerpt($EVT_ID);
804
+	}
805 805
 }
806 806
 
807 807
 
808 808
 if (! function_exists('espresso_event_content_or_excerpt')) {
809
-    /**
810
-     * espresso_event_content_or_excerpt
811
-     *
812
-     * @param int  $num_words
813
-     * @param null $more
814
-     * @param bool $echo
815
-     * @return string
816
-     */
817
-    function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true)
818
-    {
819
-        if ($echo) {
820
-            echo wp_kses(EEH_Event_View::event_content_or_excerpt($num_words, $more), AllowedTags::getWithFormTags());
821
-            return '';
822
-        }
823
-        return EEH_Event_View::event_content_or_excerpt($num_words, $more);
824
-    }
809
+	/**
810
+	 * espresso_event_content_or_excerpt
811
+	 *
812
+	 * @param int  $num_words
813
+	 * @param null $more
814
+	 * @param bool $echo
815
+	 * @return string
816
+	 */
817
+	function espresso_event_content_or_excerpt($num_words = 55, $more = null, $echo = true)
818
+	{
819
+		if ($echo) {
820
+			echo wp_kses(EEH_Event_View::event_content_or_excerpt($num_words, $more), AllowedTags::getWithFormTags());
821
+			return '';
822
+		}
823
+		return EEH_Event_View::event_content_or_excerpt($num_words, $more);
824
+	}
825 825
 }
826 826
 
827 827
 
828 828
 if (! function_exists('espresso_event_phone')) {
829
-    /**
830
-     * espresso_event_phone
831
-     *
832
-     * @param int  $EVT_ID
833
-     * @param bool $echo
834
-     * @return string
835
-     * @throws EE_Error
836
-     * @throws ReflectionException
837
-     */
838
-    function espresso_event_phone($EVT_ID = 0, $echo = true)
839
-    {
840
-        if ($echo) {
841
-            echo wp_kses(EEH_Event_View::event_phone($EVT_ID), AllowedTags::getWithFormTags());
842
-            return '';
843
-        }
844
-        return EEH_Event_View::event_phone($EVT_ID);
845
-    }
829
+	/**
830
+	 * espresso_event_phone
831
+	 *
832
+	 * @param int  $EVT_ID
833
+	 * @param bool $echo
834
+	 * @return string
835
+	 * @throws EE_Error
836
+	 * @throws ReflectionException
837
+	 */
838
+	function espresso_event_phone($EVT_ID = 0, $echo = true)
839
+	{
840
+		if ($echo) {
841
+			echo wp_kses(EEH_Event_View::event_phone($EVT_ID), AllowedTags::getWithFormTags());
842
+			return '';
843
+		}
844
+		return EEH_Event_View::event_phone($EVT_ID);
845
+	}
846 846
 }
847 847
 
848 848
 
849 849
 if (! function_exists('espresso_edit_event_link')) {
850
-    /**
851
-     * espresso_edit_event_link
852
-     * returns a link to edit an event
853
-     *
854
-     * @param int  $EVT_ID
855
-     * @param bool $echo
856
-     * @return string
857
-     * @throws EE_Error
858
-     * @throws ReflectionException
859
-     */
860
-    function espresso_edit_event_link($EVT_ID = 0, $echo = true)
861
-    {
862
-        if ($echo) {
863
-            echo wp_kses(EEH_Event_View::edit_event_link($EVT_ID), AllowedTags::getWithFormTags());
864
-            return '';
865
-        }
866
-        return EEH_Event_View::edit_event_link($EVT_ID);
867
-    }
850
+	/**
851
+	 * espresso_edit_event_link
852
+	 * returns a link to edit an event
853
+	 *
854
+	 * @param int  $EVT_ID
855
+	 * @param bool $echo
856
+	 * @return string
857
+	 * @throws EE_Error
858
+	 * @throws ReflectionException
859
+	 */
860
+	function espresso_edit_event_link($EVT_ID = 0, $echo = true)
861
+	{
862
+		if ($echo) {
863
+			echo wp_kses(EEH_Event_View::edit_event_link($EVT_ID), AllowedTags::getWithFormTags());
864
+			return '';
865
+		}
866
+		return EEH_Event_View::edit_event_link($EVT_ID);
867
+	}
868 868
 }
869 869
 
870 870
 
871 871
 if (! function_exists('espresso_organization_name')) {
872
-    /**
873
-     * espresso_organization_name
874
-     *
875
-     * @param bool $echo
876
-     * @return string
877
-     * @throws EE_Error
878
-     */
879
-    function espresso_organization_name($echo = true)
880
-    {
881
-        if ($echo) {
882
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('name'));
883
-            return '';
884
-        }
885
-        return EE_Registry::instance()->CFG->organization->get_pretty('name');
886
-    }
872
+	/**
873
+	 * espresso_organization_name
874
+	 *
875
+	 * @param bool $echo
876
+	 * @return string
877
+	 * @throws EE_Error
878
+	 */
879
+	function espresso_organization_name($echo = true)
880
+	{
881
+		if ($echo) {
882
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('name'));
883
+			return '';
884
+		}
885
+		return EE_Registry::instance()->CFG->organization->get_pretty('name');
886
+	}
887 887
 }
888 888
 
889 889
 if (! function_exists('espresso_organization_address')) {
890
-    /**
891
-     * espresso_organization_address
892
-     *
893
-     * @param string $type
894
-     * @return string
895
-     */
896
-    function espresso_organization_address($type = 'inline')
897
-    {
898
-        if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
899
-            $address = new EventEspresso\core\domain\entities\GenericAddress(
900
-                EE_Registry::instance()->CFG->organization->address_1,
901
-                EE_Registry::instance()->CFG->organization->address_2,
902
-                EE_Registry::instance()->CFG->organization->city,
903
-                EE_Registry::instance()->CFG->organization->STA_ID,
904
-                EE_Registry::instance()->CFG->organization->zip,
905
-                EE_Registry::instance()->CFG->organization->CNT_ISO
906
-            );
907
-            return EEH_Address::format($address, $type);
908
-        }
909
-        return '';
910
-    }
890
+	/**
891
+	 * espresso_organization_address
892
+	 *
893
+	 * @param string $type
894
+	 * @return string
895
+	 */
896
+	function espresso_organization_address($type = 'inline')
897
+	{
898
+		if (EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config) {
899
+			$address = new EventEspresso\core\domain\entities\GenericAddress(
900
+				EE_Registry::instance()->CFG->organization->address_1,
901
+				EE_Registry::instance()->CFG->organization->address_2,
902
+				EE_Registry::instance()->CFG->organization->city,
903
+				EE_Registry::instance()->CFG->organization->STA_ID,
904
+				EE_Registry::instance()->CFG->organization->zip,
905
+				EE_Registry::instance()->CFG->organization->CNT_ISO
906
+			);
907
+			return EEH_Address::format($address, $type);
908
+		}
909
+		return '';
910
+	}
911 911
 }
912 912
 
913 913
 if (! function_exists('espresso_organization_email')) {
914
-    /**
915
-     * espresso_organization_email
916
-     *
917
-     * @param bool $echo
918
-     * @return string
919
-     * @throws EE_Error
920
-     */
921
-    function espresso_organization_email($echo = true)
922
-    {
923
-        if ($echo) {
924
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('email'));
925
-            return '';
926
-        }
927
-        return EE_Registry::instance()->CFG->organization->get_pretty('email');
928
-    }
914
+	/**
915
+	 * espresso_organization_email
916
+	 *
917
+	 * @param bool $echo
918
+	 * @return string
919
+	 * @throws EE_Error
920
+	 */
921
+	function espresso_organization_email($echo = true)
922
+	{
923
+		if ($echo) {
924
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('email'));
925
+			return '';
926
+		}
927
+		return EE_Registry::instance()->CFG->organization->get_pretty('email');
928
+	}
929 929
 }
930 930
 
931 931
 if (! function_exists('espresso_organization_logo_url')) {
932
-    /**
933
-     * espresso_organization_logo_url
934
-     *
935
-     * @param bool $echo
936
-     * @return string
937
-     * @throws EE_Error
938
-     */
939
-    function espresso_organization_logo_url($echo = true)
940
-    {
941
-        if ($echo) {
942
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('logo_url'));
943
-            return '';
944
-        }
945
-        return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
946
-    }
932
+	/**
933
+	 * espresso_organization_logo_url
934
+	 *
935
+	 * @param bool $echo
936
+	 * @return string
937
+	 * @throws EE_Error
938
+	 */
939
+	function espresso_organization_logo_url($echo = true)
940
+	{
941
+		if ($echo) {
942
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('logo_url'));
943
+			return '';
944
+		}
945
+		return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
946
+	}
947 947
 }
948 948
 
949 949
 if (! function_exists('espresso_organization_facebook')) {
950
-    /**
951
-     * espresso_organization_facebook
952
-     *
953
-     * @param bool $echo
954
-     * @return string
955
-     * @throws EE_Error
956
-     */
957
-    function espresso_organization_facebook($echo = true)
958
-    {
959
-        if ($echo) {
960
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('facebook'));
961
-            return '';
962
-        }
963
-        return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
964
-    }
950
+	/**
951
+	 * espresso_organization_facebook
952
+	 *
953
+	 * @param bool $echo
954
+	 * @return string
955
+	 * @throws EE_Error
956
+	 */
957
+	function espresso_organization_facebook($echo = true)
958
+	{
959
+		if ($echo) {
960
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('facebook'));
961
+			return '';
962
+		}
963
+		return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
964
+	}
965 965
 }
966 966
 
967 967
 if (! function_exists('espresso_organization_twitter')) {
968
-    /**
969
-     * espresso_organization_twitter
970
-     *
971
-     * @param bool $echo
972
-     * @return string
973
-     * @throws EE_Error
974
-     */
975
-    function espresso_organization_twitter($echo = true)
976
-    {
977
-        if ($echo) {
978
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('twitter'));
979
-            return '';
980
-        }
981
-        return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
982
-    }
968
+	/**
969
+	 * espresso_organization_twitter
970
+	 *
971
+	 * @param bool $echo
972
+	 * @return string
973
+	 * @throws EE_Error
974
+	 */
975
+	function espresso_organization_twitter($echo = true)
976
+	{
977
+		if ($echo) {
978
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('twitter'));
979
+			return '';
980
+		}
981
+		return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
982
+	}
983 983
 }
984 984
 
985 985
 if (! function_exists('espresso_organization_linkedin')) {
986
-    /**
987
-     * espresso_organization_linkedin
988
-     *
989
-     * @param bool $echo
990
-     * @return string
991
-     * @throws EE_Error
992
-     */
993
-    function espresso_organization_linkedin($echo = true)
994
-    {
995
-        if ($echo) {
996
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('linkedin'));
997
-            return '';
998
-        }
999
-        return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
1000
-    }
986
+	/**
987
+	 * espresso_organization_linkedin
988
+	 *
989
+	 * @param bool $echo
990
+	 * @return string
991
+	 * @throws EE_Error
992
+	 */
993
+	function espresso_organization_linkedin($echo = true)
994
+	{
995
+		if ($echo) {
996
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('linkedin'));
997
+			return '';
998
+		}
999
+		return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
1000
+	}
1001 1001
 }
1002 1002
 
1003 1003
 if (! function_exists('espresso_organization_pinterest')) {
1004
-    /**
1005
-     * espresso_organization_pinterest
1006
-     *
1007
-     * @param bool $echo
1008
-     * @return string
1009
-     * @throws EE_Error
1010
-     */
1011
-    function espresso_organization_pinterest($echo = true)
1012
-    {
1013
-        if ($echo) {
1014
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('pinterest'));
1015
-            return '';
1016
-        }
1017
-        return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
1018
-    }
1004
+	/**
1005
+	 * espresso_organization_pinterest
1006
+	 *
1007
+	 * @param bool $echo
1008
+	 * @return string
1009
+	 * @throws EE_Error
1010
+	 */
1011
+	function espresso_organization_pinterest($echo = true)
1012
+	{
1013
+		if ($echo) {
1014
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('pinterest'));
1015
+			return '';
1016
+		}
1017
+		return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
1018
+	}
1019 1019
 }
1020 1020
 
1021 1021
 if (! function_exists('espresso_organization_google')) {
1022
-    /**
1023
-     * espresso_organization_google
1024
-     *
1025
-     * @param bool $echo
1026
-     * @return string
1027
-     * @throws EE_Error
1028
-     */
1029
-    function espresso_organization_google($echo = true)
1030
-    {
1031
-        if ($echo) {
1032
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('google'));
1033
-            return '';
1034
-        }
1035
-        return EE_Registry::instance()->CFG->organization->get_pretty('google');
1036
-    }
1022
+	/**
1023
+	 * espresso_organization_google
1024
+	 *
1025
+	 * @param bool $echo
1026
+	 * @return string
1027
+	 * @throws EE_Error
1028
+	 */
1029
+	function espresso_organization_google($echo = true)
1030
+	{
1031
+		if ($echo) {
1032
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('google'));
1033
+			return '';
1034
+		}
1035
+		return EE_Registry::instance()->CFG->organization->get_pretty('google');
1036
+	}
1037 1037
 }
1038 1038
 
1039 1039
 if (! function_exists('espresso_organization_instagram')) {
1040
-    /**
1041
-     * espresso_organization_instagram
1042
-     *
1043
-     * @param bool $echo
1044
-     * @return string
1045
-     * @throws EE_Error
1046
-     */
1047
-    function espresso_organization_instagram($echo = true)
1048
-    {
1049
-        if ($echo) {
1050
-            echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('instagram'));
1051
-            return '';
1052
-        }
1053
-        return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
1054
-    }
1040
+	/**
1041
+	 * espresso_organization_instagram
1042
+	 *
1043
+	 * @param bool $echo
1044
+	 * @return string
1045
+	 * @throws EE_Error
1046
+	 */
1047
+	function espresso_organization_instagram($echo = true)
1048
+	{
1049
+		if ($echo) {
1050
+			echo esc_html(EE_Registry::instance()->CFG->organization->get_pretty('instagram'));
1051
+			return '';
1052
+		}
1053
+		return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
1054
+	}
1055 1055
 }
1056 1056
 
1057 1057
 
@@ -1059,345 +1059,345 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 
1061 1061
 if (! function_exists('espresso_event_venues')) {
1062
-    /**
1063
-     * espresso_event_venues
1064
-     *
1065
-     * @return array  all venues related to an event
1066
-     * @throws EE_Error
1067
-     * @throws ReflectionException
1068
-     */
1069
-    function espresso_event_venues()
1070
-    {
1071
-        return EEH_Venue_View::get_event_venues();
1072
-    }
1062
+	/**
1063
+	 * espresso_event_venues
1064
+	 *
1065
+	 * @return array  all venues related to an event
1066
+	 * @throws EE_Error
1067
+	 * @throws ReflectionException
1068
+	 */
1069
+	function espresso_event_venues()
1070
+	{
1071
+		return EEH_Venue_View::get_event_venues();
1072
+	}
1073 1073
 }
1074 1074
 
1075 1075
 
1076 1076
 if (! function_exists('espresso_venue_id')) {
1077
-    /**
1078
-     *    espresso_venue_name
1079
-     *
1080
-     * @access    public
1081
-     * @param int $EVT_ID
1082
-     * @return    string
1083
-     * @throws EE_Error
1084
-     * @throws ReflectionException
1085
-     */
1086
-    function espresso_venue_id($EVT_ID = 0)
1087
-    {
1088
-        $venue = EEH_Venue_View::get_venue($EVT_ID);
1089
-        return $venue instanceof EE_Venue ? $venue->ID() : 0;
1090
-    }
1077
+	/**
1078
+	 *    espresso_venue_name
1079
+	 *
1080
+	 * @access    public
1081
+	 * @param int $EVT_ID
1082
+	 * @return    string
1083
+	 * @throws EE_Error
1084
+	 * @throws ReflectionException
1085
+	 */
1086
+	function espresso_venue_id($EVT_ID = 0)
1087
+	{
1088
+		$venue = EEH_Venue_View::get_venue($EVT_ID);
1089
+		return $venue instanceof EE_Venue ? $venue->ID() : 0;
1090
+	}
1091 1091
 }
1092 1092
 
1093 1093
 
1094 1094
 if (! function_exists('espresso_is_venue_private')) {
1095
-    /**
1096
-     * Return whether a venue is private or not.
1097
-     *
1098
-     * @param int $VNU_ID optional, the venue id to check.
1099
-     *
1100
-     * @return bool | null
1101
-     * @throws EE_Error
1102
-     * @throws ReflectionException
1103
-     * @see EEH_Venue_View::get_venue() for more info on expected return results.
1104
-     */
1105
-    function espresso_is_venue_private($VNU_ID = 0)
1106
-    {
1107
-        return EEH_Venue_View::is_venue_private($VNU_ID);
1108
-    }
1095
+	/**
1096
+	 * Return whether a venue is private or not.
1097
+	 *
1098
+	 * @param int $VNU_ID optional, the venue id to check.
1099
+	 *
1100
+	 * @return bool | null
1101
+	 * @throws EE_Error
1102
+	 * @throws ReflectionException
1103
+	 * @see EEH_Venue_View::get_venue() for more info on expected return results.
1104
+	 */
1105
+	function espresso_is_venue_private($VNU_ID = 0)
1106
+	{
1107
+		return EEH_Venue_View::is_venue_private($VNU_ID);
1108
+	}
1109 1109
 }
1110 1110
 
1111 1111
 
1112 1112
 if (! function_exists('espresso_venue_is_password_protected')) {
1113
-    /**
1114
-     * returns true or false if a venue is password protected or not
1115
-     *
1116
-     * @param int $VNU_ID optional, the venue id to check.
1117
-     * @return bool
1118
-     * @throws EE_Error
1119
-     * @throws ReflectionException
1120
-     */
1121
-    function espresso_venue_is_password_protected($VNU_ID = 0)
1122
-    {
1123
-        EE_Registry::instance()->load_helper('Venue_View');
1124
-        return EEH_Venue_View::is_venue_password_protected($VNU_ID);
1125
-    }
1113
+	/**
1114
+	 * returns true or false if a venue is password protected or not
1115
+	 *
1116
+	 * @param int $VNU_ID optional, the venue id to check.
1117
+	 * @return bool
1118
+	 * @throws EE_Error
1119
+	 * @throws ReflectionException
1120
+	 */
1121
+	function espresso_venue_is_password_protected($VNU_ID = 0)
1122
+	{
1123
+		EE_Registry::instance()->load_helper('Venue_View');
1124
+		return EEH_Venue_View::is_venue_password_protected($VNU_ID);
1125
+	}
1126 1126
 }
1127 1127
 
1128 1128
 
1129 1129
 if (! function_exists('espresso_password_protected_venue_form')) {
1130
-    /**
1131
-     * Returns a password form if venue is password protected.
1132
-     *
1133
-     * @param int $VNU_ID optional, the venue id to check.
1134
-     * @return string
1135
-     * @throws EE_Error
1136
-     * @throws ReflectionException
1137
-     */
1138
-    function espresso_password_protected_venue_form($VNU_ID = 0)
1139
-    {
1140
-        EE_Registry::instance()->load_helper('Venue_View');
1141
-        return EEH_Venue_View::password_protected_venue_form($VNU_ID);
1142
-    }
1130
+	/**
1131
+	 * Returns a password form if venue is password protected.
1132
+	 *
1133
+	 * @param int $VNU_ID optional, the venue id to check.
1134
+	 * @return string
1135
+	 * @throws EE_Error
1136
+	 * @throws ReflectionException
1137
+	 */
1138
+	function espresso_password_protected_venue_form($VNU_ID = 0)
1139
+	{
1140
+		EE_Registry::instance()->load_helper('Venue_View');
1141
+		return EEH_Venue_View::password_protected_venue_form($VNU_ID);
1142
+	}
1143 1143
 }
1144 1144
 
1145 1145
 
1146 1146
 if (! function_exists('espresso_venue_name')) {
1147
-    /**
1148
-     *    espresso_venue_name
1149
-     *
1150
-     * @access    public
1151
-     * @param int    $VNU_ID
1152
-     * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website
1153
-     * @param bool   $echo
1154
-     * @return    string
1155
-     * @throws EE_Error
1156
-     * @throws ReflectionException
1157
-     */
1158
-    function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true)
1159
-    {
1160
-        if ($echo) {
1161
-            echo wp_kses(EEH_Venue_View::venue_name($link_to, $VNU_ID), AllowedTags::getWithFormTags());
1162
-            return '';
1163
-        }
1164
-        return EEH_Venue_View::venue_name($link_to, $VNU_ID);
1165
-    }
1147
+	/**
1148
+	 *    espresso_venue_name
1149
+	 *
1150
+	 * @access    public
1151
+	 * @param int    $VNU_ID
1152
+	 * @param string $link_to - options( details, website, none ) whether to turn Venue name into a clickable link to the Venue's details page or website
1153
+	 * @param bool   $echo
1154
+	 * @return    string
1155
+	 * @throws EE_Error
1156
+	 * @throws ReflectionException
1157
+	 */
1158
+	function espresso_venue_name($VNU_ID = 0, $link_to = 'details', $echo = true)
1159
+	{
1160
+		if ($echo) {
1161
+			echo wp_kses(EEH_Venue_View::venue_name($link_to, $VNU_ID), AllowedTags::getWithFormTags());
1162
+			return '';
1163
+		}
1164
+		return EEH_Venue_View::venue_name($link_to, $VNU_ID);
1165
+	}
1166 1166
 }
1167 1167
 
1168 1168
 
1169 1169
 if (! function_exists('espresso_venue_link')) {
1170
-    /**
1171
-     *    espresso_venue_link
1172
-     *
1173
-     * @access    public
1174
-     * @param int    $VNU_ID
1175
-     * @param string $text
1176
-     * @return    string
1177
-     * @throws EE_Error
1178
-     * @throws ReflectionException
1179
-     */
1180
-    function espresso_venue_link($VNU_ID = 0, $text = '')
1181
-    {
1182
-        return EEH_Venue_View::venue_details_link($VNU_ID, $text);
1183
-    }
1170
+	/**
1171
+	 *    espresso_venue_link
1172
+	 *
1173
+	 * @access    public
1174
+	 * @param int    $VNU_ID
1175
+	 * @param string $text
1176
+	 * @return    string
1177
+	 * @throws EE_Error
1178
+	 * @throws ReflectionException
1179
+	 */
1180
+	function espresso_venue_link($VNU_ID = 0, $text = '')
1181
+	{
1182
+		return EEH_Venue_View::venue_details_link($VNU_ID, $text);
1183
+	}
1184 1184
 }
1185 1185
 
1186 1186
 
1187 1187
 if (! function_exists('espresso_venue_description')) {
1188
-    /**
1189
-     *    espresso_venue_description
1190
-     *
1191
-     * @access    public
1192
-     * @param bool $VNU_ID
1193
-     * @param bool $echo
1194
-     * @return    string
1195
-     * @throws EE_Error
1196
-     * @throws ReflectionException
1197
-     */
1198
-    function espresso_venue_description($VNU_ID = false, $echo = true)
1199
-    {
1200
-        if ($echo) {
1201
-            echo wp_kses(EEH_Venue_View::venue_description($VNU_ID), AllowedTags::getWithFormTags());
1202
-            return '';
1203
-        }
1204
-        return EEH_Venue_View::venue_description($VNU_ID);
1205
-    }
1188
+	/**
1189
+	 *    espresso_venue_description
1190
+	 *
1191
+	 * @access    public
1192
+	 * @param bool $VNU_ID
1193
+	 * @param bool $echo
1194
+	 * @return    string
1195
+	 * @throws EE_Error
1196
+	 * @throws ReflectionException
1197
+	 */
1198
+	function espresso_venue_description($VNU_ID = false, $echo = true)
1199
+	{
1200
+		if ($echo) {
1201
+			echo wp_kses(EEH_Venue_View::venue_description($VNU_ID), AllowedTags::getWithFormTags());
1202
+			return '';
1203
+		}
1204
+		return EEH_Venue_View::venue_description($VNU_ID);
1205
+	}
1206 1206
 }
1207 1207
 
1208 1208
 
1209 1209
 if (! function_exists('espresso_venue_excerpt')) {
1210
-    /**
1211
-     *    espresso_venue_excerpt
1212
-     *
1213
-     * @access    public
1214
-     * @param int  $VNU_ID
1215
-     * @param bool $echo
1216
-     * @return    string
1217
-     * @throws EE_Error
1218
-     * @throws ReflectionException
1219
-     */
1220
-    function espresso_venue_excerpt($VNU_ID = 0, $echo = true)
1221
-    {
1222
-        if ($echo) {
1223
-            echo wp_kses(EEH_Venue_View::venue_excerpt($VNU_ID), AllowedTags::getWithFormTags());
1224
-            return '';
1225
-        }
1226
-        return EEH_Venue_View::venue_excerpt($VNU_ID);
1227
-    }
1210
+	/**
1211
+	 *    espresso_venue_excerpt
1212
+	 *
1213
+	 * @access    public
1214
+	 * @param int  $VNU_ID
1215
+	 * @param bool $echo
1216
+	 * @return    string
1217
+	 * @throws EE_Error
1218
+	 * @throws ReflectionException
1219
+	 */
1220
+	function espresso_venue_excerpt($VNU_ID = 0, $echo = true)
1221
+	{
1222
+		if ($echo) {
1223
+			echo wp_kses(EEH_Venue_View::venue_excerpt($VNU_ID), AllowedTags::getWithFormTags());
1224
+			return '';
1225
+		}
1226
+		return EEH_Venue_View::venue_excerpt($VNU_ID);
1227
+	}
1228 1228
 }
1229 1229
 
1230 1230
 
1231 1231
 if (! function_exists('espresso_venue_categories')) {
1232
-    /**
1233
-     * espresso_venue_categories
1234
-     * returns the terms associated with a venue
1235
-     *
1236
-     * @param int  $VNU_ID
1237
-     * @param bool $hide_uncategorized
1238
-     * @param bool $echo
1239
-     * @return string
1240
-     * @throws EE_Error
1241
-     * @throws ReflectionException
1242
-     */
1243
-    function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true)
1244
-    {
1245
-        if ($echo) {
1246
-            echo wp_kses(EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized), AllowedTags::getWithFormTags());
1247
-            return '';
1248
-        }
1249
-        return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1250
-    }
1232
+	/**
1233
+	 * espresso_venue_categories
1234
+	 * returns the terms associated with a venue
1235
+	 *
1236
+	 * @param int  $VNU_ID
1237
+	 * @param bool $hide_uncategorized
1238
+	 * @param bool $echo
1239
+	 * @return string
1240
+	 * @throws EE_Error
1241
+	 * @throws ReflectionException
1242
+	 */
1243
+	function espresso_venue_categories($VNU_ID = 0, $hide_uncategorized = true, $echo = true)
1244
+	{
1245
+		if ($echo) {
1246
+			echo wp_kses(EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized), AllowedTags::getWithFormTags());
1247
+			return '';
1248
+		}
1249
+		return EEH_Venue_View::venue_categories($VNU_ID, $hide_uncategorized);
1250
+	}
1251 1251
 }
1252 1252
 
1253 1253
 
1254 1254
 if (! function_exists('espresso_venue_address')) {
1255
-    /**
1256
-     * espresso_venue_address
1257
-     * returns a formatted block of html  for displaying a venue's address
1258
-     *
1259
-     * @param string $type 'inline' or 'multiline'
1260
-     * @param int    $VNU_ID
1261
-     * @param bool   $echo
1262
-     * @return string
1263
-     * @throws EE_Error
1264
-     * @throws ReflectionException
1265
-     */
1266
-    function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1267
-    {
1268
-        if ($echo) {
1269
-            echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID), AllowedTags::getWithFormTags());
1270
-            return '';
1271
-        }
1272
-        return EEH_Venue_View::venue_address($type, $VNU_ID);
1273
-    }
1255
+	/**
1256
+	 * espresso_venue_address
1257
+	 * returns a formatted block of html  for displaying a venue's address
1258
+	 *
1259
+	 * @param string $type 'inline' or 'multiline'
1260
+	 * @param int    $VNU_ID
1261
+	 * @param bool   $echo
1262
+	 * @return string
1263
+	 * @throws EE_Error
1264
+	 * @throws ReflectionException
1265
+	 */
1266
+	function espresso_venue_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1267
+	{
1268
+		if ($echo) {
1269
+			echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID), AllowedTags::getWithFormTags());
1270
+			return '';
1271
+		}
1272
+		return EEH_Venue_View::venue_address($type, $VNU_ID);
1273
+	}
1274 1274
 }
1275 1275
 
1276 1276
 
1277 1277
 if (! function_exists('espresso_venue_raw_address')) {
1278
-    /**
1279
-     * espresso_venue_address
1280
-     * returns an UN-formatted string containing a venue's address
1281
-     *
1282
-     * @param string $type 'inline' or 'multiline'
1283
-     * @param int    $VNU_ID
1284
-     * @param bool   $echo
1285
-     * @return string
1286
-     * @throws EE_Error
1287
-     * @throws ReflectionException
1288
-     */
1289
-    function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1290
-    {
1291
-        if ($echo) {
1292
-            echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID, false, false), AllowedTags::getWithFormTags());
1293
-            return '';
1294
-        }
1295
-        return EEH_Venue_View::venue_address($type, $VNU_ID, false, false);
1296
-    }
1278
+	/**
1279
+	 * espresso_venue_address
1280
+	 * returns an UN-formatted string containing a venue's address
1281
+	 *
1282
+	 * @param string $type 'inline' or 'multiline'
1283
+	 * @param int    $VNU_ID
1284
+	 * @param bool   $echo
1285
+	 * @return string
1286
+	 * @throws EE_Error
1287
+	 * @throws ReflectionException
1288
+	 */
1289
+	function espresso_venue_raw_address($type = 'multiline', $VNU_ID = 0, $echo = true)
1290
+	{
1291
+		if ($echo) {
1292
+			echo wp_kses(EEH_Venue_View::venue_address($type, $VNU_ID, false, false), AllowedTags::getWithFormTags());
1293
+			return '';
1294
+		}
1295
+		return EEH_Venue_View::venue_address($type, $VNU_ID, false, false);
1296
+	}
1297 1297
 }
1298 1298
 
1299 1299
 
1300 1300
 if (! function_exists('espresso_venue_has_address')) {
1301
-    /**
1302
-     * espresso_venue_has_address
1303
-     * returns TRUE or FALSE if a Venue has address information
1304
-     *
1305
-     * @param int $VNU_ID
1306
-     * @return bool
1307
-     * @throws EE_Error
1308
-     * @throws ReflectionException
1309
-     */
1310
-    function espresso_venue_has_address($VNU_ID = 0)
1311
-    {
1312
-        return EEH_Venue_View::venue_has_address($VNU_ID);
1313
-    }
1301
+	/**
1302
+	 * espresso_venue_has_address
1303
+	 * returns TRUE or FALSE if a Venue has address information
1304
+	 *
1305
+	 * @param int $VNU_ID
1306
+	 * @return bool
1307
+	 * @throws EE_Error
1308
+	 * @throws ReflectionException
1309
+	 */
1310
+	function espresso_venue_has_address($VNU_ID = 0)
1311
+	{
1312
+		return EEH_Venue_View::venue_has_address($VNU_ID);
1313
+	}
1314 1314
 }
1315 1315
 
1316 1316
 
1317 1317
 if (! function_exists('espresso_venue_gmap')) {
1318
-    /**
1319
-     * espresso_venue_gmap
1320
-     * returns a google map for the venue address
1321
-     *
1322
-     * @param int   $VNU_ID
1323
-     * @param bool  $map_ID
1324
-     * @param array $gmap
1325
-     * @param bool  $echo
1326
-     * @return string
1327
-     * @throws EE_Error
1328
-     * @throws ReflectionException
1329
-     */
1330
-    function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true)
1331
-    {
1332
-        if ($echo) {
1333
-            echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped
1334
-            return '';
1335
-        }
1336
-        return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1337
-    }
1318
+	/**
1319
+	 * espresso_venue_gmap
1320
+	 * returns a google map for the venue address
1321
+	 *
1322
+	 * @param int   $VNU_ID
1323
+	 * @param bool  $map_ID
1324
+	 * @param array $gmap
1325
+	 * @param bool  $echo
1326
+	 * @return string
1327
+	 * @throws EE_Error
1328
+	 * @throws ReflectionException
1329
+	 */
1330
+	function espresso_venue_gmap($VNU_ID = 0, $map_ID = false, $gmap = [], $echo = true)
1331
+	{
1332
+		if ($echo) {
1333
+			echo EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap); // already escaped
1334
+			return '';
1335
+		}
1336
+		return EEH_Venue_View::venue_gmap($VNU_ID, $map_ID, $gmap);
1337
+	}
1338 1338
 }
1339 1339
 
1340 1340
 
1341 1341
 if (! function_exists('espresso_venue_phone')) {
1342
-    /**
1343
-     * espresso_venue_phone
1344
-     *
1345
-     * @param int  $VNU_ID
1346
-     * @param bool $echo
1347
-     * @return string
1348
-     * @throws EE_Error
1349
-     * @throws ReflectionException
1350
-     */
1351
-    function espresso_venue_phone($VNU_ID = 0, $echo = true)
1352
-    {
1353
-        if ($echo) {
1354
-            echo wp_kses(EEH_Venue_View::venue_phone($VNU_ID), AllowedTags::getWithFormTags());
1355
-            return '';
1356
-        }
1357
-        return EEH_Venue_View::venue_phone($VNU_ID);
1358
-    }
1342
+	/**
1343
+	 * espresso_venue_phone
1344
+	 *
1345
+	 * @param int  $VNU_ID
1346
+	 * @param bool $echo
1347
+	 * @return string
1348
+	 * @throws EE_Error
1349
+	 * @throws ReflectionException
1350
+	 */
1351
+	function espresso_venue_phone($VNU_ID = 0, $echo = true)
1352
+	{
1353
+		if ($echo) {
1354
+			echo wp_kses(EEH_Venue_View::venue_phone($VNU_ID), AllowedTags::getWithFormTags());
1355
+			return '';
1356
+		}
1357
+		return EEH_Venue_View::venue_phone($VNU_ID);
1358
+	}
1359 1359
 }
1360 1360
 
1361 1361
 
1362 1362
 if (! function_exists('espresso_venue_website')) {
1363
-    /**
1364
-     * espresso_venue_website
1365
-     *
1366
-     * @param int  $VNU_ID
1367
-     * @param bool $echo
1368
-     * @return string
1369
-     * @throws EE_Error
1370
-     * @throws ReflectionException
1371
-     */
1372
-    function espresso_venue_website($VNU_ID = 0, $echo = true)
1373
-    {
1374
-        if ($echo) {
1375
-            echo wp_kses(EEH_Venue_View::venue_website_link($VNU_ID), AllowedTags::getWithFormTags());
1376
-            return '';
1377
-        }
1378
-        return EEH_Venue_View::venue_website_link($VNU_ID);
1379
-    }
1363
+	/**
1364
+	 * espresso_venue_website
1365
+	 *
1366
+	 * @param int  $VNU_ID
1367
+	 * @param bool $echo
1368
+	 * @return string
1369
+	 * @throws EE_Error
1370
+	 * @throws ReflectionException
1371
+	 */
1372
+	function espresso_venue_website($VNU_ID = 0, $echo = true)
1373
+	{
1374
+		if ($echo) {
1375
+			echo wp_kses(EEH_Venue_View::venue_website_link($VNU_ID), AllowedTags::getWithFormTags());
1376
+			return '';
1377
+		}
1378
+		return EEH_Venue_View::venue_website_link($VNU_ID);
1379
+	}
1380 1380
 }
1381 1381
 
1382 1382
 
1383 1383
 if (! function_exists('espresso_edit_venue_link')) {
1384
-    /**
1385
-     * espresso_edit_venue_link
1386
-     *
1387
-     * @param int  $VNU_ID
1388
-     * @param bool $echo
1389
-     * @return string
1390
-     * @throws EE_Error
1391
-     * @throws ReflectionException
1392
-     */
1393
-    function espresso_edit_venue_link($VNU_ID = 0, $echo = true)
1394
-    {
1395
-        if ($echo) {
1396
-            echo wp_kses(EEH_Venue_View::edit_venue_link($VNU_ID), AllowedTags::getWithFormTags());
1397
-            return '';
1398
-        }
1399
-        return EEH_Venue_View::edit_venue_link($VNU_ID);
1400
-    }
1384
+	/**
1385
+	 * espresso_edit_venue_link
1386
+	 *
1387
+	 * @param int  $VNU_ID
1388
+	 * @param bool $echo
1389
+	 * @return string
1390
+	 * @throws EE_Error
1391
+	 * @throws ReflectionException
1392
+	 */
1393
+	function espresso_edit_venue_link($VNU_ID = 0, $echo = true)
1394
+	{
1395
+		if ($echo) {
1396
+			echo wp_kses(EEH_Venue_View::edit_venue_link($VNU_ID), AllowedTags::getWithFormTags());
1397
+			return '';
1398
+		}
1399
+		return EEH_Venue_View::edit_venue_link($VNU_ID);
1400
+	}
1401 1401
 }
1402 1402
 
1403 1403
 
Please login to merge, or discard this patch.
caffeinated/brewing_regular.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
         $this->_table_analysis = $table_analysis;
58 58
         if (defined('EE_CAFF_PATH')) {
59 59
             // defined some new constants related to caffeinated folder
60
-            define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/');
61
-            define('EE_CAF_CORE', EE_CAFF_PATH . 'core/');
62
-            define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/');
63
-            define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/');
60
+            define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/');
61
+            define('EE_CAF_CORE', EE_CAFF_PATH.'core/');
62
+            define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries/');
63
+            define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods/');
64 64
         }
65 65
     }
66 66
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
         add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10);
110 110
         add_filter(
111 111
             'AHEE__EE_System__load_core_configuration__complete',
112
-            function () {
112
+            function() {
113 113
                 EE_Register_Payment_Method::register(
114 114
                     'caffeinated_payment_methods',
115 115
                     [
116
-                        'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR),
116
+                        'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR),
117 117
                     ]
118 118
                 );
119 119
             }
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function caf_helper_paths(array $paths): array
170 170
     {
171
-        $paths[] = EE_CAF_CORE . 'helpers/';
171
+        $paths[] = EE_CAF_CORE.'helpers/';
172 172
         return $paths;
173 173
     }
174 174
 
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
         global $wpdb;
190 190
         // use same method of getting creator id as the version introducing the change
191 191
         $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
192
-        $price_type_table   = $wpdb->prefix . "esp_price_type";
193
-        $price_table        = $wpdb->prefix . "esp_price";
192
+        $price_type_table   = $wpdb->prefix."esp_price_type";
193
+        $price_table        = $wpdb->prefix."esp_price";
194 194
         if ($this->_get_table_analysis()->tableExists($price_type_table)) {
195 195
             $SQL                  =
196
-                'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types
196
+                'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types
197 197
             $tax_price_type_count = $wpdb->get_var($SQL);
198 198
             if ($tax_price_type_count <= 1) {
199 199
                 $wpdb->insert(
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
                         'PRT_wp_user'    => $default_creator_id,
208 208
                     ],
209 209
                     [
210
-                        '%s',// PRT_name
211
-                        '%d',// PBT_id
212
-                        '%d',// PRT_is_percent
213
-                        '%d',// PRT_order
214
-                        '%d',// PRT_deleted
210
+                        '%s', // PRT_name
211
+                        '%d', // PBT_id
212
+                        '%d', // PRT_is_percent
213
+                        '%d', // PRT_order
214
+                        '%d', // PRT_deleted
215 215
                         '%d', // PRT_wp_user
216 216
                     ]
217 217
                 );
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
                         'PRT_wp_user'    => $default_creator_id,
228 228
                     ],
229 229
                     [
230
-                        '%s',// PRT_name
231
-                        '%d',// PBT_id
232
-                        '%d',// PRT_is_percent
233
-                        '%d',// PRT_order
234
-                        '%d',// PRT_deleted
230
+                        '%s', // PRT_name
231
+                        '%d', // PBT_id
232
+                        '%d', // PRT_is_percent
233
+                        '%d', // PRT_order
234
+                        '%d', // PRT_deleted
235 235
                         '%d' // PRT_wp_user
236 236
                     ]
237 237
                 );
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
                             'PRC_wp_user'    => $default_creator_id,
252 252
                         ],
253 253
                         [
254
-                            '%d',// PRT_id
255
-                            '%f',// PRC_amount
256
-                            '%s',// PRC_name
257
-                            '%s',// PRC_desc
258
-                            '%d',// PRC_is_default
259
-                            '%d',// PRC_overrides
260
-                            '%d',// PRC_deleted
261
-                            '%d',// PRC_order
262
-                            '%d',// PRC_parent
254
+                            '%d', // PRT_id
255
+                            '%f', // PRC_amount
256
+                            '%s', // PRC_name
257
+                            '%s', // PRC_desc
258
+                            '%d', // PRC_is_default
259
+                            '%d', // PRC_overrides
260
+                            '%d', // PRC_deleted
261
+                            '%d', // PRC_order
262
+                            '%d', // PRC_parent
263 263
                             '%d' // PRC_wp_user
264 264
                         ]
265 265
                     );
@@ -278,8 +278,8 @@  discard block
 block discarded – undo
278 278
      */
279 279
     public function caffeinated_modules_to_register(array $modules_to_register = []): array
280 280
     {
281
-        if (is_readable(EE_CAFF_PATH . 'modules')) {
282
-            $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR);
281
+        if (is_readable(EE_CAFF_PATH.'modules')) {
282
+            $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules/*', GLOB_ONLYDIR);
283 283
             if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
284 284
                 $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
285 285
             }
Please login to merge, or discard this patch.
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -23,356 +23,356 @@
 block discarded – undo
23 23
  */
24 24
 class EE_Brewing_Regular extends EE_BASE implements InterminableInterface
25 25
 {
26
-    /**
27
-     * @var EE_Dependency_Map
28
-     */
29
-    protected $dependency_map;
30
-
31
-    /**
32
-     * @var LoaderInterface
33
-     */
34
-    protected $loader;
35
-
36
-    /**
37
-     * @var TableAnalysis
38
-     */
39
-    protected $_table_analysis;
40
-
41
-
42
-    /**
43
-     * EE_Brewing_Regular constructor.
44
-     *
45
-     * @param EE_Dependency_Map $dependency_map
46
-     * @param LoaderInterface   $loader
47
-     * @param TableAnalysis     $table_analysis
48
-     */
49
-    public function __construct(
50
-        EE_Dependency_Map $dependency_map,
51
-        LoaderInterface $loader,
52
-        TableAnalysis $table_analysis
53
-    ) {
54
-        $this->dependency_map = $dependency_map;
55
-        $this->loader         = $loader;
56
-        $this->_table_analysis = $table_analysis;
57
-        if (defined('EE_CAFF_PATH')) {
58
-            // defined some new constants related to caffeinated folder
59
-            define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/');
60
-            define('EE_CAF_CORE', EE_CAFF_PATH . 'core/');
61
-            define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/');
62
-            define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/');
63
-        }
64
-    }
65
-
66
-
67
-    /**
68
-     * @throws EE_Error
69
-     */
70
-    public function caffeinated()
71
-    {
72
-        $this->setInitializationHooks();
73
-        $this->setApiRegistrationHooks();
74
-        $this->setSwitchHooks();
75
-        $this->setDefaultFilterHooks();
76
-        // caffeinated constructed
77
-        do_action('AHEE__EE_Brewing_Regular__construct__complete');
78
-    }
79
-
80
-
81
-    public function initializePUE()
82
-    {
83
-        $this->dependency_map->registerDependencies(
84
-            PueLicensingManager::class,
85
-            [
86
-                'EE_Dependency_Map'                          => EE_Dependency_Map::load_from_cache,
87
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
88
-            ]
89
-        );
90
-        /** @var PueLicensingManager $pue_manager */
91
-        $pue_manager = $this->loader->getShared(PueLicensingManager::class);
92
-        $pue_manager->registerDependencies();
93
-        $pue_manager->registerHooks();
94
-    }
95
-
96
-
97
-    /**
98
-     * Various hooks used for extending features via registration of modules or extensions.
99
-     *
100
-     * @throws EE_Error
101
-     */
102
-    private function setApiRegistrationHooks()
103
-    {
104
-        add_filter(
105
-            'FHEE__EE_Config__register_modules__modules_to_register',
106
-            [$this, 'caffeinated_modules_to_register']
107
-        );
108
-        add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10);
109
-        add_filter(
110
-            'AHEE__EE_System__load_core_configuration__complete',
111
-            function () {
112
-                EE_Register_Payment_Method::register(
113
-                    'caffeinated_payment_methods',
114
-                    [
115
-                        'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR),
116
-                    ]
117
-                );
118
-            }
119
-        );
120
-    }
121
-
122
-
123
-    /**
124
-     * Various hooks used for modifying initialization or activation processes.
125
-     */
126
-    private function setInitializationHooks()
127
-    {
128
-        // activation
129
-        add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']);
130
-        // load caff init
131
-        add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']);
132
-        // load caff scripts
133
-        add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10);
134
-    }
135
-
136
-
137
-    /**
138
-     * Various hooks used for switch (on/off) type filters.
139
-     */
140
-    private function setSwitchHooks()
141
-    {
142
-        // remove the "powered by" credit link from receipts and invoices
143
-        add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false');
144
-        // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer
145
-        add_filter('FHEE__ee_show_affiliate_links', '__return_false');
146
-    }
147
-
148
-
149
-    /**
150
-     * Various filters for affecting default configuration values in the caffeinated
151
-     * context.
152
-     */
153
-    private function setDefaultFilterHooks()
154
-    {
155
-        add_filter(
156
-            'FHEE__EE_Admin_Config__show_reg_footer__default',
157
-            '__return_true'
158
-        );
159
-    }
160
-
161
-
162
-    /**
163
-     * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
164
-     *
165
-     * @param array $paths original helper paths array
166
-     * @return array             new array of paths
167
-     */
168
-    public function caf_helper_paths(array $paths): array
169
-    {
170
-        $paths[] = EE_CAF_CORE . 'helpers/';
171
-        return $paths;
172
-    }
173
-
174
-
175
-    /**
176
-     * Upon brand-new activation, if this is a new activation of CAF, we want to add
177
-     * some global prices that will show off EE4's capabilities. However, if they're upgrading
178
-     * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices.
179
-     * This action should only be called when EE 4.x.0.P is initially activated.
180
-     * Right now the only CAF content are these global prices. If there's more in the future, then
181
-     * we should probably create a caf file to contain it all instead just a function like this.
182
-     * Right now, we ASSUME the only price types in the system are default ones
183
-     *
184
-     * @global wpdb $wpdb
185
-     */
186
-    public function initialize_caf_db_content()
187
-    {
188
-        global $wpdb;
189
-        // use same method of getting creator id as the version introducing the change
190
-        $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
191
-        $price_type_table   = $wpdb->prefix . "esp_price_type";
192
-        $price_table        = $wpdb->prefix . "esp_price";
193
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
194
-            $SQL                  =
195
-                'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types
196
-            $tax_price_type_count = $wpdb->get_var($SQL);
197
-            if ($tax_price_type_count <= 1) {
198
-                $wpdb->insert(
199
-                    $price_type_table,
200
-                    [
201
-                        'PRT_name'       => esc_html__("Regional Tax", "event_espresso"),
202
-                        'PBT_ID'         => 4,
203
-                        'PRT_is_percent' => true,
204
-                        'PRT_order'      => 60,
205
-                        'PRT_deleted'    => false,
206
-                        'PRT_wp_user'    => $default_creator_id,
207
-                    ],
208
-                    [
209
-                        '%s',// PRT_name
210
-                        '%d',// PBT_id
211
-                        '%d',// PRT_is_percent
212
-                        '%d',// PRT_order
213
-                        '%d',// PRT_deleted
214
-                        '%d', // PRT_wp_user
215
-                    ]
216
-                );
217
-                // federal tax
218
-                $result = $wpdb->insert(
219
-                    $price_type_table,
220
-                    [
221
-                        'PRT_name'       => esc_html__("Federal Tax", "event_espresso"),
222
-                        'PBT_ID'         => 4,
223
-                        'PRT_is_percent' => true,
224
-                        'PRT_order'      => 70,
225
-                        'PRT_deleted'    => false,
226
-                        'PRT_wp_user'    => $default_creator_id,
227
-                    ],
228
-                    [
229
-                        '%s',// PRT_name
230
-                        '%d',// PBT_id
231
-                        '%d',// PRT_is_percent
232
-                        '%d',// PRT_order
233
-                        '%d',// PRT_deleted
234
-                        '%d' // PRT_wp_user
235
-                    ]
236
-                );
237
-                if ($result) {
238
-                    $wpdb->insert(
239
-                        $price_table,
240
-                        [
241
-                            'PRT_ID'         => $wpdb->insert_id,
242
-                            'PRC_amount'     => 15.00,
243
-                            'PRC_name'       => esc_html__("Sales Tax", "event_espresso"),
244
-                            'PRC_desc'       => '',
245
-                            'PRC_is_default' => true,
246
-                            'PRC_overrides'  => null,
247
-                            'PRC_deleted'    => false,
248
-                            'PRC_order'      => 50,
249
-                            'PRC_parent'     => null,
250
-                            'PRC_wp_user'    => $default_creator_id,
251
-                        ],
252
-                        [
253
-                            '%d',// PRT_id
254
-                            '%f',// PRC_amount
255
-                            '%s',// PRC_name
256
-                            '%s',// PRC_desc
257
-                            '%d',// PRC_is_default
258
-                            '%d',// PRC_overrides
259
-                            '%d',// PRC_deleted
260
-                            '%d',// PRC_order
261
-                            '%d',// PRC_parent
262
-                            '%d' // PRC_wp_user
263
-                        ]
264
-                    );
265
-                }
266
-            }
267
-        }
268
-    }
269
-
270
-
271
-    /**
272
-     *    caffeinated_modules_to_register
273
-     *
274
-     * @access public
275
-     * @param array $modules_to_register
276
-     * @return array
277
-     */
278
-    public function caffeinated_modules_to_register(array $modules_to_register = []): array
279
-    {
280
-        if (is_readable(EE_CAFF_PATH . 'modules')) {
281
-            $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR);
282
-            if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
283
-                $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
284
-            }
285
-        }
286
-        return $modules_to_register;
287
-    }
288
-
289
-
290
-    /**
291
-     * @throws EE_Error
292
-     * @throws InvalidArgumentException
293
-     * @throws ReflectionException
294
-     * @throws InvalidDataTypeException
295
-     * @throws InvalidInterfaceException
296
-     */
297
-    public function caffeinated_init()
298
-    {
299
-        // Custom Post Type hooks
300
-        add_filter(
301
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
302
-            [$this, 'filter_taxonomies']
303
-        );
304
-        add_filter(
305
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
306
-            [$this, 'filter_cpts']
307
-        );
308
-        add_filter(
309
-            'FHEE__EE_Admin__get_extra_nav_menu_pages_items',
310
-            [$this, 'nav_metabox_items']
311
-        );
312
-        EE_Registry::instance()->load_file(
313
-            EE_CAFF_PATH,
314
-            'EE_Caf_Messages',
315
-            'class',
316
-            [],
317
-            false
318
-        );
319
-        // caffeinated_init__complete hook
320
-        do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
321
-    }
322
-
323
-
324
-    public function enqueue_caffeinated_scripts()
325
-    {
326
-        // sound of crickets...
327
-    }
328
-
329
-
330
-    /**
331
-     * callbacks below here
332
-     *
333
-     * @param array $taxonomy_array
334
-     * @return array
335
-     */
336
-    public function filter_taxonomies(array $taxonomy_array): array
337
-    {
338
-        $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true;
339
-        return $taxonomy_array;
340
-    }
341
-
342
-
343
-    /**
344
-     * @param array $cpt_array
345
-     * @return array
346
-     */
347
-    public function filter_cpts(array $cpt_array): array
348
-    {
349
-        $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true;
350
-        return $cpt_array;
351
-    }
352
-
353
-
354
-    /**
355
-     * @param array $menu_items
356
-     * @return array
357
-     */
358
-    public function nav_metabox_items(array $menu_items): array
359
-    {
360
-        $menu_items[] = [
361
-            'title'       => esc_html__('Venue List', 'event_espresso'),
362
-            'url'         => get_post_type_archive_link('espresso_venues'),
363
-            'description' => esc_html__('Archive page for all venues.', 'event_espresso'),
364
-        ];
365
-        return $menu_items;
366
-    }
367
-
368
-
369
-    /**
370
-     * Gets the injected table analyzer, or throws an exception
371
-     *
372
-     * @return TableAnalysis
373
-     */
374
-    protected function _get_table_analysis(): TableAnalysis
375
-    {
376
-        return $this->_table_analysis;
377
-    }
26
+	/**
27
+	 * @var EE_Dependency_Map
28
+	 */
29
+	protected $dependency_map;
30
+
31
+	/**
32
+	 * @var LoaderInterface
33
+	 */
34
+	protected $loader;
35
+
36
+	/**
37
+	 * @var TableAnalysis
38
+	 */
39
+	protected $_table_analysis;
40
+
41
+
42
+	/**
43
+	 * EE_Brewing_Regular constructor.
44
+	 *
45
+	 * @param EE_Dependency_Map $dependency_map
46
+	 * @param LoaderInterface   $loader
47
+	 * @param TableAnalysis     $table_analysis
48
+	 */
49
+	public function __construct(
50
+		EE_Dependency_Map $dependency_map,
51
+		LoaderInterface $loader,
52
+		TableAnalysis $table_analysis
53
+	) {
54
+		$this->dependency_map = $dependency_map;
55
+		$this->loader         = $loader;
56
+		$this->_table_analysis = $table_analysis;
57
+		if (defined('EE_CAFF_PATH')) {
58
+			// defined some new constants related to caffeinated folder
59
+			define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/');
60
+			define('EE_CAF_CORE', EE_CAFF_PATH . 'core/');
61
+			define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries/');
62
+			define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods/');
63
+		}
64
+	}
65
+
66
+
67
+	/**
68
+	 * @throws EE_Error
69
+	 */
70
+	public function caffeinated()
71
+	{
72
+		$this->setInitializationHooks();
73
+		$this->setApiRegistrationHooks();
74
+		$this->setSwitchHooks();
75
+		$this->setDefaultFilterHooks();
76
+		// caffeinated constructed
77
+		do_action('AHEE__EE_Brewing_Regular__construct__complete');
78
+	}
79
+
80
+
81
+	public function initializePUE()
82
+	{
83
+		$this->dependency_map->registerDependencies(
84
+			PueLicensingManager::class,
85
+			[
86
+				'EE_Dependency_Map'                          => EE_Dependency_Map::load_from_cache,
87
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
88
+			]
89
+		);
90
+		/** @var PueLicensingManager $pue_manager */
91
+		$pue_manager = $this->loader->getShared(PueLicensingManager::class);
92
+		$pue_manager->registerDependencies();
93
+		$pue_manager->registerHooks();
94
+	}
95
+
96
+
97
+	/**
98
+	 * Various hooks used for extending features via registration of modules or extensions.
99
+	 *
100
+	 * @throws EE_Error
101
+	 */
102
+	private function setApiRegistrationHooks()
103
+	{
104
+		add_filter(
105
+			'FHEE__EE_Config__register_modules__modules_to_register',
106
+			[$this, 'caffeinated_modules_to_register']
107
+		);
108
+		add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10);
109
+		add_filter(
110
+			'AHEE__EE_System__load_core_configuration__complete',
111
+			function () {
112
+				EE_Register_Payment_Method::register(
113
+					'caffeinated_payment_methods',
114
+					[
115
+						'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR),
116
+					]
117
+				);
118
+			}
119
+		);
120
+	}
121
+
122
+
123
+	/**
124
+	 * Various hooks used for modifying initialization or activation processes.
125
+	 */
126
+	private function setInitializationHooks()
127
+	{
128
+		// activation
129
+		add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']);
130
+		// load caff init
131
+		add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']);
132
+		// load caff scripts
133
+		add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10);
134
+	}
135
+
136
+
137
+	/**
138
+	 * Various hooks used for switch (on/off) type filters.
139
+	 */
140
+	private function setSwitchHooks()
141
+	{
142
+		// remove the "powered by" credit link from receipts and invoices
143
+		add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false');
144
+		// seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer
145
+		add_filter('FHEE__ee_show_affiliate_links', '__return_false');
146
+	}
147
+
148
+
149
+	/**
150
+	 * Various filters for affecting default configuration values in the caffeinated
151
+	 * context.
152
+	 */
153
+	private function setDefaultFilterHooks()
154
+	{
155
+		add_filter(
156
+			'FHEE__EE_Admin_Config__show_reg_footer__default',
157
+			'__return_true'
158
+		);
159
+	}
160
+
161
+
162
+	/**
163
+	 * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
164
+	 *
165
+	 * @param array $paths original helper paths array
166
+	 * @return array             new array of paths
167
+	 */
168
+	public function caf_helper_paths(array $paths): array
169
+	{
170
+		$paths[] = EE_CAF_CORE . 'helpers/';
171
+		return $paths;
172
+	}
173
+
174
+
175
+	/**
176
+	 * Upon brand-new activation, if this is a new activation of CAF, we want to add
177
+	 * some global prices that will show off EE4's capabilities. However, if they're upgrading
178
+	 * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices.
179
+	 * This action should only be called when EE 4.x.0.P is initially activated.
180
+	 * Right now the only CAF content are these global prices. If there's more in the future, then
181
+	 * we should probably create a caf file to contain it all instead just a function like this.
182
+	 * Right now, we ASSUME the only price types in the system are default ones
183
+	 *
184
+	 * @global wpdb $wpdb
185
+	 */
186
+	public function initialize_caf_db_content()
187
+	{
188
+		global $wpdb;
189
+		// use same method of getting creator id as the version introducing the change
190
+		$default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id());
191
+		$price_type_table   = $wpdb->prefix . "esp_price_type";
192
+		$price_table        = $wpdb->prefix . "esp_price";
193
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
194
+			$SQL                  =
195
+				'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types
196
+			$tax_price_type_count = $wpdb->get_var($SQL);
197
+			if ($tax_price_type_count <= 1) {
198
+				$wpdb->insert(
199
+					$price_type_table,
200
+					[
201
+						'PRT_name'       => esc_html__("Regional Tax", "event_espresso"),
202
+						'PBT_ID'         => 4,
203
+						'PRT_is_percent' => true,
204
+						'PRT_order'      => 60,
205
+						'PRT_deleted'    => false,
206
+						'PRT_wp_user'    => $default_creator_id,
207
+					],
208
+					[
209
+						'%s',// PRT_name
210
+						'%d',// PBT_id
211
+						'%d',// PRT_is_percent
212
+						'%d',// PRT_order
213
+						'%d',// PRT_deleted
214
+						'%d', // PRT_wp_user
215
+					]
216
+				);
217
+				// federal tax
218
+				$result = $wpdb->insert(
219
+					$price_type_table,
220
+					[
221
+						'PRT_name'       => esc_html__("Federal Tax", "event_espresso"),
222
+						'PBT_ID'         => 4,
223
+						'PRT_is_percent' => true,
224
+						'PRT_order'      => 70,
225
+						'PRT_deleted'    => false,
226
+						'PRT_wp_user'    => $default_creator_id,
227
+					],
228
+					[
229
+						'%s',// PRT_name
230
+						'%d',// PBT_id
231
+						'%d',// PRT_is_percent
232
+						'%d',// PRT_order
233
+						'%d',// PRT_deleted
234
+						'%d' // PRT_wp_user
235
+					]
236
+				);
237
+				if ($result) {
238
+					$wpdb->insert(
239
+						$price_table,
240
+						[
241
+							'PRT_ID'         => $wpdb->insert_id,
242
+							'PRC_amount'     => 15.00,
243
+							'PRC_name'       => esc_html__("Sales Tax", "event_espresso"),
244
+							'PRC_desc'       => '',
245
+							'PRC_is_default' => true,
246
+							'PRC_overrides'  => null,
247
+							'PRC_deleted'    => false,
248
+							'PRC_order'      => 50,
249
+							'PRC_parent'     => null,
250
+							'PRC_wp_user'    => $default_creator_id,
251
+						],
252
+						[
253
+							'%d',// PRT_id
254
+							'%f',// PRC_amount
255
+							'%s',// PRC_name
256
+							'%s',// PRC_desc
257
+							'%d',// PRC_is_default
258
+							'%d',// PRC_overrides
259
+							'%d',// PRC_deleted
260
+							'%d',// PRC_order
261
+							'%d',// PRC_parent
262
+							'%d' // PRC_wp_user
263
+						]
264
+					);
265
+				}
266
+			}
267
+		}
268
+	}
269
+
270
+
271
+	/**
272
+	 *    caffeinated_modules_to_register
273
+	 *
274
+	 * @access public
275
+	 * @param array $modules_to_register
276
+	 * @return array
277
+	 */
278
+	public function caffeinated_modules_to_register(array $modules_to_register = []): array
279
+	{
280
+		if (is_readable(EE_CAFF_PATH . 'modules')) {
281
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR);
282
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
283
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
284
+			}
285
+		}
286
+		return $modules_to_register;
287
+	}
288
+
289
+
290
+	/**
291
+	 * @throws EE_Error
292
+	 * @throws InvalidArgumentException
293
+	 * @throws ReflectionException
294
+	 * @throws InvalidDataTypeException
295
+	 * @throws InvalidInterfaceException
296
+	 */
297
+	public function caffeinated_init()
298
+	{
299
+		// Custom Post Type hooks
300
+		add_filter(
301
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
302
+			[$this, 'filter_taxonomies']
303
+		);
304
+		add_filter(
305
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
306
+			[$this, 'filter_cpts']
307
+		);
308
+		add_filter(
309
+			'FHEE__EE_Admin__get_extra_nav_menu_pages_items',
310
+			[$this, 'nav_metabox_items']
311
+		);
312
+		EE_Registry::instance()->load_file(
313
+			EE_CAFF_PATH,
314
+			'EE_Caf_Messages',
315
+			'class',
316
+			[],
317
+			false
318
+		);
319
+		// caffeinated_init__complete hook
320
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
321
+	}
322
+
323
+
324
+	public function enqueue_caffeinated_scripts()
325
+	{
326
+		// sound of crickets...
327
+	}
328
+
329
+
330
+	/**
331
+	 * callbacks below here
332
+	 *
333
+	 * @param array $taxonomy_array
334
+	 * @return array
335
+	 */
336
+	public function filter_taxonomies(array $taxonomy_array): array
337
+	{
338
+		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true;
339
+		return $taxonomy_array;
340
+	}
341
+
342
+
343
+	/**
344
+	 * @param array $cpt_array
345
+	 * @return array
346
+	 */
347
+	public function filter_cpts(array $cpt_array): array
348
+	{
349
+		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true;
350
+		return $cpt_array;
351
+	}
352
+
353
+
354
+	/**
355
+	 * @param array $menu_items
356
+	 * @return array
357
+	 */
358
+	public function nav_metabox_items(array $menu_items): array
359
+	{
360
+		$menu_items[] = [
361
+			'title'       => esc_html__('Venue List', 'event_espresso'),
362
+			'url'         => get_post_type_archive_link('espresso_venues'),
363
+			'description' => esc_html__('Archive page for all venues.', 'event_espresso'),
364
+		];
365
+		return $menu_items;
366
+	}
367
+
368
+
369
+	/**
370
+	 * Gets the injected table analyzer, or throws an exception
371
+	 *
372
+	 * @return TableAnalysis
373
+	 */
374
+	protected function _get_table_analysis(): TableAnalysis
375
+	{
376
+		return $this->_table_analysis;
377
+	}
378 378
 }
Please login to merge, or discard this patch.
events_archive_caff/templates/admin-event-list-settings.template.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -5,18 +5,18 @@  discard block
 block discarded – undo
5 5
 add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
6 6
 
7 7
 $values = EEH_Form_Fields::prep_answer_options(
8
-    array(
9
-        array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
-        array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
-    )
8
+	array(
9
+		array('id' => 1, 'text' => esc_html__('Yes', 'event_espresso')),
10
+		array('id' => 0, 'text' => esc_html__('No', 'event_espresso')),
11
+	)
12 12
 );
13 13
 
14 14
 $description = EEH_Form_Fields::prep_answer_options(
15
-    array(
16
-        array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
-        array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
-        array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
-    )
15
+	array(
16
+		array('id' => 0, 'text' => esc_html__('none', 'event_espresso')),
17
+		array('id' => 1, 'text' => esc_html__('excerpt (short desc)', 'event_espresso')),
18
+		array('id' => 2, 'text' => esc_html__('full description', 'event_espresso')),
19
+	)
20 20
 );
21 21
 
22 22
 ?>
@@ -54,30 +54,30 @@  discard block
 block discarded – undo
54 54
         </th>
55 55
         <td>
56 56
             <p><?php echo site_url() . '/ '
57
-                          . EEH_Form_Fields::text(
58
-                              'not_used',
59
-                              EE_Registry::instance()->CFG->core->event_cpt_slug,
60
-                              'event_cpt_slug',
61
-                              'event_cpt_slug',
62
-                              'regular'
63
-                          ); ?></p>
57
+						  . EEH_Form_Fields::text(
58
+							  'not_used',
59
+							  EE_Registry::instance()->CFG->core->event_cpt_slug,
60
+							  'event_cpt_slug',
61
+							  'event_cpt_slug',
62
+							  'regular'
63
+						  ); ?></p>
64 64
             <p class="description"><?php
65
-                esc_html_e(
66
-                    'This allows you to configure what slug is used for the url of all event pages.',
67
-                    'event_espresso'
68
-                ); ?></p>
65
+				esc_html_e(
66
+					'This allows you to configure what slug is used for the url of all event pages.',
67
+					'event_espresso'
68
+				); ?></p>
69 69
             <?php if (has_filter('FHEE__EE_Register_CPTs__register_CPT__rewrite')) : ?>
70 70
                 <p class="important-notice">
71 71
                     <?php
72
-                    sprintf(
73
-                        esc_html__(
74
-                            'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
75
-                            'event_espresso'
76
-                        ),
77
-                        '<code>',
78
-                        '</code>'
79
-                    );
80
-                    ?>
72
+					sprintf(
73
+						esc_html__(
74
+							'Usage of the %1$s FHEE__EE_Register_CPTs__register_CPT__rewrite %2$s filter has been detected.  Please be aware that while this filter is being used, this setting has no affect.',
75
+							'event_espresso'
76
+						),
77
+						'<code>',
78
+						'</code>'
79
+					);
80
+					?>
81 81
                 </p>
82 82
             <?php endif; ?>
83 83
         </td>
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
         </th>
92 92
         <td>
93 93
             <?php echo wp_kses(
94
-                EEH_Form_Fields::select(
95
-                    'display_status_banner',
96
-                    $display_status_banner,
97
-                    $values,
98
-                    'EED_Events_Archive_display_status_banner',
99
-                    'EED_Events_Archive_display_status_banner'
100
-                ),
101
-                AllowedTags::getWithFormTags()
102
-            ); ?>
94
+				EEH_Form_Fields::select(
95
+					'display_status_banner',
96
+					$display_status_banner,
97
+					$values,
98
+					'EED_Events_Archive_display_status_banner',
99
+					'EED_Events_Archive_display_status_banner'
100
+				),
101
+				AllowedTags::getWithFormTags()
102
+			); ?>
103 103
             <p class="description"><?php
104
-                esc_html_e(
105
-                    'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
106
-                    'event_espresso'
107
-                ); ?></p>
104
+				esc_html_e(
105
+					'Selecting "Yes" will inject an Event Status banner with the title whenever Events are displaying on the events archive page.',
106
+					'event_espresso'
107
+				); ?></p>
108 108
         </td>
109 109
     </tr>
110 110
 
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
         </th>
118 118
         <td>
119 119
             <?php echo wp_kses(
120
-                EEH_Form_Fields::select(
121
-                    'description',
122
-                    $display_description,
123
-                    $description,
124
-                    'EED_Events_Archive_display_description',
125
-                    'EED_Events_Archive_display_description'
126
-                ),
127
-                AllowedTags::getWithFormTags()
128
-            ); ?>
120
+				EEH_Form_Fields::select(
121
+					'description',
122
+					$display_description,
123
+					$description,
124
+					'EED_Events_Archive_display_description',
125
+					'EED_Events_Archive_display_description'
126
+				),
127
+				AllowedTags::getWithFormTags()
128
+			); ?>
129 129
         </td>
130 130
     </tr>
131 131
 
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
         </th>
139 139
         <td>
140 140
             <?php echo wp_kses(
141
-                EEH_Form_Fields::select(
142
-                    'ticket_selector',
143
-                    $display_ticket_selector,
144
-                    $values,
145
-                    'EED_Events_Archive_display_ticket_selector',
146
-                    'EED_Events_Archive_display_ticket_selector'
147
-                ),
148
-                AllowedTags::getWithFormTags()
149
-            ); ?>
141
+				EEH_Form_Fields::select(
142
+					'ticket_selector',
143
+					$display_ticket_selector,
144
+					$values,
145
+					'EED_Events_Archive_display_ticket_selector',
146
+					'EED_Events_Archive_display_ticket_selector'
147
+				),
148
+				AllowedTags::getWithFormTags()
149
+			); ?>
150 150
         </td>
151 151
     </tr>
152 152
 
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
         </th>
160 160
         <td>
161 161
             <?php echo wp_kses(
162
-                EEH_Form_Fields::select(
163
-                    'venue_details',
164
-                    $display_datetimes,
165
-                    $values,
166
-                    'EED_Events_Archive_display_datetimes',
167
-                    'EED_Events_Archive_display_datetimes'
168
-                ),
169
-                AllowedTags::getWithFormTags()
170
-            ); ?>
162
+				EEH_Form_Fields::select(
163
+					'venue_details',
164
+					$display_datetimes,
165
+					$values,
166
+					'EED_Events_Archive_display_datetimes',
167
+					'EED_Events_Archive_display_datetimes'
168
+				),
169
+				AllowedTags::getWithFormTags()
170
+			); ?>
171 171
         </td>
172 172
     </tr>
173 173
 
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
         </th>
181 181
         <td>
182 182
             <?php echo wp_kses(
183
-                EEH_Form_Fields::select(
184
-                    'display_venue',
185
-                    $display_venue,
186
-                    $values,
187
-                    'EED_Events_Archive_display_venue',
188
-                    'EED_Events_Archive_display_venue'
189
-                ),
190
-                AllowedTags::getWithFormTags()
191
-            ); ?>
183
+				EEH_Form_Fields::select(
184
+					'display_venue',
185
+					$display_venue,
186
+					$values,
187
+					'EED_Events_Archive_display_venue',
188
+					'EED_Events_Archive_display_venue'
189
+				),
190
+				AllowedTags::getWithFormTags()
191
+			); ?>
192 192
         </td>
193 193
     </tr>
194 194
 
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
         </th>
202 202
         <td>
203 203
             <?php echo wp_kses(
204
-                EEH_Form_Fields::select(
205
-                    'expired_events',
206
-                    $display_expired_events,
207
-                    $values,
208
-                    'EED_Events_Archive_display_expired_events',
209
-                    'EED_Events_Archive_display_expired_events'
210
-                ),
211
-                AllowedTags::getWithFormTags()
212
-            ); ?>
204
+				EEH_Form_Fields::select(
205
+					'expired_events',
206
+					$display_expired_events,
207
+					$values,
208
+					'EED_Events_Archive_display_expired_events',
209
+					'EED_Events_Archive_display_expired_events'
210
+				),
211
+				AllowedTags::getWithFormTags()
212
+			); ?>
213 213
         </td>
214 214
     </tr>
215 215
 
@@ -217,46 +217,46 @@  discard block
 block discarded – undo
217 217
         <th>
218 218
             <label for="EED_Events_Archive_use_sortable_display_order">
219 219
                 <?php esc_html_e(
220
-                    'Use Custom Display Order?',
221
-                    'event_espresso'
222
-                ); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('use_sortable_display_order_info'),AllowedTags::getAllowedTags()); ?>
220
+					'Use Custom Display Order?',
221
+					'event_espresso'
222
+				); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('use_sortable_display_order_info'),AllowedTags::getAllowedTags()); ?>
223 223
             </label>
224 224
         </th>
225 225
         <td>
226 226
             <?php echo wp_kses(
227
-                EEH_Form_Fields::select(
228
-                    'use_sortable_display_order',
229
-                    $use_sortable_display_order,
230
-                    $values,
231
-                    'EED_Events_Archive_use_sortable_display_order',
232
-                    'EED_Events_Archive_use_sortable_display_order'
233
-                ),
234
-                AllowedTags::getWithFormTags()
235
-            ); ?>
227
+				EEH_Form_Fields::select(
228
+					'use_sortable_display_order',
229
+					$use_sortable_display_order,
230
+					$values,
231
+					'EED_Events_Archive_use_sortable_display_order',
232
+					'EED_Events_Archive_use_sortable_display_order'
233
+				),
234
+				AllowedTags::getWithFormTags()
235
+			); ?>
236 236
         </td>
237 237
     </tr>
238 238
 
239 239
     <tr>
240 240
         <th>
241 241
             <?php esc_html_e(
242
-                'Display Order',
243
-                'event_espresso'
244
-            ); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_archive_order_info'),AllowedTags::getAllowedTags()); ?>
242
+				'Display Order',
243
+				'event_espresso'
244
+			); ?><?php // echo wp_kses(EEH_Template::get_help_tab_link('event_archive_order_info'),AllowedTags::getAllowedTags()); ?>
245 245
         </th>
246 246
         <td>
247 247
 
248 248
             <?php wp_nonce_field(
249
-                'espresso_update_event_archive_order',
250
-                'espresso_update_event_archive_order_nonce',
251
-                false
252
-            ); ?>
249
+				'espresso_update_event_archive_order',
250
+				'espresso_update_event_archive_order_nonce',
251
+				false
252
+			); ?>
253 253
             <?php echo wp_kses($event_archive_display_order, AllowedTags::getWithFormTags()); ?>
254 254
 
255 255
             <p class="description"><?php
256
-                esc_html_e(
257
-                    'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
258
-                    'event_espresso'
259
-                ); ?></p>
256
+				esc_html_e(
257
+					'Drag and Drop the above to determine the display order of the Event Description, Date and Times, Ticket Selector, and Venue Information on the event archive page.',
258
+					'event_espresso'
259
+				); ?></p>
260 260
 
261 261
         </td>
262 262
     </tr>
@@ -269,15 +269,15 @@  discard block
 block discarded – undo
269 269
         </th>
270 270
         <td>
271 271
             <?php echo wp_kses(
272
-                EEH_Form_Fields::select(
273
-                    'reset_event_list_settings',
274
-                    0,
275
-                    $values,
276
-                    'EED_Events_Archive_reset_event_list_settings',
277
-                    'EED_Events_Archive_reset_event_list_settings'
278
-                ),
279
-                AllowedTags::getWithFormTags()
280
-            ); ?>
272
+				EEH_Form_Fields::select(
273
+					'reset_event_list_settings',
274
+					0,
275
+					$values,
276
+					'EED_Events_Archive_reset_event_list_settings',
277
+					'EED_Events_Archive_reset_event_list_settings'
278
+				),
279
+				AllowedTags::getWithFormTags()
280
+			); ?>
281 281
         </td>
282 282
     </tr>
283 283
 
Please login to merge, or discard this patch.
caffeinated/core/services/licensing/LicenseService.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -15,93 +15,93 @@
 block discarded – undo
15 15
  */
16 16
 class LicenseService
17 17
 {
18
-    /**
19
-     * @var Config
20
-     */
21
-    private $config;
18
+	/**
19
+	 * @var Config
20
+	 */
21
+	private $config;
22 22
 
23
-    /**
24
-     * @var Stats
25
-     */
26
-    private $stats_collection;
23
+	/**
24
+	 * @var Stats
25
+	 */
26
+	private $stats_collection;
27 27
 
28
-    public function __construct(Stats $stats_collection, Config $config)
29
-    {
30
-        $this->config = $config;
31
-        $this->stats_collection = $stats_collection;
32
-    }
28
+	public function __construct(Stats $stats_collection, Config $config)
29
+	{
30
+		$this->config = $config;
31
+		$this->stats_collection = $stats_collection;
32
+	}
33 33
 
34
-    public function loadPueClient()
35
-    {
36
-        // PUE Auto Upgrades stuff
37
-        if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file
38
-            require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
34
+	public function loadPueClient()
35
+	{
36
+		// PUE Auto Upgrades stuff
37
+		if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file
38
+			require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
39 39
 
40
-            // $options needs to be an array with the included keys as listed.
41
-            $options = array(
42
-                // 'optionName' => '', //(optional) - used as the reference for saving update information in the
43
-                // clients options table.  Will be automatically set if left blank.
44
-                'apikey'                => $this->config->siteLicenseKey(),
45
-                // (required), you will need to obtain the apikey that the client gets from your site and
46
-                // then saves in their sites options table (see 'getting an api-key' below)
47
-                'lang_domain'           => $this->config->i18nDomain(),
48
-                // (optional) - put here whatever reference you are using for the localization of your plugin (if it's
49
-                // localized).  That way strings in this file will be included in the translation for your plugin.
50
-                'checkPeriod'           => $this->config->checkPeriod(),
51
-                // (optional) - use this parameter to indicate how often you want the client's install to ping your
52
-                // server for update checks.  The integer indicates hours.  If you don't include this parameter it will
53
-                // default to 12 hours.
54
-                'option_key'            => $this->config->optionKey(),
55
-                // this is what is used to reference the api_key in your plugin options.  PUE uses this to trigger
56
-                // updating your information message whenever this option_key is modified.
57
-                'options_page_slug'     => $this->config->optionsPageSlug(),
58
-                'plugin_basename'       => EE_PLUGIN_BASENAME,
59
-                'use_wp_update'         => true,
60
-                // if TRUE then you want FREE versions of the plugin to be updated from WP
61
-                'extra_stats'           => $this->stats_collection->statsCallback(),
62
-                'turn_on_notices_saved' => true,
63
-            );
64
-            // initiate the class and start the plugin update engine!
65
-            new PluginUpdateEngineChecker(
66
-                $this->config->hostServerUrl(),
67
-                $this->config->pluginSlug(),
68
-                $options
69
-            );
40
+			// $options needs to be an array with the included keys as listed.
41
+			$options = array(
42
+				// 'optionName' => '', //(optional) - used as the reference for saving update information in the
43
+				// clients options table.  Will be automatically set if left blank.
44
+				'apikey'                => $this->config->siteLicenseKey(),
45
+				// (required), you will need to obtain the apikey that the client gets from your site and
46
+				// then saves in their sites options table (see 'getting an api-key' below)
47
+				'lang_domain'           => $this->config->i18nDomain(),
48
+				// (optional) - put here whatever reference you are using for the localization of your plugin (if it's
49
+				// localized).  That way strings in this file will be included in the translation for your plugin.
50
+				'checkPeriod'           => $this->config->checkPeriod(),
51
+				// (optional) - use this parameter to indicate how often you want the client's install to ping your
52
+				// server for update checks.  The integer indicates hours.  If you don't include this parameter it will
53
+				// default to 12 hours.
54
+				'option_key'            => $this->config->optionKey(),
55
+				// this is what is used to reference the api_key in your plugin options.  PUE uses this to trigger
56
+				// updating your information message whenever this option_key is modified.
57
+				'options_page_slug'     => $this->config->optionsPageSlug(),
58
+				'plugin_basename'       => EE_PLUGIN_BASENAME,
59
+				'use_wp_update'         => true,
60
+				// if TRUE then you want FREE versions of the plugin to be updated from WP
61
+				'extra_stats'           => $this->stats_collection->statsCallback(),
62
+				'turn_on_notices_saved' => true,
63
+			);
64
+			// initiate the class and start the plugin update engine!
65
+			new PluginUpdateEngineChecker(
66
+				$this->config->hostServerUrl(),
67
+				$this->config->pluginSlug(),
68
+				$options
69
+			);
70 70
 
71
-            do_action('AHEE__EE_System__brew_espresso__after_pue_init');
72
-        }
73
-    }
71
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
72
+		}
73
+	}
74 74
 
75 75
 
76
-    /**
77
-     * This is a handy helper method for retrieving whether there is an update available for the given plugin.
78
-     *
79
-     * @param string $basename  Use the equivalent result from plugin_basename() for this param as WP uses that to
80
-     *                          identify plugins. Defaults to core update
81
-     * @return bool           True if update available, false if not.
82
-     */
83
-    public static function isUpdateAvailable(string $basename = ''): bool
84
-    {
85
-        $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
76
+	/**
77
+	 * This is a handy helper method for retrieving whether there is an update available for the given plugin.
78
+	 *
79
+	 * @param string $basename  Use the equivalent result from plugin_basename() for this param as WP uses that to
80
+	 *                          identify plugins. Defaults to core update
81
+	 * @return bool           True if update available, false if not.
82
+	 */
83
+	public static function isUpdateAvailable(string $basename = ''): bool
84
+	{
85
+		$basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME;
86 86
 
87
-        $update = false;
87
+		$update = false;
88 88
 
89
-        // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
90
-        $folder = '/' . dirname($basename);
89
+		// should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
90
+		$folder = '/' . dirname($basename);
91 91
 
92
-        $plugins = get_plugins($folder);
93
-        $current = get_site_transient('update_plugins');
94
-        foreach ($plugins as $plugin_file => $plugin_data) {
95
-            if (isset($current->response[ $plugin_file ])) {
96
-                $update = true;
97
-            }
98
-        }
92
+		$plugins = get_plugins($folder);
93
+		$current = get_site_transient('update_plugins');
94
+		foreach ($plugins as $plugin_file => $plugin_data) {
95
+			if (isset($current->response[ $plugin_file ])) {
96
+				$update = true;
97
+			}
98
+		}
99 99
 
100
-        // it's possible that there is an update but an invalid site-license-key is in use
101
-        if (get_site_option('pue_json_error_' . $basename)) {
102
-            $update = true;
103
-        }
100
+		// it's possible that there is an update but an invalid site-license-key is in use
101
+		if (get_site_option('pue_json_error_' . $basename)) {
102
+			$update = true;
103
+		}
104 104
 
105
-        return $update;
106
-    }
105
+		return $update;
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
     public function loadPueClient()
35 35
     {
36 36
         // PUE Auto Upgrades stuff
37
-        if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file
38
-            require_once(EE_THIRD_PARTY . 'pue/pue-client.php');
37
+        if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { // include the file
38
+            require_once(EE_THIRD_PARTY.'pue/pue-client.php');
39 39
 
40 40
             // $options needs to be an array with the included keys as listed.
41 41
             $options = array(
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
         $update = false;
88 88
 
89 89
         // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core"
90
-        $folder = '/' . dirname($basename);
90
+        $folder = '/'.dirname($basename);
91 91
 
92 92
         $plugins = get_plugins($folder);
93 93
         $current = get_site_transient('update_plugins');
94 94
         foreach ($plugins as $plugin_file => $plugin_data) {
95
-            if (isset($current->response[ $plugin_file ])) {
95
+            if (isset($current->response[$plugin_file])) {
96 96
                 $update = true;
97 97
             }
98 98
         }
99 99
 
100 100
         // it's possible that there is an update but an invalid site-license-key is in use
101
-        if (get_site_option('pue_json_error_' . $basename)) {
101
+        if (get_site_option('pue_json_error_'.$basename)) {
102 102
             $update = true;
103 103
         }
104 104
 
Please login to merge, or discard this patch.
caffeinated/core/domain/services/pue/Config.php 1 patch
Indentation   +126 added lines, -126 removed lines patch added patch discarded remove patch
@@ -15,130 +15,130 @@
 block discarded – undo
15 15
  */
16 16
 class Config
17 17
 {
18
-    /**
19
-     * @var EE_Network_Config
20
-     */
21
-    private $network_config;
22
-
23
-    /**
24
-     * @var EE_Config
25
-     */
26
-    private $ee_config;
27
-
28
-
29
-    public function __construct(EE_Network_Config $network_config, EE_Config $ee_config)
30
-    {
31
-        $this->network_config = $network_config;
32
-        $this->ee_config      = $ee_config;
33
-    }
34
-
35
-
36
-    /**
37
-     * Get the site license key for the site.
38
-     */
39
-    public function siteLicenseKey(): string
40
-    {
41
-        return $this->network_config->core->site_license_key;
42
-    }
43
-
44
-
45
-    public function i18nDomain(): string
46
-    {
47
-        return 'event_espresso';
48
-    }
49
-
50
-
51
-    public function checkPeriod(): int
52
-    {
53
-        return 24;
54
-    }
55
-
56
-
57
-    public function optionKey(): string
58
-    {
59
-        return 'ee_site_license_key';
60
-    }
61
-
62
-
63
-    public function optionsPageSlug(): string
64
-    {
65
-        return 'espresso_general_settings';
66
-    }
67
-
68
-
69
-    public function hostServerUrl(): string
70
-    {
71
-        return defined('PUE_UPDATES_ENDPOINT')
72
-            ? PUE_UPDATES_ENDPOINT
73
-            : 'https://eventespresso.com';
74
-    }
75
-
76
-
77
-    public function pluginSlug(): array
78
-    {
79
-        // Note: PUE uses a simple preg_match to determine what type is currently installed based on version number.
80
-        //  So it's important that you use a key for the version type that is unique and not found in another key.
81
-        // For example:
82
-        // $plugin_slug['premium']['p'] = 'some-premium-slug';
83
-        // $plugin_slug['prerelease']['pr'] = 'some-pre-release-slug';
84
-        // The above would not work because "p" is found in both keys for the version type. ( i.e 1.0.p vs 1.0.pr )
85
-        // so doing something like:
86
-        // $plugin_slug['premium']['p'] = 'some-premium-slug';
87
-        // $plugin_slug['prerelease']['b'] = 'some-pre-release-slug';
88
-        // ..WOULD work!
89
-        return [
90
-            'free'       => ['decaf' => 'event-espresso-core-decaf'],
91
-            'premium'    => ['p' => 'event-espresso-core-reg'],
92
-            'prerelease' => ['beta' => 'event-espresso-core-pr'],
93
-        ];
94
-    }
95
-
96
-
97
-    /**
98
-     * Return whether the site is opted in for UXIP or not.
99
-     *
100
-     * @return bool
101
-     */
102
-    public function isOptedInForUxip(): bool
103
-    {
104
-        return filter_var($this->ee_config->core->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN);
105
-    }
106
-
107
-
108
-    /**
109
-     * Return whether the site has been notified about UXIP or not.
110
-     *
111
-     * @return bool
112
-     */
113
-    public function hasNotifiedForUxip(): bool
114
-    {
115
-        return filter_var($this->ee_config->core->ee_ueip_has_notified, FILTER_VALIDATE_BOOLEAN);
116
-    }
117
-
118
-
119
-    /**
120
-     * Set the site opted in for UXIP.
121
-     */
122
-    public function setHasOptedInForUxip()
123
-    {
124
-        $this->ee_config->core->ee_ueip_optin = true;
125
-        $this->ee_config->update_espresso_config(false, false);
126
-    }
127
-
128
-
129
-    /**
130
-     * Set the site opted out for UXIP
131
-     */
132
-    public function setHasOptedOutForUxip()
133
-    {
134
-        $this->ee_config->core->ee_ueip_optin = false;
135
-        $this->ee_config->update_espresso_config(false, false);
136
-    }
137
-
138
-
139
-    public function setHasNotifiedAboutUxip()
140
-    {
141
-        $this->ee_config->core->ee_ueip_has_notified = true;
142
-        $this->ee_config->update_espresso_config(false, false);
143
-    }
18
+	/**
19
+	 * @var EE_Network_Config
20
+	 */
21
+	private $network_config;
22
+
23
+	/**
24
+	 * @var EE_Config
25
+	 */
26
+	private $ee_config;
27
+
28
+
29
+	public function __construct(EE_Network_Config $network_config, EE_Config $ee_config)
30
+	{
31
+		$this->network_config = $network_config;
32
+		$this->ee_config      = $ee_config;
33
+	}
34
+
35
+
36
+	/**
37
+	 * Get the site license key for the site.
38
+	 */
39
+	public function siteLicenseKey(): string
40
+	{
41
+		return $this->network_config->core->site_license_key;
42
+	}
43
+
44
+
45
+	public function i18nDomain(): string
46
+	{
47
+		return 'event_espresso';
48
+	}
49
+
50
+
51
+	public function checkPeriod(): int
52
+	{
53
+		return 24;
54
+	}
55
+
56
+
57
+	public function optionKey(): string
58
+	{
59
+		return 'ee_site_license_key';
60
+	}
61
+
62
+
63
+	public function optionsPageSlug(): string
64
+	{
65
+		return 'espresso_general_settings';
66
+	}
67
+
68
+
69
+	public function hostServerUrl(): string
70
+	{
71
+		return defined('PUE_UPDATES_ENDPOINT')
72
+			? PUE_UPDATES_ENDPOINT
73
+			: 'https://eventespresso.com';
74
+	}
75
+
76
+
77
+	public function pluginSlug(): array
78
+	{
79
+		// Note: PUE uses a simple preg_match to determine what type is currently installed based on version number.
80
+		//  So it's important that you use a key for the version type that is unique and not found in another key.
81
+		// For example:
82
+		// $plugin_slug['premium']['p'] = 'some-premium-slug';
83
+		// $plugin_slug['prerelease']['pr'] = 'some-pre-release-slug';
84
+		// The above would not work because "p" is found in both keys for the version type. ( i.e 1.0.p vs 1.0.pr )
85
+		// so doing something like:
86
+		// $plugin_slug['premium']['p'] = 'some-premium-slug';
87
+		// $plugin_slug['prerelease']['b'] = 'some-pre-release-slug';
88
+		// ..WOULD work!
89
+		return [
90
+			'free'       => ['decaf' => 'event-espresso-core-decaf'],
91
+			'premium'    => ['p' => 'event-espresso-core-reg'],
92
+			'prerelease' => ['beta' => 'event-espresso-core-pr'],
93
+		];
94
+	}
95
+
96
+
97
+	/**
98
+	 * Return whether the site is opted in for UXIP or not.
99
+	 *
100
+	 * @return bool
101
+	 */
102
+	public function isOptedInForUxip(): bool
103
+	{
104
+		return filter_var($this->ee_config->core->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN);
105
+	}
106
+
107
+
108
+	/**
109
+	 * Return whether the site has been notified about UXIP or not.
110
+	 *
111
+	 * @return bool
112
+	 */
113
+	public function hasNotifiedForUxip(): bool
114
+	{
115
+		return filter_var($this->ee_config->core->ee_ueip_has_notified, FILTER_VALIDATE_BOOLEAN);
116
+	}
117
+
118
+
119
+	/**
120
+	 * Set the site opted in for UXIP.
121
+	 */
122
+	public function setHasOptedInForUxip()
123
+	{
124
+		$this->ee_config->core->ee_ueip_optin = true;
125
+		$this->ee_config->update_espresso_config(false, false);
126
+	}
127
+
128
+
129
+	/**
130
+	 * Set the site opted out for UXIP
131
+	 */
132
+	public function setHasOptedOutForUxip()
133
+	{
134
+		$this->ee_config->core->ee_ueip_optin = false;
135
+		$this->ee_config->update_espresso_config(false, false);
136
+	}
137
+
138
+
139
+	public function setHasNotifiedAboutUxip()
140
+	{
141
+		$this->ee_config->core->ee_ueip_has_notified = true;
142
+		$this->ee_config->update_espresso_config(false, false);
143
+	}
144 144
 }
Please login to merge, or discard this patch.