Completed
Branch updates-from-cafe (c7978b)
by
unknown
23:42 queued 17:07
created
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
Indentation   +207 added lines, -207 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,75 +178,75 @@  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 ($payment->payment_method() instanceof EE_Payment_Method
190
-                                    ? esc_html($payment->payment_method()->admin_name())
191
-                                    : esc_html__("Unknown", 'event_espresso'));
192
-                                ?></div>
189
+								echo ($payment->payment_method() instanceof EE_Payment_Method
190
+									? esc_html($payment->payment_method()->admin_name())
191
+									: esc_html__("Unknown", 'event_espresso'));
192
+								?></div>
193 193
                             <div id="payment-gateway-id-<?php echo absint($PAY_ID); ?>" class="hidden"><?php
194
-                                echo ($payment->payment_method() instanceof EE_Payment_Method
195
-                                    ? esc_html($payment->payment_method()->ID())
196
-                                    : 0);
197
-                                ?></div>
194
+								echo ($payment->payment_method() instanceof EE_Payment_Method
195
+									? esc_html($payment->payment_method()->ID())
196
+									: 0);
197
+								?></div>
198 198
                         </td>
199 199
                         <td class=" jst-left">
200 200
                             <div id="payment-response-<?php echo absint($PAY_ID); ?>"><?php
201
-                                echo esc_html($payment->gateway_response());
202
-                                ?></div>
201
+								echo esc_html($payment->gateway_response());
202
+								?></div>
203 203
                         </td>
204 204
                         <td class=" jst-left payment-txn-id-chq-nmbr">
205 205
                             <div id="payment-txn-id-chq-nmbr-<?php echo absint($PAY_ID); ?>"><?php
206
-                                echo esc_html($payment->txn_id_chq_nmbr());
207
-                                ?></div>
206
+								echo esc_html($payment->txn_id_chq_nmbr());
207
+								?></div>
208 208
                         </td>
209 209
                         <td class=" jst-left">
210 210
                             <div id="payment-po-nmbr-<?php echo absint($PAY_ID); ?>"><?php
211
-                                echo esc_html($payment->po_number());
212
-                                ?></div>
211
+								echo esc_html($payment->po_number());
212
+								?></div>
213 213
                         </td>
214 214
                         <td class=" jst-left">
215 215
                             <div id="payment-accntng-<?php echo absint($PAY_ID); ?>"><?php
216
-                                echo esc_html($payment->extra_accntng());
217
-                                ?></div>
216
+								echo esc_html($payment->extra_accntng());
217
+								?></div>
218 218
                         </td>
219 219
                         <td class=" jst-rght">
220 220
                             <?php
221
-                            $payment_class = $payment->amount() > 0
222
-                                ? 'txn-admin-payment-status-' . $payment->STS_ID()
223
-                                : 'txn-admin-payment-status-PDC';
224
-                            ?>
221
+							$payment_class = $payment->amount() > 0
222
+								? 'txn-admin-payment-status-' . $payment->STS_ID()
223
+								: 'txn-admin-payment-status-PDC';
224
+							?>
225 225
                             <span class="<?php echo esc_attr($payment_class); ?>">
226 226
                                 <span id="payment-amount-<?php echo absint($PAY_ID); ?>" style="display:inline;"><?php
227
-                                    echo wp_kses(
228
-                                    EEH_Template::format_currency(
229
-                                        $payment->amount(),
230
-                                        false,
231
-                                        false
232
-                                    ),
233
-                                    AllowedTags::getAllowedTags()
234
-                                );
235
-                                ?></span>
227
+									echo wp_kses(
228
+									EEH_Template::format_currency(
229
+										$payment->amount(),
230
+										false,
231
+										false
232
+									),
233
+									AllowedTags::getAllowedTags()
234
+								);
235
+								?></span>
236 236
                             </span>
237 237
                         </td>
238 238
                     </tr>
239 239
                             <?php $payment_total += $payment->STS_ID() == 'PAP' ? $payment->amount() : 0; ?>
240 240
                         <?php endforeach; ?>
241 241
                         <?php $pay_totals_class = $payment_total > $grand_raw_total
242
-                            ? ' important-notice'
243
-                            : '';
244
-                        ?>
242
+							? ' important-notice'
243
+							: '';
244
+						?>
245 245
                     <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden">
246 246
                         <td class=" jst-rght" colspan="10">
247 247
                             <span class="important-notice"><?php
248
-                                echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
249
-                            ?></span>
248
+								echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
249
+							?></span>
250 250
                         </td>
251 251
                     </tr>
252 252
                     <tr id="txn-admin-payments-total-tr"
@@ -254,45 +254,45 @@  discard block
 block discarded – undo
254 254
                     >
255 255
                         <th class=" jst-rght" colspan="9">
256 256
                             <span id="payments-total-spn"><?php
257
-                            $overpaid = $payment_total > $grand_raw_total
258
-                                ? '<span id="overpaid">'
259
-                                  . __('This transaction has been overpaid ! ', 'event_espresso')
260
-                                  . '</span>'
261
-                                : '';
262
-                            echo wp_kses(
263
-                                $overpaid
264
-                                . sprintf(
265
-                                    __('Payments Total %s', 'event_espresso'),
266
-                                    '(' . EE_Registry::instance()->CFG->currency->code . ')'
267
-                                ),
268
-                                AllowedTags::getAllowedTags()
269
-                            ); ?></span>
257
+							$overpaid = $payment_total > $grand_raw_total
258
+								? '<span id="overpaid">'
259
+								  . __('This transaction has been overpaid ! ', 'event_espresso')
260
+								  . '</span>'
261
+								: '';
262
+							echo wp_kses(
263
+								$overpaid
264
+								. sprintf(
265
+									__('Payments Total %s', 'event_espresso'),
266
+									'(' . EE_Registry::instance()->CFG->currency->code . ')'
267
+								),
268
+								AllowedTags::getAllowedTags()
269
+							); ?></span>
270 270
                         </th>
271 271
                         <th class=" jst-rght">
272 272
                             <span id="txn-admin-payment-total"><?php
273
-                            echo wp_kses(
274
-                                EEH_Template::format_currency(
275
-                                    $payment_total,
276
-                                    false,
277
-                                    false
278
-                                ),
279
-                                AllowedTags::getAllowedTags()
280
-                            ); ?></span>
273
+							echo wp_kses(
274
+								EEH_Template::format_currency(
275
+									$payment_total,
276
+									false,
277
+									false
278
+								),
279
+								AllowedTags::getAllowedTags()
280
+							); ?></span>
281 281
                         </th>
282 282
                     </tr>
283 283
                     <?php else : ?>
284 284
                     <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr">
285 285
                         <td class=" jst-rght" colspan="10">
286 286
                             <span class="important-notice"><?php
287
-                                echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
288
-                            ?></span>
287
+								echo wp_kses($no_payment_text, AllowedTags::getAllowedTags());
288
+							?></span>
289 289
                         </td>
290 290
                     </tr>
291 291
                     <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden">
292 292
                         <th class=" jst-rght" colspan="9">
293 293
                             <span id="payments-total-spn"><?php
294
-                            echo esc_html__('Payments Total', 'event_espresso');
295
-                            ?></span>
294
+							echo esc_html__('Payments Total', 'event_espresso');
295
+							?></span>
296 296
                         </th>
297 297
                         <th class=" jst-rght">
298 298
                             <span id="txn-admin-payment-total"></span>
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
         <ul id="txn-admin-payment-options-ul">
361 361
             <?php if ($can_edit_payments) :
362
-                ?>
362
+				?>
363 363
                 <li>
364 364
                     <a id="display-txn-admin-apply-payment"
365 365
                        class="button-primary no-icon no-hide"
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
                 </li>
385 385
             <?php endif; ?>
386 386
             <?php
387
-            // Allows extend the fields at actions area.
388
-            do_action(
389
-                'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
390
-                $can_edit_payments
391
-            );
392
-            ?>
387
+			// Allows extend the fields at actions area.
388
+			do_action(
389
+				'AHEE__txn_admin_details_main_meta_box_txn_details__after_actions_buttons',
390
+				$can_edit_payments
391
+			);
392
+			?>
393 393
         </ul>
394 394
         <br class="clear" />
395 395
 
@@ -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"
@@ -408,23 +408,23 @@  discard block
 block discarded – undo
408 408
             >
409 409
                 <div class="ee-icon ee-icon-cash-edit float-left"></div>
410 410
                 <?php
411
-                printf(
412
-                    esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
413
-                    '<span></span>',
414
-                    $txn_nmbr['value']
415
-                );
416
-                ?>
411
+				printf(
412
+					esc_html__('Edit Payment #%s for Transaction #%s', 'event_espresso'),
413
+					'<span></span>',
414
+					$txn_nmbr['value']
415
+				);
416
+				?>
417 417
             </h2>
418 418
 
419 419
             <h2 id="admin-modal-dialog-edit-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;">
420 420
                 <div class="ee-icon ee-icon-cash-edit float-left"></div>
421 421
                 <?php
422
-                printf(
423
-                    esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
424
-                    '<span></span>',
425
-                    $txn_nmbr['value']
426
-                );
427
-                ?>
422
+				printf(
423
+					esc_html__('Edit Refund #%s for Transaction #%s', 'event_espresso'),
424
+					'<span></span>',
425
+					$txn_nmbr['value']
426
+				);
427
+				?>
428 428
             </h2>
429 429
 
430 430
             <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon"
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
             >
433 433
                 <div class="ee-icon ee-icon-cash-remove float-left"></div>
434 434
                 <?php
435
-                echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
436
-                echo esc_html($txn_nmbr['value']);
437
-                ?>
435
+				echo esc_html__('Apply a Refund to Transaction #', 'event_espresso');
436
+				echo esc_html($txn_nmbr['value']);
437
+				?>
438 438
             </h2>
439 439
 
440 440
             <form name="txn-admin-apply-payment-frm"
@@ -533,29 +533,29 @@  discard block
 block discarded – undo
533 533
                             >
534 534
                                 <?php foreach ($payment_methods as $method) : ?>
535 535
                                     <?php
536
-                                    $selected = $method->slug() == 'cash'
537
-                                        ? ' selected'
538
-                                        : '';
539
-                                    ?>
536
+									$selected = $method->slug() == 'cash'
537
+										? ' selected'
538
+										: '';
539
+									?>
540 540
                                     <option id="payment-method-opt-<?php echo esc_attr($method->slug()); ?>"
541 541
                                             value="<?php echo esc_attr($method->ID()); ?>"
542 542
                                         <?php echo esc_attr($selected); ?>
543 543
                                     >
544 544
                                         <?php
