Completed
Branch FET/add-attendee-importer-to-l... (e1a923)
by
unknown
27:05 queued 17:59
created
core/domain/entities/shortcodes/EspressoEventAttendees.php 1 patch
Indentation   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -31,338 +31,338 @@
 block discarded – undo
31 31
 class EspressoEventAttendees extends EspressoShortcode
32 32
 {
33 33
 
34
-    private $query_params = array(
35
-        0 => array(),
36
-    );
34
+	private $query_params = array(
35
+		0 => array(),
36
+	);
37 37
 
38
-    private $template_args = array(
39
-        'contacts' => array(),
40
-        'event'    => null,
41
-        'datetime' => null,
42
-        'ticket'   => null,
43
-    );
38
+	private $template_args = array(
39
+		'contacts' => array(),
40
+		'event'    => null,
41
+		'datetime' => null,
42
+		'ticket'   => null,
43
+	);
44 44
 
45
-    /**
46
-     * the actual shortcode tag that gets registered with WordPress
47
-     *
48
-     * @return string
49
-     */
50
-    public function getTag()
51
-    {
52
-        return 'ESPRESSO_EVENT_ATTENDEES';
53
-    }
45
+	/**
46
+	 * the actual shortcode tag that gets registered with WordPress
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function getTag()
51
+	{
52
+		return 'ESPRESSO_EVENT_ATTENDEES';
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * the time in seconds to cache the results of the processShortcode() method
58
-     * 0 means the processShortcode() results will NOT be cached at all
59
-     *
60
-     * @return int
61
-     */
62
-    public function cacheExpiration()
63
-    {
64
-        return 0;
65
-    }
56
+	/**
57
+	 * the time in seconds to cache the results of the processShortcode() method
58
+	 * 0 means the processShortcode() results will NOT be cached at all
59
+	 *
60
+	 * @return int
61
+	 */
62
+	public function cacheExpiration()
63
+	{
64
+		return 0;
65
+	}
66 66
 
67 67
 
68
-    /**
69
-     * a place for adding any initialization code that needs to run prior to wp_header().
70
-     * this may be required for shortcodes that utilize a corresponding module,
71
-     * and need to enqueue assets for that module
72
-     *
73
-     * @return void
74
-     */
75
-    public function initializeShortcode()
76
-    {
77
-        $this->shortcodeHasBeenInitialized();
78
-    }
68
+	/**
69
+	 * a place for adding any initialization code that needs to run prior to wp_header().
70
+	 * this may be required for shortcodes that utilize a corresponding module,
71
+	 * and need to enqueue assets for that module
72
+	 *
73
+	 * @return void
74
+	 */
75
+	public function initializeShortcode()
76
+	{
77
+		$this->shortcodeHasBeenInitialized();
78
+	}
79 79
 
80 80
 
81
-    /**
82
-     * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
-     *  [ESPRESSO_EVENT_ATTENDEES]
84
-     *  - defaults to attendees for earliest active event, or earliest upcoming event.
85
-     *  [ESPRESSO_EVENT_ATTENDEES event_id=123]
86
-     *  - attendees for specific event.
87
-     *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245]
88
-     *  - attendees for a specific datetime.
89
-     *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123]
90
-     *  - attendees for a specific ticket.
91
-     *  [ESPRESSO_EVENT_ATTENDEES status=all]
92
-     *  - specific registration status (use status id) or all for all attendees regardless of status.
93
-     *  Note default is to only return approved attendees
94
-     *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true]
95
-     *  - default is to not return gravatar.  Otherwise if this is set then return gravatar for email address given.
96
-     *  [ESPRESSO_EVENT_ATTENDEES display_on_archives=true]
97
-     *  - default is to not display attendees list on archive pages.
98
-     * Note: because of the relationship between event_id, ticket_id, and datetime_id:
99
-     * If more than one of those params is included, then preference is given to the following:
100
-     *  - event_id is used whenever its present and any others are ignored.
101
-     *  - if no event_id then datetime is used whenever its present and any others are ignored.
102
-     *  - otherwise ticket_id is used if present.
103
-     *
104
-     * @param array $attributes
105
-     * @return string
106
-     * @throws EE_Error
107
-     * @throws InvalidDataTypeException
108
-     * @throws InvalidInterfaceException
109
-     * @throws InvalidArgumentException
110
-     * @throws DomainException
111
-     */
112
-    public function processShortcode($attributes = array())
113
-    {
114
-        // grab attributes and merge with defaults
115
-        $attributes = $this->getAttributes((array) $attributes);
116
-        $attributes['limit'] = (int) $attributes['limit'];
117
-        $display_on_archives = filter_var($attributes['display_on_archives'], FILTER_VALIDATE_BOOLEAN);
118
-        // don't display on archives unless 'display_on_archives' is true
119
-        if ($attributes['limit'] === 0 || (! $display_on_archives && is_archive())) {
120
-            return '';
121
-        }
122
-        try {
123
-            $this->setBaseTemplateArguments($attributes);
124
-            $this->validateEntities($attributes);
125
-            $this->setBaseQueryParams();
126
-        } catch (EntityNotFoundException $e) {
127
-            if (WP_DEBUG) {
128
-                return '<div class="important-notice ee-error">'
129
-                       . $e->getMessage()
130
-                       . '</div>';
131
-            }
132
-            return '';
133
-        }
134
-        $this->setAdditionalQueryParams($attributes);
135
-        // get contacts!
136
-        $this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
137
-        // all set let's load up the template and return.
138
-        return EEH_Template::locate_template(
139
-            'loop-espresso_event_attendees.php',
140
-            $this->template_args
141
-        );
142
-    }
81
+	/**
82
+	 * process_shortcode - ESPRESSO_EVENT_ATTENDEES - Returns a list of attendees to an event.
83
+	 *  [ESPRESSO_EVENT_ATTENDEES]
84
+	 *  - defaults to attendees for earliest active event, or earliest upcoming event.
85
+	 *  [ESPRESSO_EVENT_ATTENDEES event_id=123]
86
+	 *  - attendees for specific event.
87
+	 *  [ESPRESSO_EVENT_ATTENDEES datetime_id=245]
88
+	 *  - attendees for a specific datetime.
89
+	 *  [ESPRESSO_EVENT_ATTENDEES ticket_id=123]
90
+	 *  - attendees for a specific ticket.
91
+	 *  [ESPRESSO_EVENT_ATTENDEES status=all]
92
+	 *  - specific registration status (use status id) or all for all attendees regardless of status.
93
+	 *  Note default is to only return approved attendees
94
+	 *  [ESPRESSO_EVENT_ATTENDEES show_gravatar=true]
95
+	 *  - default is to not return gravatar.  Otherwise if this is set then return gravatar for email address given.
96
+	 *  [ESPRESSO_EVENT_ATTENDEES display_on_archives=true]
97
+	 *  - default is to not display attendees list on archive pages.
98
+	 * Note: because of the relationship between event_id, ticket_id, and datetime_id:
99
+	 * If more than one of those params is included, then preference is given to the following:
100
+	 *  - event_id is used whenever its present and any others are ignored.
101
+	 *  - if no event_id then datetime is used whenever its present and any others are ignored.
102
+	 *  - otherwise ticket_id is used if present.
103
+	 *
104
+	 * @param array $attributes
105
+	 * @return string
106
+	 * @throws EE_Error
107
+	 * @throws InvalidDataTypeException
108
+	 * @throws InvalidInterfaceException
109
+	 * @throws InvalidArgumentException
110
+	 * @throws DomainException
111
+	 */
112
+	public function processShortcode($attributes = array())
113
+	{
114
+		// grab attributes and merge with defaults
115
+		$attributes = $this->getAttributes((array) $attributes);
116
+		$attributes['limit'] = (int) $attributes['limit'];
117
+		$display_on_archives = filter_var($attributes['display_on_archives'], FILTER_VALIDATE_BOOLEAN);
118
+		// don't display on archives unless 'display_on_archives' is true
119
+		if ($attributes['limit'] === 0 || (! $display_on_archives && is_archive())) {
120
+			return '';
121
+		}
122
+		try {
123
+			$this->setBaseTemplateArguments($attributes);
124
+			$this->validateEntities($attributes);
125
+			$this->setBaseQueryParams();
126
+		} catch (EntityNotFoundException $e) {
127
+			if (WP_DEBUG) {
128
+				return '<div class="important-notice ee-error">'
129
+					   . $e->getMessage()
130
+					   . '</div>';
131
+			}
132
+			return '';
133
+		}
134
+		$this->setAdditionalQueryParams($attributes);
135
+		// get contacts!
136
+		$this->template_args['contacts'] = EEM_Attendee::instance()->get_all($this->query_params);
137
+		// all set let's load up the template and return.
138
+		return EEH_Template::locate_template(
139
+			'loop-espresso_event_attendees.php',
140
+			$this->template_args
141
+		);
142
+	}
143 143
 
144 144
 
145
-    /**
146
-     * merge incoming attributes with filtered defaults
147
-     *
148
-     * @param array $attributes
149
-     * @return array
150
-     */
151
-    private function getAttributes(array $attributes)
152
-    {
153
-        return (array) apply_filters(
154
-            'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
155
-            $attributes + array(
156
-                'event_id'            => null,
157
-                'datetime_id'         => null,
158
-                'ticket_id'           => null,
159
-                'status'              => EEM_Registration::status_id_approved,
160
-                'show_gravatar'       => false,
161
-                'display_on_archives' => false,
162
-                'limit'               => 999,
163
-            )
164
-        );
165
-    }
145
+	/**
146
+	 * merge incoming attributes with filtered defaults
147
+	 *
148
+	 * @param array $attributes
149
+	 * @return array
150
+	 */
151
+	private function getAttributes(array $attributes)
152
+	{
153
+		return (array) apply_filters(
154
+			'EES_Espresso_Event_Attendees__process_shortcode__default_shortcode_atts',
155
+			$attributes + array(
156
+				'event_id'            => null,
157
+				'datetime_id'         => null,
158
+				'ticket_id'           => null,
159
+				'status'              => EEM_Registration::status_id_approved,
160
+				'show_gravatar'       => false,
161
+				'display_on_archives' => false,
162
+				'limit'               => 999,
163
+			)
164
+		);
165
+	}
166 166
 
167 167
 
168
-    /**
169
-     * Set all the base template arguments from the incoming attributes.
170
-     * * Note: because of the relationship between event_id, ticket_id, and datetime_id:
171
-     * If more than one of those params is included, then preference is given to the following:
172
-     *  - event_id is used whenever its present and any others are ignored.
173
-     *  - if no event_id then datetime is used whenever its present and any others are ignored.
174
-     *  - otherwise ticket_id is used if present.
175
-     *
176
-     * @param array $attributes
177
-     * @throws EE_Error
178
-     * @throws InvalidDataTypeException
179
-     * @throws InvalidInterfaceException
180
-     * @throws InvalidArgumentException
181
-     */
182
-    private function setBaseTemplateArguments(array $attributes)
183
-    {
184
-        $this->template_args['show_gravatar'] = $attributes['show_gravatar'];
185
-        $this->template_args['event'] = $this->getEvent($attributes);
186
-        $this->template_args['datetime'] = empty($attributes['event_id'])
187
-            ? $this->getDatetime($attributes)
188
-            : null;
189
-        $this->template_args['ticket'] = empty($attributes['datetime_id']) && empty($attributes['event_id'])
190
-            ? $this->getTicket($attributes)
191
-            : null;
192
-    }
168
+	/**
169
+	 * Set all the base template arguments from the incoming attributes.
170
+	 * * Note: because of the relationship between event_id, ticket_id, and datetime_id:
171
+	 * If more than one of those params is included, then preference is given to the following:
172
+	 *  - event_id is used whenever its present and any others are ignored.
173
+	 *  - if no event_id then datetime is used whenever its present and any others are ignored.
174
+	 *  - otherwise ticket_id is used if present.
175
+	 *
176
+	 * @param array $attributes
177
+	 * @throws EE_Error
178
+	 * @throws InvalidDataTypeException
179
+	 * @throws InvalidInterfaceException
180
+	 * @throws InvalidArgumentException
181
+	 */
182
+	private function setBaseTemplateArguments(array $attributes)
183
+	{
184
+		$this->template_args['show_gravatar'] = $attributes['show_gravatar'];
185
+		$this->template_args['event'] = $this->getEvent($attributes);
186
+		$this->template_args['datetime'] = empty($attributes['event_id'])
187
+			? $this->getDatetime($attributes)
188
+			: null;
189
+		$this->template_args['ticket'] = empty($attributes['datetime_id']) && empty($attributes['event_id'])
190
+			? $this->getTicket($attributes)
191
+			: null;
192
+	}
193 193
 
194 194
 
195
-    /**
196
-     * Validates the presence of entities for the given attribute values.
197
-     *
198
-     * @param array $attributes
199
-     * @throws EntityNotFoundException
200
-     */
201
-    private function validateEntities(array $attributes)
202
-    {
203
-        if (! $this->template_args['event'] instanceof EE_Event
204
-            || (
205
-                empty($attributes['event_id'])
206
-                && $attributes['datetime_id']
207
-                && ! $this->template_args['datetime'] instanceof EE_Datetime
208
-            )
209
-            || (
210
-                empty($attributes['event_id'])
211
-                && empty($attributes['datetime_id'])
212
-                && $attributes['ticket_id']
213
-                && ! $this->template_args['ticket'] instanceof EE_Ticket
214
-            )
215
-        ) {
216
-            throw new EntityNotFoundException(
217
-                '',
218
-                '',
219
-                esc_html__(
220
-                    '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.',
221
-                    'event_espresso'
222
-                )
223
-            );
224
-        }
225
-    }
195
+	/**
196
+	 * Validates the presence of entities for the given attribute values.
197
+	 *
198
+	 * @param array $attributes
199
+	 * @throws EntityNotFoundException
200
+	 */
201
+	private function validateEntities(array $attributes)
202
+	{
203
+		if (! $this->template_args['event'] instanceof EE_Event
204
+			|| (
205
+				empty($attributes['event_id'])
206
+				&& $attributes['datetime_id']
207
+				&& ! $this->template_args['datetime'] instanceof EE_Datetime
208
+			)
209
+			|| (
210
+				empty($attributes['event_id'])
211
+				&& empty($attributes['datetime_id'])
212
+				&& $attributes['ticket_id']
213
+				&& ! $this->template_args['ticket'] instanceof EE_Ticket
214
+			)
215
+		) {
216
+			throw new EntityNotFoundException(
217
+				'',
218
+				'',
219
+				esc_html__(
220
+					'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.',
221
+					'event_espresso'
222
+				)
223
+			);
224
+		}
225
+	}
226 226
 
227 227
 
228
-    /**
229
-     * Sets the query params for the base query elements.
230
-     */
231
-    private function setBaseQueryParams()
232
-    {
233
-        switch (true) {
234
-            case $this->template_args['datetime'] instanceof EE_Datetime:
235
-                $this->query_params = array(
236
-                    0                          => array(
237
-                        'Registration.Ticket.Datetime.DTT_ID' => $this->template_args['datetime']->ID(),
238
-                    ),
239
-                    'default_where_conditions' => 'this_model_only',
240
-                );
241
-                break;
242
-            case $this->template_args['ticket'] instanceof EE_Ticket:
243
-                $this->query_params[0] = array(
244
-                    'Registration.TKT_ID' => $this->template_args['ticket']->ID(),
245
-                );
246
-                break;
247
-            case $this->template_args['event'] instanceof EE_Event:
248
-                $this->query_params[0] = array(
249
-                    'Registration.EVT_ID' => $this->template_args['event']->ID(),
250
-                );
251
-                break;
252
-        }
253
-    }
228
+	/**
229
+	 * Sets the query params for the base query elements.
230
+	 */
231
+	private function setBaseQueryParams()
232
+	{
233
+		switch (true) {
234
+			case $this->template_args['datetime'] instanceof EE_Datetime:
235
+				$this->query_params = array(
236
+					0                          => array(
237
+						'Registration.Ticket.Datetime.DTT_ID' => $this->template_args['datetime']->ID(),
238
+					),
239
+					'default_where_conditions' => 'this_model_only',
240
+				);
241
+				break;
242
+			case $this->template_args['ticket'] instanceof EE_Ticket:
243
+				$this->query_params[0] = array(
244
+					'Registration.TKT_ID' => $this->template_args['ticket']->ID(),
245
+				);
246
+				break;
247
+			case $this->template_args['event'] instanceof EE_Event:
248
+				$this->query_params[0] = array(
249
+					'Registration.EVT_ID' => $this->template_args['event']->ID(),
250
+				);
251
+				break;
252
+		}
253
+	}
254 254
 
255 255
 
256
-    /**
257
-     * @param array $attributes
258
-     * @return EE_Event|null
259
-     * @throws EE_Error
260
-     * @throws InvalidDataTypeException
261
-     * @throws InvalidInterfaceException
262
-     * @throws InvalidArgumentException
263
-     */
264
-    private function getEvent(array $attributes)
265
-    {
266
-        switch (true) {
267
-            case ! empty($attributes['event_id']):
268
-                $event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
269
-                break;
270
-            case ! empty($attributes['datetime_id']):
271
-                $event = EEM_Event::instance()->get_one(array(
272
-                    array(
273
-                        'Datetime.DTT_ID' => $attributes['datetime_id'],
274
-                    ),
275
-                ));
276
-                break;
277
-            case ! empty($attributes['ticket_id']):
278
-                $event = EEM_Event::instance()->get_one(array(
279
-                    array(
280
-                        'Datetime.Ticket.TKT_ID' => $attributes['ticket_id'],
281
-                    ),
282
-                    'default_where_conditions' => 'none'
283
-                ));
284
-                break;
285
-            case is_espresso_event():
286
-                $event = EEH_Event_View::get_event();
287
-                break;
288
-            default:
289
-                // one last shot...
290
-                // try getting the earliest active event
291
-                $events = EEM_Event::instance()->get_active_events(array(
292
-                    'limit'    => 1,
293
-                    'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'),
294
-                ));
295
-                //  if none then get the next upcoming
296
-                $events = empty($events)
297
-                    ? EEM_Event::instance()->get_upcoming_events(array(
298
-                        'limit'    => 1,
299
-                        'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'),
300
-                    ))
301
-                    : $events;
302
-                $event = reset($events);
303
-        }
256
+	/**
257
+	 * @param array $attributes
258
+	 * @return EE_Event|null
259
+	 * @throws EE_Error
260
+	 * @throws InvalidDataTypeException
261
+	 * @throws InvalidInterfaceException
262
+	 * @throws InvalidArgumentException
263
+	 */
264
+	private function getEvent(array $attributes)
265
+	{
266
+		switch (true) {
267
+			case ! empty($attributes['event_id']):
268
+				$event = EEM_Event::instance()->get_one_by_ID($attributes['event_id']);
269
+				break;
270
+			case ! empty($attributes['datetime_id']):
271
+				$event = EEM_Event::instance()->get_one(array(
272
+					array(
273
+						'Datetime.DTT_ID' => $attributes['datetime_id'],
274
+					),
275
+				));
276
+				break;
277
+			case ! empty($attributes['ticket_id']):
278
+				$event = EEM_Event::instance()->get_one(array(
279
+					array(
280
+						'Datetime.Ticket.TKT_ID' => $attributes['ticket_id'],
281
+					),
282
+					'default_where_conditions' => 'none'
283
+				));
284
+				break;
285
+			case is_espresso_event():
286
+				$event = EEH_Event_View::get_event();
287
+				break;
288
+			default:
289
+				// one last shot...
290
+				// try getting the earliest active event
291
+				$events = EEM_Event::instance()->get_active_events(array(
292
+					'limit'    => 1,
293
+					'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'),
294
+				));
295
+				//  if none then get the next upcoming
296
+				$events = empty($events)
297
+					? EEM_Event::instance()->get_upcoming_events(array(
298
+						'limit'    => 1,
299
+						'order_by' => array('Datetime.DTT_EVT_start' => 'ASC'),
300
+					))
301
+					: $events;
302
+				$event = reset($events);
303
+		}
304 304
 
