Completed
Branch FET-3467-waitlists (78124b)
by
unknown
141:27 queued 128:30
created
core/domain/entities/shortcodes/EspressoEventAttendees.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function processShortcode($attributes = array())
89 89
     {
90 90
         // grab attributes and merge with defaults
91
-        $attributes = $this->getAttributes((array)$attributes);
91
+        $attributes = $this->getAttributes((array) $attributes);
92 92
         // add attributes to template args
93 93
         $this->template_args['show_gravatar'] = $attributes['show_gravatar'];
94 94
         // add required objects: event, datetime, and ticket
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      * @return EE_Event|null
155 155
      * @throws \EE_Error
156 156
      */
157
-    private function getEventAndQueryParams(array $attributes){
157
+    private function getEventAndQueryParams(array $attributes) {
158 158
         if ( ! empty($attributes['event_id'])) {
159 159
             $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
160 160
             if ($event instanceof EE_Event) {
Please login to merge, or discard this patch.
Indentation   +239 added lines, -239 removed lines patch added patch discarded remove patch
@@ -28,245 +28,245 @@
 block discarded – undo
28 28
 class EspressoEventAttendees extends EspressoShortcode
29 29
 {
30 30
 
31
-    private $query_params = array(
32
-        0 => array()
33
-    );
34
-
35
-    private $template_args = array(
36
-        'contacts'      => array(),
37
-        'event'         => null,
38
-        'datetime'      => null,
39
-        'ticket'        => null,
40
-    );
41
-
42
-    /**
43
-     * the actual shortcode tag that gets registered with WordPress
44
-     *
45
-     * @return string
46
-     */
47
-    public function getTag()
48
-    {
49
-        return 'ESPRESSO_EVENT_ATTENDEES';
50
-    }
51
-
52
-
53
-
54
-    /**
55
-     * the time in seconds to cache the results of the processShortcode() method
56
-     * 0 means the processShortcode() results will NOT be cached at all
57
-     *
58
-     * @return int
59
-     */
60
-    public function cacheExpiration()
61
-    {
62
-        return HOUR_IN_SECONDS;
63
-    }
64
-
65
-
66
-
67
-    /**
68
-     * a place for adding any initialization code that needs to run prior to wp_header().
69
-     * this may be required for shortcodes that utilize a corresponding module,
70
-     * and need to enqueue assets for that module
71
-     *
72
-     * @return void
73
-     */
74
-    public function initializeShortcode()
75
-    {
76
-        // required by interface, but nothing to do atm
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
-     *  [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event.
84
-     *  [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event.
85
-     *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime.
86
-     *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket.
87
-     *  [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees
88
-     *                                          regardless of status.  Note default is to only return approved attendees
89
-     *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar.  Otherwise if this is set
90
-     *                                                  then return gravatar for email address given.
91
-     *  Note: because of the relationship between event_id, ticket_id, and datetime_id.
92
-     * If more than one of those params is included then preference is given to the following:
93
-     *  - event_id is used whenever its present and any others are ignored.
94
-     *  - if no event_id then datetime is used whenever its present and any others are ignored.
95
-     *  - otherwise ticket_id is used if present.
96
-     *
97
-     * @param array $attributes
98
-     * @return string
99
-     * @throws \EE_Error
100
-     */
101
-    public function processShortcode($attributes = array())
102
-    {
103
-        // grab attributes and merge with defaults
104
-        $attributes = $this->getAttributes((array)$attributes);
105
-        // add attributes to template args
106
-        $this->template_args['show_gravatar'] = $attributes['show_gravatar'];
107
-        // add required objects: event, datetime, and ticket
108
-        $this->template_args['event'] = $this->getEventAndQueryParams($attributes);
109
-        $this->template_args['datetime'] = $this->getDatetimeAndQueryParams($attributes);
110
-        $this->template_args['ticket'] = $this->getTicketAndQueryParams($attributes);
111
-
112
-        // if any of the above objects is invalid or missing,
113
-        // then there was an invalid parameter or the shortcode was used incorrectly
114
-        // so when WP_DEBUG is set and true, we'll show a message,
115
-        // otherwise we'll just return an empty string.
116
-         if (
117
-            ! $this->template_args['event'] instanceof EE_Event
118
-            || empty($this->query_params[0])
119
-            || ($attributes['datetime_id'] && ! $this->template_args['datetime'] instanceof EE_Datetime)
120
-            || ($attributes['ticket_id'] && ! $this->template_args['ticket'] instanceof EE_Ticket)
121
-        ) {
122
-            if (WP_DEBUG) {
123
-                return '<div class="important-notice ee-attention">'
124
-                       . esc_html__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.',
125
-                        'event_espresso')
126
-                       . '</div>';
127
-            } else {
128
-                return '';
129
-            }
130
-        }
131
-        $this->setAdditionalQueryParams($attributes);
132
-        //get contacts!
133
-        $this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
134
-        //all set let's load up the template and return.
135
-        return EEH_Template::locate_template('loop-espresso_event_attendees.php', $this->template_args, true, true);
136
-    }
137
-
138
-
139
-
140
-    /**
141
-     * merge incoming attributes with filtered defaults
142
-     *
143
-     * @param array $attributes
144
-     * @return array
145
-     */
146
-    private function getAttributes(array $attributes)
147
-    {
148
-        return array_merge(
149
-            (array) apply_filters(
150
-                'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
151
-                array(
152
-                    'event_id'      => null,
153
-                    'datetime_id'   => null,
154
-                    'ticket_id'     => null,
155
-                    'status'        => EEM_Registration::status_id_approved,
156
-                    'show_gravatar' => false
157
-                )
158
-            ),
159
-            $attributes
160
-        );
161
-    }
162
-
163
-
164
-
165
-    /**
166
-     * @param array $attributes
167
-     * @return EE_Event|null
168
-     * @throws \EE_Error
169
-     */
170
-    private function getEventAndQueryParams(array $attributes){
171
-        if ( ! empty($attributes['event_id'])) {
172
-            $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
173
-            if ($event instanceof EE_Event) {
174
-                $this->query_params[0]['Registration.EVT_ID'] = $attributes['event_id'];
175
-                return $event;
176
-            }
177
-        }
178
-        //seems like is_espresso_event_single() isn't working as expected. So using alternate method.
179
-        if (is_single() && is_espresso_event()) {
180
-            $event = EEH_Event_View::get_event();
181
-            if ($event instanceof EE_Event) {
182
-                $this->query_params[0]['Registration.EVT_ID'] = $event->ID();
183
-                return $event;
184
-            }
185
-        }
186
-        // one last shot...
187
-        // try getting the earliest active event
188
-        $events = EEM_Event::instance()->get_active_events(array(
189
-            'limit'    => 1,
190
-            'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
191
-        ));
192
-        //  if none then get the next upcoming
193
-        $events = empty($events)
194
-            ? EEM_Event::instance()->get_upcoming_events(array(
195
-                'limit'    => 1,
196
-                'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
197
-            ))
198
-            : $events;
199
-        $event = reset($events);
200
-        if ($event instanceof EE_Event) {
201
-            $this->query_params[0]['Registration.EVT_ID'] = $event->ID();
202
-            return $event;
203
-        }
204
-        return null;
205
-    }
206
-
207
-
208
-
209
-    /**
210
-     * @param array $attributes
211
-     * @return EE_Datetime|null
212
-     */
213
-    private function getDatetimeAndQueryParams(array $attributes)
214
-    {
215
-        if ( ! empty($attributes['datetime_id'])) {
216
-            $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
217
-            if ($datetime instanceof EE_Datetime) {
218
-                $this->query_params[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
219
-                $this->query_params['default_where_conditions'] = 'this_model_only';
220
-                if ( ! $this->template_args['event'] instanceof EE_Event) {
221
-                    $this->template_args['event'] = $datetime->event();
222
-                }
223
-                return $datetime;
224
-            }
225
-        }
226
-        return null;
227
-    }
228
-
229
-
230
-
231
-    /**
232
-     * @param array $attributes
233
-     * @return \EE_Base_Class|null
234
-     * @throws \EE_Error
235
-     */
236
-    private function getTicketAndQueryParams(array $attributes)
237
-    {
238
-        if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
239
-            $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
240
-            if ($ticket instanceof EE_Ticket) {
241
-                $this->query_params[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
242
-                if ( ! $this->template_args['event'] instanceof EE_Event) {
243
-                    $this->template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime
244
-                        ? $ticket->first_datetime()->event()
245
-                        : null;
246
-                }
247
-                return $ticket;
248
-            }
249
-        }
250
-        return null;
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * @param array $attributes
257
-     */
258
-    private function setAdditionalQueryParams(array $attributes)
259
-    {
260
-        $reg_status_array = EEM_Registration::reg_status_array();
261
-        if ($attributes['status'] !== 'all' && isset($reg_status_array[$attributes['status']])) {
262
-            $this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
263
-        }
264
-        $this->query_params['group_by'] = array('ATT_ID');
265
-        $this->query_params['order_by'] = (array) apply_filters(
266
-            'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
267
-            array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
268
-        );
269
-    }
31
+	private $query_params = array(
32
+		0 => array()
33
+	);
34
+
35
+	private $template_args = array(
36
+		'contacts'      => array(),
37
+		'event'         => null,
38
+		'datetime'      => null,
39
+		'ticket'        => null,
40
+	);
41
+
42
+	/**
43
+	 * the actual shortcode tag that gets registered with WordPress
44
+	 *
45
+	 * @return string
46
+	 */
47
+	public function getTag()
48
+	{
49
+		return 'ESPRESSO_EVENT_ATTENDEES';
50
+	}
51
+
52
+
53
+
54
+	/**
55
+	 * the time in seconds to cache the results of the processShortcode() method
56
+	 * 0 means the processShortcode() results will NOT be cached at all
57
+	 *
58
+	 * @return int
59
+	 */
60
+	public function cacheExpiration()
61
+	{
62
+		return HOUR_IN_SECONDS;
63
+	}
64
+
65
+
66
+
67
+	/**
68
+	 * a place for adding any initialization code that needs to run prior to wp_header().
69
+	 * this may be required for shortcodes that utilize a corresponding module,
70
+	 * and need to enqueue assets for that module
71
+	 *
72
+	 * @return void
73
+	 */
74
+	public function initializeShortcode()
75
+	{
76
+		// required by interface, but nothing to do atm
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
+	 *  [ESPRESSO_EVENT_ATTENDEES] - defaults to attendees for earliest active event, or earliest upcoming event.
84
+	 *  [ESPRESSO_EVENT_ATTENDEES event_id=123] - attendees for specific event.
85
+	 *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245] - attendees for a specific datetime.
86
+	 *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123] - attendees for a specific ticket.
87
+	 *  [ESPRESSO_EVENT_ATTENDEES status=all] - specific registration status (use status id) or all for all attendees
88
+	 *                                          regardless of status.  Note default is to only return approved attendees
89
+	 *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true] - default is to not return gravatar.  Otherwise if this is set
90
+	 *                                                  then return gravatar for email address given.
91
+	 *  Note: because of the relationship between event_id, ticket_id, and datetime_id.
92
+	 * If more than one of those params is included then preference is given to the following:
93
+	 *  - event_id is used whenever its present and any others are ignored.
94
+	 *  - if no event_id then datetime is used whenever its present and any others are ignored.
95
+	 *  - otherwise ticket_id is used if present.
96
+	 *
97
+	 * @param array $attributes
98
+	 * @return string
99
+	 * @throws \EE_Error
100
+	 */
101
+	public function processShortcode($attributes = array())
102
+	{
103
+		// grab attributes and merge with defaults
104
+		$attributes = $this->getAttributes((array)$attributes);
105
+		// add attributes to template args
106
+		$this->template_args['show_gravatar'] = $attributes['show_gravatar'];
107
+		// add required objects: event, datetime, and ticket
108
+		$this->template_args['event'] = $this->getEventAndQueryParams($attributes);
109
+		$this->template_args['datetime'] = $this->getDatetimeAndQueryParams($attributes);
110
+		$this->template_args['ticket'] = $this->getTicketAndQueryParams($attributes);
111
+
112
+		// if any of the above objects is invalid or missing,
113
+		// then there was an invalid parameter or the shortcode was used incorrectly
114
+		// so when WP_DEBUG is set and true, we'll show a message,
115
+		// otherwise we'll just return an empty string.
116
+		 if (
117
+			! $this->template_args['event'] instanceof EE_Event
118
+			|| empty($this->query_params[0])
119
+			|| ($attributes['datetime_id'] && ! $this->template_args['datetime'] instanceof EE_Datetime)
120
+			|| ($attributes['ticket_id'] && ! $this->template_args['ticket'] instanceof EE_Ticket)
121
+		) {
122
+			if (WP_DEBUG) {
123
+				return '<div class="important-notice ee-attention">'
124
+					   . esc_html__('The [ESPRESSO_EVENT_ATTENDEES] shortcode has been used incorrectly.  Please double check the arguments you used for any typos.  In the case of ID type arguments, its possible the given ID does not correspond to existing data in the database.',
125
+						'event_espresso')
126
+					   . '</div>';
127
+			} else {
128
+				return '';
129
+			}
130
+		}
131
+		$this->setAdditionalQueryParams($attributes);
132
+		//get contacts!
133
+		$this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
134
+		//all set let's load up the template and return.
135
+		return EEH_Template::locate_template('loop-espresso_event_attendees.php', $this->template_args, true, true);
136
+	}
137
+
138
+
139
+
140
+	/**
141
+	 * merge incoming attributes with filtered defaults
142
+	 *
143
+	 * @param array $attributes
144
+	 * @return array
145
+	 */
146
+	private function getAttributes(array $attributes)
147
+	{
148
+		return array_merge(
149
+			(array) apply_filters(
150
+				'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
151
+				array(
152
+					'event_id'      => null,
153
+					'datetime_id'   => null,
154
+					'ticket_id'     => null,
155
+					'status'        => EEM_Registration::status_id_approved,
156
+					'show_gravatar' => false
157
+				)
158
+			),
159
+			$attributes
160
+		);
161
+	}
162
+
163
+
164
+
165
+	/**
166
+	 * @param array $attributes
167
+	 * @return EE_Event|null
168
+	 * @throws \EE_Error
169
+	 */
170
+	private function getEventAndQueryParams(array $attributes){
171
+		if ( ! empty($attributes['event_id'])) {
172
+			$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
173
+			if ($event instanceof EE_Event) {
174
+				$this->query_params[0]['Registration.EVT_ID'] = $attributes['event_id'];
175
+				return $event;
176
+			}
177
+		}
178
+		//seems like is_espresso_event_single() isn't working as expected. So using alternate method.
179
+		if (is_single() && is_espresso_event()) {
180
+			$event = EEH_Event_View::get_event();
181
+			if ($event instanceof EE_Event) {
182
+				$this->query_params[0]['Registration.EVT_ID'] = $event->ID();
183
+				return $event;
184
+			}
185
+		}
186
+		// one last shot...
187
+		// try getting the earliest active event
188
+		$events = EEM_Event::instance()->get_active_events(array(
189
+			'limit'    => 1,
190
+			'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
191
+		));
192
+		//  if none then get the next upcoming
193
+		$events = empty($events)
194
+			? EEM_Event::instance()->get_upcoming_events(array(
195
+				'limit'    => 1,
196
+				'order_by' => array('Datetime.DTT_EVT_start' => 'ASC')
197
+			))
198
+			: $events;
199
+		$event = reset($events);
200
+		if ($event instanceof EE_Event) {
201
+			$this->query_params[0]['Registration.EVT_ID'] = $event->ID();
202
+			return $event;
203
+		}
204
+		return null;
205
+	}
206
+
207
+
208
+
209
+	/**
210
+	 * @param array $attributes
211
+	 * @return EE_Datetime|null
212
+	 */
213
+	private function getDatetimeAndQueryParams(array $attributes)
214
+	{
215
+		if ( ! empty($attributes['datetime_id'])) {
216
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
217
+			if ($datetime instanceof EE_Datetime) {
218
+				$this->query_params[0]['Registration.Ticket.Datetime.DTT_ID'] = $attributes['datetime_id'];
219
+				$this->query_params['default_where_conditions'] = 'this_model_only';
220
+				if ( ! $this->template_args['event'] instanceof EE_Event) {
221
+					$this->template_args['event'] = $datetime->event();
222
+				}
223
+				return $datetime;
224
+			}
225
+		}
226
+		return null;
227
+	}
228
+
229
+
230
+
231
+	/**
232
+	 * @param array $attributes
233
+	 * @return \EE_Base_Class|null
234
+	 * @throws \EE_Error
235
+	 */
236
+	private function getTicketAndQueryParams(array $attributes)
237
+	{
238
+		if ( ! empty($attributes['ticket_id']) && empty($attributes['event_id']) && empty($attributes['datetime_id'])) {
239
+			$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
240
+			if ($ticket instanceof EE_Ticket) {
241
+				$this->query_params[0]['Registration.TKT_ID'] = $attributes['ticket_id'];
242
+				if ( ! $this->template_args['event'] instanceof EE_Event) {
243
+					$this->template_args['event'] = $ticket->first_datetime() instanceof EE_Datetime
244
+						? $ticket->first_datetime()->event()
245
+						: null;
246
+				}
247
+				return $ticket;
248
+			}
249
+		}
250
+		return null;
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * @param array $attributes
257
+	 */
258
+	private function setAdditionalQueryParams(array $attributes)
259
+	{
260
+		$reg_status_array = EEM_Registration::reg_status_array();
261
+		if ($attributes['status'] !== 'all' && isset($reg_status_array[$attributes['status']])) {
262
+			$this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
263
+		}
264
+		$this->query_params['group_by'] = array('ATT_ID');
265
+		$this->query_params['order_by'] = (array) apply_filters(
266
+			'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
267
+			array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
268
+		);
269
+	}
270 270
 
271 271
 
272 272
 
Please login to merge, or discard this patch.
core/domain/SetHooksInterface.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,33 +8,33 @@
 block discarded – undo
8 8
 interface SetHooksInterface
9 9
 {
10 10
 
11
-    /**
12
-     * a place to add action and filter hooks for regular frontend requests
13
-     *
14
-     * @return void
15
-     */
16
-    public function setHooks();
17
-
18
-    /**
19
-     * a place to add action and filter hooks for regular WP admin requests
20
-     *
21
-     * @return void
22
-     */
23
-    public function setAdminHooks();
24
-
25
-    /**
26
-     * a place to add action and filter hooks for AJAX requests
27
-     *
28
-     * @return void
29
-     */
30
-    public function setAjaxHooks();
31
-
32
-    /**
33
-     * a place to add action and filter hooks for REST API requests
34
-     *
35
-     * @return void
36
-     */
37
-    public function setApiHooks();
11
+	/**
12
+	 * a place to add action and filter hooks for regular frontend requests
13
+	 *
14
+	 * @return void
15
+	 */
16
+	public function setHooks();
17
+
18
+	/**
19
+	 * a place to add action and filter hooks for regular WP admin requests
20
+	 *
21
+	 * @return void
22
+	 */
23
+	public function setAdminHooks();
24
+
25
+	/**
26
+	 * a place to add action and filter hooks for AJAX requests
27
+	 *
28
+	 * @return void
29
+	 */
30
+	public function setAjaxHooks();
31
+
32
+	/**
33
+	 * a place to add action and filter hooks for REST API requests
34
+	 *
35
+	 * @return void
36
+	 */
37
+	public function setApiHooks();
38 38
 
39 39
 }
40 40
 // End of file SetHooksInterface.php
Please login to merge, or discard this patch.
shortcodes/espresso_events/EES_Espresso_Events.shortcode.php 3 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param WP $WP
32 32
 	 * @return    void
33 33
 	 */
34
-	public function run( WP $WP ) {
34
+	public function run(WP $WP) {
35 35
 	}
36 36
 
37 37
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      *  @param 	array 	$attributes
42 42
 	 *  @return 	string
43 43
 	 */
44
-	public function process_shortcode( $attributes = array() ) {
44
+	public function process_shortcode($attributes = array()) {
45 45
         \EE_Error::doing_it_wrong(
46 46
             __METHOD__,
47 47
             __(
Please login to merge, or discard this patch.
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@  discard block
 block discarded – undo
10 10
 class EES_Espresso_Events  extends EES_Shortcode {
11 11
 
12 12
 	/**
13
-     * @deprecated 4.9.27
14
-     *  @return 	void
13
+	 * @deprecated 4.9.27
14
+	 *  @return 	void
15 15
 	 */
16 16
 	public static function set_hooks() {
17 17
 	}
18 18
 
19 19
 	/**
20
-     * @deprecated 4.9.27
21
-     *  @return 	void
20
+	 * @deprecated 4.9.27
21
+	 *  @return 	void
22 22
 	 */
23 23
 	public static function set_hooks_admin() {
24 24
 	}
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 	/**
29
-     * @deprecated 4.9.27
30
-     * @param WP $WP
29
+	 * @deprecated 4.9.27
30
+	 * @param WP $WP
31 31
 	 * @return    void
32 32
 	 */
33 33
 	public function run( WP $WP ) {
@@ -36,21 +36,21 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 	/**
39
-     * @deprecated 4.9.27
40
-     *  @param 	array 	$attributes
39
+	 * @deprecated 4.9.27
40
+	 *  @param 	array 	$attributes
41 41
 	 *  @return 	string
42 42
 	 */
43 43
 	public function process_shortcode( $attributes = array() ) {
44
-        \EE_Error::doing_it_wrong(
45
-            __METHOD__,
46
-            __(
47
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.',
48
-                'event_espresso'
49
-            ),
50
-            '4.9.27'
51
-        );
52
-        return '';
53
-    }
44
+		\EE_Error::doing_it_wrong(
45
+			__METHOD__,
46
+			__(
47
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEvents instead.',
48
+				'event_espresso'
49
+			),
50
+			'4.9.27'
51
+		);
52
+		return '';
53
+	}
54 54
 
55 55
 
56 56
 
@@ -74,23 +74,23 @@  discard block
 block discarded – undo
74 74
  */
75 75
 class EE_Event_List_Query {
76 76
 
77
-    /**
78
-     * EE_Event_List_Query constructor.
79
-     *
80
-     * @param array $args
81
-     */
82
-    public function __construct($args = array())
83
-    {
84
-        \EE_Error::doing_it_wrong(
85
-            __METHOD__,
86
-            __(
87
-                'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
88
-                'event_espresso'
89
-            ),
90
-            '4.9.27'
91
-        );
92
-        new \EventEspresso\core\domain\services\wp_queries\EventListQuery($args);
93
-    }
77
+	/**
78
+	 * EE_Event_List_Query constructor.
79
+	 *
80
+	 * @param array $args
81
+	 */
82
+	public function __construct($args = array())
83
+	{
84
+		\EE_Error::doing_it_wrong(
85
+			__METHOD__,
86
+			__(
87
+				'Usage is deprecated. Please use \EventEspresso\core\domain\services\wp_queries\EventListQuery instead.',
88
+				'event_espresso'
89
+			),
90
+			'4.9.27'
91
+		);
92
+		new \EventEspresso\core\domain\services\wp_queries\EventListQuery($args);
93
+	}
94 94
 
95 95
 }
96 96
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * ESPRESSO_EVENTS
4 6
  *
Please login to merge, or discard this patch.
espresso_event_attendees/EES_Espresso_Event_Attendees.shortcode.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param       WP $WP
19 19
 	 * @return    void
20 20
 	 */
21
-	public function run( WP $WP ) {}
21
+	public function run(WP $WP) {}
22 22
 
23 23
 
24 24
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      * @return string
48 48
      * @throws \EE_Error
49 49
      */
50
-	public function process_shortcode( $attributes = array() ) {
50
+	public function process_shortcode($attributes = array()) {
51 51
         \EE_Error::doing_it_wrong(
52 52
             __METHOD__,
53 53
             __(
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,22 +41,22 @@
 block discarded – undo
41 41
 
42 42
 
43 43
 
44
-    /**
45
-     * @deprecated 4.9.27
46
-     * @param array $attributes
47
-     * @return string
48
-     * @throws \EE_Error
49
-     */
44
+	/**
45
+	 * @deprecated 4.9.27
46
+	 * @param array $attributes
47
+	 * @return string
48
+	 * @throws \EE_Error
49
+	 */
50 50
 	public function process_shortcode( $attributes = array() ) {
51
-        \EE_Error::doing_it_wrong(
52
-            __METHOD__,
53
-            __(
54
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendeesShortcode instead.',
55
-                'event_espresso'
56
-            ),
57
-            '4.9.27'
58
-        );
59
-        return '';
51
+		\EE_Error::doing_it_wrong(
52
+			__METHOD__,
53
+			__(
54
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoEventAttendeesShortcode instead.',
55
+				'event_espresso'
56
+			),
57
+			'4.9.27'
58
+		);
59
+		return '';
60 60
 	}
61 61
 
62 62
 
Please login to merge, or discard this patch.
modules/single_page_checkout/EED_Single_Page_Checkout.module.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -214,16 +214,16 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public static function set_definitions()
216 216
     {
217
-        if(defined('SPCO_BASE_PATH')) {
217
+        if (defined('SPCO_BASE_PATH')) {
218 218
             return;
219 219
         }
220
-        define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS);
221
-        define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
222
-        define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
223
-        define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
224
-        define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
225
-        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
226
-        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
220
+        define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS);
221
+        define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS);
222
+        define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS);
223
+        define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS);
224
+        define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS);
225
+        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS);
226
+        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS);
227 227
         EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
228 228
         EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
229 229
             __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
             '</h4>',
233 233
             '<br />',
234 234
             '<p>',
235
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
235
+            '<a href="'.get_post_type_archive_link('espresso_events').'" title="',
236 236
             '">',
237 237
             '</a>',
238 238
             '</p>'
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
             return;
256 256
         }
257 257
         // filter list of reg_steps
258
-        $reg_steps_to_load = (array)apply_filters(
258
+        $reg_steps_to_load = (array) apply_filters(
259 259
             'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
260 260
             EED_Single_Page_Checkout::get_reg_steps()
261 261
         );
@@ -299,25 +299,25 @@  discard block
 block discarded – undo
299 299
         if (empty($reg_steps)) {
300 300
             $reg_steps = array(
301 301
                 10  => array(
302
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
302
+                    'file_path'  => SPCO_REG_STEPS_PATH.'attendee_information',
303 303
                     'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
304 304
                     'slug'       => 'attendee_information',
305 305
                     'has_hooks'  => false,
306 306
                 ),
307 307
                 20  => array(
308
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
308
+                    'file_path'  => SPCO_REG_STEPS_PATH.'registration_confirmation',
309 309
                     'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
310 310
                     'slug'       => 'registration_confirmation',
311 311
                     'has_hooks'  => false,
312 312
                 ),
313 313
                 30  => array(
314
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
314
+                    'file_path'  => SPCO_REG_STEPS_PATH.'payment_options',
315 315
                     'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
316 316
                     'slug'       => 'payment_options',
317 317
                     'has_hooks'  => true,
318 318
                 ),
319 319
                 999 => array(
320
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
320
+                    'file_path'  => SPCO_REG_STEPS_PATH.'finalize_registration',
321 321
                     'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
322 322
                     'slug'       => 'finalize_registration',
323 323
                     'has_hooks'  => false,
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
             // DEBUG LOG
498 498
             //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
499 499
             // get reg form
500
-            if( ! $this->_check_form_submission()) {
500
+            if ( ! $this->_check_form_submission()) {
501 501
                 EED_Single_Page_Checkout::$_initialized = true;
502 502
                 return;
503 503
             }
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
                     if ( ! $registration instanceof EE_Registration) {
1063 1063
                         throw new InvalidEntityException($registration, 'EE_Registration');
1064 1064
                     }
1065
-                    $registrations[ $registration->ID() ] = $registration;
1065
+                    $registrations[$registration->ID()] = $registration;
1066 1066
                 }
1067 1067
             }
1068 1068
             $registration_processor->fix_reg_final_price_rounding_issue($transaction);
@@ -1296,7 +1296,7 @@  discard block
 block discarded – undo
1296 1296
                         ) {
1297 1297
                             EE_Error::add_success(
1298 1298
                                 $this->checkout->current_step->success_message()
1299
-                                . '<br />' . $this->checkout->next_step->_instructions()
1299
+                                . '<br />'.$this->checkout->next_step->_instructions()
1300 1300
                             );
1301 1301
                         }
1302 1302
                         // pack it up, pack it in...
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
             '</h4>',
1394 1394
             '<br />',
1395 1395
             '<p>',
1396
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1396
+            '<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1397 1397
             '">',
1398 1398
             '</a>',
1399 1399
             '</p>'
@@ -1419,12 +1419,12 @@  discard block
 block discarded – undo
1419 1419
     public function enqueue_styles_and_scripts()
1420 1420
     {
1421 1421
         // load css
1422
-        wp_register_style('single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1422
+        wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1423 1423
         wp_enqueue_style('single_page_checkout');
1424 1424
         // load JS
1425
-        wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array('jquery'), '1.0.1', true);
1426
-        wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', true);
1427
-        wp_register_script('single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, true);
1425
+        wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery	.plugin.min.js', array('jquery'), '1.0.1', true);
1426
+        wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', true);
1427
+        wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, true);
1428 1428
         if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) {
1429 1429
             $this->checkout->registration_form->enqueue_js();
1430 1430
         }
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
          * dynamic action hook for enqueueing styles and scripts with spco calls.
1442 1442
          * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1443 1443
          */
1444
-        do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this);
1444
+        do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this);
1445 1445
     }
1446 1446
 
1447 1447
 
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
                     'layout_strategy' =>
1494 1494
                         new EE_Template_Layout(
1495 1495
                             array(
1496
-                                'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1496
+                                'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php',
1497 1497
                                 'template_args'        => array(
1498 1498
                                     'empty_cart'              => $empty_cart,
1499 1499
                                     'revisit'                 => $this->checkout->revisit,
@@ -1507,7 +1507,7 @@  discard block
 block discarded – undo
1507 1507
                                         sprintf(
1508 1508
                                             __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.',
1509 1509
                                                 'event_espresso'),
1510
-                                            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1510
+                                            '<a href="'.get_post_type_archive_link('espresso_events').'" title="',
1511 1511
                                             '">',
1512 1512
                                             '</a>'
1513 1513
                                         )
@@ -1564,7 +1564,7 @@  discard block
 block discarded – undo
1564 1564
         ) {
1565 1565
             add_filter(
1566 1566
                 'FHEE__EEH_Template__powered_by_event_espresso__url',
1567
-                function ($url) {
1567
+                function($url) {
1568 1568
                     return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1569 1569
                 }
1570 1570
             );
Please login to merge, or discard this patch.
Indentation   +1719 added lines, -1719 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 use EventEspresso\core\exceptions\InvalidEntityException;
3 3
 
4 4
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
-    exit('No direct script access allowed');
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -17,1724 +17,1724 @@  discard block
 block discarded – undo
17 17
 class EED_Single_Page_Checkout extends EED_Module
18 18
 {
19 19
 
20
-    /**
21
-     * $_initialized - has the SPCO controller already been initialized ?
22
-     *
23
-     * @access private
24
-     * @var bool $_initialized
25
-     */
26
-    private static $_initialized = false;
27
-
28
-
29
-    /**
30
-     * $_checkout_verified - is the EE_Checkout verified as correct for this request ?
31
-     *
32
-     * @access private
33
-     * @var bool $_valid_checkout
34
-     */
35
-    private static $_checkout_verified = true;
36
-
37
-    /**
38
-     *    $_reg_steps_array - holds initial array of reg steps
39
-     *
40
-     * @access private
41
-     * @var array $_reg_steps_array
42
-     */
43
-    private static $_reg_steps_array = array();
44
-
45
-    /**
46
-     *    $checkout - EE_Checkout object for handling the properties of the current checkout process
47
-     *
48
-     * @access public
49
-     * @var EE_Checkout $checkout
50
-     */
51
-    public $checkout;
52
-
53
-
54
-
55
-    /**
56
-     * @return EED_Single_Page_Checkout
57
-     */
58
-    public static function instance()
59
-    {
60
-        add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
61
-        return parent::get_instance(__CLASS__);
62
-    }
63
-
64
-
65
-
66
-    /**
67
-     * @return EE_CART
68
-     */
69
-    public function cart()
70
-    {
71
-        return $this->checkout->cart;
72
-    }
73
-
74
-
75
-
76
-    /**
77
-     * @return EE_Transaction
78
-     */
79
-    public function transaction()
80
-    {
81
-        return $this->checkout->transaction;
82
-    }
83
-
84
-
85
-
86
-    /**
87
-     *    set_hooks - for hooking into EE Core, other modules, etc
88
-     *
89
-     * @access    public
90
-     * @return    void
91
-     * @throws \EE_Error
92
-     */
93
-    public static function set_hooks()
94
-    {
95
-        EED_Single_Page_Checkout::set_definitions();
96
-    }
97
-
98
-
99
-
100
-    /**
101
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
102
-     *
103
-     * @access    public
104
-     * @return    void
105
-     * @throws \EE_Error
106
-     */
107
-    public static function set_hooks_admin()
108
-    {
109
-        EED_Single_Page_Checkout::set_definitions();
110
-        if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
111
-            return;
112
-        }
113
-        // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
114
-        ob_start();
115
-        EED_Single_Page_Checkout::load_request_handler();
116
-        EED_Single_Page_Checkout::load_reg_steps();
117
-        // set ajax hooks
118
-        add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
119
-        add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
120
-        add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
121
-        add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
122
-        add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
123
-        add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
124
-    }
125
-
126
-
127
-
128
-    /**
129
-     *    process ajax request
130
-     *
131
-     * @param string $ajax_action
132
-     * @throws \EE_Error
133
-     */
134
-    public static function process_ajax_request($ajax_action)
135
-    {
136
-        EE_Registry::instance()->REQ->set('action', $ajax_action);
137
-        EED_Single_Page_Checkout::instance()->_initialize();
138
-    }
139
-
140
-
141
-
142
-    /**
143
-     *    ajax display registration step
144
-     *
145
-     * @throws \EE_Error
146
-     */
147
-    public static function display_reg_step()
148
-    {
149
-        EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
150
-    }
151
-
152
-
153
-
154
-    /**
155
-     *    ajax process registration step
156
-     *
157
-     * @throws \EE_Error
158
-     */
159
-    public static function process_reg_step()
160
-    {
161
-        EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
162
-    }
163
-
164
-
165
-
166
-    /**
167
-     *    ajax process registration step
168
-     *
169
-     * @throws \EE_Error
170
-     */
171
-    public static function update_reg_step()
172
-    {
173
-        EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
174
-    }
175
-
176
-
177
-
178
-    /**
179
-     *   update_checkout
180
-     *
181
-     * @access public
182
-     * @return void
183
-     * @throws \EE_Error
184
-     */
185
-    public static function update_checkout()
186
-    {
187
-        EED_Single_Page_Checkout::process_ajax_request('update_checkout');
188
-    }
189
-
190
-
191
-
192
-    /**
193
-     *    load_request_handler
194
-     *
195
-     * @access    public
196
-     * @return    void
197
-     */
198
-    public static function load_request_handler()
199
-    {
200
-        // load core Request_Handler class
201
-        if ( ! isset(EE_Registry::instance()->REQ)) {
202
-            EE_Registry::instance()->load_core('Request_Handler');
203
-        }
204
-    }
205
-
206
-
207
-
208
-    /**
209
-     *    set_definitions
210
-     *
211
-     * @access    public
212
-     * @return    void
213
-     * @throws \EE_Error
214
-     */
215
-    public static function set_definitions()
216
-    {
217
-        if(defined('SPCO_BASE_PATH')) {
218
-            return;
219
-        }
220
-        define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS);
221
-        define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
222
-        define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
223
-        define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
224
-        define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
225
-        define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
226
-        define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
227
-        EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
228
-        EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
229
-            __('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
230
-                'event_espresso'),
231
-            '<h4 class="important-notice">',
232
-            '</h4>',
233
-            '<br />',
234
-            '<p>',
235
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
236
-            '">',
237
-            '</a>',
238
-            '</p>'
239
-        );
240
-    }
241
-
242
-
243
-
244
-    /**
245
-     * load_reg_steps
246
-     * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array
247
-     *
248
-     * @access    private
249
-     * @throws \EE_Error
250
-     */
251
-    public static function load_reg_steps()
252
-    {
253
-        static $reg_steps_loaded = false;
254
-        if ($reg_steps_loaded) {
255
-            return;
256
-        }
257
-        // filter list of reg_steps
258
-        $reg_steps_to_load = (array)apply_filters(
259
-            'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
260
-            EED_Single_Page_Checkout::get_reg_steps()
261
-        );
262
-        // sort by key (order)
263
-        ksort($reg_steps_to_load);
264
-        // loop through folders
265
-        foreach ($reg_steps_to_load as $order => $reg_step) {
266
-            // we need a
267
-            if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
268
-                // copy over to the reg_steps_array
269
-                EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
270
-                // register custom key route for each reg step
271
-                // ie: step=>"slug" - this is the entire reason we load the reg steps array now
272
-                EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
273
-                // add AJAX or other hooks
274
-                if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
275
-                    // setup autoloaders if necessary
276
-                    if ( ! class_exists($reg_step['class_name'])) {
277
-                        EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], true);
278
-                    }
279
-                    if (is_callable($reg_step['class_name'], 'set_hooks')) {
280
-                        call_user_func(array($reg_step['class_name'], 'set_hooks'));
281
-                    }
282
-                }
283
-            }
284
-        }
285
-        $reg_steps_loaded = true;
286
-    }
287
-
288
-
289
-
290
-    /**
291
-     *    get_reg_steps
292
-     *
293
-     * @access    public
294
-     * @return    array
295
-     */
296
-    public static function get_reg_steps()
297
-    {
298
-        $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
299
-        if (empty($reg_steps)) {
300
-            $reg_steps = array(
301
-                10  => array(
302
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
303
-                    'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
304
-                    'slug'       => 'attendee_information',
305
-                    'has_hooks'  => false,
306
-                ),
307
-                20  => array(
308
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
309
-                    'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
310
-                    'slug'       => 'registration_confirmation',
311
-                    'has_hooks'  => false,
312
-                ),
313
-                30  => array(
314
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
315
-                    'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
316
-                    'slug'       => 'payment_options',
317
-                    'has_hooks'  => true,
318
-                ),
319
-                999 => array(
320
-                    'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
321
-                    'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
322
-                    'slug'       => 'finalize_registration',
323
-                    'has_hooks'  => false,
324
-                ),
325
-            );
326
-        }
327
-        return $reg_steps;
328
-    }
329
-
330
-
331
-
332
-    /**
333
-     *    registration_checkout_for_admin
334
-     *
335
-     * @access    public
336
-     * @return    string
337
-     * @throws \EE_Error
338
-     */
339
-    public static function registration_checkout_for_admin()
340
-    {
341
-        EED_Single_Page_Checkout::load_request_handler();
342
-        EE_Registry::instance()->REQ->set('step', 'attendee_information');
343
-        EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
344
-        EE_Registry::instance()->REQ->set('process_form_submission', false);
345
-        EED_Single_Page_Checkout::instance()->_initialize();
346
-        EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
347
-        return EE_Registry::instance()->REQ->get_output();
348
-    }
349
-
350
-
351
-
352
-    /**
353
-     * process_registration_from_admin
354
-     *
355
-     * @access public
356
-     * @return \EE_Transaction
357
-     * @throws \EE_Error
358
-     */
359
-    public static function process_registration_from_admin()
360
-    {
361
-        EED_Single_Page_Checkout::load_request_handler();
362
-        EE_Registry::instance()->REQ->set('step', 'attendee_information');
363
-        EE_Registry::instance()->REQ->set('action', 'process_reg_step');
364
-        EE_Registry::instance()->REQ->set('process_form_submission', true);
365
-        EED_Single_Page_Checkout::instance()->_initialize();
366
-        if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
367
-            $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
368
-            if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
369
-                EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
370
-                if ($final_reg_step->process_reg_step()) {
371
-                    $final_reg_step->set_completed();
372
-                    EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
373
-                    return EED_Single_Page_Checkout::instance()->checkout->transaction;
374
-                }
375
-            }
376
-        }
377
-        return null;
378
-    }
379
-
380
-
381
-
382
-    /**
383
-     *    run
384
-     *
385
-     * @access    public
386
-     * @param WP_Query $WP_Query
387
-     * @return    void
388
-     * @throws \EE_Error
389
-     */
390
-    public function run($WP_Query)
391
-    {
392
-        if (
393
-            $WP_Query instanceof WP_Query
394
-            && $WP_Query->is_main_query()
395
-            && apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
396
-            && $this->_is_reg_checkout()
397
-        ) {
398
-            $this->_initialize();
399
-        }
400
-    }
401
-
402
-
403
-
404
-    /**
405
-     * determines whether current url matches reg page url
406
-     *
407
-     * @return bool
408
-     */
409
-    protected function _is_reg_checkout()
410
-    {
411
-        // get current permalink for reg page without any extra query args
412
-        $reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
413
-        // get request URI for current request, but without the scheme or host
414
-        $current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
415
-        $current_request_uri = html_entity_decode($current_request_uri);
416
-        // get array of query args from the current request URI
417
-        $query_args = \EEH_URL::get_query_string($current_request_uri);
418
-        // grab page id if it is set
419
-        $page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
420
-        // and remove the page id from the query args (we will re-add it later)
421
-        unset($query_args['page_id']);
422
-        // now strip all query args from current request URI
423
-        $current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri);
424
-        // and re-add the page id if it was set
425
-        if ($page_id) {
426
-            $current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
427
-        }
428
-        // remove slashes and ?
429
-        $current_request_uri = trim($current_request_uri, '?/');
430
-        // is current request URI part of the known full reg page URL ?
431
-        return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false;
432
-    }
433
-
434
-
435
-
436
-    /**
437
-     * @param WP_Query $wp_query
438
-     * @return    void
439
-     * @throws \EE_Error
440
-     */
441
-    public static function init($wp_query)
442
-    {
443
-        EED_Single_Page_Checkout::instance()->run($wp_query);
444
-    }
445
-
446
-
447
-
448
-    /**
449
-     *    _initialize - initial module setup
450
-     *
451
-     * @access    private
452
-     * @throws EE_Error
453
-     * @return    void
454
-     */
455
-    private function _initialize()
456
-    {
457
-        // ensure SPCO doesn't run twice
458
-        if (EED_Single_Page_Checkout::$_initialized) {
459
-            return;
460
-        }
461
-        try {
462
-            EED_Single_Page_Checkout::load_reg_steps();
463
-            $this->_verify_session();
464
-            // setup the EE_Checkout object
465
-            $this->checkout = $this->_initialize_checkout();
466
-            // filter checkout
467
-            $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
468
-            // get the $_GET
469
-            $this->_get_request_vars();
470
-            if ($this->_block_bots()) {
471
-                return;
472
-            }
473
-            // filter continue_reg
474
-            $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', true, $this->checkout);
475
-            // load the reg steps array
476
-            if ( ! $this->_load_and_instantiate_reg_steps()) {
477
-                EED_Single_Page_Checkout::$_initialized = true;
478
-                return;
479
-            }
480
-            // set the current step
481
-            $this->checkout->set_current_step($this->checkout->step);
482
-            // and the next step
483
-            $this->checkout->set_next_step();
484
-            // verify that everything has been setup correctly
485
-            if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
486
-                EED_Single_Page_Checkout::$_initialized = true;
487
-                return;
488
-            }
489
-            // lock the transaction
490
-            $this->checkout->transaction->lock();
491
-            // make sure all of our cached objects are added to their respective model entity mappers
492
-            $this->checkout->refresh_all_entities();
493
-            // set amount owing
494
-            $this->checkout->amount_owing = $this->checkout->transaction->remaining();
495
-            // initialize each reg step, which gives them the chance to potentially alter the process
496
-            $this->_initialize_reg_steps();
497
-            // DEBUG LOG
498
-            //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
499
-            // get reg form
500
-            if( ! $this->_check_form_submission()) {
501
-                EED_Single_Page_Checkout::$_initialized = true;
502
-                return;
503
-            }
504
-            // checkout the action!!!
505
-            $this->_process_form_action();
506
-            // add some style and make it dance
507
-            $this->add_styles_and_scripts();
508
-            // kk... SPCO has successfully run
509
-            EED_Single_Page_Checkout::$_initialized = true;
510
-            // set no cache headers and constants
511
-            EE_System::do_not_cache();
512
-            // add anchor
513
-            add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
514
-            // remove transaction lock
515
-            add_action('shutdown', array($this, 'unlock_transaction'), 1);
516
-        } catch (Exception $e) {
517
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
518
-        }
519
-    }
520
-
521
-
522
-
523
-    /**
524
-     *    _verify_session
525
-     * checks that the session is valid and not expired
526
-     *
527
-     * @access    private
528
-     * @throws EE_Error
529
-     */
530
-    private function _verify_session()
531
-    {
532
-        if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
533
-            throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
534
-        }
535
-        // is session still valid ?
536
-        if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
537
-            $this->checkout = new EE_Checkout();
538
-            EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
539
-            // EE_Registry::instance()->SSN->reset_cart();
540
-            // EE_Registry::instance()->SSN->reset_checkout();
541
-            // EE_Registry::instance()->SSN->reset_transaction();
542
-            EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__,
543
-                __FUNCTION__, __LINE__);
544
-            // EE_Registry::instance()->SSN->reset_expired();
545
-        }
546
-    }
547
-
548
-
549
-
550
-    /**
551
-     *    _initialize_checkout
552
-     * loads and instantiates EE_Checkout
553
-     *
554
-     * @access    private
555
-     * @throws EE_Error
556
-     * @return EE_Checkout
557
-     */
558
-    private function _initialize_checkout()
559
-    {
560
-        // look in session for existing checkout
561
-        /** @type EE_Checkout $checkout */
562
-        $checkout = EE_Registry::instance()->SSN->checkout();
563
-        // verify
564
-        if ( ! $checkout instanceof EE_Checkout) {
565
-            // instantiate EE_Checkout object for handling the properties of the current checkout process
566
-            $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), false);
567
-        } else {
568
-            if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
569
-                $this->unlock_transaction();
570
-                wp_safe_redirect($checkout->redirect_url);
571
-                exit();
572
-            }
573
-        }
574
-        $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
575
-        // verify again
576
-        if ( ! $checkout instanceof EE_Checkout) {
577
-            throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
578
-        }
579
-        // reset anything that needs a clean slate for each request
580
-        $checkout->reset_for_current_request();
581
-        return $checkout;
582
-    }
583
-
584
-
585
-
586
-    /**
587
-     *    _get_request_vars
588
-     *
589
-     * @access    private
590
-     * @return    void
591
-     * @throws \EE_Error
592
-     */
593
-    private function _get_request_vars()
594
-    {
595
-        // load classes
596
-        EED_Single_Page_Checkout::load_request_handler();
597
-        //make sure this request is marked as belonging to EE
598
-        EE_Registry::instance()->REQ->set_espresso_page(true);
599
-        // which step is being requested ?
600
-        $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
601
-        // which step is being edited ?
602
-        $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
603
-        // and what we're doing on the current step
604
-        $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
605
-        // timestamp
606
-        $this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0);
607
-        // returning to edit ?
608
-        $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
609
-        // or some other kind of revisit ?
610
-        $this->checkout->revisit = filter_var(
611
-            EE_Registry::instance()->REQ->get('revisit', false),
612
-            FILTER_VALIDATE_BOOLEAN
613
-        );
614
-        // and whether or not to generate a reg form for this request
615
-        $this->checkout->generate_reg_form = filter_var(
616
-            EE_Registry::instance()->REQ->get('generate_reg_form', true),
617
-            FILTER_VALIDATE_BOOLEAN
618
-        );
619
-        // and whether or not to process a reg form submission for this request
620
-        $this->checkout->process_form_submission = filter_var(
621
-            EE_Registry::instance()->REQ->get(
622
-                'process_form_submission',
623
-                $this->checkout->action === 'process_reg_step'
624
-            ),
625
-            FILTER_VALIDATE_BOOLEAN
626
-        );
627
-        $this->checkout->process_form_submission = filter_var(
628
-            $this->checkout->action !== 'display_spco_reg_step'
629
-                ? $this->checkout->process_form_submission
630
-                : false,
631
-            FILTER_VALIDATE_BOOLEAN
632
-        );
633
-        // $this->_display_request_vars();
634
-    }
635
-
636
-
637
-
638
-    /**
639
-     *  _display_request_vars
640
-     *
641
-     * @access    protected
642
-     * @return    void
643
-     */
644
-    protected function _display_request_vars()
645
-    {
646
-        if ( ! WP_DEBUG) {
647
-            return;
648
-        }
649
-        EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
650
-        EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
651
-        EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
652
-        EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
653
-        EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
654
-        EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
655
-        EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
656
-        EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
657
-    }
658
-
659
-
660
-
661
-    /**
662
-     * _block_bots
663
-     * checks that the incoming request has either of the following set:
664
-     *  a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector
665
-     *  a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN
666
-     * so if you're not coming from the Ticket Selector nor returning for a valid IP...
667
-     * then where you coming from man?
668
-     *
669
-     * @return boolean
670
-     */
671
-    private function _block_bots()
672
-    {
673
-        $invalid_checkout_access = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
674
-        if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) {
675
-            return true;
676
-        }
677
-        return false;
678
-    }
679
-
680
-
681
-
682
-    /**
683
-     *    _get_first_step
684
-     *  gets slug for first step in $_reg_steps_array
685
-     *
686
-     * @access    private
687
-     * @throws EE_Error
688
-     * @return    string
689
-     */
690
-    private function _get_first_step()
691
-    {
692
-        $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
693
-        return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
694
-    }
695
-
696
-
697
-
698
-    /**
699
-     *    _load_and_instantiate_reg_steps
700
-     *  instantiates each reg step based on the loaded reg_steps array
701
-     *
702
-     * @access    private
703
-     * @throws EE_Error
704
-     * @return    bool
705
-     */
706
-    private function _load_and_instantiate_reg_steps()
707
-    {
708
-        do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout);
709
-        // have reg_steps already been instantiated ?
710
-        if (
711
-            empty($this->checkout->reg_steps)
712
-            || apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
713
-        ) {
714
-            // if not, then loop through raw reg steps array
715
-            foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
716
-                if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
717
-                    return false;
718
-                }
719
-            }
720
-            EE_Registry::instance()->CFG->registration->skip_reg_confirmation = true;
721
-            EE_Registry::instance()->CFG->registration->reg_confirmation_last = true;
722
-            // skip the registration_confirmation page ?
723
-            if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
724
-                // just remove it from the reg steps array
725
-                $this->checkout->remove_reg_step('registration_confirmation', false);
726
-            } else if (
727
-                isset($this->checkout->reg_steps['registration_confirmation'])
728
-                && EE_Registry::instance()->CFG->registration->reg_confirmation_last
729
-            ) {
730
-                // set the order to something big like 100
731
-                $this->checkout->set_reg_step_order('registration_confirmation', 100);
732
-            }
733
-            // filter the array for good luck
734
-            $this->checkout->reg_steps = apply_filters(
735
-                'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps',
736
-                $this->checkout->reg_steps
737
-            );
738
-            // finally re-sort based on the reg step class order properties
739
-            $this->checkout->sort_reg_steps();
740
-        } else {
741
-            foreach ($this->checkout->reg_steps as $reg_step) {
742
-                // set all current step stati to FALSE
743
-                $reg_step->set_is_current_step(false);
744
-            }
745
-        }
746
-        if (empty($this->checkout->reg_steps)) {
747
-            EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
748
-            return false;
749
-        }
750
-        // make reg step details available to JS
751
-        $this->checkout->set_reg_step_JSON_info();
752
-        return true;
753
-    }
754
-
755
-
756
-
757
-    /**
758
-     *     _load_and_instantiate_reg_step
759
-     *
760
-     * @access    private
761
-     * @param array $reg_step
762
-     * @param int   $order
763
-     * @return bool
764
-     */
765
-    private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0)
766
-    {
767
-        // we need a file_path, class_name, and slug to add a reg step
768
-        if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
769
-            // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
770
-            if (
771
-                $this->checkout->reg_url_link
772
-                && $this->checkout->step !== $reg_step['slug']
773
-                && $reg_step['slug'] !== 'finalize_registration'
774
-                // normally at this point we would NOT load the reg step, but this filter can change that
775
-                && apply_filters(
776
-                    'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step',
777
-                    true,
778
-                    $reg_step,
779
-                    $this->checkout
780
-                )
781
-            ) {
782
-                return true;
783
-            }
784
-            // instantiate step class using file path and class name
785
-            $reg_step_obj = EE_Registry::instance()->load_file(
786
-                $reg_step['file_path'],
787
-                $reg_step['class_name'],
788
-                'class',
789
-                $this->checkout,
790
-                false
791
-            );
792
-            // did we gets the goods ?
793
-            if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
794
-                // set reg step order based on config
795
-                $reg_step_obj->set_order($order);
796
-                // add instantiated reg step object to the master reg steps array
797
-                $this->checkout->add_reg_step($reg_step_obj);
798
-            } else {
799
-                EE_Error::add_error(
800
-                    __('The current step could not be set.', 'event_espresso'),
801
-                    __FILE__, __FUNCTION__, __LINE__
802
-                );
803
-                return false;
804
-            }
805
-        } else {
806
-            if (WP_DEBUG) {
807
-                EE_Error::add_error(
808
-                    sprintf(
809
-                        __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
810
-                        isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
811
-                        isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
812
-                        isset($reg_step['slug']) ? $reg_step['slug'] : '',
813
-                        '<ul>',
814
-                        '<li>',
815
-                        '</li>',
816
-                        '</ul>'
817
-                    ),
818
-                    __FILE__, __FUNCTION__, __LINE__
819
-                );
820
-            }
821
-            return false;
822
-        }
823
-        return true;
824
-    }
825
-
826
-
827
-
828
-    /**
829
-     * _verify_transaction_and_get_registrations
830
-     *
831
-     * @access private
832
-     * @return bool
833
-     */
834
-    private function _verify_transaction_and_get_registrations()
835
-    {
836
-        // was there already a valid transaction in the checkout from the session ?
837
-        if ( ! $this->checkout->transaction instanceof EE_Transaction) {
838
-            // get transaction from db or session
839
-            $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
840
-                ? $this->_get_transaction_and_cart_for_previous_visit()
841
-                : $this->_get_cart_for_current_session_and_setup_new_transaction();
842
-            if ( ! $this->checkout->transaction instanceof EE_Transaction) {
843
-                EE_Error::add_error(
844
-                    __('Your Registration and Transaction information could not be retrieved from the db.',
845
-                        'event_espresso'),
846
-                    __FILE__, __FUNCTION__, __LINE__
847
-                );
848
-                $this->checkout->transaction = EE_Transaction::new_instance();
849
-                // add some style and make it dance
850
-                $this->add_styles_and_scripts();
851
-                EED_Single_Page_Checkout::$_initialized = true;
852
-                return false;
853
-            }
854
-            // and the registrations for the transaction
855
-            $this->_get_registrations($this->checkout->transaction);
856
-        }
857
-        return true;
858
-    }
859
-
860
-
861
-
862
-    /**
863
-     * _get_transaction_and_cart_for_previous_visit
864
-     *
865
-     * @access private
866
-     * @return mixed EE_Transaction|NULL
867
-     */
868
-    private function _get_transaction_and_cart_for_previous_visit()
869
-    {
870
-        /** @var $TXN_model EEM_Transaction */
871
-        $TXN_model = EE_Registry::instance()->load_model('Transaction');
872
-        // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
873
-        $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
874
-        // verify transaction
875
-        if ($transaction instanceof EE_Transaction) {
876
-            // and get the cart that was used for that transaction
877
-            $this->checkout->cart = $this->_get_cart_for_transaction($transaction);
878
-            return $transaction;
879
-        } else {
880
-            EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
881
-            return null;
882
-        }
883
-    }
884
-
885
-
886
-
887
-    /**
888
-     * _get_cart_for_transaction
889
-     *
890
-     * @access private
891
-     * @param EE_Transaction $transaction
892
-     * @return EE_Cart
893
-     */
894
-    private function _get_cart_for_transaction($transaction)
895
-    {
896
-        return $this->checkout->get_cart_for_transaction($transaction);
897
-    }
898
-
899
-
900
-
901
-    /**
902
-     * get_cart_for_transaction
903
-     *
904
-     * @access public
905
-     * @param EE_Transaction $transaction
906
-     * @return EE_Cart
907
-     */
908
-    public function get_cart_for_transaction(EE_Transaction $transaction)
909
-    {
910
-        return $this->checkout->get_cart_for_transaction($transaction);
911
-    }
912
-
913
-
914
-
915
-    /**
916
-     * _get_transaction_and_cart_for_current_session
917
-     *    generates a new EE_Transaction object and adds it to the $_transaction property.
918
-     *
919
-     * @access private
920
-     * @return EE_Transaction
921
-     * @throws \EE_Error
922
-     */
923
-    private function _get_cart_for_current_session_and_setup_new_transaction()
924
-    {
925
-        //  if there's no transaction, then this is the FIRST visit to SPCO
926
-        // so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
927
-        $this->checkout->cart = $this->_get_cart_for_transaction(null);
928
-        // and then create a new transaction
929
-        $transaction = $this->_initialize_transaction();
930
-        // verify transaction
931
-        if ($transaction instanceof EE_Transaction) {
932
-            // save it so that we have an ID for other objects to use
933
-            $transaction->save();
934
-            // and save TXN data to the cart
935
-            $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
936
-        } else {
937
-            EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
938
-        }
939
-        return $transaction;
940
-    }
941
-
942
-
943
-
944
-    /**
945
-     *    generates a new EE_Transaction object and adds it to the $_transaction property.
946
-     *
947
-     * @access private
948
-     * @return mixed EE_Transaction|NULL
949
-     */
950
-    private function _initialize_transaction()
951
-    {
952
-        try {
953
-            // ensure cart totals have been calculated
954
-            $this->checkout->cart->get_grand_total()->recalculate_total_including_taxes();
955
-            // grab the cart grand total
956
-            $cart_total = $this->checkout->cart->get_cart_grand_total();
957
-            // create new TXN
958
-            $transaction = EE_Transaction::new_instance(
959
-                array(
960
-                    'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(),
961
-                    'TXN_total'     => $cart_total > 0 ? $cart_total : 0,
962
-                    'TXN_paid'      => 0,
963
-                    'STS_ID'        => EEM_Transaction::failed_status_code,
964
-                )
965
-            );
966
-            // save it so that we have an ID for other objects to use
967
-            $transaction->save();
968
-            // set cron job for following up on TXNs after their session has expired
969
-            EE_Cron_Tasks::schedule_expired_transaction_check(
970
-                EE_Registry::instance()->SSN->expiration() + 1,
971
-                $transaction->ID()
972
-            );
973
-            return $transaction;
974
-        } catch (Exception $e) {
975
-            EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
976
-        }
977
-        return null;
978
-    }
979
-
980
-
981
-
982
-    /**
983
-     * _get_registrations
984
-     *
985
-     * @access private
986
-     * @param EE_Transaction $transaction
987
-     * @return void
988
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
989
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
990
-     * @throws \EE_Error
991
-     */
992
-    private function _get_registrations(EE_Transaction $transaction)
993
-    {
994
-        // first step: grab the registrants  { : o
995
-        $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
996
-        // verify registrations have been set
997
-        if (empty($registrations)) {
998
-            // if no cached registrations, then check the db
999
-            $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
1000
-            // still nothing ? well as long as this isn't a revisit
1001
-            if (empty($registrations) && ! $this->checkout->revisit) {
1002
-                // generate new registrations from scratch
1003
-                $registrations = $this->_initialize_registrations($transaction);
1004
-            }
1005
-        }
1006
-        // sort by their original registration order
1007
-        usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
1008
-        // then loop thru the array
1009
-        foreach ($registrations as $registration) {
1010
-            // verify each registration
1011
-            if ($registration instanceof EE_Registration) {
1012
-                // we display all attendee info for the primary registrant
1013
-                if ($this->checkout->reg_url_link === $registration->reg_url_link()
1014
-                    && $registration->is_primary_registrant()
1015
-                ) {
1016
-                    $this->checkout->primary_revisit = true;
1017
-                    break;
1018
-                } else if ($this->checkout->revisit
1019
-                           && $this->checkout->reg_url_link !== $registration->reg_url_link()
1020
-                ) {
1021
-                    // but hide info if it doesn't belong to you
1022
-                    $transaction->clear_cache('Registration', $registration->ID());
1023
-                }
1024
-                $this->checkout->set_reg_status_updated($registration->ID(), false);
1025
-            }
1026
-        }
1027
-    }
1028
-
1029
-
1030
-
1031
-    /**
1032
-     *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
1033
-     *
1034
-     * @access private
1035
-     * @param EE_Transaction $transaction
1036
-     * @return    array
1037
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
1038
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
1039
-     * @throws \EE_Error
1040
-     */
1041
-    private function _initialize_registrations(EE_Transaction $transaction)
1042
-    {
1043
-        $att_nmbr = 0;
1044
-        $registrations = array();
1045
-        if ($transaction instanceof EE_Transaction) {
1046
-            /** @type EE_Registration_Processor $registration_processor */
1047
-            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1048
-            $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
1049
-            // now let's add the cart items to the $transaction
1050
-            foreach ($this->checkout->cart->get_tickets() as $line_item) {
1051
-                //do the following for each ticket of this type they selected
1052
-                for ($x = 1; $x <= $line_item->quantity(); $x++) {
1053
-                    $att_nmbr++;
1054
-                    /** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
1055
-                    $CreateRegistrationCommand = EE_Registry::instance()->create(
1056
-                        'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1057
-                        array(
1058
-                            $transaction,
1059
-                            $line_item,
1060
-                            $att_nmbr,
1061
-                            $this->checkout->total_ticket_count,
1062
-                        )
1063
-                    );
1064
-                    // override capabilities for frontend registrations
1065
-                    if ( ! is_admin()) {
1066
-                        $CreateRegistrationCommand->setCapCheck(
1067
-                            new PublicCapabilities('', 'create_new_registration')
1068
-                        );
1069
-                    }
1070
-                    $registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
1071
-                    if ( ! $registration instanceof EE_Registration) {
1072
-                        throw new InvalidEntityException($registration, 'EE_Registration');
1073
-                    }
1074
-                    $registrations[ $registration->ID() ] = $registration;
1075
-                }
1076
-            }
1077
-            $registration_processor->fix_reg_final_price_rounding_issue($transaction);
1078
-        }
1079
-        return $registrations;
1080
-    }
1081
-
1082
-
1083
-
1084
-    /**
1085
-     * sorts registrations by REG_count
1086
-     *
1087
-     * @access public
1088
-     * @param EE_Registration $reg_A
1089
-     * @param EE_Registration $reg_B
1090
-     * @return int
1091
-     */
1092
-    public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B)
1093
-    {
1094
-        // this shouldn't ever happen within the same TXN, but oh well
1095
-        if ($reg_A->count() === $reg_B->count()) {
1096
-            return 0;
1097
-        }
1098
-        return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
1099
-    }
1100
-
1101
-
1102
-
1103
-    /**
1104
-     *    _final_verifications
1105
-     * just makes sure that everything is set up correctly before proceeding
1106
-     *
1107
-     * @access    private
1108
-     * @return    bool
1109
-     * @throws \EE_Error
1110
-     */
1111
-    private function _final_verifications()
1112
-    {
1113
-        // filter checkout
1114
-        $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
1115
-        //verify that current step is still set correctly
1116
-        if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
1117
-            EE_Error::add_error(
1118
-                __('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'),
1119
-                __FILE__,
1120
-                __FUNCTION__,
1121
-                __LINE__
1122
-            );
1123
-            return false;
1124
-        }
1125
-        // if returning to SPCO, then verify that primary registrant is set
1126
-        if ( ! empty($this->checkout->reg_url_link)) {
1127
-            $valid_registrant = $this->checkout->transaction->primary_registration();
1128
-            if ( ! $valid_registrant instanceof EE_Registration) {
1129
-                EE_Error::add_error(
1130
-                    __('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'),
1131
-                    __FILE__,
1132
-                    __FUNCTION__,
1133
-                    __LINE__
1134
-                );
1135
-                return false;
1136
-            }
1137
-            $valid_registrant = null;
1138
-            foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
1139
-                if (
1140
-                    $registration instanceof EE_Registration
1141
-                    && $registration->reg_url_link() === $this->checkout->reg_url_link
1142
-                ) {
1143
-                    $valid_registrant = $registration;
1144
-                }
1145
-            }
1146
-            if ( ! $valid_registrant instanceof EE_Registration) {
1147
-                // hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1148
-                if (EED_Single_Page_Checkout::$_checkout_verified) {
1149
-                    // clear the session, mark the checkout as unverified, and try again
1150
-                    EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1151
-                    EED_Single_Page_Checkout::$_initialized = false;
1152
-                    EED_Single_Page_Checkout::$_checkout_verified = false;
1153
-                    $this->_initialize();
1154
-                    EE_Error::reset_notices();
1155
-                    return false;
1156
-                }
1157
-                EE_Error::add_error(
1158
-                    __('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'),
1159
-                    __FILE__,
1160
-                    __FUNCTION__,
1161
-                    __LINE__
1162
-                );
1163
-                return false;
1164
-            }
1165
-        }
1166
-        // now that things have been kinda sufficiently verified,
1167
-        // let's add the checkout to the session so that it's available to other systems
1168
-        EE_Registry::instance()->SSN->set_checkout($this->checkout);
1169
-        return true;
1170
-    }
1171
-
1172
-
1173
-
1174
-    /**
1175
-     *    _initialize_reg_steps
1176
-     * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required
1177
-     * then loops thru all of the active reg steps and calls the initialize_reg_step() method
1178
-     *
1179
-     * @access    private
1180
-     * @param bool $reinitializing
1181
-     * @throws \EE_Error
1182
-     */
1183
-    private function _initialize_reg_steps($reinitializing = false)
1184
-    {
1185
-        $this->checkout->set_reg_step_initiated($this->checkout->current_step);
1186
-        // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1187
-        foreach ($this->checkout->reg_steps as $reg_step) {
1188
-            if ( ! $reg_step->initialize_reg_step()) {
1189
-                // if not initialized then maybe this step is being removed...
1190
-                if ( ! $reinitializing && $reg_step->is_current_step()) {
1191
-                    // if it was the current step, then we need to start over here
1192
-                    $this->_initialize_reg_steps(true);
1193
-                    return;
1194
-                }
1195
-                continue;
1196
-            }
1197
-            // add css and JS for current step
1198
-            $reg_step->enqueue_styles_and_scripts();
1199
-            // i18n
1200
-            $reg_step->translate_js_strings();
1201
-            if ($reg_step->is_current_step()) {
1202
-                // the text that appears on the reg step form submit button
1203
-                $reg_step->set_submit_button_text();
1204
-            }
1205
-        }
1206
-        // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1207
-        do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1208
-    }
1209
-
1210
-
1211
-
1212
-    /**
1213
-     * _check_form_submission
1214
-     *
1215
-     * @access private
1216
-     * @return boolean
1217
-     */
1218
-    private function _check_form_submission()
1219
-    {
1220
-        //does this request require the reg form to be generated ?
1221
-        if ($this->checkout->generate_reg_form) {
1222
-            // ever heard that song by Blue Rodeo ?
1223
-            try {
1224
-                $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1225
-                // if not displaying a form, then check for form submission
1226
-                if (
1227
-                    $this->checkout->process_form_submission
1228
-                    && $this->checkout->current_step->reg_form->was_submitted()
1229
-                ) {
1230
-                    // clear out any old data in case this step is being run again
1231
-                    $this->checkout->current_step->set_valid_data(array());
1232
-                    // capture submitted form data
1233
-                    $this->checkout->current_step->reg_form->receive_form_submission(
1234
-                        apply_filters(
1235
-                            'FHEE__Single_Page_Checkout___check_form_submission__request_params',
1236
-                            EE_Registry::instance()->REQ->params(),
1237
-                            $this->checkout
1238
-                        )
1239
-                    );
1240
-                    // validate submitted form data
1241
-                    if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) {
1242
-                        // thou shall not pass !!!
1243
-                        $this->checkout->continue_reg = false;
1244
-                        // any form validation errors?
1245
-                        if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1246
-                            $submission_error_messages = array();
1247
-                            // bad, bad, bad registrant
1248
-                            foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1249
-                                if ($validation_error instanceof EE_Validation_Error) {
1250
-                                    $submission_error_messages[] = sprintf(
1251
-                                        __('%s : %s', 'event_espresso'),
1252
-                                        $validation_error->get_form_section()->html_label_text(),
1253
-                                        $validation_error->getMessage()
1254
-                                    );
1255
-                                }
1256
-                            }
1257
-                            EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1258
-                        }
1259
-                        // well not really... what will happen is we'll just get redirected back to redo the current step
1260
-                        $this->go_to_next_step();
1261
-                        return false;
1262
-                    }
1263
-                }
1264
-            } catch (EE_Error $e) {
1265
-                $e->get_error();
1266
-            }
1267
-        }
1268
-        return true;
1269
-    }
1270
-
1271
-
1272
-
1273
-    /**
1274
-     * _process_action
1275
-     *
1276
-     * @access private
1277
-     * @return void
1278
-     * @throws \EE_Error
1279
-     */
1280
-    private function _process_form_action()
1281
-    {
1282
-        // what cha wanna do?
1283
-        switch ($this->checkout->action) {
1284
-            // AJAX next step reg form
1285
-            case 'display_spco_reg_step' :
1286
-                $this->checkout->redirect = false;
1287
-                if (EE_Registry::instance()->REQ->ajax) {
1288
-                    $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1289
-                }
1290
-                break;
1291
-            default :
1292
-                // meh... do one of those other steps first
1293
-                if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1294
-                    // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1295
-                    do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1296
-                    // call action on current step
1297
-                    if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1298
-                        // good registrant, you get to proceed
1299
-                        if (
1300
-                            $this->checkout->current_step->success_message() !== ''
1301
-                            && apply_filters(
1302
-                                'FHEE__Single_Page_Checkout___process_form_action__display_success',
1303
-                                false
1304
-                            )
1305
-                        ) {
1306
-                            EE_Error::add_success(
1307
-                                $this->checkout->current_step->success_message()
1308
-                                . '<br />' . $this->checkout->next_step->_instructions()
1309
-                            );
1310
-                        }
1311
-                        // pack it up, pack it in...
1312
-                        $this->_setup_redirect();
1313
-                    }
1314
-                    // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1315
-                    do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1316
-                } else {
1317
-                    EE_Error::add_error(
1318
-                        sprintf(
1319
-                            __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1320
-                            $this->checkout->action,
1321
-                            $this->checkout->current_step->name()
1322
-                        ),
1323
-                        __FILE__,
1324
-                        __FUNCTION__,
1325
-                        __LINE__
1326
-                    );
1327
-                }
1328
-            // end default
1329
-        }
1330
-        // store our progress so far
1331
-        $this->checkout->stash_transaction_and_checkout();
1332
-        // advance to the next step! If you pass GO, collect $200
1333
-        $this->go_to_next_step();
1334
-    }
1335
-
1336
-
1337
-
1338
-    /**
1339
-     *        add_styles_and_scripts
1340
-     *
1341
-     * @access        public
1342
-     * @return        void
1343
-     */
1344
-    public function add_styles_and_scripts()
1345
-    {
1346
-        // i18n
1347
-        $this->translate_js_strings();
1348
-        if ($this->checkout->admin_request) {
1349
-            add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1350
-        } else {
1351
-            add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1352
-        }
1353
-    }
1354
-
1355
-
1356
-
1357
-    /**
1358
-     *        translate_js_strings
1359
-     *
1360
-     * @access        public
1361
-     * @return        void
1362
-     */
1363
-    public function translate_js_strings()
1364
-    {
1365
-        EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1366
-        EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1367
-        EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1368
-        EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1369
-        EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1370
-        EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1371
-        EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1372
-        EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1373
-        EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1374
-            __('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'),
1375
-            '<br/>',
1376
-            '<br/>'
1377
-        );
1378
-        EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1379
-        EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1380
-        EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1381
-        EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1382
-        EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1383
-        EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1384
-        EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1385
-        EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1386
-        EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1387
-        EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1388
-        EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1389
-        EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1390
-        EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1391
-        EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1392
-        EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1393
-        EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1394
-        EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1395
-        EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1396
-        EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1397
-            __(
1398
-                '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
1399
-                'event_espresso'
1400
-            ),
1401
-            '<h4 class="important-notice">',
1402
-            '</h4>',
1403
-            '<br />',
1404
-            '<p>',
1405
-            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1406
-            '">',
1407
-            '</a>',
1408
-            '</p>'
1409
-        );
1410
-        EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1411
-        EE_Registry::$i18n_js_strings['session_extension'] = absint(
1412
-            apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1413
-        );
1414
-        EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1415
-            'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1416
-        );
1417
-    }
1418
-
1419
-
1420
-
1421
-    /**
1422
-     *    enqueue_styles_and_scripts
1423
-     *
1424
-     * @access        public
1425
-     * @return        void
1426
-     * @throws \EE_Error
1427
-     */
1428
-    public function enqueue_styles_and_scripts()
1429
-    {
1430
-        // load css
1431
-        wp_register_style('single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1432
-        wp_enqueue_style('single_page_checkout');
1433
-        // load JS
1434
-        wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array('jquery'), '1.0.1', true);
1435
-        wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', true);
1436
-        wp_register_script('single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, true);
1437
-        if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) {
1438
-            $this->checkout->registration_form->enqueue_js();
1439
-        }
1440
-        if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) {
1441
-            $this->checkout->current_step->reg_form->enqueue_js();
1442
-        }
1443
-        wp_enqueue_script('single_page_checkout');
1444
-        /**
1445
-         * global action hook for enqueueing styles and scripts with
1446
-         * spco calls.
1447
-         */
1448
-        do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1449
-        /**
1450
-         * dynamic action hook for enqueueing styles and scripts with spco calls.
1451
-         * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1452
-         */
1453
-        do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this);
1454
-    }
1455
-
1456
-
1457
-
1458
-    /**
1459
-     *    display the Registration Single Page Checkout Form
1460
-     *
1461
-     * @access    private
1462
-     * @return    void
1463
-     * @throws \EE_Error
1464
-     */
1465
-    private function _display_spco_reg_form()
1466
-    {
1467
-        // if registering via the admin, just display the reg form for the current step
1468
-        if ($this->checkout->admin_request) {
1469
-            EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1470
-        } else {
1471
-            // add powered by EE msg
1472
-            add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1473
-            $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1
1474
-                ? true
1475
-                : false;
1476
-            EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1477
-            $cookies_not_set_msg = '';
1478
-            if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1479
-                $cookies_not_set_msg = apply_filters(
1480
-                    'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1481
-                    sprintf(
1482
-                        __(
1483
-                            '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s',
1484
-                            'event_espresso'
1485
-                        ),
1486
-                        '<div class="ee-attention">',
1487
-                        '</div>',
1488
-                        '<h6 class="important-notice">',
1489
-                        '</h6>',
1490
-                        '<p>',
1491
-                        '</p>',
1492
-                        '<br />',
1493
-                        '<a href="http://www.whatarecookies.com/enable.asp" target="_blank">',
1494
-                        '</a>'
1495
-                    )
1496
-                );
1497
-            }
1498
-            $this->checkout->registration_form = new EE_Form_Section_Proper(
1499
-                array(
1500
-                    'name'            => 'single-page-checkout',
1501
-                    'html_id'         => 'ee-single-page-checkout-dv',
1502
-                    'layout_strategy' =>
1503
-                        new EE_Template_Layout(
1504
-                            array(
1505
-                                'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1506
-                                'template_args'        => array(
1507
-                                    'empty_cart'              => $empty_cart,
1508
-                                    'revisit'                 => $this->checkout->revisit,
1509
-                                    'reg_steps'               => $this->checkout->reg_steps,
1510
-                                    'next_step'               => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
1511
-                                        ? $this->checkout->next_step->slug()
1512
-                                        : '',
1513
-                                    'cancel_page_url'         => $this->checkout->cancel_page_url,
1514
-                                    'empty_msg'               => apply_filters(
1515
-                                        'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1516
-                                        sprintf(
1517
-                                            __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.',
1518
-                                                'event_espresso'),
1519
-                                            '<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1520
-                                            '">',
1521
-                                            '</a>'
1522
-                                        )
1523
-                                    ),
1524
-                                    'cookies_not_set_msg'     => $cookies_not_set_msg,
1525
-                                    'registration_time_limit' => $this->checkout->get_registration_time_limit(),
1526
-                                    'session_expiration'      => gmdate(
1527
-                                        'M d, Y H:i:s',
1528
-                                        EE_Registry::instance()->SSN->expiration()
1529
-                                        + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1530
-                                    ),
1531
-                                ),
1532
-                            )
1533
-                        ),
1534
-                )
1535
-            );
1536
-            // load template and add to output sent that gets filtered into the_content()
1537
-            EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html());
1538
-        }
1539
-    }
1540
-
1541
-
1542
-
1543
-    /**
1544
-     *    add_extra_finalize_registration_inputs
1545
-     *
1546
-     * @access    public
1547
-     * @param $next_step
1548
-     * @internal  param string $label
1549
-     * @return void
1550
-     */
1551
-    public function add_extra_finalize_registration_inputs($next_step)
1552
-    {
1553
-        if ($next_step === 'finalize_registration') {
1554
-            echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1555
-        }
1556
-    }
1557
-
1558
-
1559
-
1560
-    /**
1561
-     *    display_registration_footer
1562
-     *
1563
-     * @access    public
1564
-     * @return    string
1565
-     */
1566
-    public static function display_registration_footer()
1567
-    {
1568
-        if (
1569
-        apply_filters(
1570
-            'FHEE__EE_Front__Controller__show_reg_footer',
1571
-            EE_Registry::instance()->CFG->admin->show_reg_footer
1572
-        )
1573
-        ) {
1574
-            add_filter(
1575
-                'FHEE__EEH_Template__powered_by_event_espresso__url',
1576
-                function ($url) {
1577
-                    return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1578
-                }
1579
-            );
1580
-            echo apply_filters(
1581
-                'FHEE__EE_Front_Controller__display_registration_footer',
1582
-                \EEH_Template::powered_by_event_espresso(
1583
-                    '',
1584
-                    'espresso-registration-footer-dv',
1585
-                    array('utm_content' => 'registration_checkout')
1586
-                )
1587
-            );
1588
-        }
1589
-        return '';
1590
-    }
1591
-
1592
-
1593
-
1594
-    /**
1595
-     *    unlock_transaction
1596
-     *
1597
-     * @access    public
1598
-     * @return    void
1599
-     * @throws \EE_Error
1600
-     */
1601
-    public function unlock_transaction()
1602
-    {
1603
-        if ($this->checkout->transaction instanceof EE_Transaction) {
1604
-            $this->checkout->transaction->unlock();
1605
-        }
1606
-    }
1607
-
1608
-
1609
-
1610
-    /**
1611
-     *        _setup_redirect
1612
-     *
1613
-     * @access    private
1614
-     * @return void
1615
-     */
1616
-    private function _setup_redirect()
1617
-    {
1618
-        if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1619
-            $this->checkout->redirect = true;
1620
-            if (empty($this->checkout->redirect_url)) {
1621
-                $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1622
-            }
1623
-            $this->checkout->redirect_url = apply_filters(
1624
-                'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1625
-                $this->checkout->redirect_url,
1626
-                $this->checkout
1627
-            );
1628
-        }
1629
-    }
1630
-
1631
-
1632
-
1633
-    /**
1634
-     *   handle ajax message responses and redirects
1635
-     *
1636
-     * @access public
1637
-     * @return void
1638
-     * @throws \EE_Error
1639
-     */
1640
-    public function go_to_next_step()
1641
-    {
1642
-        if (EE_Registry::instance()->REQ->ajax) {
1643
-            // capture contents of output buffer we started earlier in the request, and insert into JSON response
1644
-            $this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1645
-        }
1646
-        $this->unlock_transaction();
1647
-        // just return for these conditions
1648
-        if (
1649
-            $this->checkout->admin_request
1650
-            || $this->checkout->action === 'redirect_form'
1651
-            || $this->checkout->action === 'update_checkout'
1652
-        ) {
1653
-            return;
1654
-        }
1655
-        // AJAX response
1656
-        $this->_handle_json_response();
1657
-        // redirect to next step or the Thank You page
1658
-        $this->_handle_html_redirects();
1659
-        // hmmm... must be something wrong, so let's just display the form again !
1660
-        $this->_display_spco_reg_form();
1661
-    }
1662
-
1663
-
1664
-
1665
-    /**
1666
-     *   _handle_json_response
1667
-     *
1668
-     * @access protected
1669
-     * @return void
1670
-     */
1671
-    protected function _handle_json_response()
1672
-    {
1673
-        // if this is an ajax request
1674
-        if (EE_Registry::instance()->REQ->ajax) {
1675
-            // DEBUG LOG
1676
-            //$this->checkout->log(
1677
-            //	__CLASS__, __FUNCTION__, __LINE__,
1678
-            //	array(
1679
-            //		'json_response_redirect_url' => $this->checkout->json_response->redirect_url(),
1680
-            //		'redirect'                   => $this->checkout->redirect,
1681
-            //		'continue_reg'               => $this->checkout->continue_reg,
1682
-            //	)
1683
-            //);
1684
-            $this->checkout->json_response->set_registration_time_limit(
1685
-                $this->checkout->get_registration_time_limit()
1686
-            );
1687
-            $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1688
-            // just send the ajax (
1689
-            $json_response = apply_filters(
1690
-                'FHEE__EE_Single_Page_Checkout__JSON_response',
1691
-                $this->checkout->json_response
1692
-            );
1693
-            echo $json_response;
1694
-            exit();
1695
-        }
1696
-    }
1697
-
1698
-
1699
-
1700
-    /**
1701
-     *   _handle_redirects
1702
-     *
1703
-     * @access protected
1704
-     * @return void
1705
-     */
1706
-    protected function _handle_html_redirects()
1707
-    {
1708
-        // going somewhere ?
1709
-        if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1710
-            // store notices in a transient
1711
-            EE_Error::get_notices(false, true, true);
1712
-            // DEBUG LOG
1713
-            //$this->checkout->log(
1714
-            //	__CLASS__, __FUNCTION__, __LINE__,
1715
-            //	array(
1716
-            //		'headers_sent' => headers_sent(),
1717
-            //		'redirect_url'     => $this->checkout->redirect_url,
1718
-            //		'headers_list'    => headers_list(),
1719
-            //	)
1720
-            //);
1721
-            wp_safe_redirect($this->checkout->redirect_url);
1722
-            exit();
1723
-        }
1724
-    }
1725
-
1726
-
1727
-
1728
-    /**
1729
-     *   set_checkout_anchor
1730
-     *
1731
-     * @access public
1732
-     * @return void
1733
-     */
1734
-    public function set_checkout_anchor()
1735
-    {
1736
-        echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>';
1737
-    }
20
+	/**
21
+	 * $_initialized - has the SPCO controller already been initialized ?
22
+	 *
23
+	 * @access private
24
+	 * @var bool $_initialized
25
+	 */
26
+	private static $_initialized = false;
27
+
28
+
29
+	/**
30
+	 * $_checkout_verified - is the EE_Checkout verified as correct for this request ?
31
+	 *
32
+	 * @access private
33
+	 * @var bool $_valid_checkout
34
+	 */
35
+	private static $_checkout_verified = true;
36
+
37
+	/**
38
+	 *    $_reg_steps_array - holds initial array of reg steps
39
+	 *
40
+	 * @access private
41
+	 * @var array $_reg_steps_array
42
+	 */
43
+	private static $_reg_steps_array = array();
44
+
45
+	/**
46
+	 *    $checkout - EE_Checkout object for handling the properties of the current checkout process
47
+	 *
48
+	 * @access public
49
+	 * @var EE_Checkout $checkout
50
+	 */
51
+	public $checkout;
52
+
53
+
54
+
55
+	/**
56
+	 * @return EED_Single_Page_Checkout
57
+	 */
58
+	public static function instance()
59
+	{
60
+		add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true');
61
+		return parent::get_instance(__CLASS__);
62
+	}
63
+
64
+
65
+
66
+	/**
67
+	 * @return EE_CART
68
+	 */
69
+	public function cart()
70
+	{
71
+		return $this->checkout->cart;
72
+	}
73
+
74
+
75
+
76
+	/**
77
+	 * @return EE_Transaction
78
+	 */
79
+	public function transaction()
80
+	{
81
+		return $this->checkout->transaction;
82
+	}
83
+
84
+
85
+
86
+	/**
87
+	 *    set_hooks - for hooking into EE Core, other modules, etc
88
+	 *
89
+	 * @access    public
90
+	 * @return    void
91
+	 * @throws \EE_Error
92
+	 */
93
+	public static function set_hooks()
94
+	{
95
+		EED_Single_Page_Checkout::set_definitions();
96
+	}
97
+
98
+
99
+
100
+	/**
101
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
102
+	 *
103
+	 * @access    public
104
+	 * @return    void
105
+	 * @throws \EE_Error
106
+	 */
107
+	public static function set_hooks_admin()
108
+	{
109
+		EED_Single_Page_Checkout::set_definitions();
110
+		if ( ! (defined('DOING_AJAX') && DOING_AJAX)) {
111
+			return;
112
+		}
113
+		// going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response
114
+		ob_start();
115
+		EED_Single_Page_Checkout::load_request_handler();
116
+		EED_Single_Page_Checkout::load_reg_steps();
117
+		// set ajax hooks
118
+		add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
119
+		add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step'));
120
+		add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
121
+		add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step'));
122
+		add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
123
+		add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step'));
124
+	}
125
+
126
+
127
+
128
+	/**
129
+	 *    process ajax request
130
+	 *
131
+	 * @param string $ajax_action
132
+	 * @throws \EE_Error
133
+	 */
134
+	public static function process_ajax_request($ajax_action)
135
+	{
136
+		EE_Registry::instance()->REQ->set('action', $ajax_action);
137
+		EED_Single_Page_Checkout::instance()->_initialize();
138
+	}
139
+
140
+
141
+
142
+	/**
143
+	 *    ajax display registration step
144
+	 *
145
+	 * @throws \EE_Error
146
+	 */
147
+	public static function display_reg_step()
148
+	{
149
+		EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step');
150
+	}
151
+
152
+
153
+
154
+	/**
155
+	 *    ajax process registration step
156
+	 *
157
+	 * @throws \EE_Error
158
+	 */
159
+	public static function process_reg_step()
160
+	{
161
+		EED_Single_Page_Checkout::process_ajax_request('process_reg_step');
162
+	}
163
+
164
+
165
+
166
+	/**
167
+	 *    ajax process registration step
168
+	 *
169
+	 * @throws \EE_Error
170
+	 */
171
+	public static function update_reg_step()
172
+	{
173
+		EED_Single_Page_Checkout::process_ajax_request('update_reg_step');
174
+	}
175
+
176
+
177
+
178
+	/**
179
+	 *   update_checkout
180
+	 *
181
+	 * @access public
182
+	 * @return void
183
+	 * @throws \EE_Error
184
+	 */
185
+	public static function update_checkout()
186
+	{
187
+		EED_Single_Page_Checkout::process_ajax_request('update_checkout');
188
+	}
189
+
190
+
191
+
192
+	/**
193
+	 *    load_request_handler
194
+	 *
195
+	 * @access    public
196
+	 * @return    void
197
+	 */
198
+	public static function load_request_handler()
199
+	{
200
+		// load core Request_Handler class
201
+		if ( ! isset(EE_Registry::instance()->REQ)) {
202
+			EE_Registry::instance()->load_core('Request_Handler');
203
+		}
204
+	}
205
+
206
+
207
+
208
+	/**
209
+	 *    set_definitions
210
+	 *
211
+	 * @access    public
212
+	 * @return    void
213
+	 * @throws \EE_Error
214
+	 */
215
+	public static function set_definitions()
216
+	{
217
+		if(defined('SPCO_BASE_PATH')) {
218
+			return;
219
+		}
220
+		define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS) . DS);
221
+		define('SPCO_CSS_URL', plugin_dir_url(__FILE__) . 'css' . DS);
222
+		define('SPCO_IMG_URL', plugin_dir_url(__FILE__) . 'img' . DS);
223
+		define('SPCO_JS_URL', plugin_dir_url(__FILE__) . 'js' . DS);
224
+		define('SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS);
225
+		define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS);
226
+		define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS);
227
+		EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, true);
228
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
229
+			__('%1$sWe\'re sorry, but you\'re registration time has expired.%2$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
230
+				'event_espresso'),
231
+			'<h4 class="important-notice">',
232
+			'</h4>',
233
+			'<br />',
234
+			'<p>',
235
+			'<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
236
+			'">',
237
+			'</a>',
238
+			'</p>'
239
+		);
240
+	}
241
+
242
+
243
+
244
+	/**
245
+	 * load_reg_steps
246
+	 * loads and instantiates each reg step based on the EE_Registry::instance()->CFG->registration->reg_steps array
247
+	 *
248
+	 * @access    private
249
+	 * @throws \EE_Error
250
+	 */
251
+	public static function load_reg_steps()
252
+	{
253
+		static $reg_steps_loaded = false;
254
+		if ($reg_steps_loaded) {
255
+			return;
256
+		}
257
+		// filter list of reg_steps
258
+		$reg_steps_to_load = (array)apply_filters(
259
+			'AHEE__SPCO__load_reg_steps__reg_steps_to_load',
260
+			EED_Single_Page_Checkout::get_reg_steps()
261
+		);
262
+		// sort by key (order)
263
+		ksort($reg_steps_to_load);
264
+		// loop through folders
265
+		foreach ($reg_steps_to_load as $order => $reg_step) {
266
+			// we need a
267
+			if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
268
+				// copy over to the reg_steps_array
269
+				EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step;
270
+				// register custom key route for each reg step
271
+				// ie: step=>"slug" - this is the entire reason we load the reg steps array now
272
+				EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step');
273
+				// add AJAX or other hooks
274
+				if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) {
275
+					// setup autoloaders if necessary
276
+					if ( ! class_exists($reg_step['class_name'])) {
277
+						EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], true);
278
+					}
279
+					if (is_callable($reg_step['class_name'], 'set_hooks')) {
280
+						call_user_func(array($reg_step['class_name'], 'set_hooks'));
281
+					}
282
+				}
283
+			}
284
+		}
285
+		$reg_steps_loaded = true;
286
+	}
287
+
288
+
289
+
290
+	/**
291
+	 *    get_reg_steps
292
+	 *
293
+	 * @access    public
294
+	 * @return    array
295
+	 */
296
+	public static function get_reg_steps()
297
+	{
298
+		$reg_steps = EE_Registry::instance()->CFG->registration->reg_steps;
299
+		if (empty($reg_steps)) {
300
+			$reg_steps = array(
301
+				10  => array(
302
+					'file_path'  => SPCO_REG_STEPS_PATH . 'attendee_information',
303
+					'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information',
304
+					'slug'       => 'attendee_information',
305
+					'has_hooks'  => false,
306
+				),
307
+				20  => array(
308
+					'file_path'  => SPCO_REG_STEPS_PATH . 'registration_confirmation',
309
+					'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation',
310
+					'slug'       => 'registration_confirmation',
311
+					'has_hooks'  => false,
312
+				),
313
+				30  => array(
314
+					'file_path'  => SPCO_REG_STEPS_PATH . 'payment_options',
315
+					'class_name' => 'EE_SPCO_Reg_Step_Payment_Options',
316
+					'slug'       => 'payment_options',
317
+					'has_hooks'  => true,
318
+				),
319
+				999 => array(
320
+					'file_path'  => SPCO_REG_STEPS_PATH . 'finalize_registration',
321
+					'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration',
322
+					'slug'       => 'finalize_registration',
323
+					'has_hooks'  => false,
324
+				),
325
+			);
326
+		}
327
+		return $reg_steps;
328
+	}
329
+
330
+
331
+
332
+	/**
333
+	 *    registration_checkout_for_admin
334
+	 *
335
+	 * @access    public
336
+	 * @return    string
337
+	 * @throws \EE_Error
338
+	 */
339
+	public static function registration_checkout_for_admin()
340
+	{
341
+		EED_Single_Page_Checkout::load_request_handler();
342
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
343
+		EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step');
344
+		EE_Registry::instance()->REQ->set('process_form_submission', false);
345
+		EED_Single_Page_Checkout::instance()->_initialize();
346
+		EED_Single_Page_Checkout::instance()->_display_spco_reg_form();
347
+		return EE_Registry::instance()->REQ->get_output();
348
+	}
349
+
350
+
351
+
352
+	/**
353
+	 * process_registration_from_admin
354
+	 *
355
+	 * @access public
356
+	 * @return \EE_Transaction
357
+	 * @throws \EE_Error
358
+	 */
359
+	public static function process_registration_from_admin()
360
+	{
361
+		EED_Single_Page_Checkout::load_request_handler();
362
+		EE_Registry::instance()->REQ->set('step', 'attendee_information');
363
+		EE_Registry::instance()->REQ->set('action', 'process_reg_step');
364
+		EE_Registry::instance()->REQ->set('process_form_submission', true);
365
+		EED_Single_Page_Checkout::instance()->_initialize();
366
+		if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) {
367
+			$final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps);
368
+			if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) {
369
+				EED_Single_Page_Checkout::instance()->checkout->set_reg_step_initiated($final_reg_step);
370
+				if ($final_reg_step->process_reg_step()) {
371
+					$final_reg_step->set_completed();
372
+					EED_Single_Page_Checkout::instance()->checkout->update_txn_reg_steps_array();
373
+					return EED_Single_Page_Checkout::instance()->checkout->transaction;
374
+				}
375
+			}
376
+		}
377
+		return null;
378
+	}
379
+
380
+
381
+
382
+	/**
383
+	 *    run
384
+	 *
385
+	 * @access    public
386
+	 * @param WP_Query $WP_Query
387
+	 * @return    void
388
+	 * @throws \EE_Error
389
+	 */
390
+	public function run($WP_Query)
391
+	{
392
+		if (
393
+			$WP_Query instanceof WP_Query
394
+			&& $WP_Query->is_main_query()
395
+			&& apply_filters('FHEE__EED_Single_Page_Checkout__run', true)
396
+			&& $this->_is_reg_checkout()
397
+		) {
398
+			$this->_initialize();
399
+		}
400
+	}
401
+
402
+
403
+
404
+	/**
405
+	 * determines whether current url matches reg page url
406
+	 *
407
+	 * @return bool
408
+	 */
409
+	protected function _is_reg_checkout()
410
+	{
411
+		// get current permalink for reg page without any extra query args
412
+		$reg_page_url = \get_permalink(EE_Config::instance()->core->reg_page_id);
413
+		// get request URI for current request, but without the scheme or host
414
+		$current_request_uri = \EEH_URL::filter_input_server_url('REQUEST_URI');
415
+		$current_request_uri = html_entity_decode($current_request_uri);
416
+		// get array of query args from the current request URI
417
+		$query_args = \EEH_URL::get_query_string($current_request_uri);
418
+		// grab page id if it is set
419
+		$page_id = isset($query_args['page_id']) ? absint($query_args['page_id']) : 0;
420
+		// and remove the page id from the query args (we will re-add it later)
421
+		unset($query_args['page_id']);
422
+		// now strip all query args from current request URI
423
+		$current_request_uri = remove_query_arg(array_keys($query_args), $current_request_uri);
424
+		// and re-add the page id if it was set
425
+		if ($page_id) {
426
+			$current_request_uri = add_query_arg('page_id', $page_id, $current_request_uri);
427
+		}
428
+		// remove slashes and ?
429
+		$current_request_uri = trim($current_request_uri, '?/');
430
+		// is current request URI part of the known full reg page URL ?
431
+		return ! empty($current_request_uri) && strpos($reg_page_url, $current_request_uri) !== false;
432
+	}
433
+
434
+
435
+
436
+	/**
437
+	 * @param WP_Query $wp_query
438
+	 * @return    void
439
+	 * @throws \EE_Error
440
+	 */
441
+	public static function init($wp_query)
442
+	{
443
+		EED_Single_Page_Checkout::instance()->run($wp_query);
444
+	}
445
+
446
+
447
+
448
+	/**
449
+	 *    _initialize - initial module setup
450
+	 *
451
+	 * @access    private
452
+	 * @throws EE_Error
453
+	 * @return    void
454
+	 */
455
+	private function _initialize()
456
+	{
457
+		// ensure SPCO doesn't run twice
458
+		if (EED_Single_Page_Checkout::$_initialized) {
459
+			return;
460
+		}
461
+		try {
462
+			EED_Single_Page_Checkout::load_reg_steps();
463
+			$this->_verify_session();
464
+			// setup the EE_Checkout object
465
+			$this->checkout = $this->_initialize_checkout();
466
+			// filter checkout
467
+			$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout);
468
+			// get the $_GET
469
+			$this->_get_request_vars();
470
+			if ($this->_block_bots()) {
471
+				return;
472
+			}
473
+			// filter continue_reg
474
+			$this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', true, $this->checkout);
475
+			// load the reg steps array
476
+			if ( ! $this->_load_and_instantiate_reg_steps()) {
477
+				EED_Single_Page_Checkout::$_initialized = true;
478
+				return;
479
+			}
480
+			// set the current step
481
+			$this->checkout->set_current_step($this->checkout->step);
482
+			// and the next step
483
+			$this->checkout->set_next_step();
484
+			// verify that everything has been setup correctly
485
+			if ( ! ($this->_verify_transaction_and_get_registrations() && $this->_final_verifications())) {
486
+				EED_Single_Page_Checkout::$_initialized = true;
487
+				return;
488
+			}
489
+			// lock the transaction
490
+			$this->checkout->transaction->lock();
491
+			// make sure all of our cached objects are added to their respective model entity mappers
492
+			$this->checkout->refresh_all_entities();
493
+			// set amount owing
494
+			$this->checkout->amount_owing = $this->checkout->transaction->remaining();
495
+			// initialize each reg step, which gives them the chance to potentially alter the process
496
+			$this->_initialize_reg_steps();
497
+			// DEBUG LOG
498
+			//$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ );
499
+			// get reg form
500
+			if( ! $this->_check_form_submission()) {
501
+				EED_Single_Page_Checkout::$_initialized = true;
502
+				return;
503
+			}
504
+			// checkout the action!!!
505
+			$this->_process_form_action();
506
+			// add some style and make it dance
507
+			$this->add_styles_and_scripts();
508
+			// kk... SPCO has successfully run
509
+			EED_Single_Page_Checkout::$_initialized = true;
510
+			// set no cache headers and constants
511
+			EE_System::do_not_cache();
512
+			// add anchor
513
+			add_action('loop_start', array($this, 'set_checkout_anchor'), 1);
514
+			// remove transaction lock
515
+			add_action('shutdown', array($this, 'unlock_transaction'), 1);
516
+		} catch (Exception $e) {
517
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
518
+		}
519
+	}
520
+
521
+
522
+
523
+	/**
524
+	 *    _verify_session
525
+	 * checks that the session is valid and not expired
526
+	 *
527
+	 * @access    private
528
+	 * @throws EE_Error
529
+	 */
530
+	private function _verify_session()
531
+	{
532
+		if ( ! EE_Registry::instance()->SSN instanceof EE_Session) {
533
+			throw new EE_Error(__('The EE_Session class could not be loaded.', 'event_espresso'));
534
+		}
535
+		// is session still valid ?
536
+		if (EE_Registry::instance()->SSN->expired() && EE_Registry::instance()->REQ->get('e_reg_url_link', '') === '') {
537
+			$this->checkout = new EE_Checkout();
538
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
539
+			// EE_Registry::instance()->SSN->reset_cart();
540
+			// EE_Registry::instance()->SSN->reset_checkout();
541
+			// EE_Registry::instance()->SSN->reset_transaction();
542
+			EE_Error::add_attention(EE_Registry::$i18n_js_strings['registration_expiration_notice'], __FILE__,
543
+				__FUNCTION__, __LINE__);
544
+			// EE_Registry::instance()->SSN->reset_expired();
545
+		}
546
+	}
547
+
548
+
549
+
550
+	/**
551
+	 *    _initialize_checkout
552
+	 * loads and instantiates EE_Checkout
553
+	 *
554
+	 * @access    private
555
+	 * @throws EE_Error
556
+	 * @return EE_Checkout
557
+	 */
558
+	private function _initialize_checkout()
559
+	{
560
+		// look in session for existing checkout
561
+		/** @type EE_Checkout $checkout */
562
+		$checkout = EE_Registry::instance()->SSN->checkout();
563
+		// verify
564
+		if ( ! $checkout instanceof EE_Checkout) {
565
+			// instantiate EE_Checkout object for handling the properties of the current checkout process
566
+			$checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), false);
567
+		} else {
568
+			if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) {
569
+				$this->unlock_transaction();
570
+				wp_safe_redirect($checkout->redirect_url);
571
+				exit();
572
+			}
573
+		}
574
+		$checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout);
575
+		// verify again
576
+		if ( ! $checkout instanceof EE_Checkout) {
577
+			throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso'));
578
+		}
579
+		// reset anything that needs a clean slate for each request
580
+		$checkout->reset_for_current_request();
581
+		return $checkout;
582
+	}
583
+
584
+
585
+
586
+	/**
587
+	 *    _get_request_vars
588
+	 *
589
+	 * @access    private
590
+	 * @return    void
591
+	 * @throws \EE_Error
592
+	 */
593
+	private function _get_request_vars()
594
+	{
595
+		// load classes
596
+		EED_Single_Page_Checkout::load_request_handler();
597
+		//make sure this request is marked as belonging to EE
598
+		EE_Registry::instance()->REQ->set_espresso_page(true);
599
+		// which step is being requested ?
600
+		$this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step());
601
+		// which step is being edited ?
602
+		$this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', '');
603
+		// and what we're doing on the current step
604
+		$this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step');
605
+		// timestamp
606
+		$this->checkout->uts = EE_Registry::instance()->REQ->get('uts', 0);
607
+		// returning to edit ?
608
+		$this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', '');
609
+		// or some other kind of revisit ?
610
+		$this->checkout->revisit = filter_var(
611
+			EE_Registry::instance()->REQ->get('revisit', false),
612
+			FILTER_VALIDATE_BOOLEAN
613
+		);
614
+		// and whether or not to generate a reg form for this request
615
+		$this->checkout->generate_reg_form = filter_var(
616
+			EE_Registry::instance()->REQ->get('generate_reg_form', true),
617
+			FILTER_VALIDATE_BOOLEAN
618
+		);
619
+		// and whether or not to process a reg form submission for this request
620
+		$this->checkout->process_form_submission = filter_var(
621
+			EE_Registry::instance()->REQ->get(
622
+				'process_form_submission',
623
+				$this->checkout->action === 'process_reg_step'
624
+			),
625
+			FILTER_VALIDATE_BOOLEAN
626
+		);
627
+		$this->checkout->process_form_submission = filter_var(
628
+			$this->checkout->action !== 'display_spco_reg_step'
629
+				? $this->checkout->process_form_submission
630
+				: false,
631
+			FILTER_VALIDATE_BOOLEAN
632
+		);
633
+		// $this->_display_request_vars();
634
+	}
635
+
636
+
637
+
638
+	/**
639
+	 *  _display_request_vars
640
+	 *
641
+	 * @access    protected
642
+	 * @return    void
643
+	 */
644
+	protected function _display_request_vars()
645
+	{
646
+		if ( ! WP_DEBUG) {
647
+			return;
648
+		}
649
+		EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__);
650
+		EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__);
651
+		EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__);
652
+		EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__);
653
+		EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__);
654
+		EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__);
655
+		EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__);
656
+		EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__);
657
+	}
658
+
659
+
660
+
661
+	/**
662
+	 * _block_bots
663
+	 * checks that the incoming request has either of the following set:
664
+	 *  a uts (unix timestamp) which indicates that the request was redirected from the Ticket Selector
665
+	 *  a REG URL Link, which indicates that the request is a return visit to SPCO for a valid TXN
666
+	 * so if you're not coming from the Ticket Selector nor returning for a valid IP...
667
+	 * then where you coming from man?
668
+	 *
669
+	 * @return boolean
670
+	 */
671
+	private function _block_bots()
672
+	{
673
+		$invalid_checkout_access = \EED_Invalid_Checkout_Access::getInvalidCheckoutAccess();
674
+		if ($invalid_checkout_access->checkoutAccessIsInvalid($this->checkout)) {
675
+			return true;
676
+		}
677
+		return false;
678
+	}
679
+
680
+
681
+
682
+	/**
683
+	 *    _get_first_step
684
+	 *  gets slug for first step in $_reg_steps_array
685
+	 *
686
+	 * @access    private
687
+	 * @throws EE_Error
688
+	 * @return    string
689
+	 */
690
+	private function _get_first_step()
691
+	{
692
+		$first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array);
693
+		return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information';
694
+	}
695
+
696
+
697
+
698
+	/**
699
+	 *    _load_and_instantiate_reg_steps
700
+	 *  instantiates each reg step based on the loaded reg_steps array
701
+	 *
702
+	 * @access    private
703
+	 * @throws EE_Error
704
+	 * @return    bool
705
+	 */
706
+	private function _load_and_instantiate_reg_steps()
707
+	{
708
+		do_action('AHEE__Single_Page_Checkout___load_and_instantiate_reg_steps__start', $this->checkout);
709
+		// have reg_steps already been instantiated ?
710
+		if (
711
+			empty($this->checkout->reg_steps)
712
+			|| apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout)
713
+		) {
714
+			// if not, then loop through raw reg steps array
715
+			foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) {
716
+				if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) {
717
+					return false;
718
+				}
719
+			}
720
+			EE_Registry::instance()->CFG->registration->skip_reg_confirmation = true;
721
+			EE_Registry::instance()->CFG->registration->reg_confirmation_last = true;
722
+			// skip the registration_confirmation page ?
723
+			if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) {
724
+				// just remove it from the reg steps array
725
+				$this->checkout->remove_reg_step('registration_confirmation', false);
726
+			} else if (
727
+				isset($this->checkout->reg_steps['registration_confirmation'])
728
+				&& EE_Registry::instance()->CFG->registration->reg_confirmation_last
729
+			) {
730
+				// set the order to something big like 100
731
+				$this->checkout->set_reg_step_order('registration_confirmation', 100);
732
+			}
733
+			// filter the array for good luck
734
+			$this->checkout->reg_steps = apply_filters(
735
+				'FHEE__Single_Page_Checkout__load_reg_steps__reg_steps',
736
+				$this->checkout->reg_steps
737
+			);
738
+			// finally re-sort based on the reg step class order properties
739
+			$this->checkout->sort_reg_steps();
740
+		} else {
741
+			foreach ($this->checkout->reg_steps as $reg_step) {
742
+				// set all current step stati to FALSE
743
+				$reg_step->set_is_current_step(false);
744
+			}
745
+		}
746
+		if (empty($this->checkout->reg_steps)) {
747
+			EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
748
+			return false;
749
+		}
750
+		// make reg step details available to JS
751
+		$this->checkout->set_reg_step_JSON_info();
752
+		return true;
753
+	}
754
+
755
+
756
+
757
+	/**
758
+	 *     _load_and_instantiate_reg_step
759
+	 *
760
+	 * @access    private
761
+	 * @param array $reg_step
762
+	 * @param int   $order
763
+	 * @return bool
764
+	 */
765
+	private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0)
766
+	{
767
+		// we need a file_path, class_name, and slug to add a reg step
768
+		if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) {
769
+			// if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step)
770
+			if (
771
+				$this->checkout->reg_url_link
772
+				&& $this->checkout->step !== $reg_step['slug']
773
+				&& $reg_step['slug'] !== 'finalize_registration'
774
+				// normally at this point we would NOT load the reg step, but this filter can change that
775
+				&& apply_filters(
776
+					'FHEE__Single_Page_Checkout___load_and_instantiate_reg_step__bypass_reg_step',
777
+					true,
778
+					$reg_step,
779
+					$this->checkout
780
+				)
781
+			) {
782
+				return true;
783
+			}
784
+			// instantiate step class using file path and class name
785
+			$reg_step_obj = EE_Registry::instance()->load_file(
786
+				$reg_step['file_path'],
787
+				$reg_step['class_name'],
788
+				'class',
789
+				$this->checkout,
790
+				false
791
+			);
792
+			// did we gets the goods ?
793
+			if ($reg_step_obj instanceof EE_SPCO_Reg_Step) {
794
+				// set reg step order based on config
795
+				$reg_step_obj->set_order($order);
796
+				// add instantiated reg step object to the master reg steps array
797
+				$this->checkout->add_reg_step($reg_step_obj);
798
+			} else {
799
+				EE_Error::add_error(
800
+					__('The current step could not be set.', 'event_espresso'),
801
+					__FILE__, __FUNCTION__, __LINE__
802
+				);
803
+				return false;
804
+			}
805
+		} else {
806
+			if (WP_DEBUG) {
807
+				EE_Error::add_error(
808
+					sprintf(
809
+						__('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'),
810
+						isset($reg_step['file_path']) ? $reg_step['file_path'] : '',
811
+						isset($reg_step['class_name']) ? $reg_step['class_name'] : '',
812
+						isset($reg_step['slug']) ? $reg_step['slug'] : '',
813
+						'<ul>',
814
+						'<li>',
815
+						'</li>',
816
+						'</ul>'
817
+					),
818
+					__FILE__, __FUNCTION__, __LINE__
819
+				);
820
+			}
821
+			return false;
822
+		}
823
+		return true;
824
+	}
825
+
826
+
827
+
828
+	/**
829
+	 * _verify_transaction_and_get_registrations
830
+	 *
831
+	 * @access private
832
+	 * @return bool
833
+	 */
834
+	private function _verify_transaction_and_get_registrations()
835
+	{
836
+		// was there already a valid transaction in the checkout from the session ?
837
+		if ( ! $this->checkout->transaction instanceof EE_Transaction) {
838
+			// get transaction from db or session
839
+			$this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin()
840
+				? $this->_get_transaction_and_cart_for_previous_visit()
841
+				: $this->_get_cart_for_current_session_and_setup_new_transaction();
842
+			if ( ! $this->checkout->transaction instanceof EE_Transaction) {
843
+				EE_Error::add_error(
844
+					__('Your Registration and Transaction information could not be retrieved from the db.',
845
+						'event_espresso'),
846
+					__FILE__, __FUNCTION__, __LINE__
847
+				);
848
+				$this->checkout->transaction = EE_Transaction::new_instance();
849
+				// add some style and make it dance
850
+				$this->add_styles_and_scripts();
851
+				EED_Single_Page_Checkout::$_initialized = true;
852
+				return false;
853
+			}
854
+			// and the registrations for the transaction
855
+			$this->_get_registrations($this->checkout->transaction);
856
+		}
857
+		return true;
858
+	}
859
+
860
+
861
+
862
+	/**
863
+	 * _get_transaction_and_cart_for_previous_visit
864
+	 *
865
+	 * @access private
866
+	 * @return mixed EE_Transaction|NULL
867
+	 */
868
+	private function _get_transaction_and_cart_for_previous_visit()
869
+	{
870
+		/** @var $TXN_model EEM_Transaction */
871
+		$TXN_model = EE_Registry::instance()->load_model('Transaction');
872
+		// because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db
873
+		$transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link);
874
+		// verify transaction
875
+		if ($transaction instanceof EE_Transaction) {
876
+			// and get the cart that was used for that transaction
877
+			$this->checkout->cart = $this->_get_cart_for_transaction($transaction);
878
+			return $transaction;
879
+		} else {
880
+			EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
881
+			return null;
882
+		}
883
+	}
884
+
885
+
886
+
887
+	/**
888
+	 * _get_cart_for_transaction
889
+	 *
890
+	 * @access private
891
+	 * @param EE_Transaction $transaction
892
+	 * @return EE_Cart
893
+	 */
894
+	private function _get_cart_for_transaction($transaction)
895
+	{
896
+		return $this->checkout->get_cart_for_transaction($transaction);
897
+	}
898
+
899
+
900
+
901
+	/**
902
+	 * get_cart_for_transaction
903
+	 *
904
+	 * @access public
905
+	 * @param EE_Transaction $transaction
906
+	 * @return EE_Cart
907
+	 */
908
+	public function get_cart_for_transaction(EE_Transaction $transaction)
909
+	{
910
+		return $this->checkout->get_cart_for_transaction($transaction);
911
+	}
912
+
913
+
914
+
915
+	/**
916
+	 * _get_transaction_and_cart_for_current_session
917
+	 *    generates a new EE_Transaction object and adds it to the $_transaction property.
918
+	 *
919
+	 * @access private
920
+	 * @return EE_Transaction
921
+	 * @throws \EE_Error
922
+	 */
923
+	private function _get_cart_for_current_session_and_setup_new_transaction()
924
+	{
925
+		//  if there's no transaction, then this is the FIRST visit to SPCO
926
+		// so load up the cart ( passing nothing for the TXN because it doesn't exist yet )
927
+		$this->checkout->cart = $this->_get_cart_for_transaction(null);
928
+		// and then create a new transaction
929
+		$transaction = $this->_initialize_transaction();
930
+		// verify transaction
931
+		if ($transaction instanceof EE_Transaction) {
932
+			// save it so that we have an ID for other objects to use
933
+			$transaction->save();
934
+			// and save TXN data to the cart
935
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID());
936
+		} else {
937
+			EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
938
+		}
939
+		return $transaction;
940
+	}
941
+
942
+
943
+
944
+	/**
945
+	 *    generates a new EE_Transaction object and adds it to the $_transaction property.
946
+	 *
947
+	 * @access private
948
+	 * @return mixed EE_Transaction|NULL
949
+	 */
950
+	private function _initialize_transaction()
951
+	{
952
+		try {
953
+			// ensure cart totals have been calculated
954
+			$this->checkout->cart->get_grand_total()->recalculate_total_including_taxes();
955
+			// grab the cart grand total
956
+			$cart_total = $this->checkout->cart->get_cart_grand_total();
957
+			// create new TXN
958
+			$transaction = EE_Transaction::new_instance(
959
+				array(
960
+					'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(),
961
+					'TXN_total'     => $cart_total > 0 ? $cart_total : 0,
962
+					'TXN_paid'      => 0,
963
+					'STS_ID'        => EEM_Transaction::failed_status_code,
964
+				)
965
+			);
966
+			// save it so that we have an ID for other objects to use
967
+			$transaction->save();
968
+			// set cron job for following up on TXNs after their session has expired
969
+			EE_Cron_Tasks::schedule_expired_transaction_check(
970
+				EE_Registry::instance()->SSN->expiration() + 1,
971
+				$transaction->ID()
972
+			);
973
+			return $transaction;
974
+		} catch (Exception $e) {
975
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
976
+		}
977
+		return null;
978
+	}
979
+
980
+
981
+
982
+	/**
983
+	 * _get_registrations
984
+	 *
985
+	 * @access private
986
+	 * @param EE_Transaction $transaction
987
+	 * @return void
988
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
989
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
990
+	 * @throws \EE_Error
991
+	 */
992
+	private function _get_registrations(EE_Transaction $transaction)
993
+	{
994
+		// first step: grab the registrants  { : o
995
+		$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
996
+		// verify registrations have been set
997
+		if (empty($registrations)) {
998
+			// if no cached registrations, then check the db
999
+			$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
1000
+			// still nothing ? well as long as this isn't a revisit
1001
+			if (empty($registrations) && ! $this->checkout->revisit) {
1002
+				// generate new registrations from scratch
1003
+				$registrations = $this->_initialize_registrations($transaction);
1004
+			}
1005
+		}
1006
+		// sort by their original registration order
1007
+		usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
1008
+		// then loop thru the array
1009
+		foreach ($registrations as $registration) {
1010
+			// verify each registration
1011
+			if ($registration instanceof EE_Registration) {
1012
+				// we display all attendee info for the primary registrant
1013
+				if ($this->checkout->reg_url_link === $registration->reg_url_link()
1014
+					&& $registration->is_primary_registrant()
1015
+				) {
1016
+					$this->checkout->primary_revisit = true;
1017
+					break;
1018
+				} else if ($this->checkout->revisit
1019
+						   && $this->checkout->reg_url_link !== $registration->reg_url_link()
1020
+				) {
1021
+					// but hide info if it doesn't belong to you
1022
+					$transaction->clear_cache('Registration', $registration->ID());
1023
+				}
1024
+				$this->checkout->set_reg_status_updated($registration->ID(), false);
1025
+			}
1026
+		}
1027
+	}
1028
+
1029
+
1030
+
1031
+	/**
1032
+	 *    adds related EE_Registration objects for each ticket in the cart to the current EE_Transaction object
1033
+	 *
1034
+	 * @access private
1035
+	 * @param EE_Transaction $transaction
1036
+	 * @return    array
1037
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
1038
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
1039
+	 * @throws \EE_Error
1040
+	 */
1041
+	private function _initialize_registrations(EE_Transaction $transaction)
1042
+	{
1043
+		$att_nmbr = 0;
1044
+		$registrations = array();
1045
+		if ($transaction instanceof EE_Transaction) {
1046
+			/** @type EE_Registration_Processor $registration_processor */
1047
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1048
+			$this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count();
1049
+			// now let's add the cart items to the $transaction
1050
+			foreach ($this->checkout->cart->get_tickets() as $line_item) {
1051
+				//do the following for each ticket of this type they selected
1052
+				for ($x = 1; $x <= $line_item->quantity(); $x++) {
1053
+					$att_nmbr++;
1054
+					/** @var EventEspresso\core\services\commands\registration\CreateRegistrationCommand $CreateRegistrationCommand */
1055
+					$CreateRegistrationCommand = EE_Registry::instance()->create(
1056
+						'EventEspresso\core\services\commands\registration\CreateRegistrationCommand',
1057
+						array(
1058
+							$transaction,
1059
+							$line_item,
1060
+							$att_nmbr,
1061
+							$this->checkout->total_ticket_count,
1062
+						)
1063
+					);
1064
+					// override capabilities for frontend registrations
1065
+					if ( ! is_admin()) {
1066
+						$CreateRegistrationCommand->setCapCheck(
1067
+							new PublicCapabilities('', 'create_new_registration')
1068
+						);
1069
+					}
1070
+					$registration = EE_Registry::instance()->BUS->execute($CreateRegistrationCommand);
1071
+					if ( ! $registration instanceof EE_Registration) {
1072
+						throw new InvalidEntityException($registration, 'EE_Registration');
1073
+					}
1074
+					$registrations[ $registration->ID() ] = $registration;
1075
+				}
1076
+			}
1077
+			$registration_processor->fix_reg_final_price_rounding_issue($transaction);
1078
+		}
1079
+		return $registrations;
1080
+	}
1081
+
1082
+
1083
+
1084
+	/**
1085
+	 * sorts registrations by REG_count
1086
+	 *
1087
+	 * @access public
1088
+	 * @param EE_Registration $reg_A
1089
+	 * @param EE_Registration $reg_B
1090
+	 * @return int
1091
+	 */
1092
+	public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B)
1093
+	{
1094
+		// this shouldn't ever happen within the same TXN, but oh well
1095
+		if ($reg_A->count() === $reg_B->count()) {
1096
+			return 0;
1097
+		}
1098
+		return ($reg_A->count() > $reg_B->count()) ? 1 : -1;
1099
+	}
1100
+
1101
+
1102
+
1103
+	/**
1104
+	 *    _final_verifications
1105
+	 * just makes sure that everything is set up correctly before proceeding
1106
+	 *
1107
+	 * @access    private
1108
+	 * @return    bool
1109
+	 * @throws \EE_Error
1110
+	 */
1111
+	private function _final_verifications()
1112
+	{
1113
+		// filter checkout
1114
+		$this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout);
1115
+		//verify that current step is still set correctly
1116
+		if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) {
1117
+			EE_Error::add_error(
1118
+				__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'),
1119
+				__FILE__,
1120
+				__FUNCTION__,
1121
+				__LINE__
1122
+			);
1123
+			return false;
1124
+		}
1125
+		// if returning to SPCO, then verify that primary registrant is set
1126
+		if ( ! empty($this->checkout->reg_url_link)) {
1127
+			$valid_registrant = $this->checkout->transaction->primary_registration();
1128
+			if ( ! $valid_registrant instanceof EE_Registration) {
1129
+				EE_Error::add_error(
1130
+					__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'),
1131
+					__FILE__,
1132
+					__FUNCTION__,
1133
+					__LINE__
1134
+				);
1135
+				return false;
1136
+			}
1137
+			$valid_registrant = null;
1138
+			foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) {
1139
+				if (
1140
+					$registration instanceof EE_Registration
1141
+					&& $registration->reg_url_link() === $this->checkout->reg_url_link
1142
+				) {
1143
+					$valid_registrant = $registration;
1144
+				}
1145
+			}
1146
+			if ( ! $valid_registrant instanceof EE_Registration) {
1147
+				// hmmm... maybe we have the wrong session because the user is opening multiple tabs ?
1148
+				if (EED_Single_Page_Checkout::$_checkout_verified) {
1149
+					// clear the session, mark the checkout as unverified, and try again
1150
+					EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
1151
+					EED_Single_Page_Checkout::$_initialized = false;
1152
+					EED_Single_Page_Checkout::$_checkout_verified = false;
1153
+					$this->_initialize();
1154
+					EE_Error::reset_notices();
1155
+					return false;
1156
+				}
1157
+				EE_Error::add_error(
1158
+					__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'),
1159
+					__FILE__,
1160
+					__FUNCTION__,
1161
+					__LINE__
1162
+				);
1163
+				return false;
1164
+			}
1165
+		}
1166
+		// now that things have been kinda sufficiently verified,
1167
+		// let's add the checkout to the session so that it's available to other systems
1168
+		EE_Registry::instance()->SSN->set_checkout($this->checkout);
1169
+		return true;
1170
+	}
1171
+
1172
+
1173
+
1174
+	/**
1175
+	 *    _initialize_reg_steps
1176
+	 * first makes sure that EE_Transaction_Processor::set_reg_step_initiated() is called as required
1177
+	 * then loops thru all of the active reg steps and calls the initialize_reg_step() method
1178
+	 *
1179
+	 * @access    private
1180
+	 * @param bool $reinitializing
1181
+	 * @throws \EE_Error
1182
+	 */
1183
+	private function _initialize_reg_steps($reinitializing = false)
1184
+	{
1185
+		$this->checkout->set_reg_step_initiated($this->checkout->current_step);
1186
+		// loop thru all steps to call their individual "initialize" methods and set i18n strings for JS
1187
+		foreach ($this->checkout->reg_steps as $reg_step) {
1188
+			if ( ! $reg_step->initialize_reg_step()) {
1189
+				// if not initialized then maybe this step is being removed...
1190
+				if ( ! $reinitializing && $reg_step->is_current_step()) {
1191
+					// if it was the current step, then we need to start over here
1192
+					$this->_initialize_reg_steps(true);
1193
+					return;
1194
+				}
1195
+				continue;
1196
+			}
1197
+			// add css and JS for current step
1198
+			$reg_step->enqueue_styles_and_scripts();
1199
+			// i18n
1200
+			$reg_step->translate_js_strings();
1201
+			if ($reg_step->is_current_step()) {
1202
+				// the text that appears on the reg step form submit button
1203
+				$reg_step->set_submit_button_text();
1204
+			}
1205
+		}
1206
+		// dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information
1207
+		do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step);
1208
+	}
1209
+
1210
+
1211
+
1212
+	/**
1213
+	 * _check_form_submission
1214
+	 *
1215
+	 * @access private
1216
+	 * @return boolean
1217
+	 */
1218
+	private function _check_form_submission()
1219
+	{
1220
+		//does this request require the reg form to be generated ?
1221
+		if ($this->checkout->generate_reg_form) {
1222
+			// ever heard that song by Blue Rodeo ?
1223
+			try {
1224
+				$this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form();
1225
+				// if not displaying a form, then check for form submission
1226
+				if (
1227
+					$this->checkout->process_form_submission
1228
+					&& $this->checkout->current_step->reg_form->was_submitted()
1229
+				) {
1230
+					// clear out any old data in case this step is being run again
1231
+					$this->checkout->current_step->set_valid_data(array());
1232
+					// capture submitted form data
1233
+					$this->checkout->current_step->reg_form->receive_form_submission(
1234
+						apply_filters(
1235
+							'FHEE__Single_Page_Checkout___check_form_submission__request_params',
1236
+							EE_Registry::instance()->REQ->params(),
1237
+							$this->checkout
1238
+						)
1239
+					);
1240
+					// validate submitted form data
1241
+					if ( ! $this->checkout->continue_reg || ! $this->checkout->current_step->reg_form->is_valid()) {
1242
+						// thou shall not pass !!!
1243
+						$this->checkout->continue_reg = false;
1244
+						// any form validation errors?
1245
+						if ($this->checkout->current_step->reg_form->submission_error_message() !== '') {
1246
+							$submission_error_messages = array();
1247
+							// bad, bad, bad registrant
1248
+							foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) {
1249
+								if ($validation_error instanceof EE_Validation_Error) {
1250
+									$submission_error_messages[] = sprintf(
1251
+										__('%s : %s', 'event_espresso'),
1252
+										$validation_error->get_form_section()->html_label_text(),
1253
+										$validation_error->getMessage()
1254
+									);
1255
+								}
1256
+							}
1257
+							EE_Error::add_error(implode('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__);
1258
+						}
1259
+						// well not really... what will happen is we'll just get redirected back to redo the current step
1260
+						$this->go_to_next_step();
1261
+						return false;
1262
+					}
1263
+				}
1264
+			} catch (EE_Error $e) {
1265
+				$e->get_error();
1266
+			}
1267
+		}
1268
+		return true;
1269
+	}
1270
+
1271
+
1272
+
1273
+	/**
1274
+	 * _process_action
1275
+	 *
1276
+	 * @access private
1277
+	 * @return void
1278
+	 * @throws \EE_Error
1279
+	 */
1280
+	private function _process_form_action()
1281
+	{
1282
+		// what cha wanna do?
1283
+		switch ($this->checkout->action) {
1284
+			// AJAX next step reg form
1285
+			case 'display_spco_reg_step' :
1286
+				$this->checkout->redirect = false;
1287
+				if (EE_Registry::instance()->REQ->ajax) {
1288
+					$this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form());
1289
+				}
1290
+				break;
1291
+			default :
1292
+				// meh... do one of those other steps first
1293
+				if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) {
1294
+					// dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step
1295
+					do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1296
+					// call action on current step
1297
+					if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) {
1298
+						// good registrant, you get to proceed
1299
+						if (
1300
+							$this->checkout->current_step->success_message() !== ''
1301
+							&& apply_filters(
1302
+								'FHEE__Single_Page_Checkout___process_form_action__display_success',
1303
+								false
1304
+							)
1305
+						) {
1306
+							EE_Error::add_success(
1307
+								$this->checkout->current_step->success_message()
1308
+								. '<br />' . $this->checkout->next_step->_instructions()
1309
+							);
1310
+						}
1311
+						// pack it up, pack it in...
1312
+						$this->_setup_redirect();
1313
+					}
1314
+					// dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step
1315
+					do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step);
1316
+				} else {
1317
+					EE_Error::add_error(
1318
+						sprintf(
1319
+							__('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'),
1320
+							$this->checkout->action,
1321
+							$this->checkout->current_step->name()
1322
+						),
1323
+						__FILE__,
1324
+						__FUNCTION__,
1325
+						__LINE__
1326
+					);
1327
+				}
1328
+			// end default
1329
+		}
1330
+		// store our progress so far
1331
+		$this->checkout->stash_transaction_and_checkout();
1332
+		// advance to the next step! If you pass GO, collect $200
1333
+		$this->go_to_next_step();
1334
+	}
1335
+
1336
+
1337
+
1338
+	/**
1339
+	 *        add_styles_and_scripts
1340
+	 *
1341
+	 * @access        public
1342
+	 * @return        void
1343
+	 */
1344
+	public function add_styles_and_scripts()
1345
+	{
1346
+		// i18n
1347
+		$this->translate_js_strings();
1348
+		if ($this->checkout->admin_request) {
1349
+			add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1350
+		} else {
1351
+			add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10);
1352
+		}
1353
+	}
1354
+
1355
+
1356
+
1357
+	/**
1358
+	 *        translate_js_strings
1359
+	 *
1360
+	 * @access        public
1361
+	 * @return        void
1362
+	 */
1363
+	public function translate_js_strings()
1364
+	{
1365
+		EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit;
1366
+		EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link;
1367
+		EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1368
+		EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso');
1369
+		EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso');
1370
+		EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso');
1371
+		EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso');
1372
+		EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso');
1373
+		EE_Registry::$i18n_js_strings['process_registration'] = sprintf(
1374
+			__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'),
1375
+			'<br/>',
1376
+			'<br/>'
1377
+		);
1378
+		EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language');
1379
+		EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id();
1380
+		EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency;
1381
+		EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20';
1382
+		EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso');
1383
+		EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso');
1384
+		EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso');
1385
+		EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso');
1386
+		EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso');
1387
+		EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso');
1388
+		EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso');
1389
+		EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso');
1390
+		EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso');
1391
+		EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso');
1392
+		EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso');
1393
+		EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso');
1394
+		EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso');
1395
+		EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso');
1396
+		EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf(
1397
+			__(
1398
+				'%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s',
1399
+				'event_espresso'
1400
+			),
1401
+			'<h4 class="important-notice">',
1402
+			'</h4>',
1403
+			'<br />',
1404
+			'<p>',
1405
+			'<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1406
+			'">',
1407
+			'</a>',
1408
+			'</p>'
1409
+		);
1410
+		EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true);
1411
+		EE_Registry::$i18n_js_strings['session_extension'] = absint(
1412
+			apply_filters('FHEE__EE_Session__extend_expiration__seconds_added', 10 * MINUTE_IN_SECONDS)
1413
+		);
1414
+		EE_Registry::$i18n_js_strings['session_expiration'] = gmdate(
1415
+			'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)
1416
+		);
1417
+	}
1418
+
1419
+
1420
+
1421
+	/**
1422
+	 *    enqueue_styles_and_scripts
1423
+	 *
1424
+	 * @access        public
1425
+	 * @return        void
1426
+	 * @throws \EE_Error
1427
+	 */
1428
+	public function enqueue_styles_and_scripts()
1429
+	{
1430
+		// load css
1431
+		wp_register_style('single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION);
1432
+		wp_enqueue_style('single_page_checkout');
1433
+		// load JS
1434
+		wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL . 'jquery	.plugin.min.js', array('jquery'), '1.0.1', true);
1435
+		wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL . 'jquery	.countdown.min.js', array('jquery_plugin'), '2.0.2', true);
1436
+		wp_register_script('single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, true);
1437
+		if ($this->checkout->registration_form instanceof EE_Form_Section_Proper) {
1438
+			$this->checkout->registration_form->enqueue_js();
1439
+		}
1440
+		if ($this->checkout->current_step->reg_form instanceof EE_Form_Section_Proper) {
1441
+			$this->checkout->current_step->reg_form->enqueue_js();
1442
+		}
1443
+		wp_enqueue_script('single_page_checkout');
1444
+		/**
1445
+		 * global action hook for enqueueing styles and scripts with
1446
+		 * spco calls.
1447
+		 */
1448
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this);
1449
+		/**
1450
+		 * dynamic action hook for enqueueing styles and scripts with spco calls.
1451
+		 * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information
1452
+		 */
1453
+		do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this);
1454
+	}
1455
+
1456
+
1457
+
1458
+	/**
1459
+	 *    display the Registration Single Page Checkout Form
1460
+	 *
1461
+	 * @access    private
1462
+	 * @return    void
1463
+	 * @throws \EE_Error
1464
+	 */
1465
+	private function _display_spco_reg_form()
1466
+	{
1467
+		// if registering via the admin, just display the reg form for the current step
1468
+		if ($this->checkout->admin_request) {
1469
+			EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form());
1470
+		} else {
1471
+			// add powered by EE msg
1472
+			add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer'));
1473
+			$empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1
1474
+				? true
1475
+				: false;
1476
+			EE_Registry::$i18n_js_strings['empty_cart'] = $empty_cart;
1477
+			$cookies_not_set_msg = '';
1478
+			if ($empty_cart && ! isset($_COOKIE['ee_cookie_test'])) {
1479
+				$cookies_not_set_msg = apply_filters(
1480
+					'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg',
1481
+					sprintf(
1482
+						__(
1483
+							'%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s',
1484
+							'event_espresso'
1485
+						),
1486
+						'<div class="ee-attention">',
1487
+						'</div>',
1488
+						'<h6 class="important-notice">',
1489
+						'</h6>',
1490
+						'<p>',
1491
+						'</p>',
1492
+						'<br />',
1493
+						'<a href="http://www.whatarecookies.com/enable.asp" target="_blank">',
1494
+						'</a>'
1495
+					)
1496
+				);
1497
+			}
1498
+			$this->checkout->registration_form = new EE_Form_Section_Proper(
1499
+				array(
1500
+					'name'            => 'single-page-checkout',
1501
+					'html_id'         => 'ee-single-page-checkout-dv',
1502
+					'layout_strategy' =>
1503
+						new EE_Template_Layout(
1504
+							array(
1505
+								'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php',
1506
+								'template_args'        => array(
1507
+									'empty_cart'              => $empty_cart,
1508
+									'revisit'                 => $this->checkout->revisit,
1509
+									'reg_steps'               => $this->checkout->reg_steps,
1510
+									'next_step'               => $this->checkout->next_step instanceof EE_SPCO_Reg_Step
1511
+										? $this->checkout->next_step->slug()
1512
+										: '',
1513
+									'cancel_page_url'         => $this->checkout->cancel_page_url,
1514
+									'empty_msg'               => apply_filters(
1515
+										'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg',
1516
+										sprintf(
1517
+											__('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.',
1518
+												'event_espresso'),
1519
+											'<a href="' . get_post_type_archive_link('espresso_events') . '" title="',
1520
+											'">',
1521
+											'</a>'
1522
+										)
1523
+									),
1524
+									'cookies_not_set_msg'     => $cookies_not_set_msg,
1525
+									'registration_time_limit' => $this->checkout->get_registration_time_limit(),
1526
+									'session_expiration'      => gmdate(
1527
+										'M d, Y H:i:s',
1528
+										EE_Registry::instance()->SSN->expiration()
1529
+										+ (get_option('gmt_offset') * HOUR_IN_SECONDS)
1530
+									),
1531
+								),
1532
+							)
1533
+						),
1534
+				)
1535
+			);
1536
+			// load template and add to output sent that gets filtered into the_content()
1537
+			EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html());
1538
+		}
1539
+	}
1540
+
1541
+
1542
+
1543
+	/**
1544
+	 *    add_extra_finalize_registration_inputs
1545
+	 *
1546
+	 * @access    public
1547
+	 * @param $next_step
1548
+	 * @internal  param string $label
1549
+	 * @return void
1550
+	 */
1551
+	public function add_extra_finalize_registration_inputs($next_step)
1552
+	{
1553
+		if ($next_step === 'finalize_registration') {
1554
+			echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>';
1555
+		}
1556
+	}
1557
+
1558
+
1559
+
1560
+	/**
1561
+	 *    display_registration_footer
1562
+	 *
1563
+	 * @access    public
1564
+	 * @return    string
1565
+	 */
1566
+	public static function display_registration_footer()
1567
+	{
1568
+		if (
1569
+		apply_filters(
1570
+			'FHEE__EE_Front__Controller__show_reg_footer',
1571
+			EE_Registry::instance()->CFG->admin->show_reg_footer
1572
+		)
1573
+		) {
1574
+			add_filter(
1575
+				'FHEE__EEH_Template__powered_by_event_espresso__url',
1576
+				function ($url) {
1577
+					return apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url);
1578
+				}
1579
+			);
1580
+			echo apply_filters(
1581
+				'FHEE__EE_Front_Controller__display_registration_footer',
1582
+				\EEH_Template::powered_by_event_espresso(
1583
+					'',
1584
+					'espresso-registration-footer-dv',
1585
+					array('utm_content' => 'registration_checkout')
1586
+				)
1587
+			);
1588
+		}
1589
+		return '';
1590
+	}
1591
+
1592
+
1593
+
1594
+	/**
1595
+	 *    unlock_transaction
1596
+	 *
1597
+	 * @access    public
1598
+	 * @return    void
1599
+	 * @throws \EE_Error
1600
+	 */
1601
+	public function unlock_transaction()
1602
+	{
1603
+		if ($this->checkout->transaction instanceof EE_Transaction) {
1604
+			$this->checkout->transaction->unlock();
1605
+		}
1606
+	}
1607
+
1608
+
1609
+
1610
+	/**
1611
+	 *        _setup_redirect
1612
+	 *
1613
+	 * @access    private
1614
+	 * @return void
1615
+	 */
1616
+	private function _setup_redirect()
1617
+	{
1618
+		if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) {
1619
+			$this->checkout->redirect = true;
1620
+			if (empty($this->checkout->redirect_url)) {
1621
+				$this->checkout->redirect_url = $this->checkout->next_step->reg_step_url();
1622
+			}
1623
+			$this->checkout->redirect_url = apply_filters(
1624
+				'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url',
1625
+				$this->checkout->redirect_url,
1626
+				$this->checkout
1627
+			);
1628
+		}
1629
+	}
1630
+
1631
+
1632
+
1633
+	/**
1634
+	 *   handle ajax message responses and redirects
1635
+	 *
1636
+	 * @access public
1637
+	 * @return void
1638
+	 * @throws \EE_Error
1639
+	 */
1640
+	public function go_to_next_step()
1641
+	{
1642
+		if (EE_Registry::instance()->REQ->ajax) {
1643
+			// capture contents of output buffer we started earlier in the request, and insert into JSON response
1644
+			$this->checkout->json_response->set_unexpected_errors(ob_get_clean());
1645
+		}
1646
+		$this->unlock_transaction();
1647
+		// just return for these conditions
1648
+		if (
1649
+			$this->checkout->admin_request
1650
+			|| $this->checkout->action === 'redirect_form'
1651
+			|| $this->checkout->action === 'update_checkout'
1652
+		) {
1653
+			return;
1654
+		}
1655
+		// AJAX response
1656
+		$this->_handle_json_response();
1657
+		// redirect to next step or the Thank You page
1658
+		$this->_handle_html_redirects();
1659
+		// hmmm... must be something wrong, so let's just display the form again !
1660
+		$this->_display_spco_reg_form();
1661
+	}
1662
+
1663
+
1664
+
1665
+	/**
1666
+	 *   _handle_json_response
1667
+	 *
1668
+	 * @access protected
1669
+	 * @return void
1670
+	 */
1671
+	protected function _handle_json_response()
1672
+	{
1673
+		// if this is an ajax request
1674
+		if (EE_Registry::instance()->REQ->ajax) {
1675
+			// DEBUG LOG
1676
+			//$this->checkout->log(
1677
+			//	__CLASS__, __FUNCTION__, __LINE__,
1678
+			//	array(
1679
+			//		'json_response_redirect_url' => $this->checkout->json_response->redirect_url(),
1680
+			//		'redirect'                   => $this->checkout->redirect,
1681
+			//		'continue_reg'               => $this->checkout->continue_reg,
1682
+			//	)
1683
+			//);
1684
+			$this->checkout->json_response->set_registration_time_limit(
1685
+				$this->checkout->get_registration_time_limit()
1686
+			);
1687
+			$this->checkout->json_response->set_payment_amount($this->checkout->amount_owing);
1688
+			// just send the ajax (
1689
+			$json_response = apply_filters(
1690
+				'FHEE__EE_Single_Page_Checkout__JSON_response',
1691
+				$this->checkout->json_response
1692
+			);
1693
+			echo $json_response;
1694
+			exit();
1695
+		}
1696
+	}
1697
+
1698
+
1699
+
1700
+	/**
1701
+	 *   _handle_redirects
1702
+	 *
1703
+	 * @access protected
1704
+	 * @return void
1705
+	 */
1706
+	protected function _handle_html_redirects()
1707
+	{
1708
+		// going somewhere ?
1709
+		if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) {
1710
+			// store notices in a transient
1711
+			EE_Error::get_notices(false, true, true);
1712
+			// DEBUG LOG
1713
+			//$this->checkout->log(
1714
+			//	__CLASS__, __FUNCTION__, __LINE__,
1715
+			//	array(
1716
+			//		'headers_sent' => headers_sent(),
1717
+			//		'redirect_url'     => $this->checkout->redirect_url,
1718
+			//		'headers_list'    => headers_list(),
1719
+			//	)
1720
+			//);
1721
+			wp_safe_redirect($this->checkout->redirect_url);
1722
+			exit();
1723
+		}
1724
+	}
1725
+
1726
+
1727
+
1728
+	/**
1729
+	 *   set_checkout_anchor
1730
+	 *
1731
+	 * @access public
1732
+	 * @return void
1733
+	 */
1734
+	public function set_checkout_anchor()
1735
+	{
1736
+		echo '<a id="checkout" style="float: left; margin-left: -999em;"></a>';
1737
+	}
1738 1738
 