545
-                                        echo esc_html(
546
-                                            sanitize_key($method->admin_desc())
547
-                                                ? substr($method->admin_desc(), 0, 128)
548
-                                                : $method->admin_name()
549
-                                        );
550
-                                        ?>&nbsp;&nbsp;
545
+										echo esc_html(
546
+											sanitize_key($method->admin_desc())
547
+												? substr($method->admin_desc(), 0, 128)
548
+												: $method->admin_name()
549
+										);
550
+										?>&nbsp;&nbsp;
551 551
                                     </option>
552 552
                                 <?php endforeach; ?>
553 553
                             </select>
554 554
                             <p class="description">
555 555
                                 <?php esc_html_e(
556
-                                    'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
557
-                                    'event_espresso'
558
-                                ); ?>
556
+									'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash',
557
+									'event_espresso'
558
+								); ?>
559 559
                             </p>
560 560
                         </div>
561 561
 
@@ -563,9 +563,9 @@  discard block
 block discarded – undo
563 563
                             <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row">
564 564
                                 <label for="txn-admin-payment-txn-id-chq-nmbr-inp" class="">
565 565
                                     <?php esc_html_e(
566
-                                        'TXN ID / CHQ #',
567
-                                        'event_espresso'
568
-                                    ); ?>
566
+										'TXN ID / CHQ #',
567
+										'event_espresso'
568
+									); ?>
569 569
                                 </label>
570 570
                                 <input name="txn_admin_payment[txn_id_chq_nmbr]"
571 571
                                        id="txn-admin-payment-txn-id-chq-nmbr-inp"
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
                                 />
575 575
                                 <p class="description">
576 576
                                     <?php esc_html_e(
577
-                                        'The Transaction ID sent back from the payment gateway, or the Cheque #',
578
-                                        'event_espresso'
579
-                                    ); ?>
577
+										'The Transaction ID sent back from the payment gateway, or the Cheque #',
578
+										'event_espresso'
579
+									); ?>
580 580
                                 </p>
581 581
                             </div>
582 582
                         </div>
@@ -593,9 +593,9 @@  discard block
 block discarded – undo
593 593
                                 />
594 594
                                 <p class="description">
595 595
                                     <?php esc_html_e(
596
-                                        'The gateway response string (optional)',
597
-                                        'event_espresso'
598
-                                    ); ?>
596
+										'The gateway response string (optional)',
597
+										'event_espresso'
598
+									); ?>
599 599
                                 </p>
600 600
                             </div>
601 601
                         </div>
@@ -604,9 +604,9 @@  discard block
 block discarded – undo
604 604
                             <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row">
605 605
                                 <label for="txn-admin-payment-status-slct" class="">
606 606
                                     <?php esc_html_e(
607
-                                        'Payment Status',
608
-                                        'event_espresso'
609
-                                    ); ?>
607
+										'Payment Status',
608
+										'event_espresso'
609
+									); ?>
610 610
                                 </label>
611 611
                                 <select name="txn_admin_payment[status]"
612 612
                                         id="txn-admin-payment-status-slct"
@@ -615,10 +615,10 @@  discard block
 block discarded – undo
615 615
                                 >
616 616
                                     <?php foreach ($payment_status as $STS_ID => $STS_code) : ?>
617 617
                                         <?php
618
-                                        $selected = $STS_ID == 'PAP'
619
-                                            ? 'selected'
620
-                                            : '';
621
-                                        ?>
618
+										$selected = $STS_ID == 'PAP'
619
+											? 'selected'
620
+											: '';
621
+										?>
622 622
                                         <option id="payment-status-opt-<?php echo esc_attr($STS_ID); ?>"
623 623
                                                 value="<?php echo esc_attr($STS_ID); ?>"
624 624
                                             <?php echo esc_attr($selected); ?>
@@ -629,10 +629,10 @@  discard block
 block discarded – undo
629 629
                                 </select>
630 630
                                 <p class="description">
631 631
                                     <?php
632
-                                    esc_html_e(
633
-                                        'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
634
-                                        'event_espresso'
635
-                                    ); ?>
632
+									esc_html_e(
633
+										'Whether the payment was approved, cancelled, declined or failed after submission to the gateway',
634
+										'event_espresso'
635
+									); ?>
636 636
                                 </p>
637 637
                             </div>
638 638
                         </div>
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
                             />
650 650
                             <p class="description">
651 651
                                 <?php esc_html_e(
652
-                                    'The Purchase or Sales Order Number if any (optional)',
653
-                                    'event_espresso'
654
-                                ); ?>
652
+									'The Purchase or Sales Order Number if any (optional)',
653
+									'event_espresso'
654
+								); ?>
655 655
                             </p>
656 656
                         </div>
657 657
 
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
                             />
673 673
                             <p class="description">
674 674
                                 <?php esc_html_e(
675
-                                    'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
676
-                                    'event_espresso'
677
-                                ); ?>
675
+									'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.',
676
+									'event_espresso'
677
+								); ?>
678 678
                             </p>
679 679
                         </div>
680 680
 
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
                             <?php echo wp_kses($status_change_select, AllowedTags::getWithFormTags()); ?>
710 710
                             <p class="description">
711 711
                                 <?php esc_html_e(
712
-                                    'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
713
-                                    'event_espresso'
714
-                                ); ?>
712
+									'If you wish to change the status for the registrations selected above, then select which status from this dropdown.',
713
+									'event_espresso'
714
+								); ?>
715 715
                             </p>
716 716
                             <br />
717 717
                         </div>
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
                             <br class="clear-float" />
743 743
                             <p class="description">
744 744
                                 <?php printf(
745
-                                    esc_html__(
746
-                                        '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.',
747
-                                        'event_espresso'
748
-                                    ),
749
-                                    '<strong>',
750
-                                    '</strong>',
751
-                                    '<br />'
752
-                                ); ?>
745
+									esc_html__(
746
+										'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.',
747
+										'event_espresso'
748
+									),
749
+									'<strong>',
750
+									'</strong>',
751
+									'<br />'
752
+								); ?>
753 753
                             </p>
754 754
                         </div>
755 755
                         <div class="clear"></div>
@@ -814,10 +814,10 @@  discard block
 block discarded – undo
814 814
             >
815 815
                 <span class="ee-icon ee-icon-cash-add"></span>
816 816
                 <?php printf(
817
-                    esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
818
-                    $txn_nmbr['value']
819
-                );
820
-                ?>
817
+					esc_html__('Delete Payment/Refund for Transaction #', 'event_espresso'),
818
+					$txn_nmbr['value']
819
+				);
820
+				?>
821 821
             </h2>
822 822
 
823 823
             <form name="txn-admin-delete-payment-frm"
@@ -853,13 +853,13 @@  discard block
 block discarded – undo
853 853
                             <?php echo wp_kses($delete_status_change_select, AllowedTags::getWithFormTags()); ?>
854 854
                             <p class="description">
855 855
                                 <?php printf(
856
-                                    esc_html__(
857
-                                        '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',
858
-                                        'event_espresso'
859
-                                    ),
860
-                                    '<strong>',
861
-                                    '</strong>'
862
-                                ); ?>
856
+									esc_html__(
857
+										'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',
858
+										'event_espresso'
859
+									),
860
+									'<strong>',
861
+									'</strong>'
862
+								); ?>
863 863
                             </p>
864 864
                         </div>
865 865
 
@@ -874,10 +874,10 @@  discard block
 block discarded – undo
874 874
                             />
875 875
                             <p class="description">
876 876
                                 <?php
877
-                                esc_html_e(
878
-                                    '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.',
879
-                                    'event_espresso'
880
-                                ); ?>
877
+								esc_html_e(
878
+									'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.',
879
+									'event_espresso'
880
+								); ?>
881 881
                             </p>
882 882
                         </div>
883 883
                         <div class="clear"></div>
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
     <?php endif; // $grand_raw_total > 0?>
911 911
 
912 912
     <?php if (WP_DEBUG) {
913
-        $delivered_messages = get_option('EED_Messages__payment', []);
914
-        if (isset($delivered_messages[ $TXN_ID ])) { ?>
913
+		$delivered_messages = get_option('EED_Messages__payment', []);
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'); ?>
@@ -923,39 +923,39 @@  discard block
 block discarded – undo
923 923
                             <th class="jst-left"><?php esc_html_e('Date & Time', 'event_espresso'); ?></th>
924 924
                             <th class="jst-left"><?php esc_html_e('Message Type', 'event_espresso'); ?></th>
925 925
                             <th class="jst-left"><?php esc_html_e(
926
-                                'Payment Status Upon Sending',
927
-                                'event_espresso'
928
-                            ); ?></th>
926
+								'Payment Status Upon Sending',
927
+								'event_espresso'
928
+							); ?></th>
929 929
                             <th class="jst-left"><?php esc_html_e('TXN Status Upon Sending', 'event_espresso'); ?></th>
930 930
                         </tr>
931 931
                     </thead>
932 932
                     <tbody>
933 933
                         <?php
934
-                        foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
935
-                            ?>
934
+						foreach ($delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message) :
935
+							?>
936 936
                             <tr>
937 937
                                 <td class="jst-left">
938 938
                                     <?php echo esc_html(
939
-                                        date(
940
-                                            get_option('date_format') . ' ' . get_option('time_format'),
941
-                                            ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
942
-                                        )
943
-                                    ); ?>
939
+										date(
940
+											get_option('date_format') . ' ' . get_option('time_format'),
941
+											($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))
942
+										)
943
+									); ?>
944 944
                                 </td>
945 945
                                 <td class="jst-left"><?php
946
-                                    echo isset($delivered_message['message_type'])
947
-                                        ? esc_html($delivered_message['message_type'])
948
-                                        : ''; ?>
946
+									echo isset($delivered_message['message_type'])
947
+										? esc_html($delivered_message['message_type'])
948
+										: ''; ?>
949 949
                                 </td>
950 950
                                 <td class="jst-left"><?php
951
-                                    echo isset($delivered_message['pay_status'])
952
-                                        ? esc_html($delivered_message['pay_status'])
953
-                                        : ''; ?>
951
+									echo isset($delivered_message['pay_status'])
952
+										? esc_html($delivered_message['pay_status'])
953
+										: ''; ?>
954 954
                                 </td>
955 955
                                 <td class="jst-left"><?php
956
-                                    echo isset($delivered_message['txn_status'])
957
-                                        ? esc_html($delivered_message['txn_status'])
958
-                                        : ''; ?>
956
+									echo isset($delivered_message['txn_status'])
957
+										? esc_html($delivered_message['txn_status'])
958
+										: ''; ?>
959 959
                                 </td>
960 960
                             </tr>
961 961
                         <?php endforeach; // $delivered_messages?>
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                 </table>
964 964
             </div>
965 965
             <?php
966
-        }
967
-    }
968
-    ?>
966
+		}
967
+	}
968
+	?>
969 969
 </div>