305
-        return $event instanceof EE_Event ? $event : null;
306
-    }
305
+		return $event instanceof EE_Event ? $event : null;
306
+	}
307 307
 
308 308
 
309
-    /**
310
-     * @param array $attributes
311
-     * @return EE_Datetime|null
312
-     * @throws EE_Error
313
-     * @throws InvalidDataTypeException
314
-     * @throws InvalidInterfaceException
315
-     * @throws InvalidArgumentException
316
-     */
317
-    private function getDatetime(array $attributes)
318
-    {
319
-        if (! empty($attributes['datetime_id'])) {
320
-            $datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
321
-            if ($datetime instanceof EE_Datetime) {
322
-                return $datetime;
323
-            }
324
-        }
325
-        return null;
326
-    }
309
+	/**
310
+	 * @param array $attributes
311
+	 * @return EE_Datetime|null
312
+	 * @throws EE_Error
313
+	 * @throws InvalidDataTypeException
314
+	 * @throws InvalidInterfaceException
315
+	 * @throws InvalidArgumentException
316
+	 */
317
+	private function getDatetime(array $attributes)
318
+	{
319
+		if (! empty($attributes['datetime_id'])) {
320
+			$datetime = EEM_Datetime::instance()->get_one_by_ID($attributes['datetime_id']);
321
+			if ($datetime instanceof EE_Datetime) {
322
+				return $datetime;
323
+			}
324
+		}
325
+		return null;
326
+	}
327 327
 