1739 1739
 
1740 1740
 
Please login to merge, or discard this patch.
shortcodes/espresso_txn_page/EES_Espresso_Txn_Page.shortcode.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
2 2
 /**
3 3
  * EES_Espresso_Txn_Page
4 4
  *
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @throws \Exception
58 58
 	 * @throws \EE_Error
59 59
 	 */
60
-	public function run( WP $WP ) {
60
+	public function run(WP $WP) {
61 61
 	}
62 62
 
63 63
 
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @param array $attributes
69 69
 	 * @return string
70 70
 	 */
71
-	public function process_shortcode( $attributes = array() ) {
72
-		return __( 'This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso' );
71
+	public function process_shortcode($attributes = array()) {
72
+		return __('This is the Event Espresso Transactions page. This page receives instant payment notification (IPN) requests and should have a status of published, but should not be easily accessible by site visitors. Do not add it to your website\'s navigation menu or link to it from another page. Also, do not delete it or change its status to private.', 'event_espresso');
73 73
 	}
74 74
 
75 75
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 	/**
14
-     * @deprecated 4.9.27
15
-     * @return 	void
14
+	 * @deprecated 4.9.27
15
+	 * @return 	void
16 16
 	 */
17 17
 	public static function set_hooks() {
18 18
 	}
19 19
 
20 20
 	/**
21
-     * @deprecated 4.9.27
22
-     * @return 	void
21
+	 * @deprecated 4.9.27
22
+	 * @return 	void
23 23
 	 */
24 24
 	public static function set_hooks_admin() {
25 25
 	}
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 	/**
30
-     * @deprecated 4.9.27
31
-     * @return 	void
30
+	 * @deprecated 4.9.27
31
+	 * @return 	void
32 32
 	 */
33 33
 	public static function set_definitions() {
34 34
 	}
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 
37 37
 
38 38
 	/**
39
-     * @deprecated 4.9.27
40
-     * @param  WP $WP
39
+	 * @deprecated 4.9.27
40
+	 * @param  WP $WP
41 41
 	 * @return void
42 42
 	 * @throws \Exception
43 43
 	 * @throws \EE_Error
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	/**
52
-     * @deprecated 4.9.27
53
-     * @param array $attributes
52
+	 * @deprecated 4.9.27
53
+	 * @param array $attributes
54 54
 	 * @return string
55 55
 	 */
56 56
 	public function process_shortcode( $attributes = array() ) {
Please login to merge, or discard this patch.
core/domain/entities/shortcodes/EspressoTicketSelector.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         do_action('AHEE_event_details_before_post', $event_id);
65 65
         espresso_ticket_selector($event);
66 66
         do_action('AHEE_event_details_after_post');
67
-        return ob_get_clean();    }
67
+        return ob_get_clean(); }
68 68
 }