Please login to merge, or discard this patch.
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.
admin_pages/general_settings/OrganizationSettings.php 2 patches
Indentation   +389 added lines, -389 removed lines patch added patch discarded remove patch
@@ -40,405 +40,405 @@
 block discarded – undo
40 40
  */
41 41
 class OrganizationSettings extends FormHandler
42 42
 {
43
-    protected EE_Organization_Config $organization_config;
43
+	protected EE_Organization_Config $organization_config;
44 44
 
45
-    protected EE_Core_Config $core_config;
45
+	protected EE_Core_Config $core_config;
46 46
 
47
-    protected EE_Network_Core_Config $network_core_config;
47
+	protected EE_Network_Core_Config $network_core_config;
48 48
 
49
-    protected CountrySubRegionDao $countrySubRegionDao;
49
+	protected CountrySubRegionDao $countrySubRegionDao;
50 50
 
51
-    /**
52
-     * Form constructor.
53
-     *
54
-     * @param EE_Registry             $registry
55
-     * @param EE_Organization_Config  $organization_config
56
-     * @param EE_Core_Config          $core_config
57
-     * @param EE_Network_Core_Config $network_core_config
58
-     * @param CountrySubRegionDao $countrySubRegionDao
59
-     * @throws InvalidArgumentException
60
-     * @throws InvalidDataTypeException
61
-     * @throws DomainException
62
-     */
63
-    public function __construct(
64
-        EE_Registry $registry,
65
-        EE_Organization_Config $organization_config,
66
-        EE_Core_Config $core_config,
67
-        EE_Network_Core_Config $network_core_config,
68
-        CountrySubRegionDao $countrySubRegionDao
69
-    ) {
70
-        $this->organization_config = $organization_config;
71
-        $this->core_config = $core_config;
72
-        $this->network_core_config = $network_core_config;
73
-        $this->countrySubRegionDao = $countrySubRegionDao;
74
-        parent::__construct(
75
-            esc_html__('Your Organization Settings', 'event_espresso'),
76
-            esc_html__('Your Organization Settings', 'event_espresso'),
77
-            'organization_settings',
78
-            '',
79
-            FormHandler::DO_NOT_SETUP_FORM,
80
-            $registry
81
-        );
82
-    }
51
+	/**
52
+	 * Form constructor.
53
+	 *
54
+	 * @param EE_Registry             $registry
55
+	 * @param EE_Organization_Config  $organization_config
56
+	 * @param EE_Core_Config          $core_config
57
+	 * @param EE_Network_Core_Config $network_core_config
58
+	 * @param CountrySubRegionDao $countrySubRegionDao
59
+	 * @throws InvalidArgumentException
60
+	 * @throws InvalidDataTypeException
61
+	 * @throws DomainException
62
+	 */
63
+	public function __construct(
64
+		EE_Registry $registry,
65
+		EE_Organization_Config $organization_config,
66
+		EE_Core_Config $core_config,
67
+		EE_Network_Core_Config $network_core_config,
68
+		CountrySubRegionDao $countrySubRegionDao
69
+	) {
70
+		$this->organization_config = $organization_config;
71
+		$this->core_config = $core_config;
72
+		$this->network_core_config = $network_core_config;
73
+		$this->countrySubRegionDao = $countrySubRegionDao;
74
+		parent::__construct(
75
+			esc_html__('Your Organization Settings', 'event_espresso'),
76
+			esc_html__('Your Organization Settings', 'event_espresso'),
77
+			'organization_settings',
78
+			'',
79
+			FormHandler::DO_NOT_SETUP_FORM,
80
+			$registry
81
+		);
82
+	}
83 83
 
84 84
 
85
-    /**
86
-     * creates and returns the actual form
87
-     *
88
-     * @return EE_Form_Section_Proper
89
-     * @throws EE_Error
90
-     * @throws InvalidArgumentException
91
-     * @throws InvalidDataTypeException
92
-     * @throws InvalidInterfaceException
93
-     * @throws ReflectionException
94
-     */
95
-    public function generate(): EE_Form_Section_Proper
96
-    {
97
-        $has_sub_regions = EEM_State::instance()->count(
98
-            array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
99
-        );
100
-        return apply_filters(
101
-            'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
102
-            new EE_Form_Section_Proper(
103
-                array(
104
-                    'name'            => 'organization_settings',
105
-                    'html_id'         => 'organization_settings',
106
-                    'layout_strategy' => new EE_Admin_Two_Column_Layout(),
107
-                    'subsections'     => array(
108
-                        'contact_information_hdr'        => new EE_Form_Section_HTML(
109
-                            EEH_HTML::h2(
110
-                                esc_html__('Contact Information', 'event_espresso')
111
-                                . ' '
112
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
113
-                                '',
114
-                                'contact-information-hdr'
115
-                            )
116
-                        ),
117
-                        'organization_name'      => new EE_Text_Input(
118
-                            array(
119
-                                'html_name' => 'organization_name',
120
-                                'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
121
-                                'html_help_text'  => esc_html__(
122
-                                    'Displayed on all emails and invoices.',
123
-                                    'event_espresso'
124
-                                ),
125
-                                'default'         => $this->organization_config->get_pretty('name'),
126
-                                'required'        => false,
127
-                            )
128
-                        ),
129
-                        'organization_address_1'      => new EE_Text_Input(
130
-                            array(
131
-                                'html_name' => 'organization_address_1',
132
-                                'html_label_text' => esc_html__('Street Address', 'event_espresso'),
133
-                                'default'         => $this->organization_config->get_pretty('address_1'),
134
-                                'required'        => false,
135
-                            )
136
-                        ),
137
-                        'organization_address_2'      => new EE_Text_Input(
138
-                            array(
139
-                                'html_name' => 'organization_address_2',
140
-                                'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
141
-                                'default'         => $this->organization_config->get_pretty('address_2'),
142
-                                'required'        => false,
143
-                            )
144
-                        ),
145
-                        'organization_city'      => new EE_Text_Input(
146
-                            array(
147
-                                'html_name' => 'organization_city',
148
-                                'html_label_text' => esc_html__('City', 'event_espresso'),
149
-                                'default'         => $this->organization_config->get_pretty('city'),
150
-                                'required'        => false,
151
-                            )
152
-                        ),
153
-                        'organization_country'      => new EE_Country_Select_Input(
154
-                            null,
155
-                            array(
156
-                                EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
157
-                                'html_name'       => 'organization_country',
158
-                                'html_label_text' => esc_html__('Country', 'event_espresso'),
159
-                                'default'         => $this->organization_config->CNT_ISO,
160
-                                'required'        => false,
161
-                                'html_help_text'  => sprintf(
162
-                                    esc_html__(
163
-                                        '%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
164
-                                        'event_espresso'
165
-                                    ),
166
-                                    '<span class="reminder-spn">',
167
-                                    '</span>'
168
-                                ),
169
-                            )
170
-                        ),
171
-                        'organization_state' => new EE_State_Select_Input(
172
-                            null,
173
-                            array(
174
-                                'html_name'       => 'organization_state',
175
-                                'html_label_text' => esc_html__('State/Province', 'event_espresso'),
176
-                                'default'         => $this->organization_config->STA_ID,
177
-                                'required'        => false,
178
-                                'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
179
-                                    ? sprintf(
180
-                                        esc_html__(
181
-                                            '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',
182
-                                            'event_espresso'
183
-                                        ),
184
-                                        '<span class="reminder-spn">',
185
-                                        '</span>',
186
-                                        '<br />'
187
-                                    )
188
-                                    : '',
189
-                            )
190
-                        ),
191
-                        'organization_zip'      => new EE_Text_Input(
192
-                            array(
193
-                                'html_name' => 'organization_zip',
194
-                                'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
195
-                                'default'         => $this->organization_config->get_pretty('zip'),
196
-                                'required'        => false,
197
-                            )
198
-                        ),
199
-                        'organization_email'      => new EE_Text_Input(
200
-                            array(
201
-                                'html_name' => 'organization_email',
202
-                                'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
203
-                                'html_help_text'  => sprintf(
204
-                                    esc_html__(
205
-                                        'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
206
-                                        'event_espresso'
207
-                                    ),
208
-                                    '<code>[CO_FORMATTED_EMAIL]</code>',
209
-                                    '<code>[CO_EMAIL]</code>'
210
-                                ),
211
-                                'default'         => $this->organization_config->get_pretty('email'),
212
-                                'required'        => false,
213
-                            )
214
-                        ),
215
-                        'organization_phone'      => new EE_Text_Input(
216
-                            array(
217
-                                'html_name' => 'organization_phone',
218
-                                'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
219
-                                'html_help_text'  => esc_html__(
220
-                                    'The phone number for your organization.',
221
-                                    'event_espresso'
222
-                                ),
223
-                                'default'         => $this->organization_config->get_pretty('phone'),
224
-                                'required'        => false,
225
-                            )
226
-                        ),
227
-                        'organization_vat'      => new EE_Text_Input(
228
-                            array(
229
-                                'html_name' => 'organization_vat',
230
-                                'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
231
-                                'html_help_text'  => esc_html__(
232
-                                    'The VAT/Tax Number may be displayed on invoices and receipts.',
233
-                                    'event_espresso'
234
-                                ),
235
-                                'default'         => $this->organization_config->get_pretty('vat'),
236
-                                'required'        => false,
237
-                            )
238
-                        ),
239
-                        'company_logo_hdr'        => new EE_Form_Section_HTML(
240
-                            EEH_HTML::h2(
241
-                                esc_html__('Company Logo', 'event_espresso')
242
-                                . ' '
243
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
244
-                                '',
245
-                                'company-logo-hdr'
246
-                            )
247
-                        ),
248
-                        'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
249
-                            array(
250
-                                'html_name' => 'organization_logo_url',
251
-                                'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
252
-                                'html_help_text'  => esc_html__(
253
-                                    'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
254
-                                    'event_espresso'
255
-                                ),
256
-                                'default'         => $this->organization_config->get_pretty('logo_url'),
257
-                                'required'        => false,
258
-                            )
259
-                        ),
260
-                        'social_links_hdr'        => new EE_Form_Section_HTML(
261
-                            EEH_HTML::h2(
262
-                                esc_html__('Social Links', 'event_espresso')
263
-                                . ' '
264
-                                . EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
265
-                                . EEH_HTML::br()
266
-                                . EEH_HTML::p(
267
-                                    esc_html__(
268
-                                        'Enter any links to social accounts for your organization here',
269
-                                        'event_espresso'
270
-                                    ),
271
-                                    '',
272
-                                    'description'
273
-                                ),
274
-                                '',
275
-                                'social-links-hdr'
276
-                            )
277
-                        ),
278
-                        'organization_facebook'      => new EE_Text_Input(
279
-                            array(
280
-                                'html_name' => 'organization_facebook',
281
-                                'html_label_text' => esc_html__('Facebook', 'event_espresso'),
282
-                                'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
283
-                                'default'         => $this->organization_config->get_pretty('facebook'),
284
-                                'required'        => false,
285
-                            )
286
-                        ),
287
-                        'organization_twitter'      => new EE_Text_Input(
288
-                            array(
289
-                                'html_name' => 'organization_twitter',
290
-                                'html_label_text' => esc_html__('Twitter', 'event_espresso'),
291
-                                'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
292
-                                'default'         => $this->organization_config->get_pretty('twitter'),
293
-                                'required'        => false,
294
-                            )
295
-                        ),
296
-                        'organization_linkedin'      => new EE_Text_Input(
297
-                            array(
298
-                                'html_name' => 'organization_linkedin',
299
-                                'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
300
-                                'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
301
-                                'default'         => $this->organization_config->get_pretty('linkedin'),
302
-                                'required'        => false,
303
-                            )
304
-                        ),
305
-                        'organization_pinterest'      => new EE_Text_Input(
306
-                            array(
307
-                                'html_name' => 'organization_pinterest',
308
-                                'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
309
-                                'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
310
-                                'default'         => $this->organization_config->get_pretty('pinterest'),
311
-                                'required'        => false,
312
-                            )
313
-                        ),
314
-                        'organization_instagram'      => new EE_Text_Input(
315
-                            array(
316
-                                'html_name' => 'organization_instagram',
317
-                                'html_label_text' => esc_html__('Instagram', 'event_espresso'),
318
-                                'other_html_attributes' => ' placeholder="instagram.com/handle"',
319
-                                'default'         => $this->organization_config->get_pretty('instagram'),
320
-                                'required'        => false,
321
-                            )
322
-                        ),
323
-                    ),
324
-                )
325
-            ),
326
-            $this,
327
-            $has_sub_regions
328
-        );
329
-    }
85
+	/**
86
+	 * creates and returns the actual form
87
+	 *
88
+	 * @return EE_Form_Section_Proper
89
+	 * @throws EE_Error
90
+	 * @throws InvalidArgumentException
91
+	 * @throws InvalidDataTypeException
92
+	 * @throws InvalidInterfaceException
93
+	 * @throws ReflectionException
94
+	 */
95
+	public function generate(): EE_Form_Section_Proper
96
+	{
97
+		$has_sub_regions = EEM_State::instance()->count(
98
+			array(array('Country.CNT_ISO' => $this->organization_config->CNT_ISO))
99
+		);
100
+		return apply_filters(
101
+			'FHEE__EventEspresso_admin_pages_general_settings_OrganizationSettings__generate__form',
102
+			new EE_Form_Section_Proper(
103
+				array(
104
+					'name'            => 'organization_settings',
105
+					'html_id'         => 'organization_settings',
106
+					'layout_strategy' => new EE_Admin_Two_Column_Layout(),
107
+					'subsections'     => array(
108
+						'contact_information_hdr'        => new EE_Form_Section_HTML(
109
+							EEH_HTML::h2(
110
+								esc_html__('Contact Information', 'event_espresso')
111
+								. ' '
112
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('contact_info_info')),
113
+								'',
114
+								'contact-information-hdr'
115
+							)
116
+						),
117
+						'organization_name'      => new EE_Text_Input(
118
+							array(
119
+								'html_name' => 'organization_name',
120
+								'html_label_text' => esc_html__('Organization Name', 'event_espresso'),
121
+								'html_help_text'  => esc_html__(
122
+									'Displayed on all emails and invoices.',
123
+									'event_espresso'
124
+								),
125
+								'default'         => $this->organization_config->get_pretty('name'),
126
+								'required'        => false,
127
+							)
128
+						),
129
+						'organization_address_1'      => new EE_Text_Input(
130
+							array(
131
+								'html_name' => 'organization_address_1',
132
+								'html_label_text' => esc_html__('Street Address', 'event_espresso'),
133
+								'default'         => $this->organization_config->get_pretty('address_1'),
134
+								'required'        => false,
135
+							)
136
+						),
137
+						'organization_address_2'      => new EE_Text_Input(
138
+							array(
139
+								'html_name' => 'organization_address_2',
140
+								'html_label_text' => esc_html__('Street Address 2', 'event_espresso'),
141
+								'default'         => $this->organization_config->get_pretty('address_2'),
142
+								'required'        => false,
143
+							)
144
+						),
145
+						'organization_city'      => new EE_Text_Input(
146
+							array(
147
+								'html_name' => 'organization_city',
148
+								'html_label_text' => esc_html__('City', 'event_espresso'),
149
+								'default'         => $this->organization_config->get_pretty('city'),
150
+								'required'        => false,
151
+							)
152
+						),
153
+						'organization_country'      => new EE_Country_Select_Input(
154
+							null,
155
+							array(
156
+								EE_Country_Select_Input::OPTION_GET_KEY => EE_Country_Select_Input::OPTION_GET_ALL,
157
+								'html_name'       => 'organization_country',
158
+								'html_label_text' => esc_html__('Country', 'event_espresso'),
159
+								'default'         => $this->organization_config->CNT_ISO,
160
+								'required'        => false,
161
+								'html_help_text'  => sprintf(
162
+									esc_html__(
163
+										'%1$sThe Country set here will have the effect of setting the currency used for all ticket prices.%2$s',
164
+										'event_espresso'
165
+									),
166
+									'<span class="reminder-spn">',
167
+									'</span>'
168
+								),
169
+							)
170
+						),
171
+						'organization_state' => new EE_State_Select_Input(
172
+							null,
173
+							array(
174
+								'html_name'       => 'organization_state',
175
+								'html_label_text' => esc_html__('State/Province', 'event_espresso'),
176
+								'default'         => $this->organization_config->STA_ID,
177
+								'required'        => false,
178
+								'html_help_text' => empty($this->organization_config->STA_ID) || ! $has_sub_regions
179
+									? sprintf(
180
+										esc_html__(
181
+											'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',
182
+											'event_espresso'
183
+										),
184
+										'<span class="reminder-spn">',
185
+										'</span>',
186
+										'<br />'
187
+									)
188
+									: '',
189
+							)
190
+						),
191
+						'organization_zip'      => new EE_Text_Input(
192
+							array(
193
+								'html_name' => 'organization_zip',
194
+								'html_label_text' => esc_html__('Zip/Postal Code', 'event_espresso'),
195
+								'default'         => $this->organization_config->get_pretty('zip'),
196
+								'required'        => false,
197
+							)
198
+						),
199
+						'organization_email'      => new EE_Text_Input(
200
+							array(
201
+								'html_name' => 'organization_email',
202
+								'html_label_text' => esc_html__('Primary Contact Email', 'event_espresso'),
203
+								'html_help_text'  => sprintf(
204
+									esc_html__(
205
+										'This is where notifications go to when you use the %1$s and %2$s shortcodes in the message templates.',
206
+										'event_espresso'
207
+									),
208
+									'<code>[CO_FORMATTED_EMAIL]</code>',
209
+									'<code>[CO_EMAIL]</code>'
210
+								),
211
+								'default'         => $this->organization_config->get_pretty('email'),
212
+								'required'        => false,
213
+							)
214
+						),
215
+						'organization_phone'      => new EE_Text_Input(
216
+							array(
217
+								'html_name' => 'organization_phone',
218
+								'html_label_text' => esc_html__('Phone Number', 'event_espresso'),
219
+								'html_help_text'  => esc_html__(
220
+									'The phone number for your organization.',
221
+									'event_espresso'
222
+								),
223
+								'default'         => $this->organization_config->get_pretty('phone'),
224
+								'required'        => false,
225
+							)
226
+						),
227
+						'organization_vat'      => new EE_Text_Input(
228
+							array(
229
+								'html_name' => 'organization_vat',
230
+								'html_label_text' => esc_html__('VAT/Tax Number', 'event_espresso'),
231
+								'html_help_text'  => esc_html__(
232
+									'The VAT/Tax Number may be displayed on invoices and receipts.',
233
+									'event_espresso'
234
+								),
235
+								'default'         => $this->organization_config->get_pretty('vat'),
236
+								'required'        => false,
237
+							)
238
+						),
239
+						'company_logo_hdr'        => new EE_Form_Section_HTML(
240
+							EEH_HTML::h2(
241
+								esc_html__('Company Logo', 'event_espresso')
242
+								. ' '
243
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('organization_logo_info')),
244
+								'',
245
+								'company-logo-hdr'
246
+							)
247
+						),
248
+						'organization_logo_url'      => new EE_Admin_File_Uploader_Input(
249
+							array(
250
+								'html_name' => 'organization_logo_url',
251
+								'html_label_text' => esc_html__('Upload New Logo', 'event_espresso'),
252
+								'html_help_text'  => esc_html__(
253
+									'Your logo will be used on custom invoices, tickets, certificates, and payment templates.',
254
+									'event_espresso'
255
+								),
256
+								'default'         => $this->organization_config->get_pretty('logo_url'),
257
+								'required'        => false,
258
+							)
259
+						),
260
+						'social_links_hdr'        => new EE_Form_Section_HTML(
261
+							EEH_HTML::h2(
262
+								esc_html__('Social Links', 'event_espresso')
263
+								. ' '
264
+								. EEH_HTML::span(EEH_Template::get_help_tab_link('social_links_info'))
265
+								. EEH_HTML::br()
266
+								. EEH_HTML::p(
267
+									esc_html__(
268
+										'Enter any links to social accounts for your organization here',
269
+										'event_espresso'
270
+									),
271
+									'',
272
+									'description'
273
+								),
274
+								'',
275
+								'social-links-hdr'
276
+							)
277
+						),
278
+						'organization_facebook'      => new EE_Text_Input(
279
+							array(
280
+								'html_name' => 'organization_facebook',
281
+								'html_label_text' => esc_html__('Facebook', 'event_espresso'),
282
+								'other_html_attributes' => ' placeholder="facebook.com/profile.name"',
283
+								'default'         => $this->organization_config->get_pretty('facebook'),
284
+								'required'        => false,
285
+							)
286
+						),
287
+						'organization_twitter'      => new EE_Text_Input(
288
+							array(
289
+								'html_name' => 'organization_twitter',
290
+								'html_label_text' => esc_html__('Twitter', 'event_espresso'),
291
+								'other_html_attributes' => ' placeholder="twitter.com/twitterhandle"',
292
+								'default'         => $this->organization_config->get_pretty('twitter'),
293
+								'required'        => false,
294
+							)
295
+						),
296
+						'organization_linkedin'      => new EE_Text_Input(
297
+							array(
298
+								'html_name' => 'organization_linkedin',
299
+								'html_label_text' => esc_html__('LinkedIn', 'event_espresso'),
300
+								'other_html_attributes' => ' placeholder="linkedin.com/in/profilename"',
301
+								'default'         => $this->organization_config->get_pretty('linkedin'),
302
+								'required'        => false,
303
+							)
304
+						),
305
+						'organization_pinterest'      => new EE_Text_Input(
306
+							array(
307
+								'html_name' => 'organization_pinterest',
308
+								'html_label_text' => esc_html__('Pinterest', 'event_espresso'),
309
+								'other_html_attributes' => ' placeholder="pinterest.com/profilename"',
310
+								'default'         => $this->organization_config->get_pretty('pinterest'),
311
+								'required'        => false,
312
+							)
313
+						),
314
+						'organization_instagram'      => new EE_Text_Input(
315
+							array(
316
+								'html_name' => 'organization_instagram',
317
+								'html_label_text' => esc_html__('Instagram', 'event_espresso'),
318
+								'other_html_attributes' => ' placeholder="instagram.com/handle"',
319
+								'default'         => $this->organization_config->get_pretty('instagram'),
320
+								'required'        => false,
321
+							)
322
+						),
323
+					),
324
+				)
325
+			),
326
+			$this,
327
+			$has_sub_regions
328
+		);
329
+	}
330 330
 
