@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * date_format and the second value is the time format |
51 | 51 | * @return EE_Event |
52 | 52 | */ |
53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * the website will be used. |
64 | 64 | * @return EE_Event |
65 | 65 | */ |
66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
67 | + return new self($props_n_values, TRUE, $timezone); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | * @param array $query_params like EEM_Base::get_all |
76 | 76 | * @return EE_Datetime[] |
77 | 77 | */ |
78 | - public function datetimes( $query_params = array() ) { |
|
79 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
78 | + public function datetimes($query_params = array()) { |
|
79 | + return $this->get_many_related('Datetime', $query_params); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return EE_Datetime[] |
88 | 88 | */ |
89 | 89 | public function datetimes_in_chronological_order() { |
90 | - return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
90 | + return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @param null $limit |
104 | 104 | * @return \EE_Datetime[] |
105 | 105 | */ |
106 | - public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) { |
|
107 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit ); |
|
106 | + public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) { |
|
107 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return EE_Datetime |
115 | 115 | */ |
116 | 116 | public function first_datetime() { |
117 | - return $this->get_first_related( 'Datetime' ); |
|
117 | + return $this->get_first_related('Datetime'); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | * @param bool $try_to_exclude_deleted |
126 | 126 | * @return EE_Datetime |
127 | 127 | */ |
128 | - public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) { |
|
129 | - if ( !empty ( $this->_Primary_Datetime ) ) { |
|
128 | + public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) { |
|
129 | + if ( ! empty ($this->_Primary_Datetime)) { |
|
130 | 130 | return $this->_Primary_Datetime; |
131 | 131 | } |
132 | - $this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted ); |
|
132 | + $this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted); |
|
133 | 133 | return $this->_Primary_Datetime; |
134 | 134 | } |
135 | 135 | |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | * @param array $query_params like EEM_Base::get_all |
141 | 141 | * @return EE_Ticket[] |
142 | 142 | */ |
143 | - public function tickets( $query_params = array() ) { |
|
143 | + public function tickets($query_params = array()) { |
|
144 | 144 | //first get all datetimes |
145 | 145 | $datetimes = $this->datetimes_ordered(); |
146 | - if ( ! $datetimes ) { |
|
146 | + if ( ! $datetimes) { |
|
147 | 147 | return array(); |
148 | 148 | } |
149 | 149 | |
150 | 150 | $datetime_ids = array(); |
151 | - foreach ( $datetimes as $datetime ) { |
|
151 | + foreach ($datetimes as $datetime) { |
|
152 | 152 | $datetime_ids[] = $datetime->ID(); |
153 | 153 | } |
154 | 154 | |
155 | - $where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) ); |
|
155 | + $where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids)); |
|
156 | 156 | |
157 | 157 | //if incoming $query_params has where conditions let's merge but not override existing. |
158 | - if ( is_array( $query_params ) && isset( $query_params[0]) ) { |
|
159 | - $where_params = array_merge( $query_params[0], $where_params ); |
|
160 | - unset( $query_params[0] ); |
|
158 | + if (is_array($query_params) && isset($query_params[0])) { |
|
159 | + $where_params = array_merge($query_params[0], $where_params); |
|
160 | + unset($query_params[0]); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //now add $where_params to $query_params |
164 | 164 | $query_params[0] = $where_params; |
165 | 165 | |
166 | - return EEM_Ticket::instance()->get_all( $query_params ); |
|
166 | + return EEM_Ticket::instance()->get_all($query_params); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @return bool |
173 | 173 | */ |
174 | 174 | function additional_limit() { |
175 | - return $this->get( 'EVT_additional_limit' ); |
|
175 | + return $this->get('EVT_additional_limit'); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return bool |
182 | 182 | */ |
183 | 183 | function allow_overflow() { |
184 | - return $this->get( 'EVT_allow_overflow' ); |
|
184 | + return $this->get('EVT_allow_overflow'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * @return bool |
191 | 191 | */ |
192 | 192 | function created() { |
193 | - return $this->get( 'EVT_created' ); |
|
193 | + return $this->get('EVT_created'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | * @return bool |
200 | 200 | */ |
201 | 201 | function description() { |
202 | - return $this->get( 'EVT_desc' ); |
|
202 | + return $this->get('EVT_desc'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string of html |
210 | 210 | */ |
211 | 211 | function description_filtered() { |
212 | - return $this->get_pretty( 'EVT_desc' ); |
|
212 | + return $this->get_pretty('EVT_desc'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @return bool |
219 | 219 | */ |
220 | 220 | function display_description() { |
221 | - return $this->get( 'EVT_display_desc' ); |
|
221 | + return $this->get('EVT_display_desc'); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return bool |
228 | 228 | */ |
229 | 229 | function display_ticket_selector() { |
230 | - return (bool)$this->get( 'EVT_display_ticket_selector' ); |
|
230 | + return (bool) $this->get('EVT_display_ticket_selector'); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * @return bool |
237 | 237 | */ |
238 | 238 | function external_url() { |
239 | - return $this->get( 'EVT_external_URL' ); |
|
239 | + return $this->get('EVT_external_URL'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * @return bool |
246 | 246 | */ |
247 | 247 | function member_only() { |
248 | - return $this->get( 'EVT_member_only' ); |
|
248 | + return $this->get('EVT_member_only'); |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * @return bool |
255 | 255 | */ |
256 | 256 | function phone() { |
257 | - return $this->get( 'EVT_phone' ); |
|
257 | + return $this->get('EVT_phone'); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return bool |
264 | 264 | */ |
265 | 265 | function modified() { |
266 | - return $this->get( 'EVT_modified' ); |
|
266 | + return $this->get('EVT_modified'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * @return bool |
273 | 273 | */ |
274 | 274 | function name() { |
275 | - return $this->get( 'EVT_name' ); |
|
275 | + return $this->get('EVT_name'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return bool |
282 | 282 | */ |
283 | 283 | function order() { |
284 | - return $this->get( 'EVT_order' ); |
|
284 | + return $this->get('EVT_order'); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | |
@@ -290,8 +290,8 @@ discard block |
||
290 | 290 | * @return bool|string |
291 | 291 | */ |
292 | 292 | function default_registration_status() { |
293 | - $event_default_registration_status = $this->get( 'EVT_default_registration_status' ); |
|
294 | - return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
293 | + $event_default_registration_status = $this->get('EVT_default_registration_status'); |
|
294 | + return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | * @param bool $not_full_desc |
303 | 303 | * @return bool|string |
304 | 304 | */ |
305 | - function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) { |
|
306 | - $short_desc = $this->get( 'EVT_short_desc' ); |
|
307 | - if ( !empty( $short_desc ) || $not_full_desc ) { |
|
305 | + function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) { |
|
306 | + $short_desc = $this->get('EVT_short_desc'); |
|
307 | + if ( ! empty($short_desc) || $not_full_desc) { |
|
308 | 308 | return $short_desc; |
309 | 309 | } |
310 | 310 | else { |
311 | - $full_desc = $this->get( 'EVT_desc' ); |
|
312 | - return wp_trim_words( $full_desc, $num_words, $more ); |
|
311 | + $full_desc = $this->get('EVT_desc'); |
|
312 | + return wp_trim_words($full_desc, $num_words, $more); |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return bool |
320 | 320 | */ |
321 | 321 | function slug() { |
322 | - return $this->get( 'EVT_slug' ); |
|
322 | + return $this->get('EVT_slug'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return bool |
329 | 329 | */ |
330 | 330 | function timezone_string() { |
331 | - return $this->get( 'EVT_timezone_string' ); |
|
331 | + return $this->get('EVT_timezone_string'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * @return bool |
338 | 338 | */ |
339 | 339 | function visible_on() { |
340 | - return $this->get( 'EVT_visible_on' ); |
|
340 | + return $this->get('EVT_visible_on'); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | * @return bool |
347 | 347 | */ |
348 | 348 | function wp_user() { |
349 | - return $this->get( 'EVT_wp_user' ); |
|
349 | + return $this->get('EVT_wp_user'); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * @return bool |
356 | 356 | */ |
357 | 357 | function donations() { |
358 | - return $this->get( 'EVT_donations' ); |
|
358 | + return $this->get('EVT_donations'); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | /** |
364 | 364 | * @param $limit |
365 | 365 | */ |
366 | - function set_additional_limit( $limit ) { |
|
367 | - $this->set( 'EVT_additional_limit', $limit ); |
|
366 | + function set_additional_limit($limit) { |
|
367 | + $this->set('EVT_additional_limit', $limit); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * @param $created |
374 | 374 | */ |
375 | - function set_created( $created ) { |
|
376 | - $this->set( 'EVT_created', $created ); |
|
375 | + function set_created($created) { |
|
376 | + $this->set('EVT_created', $created); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param $desc |
383 | 383 | */ |
384 | - function set_description( $desc ) { |
|
385 | - $this->set( 'EVT_desc', $desc ); |
|
384 | + function set_description($desc) { |
|
385 | + $this->set('EVT_desc', $desc); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * @param $display_desc |
392 | 392 | */ |
393 | - function set_display_description( $display_desc ) { |
|
394 | - $this->set( 'EVT_display_desc', $display_desc ); |
|
393 | + function set_display_description($display_desc) { |
|
394 | + $this->set('EVT_display_desc', $display_desc); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | /** |
400 | 400 | * @param $display_ticket_selector |
401 | 401 | */ |
402 | - function set_display_ticket_selector( $display_ticket_selector ) { |
|
403 | - $this->set( 'EVT_display_ticket_selector', $display_ticket_selector ); |
|
402 | + function set_display_ticket_selector($display_ticket_selector) { |
|
403 | + $this->set('EVT_display_ticket_selector', $display_ticket_selector); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | /** |
409 | 409 | * @param $external_url |
410 | 410 | */ |
411 | - function set_external_url( $external_url ) { |
|
412 | - $this->set( 'EVT_external_URL', $external_url ); |
|
411 | + function set_external_url($external_url) { |
|
412 | + $this->set('EVT_external_URL', $external_url); |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | /** |
418 | 418 | * @param $member_only |
419 | 419 | */ |
420 | - function set_member_only( $member_only ) { |
|
421 | - $this->set( 'EVT_member_only', $member_only ); |
|
420 | + function set_member_only($member_only) { |
|
421 | + $this->set('EVT_member_only', $member_only); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | /** |
427 | 427 | * @param $event_phone |
428 | 428 | */ |
429 | - function set_event_phone( $event_phone ) { |
|
430 | - $this->set( 'EVT_phone', $event_phone ); |
|
429 | + function set_event_phone($event_phone) { |
|
430 | + $this->set('EVT_phone', $event_phone); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -435,8 +435,8 @@ discard block |
||
435 | 435 | /** |
436 | 436 | * @param $modified |
437 | 437 | */ |
438 | - function set_modified( $modified ) { |
|
439 | - $this->set( 'EVT_modified', $modified ); |
|
438 | + function set_modified($modified) { |
|
439 | + $this->set('EVT_modified', $modified); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | |
@@ -444,8 +444,8 @@ discard block |
||
444 | 444 | /** |
445 | 445 | * @param $name |
446 | 446 | */ |
447 | - function set_name( $name ) { |
|
448 | - $this->set( 'EVT_name', $name ); |
|
447 | + function set_name($name) { |
|
448 | + $this->set('EVT_name', $name); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | /** |
454 | 454 | * @param $order |
455 | 455 | */ |
456 | - function set_order( $order ) { |
|
457 | - $this->set( 'EVT_order', $order ); |
|
456 | + function set_order($order) { |
|
457 | + $this->set('EVT_order', $order); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | /** |
463 | 463 | * @param $short_desc |
464 | 464 | */ |
465 | - function set_short_description( $short_desc ) { |
|
466 | - $this->set( 'EVT_short_desc', $short_desc ); |
|
465 | + function set_short_description($short_desc) { |
|
466 | + $this->set('EVT_short_desc', $short_desc); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -471,8 +471,8 @@ discard block |
||
471 | 471 | /** |
472 | 472 | * @param $slug |
473 | 473 | */ |
474 | - function set_slug( $slug ) { |
|
475 | - $this->set( 'EVT_slug', $slug ); |
|
474 | + function set_slug($slug) { |
|
475 | + $this->set('EVT_slug', $slug); |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | /** |
481 | 481 | * @param $timezone_string |
482 | 482 | */ |
483 | - function set_timezone_string( $timezone_string ) { |
|
484 | - $this->set( 'EVT_timezone_string', $timezone_string ); |
|
483 | + function set_timezone_string($timezone_string) { |
|
484 | + $this->set('EVT_timezone_string', $timezone_string); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | |
@@ -489,8 +489,8 @@ discard block |
||
489 | 489 | /** |
490 | 490 | * @param $visible_on |
491 | 491 | */ |
492 | - function set_visible_on( $visible_on ) { |
|
493 | - $this->set( 'EVT_visible_on', $visible_on ); |
|
492 | + function set_visible_on($visible_on) { |
|
493 | + $this->set('EVT_visible_on', $visible_on); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
@@ -498,8 +498,8 @@ discard block |
||
498 | 498 | /** |
499 | 499 | * @param $wp_user |
500 | 500 | */ |
501 | - function set_wp_user( $wp_user ) { |
|
502 | - $this->set( 'EVT_wp_user', $wp_user ); |
|
501 | + function set_wp_user($wp_user) { |
|
502 | + $this->set('EVT_wp_user', $wp_user); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | |
@@ -507,8 +507,8 @@ discard block |
||
507 | 507 | /** |
508 | 508 | * @param $default_registration_status |
509 | 509 | */ |
510 | - function set_default_registration_status( $default_registration_status ) { |
|
511 | - $this->set( 'EVT_default_registration_status', $default_registration_status ); |
|
510 | + function set_default_registration_status($default_registration_status) { |
|
511 | + $this->set('EVT_default_registration_status', $default_registration_status); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | /** |
517 | 517 | * @param $donations |
518 | 518 | */ |
519 | - function set_donations( $donations ) { |
|
520 | - $this->set( 'EVT_donations', $donations ); |
|
519 | + function set_donations($donations) { |
|
520 | + $this->set('EVT_donations', $donations); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | * @param EE_Venue /int $venue_id_or_obj |
528 | 528 | * @return EE_Venue |
529 | 529 | */ |
530 | - function add_venue( $venue_id_or_obj ) { |
|
531 | - return $this->_add_relation_to( $venue_id_or_obj, 'Venue' ); |
|
530 | + function add_venue($venue_id_or_obj) { |
|
531 | + return $this->_add_relation_to($venue_id_or_obj, 'Venue'); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | * @param EE_Venue /int $venue_id_or_obj |
539 | 539 | * @return EE_Venue |
540 | 540 | */ |
541 | - function remove_venue( $venue_id_or_obj ) { |
|
542 | - return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' ); |
|
541 | + function remove_venue($venue_id_or_obj) { |
|
542 | + return $this->_remove_relation_to($venue_id_or_obj, 'Venue'); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -549,8 +549,8 @@ discard block |
||
549 | 549 | * @param array $query_params like EEM_Base::get_all's $query_params |
550 | 550 | * @return EE_Venue[] |
551 | 551 | */ |
552 | - function venues( $query_params = array() ) { |
|
553 | - return $this->get_many_related( 'Venue', $query_params ); |
|
552 | + function venues($query_params = array()) { |
|
553 | + return $this->get_many_related('Venue', $query_params); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | private function _has_ID_and_is_published() { |
564 | 564 | // first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses) |
565 | - return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE; |
|
565 | + return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | |
@@ -574,21 +574,21 @@ discard block |
||
574 | 574 | */ |
575 | 575 | public function is_upcoming() { |
576 | 576 | // check if event id is present and if this event is published |
577 | - if ( $this->is_inactive() ) { |
|
577 | + if ($this->is_inactive()) { |
|
578 | 578 | return FALSE; |
579 | 579 | } |
580 | 580 | // set initial value |
581 | 581 | $upcoming = FALSE; |
582 | 582 | //next let's get all datetimes and loop through them |
583 | 583 | $datetimes = $this->datetimes_in_chronological_order(); |
584 | - foreach ( $datetimes as $datetime ) { |
|
585 | - if ( $datetime instanceof EE_Datetime ) { |
|
584 | + foreach ($datetimes as $datetime) { |
|
585 | + if ($datetime instanceof EE_Datetime) { |
|
586 | 586 | //if this dtt is expired then we continue cause one of the other datetimes might be upcoming. |
587 | - if ( $datetime->is_expired() ) { |
|
587 | + if ($datetime->is_expired()) { |
|
588 | 588 | continue; |
589 | 589 | } |
590 | 590 | //if this dtt is active then we return false. |
591 | - if ( $datetime->is_active() ) { |
|
591 | + if ($datetime->is_active()) { |
|
592 | 592 | return FALSE; |
593 | 593 | } |
594 | 594 | //otherwise let's check upcoming status |
@@ -605,21 +605,21 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function is_active() { |
607 | 607 | // check if event id is present and if this event is published |
608 | - if ( $this->is_inactive() ) { |
|
608 | + if ($this->is_inactive()) { |
|
609 | 609 | return FALSE; |
610 | 610 | } |
611 | 611 | // set initial value |
612 | 612 | $active = FALSE; |
613 | 613 | //next let's get all datetimes and loop through them |
614 | 614 | $datetimes = $this->datetimes_in_chronological_order(); |
615 | - foreach ( $datetimes as $datetime ) { |
|
616 | - if ( $datetime instanceof EE_Datetime ) { |
|
615 | + foreach ($datetimes as $datetime) { |
|
616 | + if ($datetime instanceof EE_Datetime) { |
|
617 | 617 | //if this dtt is expired then we continue cause one of the other datetimes might be active. |
618 | - if ( $datetime->is_expired() ) { |
|
618 | + if ($datetime->is_expired()) { |
|
619 | 619 | continue; |
620 | 620 | } |
621 | 621 | //if this dtt is upcoming then we return false. |
622 | - if ( $datetime->is_upcoming() ) { |
|
622 | + if ($datetime->is_upcoming()) { |
|
623 | 623 | return FALSE; |
624 | 624 | } |
625 | 625 | //otherwise let's check active status |
@@ -636,17 +636,17 @@ discard block |
||
636 | 636 | */ |
637 | 637 | public function is_expired() { |
638 | 638 | // check if event id is present and if this event is published |
639 | - if ( $this->is_inactive() ) { |
|
639 | + if ($this->is_inactive()) { |
|
640 | 640 | return FALSE; |
641 | 641 | } |
642 | 642 | // set initial value |
643 | 643 | $expired = FALSE; |
644 | 644 | //first let's get all datetimes and loop through them |
645 | 645 | $datetimes = $this->datetimes_in_chronological_order(); |
646 | - foreach ( $datetimes as $datetime ) { |
|
647 | - if ( $datetime instanceof EE_Datetime ) { |
|
646 | + foreach ($datetimes as $datetime) { |
|
647 | + if ($datetime instanceof EE_Datetime) { |
|
648 | 648 | //if this dtt is upcoming or active then we return false. |
649 | - if ( $datetime->is_upcoming() || $datetime->is_active() ) { |
|
649 | + if ($datetime->is_upcoming() || $datetime->is_active()) { |
|
650 | 650 | return FALSE; |
651 | 651 | } |
652 | 652 | //otherwise let's check active status |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | */ |
664 | 664 | public function is_inactive() { |
665 | 665 | // check if event id is present and if this event is published |
666 | - if ( $this->_has_ID_and_is_published() ) { |
|
666 | + if ($this->_has_ID_and_is_published()) { |
|
667 | 667 | return FALSE; |
668 | 668 | } |
669 | 669 | return TRUE; |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | */ |
682 | 682 | public function perform_sold_out_status_check() { |
683 | 683 | // get all unexpired untrashed tickets |
684 | - $tickets = $this->tickets( array( |
|
684 | + $tickets = $this->tickets(array( |
|
685 | 685 | array( |
686 | - 'TKT_end_date' => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ), |
|
686 | + 'TKT_end_date' => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')), |
|
687 | 687 | 'TKT_deleted' => false |
688 | 688 | ) |
689 | 689 | )); |
690 | 690 | // if all the tickets are just expired, then don't update the event status to sold out |
691 | - if ( empty( $tickets )) { |
|
691 | + if (empty($tickets)) { |
|
692 | 692 | return true; |
693 | 693 | } |
694 | 694 | // set initial value |
695 | 695 | $spaces_remaining = 0; |
696 | - foreach( $tickets as $ticket ) { |
|
697 | - if ( $ticket instanceof EE_Ticket ) { |
|
698 | - $spaces_remaining += $ticket->qty( 'saleable' ); |
|
696 | + foreach ($tickets as $ticket) { |
|
697 | + if ($ticket instanceof EE_Ticket) { |
|
698 | + $spaces_remaining += $ticket->qty('saleable'); |
|
699 | 699 | } |
700 | 700 | } |
701 | - if ( $spaces_remaining === 0 ) { |
|
702 | - $this->set_status( EEM_Event::sold_out ); |
|
703 | - if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) { |
|
701 | + if ($spaces_remaining === 0) { |
|
702 | + $this->set_status(EEM_Event::sold_out); |
|
703 | + if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) { |
|
704 | 704 | $this->save(); |
705 | 705 | } |
706 | 706 | $sold_out = TRUE; |
@@ -728,15 +728,15 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function spaces_remaining_for_sale() { |
730 | 730 | //first get total available spaces including consideration for tickets that have already sold. |
731 | - $spaces_available = $this->total_available_spaces( true ); |
|
731 | + $spaces_available = $this->total_available_spaces(true); |
|
732 | 732 | |
733 | 733 | //if total available = 0, then exit right away because that means everything is expired. |
734 | - if ( $spaces_available === 0 ) { |
|
734 | + if ($spaces_available === 0) { |
|
735 | 735 | return 0; |
736 | 736 | } |
737 | 737 | |
738 | 738 | //subtract total approved registrations from spaces available to get how many are remaining. |
739 | - $spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
739 | + $spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
740 | 740 | $spaces_remaining = $spaces_available - $spots_taken; |
741 | 741 | |
742 | 742 | return $spaces_remaining > 0 ? $spaces_remaining : 0; |
@@ -769,29 +769,29 @@ discard block |
||
769 | 769 | * |
770 | 770 | * @return int|float (Note: if EE_INF is returned its considered a float by PHP) |
771 | 771 | */ |
772 | - public function total_available_spaces( $current_total_available = false ) { |
|
772 | + public function total_available_spaces($current_total_available = false) { |
|
773 | 773 | $spaces_available = 0; |
774 | 774 | |
775 | 775 | //first get all tickets on the event and include expired tickets |
776 | - $tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) ); |
|
776 | + $tickets = $this->tickets(array('default_where_conditions' => 'none')); |
|
777 | 777 | $ticket_sums = array(); |
778 | 778 | $datetime_limits = array(); |
779 | 779 | |
780 | 780 | //loop through tickets and normalize them |
781 | - foreach ( $tickets as $ticket ) { |
|
782 | - $datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
781 | + foreach ($tickets as $ticket) { |
|
782 | + $datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
783 | 783 | |
784 | - if ( empty( $datetimes ) ) { |
|
784 | + if (empty($datetimes)) { |
|
785 | 785 | continue; |
786 | 786 | } |
787 | 787 | |
788 | 788 | //first datetime should be the lowest datetime |
789 | - $least_datetime = reset( $datetimes ); |
|
789 | + $least_datetime = reset($datetimes); |
|
790 | 790 | |
791 | 791 | //lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity |
792 | 792 | //IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit. |
793 | - if ( $current_total_available ) { |
|
794 | - if ( $ticket->is_remaining() ) { |
|
793 | + if ($current_total_available) { |
|
794 | + if ($ticket->is_remaining()) { |
|
795 | 795 | $remaining = $ticket->remaining(); |
796 | 796 | } else { |
797 | 797 | $spaces_available += $ticket->sold(); |
@@ -799,23 +799,23 @@ discard block |
||
799 | 799 | continue; |
800 | 800 | } |
801 | 801 | } else { |
802 | - $remaining = min( $ticket->qty(), $least_datetime->reg_limit() ); |
|
802 | + $remaining = min($ticket->qty(), $least_datetime->reg_limit()); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | //if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts. |
806 | - if ( $remaining == EE_INF ) { |
|
806 | + if ($remaining == EE_INF) { |
|
807 | 807 | return EE_INF; |
808 | 808 | } |
809 | 809 | |
810 | 810 | //multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum" |
811 | 811 | //also include the sum of all the datetime reg limits on the ticket for breaking ties. |
812 | - $ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes ); |
|
812 | + $ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes); |
|
813 | 813 | $ticket_sums[$ticket->ID()]['datetime_sums'] = 0; |
814 | - foreach ( $datetimes as $datetime ) { |
|
815 | - if ( $datetime->reg_limit() === EE_INF ) { |
|
814 | + foreach ($datetimes as $datetime) { |
|
815 | + if ($datetime->reg_limit() === EE_INF) { |
|
816 | 816 | $ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF; |
817 | 817 | } else { |
818 | - $ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
818 | + $ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
|
819 | 819 | } |
820 | 820 | $datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit(); |
821 | 821 | } |
@@ -826,74 +826,74 @@ discard block |
||
826 | 826 | //ticket quantity by the number of datetimes on the ticket). For tie-breakers, then the next sort is based on the |
827 | 827 | //ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not |
828 | 828 | //$current_total_available ) for the datetimes on the ticket. |
829 | - usort( $ticket_sums, function( $a, $b ) { |
|
830 | - if ( $a['sum'] == $b['sum'] ) { |
|
831 | - if ( $a['datetime_sums'] == $b['datetime_sums'] ) { |
|
829 | + usort($ticket_sums, function($a, $b) { |
|
830 | + if ($a['sum'] == $b['sum']) { |
|
831 | + if ($a['datetime_sums'] == $b['datetime_sums']) { |
|
832 | 832 | return 0; |
833 | 833 | } |
834 | 834 | |
835 | 835 | return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1; |
836 | 836 | } |
837 | - return ( $a['sum'] < $b['sum'] ) ? -1 : 1; |
|
837 | + return ($a['sum'] < $b['sum']) ? -1 : 1; |
|
838 | 838 | }); |
839 | 839 | |
840 | 840 | //now let's loop through the sorted tickets and simulate sellouts |
841 | - foreach ( $ticket_sums as $ticket_info ) { |
|
842 | - if ( $ticket_info['ticket'] instanceof EE_Ticket ) { |
|
841 | + foreach ($ticket_sums as $ticket_info) { |
|
842 | + if ($ticket_info['ticket'] instanceof EE_Ticket) { |
|
843 | 843 | |
844 | - $datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) ); |
|
844 | + $datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC'))); |
|
845 | 845 | //need to sort these $datetimes by remaining (only if $current_total_available) |
846 | 846 | //setup datetimes for simulation |
847 | 847 | $ticket_datetimes_remaining = array(); |
848 | - foreach( $datetimes as $datetime ) { |
|
848 | + foreach ($datetimes as $datetime) { |
|
849 | 849 | $ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()]; |
850 | 850 | $ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime; |
851 | 851 | } |
852 | - usort( $ticket_datetimes_remaining, function( $a, $b ) { |
|
853 | - if ( $a['rem'] == $b['rem'] ) { |
|
852 | + usort($ticket_datetimes_remaining, function($a, $b) { |
|
853 | + if ($a['rem'] == $b['rem']) { |
|
854 | 854 | return 0; |
855 | 855 | } |
856 | - return ( $a['rem'] < $b['rem'] ) ? -1 : 1; |
|
856 | + return ($a['rem'] < $b['rem']) ? -1 : 1; |
|
857 | 857 | }); |
858 | 858 | |
859 | 859 | |
860 | 860 | //get the remaining on the first datetime (which should be the one with the least remaining) and that is |
861 | 861 | //what we add to the spaces_available running total. Then we need to decrease the remaining on our datetime tracker. |
862 | - $lowest_datetime = reset( $ticket_datetimes_remaining ); |
|
862 | + $lowest_datetime = reset($ticket_datetimes_remaining); |
|
863 | 863 | |
864 | 864 | //need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket. |
865 | 865 | // If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already |
866 | 866 | // been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue |
867 | 867 | // to the next ticket. |
868 | - if ( $current_total_available ) { |
|
869 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() ); |
|
868 | + if ($current_total_available) { |
|
869 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining()); |
|
870 | 870 | } else { |
871 | - $remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() ); |
|
871 | + $remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty()); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | //if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all |
875 | 875 | //tickets have a quantity. So we don't have to track datetimes, we can just use ticket quantities for total |
876 | 876 | //available. |
877 | - if ( $remaining === EE_INF ) { |
|
877 | + if ($remaining === EE_INF) { |
|
878 | 878 | $spaces_available += $ticket_info['ticket']->qty(); |
879 | 879 | continue; |
880 | 880 | } |
881 | 881 | |
882 | 882 | //if ticket has sold amounts then we also need to add that (but only if doing live counts) |
883 | - if ( $current_total_available ) { |
|
883 | + if ($current_total_available) { |
|
884 | 884 | $spaces_available += $ticket_info['ticket']->sold(); |
885 | 885 | } |
886 | 886 | |
887 | - if ( $remaining <= 0 ) { |
|
887 | + if ($remaining <= 0) { |
|
888 | 888 | continue; |
889 | 889 | } else { |
890 | 890 | $spaces_available += $remaining; |
891 | 891 | } |
892 | 892 | |
893 | 893 | //loop through the datetimes and sell them out! |
894 | - foreach ( $ticket_datetimes_remaining as $datetime_info ) { |
|
895 | - if ( $datetime_info['datetime'] instanceof EE_Datetime ) { |
|
896 | - $datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining; |
|
894 | + foreach ($ticket_datetimes_remaining as $datetime_info) { |
|
895 | + if ($datetime_info['datetime'] instanceof EE_Datetime) { |
|
896 | + $datetime_limits[$datetime_info['datetime']->ID()] += - $remaining; |
|
897 | 897 | } |
898 | 898 | } |
899 | 899 | } |
@@ -909,8 +909,8 @@ discard block |
||
909 | 909 | * @param bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event |
910 | 910 | * @return boolean |
911 | 911 | */ |
912 | - public function is_sold_out( $actual = FALSE ) { |
|
913 | - if ( ! $actual ) { |
|
912 | + public function is_sold_out($actual = FALSE) { |
|
913 | + if ( ! $actual) { |
|
914 | 914 | return $this->status() == EEM_Event::sold_out; |
915 | 915 | } |
916 | 916 | else { |
@@ -955,30 +955,30 @@ discard block |
||
955 | 955 | * |
956 | 956 | * @return bool | string - based on EE_Datetime active constants or FALSE if error. |
957 | 957 | */ |
958 | - public function get_active_status( $reset = false ) { |
|
958 | + public function get_active_status($reset = false) { |
|
959 | 959 | // if the active status has already been set, then just use that value (unless we are resetting it) |
960 | - if ( ! empty( $this->_active_status ) && ! $reset ) { |
|
960 | + if ( ! empty($this->_active_status) && ! $reset) { |
|
961 | 961 | return $this->_active_status; |
962 | 962 | } |
963 | 963 | //first check if event id is present on this object |
964 | - if ( ! $this->ID() ) { |
|
964 | + if ( ! $this->ID()) { |
|
965 | 965 | return false; |
966 | 966 | } |
967 | 967 | |
968 | - $where_params_for_event = array( array( 'EVT_ID' => $this->ID() ) ); |
|
968 | + $where_params_for_event = array(array('EVT_ID' => $this->ID())); |
|
969 | 969 | |
970 | 970 | //if event is published: |
971 | - if ( $this->status() === 'publish' ) { |
|
971 | + if ($this->status() === 'publish') { |
|
972 | 972 | //active? |
973 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) { |
|
973 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) { |
|
974 | 974 | $this->_active_status = EE_Datetime::active; |
975 | 975 | } else { |
976 | 976 | //upcoming? |
977 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event ) > 0 ) { |
|
977 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) { |
|
978 | 978 | $this->_active_status = EE_Datetime::upcoming; |
979 | 979 | } else { |
980 | 980 | //expired? |
981 | - if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event ) > 0 ) { |
|
981 | + if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) { |
|
982 | 982 | $this->_active_status = EE_Datetime::expired; |
983 | 983 | } else { |
984 | 984 | //it would be odd if things make it this far because it basically means there are no datetime's |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | } |
990 | 990 | } else { |
991 | 991 | //the event is not published, so let's just set it's active status according to its' post status |
992 | - switch ( $this->status() ) { |
|
992 | + switch ($this->status()) { |
|
993 | 993 | case EEM_Event::sold_out : |
994 | 994 | $this->_active_status = EE_Datetime::sold_out; |
995 | 995 | break; |
@@ -1015,10 +1015,10 @@ discard block |
||
1015 | 1015 | * @param boolean $echo whether to return (FALSE), or echo out the result (TRUE) |
1016 | 1016 | * @return mixed void|string |
1017 | 1017 | */ |
1018 | - public function pretty_active_status( $echo = TRUE ) { |
|
1018 | + public function pretty_active_status($echo = TRUE) { |
|
1019 | 1019 | $active_status = $this->get_active_status(); |
1020 | - $status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>'; |
|
1021 | - if ( $echo ) { |
|
1020 | + $status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>'; |
|
1021 | + if ($echo) { |
|
1022 | 1022 | echo $status; |
1023 | 1023 | return ''; |
1024 | 1024 | } |
@@ -1032,12 +1032,12 @@ discard block |
||
1032 | 1032 | */ |
1033 | 1033 | public function get_number_of_tickets_sold() { |
1034 | 1034 | $tkt_sold = 0; |
1035 | - if ( !$this->ID() ) { |
|
1035 | + if ( ! $this->ID()) { |
|
1036 | 1036 | return 0; |
1037 | 1037 | } |
1038 | 1038 | $datetimes = $this->datetimes(); |
1039 | - foreach ( $datetimes as $datetime ) { |
|
1040 | - if ( $datetime instanceof EE_Datetime ) { |
|
1039 | + foreach ($datetimes as $datetime) { |
|
1040 | + if ($datetime instanceof EE_Datetime) { |
|
1041 | 1041 | $tkt_sold += $datetime->sold(); |
1042 | 1042 | } |
1043 | 1043 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | * @return int |
1053 | 1053 | */ |
1054 | 1054 | public function get_count_of_all_registrations() { |
1055 | - return EEM_Event::instance()->count_related( $this, 'Registration' ); |
|
1055 | + return EEM_Event::instance()->count_related($this, 'Registration'); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | |
@@ -1062,9 +1062,9 @@ discard block |
||
1062 | 1062 | * @return EE_Ticket |
1063 | 1063 | */ |
1064 | 1064 | public function get_ticket_with_earliest_start_time() { |
1065 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1066 | - $query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) ); |
|
1067 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1065 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1066 | + $query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC')); |
|
1067 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | |
@@ -1074,9 +1074,9 @@ discard block |
||
1074 | 1074 | * @return EE_Ticket |
1075 | 1075 | */ |
1076 | 1076 | public function get_ticket_with_latest_end_time() { |
1077 | - $where[ 'Datetime.EVT_ID' ] = $this->ID(); |
|
1078 | - $query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) ); |
|
1079 | - return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params ); |
|
1077 | + $where['Datetime.EVT_ID'] = $this->ID(); |
|
1078 | + $query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC')); |
|
1079 | + return EE_Registry::instance()->load_model('Ticket')->get_one($query_params); |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | |
@@ -1088,11 +1088,11 @@ discard block |
||
1088 | 1088 | public function tickets_on_sale() { |
1089 | 1089 | $earliest_ticket = $this->get_ticket_with_earliest_start_time(); |
1090 | 1090 | $latest_ticket = $this->get_ticket_with_latest_end_time(); |
1091 | - if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) { |
|
1091 | + if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) { |
|
1092 | 1092 | return FALSE; |
1093 | 1093 | } |
1094 | 1094 | //check on sale for these two tickets. |
1095 | - if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) { |
|
1095 | + if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) { |
|
1096 | 1096 | return TRUE; |
1097 | 1097 | } |
1098 | 1098 | return FALSE; |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | * @return string |
1107 | 1107 | */ |
1108 | 1108 | public function get_permalink() { |
1109 | - if ( $this->external_url() ) { |
|
1109 | + if ($this->external_url()) { |
|
1110 | 1110 | return $this->external_url(); |
1111 | 1111 | } |
1112 | 1112 | else { |
@@ -1121,10 +1121,10 @@ discard block |
||
1121 | 1121 | * @param array $query_params like EEM_Base::get_all |
1122 | 1122 | * @return EE_Term |
1123 | 1123 | */ |
1124 | - public function first_event_category( $query_params = array() ) { |
|
1125 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1126 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1127 | - return EEM_Term::instance()->get_one( $query_params ); |
|
1124 | + public function first_event_category($query_params = array()) { |
|
1125 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1126 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1127 | + return EEM_Term::instance()->get_one($query_params); |
|
1128 | 1128 | } |
1129 | 1129 | |
1130 | 1130 | |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | * @param array $query_params |
1135 | 1135 | * @return EE_Term[] |
1136 | 1136 | */ |
1137 | - public function get_all_event_categories( $query_params = array() ) { |
|
1138 | - $query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories'; |
|
1139 | - $query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID(); |
|
1140 | - return EEM_Term::instance()->get_all( $query_params ); |
|
1137 | + public function get_all_event_categories($query_params = array()) { |
|
1138 | + $query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
|
1139 | + $query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID(); |
|
1140 | + return EEM_Term::instance()->get_all($query_params); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | /** |
@@ -1145,8 +1145,8 @@ discard block |
||
1145 | 1145 | * @param array $query_params @see EEM_Base::get_all |
1146 | 1146 | * @return EE_Question_Group[] |
1147 | 1147 | */ |
1148 | - public function question_groups($query_params = array()){ |
|
1149 | - $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' )); |
|
1148 | + public function question_groups($query_params = array()) { |
|
1149 | + $query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC')); |
|
1150 | 1150 | return $this->get_many_related('Question_Group', $query_params); |
1151 | 1151 | } |
1152 | 1152 | |
@@ -1186,12 +1186,12 @@ discard block |
||
1186 | 1186 | */ |
1187 | 1187 | public function get_admin_edit_link() { |
1188 | 1188 | EE_Registry::instance()->load_helper('URL'); |
1189 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1189 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1190 | 1190 | 'page' => 'espresso_events', |
1191 | 1191 | 'action' => 'edit', |
1192 | 1192 | 'post' => $this->ID() |
1193 | 1193 | ), |
1194 | - admin_url( 'admin.php' ) |
|
1194 | + admin_url('admin.php') |
|
1195 | 1195 | ); |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1204,11 +1204,11 @@ discard block |
||
1204 | 1204 | */ |
1205 | 1205 | public function get_admin_settings_link() { |
1206 | 1206 | EE_Registry::instance()->load_helper('URL'); |
1207 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1207 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1208 | 1208 | 'page' => 'espresso_events', |
1209 | 1209 | 'action' => 'default_event_settings' |
1210 | 1210 | ), |
1211 | - admin_url( 'admin.php' ) |
|
1211 | + admin_url('admin.php') |
|
1212 | 1212 | ); |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1224,11 +1224,11 @@ discard block |
||
1224 | 1224 | public function get_admin_overview_link() { |
1225 | 1225 | |
1226 | 1226 | EE_Registry::instance()->load_helper('URL'); |
1227 | - return EEH_URL::add_query_args_and_nonce( array( |
|
1227 | + return EEH_URL::add_query_args_and_nonce(array( |
|
1228 | 1228 | 'page' => 'espresso_events', |
1229 | 1229 | 'action' => 'default' |
1230 | 1230 | ), |
1231 | - admin_url( 'admin.php' ) |
|
1231 | + admin_url('admin.php') |
|
1232 | 1232 | ); |
1233 | 1233 | } |
1234 | 1234 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * EE_Registration class |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | * date_format and the second value is the time format |
42 | 42 | * @return EE_Registration |
43 | 43 | */ |
44 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
46 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
44 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
46 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * the website will be used. |
55 | 55 | * @return EE_Registration |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - return new self( $props_n_values, TRUE, $timezone ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + return new self($props_n_values, TRUE, $timezone); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @access public |
67 | 67 | * @param int $EVT_ID Event ID |
68 | 68 | */ |
69 | - public function set_event( $EVT_ID = 0 ) { |
|
70 | - $this->set( 'EVT_ID', $EVT_ID ); |
|
69 | + public function set_event($EVT_ID = 0) { |
|
70 | + $this->set('EVT_ID', $EVT_ID); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -78,18 +78,18 @@ discard block |
||
78 | 78 | * @param mixed $field_value |
79 | 79 | * @param bool $use_default |
80 | 80 | */ |
81 | - public function set( $field_name, $field_value, $use_default = FALSE ) { |
|
82 | - switch( $field_name ) { |
|
81 | + public function set($field_name, $field_value, $use_default = FALSE) { |
|
82 | + switch ($field_name) { |
|
83 | 83 | case 'REG_code' : |
84 | - if ( ! empty( $field_value ) && $this->reg_code() == '' ) { |
|
85 | - $this->set_reg_code( $field_value, $use_default ); |
|
84 | + if ( ! empty($field_value) && $this->reg_code() == '') { |
|
85 | + $this->set_reg_code($field_value, $use_default); |
|
86 | 86 | } |
87 | 87 | break; |
88 | 88 | case 'STS_ID' : |
89 | - $this->set_status( $field_value, $use_default ); |
|
89 | + $this->set_status($field_value, $use_default); |
|
90 | 90 | break; |
91 | 91 | default : |
92 | - parent::set( $field_name, $field_value, $use_default ); |
|
92 | + parent::set($field_name, $field_value, $use_default); |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
@@ -106,30 +106,30 @@ discard block |
||
106 | 106 | * @param boolean $use_default |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) { |
|
109 | + public function set_status($new_STS_ID = NULL, $use_default = FALSE) { |
|
110 | 110 | // get current REG_Status |
111 | 111 | $old_STS_ID = $this->status_ID(); |
112 | 112 | // if status has changed |
113 | - if ( $old_STS_ID != $new_STS_ID ) { |
|
113 | + if ($old_STS_ID != $new_STS_ID) { |
|
114 | 114 | // TO approved |
115 | - if ( $new_STS_ID == EEM_Registration::status_id_approved ) { |
|
115 | + if ($new_STS_ID == EEM_Registration::status_id_approved) { |
|
116 | 116 | // reserve a space by incrementing ticket and datetime sold values |
117 | 117 | $this->_reserve_registration_space(); |
118 | - do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
118 | + do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID); |
|
119 | 119 | // OR FROM approved |
120 | - } else if ( $old_STS_ID == EEM_Registration::status_id_approved ) { |
|
120 | + } else if ($old_STS_ID == EEM_Registration::status_id_approved) { |
|
121 | 121 | // release a space by decrementing ticket and datetime sold values |
122 | 122 | $this->_release_registration_space(); |
123 | - do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID ); |
|
123 | + do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID); |
|
124 | 124 | } |
125 | 125 | // update status |
126 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
127 | - do_action( 'AHEE__EE_Registration__set_status__after_update', $this ); |
|
126 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
127 | + do_action('AHEE__EE_Registration__set_status__after_update', $this); |
|
128 | 128 | return TRUE; |
129 | - }else{ |
|
129 | + } else { |
|
130 | 130 | //even though the old value matches the new value, it's still good to |
131 | 131 | //allow the parent set method to have a say |
132 | - parent::set( 'STS_ID', $new_STS_ID, $use_default ); |
|
132 | + parent::set('STS_ID', $new_STS_ID, $use_default); |
|
133 | 133 | return TRUE; |
134 | 134 | } |
135 | 135 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @access public |
142 | 142 | */ |
143 | 143 | public function status_ID() { |
144 | - return $this->get( 'STS_ID' ); |
|
144 | + return $this->get('STS_ID'); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * @param boolean $include_archived whether to include archived tickets or not. |
167 | 167 | * @return EE_Ticket |
168 | 168 | */ |
169 | - public function ticket( $include_archived = TRUE ) { |
|
169 | + public function ticket($include_archived = TRUE) { |
|
170 | 170 | $query_params = array(); |
171 | - if ( $include_archived ) { |
|
172 | - $query_params[ 'default_where_conditions' ] = 'none'; |
|
171 | + if ($include_archived) { |
|
172 | + $query_params['default_where_conditions'] = 'none'; |
|
173 | 173 | } |
174 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
174 | + return $this->get_first_related('Ticket', $query_params); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @return EE_Event |
182 | 182 | */ |
183 | 183 | public function event() { |
184 | - return $this->get_first_related( 'Event' ); |
|
184 | + return $this->get_first_related('Event'); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function wp_user() { |
197 | 197 | $event = $this->event(); |
198 | - if ( $event instanceof EE_Event ) { |
|
198 | + if ($event instanceof EE_Event) { |
|
199 | 199 | return $event->wp_user(); |
200 | 200 | } |
201 | 201 | return 0; |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | * @access public |
222 | 222 | * @param int $ATT_ID Attendee ID |
223 | 223 | */ |
224 | - public function set_attendee_id( $ATT_ID = 0 ) { |
|
225 | - $this->set( 'ATT_ID', $ATT_ID ); |
|
224 | + public function set_attendee_id($ATT_ID = 0) { |
|
225 | + $this->set('ATT_ID', $ATT_ID); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | * @access public |
234 | 234 | * @param int $TXN_ID Transaction ID |
235 | 235 | */ |
236 | - public function set_transaction_id( $TXN_ID = 0 ) { |
|
237 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
236 | + public function set_transaction_id($TXN_ID = 0) { |
|
237 | + $this->set('TXN_ID', $TXN_ID); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | * @access public |
246 | 246 | * @param string $REG_session PHP Session ID |
247 | 247 | */ |
248 | - public function set_session( $REG_session = '' ) { |
|
249 | - $this->set( 'REG_session', $REG_session ); |
|
248 | + public function set_session($REG_session = '') { |
|
249 | + $this->set('REG_session', $REG_session); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | * @access public |
258 | 258 | * @param string $REG_url_link Registration URL Link |
259 | 259 | */ |
260 | - public function set_reg_url_link( $REG_url_link = '' ) { |
|
261 | - $this->set( 'REG_url_link', $REG_url_link ); |
|
260 | + public function set_reg_url_link($REG_url_link = '') { |
|
261 | + $this->set('REG_url_link', $REG_url_link); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | * @access public |
270 | 270 | * @param int $REG_count Primary Attendee |
271 | 271 | */ |
272 | - public function set_count( $REG_count = 1 ) { |
|
273 | - $this->set( 'REG_count', $REG_count ); |
|
272 | + public function set_count($REG_count = 1) { |
|
273 | + $this->set('REG_count', $REG_count); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * @access public |
282 | 282 | * @param boolean $REG_group_size Group Registration |
283 | 283 | */ |
284 | - public function set_group_size( $REG_group_size = FALSE ) { |
|
285 | - $this->set( 'REG_group_size', $REG_group_size ); |
|
284 | + public function set_group_size($REG_group_size = FALSE) { |
|
285 | + $this->set('REG_group_size', $REG_group_size); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | * @access public |
366 | 366 | * @param mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date |
367 | 367 | */ |
368 | - public function set_reg_date( $REG_date = FALSE ) { |
|
369 | - $this->set( 'REG_date', $REG_date ); |
|
368 | + public function set_reg_date($REG_date = FALSE) { |
|
369 | + $this->set('REG_date', $REG_date); |
|
370 | 370 | } |
371 | 371 | |
372 | 372 | |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | * @access public |
378 | 378 | * @param float $REG_final_price |
379 | 379 | */ |
380 | - public function set_final_price( $REG_final_price = 0.00 ) { |
|
381 | - $this->set( 'REG_final_price', $REG_final_price ); |
|
380 | + public function set_final_price($REG_final_price = 0.00) { |
|
381 | + $this->set('REG_final_price', $REG_final_price); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | * @access public |
390 | 390 | * @param float $REG_paid |
391 | 391 | */ |
392 | - public function set_paid( $REG_paid = 0.00 ) { |
|
393 | - $this->set( 'REG_paid', $REG_paid ); |
|
392 | + public function set_paid($REG_paid = 0.00) { |
|
393 | + $this->set('REG_paid', $REG_paid); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @access public |
402 | 402 | * @param boolean $REG_att_is_going Attendee Is Going |
403 | 403 | */ |
404 | - public function set_att_is_going( $REG_att_is_going = FALSE ) { |
|
405 | - $this->set( 'REG_att_is_going', $REG_att_is_going ); |
|
404 | + public function set_att_is_going($REG_att_is_going = FALSE) { |
|
405 | + $this->set('REG_att_is_going', $REG_att_is_going); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return EE_Attendee |
413 | 413 | */ |
414 | 414 | public function attendee() { |
415 | - return $this->get_first_related( 'Attendee' ); |
|
415 | + return $this->get_first_related('Attendee'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | * @access public |
423 | 423 | */ |
424 | 424 | public function event_ID() { |
425 | - return $this->get( 'EVT_ID' ); |
|
425 | + return $this->get('EVT_ID'); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | */ |
434 | 434 | public function event_name() { |
435 | 435 | $event = $this->event_obj(); |
436 | - if ( $event ) { |
|
436 | + if ($event) { |
|
437 | 437 | return $event->name(); |
438 | 438 | } else { |
439 | 439 | return NULL; |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @return EE_Event |
448 | 448 | */ |
449 | 449 | public function event_obj() { |
450 | - return $this->get_first_related( 'Event' ); |
|
450 | + return $this->get_first_related('Event'); |
|
451 | 451 | } |
452 | 452 | |
453 | 453 | |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | * @access public |
458 | 458 | */ |
459 | 459 | public function attendee_ID() { |
460 | - return $this->get( 'ATT_ID' ); |
|
460 | + return $this->get('ATT_ID'); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | * @access public |
468 | 468 | */ |
469 | 469 | public function session_ID() { |
470 | - return $this->get( 'REG_session' ); |
|
470 | + return $this->get('REG_session'); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
478 | 478 | * @return string |
479 | 479 | */ |
480 | - public function receipt_url( $messenger = 'html' ) { |
|
480 | + public function receipt_url($messenger = 'html') { |
|
481 | 481 | |
482 | 482 | /** |
483 | 483 | * The below will be deprecated one version after this. We check first if there is a custom receipt template already in use on old system. If there is then we just return the standard url for it. |
@@ -486,12 +486,12 @@ discard block |
||
486 | 486 | */ |
487 | 487 | EE_Registry::instance()->load_helper('Template'); |
488 | 488 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php'; |
489 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
489 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
490 | 490 | |
491 | - if ( $has_custom ) { |
|
492 | - return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) ); |
|
491 | + if ($has_custom) { |
|
492 | + return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch')); |
|
493 | 493 | } |
494 | - return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' ); |
|
494 | + return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt'); |
|
495 | 495 | } |
496 | 496 | |
497 | 497 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | * @param string $messenger 'pdf' or 'html'. Default 'html'. |
503 | 503 | * @return string |
504 | 504 | */ |
505 | - public function invoice_url( $messenger = 'html' ) { |
|
505 | + public function invoice_url($messenger = 'html') { |
|
506 | 506 | /** |
507 | 507 | * The below will be deprecated one version after this. We check first if there is a custom invoice template already in use on old system. If there is then we just return the standard url for it. |
508 | 508 | * |
@@ -510,21 +510,21 @@ discard block |
||
510 | 510 | */ |
511 | 511 | EE_Registry::instance()->load_helper('Template'); |
512 | 512 | $template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php'; |
513 | - $has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE ); |
|
513 | + $has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE); |
|
514 | 514 | |
515 | - if ( $has_custom ) { |
|
516 | - if ( $messenger == 'html' ) { |
|
517 | - return $this->invoice_url( 'launch' ); |
|
515 | + if ($has_custom) { |
|
516 | + if ($messenger == 'html') { |
|
517 | + return $this->invoice_url('launch'); |
|
518 | 518 | } |
519 | 519 | $route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice'; |
520 | 520 | |
521 | - $query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() ); |
|
522 | - if ( $messenger == 'html' ) { |
|
521 | + $query_args = array('ee' => $route, 'id' => $this->reg_url_link()); |
|
522 | + if ($messenger == 'html') { |
|
523 | 523 | $query_args['html'] = TRUE; |
524 | 524 | } |
525 | - return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) ); |
|
525 | + return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id)); |
|
526 | 526 | } |
527 | - return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' ); |
|
527 | + return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice'); |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -534,7 +534,7 @@ discard block |
||
534 | 534 | * @access public |
535 | 535 | */ |
536 | 536 | public function reg_url_link() { |
537 | - return $this->get( 'REG_url_link' ); |
|
537 | + return $this->get('REG_url_link'); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | * @param string $type 'download','launch', or 'html' (default is 'launch') |
545 | 545 | * @return void |
546 | 546 | */ |
547 | - public function e_invoice_url( $type = 'launch' ) { |
|
548 | - echo $this->invoice_url( $type ); |
|
547 | + public function e_invoice_url($type = 'launch') { |
|
548 | + echo $this->invoice_url($type); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * @return string |
566 | 566 | */ |
567 | 567 | public function payment_overview_url() { |
568 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
568 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | * @return string |
577 | 577 | */ |
578 | 578 | public function edit_attendee_information_url() { |
579 | - return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() ); |
|
579 | + return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url()); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -586,8 +586,8 @@ discard block |
||
586 | 586 | * @return string |
587 | 587 | */ |
588 | 588 | public function get_admin_edit_url() { |
589 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
590 | - return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) ); |
|
589 | + EE_Registry::instance()->load_helper('URL'); |
|
590 | + return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php')); |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | * @access public |
598 | 598 | */ |
599 | 599 | public function is_primary_registrant() { |
600 | - return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE; |
|
600 | + return $this->get('REG_count') == 1 ? TRUE : FALSE; |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -606,12 +606,12 @@ discard block |
||
606 | 606 | * This returns the primary registration object for this registration group (which may be this object). |
607 | 607 | * @return EE_Registration |
608 | 608 | */ |
609 | - public function get_primary_registration() { |
|
610 | - if ( $this->is_primary_registrant() ) |
|
609 | + public function get_primary_registration() { |
|
610 | + if ($this->is_primary_registrant()) |
|
611 | 611 | return $this; |
612 | 612 | |
613 | 613 | //k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1 |
614 | - $primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) ); |
|
614 | + $primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1))); |
|
615 | 615 | return $primary_registrant; |
616 | 616 | } |
617 | 617 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * @access public |
623 | 623 | */ |
624 | 624 | public function count() { |
625 | - return $this->get( 'REG_count' ); |
|
625 | + return $this->get('REG_count'); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @access public |
633 | 633 | */ |
634 | 634 | public function group_size() { |
635 | - return $this->get( 'REG_group_size' ); |
|
635 | + return $this->get('REG_group_size'); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @access public |
643 | 643 | */ |
644 | 644 | public function date() { |
645 | - return $this->get( 'REG_date' ); |
|
645 | + return $this->get('REG_date'); |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | |
@@ -653,8 +653,8 @@ discard block |
||
653 | 653 | * @param string $time_format |
654 | 654 | * @return string |
655 | 655 | */ |
656 | - public function pretty_date( $date_format = NULL, $time_format = NULL ) { |
|
657 | - return $this->get_datetime( 'REG_date', $date_format, $time_format ); |
|
656 | + public function pretty_date($date_format = NULL, $time_format = NULL) { |
|
657 | + return $this->get_datetime('REG_date', $date_format, $time_format); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | * @return float |
668 | 668 | */ |
669 | 669 | public function final_price() { |
670 | - return $this->get( 'REG_final_price' ); |
|
670 | + return $this->get('REG_final_price'); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @return string |
679 | 679 | */ |
680 | 680 | public function pretty_final_price() { |
681 | - return $this->get_pretty( 'REG_final_price' ); |
|
681 | + return $this->get_pretty('REG_final_price'); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * @return float |
690 | 690 | */ |
691 | 691 | public function paid() { |
692 | - return $this->get( 'REG_paid' ); |
|
692 | + return $this->get('REG_paid'); |
|
693 | 693 | } |
694 | 694 | |
695 | 695 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @return float |
701 | 701 | */ |
702 | 702 | public function pretty_paid() { |
703 | - return $this->get_pretty( 'REG_paid' ); |
|
703 | + return $this->get_pretty('REG_paid'); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | |
@@ -712,11 +712,11 @@ discard block |
||
712 | 712 | * @param array $requires_payment |
713 | 713 | * @return bool |
714 | 714 | */ |
715 | - public function owes_monies_and_can_pay( $requires_payment = array()) { |
|
715 | + public function owes_monies_and_can_pay($requires_payment = array()) { |
|
716 | 716 | // these reg statuses require payment (if event is not free) |
717 | - $requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
717 | + $requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment(); |
|
718 | 718 | if ( |
719 | - in_array( $this->status_ID(), $requires_payment ) && |
|
719 | + in_array($this->status_ID(), $requires_payment) && |
|
720 | 720 | $this->final_price() != 0 && |
721 | 721 | $this->final_price() != $this->paid() |
722 | 722 | ) { |
@@ -733,8 +733,8 @@ discard block |
||
733 | 733 | * @param bool $show_icons |
734 | 734 | * @return void |
735 | 735 | */ |
736 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
737 | - echo $this->pretty_status( $show_icons ); |
|
736 | + public function e_pretty_status($show_icons = FALSE) { |
|
737 | + echo $this->pretty_status($show_icons); |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | * @param bool $show_icons |
746 | 746 | * @return string |
747 | 747 | */ |
748 | - public function pretty_status( $show_icons = FALSE ) { |
|
749 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
748 | + public function pretty_status($show_icons = FALSE) { |
|
749 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
750 | 750 | $icon = ''; |
751 | - switch ( $this->status_ID() ) { |
|
751 | + switch ($this->status_ID()) { |
|
752 | 752 | case EEM_Registration::status_id_approved: |
753 | 753 | $icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : ''; |
754 | 754 | break; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | $icon = $show_icons ? '<span class="dashicons dashicons-no ee-icon-size-16 red-text"></span>' : ''; |
769 | 769 | break; |
770 | 770 | } |
771 | - return $icon . $status[ $this->status_ID() ]; |
|
771 | + return $icon.$status[$this->status_ID()]; |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | * @access public |
779 | 779 | */ |
780 | 780 | public function att_is_going() { |
781 | - return $this->get( 'REG_att_is_going' ); |
|
781 | + return $this->get('REG_att_is_going'); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | * @param array $query_params like EEM_Base::get_all |
789 | 789 | * @return EE_Answer[] |
790 | 790 | */ |
791 | - public function answers( $query_params = NULL ) { |
|
792 | - return $this->get_many_related( 'Answer', $query_params ); |
|
791 | + public function answers($query_params = NULL) { |
|
792 | + return $this->get_many_related('Answer', $query_params); |
|
793 | 793 | } |
794 | 794 | |
795 | 795 | |
@@ -803,9 +803,9 @@ discard block |
||
803 | 803 | * (because the answer might be an array of answer values, so passing pretty_value=true |
804 | 804 | * will convert it into some kind of string) |
805 | 805 | */ |
806 | - public function answer_value_to_question( $question, $pretty_value=true ) { |
|
806 | + public function answer_value_to_question($question, $pretty_value = true) { |
|
807 | 807 | $question_id = EEM_Question::instance()->ensure_is_ID($question); |
808 | - return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value); |
|
808 | + return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value); |
|
809 | 809 | } |
810 | 810 | |
811 | 811 | |
@@ -818,13 +818,13 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function question_groups() { |
820 | 820 | $question_groups = array(); |
821 | - if ( $this->event() instanceof EE_Event ) { |
|
821 | + if ($this->event() instanceof EE_Event) { |
|
822 | 822 | $question_groups = $this->event()->question_groups( |
823 | 823 | array( |
824 | 824 | array( |
825 | 825 | 'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false |
826 | 826 | ), |
827 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
827 | + 'order_by' => array('QSG_order' => 'ASC') |
|
828 | 828 | ) |
829 | 829 | ); |
830 | 830 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | */ |
842 | 842 | public function count_question_groups() { |
843 | 843 | $qg_count = 0; |
844 | - if ( $this->event() instanceof EE_Event ) { |
|
844 | + if ($this->event() instanceof EE_Event) { |
|
845 | 845 | $qg_count = $this->event()->count_related( |
846 | 846 | 'Question_Group', |
847 | 847 | array( |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | * @return string |
863 | 863 | */ |
864 | 864 | public function reg_date() { |
865 | - return $this->get_datetime( 'REG_date' ); |
|
865 | + return $this->get_datetime('REG_date'); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @return EE_Datetime_Ticket |
875 | 875 | */ |
876 | 876 | public function datetime_ticket() { |
877 | - return $this->get_first_related( 'Datetime_Ticket' ); |
|
877 | + return $this->get_first_related('Datetime_Ticket'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -884,15 +884,15 @@ discard block |
||
884 | 884 | * @param EE_Datetime_Ticket $datetime_ticket |
885 | 885 | * @return EE_Datetime_Ticket |
886 | 886 | */ |
887 | - public function set_datetime_ticket( $datetime_ticket ) { |
|
888 | - return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' ); |
|
887 | + public function set_datetime_ticket($datetime_ticket) { |
|
888 | + return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket'); |
|
889 | 889 | } |
890 | 890 | /** |
891 | 891 | * Gets deleted |
892 | 892 | * @return boolean |
893 | 893 | */ |
894 | 894 | public function deleted() { |
895 | - return $this->get( 'REG_deleted' ); |
|
895 | + return $this->get('REG_deleted'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | /** |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | * @return boolean |
902 | 902 | */ |
903 | 903 | public function set_deleted($deleted) { |
904 | - $this->set( 'REG_deleted', $deleted ); |
|
904 | + $this->set('REG_deleted', $deleted); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | * @return EE_Status |
912 | 912 | */ |
913 | 913 | public function status_obj() { |
914 | - return $this->get_first_related( 'Status' ); |
|
914 | + return $this->get_first_related('Status'); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * @return int |
923 | 923 | */ |
924 | 924 | public function count_checkins() { |
925 | - return $this->get_model()->count_related( $this, 'Checkin' ); |
|
925 | + return $this->get_model()->count_related($this, 'Checkin'); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -932,7 +932,7 @@ discard block |
||
932 | 932 | * @return int |
933 | 933 | */ |
934 | 934 | public function count_checkins_not_checkedout() { |
935 | - return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) ); |
|
935 | + return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1))); |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | |
@@ -945,20 +945,20 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @return bool |
947 | 947 | */ |
948 | - public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) { |
|
949 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
948 | + public function can_checkin($DTT_OR_ID, $check_approved = TRUE) { |
|
949 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
950 | 950 | |
951 | 951 | //first check registration status |
952 | - if ( ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) { |
|
952 | + if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) { |
|
953 | 953 | return false; |
954 | 954 | } |
955 | 955 | //is there a datetime ticket that matches this dtt_ID? |
956 | - if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) { |
|
956 | + if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) { |
|
957 | 957 | return false; |
958 | 958 | } |
959 | 959 | |
960 | 960 | //final check is against TKT_uses |
961 | - return $this->verify_can_checkin_against_TKT_uses( $DTT_ID ); |
|
961 | + return $this->verify_can_checkin_against_TKT_uses($DTT_ID); |
|
962 | 962 | } |
963 | 963 | |
964 | 964 | |
@@ -971,10 +971,10 @@ discard block |
||
971 | 971 | * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against |
972 | 972 | * @return bool true means can checkin. false means cannot checkin. |
973 | 973 | */ |
974 | - public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) { |
|
975 | - $DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID ); |
|
974 | + public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) { |
|
975 | + $DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID); |
|
976 | 976 | |
977 | - if ( ! $DTT_ID ) { |
|
977 | + if ( ! $DTT_ID) { |
|
978 | 978 | return false; |
979 | 979 | } |
980 | 980 | |
@@ -982,23 +982,23 @@ discard block |
||
982 | 982 | |
983 | 983 | // if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in |
984 | 984 | // or not. |
985 | - if ( ! $max_uses || $max_uses === EE_INF ) { |
|
985 | + if ( ! $max_uses || $max_uses === EE_INF) { |
|
986 | 986 | return true; |
987 | 987 | } |
988 | 988 | |
989 | 989 | //does this datetime have a checkin record? If so, then the dtt count has already been verified so we can just |
990 | 990 | //go ahead and toggle. |
991 | - if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) { |
|
991 | + if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) { |
|
992 | 992 | return true; |
993 | 993 | } |
994 | 994 | |
995 | 995 | //made it here so the last check is whether the number of checkins per unique datetime on this registration |
996 | 996 | //disallows further check-ins. |
997 | - $count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true ); |
|
997 | + $count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true); |
|
998 | 998 | // checkins have already reached their max number of uses |
999 | 999 | // so registrant can NOT checkin |
1000 | - if ( $count_unique_dtt_checkins >= $max_uses ) { |
|
1001 | - EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1000 | + if ($count_unique_dtt_checkins >= $max_uses) { |
|
1001 | + EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1002 | 1002 | return false; |
1003 | 1003 | } |
1004 | 1004 | return true; |
@@ -1019,15 +1019,15 @@ discard block |
||
1019 | 1019 | * @param bool $verify If true then can_checkin() is used to verify whether the person can be checked in or not. Otherwise this forces change in checkin status. |
1020 | 1020 | * @return int|BOOL the chk_in status toggled to OR false if nothing got changed. |
1021 | 1021 | */ |
1022 | - public function toggle_checkin_status( $DTT_ID = null, $verify = false ) { |
|
1023 | - if ( empty( $DTT_ID ) ) { |
|
1022 | + public function toggle_checkin_status($DTT_ID = null, $verify = false) { |
|
1023 | + if (empty($DTT_ID)) { |
|
1024 | 1024 | $datetime = $this->get_related_primary_datetime(); |
1025 | 1025 | $DTT_ID = $datetime->ID(); |
1026 | 1026 | // verify the registration can checkin for the given DTT_ID |
1027 | - } elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) { |
|
1027 | + } elseif ( ! $this->can_checkin($DTT_ID, $verify)) { |
|
1028 | 1028 | EE_Error::add_error( |
1029 | 1029 | sprintf( |
1030 | - __( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1030 | + __('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'), |
|
1031 | 1031 | $this->ID(), |
1032 | 1032 | $DTT_ID |
1033 | 1033 | ), |
@@ -1041,8 +1041,8 @@ discard block |
||
1041 | 1041 | EE_Registration::checkin_status_out => EE_Registration::checkin_status_in |
1042 | 1042 | ); |
1043 | 1043 | //start by getting the current status so we know what status we'll be changing to. |
1044 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL ); |
|
1045 | - $status_to = $status_paths[ $cur_status ]; |
|
1044 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL); |
|
1045 | + $status_to = $status_paths[$cur_status]; |
|
1046 | 1046 | // database only records true for checked IN or false for checked OUT |
1047 | 1047 | // no record ( null ) means checked in NEVER, but we obviously don't save that |
1048 | 1048 | $new_status = $status_to == EE_Registration::checkin_status_in ? true : false; |
@@ -1050,24 +1050,24 @@ discard block |
||
1050 | 1050 | // because we are keeping track of Check-ins over time. |
1051 | 1051 | // Eventually we'll probably want to show a list table |
1052 | 1052 | // for the individual Check-ins so that they can be managed. |
1053 | - $checkin = EE_Checkin::new_instance( array( |
|
1053 | + $checkin = EE_Checkin::new_instance(array( |
|
1054 | 1054 | 'REG_ID' => $this->ID(), |
1055 | 1055 | 'DTT_ID' => $DTT_ID, |
1056 | 1056 | 'CHK_in' => $new_status |
1057 | - ) ); |
|
1057 | + )); |
|
1058 | 1058 | // if the record could not be saved then return false |
1059 | - if ( $checkin->save() === 0 ) { |
|
1060 | - if ( WP_DEBUG ) { |
|
1059 | + if ($checkin->save() === 0) { |
|
1060 | + if (WP_DEBUG) { |
|
1061 | 1061 | global $wpdb; |
1062 | 1062 | $error = sprintf( |
1063 | - __( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ), |
|
1063 | + __('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'), |
|
1064 | 1064 | '<br />', |
1065 | 1065 | $wpdb->last_error |
1066 | 1066 | ); |
1067 | 1067 | } else { |
1068 | - $error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' ); |
|
1068 | + $error = __('Registration check in update failed because of an unknown database error', 'event_espresso'); |
|
1069 | 1069 | } |
1070 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
1070 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
1071 | 1071 | return false; |
1072 | 1072 | } |
1073 | 1073 | return $status_to; |
@@ -1091,19 +1091,19 @@ discard block |
||
1091 | 1091 | * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id. |
1092 | 1092 | * @return int Integer representing Check-in status. |
1093 | 1093 | */ |
1094 | - public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = NULL ) { |
|
1095 | - if ( empty( $DTT_ID ) && ! $checkin instanceof EE_Checkin ) { |
|
1094 | + public function check_in_status_for_datetime($DTT_ID = 0, $checkin = NULL) { |
|
1095 | + if (empty($DTT_ID) && ! $checkin instanceof EE_Checkin) { |
|
1096 | 1096 | $datetime = $this->get_related_primary_datetime(); |
1097 | - if ( ! $datetime instanceof EE_Datetime ) { |
|
1097 | + if ( ! $datetime instanceof EE_Datetime) { |
|
1098 | 1098 | return 0; |
1099 | 1099 | } |
1100 | 1100 | $DTT_ID = $datetime->ID(); |
1101 | 1101 | //verify the registration can checkin for the given DTT_ID |
1102 | 1102 | } |
1103 | 1103 | //get checkin object (if exists) |
1104 | - $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related( 'Checkin', array( array( 'DTT_ID' => $DTT_ID ), 'order_by' => array( 'CHK_timestamp' => 'DESC' ) ) ); |
|
1105 | - if ( $checkin instanceof EE_Checkin ) { |
|
1106 | - if ( $checkin->get( 'CHK_in' ) ) { |
|
1104 | + $checkin = $checkin instanceof EE_Checkin ? $checkin : $this->get_first_related('Checkin', array(array('DTT_ID' => $DTT_ID), 'order_by' => array('CHK_timestamp' => 'DESC'))); |
|
1105 | + if ($checkin instanceof EE_Checkin) { |
|
1106 | + if ($checkin->get('CHK_in')) { |
|
1107 | 1107 | return EE_Registration::checkin_status_in; //checked in |
1108 | 1108 | } else { |
1109 | 1109 | return EE_Registration::checkin_status_out; //had checked in but is now checked out. |
@@ -1121,28 +1121,28 @@ discard block |
||
1121 | 1121 | * @param bool $error This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name. |
1122 | 1122 | * @return string internationalized message |
1123 | 1123 | */ |
1124 | - public function get_checkin_msg( $DTT_ID, $error = FALSE ) { |
|
1124 | + public function get_checkin_msg($DTT_ID, $error = FALSE) { |
|
1125 | 1125 | //let's get the attendee first so we can include the name of the attendee |
1126 | - $attendee = $this->get_first_related( 'Attendee' ); |
|
1127 | - if ( $attendee instanceof EE_Attendee ) { |
|
1128 | - if ( $error ) { |
|
1129 | - return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() ); |
|
1126 | + $attendee = $this->get_first_related('Attendee'); |
|
1127 | + if ($attendee instanceof EE_Attendee) { |
|
1128 | + if ($error) { |
|
1129 | + return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name()); |
|
1130 | 1130 | } |
1131 | - $cur_status = $this->check_in_status_for_datetime( $DTT_ID ); |
|
1131 | + $cur_status = $this->check_in_status_for_datetime($DTT_ID); |
|
1132 | 1132 | //what is the status message going to be? |
1133 | - switch ( $cur_status ) { |
|
1133 | + switch ($cur_status) { |
|
1134 | 1134 | case EE_Registration::checkin_status_never : |
1135 | - return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() ); |
|
1135 | + return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name()); |
|
1136 | 1136 | break; |
1137 | 1137 | case EE_Registration::checkin_status_in : |
1138 | - return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() ); |
|
1138 | + return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name()); |
|
1139 | 1139 | break; |
1140 | 1140 | case EE_Registration::checkin_status_out : |
1141 | - return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() ); |
|
1141 | + return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name()); |
|
1142 | 1142 | break; |
1143 | 1143 | } |
1144 | 1144 | } |
1145 | - return __( "The check-in status could not be determined.", "event_espresso" ); |
|
1145 | + return __("The check-in status could not be determined.", "event_espresso"); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @return EE_Transaction |
1153 | 1153 | */ |
1154 | 1154 | public function transaction() { |
1155 | - return $this->get_first_related( 'Transaction' ); |
|
1155 | + return $this->get_first_related('Transaction'); |
|
1156 | 1156 | } |
1157 | 1157 | |
1158 | 1158 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @access public |
1164 | 1164 | */ |
1165 | 1165 | public function reg_code() { |
1166 | - return $this->get( 'REG_code' ); |
|
1166 | + return $this->get('REG_code'); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | |
@@ -1173,7 +1173,7 @@ discard block |
||
1173 | 1173 | * @access public |
1174 | 1174 | */ |
1175 | 1175 | public function transaction_ID() { |
1176 | - return $this->get( 'TXN_ID' ); |
|
1176 | + return $this->get('TXN_ID'); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | * @return int |
1183 | 1183 | */ |
1184 | 1184 | public function ticket_ID() { |
1185 | - return $this->get( 'TKT_ID' ); |
|
1185 | + return $this->get('TKT_ID'); |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | |
@@ -1194,17 +1194,17 @@ discard block |
||
1194 | 1194 | * @param string $REG_code Registration Code |
1195 | 1195 | * @param boolean $use_default |
1196 | 1196 | */ |
1197 | - public function set_reg_code( $REG_code, $use_default = FALSE ) { |
|
1198 | - if ( empty( $REG_code )) { |
|
1199 | - EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
1197 | + public function set_reg_code($REG_code, $use_default = FALSE) { |
|
1198 | + if (empty($REG_code)) { |
|
1199 | + EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1200 | 1200 | return; |
1201 | 1201 | } |
1202 | - if ( ! $this->reg_code() ) { |
|
1203 | - parent::set( 'REG_code', $REG_code, $use_default ); |
|
1202 | + if ( ! $this->reg_code()) { |
|
1203 | + parent::set('REG_code', $REG_code, $use_default); |
|
1204 | 1204 | } else { |
1205 | 1205 | EE_Error::doing_it_wrong( |
1206 | - __CLASS__ . '::' . __FUNCTION__, |
|
1207 | - __( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ), |
|
1206 | + __CLASS__.'::'.__FUNCTION__, |
|
1207 | + __('Can not change a registration REG_code once it has been set.', 'event_espresso'), |
|
1208 | 1208 | '4.6.0' |
1209 | 1209 | ); |
1210 | 1210 | } |
@@ -1224,17 +1224,17 @@ discard block |
||
1224 | 1224 | * @return EE_Registration[] or empty array if this isn't a group registration. |
1225 | 1225 | */ |
1226 | 1226 | public function get_all_other_registrations_in_group() { |
1227 | - if ( $this->group_size() < 2 ) { |
|
1227 | + if ($this->group_size() < 2) { |
|
1228 | 1228 | return array(); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | $query[0] = array( |
1232 | 1232 | 'TXN_ID' => $this->transaction_ID(), |
1233 | - 'REG_ID' => array( '!=', $this->ID() ), |
|
1233 | + 'REG_ID' => array('!=', $this->ID()), |
|
1234 | 1234 | 'TKT_ID' => $this->ticket_ID() |
1235 | 1235 | ); |
1236 | 1236 | |
1237 | - $registrations = $this->get_model()->get_all( $query ); |
|
1237 | + $registrations = $this->get_model()->get_all($query); |
|
1238 | 1238 | return $registrations; |
1239 | 1239 | } |
1240 | 1240 | |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | * @param array $query_params |
1245 | 1245 | * @return \EE_Registration[] |
1246 | 1246 | */ |
1247 | - public function payments( $query_params = array() ) { |
|
1248 | - return $this->get_many_related( 'Payment', $query_params ); |
|
1247 | + public function payments($query_params = array()) { |
|
1248 | + return $this->get_many_related('Payment', $query_params); |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | |
@@ -1254,8 +1254,8 @@ discard block |
||
1254 | 1254 | * @param array $query_params |
1255 | 1255 | * @return \EE_Registration[] |
1256 | 1256 | */ |
1257 | - public function registration_payments( $query_params = array() ) { |
|
1258 | - return $this->get_many_related( 'Registration_Payment', $query_params ); |
|
1257 | + public function registration_payments($query_params = array()) { |
|
1258 | + return $this->get_many_related('Registration_Payment', $query_params); |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | 1261 | |
@@ -1266,7 +1266,7 @@ discard block |
||
1266 | 1266 | * @access public |
1267 | 1267 | */ |
1268 | 1268 | public function price_paid() { |
1269 | - EE_Error::doing_it_wrong( 'EE_Registration::price_paid()', __( 'This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1269 | + EE_Error::doing_it_wrong('EE_Registration::price_paid()', __('This method is deprecated, please use EE_Registration::final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1270 | 1270 | return $this->final_price(); |
1271 | 1271 | } |
1272 | 1272 | |
@@ -1278,9 +1278,9 @@ discard block |
||
1278 | 1278 | * @access public |
1279 | 1279 | * @param float $REG_final_price |
1280 | 1280 | */ |
1281 | - public function set_price_paid( $REG_final_price = 0.00 ) { |
|
1282 | - EE_Error::doing_it_wrong( 'EE_Registration::set_price_paid()', __( 'This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1283 | - $this->set_final_price( $REG_final_price ); |
|
1281 | + public function set_price_paid($REG_final_price = 0.00) { |
|
1282 | + EE_Error::doing_it_wrong('EE_Registration::set_price_paid()', __('This method is deprecated, please use EE_Registration::set_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1283 | + $this->set_final_price($REG_final_price); |
|
1284 | 1284 | } |
1285 | 1285 | |
1286 | 1286 | |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | * @return string |
1292 | 1292 | */ |
1293 | 1293 | public function pretty_price_paid() { |
1294 | - EE_Error::doing_it_wrong( 'EE_Registration::pretty_price_paid()', __( 'This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso' ), '4.7.0' ); |
|
1294 | + EE_Error::doing_it_wrong('EE_Registration::pretty_price_paid()', __('This method is deprecated, please use EE_Registration::pretty_final_price() instead.', 'event_espresso'), '4.7.0'); |
|
1295 | 1295 | return $this->pretty_final_price(); |
1296 | 1296 | } |
1297 | 1297 |