69 69
 // End of file EspressoTicketSelector.php
70 70
 // Location: EventEspresso\core\domain\entities\shortcodes/EspressoTicketSelector.php
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -21,62 +21,62 @@
 block discarded – undo
21 21
 
22 22
 
23 23
 
24
-    /**
25
-     * the actual shortcode tag that gets registered with WordPress
26
-     *
27
-     * @return string
28
-     */
29
-    public function getTag()
30
-    {
31
-        return 'ESPRESSO_TICKET_SELECTOR';
32
-    }
33
-
34
-
35
-
36
-    /**
37
-     * the time in seconds to cache the results of the processShortcode() method
38
-     * 0 means the processShortcode() results will NOT be cached at all
39
-     *
40
-     * @return int
41
-     */
42
-    public function cacheExpiration()
43
-    {
44
-        return MINUTE_IN_SECONDS * 5;
45
-    }
46
-
47
-
48
-    /**
49
-     * a place for adding any initialization code that needs to run prior to wp_header().
50
-     * this may be required for shortcodes that utilize a corresponding module,
51
-     * and need to enqueue assets for that module
52
-     *
53
-     * @return void
54
-     */
55
-    public function initializeShortcode()
56
-    {
57
-        add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
58
-    }
59
-
60
-
61
-
62
-    /**
63
-     * callback that runs when the shortcode is encountered in post content.
64
-     * IMPORTANT !!!
65
-     * remember that shortcode content should be RETURNED and NOT echoed out
66
-     *
67
-     * @param array $attributes
68
-     * @return string
69
-     */
70
-    public function processShortcode($attributes = array())
71
-    {
72
-        extract($attributes, EXTR_OVERWRITE);
73
-        $event_id = isset($event_id) ? $event_id : 0;
74
-        $event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
75
-        ob_start();
76
-        do_action('AHEE_event_details_before_post', $event_id);
77
-        espresso_ticket_selector($event);
78
-        do_action('AHEE_event_details_after_post');
79
-        return ob_get_clean();    }
24
+	/**
25
+	 * the actual shortcode tag that gets registered with WordPress
26
+	 *
27
+	 * @return string
28
+	 */
29
+	public function getTag()
30
+	{
31
+		return 'ESPRESSO_TICKET_SELECTOR';
32
+	}
33
+
34
+
35
+
36
+	/**
37
+	 * the time in seconds to cache the results of the processShortcode() method
38
+	 * 0 means the processShortcode() results will NOT be cached at all
39
+	 *
40
+	 * @return int
41
+	 */
42
+	public function cacheExpiration()
43
+	{
44
+		return MINUTE_IN_SECONDS * 5;
45
+	}
46
+
47
+
48
+	/**
49
+	 * a place for adding any initialization code that needs to run prior to wp_header().
50
+	 * this may be required for shortcodes that utilize a corresponding module,
51
+	 * and need to enqueue assets for that module
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function initializeShortcode()
56
+	{
57
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
58
+	}
59
+
60
+
61
+
62
+	/**
63
+	 * callback that runs when the shortcode is encountered in post content.
64
+	 * IMPORTANT !!!
65
+	 * remember that shortcode content should be RETURNED and NOT echoed out
66
+	 *
67
+	 * @param array $attributes
68
+	 * @return string
69
+	 */
70
+	public function processShortcode($attributes = array())
71
+	{
72
+		extract($attributes, EXTR_OVERWRITE);
73
+		$event_id = isset($event_id) ? $event_id : 0;
74
+		$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($event_id);
75
+		ob_start();
76
+		do_action('AHEE_event_details_before_post', $event_id);
77
+		espresso_ticket_selector($event);
78
+		do_action('AHEE_event_details_after_post');
79
+		return ob_get_clean();    }
80 80
 }