331 331
 
332
-    /**
333
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
334
-     * returns a string of HTML that can be directly echoed in a template
335
-     *
336
-     * @return string
337
-     * @throws EE_Error
338
-     * @throws InvalidArgumentException
339
-     * @throws InvalidDataTypeException
340
-     * @throws InvalidInterfaceException
341
-     * @throws LogicException
342
-     */
343
-    public function display()
344
-    {
345
-        $this->form()->enqueue_js();
346
-        return parent::display();
347
-    }
332
+	/**
333
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
334
+	 * returns a string of HTML that can be directly echoed in a template
335
+	 *
336
+	 * @return string
337
+	 * @throws EE_Error
338
+	 * @throws InvalidArgumentException
339
+	 * @throws InvalidDataTypeException
340
+	 * @throws InvalidInterfaceException
341
+	 * @throws LogicException
342
+	 */
343
+	public function display()
344
+	{
345
+		$this->form()->enqueue_js();
346
+		return parent::display();
347
+	}
348 348
 
349 349
 
350
-    /**
351
-     * handles processing the form submission
352
-     * returns true or false depending on whether the form was processed successfully or not
353
-     *
354
-     * @param array $form_data
355
-     * @return bool
356
-     * @throws InvalidFormSubmissionException
357
-     * @throws EE_Error
358
-     * @throws LogicException
359
-     * @throws InvalidArgumentException
360
-     * @throws InvalidDataTypeException
361
-     * @throws ReflectionException
362
-     */
363
-    public function process($form_data = array()): bool
364
-    {
365
-        // process form
366
-        $valid_data = (array) parent::process($form_data);
367
-        if (empty($valid_data)) {
368
-            return false;
369
-        }
350
+	/**
351
+	 * handles processing the form submission
352
+	 * returns true or false depending on whether the form was processed successfully or not
353
+	 *
354
+	 * @param array $form_data
355
+	 * @return bool
356
+	 * @throws InvalidFormSubmissionException
357
+	 * @throws EE_Error
358
+	 * @throws LogicException
359
+	 * @throws InvalidArgumentException
360
+	 * @throws InvalidDataTypeException
361
+	 * @throws ReflectionException
362
+	 */
363
+	public function process($form_data = array()): bool
364
+	{
365
+		// process form
366
+		$valid_data = (array) parent::process($form_data);
367
+		if (empty($valid_data)) {
368
+			return false;
369
+		}
370 370
 
371
-        if (is_main_site()) {
372
-            $this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
373
-                ? sanitize_text_field($form_data['ee_site_license_key'])
374
-                : $this->network_core_config->site_license_key;
375
-        }
376
-        $this->organization_config->name = isset($form_data['organization_name'])
377
-            ? sanitize_text_field($form_data['organization_name'])
378
-            : $this->organization_config->name;
379
-        $this->organization_config->address_1 = isset($form_data['organization_address_1'])
380
-            ? sanitize_text_field($form_data['organization_address_1'])
381
-            : $this->organization_config->address_1;
382
-        $this->organization_config->address_2 = isset($form_data['organization_address_2'])
383
-            ? sanitize_text_field($form_data['organization_address_2'])
384
-            : $this->organization_config->address_2;
385
-        $this->organization_config->city = isset($form_data['organization_city'])
386
-            ? sanitize_text_field($form_data['organization_city'])
387
-            : $this->organization_config->city;
388
-        $this->organization_config->STA_ID = isset($form_data['organization_state'])
389
-            ? absint($form_data['organization_state'])
390
-            : $this->organization_config->STA_ID;
391
-        $this->organization_config->CNT_ISO = isset($form_data['organization_country'])
392
-            ? sanitize_text_field($form_data['organization_country'])
393
-            : $this->organization_config->CNT_ISO;
394
-        $this->organization_config->zip = isset($form_data['organization_zip'])
395
-            ? sanitize_text_field($form_data['organization_zip'])
396
-            : $this->organization_config->zip;
397
-        $this->organization_config->email = isset($form_data['organization_email'])
398
-            ? sanitize_email($form_data['organization_email'])
399
-            : $this->organization_config->email;
400
-        $this->organization_config->vat = isset($form_data['organization_vat'])
401
-            ? sanitize_text_field($form_data['organization_vat'])
402
-            : $this->organization_config->vat;
403
-        $this->organization_config->phone = isset($form_data['organization_phone'])
404
-            ? sanitize_text_field($form_data['organization_phone'])
405
-            : $this->organization_config->phone;
406
-        $this->organization_config->logo_url = isset($form_data['organization_logo_url'])
407
-            ? esc_url_raw($form_data['organization_logo_url'])
408
-            : $this->organization_config->logo_url;
409
-        $this->organization_config->facebook = isset($form_data['organization_facebook'])
410
-            ? esc_url_raw($form_data['organization_facebook'])
411
-            : $this->organization_config->facebook;
412
-        $this->organization_config->twitter = isset($form_data['organization_twitter'])
413
-            ? esc_url_raw($form_data['organization_twitter'])
414
-            : $this->organization_config->twitter;
415
-        $this->organization_config->linkedin = isset($form_data['organization_linkedin'])
416
-            ? esc_url_raw($form_data['organization_linkedin'])
417
-            : $this->organization_config->linkedin;
418
-        $this->organization_config->pinterest = isset($form_data['organization_pinterest'])
419
-            ? esc_url_raw($form_data['organization_pinterest'])
420
-            : $this->organization_config->pinterest;
421
-        $this->organization_config->google = isset($form_data['organization_google'])
422
-            ? esc_url_raw($form_data['organization_google'])
423
-            : $this->organization_config->google;
424
-        $this->organization_config->instagram = isset($form_data['organization_instagram'])
425
-            ? esc_url_raw($form_data['organization_instagram'])
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)
429
-            : false;
430
-        $this->core_config->ee_ueip_has_notified = true;
371
+		if (is_main_site()) {
372
+			$this->network_core_config->site_license_key = isset($form_data['ee_site_license_key'])
373
+				? sanitize_text_field($form_data['ee_site_license_key'])
374
+				: $this->network_core_config->site_license_key;
375
+		}
376
+		$this->organization_config->name = isset($form_data['organization_name'])
377
+			? sanitize_text_field($form_data['organization_name'])
378
+			: $this->organization_config->name;
379
+		$this->organization_config->address_1 = isset($form_data['organization_address_1'])
380
+			? sanitize_text_field($form_data['organization_address_1'])
381
+			: $this->organization_config->address_1;
382
+		$this->organization_config->address_2 = isset($form_data['organization_address_2'])
383
+			? sanitize_text_field($form_data['organization_address_2'])
384
+			: $this->organization_config->address_2;
385
+		$this->organization_config->city = isset($form_data['organization_city'])
386
+			? sanitize_text_field($form_data['organization_city'])
387
+			: $this->organization_config->city;
388
+		$this->organization_config->STA_ID = isset($form_data['organization_state'])
389
+			? absint($form_data['organization_state'])
390
+			: $this->organization_config->STA_ID;
391
+		$this->organization_config->CNT_ISO = isset($form_data['organization_country'])
392
+			? sanitize_text_field($form_data['organization_country'])
393
+			: $this->organization_config->CNT_ISO;
394
+		$this->organization_config->zip = isset($form_data['organization_zip'])
395
+			? sanitize_text_field($form_data['organization_zip'])
396
+			: $this->organization_config->zip;
397
+		$this->organization_config->email = isset($form_data['organization_email'])
398
+			? sanitize_email($form_data['organization_email'])
399
+			: $this->organization_config->email;
400
+		$this->organization_config->vat = isset($form_data['organization_vat'])
401
+			? sanitize_text_field($form_data['organization_vat'])
402
+			: $this->organization_config->vat;
403
+		$this->organization_config->phone = isset($form_data['organization_phone'])
404
+			? sanitize_text_field($form_data['organization_phone'])
405
+			: $this->organization_config->phone;
406
+		$this->organization_config->logo_url = isset($form_data['organization_logo_url'])
407
+			? esc_url_raw($form_data['organization_logo_url'])
408
+			: $this->organization_config->logo_url;
409
+		$this->organization_config->facebook = isset($form_data['organization_facebook'])
410
+			? esc_url_raw($form_data['organization_facebook'])
411
+			: $this->organization_config->facebook;
412
+		$this->organization_config->twitter = isset($form_data['organization_twitter'])
413
+			? esc_url_raw($form_data['organization_twitter'])
414
+			: $this->organization_config->twitter;
415
+		$this->organization_config->linkedin = isset($form_data['organization_linkedin'])
416
+			? esc_url_raw($form_data['organization_linkedin'])
417
+			: $this->organization_config->linkedin;
418
+		$this->organization_config->pinterest = isset($form_data['organization_pinterest'])
419
+			? esc_url_raw($form_data['organization_pinterest'])
420
+			: $this->organization_config->pinterest;
421
+		$this->organization_config->google = isset($form_data['organization_google'])
422
+			? esc_url_raw($form_data['organization_google'])
423
+			: $this->organization_config->google;
424
+		$this->organization_config->instagram = isset($form_data['organization_instagram'])
425
+			? esc_url_raw($form_data['organization_instagram'])
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)
429
+			: false;
430
+		$this->core_config->ee_ueip_has_notified = true;
431 431
 