328 328
 
329
-    /**
330
-     * @param array $attributes
331
-     * @return \EE_Base_Class|EE_Ticket|null
332
-     * @throws EE_Error
333
-     * @throws InvalidDataTypeException
334
-     * @throws InvalidInterfaceException
335
-     * @throws InvalidArgumentException
336
-     */
337
-    private function getTicket(array $attributes)
338
-    {
339
-        if (! empty($attributes['ticket_id'])) {
340
-            $ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
341
-            if ($ticket instanceof EE_Ticket) {
342
-                return $ticket;
343
-            }
344
-        }
345
-        return null;
346
-    }
329
+	/**
330
+	 * @param array $attributes
331
+	 * @return \EE_Base_Class|EE_Ticket|null
332
+	 * @throws EE_Error
333
+	 * @throws InvalidDataTypeException
334
+	 * @throws InvalidInterfaceException
335
+	 * @throws InvalidArgumentException
336
+	 */
337
+	private function getTicket(array $attributes)
338
+	{
339
+		if (! empty($attributes['ticket_id'])) {
340
+			$ticket = EEM_Ticket::instance()->get_one_by_ID($attributes['ticket_id']);
341
+			if ($ticket instanceof EE_Ticket) {
342
+				return $ticket;
343
+			}
344
+		}
345
+		return null;
346
+	}
347 347
 