81 81
 // End of file EspressoTicketSelector.php
82 82
 // Location: EventEspresso\core\domain\entities\shortcodes/EspressoTicketSelector.php
83 83
\ No newline at end of file
Please login to merge, or discard this patch.
shortcodes/espresso_cancelled/EES_Espresso_Cancelled.shortcode.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -14,57 +14,57 @@
 block discarded – undo
14 14
 class EES_Espresso_Cancelled extends EES_Shortcode
15 15
 {
16 16
 
17
-    /**
18
-     * @deprecated 4.9.27
19
-     * @return    void
20
-     */
21
-    public static function set_hooks()
22
-    {
23
-    }
17
+	/**
18
+	 * @deprecated 4.9.27
19
+	 * @return    void
20
+	 */
21
+	public static function set_hooks()
22
+	{
23
+	}
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * @deprecated 4.9.27
29
-     * @return    void
30
-     */
31
-    public static function set_hooks_admin()
32
-    {
33
-    }
27
+	/**
28
+	 * @deprecated 4.9.27
29
+	 * @return    void
30
+	 */
31
+	public static function set_hooks_admin()
32
+	{
33
+	}
34 34
 
35 35
 
36 36
 
37
-    /**
38
-     * @deprecated 4.9.27
39
-     * @param WP $WP
40
-     * @return    void
41
-     */
42
-    public function run(WP $WP)
43
-    {
44
-    }
37
+	/**
38
+	 * @deprecated 4.9.27
39
+	 * @param WP $WP
40
+	 * @return    void
41
+	 */
42
+	public function run(WP $WP)
43
+	{
44
+	}
45 45
 
46 46
 
47 47
 
48
-    /**
49
-     * process_shortcode - ESPRESSO_CANCELLED
50
-     *
51
-     * @deprecated 4.9.27
52
-     * @param        array $attributes
53
-     * @return    string
54
-     * @throws \EE_Error
55
-     */
56
-    public function process_shortcode($attributes = array())
57
-    {
58
-        \EE_Error::doing_it_wrong(
59
-            __METHOD__,
60
-            __(
61
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCancelled instead.',
62
-                'event_espresso'
63
-            ),
64
-            '4.9.27'
65
-        );
66
-        return '';
67
-    }
48
+	/**
49
+	 * process_shortcode - ESPRESSO_CANCELLED
50
+	 *
51
+	 * @deprecated 4.9.27
52
+	 * @param        array $attributes
53
+	 * @return    string
54
+	 * @throws \EE_Error
55
+	 */
56
+	public function process_shortcode($attributes = array())
57
+	{
58
+		\EE_Error::doing_it_wrong(
59
+			__METHOD__,
60
+			__(
61
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoCancelled instead.',
62
+				'event_espresso'
63
+			),
64
+			'4.9.27'
65
+		);
66
+		return '';
67
+	}
68 68
 
69 69
 }
