@@ -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 |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * date_format and the second value is the time format |
38 | 38 | * @return EE_Attendee |
39 | 39 | */ |
40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * the website will be used. |
51 | 51 | * @return EE_Attendee |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return string |
62 | 62 | */ |
63 | 63 | function name() { |
64 | - return $this->get( 'VNU_name' ); |
|
64 | + return $this->get('VNU_name'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return string |
71 | 71 | */ |
72 | 72 | function phone() { |
73 | - return $this->get( 'VNU_phone' ); |
|
73 | + return $this->get('VNU_phone'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | */ |
82 | 82 | function venue_url() { |
83 | - return $this->get( 'VNU_url' ); |
|
83 | + return $this->get('VNU_url'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return string |
90 | 90 | */ |
91 | 91 | function description() { |
92 | - return $this->get( 'VNU_desc' ); |
|
92 | + return $this->get('VNU_desc'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | function excerpt() { |
102 | - return $this->get( 'VNU_short_desc' ); |
|
102 | + return $this->get('VNU_short_desc'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string |
110 | 110 | */ |
111 | 111 | function identifier() { |
112 | - return $this->get( 'VNU_identifier' ); |
|
112 | + return $this->get('VNU_identifier'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | function address() { |
122 | - return $this->get( 'VNU_address' ); |
|
122 | + return $this->get('VNU_address'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return string |
130 | 130 | */ |
131 | 131 | function address2() { |
132 | - return $this->get( 'VNU_address2' ); |
|
132 | + return $this->get('VNU_address2'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function city() { |
143 | - return $this->get( 'VNU_city' ); |
|
143 | + return $this->get('VNU_city'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return int |
149 | 149 | */ |
150 | 150 | function state_ID() { |
151 | - return $this->get( 'STA_ID' ); |
|
151 | + return $this->get('STA_ID'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return string |
167 | 167 | */ |
168 | 168 | public function state_name() { |
169 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : ''; |
|
169 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : ''; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @return EE_State |
177 | 177 | */ |
178 | 178 | function state_obj() { |
179 | - return $this->get_first_related( 'State' ); |
|
179 | + return $this->get_first_related('State'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @return string |
189 | 189 | */ |
190 | 190 | public function state() { |
191 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
191 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
192 | 192 | return $this->state_abbrev(); |
193 | 193 | } else { |
194 | 194 | return $this->state_name(); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string |
203 | 203 | */ |
204 | 204 | function country_ID() { |
205 | - return $this->get( 'CNT_ISO' ); |
|
205 | + return $this->get('CNT_ISO'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return string |
212 | 212 | */ |
213 | 213 | public function country_name() { |
214 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : ''; |
|
214 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : ''; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return EE_Country |
222 | 222 | */ |
223 | 223 | function country_obj() { |
224 | - return $this->get_first_related( 'Country' ); |
|
224 | + return $this->get_first_related('Country'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @return string |
234 | 234 | */ |
235 | 235 | public function country() { |
236 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
236 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
237 | 237 | return $this->country_ID(); |
238 | 238 | } else { |
239 | 239 | return $this->country_name(); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return string |
248 | 248 | */ |
249 | 249 | function zip() { |
250 | - return $this->get( 'VNU_zip' ); |
|
250 | + return $this->get('VNU_zip'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return int |
258 | 258 | */ |
259 | 259 | function capacity() { |
260 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
260 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return string |
268 | 268 | */ |
269 | 269 | function created() { |
270 | - return $this->get( 'VNU_created' ); |
|
270 | + return $this->get('VNU_created'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return string |
278 | 278 | */ |
279 | 279 | function modified() { |
280 | - return $this->get( 'VNU_modified' ); |
|
280 | + return $this->get('VNU_modified'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return int |
288 | 288 | */ |
289 | 289 | function order() { |
290 | - return $this->get( 'VNU_order' ); |
|
290 | + return $this->get('VNU_order'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return int |
298 | 298 | */ |
299 | 299 | function wp_user() { |
300 | - return $this->get( 'VNU_wp_user' ); |
|
300 | + return $this->get('VNU_wp_user'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @return string |
307 | 307 | */ |
308 | 308 | function virtual_phone() { |
309 | - return $this->get( 'VNU_virtual_phone' ); |
|
309 | + return $this->get('VNU_virtual_phone'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @return string |
316 | 316 | */ |
317 | 317 | function virtual_url() { |
318 | - return $this->get( 'VNU_virtual_url' ); |
|
318 | + return $this->get('VNU_virtual_url'); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return bool |
325 | 325 | */ |
326 | 326 | function enable_for_gmap() { |
327 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
327 | + return $this->get('VNU_enable_for_gmap'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return string |
334 | 334 | */ |
335 | 335 | function google_map_link() { |
336 | - return $this->get( 'VNU_google_map_link' ); |
|
336 | + return $this->get('VNU_google_map_link'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | * @param bool $upcoming |
346 | 346 | * @return EE_Event[] |
347 | 347 | */ |
348 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
349 | - if ( $upcoming ) { |
|
348 | + function events($query_params = array(), $upcoming = FALSE) { |
|
349 | + if ($upcoming) { |
|
350 | 350 | $query_params = array( |
351 | 351 | array( |
352 | 352 | 'status' => 'publish', |
353 | - 'Datetime.DTT_EVT_start' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ) |
|
353 | + 'Datetime.DTT_EVT_start' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')) |
|
354 | 354 | ) |
355 | 355 | ); |
356 | 356 | } |
357 | - return $this->get_many_related( 'Event', $query_params ); |
|
357 | + return $this->get_many_related('Event', $query_params); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Sets address |
374 | 374 | */ |
375 | - function set_address( $address = '' ) { |
|
376 | - $this->set( 'VNU_address', $address ); |
|
375 | + function set_address($address = '') { |
|
376 | + $this->set('VNU_address', $address); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param string $address2 |
383 | 383 | */ |
384 | - function set_address2( $address2 = '' ) { |
|
385 | - $this->set( 'VNU_address2', $address2 ); |
|
384 | + function set_address2($address2 = '') { |
|
385 | + $this->set('VNU_address2', $address2); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * @param string $city |
392 | 392 | */ |
393 | - function set_city( $city = '' ) { |
|
394 | - $this->set( 'VNU_city', $city ); |
|
393 | + function set_city($city = '') { |
|
394 | + $this->set('VNU_city', $city); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | /** |
400 | 400 | * @param int $state |
401 | 401 | */ |
402 | - function set_state_ID( $state = 0 ) { |
|
403 | - $this->set( 'STA_ID', $state ); |
|
402 | + function set_state_ID($state = 0) { |
|
403 | + $this->set('STA_ID', $state); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @param EE_State /int $state_id_or_obj |
412 | 412 | * @return EE_State |
413 | 413 | */ |
414 | - function set_state_obj( $state_id_or_obj ) { |
|
415 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
414 | + function set_state_obj($state_id_or_obj) { |
|
415 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param int $country_ID |
422 | 422 | */ |
423 | - function set_country_ID( $country_ID = 0 ) { |
|
424 | - $this->set( 'CNT_ISO', $country_ID ); |
|
423 | + function set_country_ID($country_ID = 0) { |
|
424 | + $this->set('CNT_ISO', $country_ID); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @param EE_Country /string $country_id_or_obj |
431 | 431 | * @return EE_Country |
432 | 432 | */ |
433 | - function set_country_obj( $country_id_or_obj ) { |
|
433 | + function set_country_obj($country_id_or_obj) { |
|
434 | 434 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
435 | 435 | } |
436 | 436 | |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | /** |
440 | 440 | * @param string $zip |
441 | 441 | */ |
442 | - function set_zip( $zip = '' ) { |
|
443 | - $this->set( 'VNU_zip', $zip ); |
|
442 | + function set_zip($zip = '') { |
|
443 | + $this->set('VNU_zip', $zip); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | /** |
449 | 449 | * @param int $capacity |
450 | 450 | */ |
451 | - function set_capacity( $capacity = 0 ) { |
|
452 | - $this->set( 'VNU_capacity', $capacity ); |
|
451 | + function set_capacity($capacity = 0) { |
|
452 | + $this->set('VNU_capacity', $capacity); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * @param string $created |
459 | 459 | */ |
460 | - function set_created( $created = '' ) { |
|
461 | - $this->set( 'VNU_created', $created ); |
|
460 | + function set_created($created = '') { |
|
461 | + $this->set('VNU_created', $created); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | /** |
467 | 467 | * @param string $desc |
468 | 468 | */ |
469 | - function set_description( $desc = '' ) { |
|
470 | - $this->set( 'VNU_desc', $desc ); |
|
469 | + function set_description($desc = '') { |
|
470 | + $this->set('VNU_desc', $desc); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | /** |
476 | 476 | * @param string $identifier |
477 | 477 | */ |
478 | - function set_identifier( $identifier = '' ) { |
|
479 | - $this->set( 'VNU_identifier', $identifier ); |
|
478 | + function set_identifier($identifier = '') { |
|
479 | + $this->set('VNU_identifier', $identifier); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * @param string $modified |
486 | 486 | */ |
487 | - function set_modified( $modified = '' ) { |
|
488 | - $this->set( 'VNU_modified', $modified ); |
|
487 | + function set_modified($modified = '') { |
|
488 | + $this->set('VNU_modified', $modified); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | /** |
494 | 494 | * @param string $name |
495 | 495 | */ |
496 | - function set_name( $name = '' ) { |
|
497 | - $this->set( 'VNU_name', $name ); |
|
496 | + function set_name($name = '') { |
|
497 | + $this->set('VNU_name', $name); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | /** |
503 | 503 | * @param int $order |
504 | 504 | */ |
505 | - function set_order( $order = 0 ) { |
|
506 | - $this->set( 'VNU_order', $order ); |
|
505 | + function set_order($order = 0) { |
|
506 | + $this->set('VNU_order', $order); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | /** |
512 | 512 | * @param string $phone |
513 | 513 | */ |
514 | - function set_phone( $phone = '' ) { |
|
515 | - $this->set( 'VNU_phone', $phone ); |
|
514 | + function set_phone($phone = '') { |
|
515 | + $this->set('VNU_phone', $phone); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * @param int $wp_user |
522 | 522 | */ |
523 | - function set_wp_user( $wp_user = 1 ) { |
|
524 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
523 | + function set_wp_user($wp_user = 1) { |
|
524 | + $this->set('VNU_wp_user', $wp_user); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @param string $url |
531 | 531 | */ |
532 | - function set_venue_url( $url = '' ) { |
|
533 | - $this->set( 'VNU_url', $url ); |
|
532 | + function set_venue_url($url = '') { |
|
533 | + $this->set('VNU_url', $url); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @param string $phone |
540 | 540 | */ |
541 | - function set_virtual_phone( $phone = '' ) { |
|
542 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
541 | + function set_virtual_phone($phone = '') { |
|
542 | + $this->set('VNU_virtual_phone', $phone); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @param string $url |
549 | 549 | */ |
550 | - function set_virtual_url( $url = '' ) { |
|
551 | - $this->set( 'VNU_virtual_url', $url ); |
|
550 | + function set_virtual_url($url = '') { |
|
551 | + $this->set('VNU_virtual_url', $url); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * @param string $enable |
558 | 558 | */ |
559 | - function set_enable_for_gmap( $enable = '' ) { |
|
560 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
559 | + function set_enable_for_gmap($enable = '') { |
|
560 | + $this->set('VNU_enable_for_gmap', $enable); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @param string $google_map_link |
567 | 567 | */ |
568 | - function set_google_map_link( $google_map_link = '' ) { |
|
569 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
568 | + function set_google_map_link($google_map_link = '') { |
|
569 | + $this->set('VNU_google_map_link', $google_map_link); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 |
@@ -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 |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | * @param string $timezone |
34 | 34 | * @param array $date_formats |
35 | 35 | */ |
36 | - protected function __construct( $fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array() ) { |
|
37 | - if ( !isset( $fieldValues[ 'ATT_full_name' ] ) ) { |
|
38 | - $fname = isset( $fieldValues[ 'ATT_fname' ] ) ? $fieldValues[ 'ATT_fname' ] . ' ' : ''; |
|
39 | - $lname = isset( $fieldValues[ 'ATT_lname' ] ) ? $fieldValues[ 'ATT_lname' ] : ''; |
|
40 | - $fieldValues[ 'ATT_full_name' ] = $fname . $lname; |
|
36 | + protected function __construct($fieldValues = NULL, $bydb = FALSE, $timezone = NULL, $date_formats = array()) { |
|
37 | + if ( ! isset($fieldValues['ATT_full_name'])) { |
|
38 | + $fname = isset($fieldValues['ATT_fname']) ? $fieldValues['ATT_fname'].' ' : ''; |
|
39 | + $lname = isset($fieldValues['ATT_lname']) ? $fieldValues['ATT_lname'] : ''; |
|
40 | + $fieldValues['ATT_full_name'] = $fname.$lname; |
|
41 | 41 | } |
42 | - if ( !isset( $fieldValues[ 'ATT_slug' ] ) ) { |
|
42 | + if ( ! isset($fieldValues['ATT_slug'])) { |
|
43 | 43 | // $fieldValues['ATT_slug'] = sanitize_key(wp_generate_password(20)); |
44 | - $fieldValues[ 'ATT_slug' ] = sanitize_title( $fieldValues[ 'ATT_full_name' ] ); |
|
44 | + $fieldValues['ATT_slug'] = sanitize_title($fieldValues['ATT_full_name']); |
|
45 | 45 | } |
46 | - if ( !isset( $fieldValues[ 'ATT_short_bio' ] ) && isset( $fieldValues[ 'ATT_bio' ] ) ) { |
|
47 | - $fieldValues[ 'ATT_short_bio' ] = substr( $fieldValues[ 'ATT_bio' ], 0, 50 ); |
|
46 | + if ( ! isset($fieldValues['ATT_short_bio']) && isset($fieldValues['ATT_bio'])) { |
|
47 | + $fieldValues['ATT_short_bio'] = substr($fieldValues['ATT_bio'], 0, 50); |
|
48 | 48 | } |
49 | - parent::__construct( $fieldValues, $bydb, $timezone, $date_formats ); |
|
49 | + parent::__construct($fieldValues, $bydb, $timezone, $date_formats); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * date_format and the second value is the time format |
61 | 61 | * @return EE_Attendee |
62 | 62 | */ |
63 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
64 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
65 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
63 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
64 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
65 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * the website will be used. |
74 | 74 | * @return EE_Attendee |
75 | 75 | */ |
76 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
77 | - return new self( $props_n_values, TRUE, $timezone ); |
|
76 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
77 | + return new self($props_n_values, TRUE, $timezone); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @access public |
86 | 86 | * @param string $fname |
87 | 87 | */ |
88 | - public function set_fname( $fname = '' ) { |
|
89 | - $this->set( 'ATT_fname', $fname ); |
|
88 | + public function set_fname($fname = '') { |
|
89 | + $this->set('ATT_fname', $fname); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @access public |
98 | 98 | * @param string $lname |
99 | 99 | */ |
100 | - public function set_lname( $lname = '' ) { |
|
101 | - $this->set( 'ATT_lname', $lname ); |
|
100 | + public function set_lname($lname = '') { |
|
101 | + $this->set('ATT_lname', $lname); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * @access public |
110 | 110 | * @param string $address |
111 | 111 | */ |
112 | - public function set_address( $address = '' ) { |
|
113 | - $this->set( 'ATT_address', $address ); |
|
112 | + public function set_address($address = '') { |
|
113 | + $this->set('ATT_address', $address); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * @access public |
122 | 122 | * @param string $address2 |
123 | 123 | */ |
124 | - public function set_address2( $address2 = '' ) { |
|
125 | - $this->set( 'ATT_address2', $address2 ); |
|
124 | + public function set_address2($address2 = '') { |
|
125 | + $this->set('ATT_address2', $address2); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @access public |
134 | 134 | * @param string $city |
135 | 135 | */ |
136 | - public function set_city( $city = '' ) { |
|
137 | - $this->set( 'ATT_city', $city ); |
|
136 | + public function set_city($city = '') { |
|
137 | + $this->set('ATT_city', $city); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | * @access public |
146 | 146 | * @param int $STA_ID |
147 | 147 | */ |
148 | - public function set_state( $STA_ID = 0 ) { |
|
149 | - $this->set( 'STA_ID', $STA_ID ); |
|
148 | + public function set_state($STA_ID = 0) { |
|
149 | + $this->set('STA_ID', $STA_ID); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -157,8 +157,8 @@ discard block |
||
157 | 157 | * @access public |
158 | 158 | * @param string $CNT_ISO |
159 | 159 | */ |
160 | - public function set_country( $CNT_ISO = '' ) { |
|
161 | - $this->set( 'CNT_ISO', $CNT_ISO ); |
|
160 | + public function set_country($CNT_ISO = '') { |
|
161 | + $this->set('CNT_ISO', $CNT_ISO); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @access public |
170 | 170 | * @param string $zip |
171 | 171 | */ |
172 | - public function set_zip( $zip = '' ) { |
|
173 | - $this->set( 'ATT_zip', $zip ); |
|
172 | + public function set_zip($zip = '') { |
|
173 | + $this->set('ATT_zip', $zip); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @access public |
182 | 182 | * @param string $email |
183 | 183 | */ |
184 | - public function set_email( $email = '' ) { |
|
185 | - $this->set( 'ATT_email', $email ); |
|
184 | + public function set_email($email = '') { |
|
185 | + $this->set('ATT_email', $email); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * @access public |
194 | 194 | * @param string $phone |
195 | 195 | */ |
196 | - public function set_phone( $phone = '' ) { |
|
197 | - $this->set( 'ATT_phone', $phone ); |
|
196 | + public function set_phone($phone = '') { |
|
197 | + $this->set('ATT_phone', $phone); |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @param bool $ATT_deleted |
207 | 207 | */ |
208 | - public function set_deleted( $ATT_deleted = FALSE ) { |
|
209 | - $this->set( 'ATT_deleted', $ATT_deleted ); |
|
208 | + public function set_deleted($ATT_deleted = FALSE) { |
|
209 | + $this->set('ATT_deleted', $ATT_deleted); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @return int |
220 | 220 | */ |
221 | 221 | public function wp_user() { |
222 | - return $this->get( 'ATT_author' ); |
|
222 | + return $this->get('ATT_author'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @return string |
231 | 231 | */ |
232 | 232 | public function fname() { |
233 | - return $this->get( 'ATT_fname' ); |
|
233 | + return $this->get('ATT_fname'); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * @param bool $apply_html_entities |
251 | 251 | * @return string |
252 | 252 | */ |
253 | - public function full_name( $apply_html_entities = FALSE ) { |
|
254 | - $full_name = $this->fname() . ' ' . $this->lname(); |
|
255 | - return $apply_html_entities ? htmlentities( $full_name, ENT_QUOTES, 'UTF-8' ) : $full_name; |
|
253 | + public function full_name($apply_html_entities = FALSE) { |
|
254 | + $full_name = $this->fname().' '.$this->lname(); |
|
255 | + return $apply_html_entities ? htmlentities($full_name, ENT_QUOTES, 'UTF-8') : $full_name; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @return string |
264 | 264 | */ |
265 | 265 | public function lname() { |
266 | - return $this->get( 'ATT_lname' ); |
|
266 | + return $this->get('ATT_lname'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -277,26 +277,26 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function full_address_as_array() { |
279 | 279 | $full_address_array = array(); |
280 | - $initial_address_fields = array( 'ATT_address', 'ATT_address2', 'ATT_city', ); |
|
281 | - foreach ( $initial_address_fields as $address_field_name ) { |
|
282 | - $address_fields_value = $this->get( $address_field_name ); |
|
283 | - if ( !empty( $address_fields_value ) ) { |
|
284 | - $full_address_array[ ] = $address_fields_value; |
|
280 | + $initial_address_fields = array('ATT_address', 'ATT_address2', 'ATT_city',); |
|
281 | + foreach ($initial_address_fields as $address_field_name) { |
|
282 | + $address_fields_value = $this->get($address_field_name); |
|
283 | + if ( ! empty($address_fields_value)) { |
|
284 | + $full_address_array[] = $address_fields_value; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | //now handle state and country |
288 | 288 | $state_obj = $this->state_obj(); |
289 | - if ( !empty( $state_obj ) ) { |
|
290 | - $full_address_array[ ] = $state_obj->name(); |
|
289 | + if ( ! empty($state_obj)) { |
|
290 | + $full_address_array[] = $state_obj->name(); |
|
291 | 291 | } |
292 | 292 | $country_obj = $this->country_obj(); |
293 | - if ( !empty( $country_obj ) ) { |
|
294 | - $full_address_array[ ] = $country_obj->name(); |
|
293 | + if ( ! empty($country_obj)) { |
|
294 | + $full_address_array[] = $country_obj->name(); |
|
295 | 295 | } |
296 | 296 | //lastly get the xip |
297 | 297 | $zip_value = $this->zip(); |
298 | - if ( !empty( $zip_value ) ) { |
|
299 | - $full_address_array[ ] = $zip_value; |
|
298 | + if ( ! empty($zip_value)) { |
|
299 | + $full_address_array[] = $zip_value; |
|
300 | 300 | } |
301 | 301 | return $full_address_array; |
302 | 302 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return string |
309 | 309 | */ |
310 | 310 | public function address() { |
311 | - return $this->get( 'ATT_address' ); |
|
311 | + return $this->get('ATT_address'); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | * @return string |
319 | 319 | */ |
320 | 320 | public function address2() { |
321 | - return $this->get( 'ATT_address2' ); |
|
321 | + return $this->get('ATT_address2'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | public function city() { |
331 | - return $this->get( 'ATT_city' ); |
|
331 | + return $this->get('ATT_city'); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * @return string |
339 | 339 | */ |
340 | 340 | public function state_ID() { |
341 | - return $this->get( 'STA_ID' ); |
|
341 | + return $this->get('STA_ID'); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -357,17 +357,17 @@ discard block |
||
357 | 357 | * @return EE_State |
358 | 358 | */ |
359 | 359 | public function state_obj() { |
360 | - return $this->get_first_related( 'State' ); |
|
360 | + return $this->get_first_related('State'); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
364 | 364 | * Returns the state's name, otherwise 'Unknown' |
365 | 365 | * @return string |
366 | 366 | */ |
367 | - public function state_name(){ |
|
368 | - if( $this->state_obj() ){ |
|
367 | + public function state_name() { |
|
368 | + if ($this->state_obj()) { |
|
369 | 369 | return $this->state_obj()->name(); |
370 | - }else{ |
|
370 | + } else { |
|
371 | 371 | return ''; |
372 | 372 | } |
373 | 373 | } |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @return string |
382 | 382 | */ |
383 | 383 | public function state() { |
384 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
384 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
385 | 385 | return $this->state_abbrev(); |
386 | 386 | } else { |
387 | 387 | return $this->state_name(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | * @return string |
396 | 396 | */ |
397 | 397 | public function country_ID() { |
398 | - return $this->get( 'CNT_ISO' ); |
|
398 | + return $this->get('CNT_ISO'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | * @return EE_Country |
406 | 406 | */ |
407 | 407 | public function country_obj() { |
408 | - return $this->get_first_related( 'Country' ); |
|
408 | + return $this->get_first_related('Country'); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
412 | 412 | * Returns the country's name if known, otherwise 'Unknown' |
413 | 413 | * @return string |
414 | 414 | */ |
415 | - public function country_name(){ |
|
416 | - if( $this->country_obj() ){ |
|
415 | + public function country_name() { |
|
416 | + if ($this->country_obj()) { |
|
417 | 417 | return $this->country_obj()->name(); |
418 | - }else{ |
|
418 | + } else { |
|
419 | 419 | return ''; |
420 | 420 | } |
421 | 421 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @return string |
430 | 430 | */ |
431 | 431 | public function country() { |
432 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
432 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
433 | 433 | return $this->country_ID(); |
434 | 434 | } else { |
435 | 435 | return $this->country_name(); |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * @return string |
444 | 444 | */ |
445 | 445 | public function zip() { |
446 | - return $this->get( 'ATT_zip' ); |
|
446 | + return $this->get('ATT_zip'); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @return string |
454 | 454 | */ |
455 | 455 | public function email() { |
456 | - return $this->get( 'ATT_email' ); |
|
456 | + return $this->get('ATT_email'); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | * @return string |
464 | 464 | */ |
465 | 465 | public function phone() { |
466 | - return $this->get( 'ATT_phone' ); |
|
466 | + return $this->get('ATT_phone'); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | * @return bool |
474 | 474 | */ |
475 | 475 | public function deleted() { |
476 | - return $this->get( 'ATT_deleted' ); |
|
476 | + return $this->get('ATT_deleted'); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | * @param array $query_params |
484 | 484 | * @return EE_Registration[] |
485 | 485 | */ |
486 | - public function get_registrations( $query_params = array() ) { |
|
487 | - return $this->get_many_related( 'Registration', $query_params ); |
|
486 | + public function get_registrations($query_params = array()) { |
|
487 | + return $this->get_many_related('Registration', $query_params); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return EE_Registration |
495 | 495 | */ |
496 | 496 | public function get_most_recent_registration() { |
497 | - return $this->get_first_related( 'Registration', array( 'order_by' => array( 'REG_date' => 'DESC' ) ) ); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
497 | + return $this->get_first_related('Registration', array('order_by' => array('REG_date' => 'DESC'))); //null, 'REG_date', 'DESC', '=', 'OBJECT_K'); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | * @param int $event_id |
505 | 505 | * @return EE_Registration |
506 | 506 | */ |
507 | - public function get_most_recent_registration_for_event( $event_id ) { |
|
508 | - return $this->get_first_related( 'Registration', array(array( 'EVT_ID' => $event_id ), 'order_by' => array('REG_date' => 'DESC')));//, '=', 'OBJECT_K' ); |
|
507 | + public function get_most_recent_registration_for_event($event_id) { |
|
508 | + return $this->get_first_related('Registration', array(array('EVT_ID' => $event_id), 'order_by' => array('REG_date' => 'DESC'))); //, '=', 'OBJECT_K' ); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @return array |
516 | 516 | */ |
517 | 517 | public function events() { |
518 | - return $this->get_many_related( 'Event' ); |
|
518 | + return $this->get_many_related('Event'); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | /** |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | * @param EE_Payment_Method $payment_method the _gateway_name property on the gateway class |
525 | 525 | * @return EE_Form_Section_Proper |
526 | 526 | */ |
527 | - public function billing_info_for_payment_method($payment_method){ |
|
527 | + public function billing_info_for_payment_method($payment_method) { |
|
528 | 528 | $pm_type = $payment_method->type_obj(); |
529 | - if( ! $pm_type instanceof EE_PMT_Base ){ |
|
529 | + if ( ! $pm_type instanceof EE_PMT_Base) { |
|
530 | 530 | return NULL; |
531 | 531 | } |
532 | - $billing_info = $this->get_post_meta( $this->get_billing_info_postmeta_name( $payment_method ), true ); |
|
533 | - if ( ! $billing_info){ |
|
532 | + $billing_info = $this->get_post_meta($this->get_billing_info_postmeta_name($payment_method), true); |
|
533 | + if ( ! $billing_info) { |
|
534 | 534 | return NULL; |
535 | 535 | } |
536 | 536 | $billing_form = $pm_type->billing_form(); |
537 | - $billing_form->receive_form_submission( array( $billing_form->name() => $billing_info ), FALSE ); |
|
537 | + $billing_form->receive_form_submission(array($billing_form->name() => $billing_info), FALSE); |
|
538 | 538 | return $billing_form; |
539 | 539 | } |
540 | 540 | |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | * @param EE_Payment_Method $payment_method |
545 | 545 | * @return string |
546 | 546 | */ |
547 | - public function get_billing_info_postmeta_name($payment_method){ |
|
548 | - if( $payment_method->type_obj() instanceof EE_PMT_Base ){ |
|
549 | - return 'billing_info_' . $payment_method->type_obj()->system_name(); |
|
550 | - }else{ |
|
547 | + public function get_billing_info_postmeta_name($payment_method) { |
|
548 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
549 | + return 'billing_info_'.$payment_method->type_obj()->system_name(); |
|
550 | + } else { |
|
551 | 551 | return NULL; |
552 | 552 | } |
553 | 553 | } |
@@ -558,13 +558,13 @@ discard block |
||
558 | 558 | * @param EE_Payment_Method $payment_method |
559 | 559 | * @return boolean |
560 | 560 | */ |
561 | - public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method){ |
|
562 | - if( ! $billing_form instanceof EE_Billing_Attendee_Info_Form ){ |
|
563 | - EE_Error::add_error( __( 'Cannot save billing info because there is none.', 'event_espresso' ) ); |
|
561 | + public function save_and_clean_billing_info_for_payment_method($billing_form, $payment_method) { |
|
562 | + if ( ! $billing_form instanceof EE_Billing_Attendee_Info_Form) { |
|
563 | + EE_Error::add_error(__('Cannot save billing info because there is none.', 'event_espresso')); |
|
564 | 564 | return false; |
565 | 565 | } |
566 | 566 | $billing_form->clean_sensitive_data(); |
567 | - return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name( $payment_method ), $billing_form->input_values( true ) ); |
|
567 | + return update_post_meta($this->ID(), $this->get_billing_info_postmeta_name($payment_method), $billing_form->input_values(true)); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -580,14 +580,14 @@ discard block |
||
580 | 580 | * @return string |
581 | 581 | */ |
582 | 582 | public function get_admin_edit_link() { |
583 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
583 | + EE_Registry::instance()->load_helper('URL'); |
|
584 | 584 | return EEH_URL::add_query_args_and_nonce( |
585 | 585 | array( |
586 | 586 | 'page' => 'espresso_registrations', |
587 | 587 | 'action' => 'edit_attendee', |
588 | 588 | 'post' => $this->ID() |
589 | 589 | ), |
590 | - admin_url( 'admin.php' ) |
|
590 | + admin_url('admin.php') |
|
591 | 591 | ); |
592 | 592 | } |
593 | 593 | |
@@ -604,13 +604,13 @@ discard block |
||
604 | 604 | * @return string |
605 | 605 | */ |
606 | 606 | public function get_admin_overview_link() { |
607 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
607 | + EE_Registry::instance()->load_helper('URL'); |
|
608 | 608 | return EEH_URL::add_query_args_and_nonce( |
609 | 609 | array( |
610 | 610 | 'page' => 'espresso_registrations', |
611 | 611 | 'action' => 'contact_list' |
612 | 612 | ), |
613 | - admin_url( 'admin.php' ) |
|
613 | + admin_url('admin.php') |
|
614 | 614 | ); |
615 | 615 | } |
616 | 616 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket extends EEM_Soft_Delete_Base { |
28 | 28 | |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | * @access private |
36 | 36 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
37 | 37 | */ |
38 | - protected function __construct( $timezone ) { |
|
39 | - $this->singular_item = __('Ticket','event_espresso'); |
|
40 | - $this->plural_item = __('Tickets','event_espresso'); |
|
38 | + protected function __construct($timezone) { |
|
39 | + $this->singular_item = __('Ticket', 'event_espresso'); |
|
40 | + $this->plural_item = __('Tickets', 'event_espresso'); |
|
41 | 41 | |
42 | 42 | $this->_tables = array( |
43 | 43 | 'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID') |
44 | 44 | ); |
45 | 45 | $this->_fields = array( |
46 | 46 | 'Ticket'=>array( |
47 | - 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')), |
|
48 | - 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'), |
|
47 | + 'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), |
|
48 | + 'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), |
|
49 | 49 | 'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), |
50 | - 'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ), |
|
51 | - 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
52 | - 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, time(), $timezone ), |
|
53 | - 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ), |
|
54 | - 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF ), |
|
50 | + 'TKT_description'=>new EE_Post_Content_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), |
|
51 | + 'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
52 | + 'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, time(), $timezone), |
|
53 | + 'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), |
|
54 | + 'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, EE_INF), |
|
55 | 55 | 'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), |
56 | 56 | 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), |
57 | - 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, EE_INF), |
|
58 | - 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF ), |
|
59 | - 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ), |
|
60 | - 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false), |
|
61 | - 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ), |
|
57 | + 'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, EE_INF), |
|
58 | + 'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, EE_INF), |
|
59 | + 'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), |
|
60 | + 'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), |
|
61 | + 'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), |
|
62 | 62 | 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), |
63 | - 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ), |
|
63 | + 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), |
|
64 | 64 | 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), |
65 | - 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ), |
|
66 | - 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 ) |
|
65 | + 'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE), |
|
66 | + 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0) |
|
67 | 67 | )); |
68 | 68 | $this->_model_relations = array( |
69 | 69 | 'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'), |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event'); |
|
79 | 79 | //account for default tickets in the caps |
80 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
81 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
82 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' ); |
|
83 | - parent::__construct( $timezone ); |
|
80 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
81 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
82 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event'); |
|
83 | + parent::__construct($timezone); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function get_all_default_tickets() { |
93 | 93 | /** @type EE_Ticket[] $tickets */ |
94 | - $tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC')) ); |
|
94 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
95 | 95 | //we need to set the start date and end date to today's date and the start of the default dtt |
96 | - return $this->_set_default_dates( $tickets ); |
|
96 | + return $this->_set_default_dates($tickets); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * @param EE_Ticket[] $tickets |
104 | 104 | * @return EE_Ticket[] |
105 | 105 | */ |
106 | - private function _set_default_dates( $tickets ) { |
|
107 | - foreach ( $tickets as $ticket ) { |
|
108 | - $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true) ); |
|
109 | - $ticket->set('TKT_end_date', $this->current_time_for_query( 'TKT_end_date', true ) + (60 * 60 * 24 * 30 ) ); |
|
110 | - $ticket->set_end_time( $this->convert_datetime_for_query( 'TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone ) ); |
|
106 | + private function _set_default_dates($tickets) { |
|
107 | + foreach ($tickets as $ticket) { |
|
108 | + $ticket->set('TKT_start_date', $this->current_time_for_query('TKT_start_date', true)); |
|
109 | + $ticket->set('TKT_end_date', $this->current_time_for_query('TKT_end_date', true) + (60 * 60 * 24 * 30)); |
|
110 | + $ticket->set_end_time($this->convert_datetime_for_query('TKT_end_date', '11:59 pm', 'g:i a', $this->_timezone)); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $tickets; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @param array $query_params |
123 | 123 | * @return int |
124 | 124 | */ |
125 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){ |
|
126 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params ); |
|
125 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) { |
|
126 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @param EE_Ticket[] $tickets |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function update_tickets_sold($tickets){ |
|
137 | - foreach($tickets as $ticket){ |
|
136 | + public function update_tickets_sold($tickets) { |
|
137 | + foreach ($tickets as $ticket) { |
|
138 | 138 | /* @var $ticket EE_Ticket */ |
139 | 139 | $ticket->update_tickets_sold(); |
140 | 140 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
5 | -require_once( EE_CLASSES . 'EE_Question.class.php' ); |
|
4 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
5 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
6 | 6 | |
7 | 7 | |
8 | 8 | |
@@ -101,52 +101,52 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @param null $timezone |
103 | 103 | */ |
104 | - protected function __construct( $timezone = NULL ) { |
|
105 | - $this->singular_item = __('Question','event_espresso'); |
|
106 | - $this->plural_item = __('Questions','event_espresso'); |
|
107 | - $this->_allowed_question_types=apply_filters( |
|
104 | + protected function __construct($timezone = NULL) { |
|
105 | + $this->singular_item = __('Question', 'event_espresso'); |
|
106 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
107 | + $this->_allowed_question_types = apply_filters( |
|
108 | 108 | 'FHEE__EEM_Question__construct__allowed_question_types', |
109 | 109 | array( |
110 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
111 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
112 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
113 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
114 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
115 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
116 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
117 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
118 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
119 | - EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ), |
|
120 | - EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ), |
|
121 | - EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ), |
|
122 | - EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ), |
|
123 | - EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ), |
|
124 | - EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ), |
|
125 | - EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ) |
|
110 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
111 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
112 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
113 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
114 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
115 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
116 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
117 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
118 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
119 | + EEM_Question::QST_type_email => __('Email', 'event_espresso'), |
|
120 | + EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), |
|
121 | + EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), |
|
122 | + EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), |
|
123 | + EEM_Question::QST_type_url => __('URL', 'event_espresso'), |
|
124 | + EEM_Question::QST_type_year => __('Year', 'event_espresso'), |
|
125 | + EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso') |
|
126 | 126 | ) |
127 | 127 | ); |
128 | 128 | $this->_question_descriptions = apply_filters( |
129 | 129 | 'FHEE__EEM_Question__construct__allowed_question_types', |
130 | 130 | array( |
131 | - EEM_Question::QST_type_text => __( 'A single line text input field', 'event_espresso' ), |
|
132 | - EEM_Question::QST_type_textarea => __( 'A multi line text input field', 'event_espresso' ), |
|
133 | - EEM_Question::QST_type_checkbox => __( 'Allows multiple preset options to be selected', 'event_espresso' ), |
|
134 | - EEM_Question::QST_type_radio => __( 'Allows a single preset option to be selected', 'event_espresso' ), |
|
135 | - EEM_Question::QST_type_dropdown => __( 'A dropdown that allows a single selection', 'event_espresso' ), |
|
136 | - EEM_Question::QST_type_state => __( 'A dropdown that lists states/provinces', 'event_espresso' ), |
|
137 | - EEM_Question::QST_type_country => __( 'A dropdown that lists countries', 'event_espresso' ), |
|
138 | - EEM_Question::QST_type_date => __( 'A popup calendar that allows date selections', 'event_espresso' ), |
|
139 | - EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ), |
|
140 | - EEM_Question::QST_type_email => __( 'A text field that must contain a valid Email address', 'event_espresso' ), |
|
141 | - EEM_Question::QST_type_us_phone => __( 'A text field that must contain a valid US phone number', 'event_espresso' ), |
|
142 | - EEM_Question::QST_type_decimal => __( 'A text field that allows number values with decimals', 'event_espresso' ), |
|
143 | - EEM_Question::QST_type_int => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ), |
|
144 | - EEM_Question::QST_type_url => __( 'A text field that must contain a valid URL', 'event_espresso' ), |
|
145 | - EEM_Question::QST_type_year => __( 'A dropdown that lists the last 100 years', 'event_espresso' ), |
|
146 | - EEM_Question::QST_type_multi_select => __( 'A dropdown that allows multiple selections', 'event_espresso' ) |
|
131 | + EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), |
|
132 | + EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), |
|
133 | + EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), |
|
134 | + EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), |
|
135 | + EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), |
|
136 | + EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), |
|
137 | + EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), |
|
138 | + EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), |
|
139 | + EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), |
|
140 | + EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), |
|
141 | + EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), |
|
142 | + EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), |
|
143 | + EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), |
|
144 | + EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), |
|
145 | + EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), |
|
146 | + EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso') |
|
147 | 147 | ) |
148 | 148 | ); |
149 | - $this->_question_type_categories = (array)apply_filters( |
|
149 | + $this->_question_type_categories = (array) apply_filters( |
|
150 | 150 | 'FHEE__EEM_Question__construct__question_type_categories', |
151 | 151 | array( |
152 | 152 | 'text' => array( |
@@ -171,22 +171,22 @@ discard block |
||
171 | 171 | ); |
172 | 172 | |
173 | 173 | $this->_tables = array( |
174 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
174 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
175 | 175 | ); |
176 | 176 | $this->_fields = array( |
177 | 177 | 'Question'=>array( |
178 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
179 | - 'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
180 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
181 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), false, '' ), |
|
182 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
183 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
184 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
185 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
186 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
187 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
188 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
189 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
178 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
179 | + 'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
180 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
181 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''), |
|
182 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
183 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
184 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
185 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
186 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
187 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
188 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
189 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
190 | 190 | ) |
191 | 191 | ); |
192 | 192 | $this->_model_relations = array( |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
199 | 199 | ); |
200 | 200 | //this model is generally available for reading |
201 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
202 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | - parent::__construct( $timezone ); |
|
201 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
202 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
203 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
204 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
205 | + parent::__construct($timezone); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * but they can be extended |
211 | 211 | * @return string[] |
212 | 212 | */ |
213 | - public function allowed_question_types(){ |
|
213 | + public function allowed_question_types() { |
|
214 | 214 | return $this->_allowed_question_types; |
215 | 215 | } |
216 | 216 | /** |
@@ -218,16 +218,16 @@ discard block |
||
218 | 218 | * @param string $question_type one of EEM_Question::allowed_question_types( |
219 | 219 | * @return string[] like EEM_Question::allowed_question_types() |
220 | 220 | */ |
221 | - public function question_types_in_same_category( $question_type ) { |
|
222 | - $question_types = array( $question_type ); |
|
223 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
224 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
221 | + public function question_types_in_same_category($question_type) { |
|
222 | + $question_types = array($question_type); |
|
223 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
224 | + if (in_array($question_type, $question_types_in_category)) { |
|
225 | 225 | $question_types = $question_types_in_category; |
226 | 226 | break; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | |
230 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
230 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
237 | 237 | * @return boolean |
238 | 238 | */ |
239 | - public function question_type_is_in_category( $question_type, $category ) { |
|
240 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
239 | + public function question_type_is_in_category($question_type, $category) { |
|
240 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
241 | 241 | return false; |
242 | 242 | } |
243 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
243 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * @param string $system_question_group_id QSG_system |
258 | 258 | * @return array of system question names (QST_system) |
259 | 259 | */ |
260 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
260 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
261 | 261 | $question_system_ids = array(); |
262 | - switch( $system_question_group_id ) { |
|
262 | + switch ($system_question_group_id) { |
|
263 | 263 | case EEM_Question_Group::system_personal: |
264 | 264 | $question_system_ids = array( |
265 | 265 | EEM_Attendee::system_question_fname, |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ); |
281 | 281 | break; |
282 | 282 | } |
283 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
283 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | /** |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | * @param string $system_question_group_id QSG_system |
290 | 290 | * @return array of system question names (QST_system) |
291 | 291 | */ |
292 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
292 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
293 | 293 | $question_system_ids = null; |
294 | - switch( $system_question_group_id ) { |
|
294 | + switch ($system_question_group_id) { |
|
295 | 295 | case EEM_Question_Group::system_personal: |
296 | - $question_system_ids = array( |
|
296 | + $question_system_ids = array( |
|
297 | 297 | EEM_Attendee::system_question_fname, |
298 | 298 | EEM_Attendee::system_question_email, |
299 | 299 | ); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | default: |
302 | 302 | $question_system_ids = array(); |
303 | 303 | } |
304 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
304 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | * @param $QST_system |
313 | 313 | * @return int of QST_ID for the question that corresponds to that QST_system |
314 | 314 | */ |
315 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
316 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
315 | + public function get_Question_ID_from_system_string($QST_system) { |
|
316 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function get_latest_question_order() { |
327 | 327 | $columns_to_select = array( |
328 | - 'max_order' => array("MAX(QST_order)","%d") |
|
328 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
329 | 329 | ); |
330 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
331 | - return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
330 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
331 | + return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * @param string $system_question_value |
358 | 358 | * @return int|float |
359 | 359 | */ |
360 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
360 | + public function absolute_max_for_system_question($system_question_value) { |
|
361 | 361 | $maxes = $this->system_question_maxes(); |
362 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
363 | - return $maxes[ $system_question_value ]; |
|
362 | + if (isset($maxes[$system_question_value])) { |
|
363 | + return $maxes[$system_question_value]; |
|
364 | 364 | } else { |
365 | 365 | return EE_INF; |
366 | 366 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * but you want to have an exceptional case where users can directly submit content |
12 | 12 | * for this field, then you should first run the content through `wp_kses( $content, 'post' )` |
13 | 13 | */ |
14 | -class EE_Full_HTML_Field extends EE_Text_Field_Base{ |
|
14 | +class EE_Full_HTML_Field extends EE_Text_Field_Base { |
|
15 | 15 | |
16 | 16 | |
17 | 17 | /** |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
24 | - if($schema =='form_input'){ |
|
24 | + if ($schema == 'form_input') { |
|
25 | 25 | return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
26 | - }elseif($schema == 'no_wpautop'){ |
|
26 | + }elseif ($schema == 'no_wpautop') { |
|
27 | 27 | return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
28 | - }else{ |
|
28 | + } else { |
|
29 | 29 | return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
30 | 30 | } |
31 | 31 | } |
@@ -3,20 +3,20 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Text_Field_Base{ |
|
6 | +class EE_Post_Content_Field extends EE_Text_Field_Base { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value) { |
13 | - if( ! current_user_can( 'unfiltered_html' ) ) { |
|
14 | - $value = wp_kses("$value",wp_kses_allowed_html( 'post' )); |
|
13 | + if ( ! current_user_can('unfiltered_html')) { |
|
14 | + $value = wp_kses("$value", wp_kses_allowed_html('post')); |
|
15 | 15 | } |
16 | 16 | return parent::prepare_for_set($value); |
17 | 17 | } |
18 | 18 | |
19 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
19 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
20 | 20 | return $value_found_in_db_for_model_object; |
21 | 21 | } |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @param string $value_inputted_for_field_on_model_object |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - function prepare_for_set( $value_inputted_for_field_on_model_object ) { |
|
16 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
17 | 17 | if ( ! preg_match( |
18 | 18 | '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u', |
19 | 19 | $value_inputted_for_field_on_model_object |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question_Option.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question_Option.class.php'); |
|
26 | 26 | |
27 | 27 | |
28 | 28 | class EEM_Question_Option extends EEM_Soft_Delete_Base { |
@@ -30,22 +30,22 @@ discard block |
||
30 | 30 | // private instance of the Attendee object |
31 | 31 | protected static $_instance = NULL; |
32 | 32 | |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singular_item = __('Question Option','event_espresso'); |
|
35 | - $this->plural_item = __('Question Options','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singular_item = __('Question Option', 'event_espresso'); |
|
35 | + $this->plural_item = __('Question Options', 'event_espresso'); |
|
36 | 36 | |
37 | 37 | $this->_tables = array( |
38 | - 'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID') |
|
38 | + 'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID') |
|
39 | 39 | ); |
40 | 40 | $this->_fields = array( |
41 | 41 | 'Question_Option'=>array( |
42 | - 'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')), |
|
43 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
44 | - 'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"),false,''), |
|
45 | - 'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''), |
|
46 | - 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ), |
|
47 | - 'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option','event_espresso'), TRUE, NULL ), |
|
48 | - 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false) |
|
42 | + 'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')), |
|
43 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
44 | + 'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''), |
|
45 | + 'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''), |
|
46 | + 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0), |
|
47 | + 'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL), |
|
48 | + 'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false) |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | $this->_model_relations = array( |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->_model_chain_to_wp_user = 'Question'; |
56 | 56 | //this model is generally available for reading |
57 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
58 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
60 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
57 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
58 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
60 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option'); |
|
61 | 61 | $this->_caps_slug = 'questions'; |
62 | - parent::__construct( $timezone ); |
|
62 | + parent::__construct($timezone); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
25 | -require_once( EE_CLASSES . 'EE_Question_Group.class.php'); |
|
24 | +require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
25 | +require_once(EE_CLASSES.'EE_Question_Group.class.php'); |
|
26 | 26 | class EEM_Question_Group extends EEM_Soft_Delete_Base { |
27 | 27 | const system_personal = 1; |
28 | 28 | const system_address = 2; |
@@ -30,25 +30,25 @@ discard block |
||
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | 32 | |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singular_item = __('Question Group','event_espresso'); |
|
35 | - $this->plural_item = __('Question Groups','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singular_item = __('Question Group', 'event_espresso'); |
|
35 | + $this->plural_item = __('Question Groups', 'event_espresso'); |
|
36 | 36 | |
37 | 37 | $this->_tables = array( |
38 | - 'Question_Group'=>new EE_Primary_Table('esp_question_group','QSG_ID') |
|
38 | + 'Question_Group'=>new EE_Primary_Table('esp_question_group', 'QSG_ID') |
|
39 | 39 | ); |
40 | 40 | $this->_fields = array( |
41 | 41 | 'Question_Group'=>array( |
42 | - 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID','event_espresso')), |
|
43 | - 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name','event_espresso'), false, ''), |
|
44 | - 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group','event_espresso'), false, ''), |
|
45 | - 'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group','event_espresso'), true, ''), |
|
46 | - 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group','event_espresso'), true, 0), |
|
47 | - 'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page','event_espresso'), false, true), |
|
48 | - 'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page','event_espresso'), false, false), |
|
49 | - 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE ), |
|
50 | - 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.','event_espresso'), false, 0), |
|
51 | - 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted','event_espresso'), false, false) |
|
42 | + 'QSG_ID'=>new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')), |
|
43 | + 'QSG_name'=>new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''), |
|
44 | + 'QSG_identifier'=>new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''), |
|
45 | + 'QSG_desc'=>new EE_Post_Content_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''), |
|
46 | + 'QSG_order'=>new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0), |
|
47 | + 'QSG_show_group_name'=>new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true), |
|
48 | + 'QSG_show_group_desc'=>new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\s description on the registration page', 'event_espresso'), false, false), |
|
49 | + 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE), |
|
50 | + 'QSG_system'=>new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0), |
|
51 | + 'QSG_deleted'=>new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false) |
|
52 | 52 | ) |
53 | 53 | ); |
54 | 54 | $this->_model_relations = array( |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | 'WP_User' => new EE_Belongs_To_Relation(), |
59 | 59 | ); |
60 | 60 | //this model is generally available for reading |
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
62 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
63 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
64 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
65 | - parent::__construct( $timezone ); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
62 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
63 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
64 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system'); |
|
65 | + parent::__construct($timezone); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | /** |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function get_latest_question_group_order() { |
74 | 74 | $columns_to_select = array( |
75 | - 'max_order' => array("MAX(QSG_order)","%d") |
|
75 | + 'max_order' => array("MAX(QSG_order)", "%d") |
|
76 | 76 | ); |
77 | - $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select ); |
|
77 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
78 | 78 | return $max[0]['max_order']; |
79 | 79 | } |
80 | 80 |