348 348
 
349
-    /**
350
-     * @param array $attributes
351
-     * @throws EE_Error
352
-     */
353
-    private function setAdditionalQueryParams(array $attributes)
354
-    {
355
-        $reg_status_array = EEM_Registration::reg_status_array();
356
-        if (isset($reg_status_array[ $attributes['status'] ])) {
357
-            $this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
358
-        }
359
-        if (absint($attributes['limit'])) {
360
-            $this->query_params['limit'] = $attributes['limit'];
361
-        }
362
-        $this->query_params['group_by'] = array('ATT_ID');
363
-        $this->query_params['order_by'] = (array) apply_filters(
364
-            'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
365
-            array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
366
-        );
367
-    }
349
+	/**
350
+	 * @param array $attributes
351
+	 * @throws EE_Error
352
+	 */
353
+	private function setAdditionalQueryParams(array $attributes)
354
+	{
355
+		$reg_status_array = EEM_Registration::reg_status_array();
356
+		if (isset($reg_status_array[ $attributes['status'] ])) {
357
+			$this->query_params[0]['Registration.STS_ID'] = $attributes['status'];
358
+		}
359
+		if (absint($attributes['limit'])) {
360
+			$this->query_params['limit'] = $attributes['limit'];
361
+		}
362
+		$this->query_params['group_by'] = array('ATT_ID');
363
+		$this->query_params['order_by'] = (array) apply_filters(
364
+			'FHEE__EES_Espresso_Event_Attendees__process_shortcode__order_by',
365
+			array('ATT_lname' => 'ASC', 'ATT_fname' => 'ASC')
366
+		);
367
+	}
368 368
 }
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.76.rc.022');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.76.rc.022');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.