70 70
 // End of file EES_Espresso_Cancelled.shortcode.php
Please login to merge, or discard this patch.
espresso_ticket_selector/EES_Espresso_Ticket_Selector.shortcode.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 class EES_Espresso_Ticket_Selector  extends EES_Shortcode {
11 11
 
12 12
 	/**
13
-     * @deprecated 4.9.27
14
-     * @return 	void
13
+	 * @deprecated 4.9.27
14
+	 * @return 	void
15 15
 	 */
16 16
 	public static function set_hooks() {
17 17
 	}
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 
21 21
 	/**
22
-     * @deprecated 4.9.27
23
-     * @return 	void
22
+	 * @deprecated 4.9.27
23
+	 * @return 	void
24 24
 	 */
25 25
 	public static function set_hooks_admin() {
26 26
 	}
@@ -28,29 +28,29 @@  discard block
 block discarded – undo
28 28
 
29 29
 
30 30
 	/**
31
-     * @deprecated 4.9.27
32
-     * @param \WP $WP
31
+	 * @deprecated 4.9.27
32
+	 * @param \WP $WP
33 33
 	 */
34 34
 	public function run( WP $WP ) {
35 35
 	}
36 36
 
37 37
 
38 38
 	/**
39
-     * @deprecated 4.9.27
40
-     * @param		array 	$attributes
39
+	 * @deprecated 4.9.27
40
+	 * @param		array 	$attributes
41 41
 	 * @return 	string
42 42
 	 */
43 43
 	public function process_shortcode( $attributes = array() ) {
44
-        \EE_Error::doing_it_wrong(
45
-            __METHOD__,
46
-            __(
47
-                'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector instead.',
48
-                'event_espresso'
49
-            ),
50
-            '4.9.27'
51
-        );
52
-        return '';
53
-    }
44
+		\EE_Error::doing_it_wrong(
45
+			__METHOD__,
46
+			__(
47
+				'Usage is deprecated. Please use \EventEspresso\core\domain\entities\shortcodes\EspressoTicketSelector instead.',
48
+				'event_espresso'
49
+			),
50
+			'4.9.27'
51
+		);
52
+		return '';
53
+	}
54 54
 
55 55
 }
56 56
 // End of file EES_Espresso_Ticket_Selector.shortcode.php
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @deprecated 4.9.27
32 32
      * @param \WP $WP
33 33
 	 */
34
-	public function run( WP $WP ) {
34
+	public function run(WP $WP) {
35 35
 	}
36 36
 
37 37
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param		array 	$attributes
41 41
 	 * @return 	string
42 42
 	 */
43
-	public function process_shortcode( $attributes = array() ) {
43
+	public function process_shortcode($attributes = array()) {
44 44
         \EE_Error::doing_it_wrong(
45 45
             __METHOD__,
46 46
             __(
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EES_Espresso_Ticket_Selector
4 6
  *
Please login to merge, or discard this patch.