432
-        $this->registry->CFG->currency = new EE_Currency_Config(
433
-            $this->organization_config->CNT_ISO
434
-        );
435
-        /** @var EE_Country $country */
436
-        $country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
437
-        if ($country instanceof EE_Country) {
438
-            $country->set('CNT_active', 1);
439
-            $country->save();
440
-            $this->countrySubRegionDao->saveCountrySubRegions($country);
441
-        }
442
-        return true;
443
-    }
432
+		$this->registry->CFG->currency = new EE_Currency_Config(
433
+			$this->organization_config->CNT_ISO
434
+		);
435
+		/** @var EE_Country $country */
436
+		$country = EEM_Country::instance()->get_one_by_ID($this->organization_config->CNT_ISO);
437
+		if ($country instanceof EE_Country) {
438
+			$country->set('CNT_active', 1);
439
+			$country->save();
440
+			$this->countrySubRegionDao->saveCountrySubRegions($country);
441
+		}
442
+		return true;
443
+	}
444 444
 }
Please login to merge, or discard this patch.
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.
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
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -24,358 +24,358 @@
 block discarded – undo
24 24
 class EE_Brewing_Regular extends EE_BASE implements InterminableInterface
25 25
 {
26 26
 
27
-    /**
28
-     * @var EE_Dependency_Map
29
-     */
30
-    protected $dependency_map;
31
-
32
-    /**
33
-     * @var LoaderInterface
34
-     */
35
-    protected $loader;
36
-
37
-    /**
38
-     * @var TableAnalysis
39
-     */
40
-    protected $_table_analysis;
41
-
42
-
43
-    /**
44
-     * EE_Brewing_Regular constructor.
45
-     *
46
-     * @param EE_Dependency_Map $dependency_map
47
-     * @param LoaderInterface   $loader
48
-     * @param TableAnalysis     $table_analysis
49
-     */
50
-    public function __construct(
51
-        EE_Dependency_Map $dependency_map,
52
-        LoaderInterface $loader,
53
-        TableAnalysis $table_analysis
54
-    ) {
55
-        $this->dependency_map = $dependency_map;
56
-        $this->loader         = $loader;
57
-        $this->_table_analysis = $table_analysis;
58
-        if (defined('EE_CAFF_PATH')) {
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/');
64
-        }
65
-    }
66
-
67
-
68
-    /**
69
-     * @throws EE_Error
70
-     */
71
-    public function caffeinated()
72
-    {
73
-        $this->setInitializationHooks();
74
-        $this->setApiRegistrationHooks();
75
-        $this->setSwitchHooks();
76
-        $this->setDefaultFilterHooks();
77
-        // caffeinated constructed
78
-        do_action('AHEE__EE_Brewing_Regular__construct__complete');
79
-    }
80
-
81
-
82
-    public function initializePUE()
83
-    {
84
-        $this->dependency_map->registerDependencies(
85
-            PueLicensingManager::class,
86
-            [
87
-                'EE_Dependency_Map'                          => EE_Dependency_Map::load_from_cache,
88
-                'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
89
-            ]
90
-        );
91
-        /** @var PueLicensingManager $pue_manager */
92
-        $pue_manager = $this->loader->getShared(PueLicensingManager::class);
93
-        $pue_manager->registerDependencies();
94
-        $pue_manager->registerHooks();
95
-    }
96
-
97
-
98
-    /**
99
-     * Various hooks used for extending features via registration of modules or extensions.
100
-     *
101
-     * @throws EE_Error
102
-     */
103
-    private function setApiRegistrationHooks()
104
-    {
105
-        add_filter(
106
-            'FHEE__EE_Config__register_modules__modules_to_register',
107
-            [$this, 'caffeinated_modules_to_register']
108
-        );
109
-        add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10);
110
-        add_filter(
111
-            'AHEE__EE_System__load_core_configuration__complete',
112
-            function () {
113
-                EE_Register_Payment_Method::register(
114
-                    'caffeinated_payment_methods',
115
-                    [
116
-                        'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR),
117
-                    ]
118
-                );
119
-            }
120
-        );
121
-    }
122
-
123
-
124
-    /**
125
-     * Various hooks used for modifying initialization or activation processes.
126
-     */
127
-    private function setInitializationHooks()
128
-    {
129
-        // activation
130
-        add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']);
131
-        // load caff init
132
-        add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']);
133
-        // load caff scripts
134
-        add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10);
135
-    }
136
-
137
-
138
-    /**
139
-     * Various hooks used for switch (on/off) type filters.
140
-     */
141
-    private function setSwitchHooks()
142
-    {
143
-        // remove the "powered by" credit link from receipts and invoices
144
-        add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false');
145
-        // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer
146
-        add_filter('FHEE__ee_show_affiliate_links', '__return_false');
147
-    }
148
-
149
-
150
-    /**
151
-     * Various filters for affecting default configuration values in the caffeinated
152
-     * context.
153
-     */
154
-    private function setDefaultFilterHooks()
155
-    {
156
-        add_filter(
157
-            'FHEE__EE_Admin_Config__show_reg_footer__default',
158
-            '__return_true'
159
-        );
160
-    }
161
-
162
-
163
-    /**
164
-     * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
165
-     *
166
-     * @param array $paths original helper paths array
167
-     * @return array             new array of paths
168
-     */
169
-    public function caf_helper_paths(array $paths): array
170
-    {
171
-        $paths[] = EE_CAF_CORE . 'helpers/';
172
-        return $paths;
173
-    }
174
-
175
-
176
-    /**
177
-     * Upon brand-new activation, if this is a new activation of CAF, we want to add
178
-     * some global prices that will show off EE4's capabilities. However, if they're upgrading
179
-     * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices.
180
-     * This action should only be called when EE 4.x.0.P is initially activated.
181
-     * Right now the only CAF content are these global prices. If there's more in the future, then
182
-     * we should probably create a caf file to contain it all instead just a function like this.
183
-     * Right now, we ASSUME the only price types in the system are default ones
184
-     *
185
-     * @global wpdb $wpdb
186
-     */
187
-    public function initialize_caf_db_content()
188
-    {
189
-        global $wpdb;
190
-        // use same method of getting creator id as the version introducing the change
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";
194
-        if ($this->_get_table_analysis()->tableExists($price_type_table)) {
195
-            $SQL                  =
196
-                'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types
197
-            $tax_price_type_count = $wpdb->get_var($SQL);
198
-            if ($tax_price_type_count <= 1) {
199
-                $wpdb->insert(
200
-                    $price_type_table,
201
-                    [
202
-                        'PRT_name'       => esc_html__("Regional Tax", "event_espresso"),
203
-                        'PBT_ID'         => 4,
204
-                        'PRT_is_percent' => true,
205
-                        'PRT_order'      => 60,
206
-                        'PRT_deleted'    => false,
207
-                        'PRT_wp_user'    => $default_creator_id,
208
-                    ],
209
-                    [
210
-                        '%s',// PRT_name
211
-                        '%d',// PBT_id
212
-                        '%d',// PRT_is_percent
213
-                        '%d',// PRT_order
214
-                        '%d',// PRT_deleted
215
-                        '%d', // PRT_wp_user
216
-                    ]
217
-                );
218
-                // federal tax
219
-                $result = $wpdb->insert(
220
-                    $price_type_table,
221
-                    [
222
-                        'PRT_name'       => esc_html__("Federal Tax", "event_espresso"),
223
-                        'PBT_ID'         => 4,
224
-                        'PRT_is_percent' => true,
225
-                        'PRT_order'      => 70,
226
-                        'PRT_deleted'    => false,
227
-                        'PRT_wp_user'    => $default_creator_id,
228
-                    ],
229
-                    [
230
-                        '%s',// PRT_name
231
-                        '%d',// PBT_id
232
-                        '%d',// PRT_is_percent
233
-                        '%d',// PRT_order
234
-                        '%d',// PRT_deleted
235
-                        '%d' // PRT_wp_user
236
-                    ]
237
-                );
238
-                if ($result) {
239
-                    $wpdb->insert(
240
-                        $price_table,
241
-                        [
242
-                            'PRT_ID'         => $wpdb->insert_id,
243
-                            'PRC_amount'     => 15.00,
244
-                            'PRC_name'       => esc_html__("Sales Tax", "event_espresso"),
245
-                            'PRC_desc'       => '',
246
-                            'PRC_is_default' => true,
247
-                            'PRC_overrides'  => null,
248
-                            'PRC_deleted'    => false,
249
-                            'PRC_order'      => 50,
250
-                            'PRC_parent'     => null,
251
-                            'PRC_wp_user'    => $default_creator_id,
252
-                        ],
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
263
-                            '%d' // PRC_wp_user
264
-                        ]
265
-                    );
266
-                }
267
-            }
268
-        }
269
-    }
270
-
271
-
272
-    /**
273
-     *    caffeinated_modules_to_register
274
-     *
275
-     * @access public
276
-     * @param array $modules_to_register
277
-     * @return array
278
-     */
279
-    public function caffeinated_modules_to_register(array $modules_to_register = []): array
280
-    {
281
-        if (is_readable(EE_CAFF_PATH . 'modules')) {
282
-            $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR);
283
-            if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
284
-                $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
285
-            }
286
-        }
287
-        return $modules_to_register;
288
-    }
289
-
290
-
291
-    /**
292
-     * @throws EE_Error
293
-     * @throws InvalidArgumentException
294
-     * @throws ReflectionException
295
-     * @throws InvalidDataTypeException
296
-     * @throws InvalidInterfaceException
297
-     */
298
-    public function caffeinated_init()
299
-    {
300
-        // Custom Post Type hooks
301
-        add_filter(
302
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
303
-            [$this, 'filter_taxonomies']
304
-        );
305
-        add_filter(
306
-            'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
307
-            [$this, 'filter_cpts']
308
-        );
309
-        add_filter(
310
-            'FHEE__EE_Admin__get_extra_nav_menu_pages_items',
311
-            [$this, 'nav_metabox_items']
312
-        );
313
-        EE_Registry::instance()->load_file(
314
-            EE_CAFF_PATH,
315
-            'EE_Caf_Messages',
316
-            'class',
317
-            [],
318
-            false
319
-        );
320
-        // caffeinated_init__complete hook
321
-        do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
322
-    }
323
-
324
-
325
-    public function enqueue_caffeinated_scripts()
326
-    {
327
-        // sound of crickets...
328
-    }
329
-
330
-
331
-    /**
332
-     * callbacks below here
333
-     *
334
-     * @param array $taxonomy_array
335
-     * @return array
336
-     */
337
-    public function filter_taxonomies(array $taxonomy_array): array
338
-    {
339
-        $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true;
340
-        return $taxonomy_array;
341
-    }
342
-
343
-
344
-    /**
345
-     * @param array $cpt_array
346
-     * @return array
347
-     */
348
-    public function filter_cpts(array $cpt_array): array
349
-    {
350
-        $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true;
351
-        return $cpt_array;
352
-    }
353
-
354
-
355
-    /**
356
-     * @param array $menu_items
357
-     * @return array
358
-     */
359
-    public function nav_metabox_items(array $menu_items): array
360
-    {
361
-        $menu_items[] = [
362
-            'title'       => esc_html__('Venue List', 'event_espresso'),
363
-            'url'         => get_post_type_archive_link('espresso_venues'),
364
-            'description' => esc_html__('Archive page for all venues.', 'event_espresso'),
365
-        ];
366
-        return $menu_items;
367
-    }
368
-
369
-
370
-    /**
371
-     * Gets the injected table analyzer, or throws an exception
372
-     *
373
-     * @return TableAnalysis
374
-     */
375
-    protected function _get_table_analysis(): TableAnalysis
376
-    {
377
-        return $this->_table_analysis;
378
-    }
27
+	/**
28
+	 * @var EE_Dependency_Map
29
+	 */
30
+	protected $dependency_map;
31
+
32
+	/**
33
+	 * @var LoaderInterface
34
+	 */
35
+	protected $loader;
36
+
37
+	/**
38
+	 * @var TableAnalysis
39
+	 */
40
+	protected $_table_analysis;
41
+
42
+
43
+	/**
44
+	 * EE_Brewing_Regular constructor.
45
+	 *
46
+	 * @param EE_Dependency_Map $dependency_map
47
+	 * @param LoaderInterface   $loader
48
+	 * @param TableAnalysis     $table_analysis
49
+	 */
50
+	public function __construct(
51
+		EE_Dependency_Map $dependency_map,
52
+		LoaderInterface $loader,
53
+		TableAnalysis $table_analysis
54
+	) {
55
+		$this->dependency_map = $dependency_map;
56
+		$this->loader         = $loader;
57
+		$this->_table_analysis = $table_analysis;
58
+		if (defined('EE_CAFF_PATH')) {
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/');
64
+		}
65
+	}
66
+
67
+
68
+	/**
69
+	 * @throws EE_Error
70
+	 */
71
+	public function caffeinated()
72
+	{
73
+		$this->setInitializationHooks();
74
+		$this->setApiRegistrationHooks();
75
+		$this->setSwitchHooks();
76
+		$this->setDefaultFilterHooks();
77
+		// caffeinated constructed
78
+		do_action('AHEE__EE_Brewing_Regular__construct__complete');
79
+	}
80
+
81
+
82
+	public function initializePUE()
83
+	{
84
+		$this->dependency_map->registerDependencies(
85
+			PueLicensingManager::class,
86
+			[
87
+				'EE_Dependency_Map'                          => EE_Dependency_Map::load_from_cache,
88
+				'EventEspresso\core\services\loaders\Loader' => EE_Dependency_Map::load_from_cache,
89
+			]
90
+		);
91
+		/** @var PueLicensingManager $pue_manager */
92
+		$pue_manager = $this->loader->getShared(PueLicensingManager::class);
93
+		$pue_manager->registerDependencies();
94
+		$pue_manager->registerHooks();
95
+	}
96
+
97
+
98
+	/**
99
+	 * Various hooks used for extending features via registration of modules or extensions.
100
+	 *
101
+	 * @throws EE_Error
102
+	 */
103
+	private function setApiRegistrationHooks()
104
+	{
105
+		add_filter(
106
+			'FHEE__EE_Config__register_modules__modules_to_register',
107
+			[$this, 'caffeinated_modules_to_register']
108
+		);
109
+		add_filter('FHEE__EE_Registry__load_helper__helper_paths', [$this, 'caf_helper_paths'], 10);
110
+		add_filter(
111
+			'AHEE__EE_System__load_core_configuration__complete',
112
+			function () {
113
+				EE_Register_Payment_Method::register(
114
+					'caffeinated_payment_methods',
115
+					[
116
+						'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR),
117
+					]
118
+				);
119
+			}
120
+		);
121
+	}
122
+
123
+
124
+	/**
125
+	 * Various hooks used for modifying initialization or activation processes.
126
+	 */
127
+	private function setInitializationHooks()
128
+	{
129
+		// activation
130
+		add_action('AHEE__EEH_Activation__initialize_db_content', [$this, 'initialize_caf_db_content']);
131
+		// load caff init
132
+		add_action('AHEE__EE_System__set_hooks_for_core', [$this, 'caffeinated_init']);
133
+		// load caff scripts
134
+		add_action('wp_enqueue_scripts', [$this, 'enqueue_caffeinated_scripts'], 10);
135
+	}
136
+
137
+
138
+	/**
139
+	 * Various hooks used for switch (on/off) type filters.
140
+	 */
141
+	private function setSwitchHooks()
142
+	{
143
+		// remove the "powered by" credit link from receipts and invoices
144
+		add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false');
145
+		// seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer
146
+		add_filter('FHEE__ee_show_affiliate_links', '__return_false');
147
+	}
148
+
149
+
150
+	/**
151
+	 * Various filters for affecting default configuration values in the caffeinated
152
+	 * context.
153
+	 */
154
+	private function setDefaultFilterHooks()
155
+	{
156
+		add_filter(
157
+			'FHEE__EE_Admin_Config__show_reg_footer__default',
158
+			'__return_true'
159
+		);
160
+	}
161
+
162
+
163
+	/**
164
+	 * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths
165
+	 *
166
+	 * @param array $paths original helper paths array
167
+	 * @return array             new array of paths
168
+	 */
169
+	public function caf_helper_paths(array $paths): array
170
+	{
171
+		$paths[] = EE_CAF_CORE . 'helpers/';
172
+		return $paths;
173
+	}
174
+
175
+
176
+	/**
177
+	 * Upon brand-new activation, if this is a new activation of CAF, we want to add
178
+	 * some global prices that will show off EE4's capabilities. However, if they're upgrading
179
+	 * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices.
180
+	 * This action should only be called when EE 4.x.0.P is initially activated.
181
+	 * Right now the only CAF content are these global prices. If there's more in the future, then
182
+	 * we should probably create a caf file to contain it all instead just a function like this.
183
+	 * Right now, we ASSUME the only price types in the system are default ones
184
+	 *
185
+	 * @global wpdb $wpdb
186
+	 */
187
+	public function initialize_caf_db_content()
188
+	{
189
+		global $wpdb;
190
+		// use same method of getting creator id as the version introducing the change
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";
194
+		if ($this->_get_table_analysis()->tableExists($price_type_table)) {
195
+			$SQL                  =
196
+				'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types
197
+			$tax_price_type_count = $wpdb->get_var($SQL);
198
+			if ($tax_price_type_count <= 1) {
199
+				$wpdb->insert(
200
+					$price_type_table,
201
+					[
202
+						'PRT_name'       => esc_html__("Regional Tax", "event_espresso"),
203
+						'PBT_ID'         => 4,
204
+						'PRT_is_percent' => true,
205
+						'PRT_order'      => 60,
206
+						'PRT_deleted'    => false,
207
+						'PRT_wp_user'    => $default_creator_id,
208
+					],
209
+					[
210
+						'%s',// PRT_name
211
+						'%d',// PBT_id
212
+						'%d',// PRT_is_percent
213
+						'%d',// PRT_order
214
+						'%d',// PRT_deleted
215
+						'%d', // PRT_wp_user
216
+					]
217
+				);
218
+				// federal tax
219
+				$result = $wpdb->insert(
220
+					$price_type_table,
221
+					[
222
+						'PRT_name'       => esc_html__("Federal Tax", "event_espresso"),
223
+						'PBT_ID'         => 4,
224
+						'PRT_is_percent' => true,
225
+						'PRT_order'      => 70,
226
+						'PRT_deleted'    => false,
227
+						'PRT_wp_user'    => $default_creator_id,
228
+					],
229
+					[
230
+						'%s',// PRT_name
231
+						'%d',// PBT_id
232
+						'%d',// PRT_is_percent
233
+						'%d',// PRT_order
234
+						'%d',// PRT_deleted
235
+						'%d' // PRT_wp_user
236
+					]
237
+				);
238
+				if ($result) {
239
+					$wpdb->insert(
240
+						$price_table,
241
+						[
242
+							'PRT_ID'         => $wpdb->insert_id,
243
+							'PRC_amount'     => 15.00,
244
+							'PRC_name'       => esc_html__("Sales Tax", "event_espresso"),
245
+							'PRC_desc'       => '',
246
+							'PRC_is_default' => true,
247
+							'PRC_overrides'  => null,
248
+							'PRC_deleted'    => false,
249
+							'PRC_order'      => 50,
250
+							'PRC_parent'     => null,
251
+							'PRC_wp_user'    => $default_creator_id,
252
+						],
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
263
+							'%d' // PRC_wp_user
264
+						]
265
+					);
266
+				}
267
+			}
268
+		}
269
+	}
270
+
271
+
272
+	/**
273
+	 *    caffeinated_modules_to_register
274
+	 *
275
+	 * @access public
276
+	 * @param array $modules_to_register
277
+	 * @return array
278
+	 */
279
+	public function caffeinated_modules_to_register(array $modules_to_register = []): array
280
+	{
281
+		if (is_readable(EE_CAFF_PATH . 'modules')) {
282
+			$caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules/*', GLOB_ONLYDIR);
283
+			if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) {
284
+				$modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register);
285
+			}
286
+		}
287
+		return $modules_to_register;
288
+	}
289
+
290
+
291
+	/**
292
+	 * @throws EE_Error
293
+	 * @throws InvalidArgumentException
294
+	 * @throws ReflectionException
295
+	 * @throws InvalidDataTypeException
296
+	 * @throws InvalidInterfaceException
297
+	 */
298
+	public function caffeinated_init()
299
+	{
300
+		// Custom Post Type hooks
301
+		add_filter(
302
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies',
303
+			[$this, 'filter_taxonomies']
304
+		);
305
+		add_filter(
306
+			'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes',
307
+			[$this, 'filter_cpts']
308
+		);
309
+		add_filter(
310
+			'FHEE__EE_Admin__get_extra_nav_menu_pages_items',
311
+			[$this, 'nav_metabox_items']
312
+		);
313
+		EE_Registry::instance()->load_file(
314
+			EE_CAFF_PATH,
315
+			'EE_Caf_Messages',
316
+			'class',
317
+			[],
318
+			false
319
+		);
320
+		// caffeinated_init__complete hook
321
+		do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete');
322
+	}
323
+
324
+
325
+	public function enqueue_caffeinated_scripts()
326
+	{
327
+		// sound of crickets...
328
+	}
329
+
330
+
331
+	/**
332
+	 * callbacks below here
333
+	 *
334
+	 * @param array $taxonomy_array
335
+	 * @return array
336
+	 */
337
+	public function filter_taxonomies(array $taxonomy_array): array
338
+	{
339
+		$taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true;
340
+		return $taxonomy_array;
341
+	}
342
+
343
+
344
+	/**
345
+	 * @param array $cpt_array
346
+	 * @return array
347
+	 */
348
+	public function filter_cpts(array $cpt_array): array
349
+	{
350
+		$cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true;
351
+		return $cpt_array;
352
+	}
353
+
354
+
355
+	/**
356
+	 * @param array $menu_items
357
+	 * @return array
358
+	 */
359
+	public function nav_metabox_items(array $menu_items): array
360
+	{
361
+		$menu_items[] = [
362
+			'title'       => esc_html__('Venue List', 'event_espresso'),
363
+			'url'         => get_post_type_archive_link('espresso_venues'),
364
+			'description' => esc_html__('Archive page for all venues.', 'event_espresso'),
365
+		];
366
+		return $menu_items;
367
+	}
368
+
369
+
370
+	/**
371
+	 * Gets the injected table analyzer, or throws an exception
372
+	 *
373
+	 * @return TableAnalysis
374
+	 */
375
+	protected function _get_table_analysis(): TableAnalysis
376
+	{
377
+		return $this->_table_analysis;
378
+	}
379 379
 }
380 380
 
381 381
 
Please login to merge, or discard this patch.
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.
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/services/licensing/UserExperienceForm.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -16,129 +16,129 @@
 block discarded – undo
16 16
 
17 17
 class UserExperienceForm
18 18
 {
19
-    /**
20
-     * @var EE_Core_Config
21
-     */
22
-    protected $core_config;
19
+	/**
20
+	 * @var EE_Core_Config
21
+	 */
22
+	protected $core_config;
23 23
 
24
-    /**
25
-     * @var EE_Network_Core_Config
26
-     */
27
-    protected $network_core_config;
24
+	/**
25
+	 * @var EE_Network_Core_Config
26
+	 */
27
+	protected $network_core_config;
28 28
 
29 29
 
30
-    /**
31
-     * @param EE_Core_Config         $core_config
32
-     * @param EE_Network_Core_Config $network_core_config
33
-     */
34
-    public function __construct(EE_Core_Config $core_config, EE_Network_Core_Config $network_core_config)
35
-    {
36
-        $this->core_config         = $core_config;
37
-        $this->network_core_config = $network_core_config;
38
-    }
30
+	/**
31
+	 * @param EE_Core_Config         $core_config
32
+	 * @param EE_Network_Core_Config $network_core_config
33
+	 */
34
+	public function __construct(EE_Core_Config $core_config, EE_Network_Core_Config $network_core_config)
35
+	{
36
+		$this->core_config         = $core_config;
37
+		$this->network_core_config = $network_core_config;
38
+	}
39 39
 
40 40
 
41
-    /**
42
-     * @throws EE_Error
43
-     */
44
-    public function uxipFormSections(EE_Form_Section_Proper $org_settings_form ): EE_Form_Section_Proper
45
-    {
46
-        if (is_main_site()) {
47
-            $org_settings_form->add_subsections(
48
-                [
49
-                    'site_license_key_hdr' => new EE_Form_Section_HTML(
50
-                        EEH_HTML::h2(
51
-                            esc_html__('Your Event Espresso License Key', 'event_espresso')
52
-                            . ' '
53
-                            . EEH_HTML::span(
54
-                                EEH_Template::get_help_tab_link('site_license_key_info')
55
-                            ),
56
-                            '',
57
-                            'site-license-key-hdr'
58
-                        )
59
-                    ),
60
-                    'site_license_key'     => new EE_Text_Input(
61
-                        [
62
-                            'html_name'        => 'ee_site_license_key',
63
-                            'html_id'          => 'site_license_key',
64
-                            'html_label_text'  => esc_html__('Support License Key', 'event_espresso'),
65
-                            /** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
66
-                            'html_help_text'   => sprintf(
67
-                                esc_html__(
68
-                                    'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
69
-                                    'event_espresso'
70
-                                ),
71
-                                '<strong>',
72
-                                '</strong>'
73
-                            ),
74
-                            /** phpcs:enable */
75
-                            'default'          => $this->network_core_config->site_license_key ?? '',
76
-                            'required'         => false,
77
-                            'form_html_filter' => new VsprintfFilter(
78
-                                '%2$s %1$s',
79
-                                [$this->getValidationIndicator()]
80
-                            )
81
-                        ]
82
-                    )
83
-                ]
84
-            );
85
-            $org_settings_form->add_subsections(
86
-                [
87
-                    'uxip_optin_hdr' => new EE_Form_Section_HTML(Stats::optinText(false)),
88
-                    'ueip_optin'     => new EE_Checkbox_Multi_Input(
89
-                        [
90
-                            true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso')
91
-                        ],
92
-                        [
93
-                            'html_name'       => EE_Core_Config::OPTION_NAME_UXIP,
94
-                            'html_label_text' => esc_html__(
95
-                                'UXIP Opt In?',
96
-                                'event_espresso'
97
-                            ),
98
-                            'default'         => isset($this->core_config->ee_ueip_optin)
99
-                                ? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
100
-                                : false,
101
-                            'required'        => false,
102
-                        ]
103
-                    ),
104
-                ],
105
-                'organization_instagram',
106
-                false
107
-            );
108
-        }
109
-        return $org_settings_form;
110
-    }
41
+	/**
42
+	 * @throws EE_Error
43
+	 */
44
+	public function uxipFormSections(EE_Form_Section_Proper $org_settings_form ): EE_Form_Section_Proper
45
+	{
46
+		if (is_main_site()) {
47
+			$org_settings_form->add_subsections(
48
+				[
49
+					'site_license_key_hdr' => new EE_Form_Section_HTML(
50
+						EEH_HTML::h2(
51
+							esc_html__('Your Event Espresso License Key', 'event_espresso')
52
+							. ' '
53
+							. EEH_HTML::span(
54
+								EEH_Template::get_help_tab_link('site_license_key_info')
55
+							),
56
+							'',
57
+							'site-license-key-hdr'
58
+						)
59
+					),
60
+					'site_license_key'     => new EE_Text_Input(
61
+						[
62
+							'html_name'        => 'ee_site_license_key',
63
+							'html_id'          => 'site_license_key',
64
+							'html_label_text'  => esc_html__('Support License Key', 'event_espresso'),
65
+							/** phpcs:disable WordPress.WP.I18n.UnorderedPlaceholdersText */
66
+							'html_help_text'   => sprintf(
67
+								esc_html__(
68
+									'Adding a valid Support License Key will enable automatic update notifications and backend updates for Event Espresso Core and any installed add-ons. If this is a Development or Test site, %sDO NOT%s enter your Support License Key.',
69
+									'event_espresso'
70
+								),
71
+								'<strong>',
72
+								'</strong>'
73
+							),
74
+							/** phpcs:enable */
75
+							'default'          => $this->network_core_config->site_license_key ?? '',
76
+							'required'         => false,
77
+							'form_html_filter' => new VsprintfFilter(
78
+								'%2$s %1$s',
79
+								[$this->getValidationIndicator()]
80
+							)
81
+						]
82
+					)
83
+				]
84
+			);
85
+			$org_settings_form->add_subsections(
86
+				[
87
+					'uxip_optin_hdr' => new EE_Form_Section_HTML(Stats::optinText(false)),
88
+					'ueip_optin'     => new EE_Checkbox_Multi_Input(
89
+						[
90
+							true => esc_html__('Yes! I want to help improve Event Espresso!', 'event_espresso')
91
+						],
92
+						[
93
+							'html_name'       => EE_Core_Config::OPTION_NAME_UXIP,
94
+							'html_label_text' => esc_html__(
95
+								'UXIP Opt In?',
96
+								'event_espresso'
97
+							),
98
+							'default'         => isset($this->core_config->ee_ueip_optin)
99
+								? filter_var($this->core_config->ee_ueip_optin, FILTER_VALIDATE_BOOLEAN)
100
+								: false,
101
+							'required'        => false,
102
+						]
103
+					),
104
+				],
105
+				'organization_instagram',
106
+				false
107
+			);
108
+		}
109
+		return $org_settings_form;
110
+	}
111 111
 
112 112
 
113 113
 
114
-    /**
115
-     * Return whether the site license key has been verified or not.
116
-     *
117
-     * @return bool
118
-     */
119
-    private function licenseKeyVerified(): bool
120
-    {
121
-        if (empty($this->network_core_config->site_license_key)) {
122
-            return false;
123
-        }
124
-        $verify_fail = get_option(
125
-            'puvererr_' . basename(EE_PLUGIN_BASENAME),
126
-            false
127
-        );
128
-        return $verify_fail === false
129
-               || (
130
-                   ! empty($this->network_core_config->site_license_key)
131
-                   && $verify_fail === false
132
-               );
133
-    }
114
+	/**
115
+	 * Return whether the site license key has been verified or not.
116
+	 *
117
+	 * @return bool
118
+	 */
119
+	private function licenseKeyVerified(): bool
120
+	{
121
+		if (empty($this->network_core_config->site_license_key)) {
122
+			return false;
123
+		}
124
+		$verify_fail = get_option(
125
+			'puvererr_' . basename(EE_PLUGIN_BASENAME),
126
+			false
127
+		);
128
+		return $verify_fail === false
129
+			   || (
130
+				   ! empty($this->network_core_config->site_license_key)
131
+				   && $verify_fail === false
132
+			   );
133
+	}
134 134
 
135 135
 
136
-    /**
137
-     * @return string
138
-     */
139
-    private function getValidationIndicator(): string
140
-    {
141
-        $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
142
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
143
-    }
136
+	/**
137
+	 * @return string
138
+	 */
139
+	private function getValidationIndicator(): string
140
+	{
141
+		$verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
142
+		return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
143
+	}
144 144
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     /**
42 42
      * @throws EE_Error
43 43
      */
44
-    public function uxipFormSections(EE_Form_Section_Proper $org_settings_form ): EE_Form_Section_Proper
44
+    public function uxipFormSections(EE_Form_Section_Proper $org_settings_form): EE_Form_Section_Proper
45 45
     {
46 46
         if (is_main_site()) {
47 47
             $org_settings_form->add_subsections(
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             return false;
123 123
         }
124 124
         $verify_fail = get_option(
125
-            'puvererr_' . basename(EE_PLUGIN_BASENAME),
125
+            'puvererr_'.basename(EE_PLUGIN_BASENAME),
126 126
             false
127 127
         );
128 128
         return $verify_fail === false
@@ -139,6 +139,6 @@  discard block
 block discarded – undo
139 139
     private function getValidationIndicator(): string
140 140
     {
141 141
         $verified_class = $this->licenseKeyVerified() ? 'ee-icon-color-ee-green' : 'ee-icon-color-ee-red';
142
-        return '<span class="dashicons dashicons-admin-network ' . $verified_class . ' ee-icon-size-20"></span>';
142
+        return '<span class="dashicons dashicons-admin-network '.$verified_class.' ee-icon-size-20"></span>';
143 143
     }
144 144
 }
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.