@@ -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 |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | * @param array $props_n_values |
33 | 33 | * @return EE_Term_Taxonomy |
34 | 34 | */ |
35 | - public static function new_instance( $props_n_values = array() ) { |
|
36 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
37 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
35 | + public static function new_instance($props_n_values = array()) { |
|
36 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
37 | + return $has_object ? $has_object : new self($props_n_values); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @param array $props_n_values |
44 | 44 | * @return EE_Term_Taxonomy |
45 | 45 | */ |
46 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
47 | - return new self( $props_n_values, TRUE ); |
|
46 | + public static function new_instance_from_db($props_n_values = array()) { |
|
47 | + return new self($props_n_values, TRUE); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return string |
55 | 55 | */ |
56 | 56 | function taxonomy() { |
57 | - return $this->get( 'taxonomy' ); |
|
57 | + return $this->get('taxonomy'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * @param string $taxonomy |
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | - function set_taxonomy( $taxonomy ) { |
|
68 | - $this->set( 'taxonomy', $taxonomy ); |
|
67 | + function set_taxonomy($taxonomy) { |
|
68 | + $this->set('taxonomy', $taxonomy); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @return int |
76 | 76 | */ |
77 | 77 | function count() { |
78 | - return $this->get( 'term_count' ); |
|
78 | + return $this->get('term_count'); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @param int $term_count |
86 | 86 | * @return boolean |
87 | 87 | */ |
88 | - function set_count( $term_count ) { |
|
89 | - $this->set( 'term_count', $term_count ); |
|
88 | + function set_count($term_count) { |
|
89 | + $this->set('term_count', $term_count); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return EE_Term |
97 | 97 | */ |
98 | 98 | function term() { |
99 | - return $this->get_first_related( 'Term' ); |
|
99 | + return $this->get_first_related('Term'); |
|
100 | 100 | } |
101 | 101 | |
102 | 102 |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Sets taxonomy |
64 | 64 | * @param string $taxonomy |
65 | - * @return boolean |
|
65 | + * @return boolean|null |
|
66 | 66 | */ |
67 | 67 | function set_taxonomy( $taxonomy ) { |
68 | 68 | $this->set( 'taxonomy', $taxonomy ); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Sets term_count |
85 | 85 | * @param int $term_count |
86 | - * @return boolean |
|
86 | + * @return boolean|null |
|
87 | 87 | */ |
88 | 88 | function set_count( $term_count ) { |
89 | 89 | $this->set( 'term_count', $term_count ); |
@@ -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 |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Template|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Template |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -742,11 +742,11 @@ |
||
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | 743 | if( $pm instanceof EE_Payment_Method ){ |
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else{ |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | 747 | if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else{ |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * Gets all the attendees for this transaction (handy for use with EE_Attendee's get_registrations_for_event function |
428 | 428 | * for getting attendees and how many registrations they each have for an event) |
429 | 429 | * |
430 | - * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
430 | + * @return EE_Base_Class[] EE_Attendee[] by default, int if $output is set to 'COUNT' |
|
431 | 431 | * @throws \EE_Error |
432 | 432 | */ |
433 | 433 | public function attendees() { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | |
465 | 465 | /** |
466 | 466 | * Gets all payments which have not been approved |
467 | - * @return \EEI_Payment[] |
|
467 | + * @return EE_Base_Class[] |
|
468 | 468 | * @throws EE_Error if a model is misconfigured somehow |
469 | 469 | */ |
470 | 470 | public function pending_payments() |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | * Gets all the extra meta info on this payment |
710 | 710 | * |
711 | 711 | * @param array $query_params like EEM_Base::get_all |
712 | - * @return EE_Extra_Meta |
|
712 | + * @return EE_Base_Class[] |
|
713 | 713 | * @throws \EE_Error |
714 | 714 | */ |
715 | 715 | public function extra_meta( $query_params = array() ) { |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * Sets PMD_ID |
887 | 887 | * |
888 | 888 | * @param int $PMD_ID |
889 | - * @return boolean |
|
889 | + * @return boolean|null |
|
890 | 890 | * @throws \EE_Error |
891 | 891 | */ |
892 | 892 | public function set_payment_method_ID($PMD_ID) { |
@@ -462,29 +462,29 @@ discard block |
||
462 | 462 | |
463 | 463 | |
464 | 464 | |
465 | - /** |
|
466 | - * Gets all payments which have not been approved |
|
467 | - * @return \EEI_Payment[] |
|
468 | - * @throws EE_Error if a model is misconfigured somehow |
|
469 | - */ |
|
465 | + /** |
|
466 | + * Gets all payments which have not been approved |
|
467 | + * @return \EEI_Payment[] |
|
468 | + * @throws EE_Error if a model is misconfigured somehow |
|
469 | + */ |
|
470 | 470 | public function pending_payments() |
471 | - { |
|
472 | - return $this->get_many_related( |
|
473 | - 'Payment', |
|
474 | - array( |
|
475 | - array( |
|
476 | - 'STS_ID' => EEM_Payment::status_id_pending |
|
477 | - ), |
|
478 | - 'order_by' => array( |
|
479 | - 'PAY_timestamp' => 'DESC' |
|
480 | - ) |
|
481 | - ) |
|
482 | - ); |
|
483 | - } |
|
484 | - |
|
485 | - |
|
486 | - |
|
487 | - /** |
|
471 | + { |
|
472 | + return $this->get_many_related( |
|
473 | + 'Payment', |
|
474 | + array( |
|
475 | + array( |
|
476 | + 'STS_ID' => EEM_Payment::status_id_pending |
|
477 | + ), |
|
478 | + 'order_by' => array( |
|
479 | + 'PAY_timestamp' => 'DESC' |
|
480 | + ) |
|
481 | + ) |
|
482 | + ); |
|
483 | + } |
|
484 | + |
|
485 | + |
|
486 | + |
|
487 | + /** |
|
488 | 488 | * echoes $this->pretty_status() |
489 | 489 | * |
490 | 490 | * @param bool $show_icons |
@@ -645,20 +645,20 @@ discard block |
||
645 | 645 | * @throws \EE_Error |
646 | 646 | */ |
647 | 647 | public function primary_registration() { |
648 | - $registrations = (array) $this->get_many_related( |
|
649 | - 'Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)) |
|
650 | - ); |
|
651 | - foreach ($registrations as $registration) { |
|
652 | - // valid registration that is NOT cancelled or declined ? |
|
653 | - if( |
|
654 | - $registration instanceof EE_Registration |
|
655 | - && ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true) |
|
656 | - ) { |
|
657 | - return $registration; |
|
658 | - } |
|
659 | - } |
|
660 | - // nothing valid found, so just return first thing from array of results |
|
661 | - return reset($registrations); |
|
648 | + $registrations = (array) $this->get_many_related( |
|
649 | + 'Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT)) |
|
650 | + ); |
|
651 | + foreach ($registrations as $registration) { |
|
652 | + // valid registration that is NOT cancelled or declined ? |
|
653 | + if( |
|
654 | + $registration instanceof EE_Registration |
|
655 | + && ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true) |
|
656 | + ) { |
|
657 | + return $registration; |
|
658 | + } |
|
659 | + } |
|
660 | + // nothing valid found, so just return first thing from array of results |
|
661 | + return reset($registrations); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 |
@@ -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_Transaction class |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @return EE_Transaction |
35 | 35 | * @throws \EE_Error |
36 | 36 | */ |
37 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
38 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
37 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
38 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
39 | 39 | $txn = $has_object |
40 | 40 | ? $has_object |
41 | - : new self( $props_n_values, false, $timezone, $date_formats ); |
|
42 | - if ( ! $has_object ) { |
|
43 | - $txn->set_old_txn_status( $txn->status_ID() ); |
|
41 | + : new self($props_n_values, false, $timezone, $date_formats); |
|
42 | + if ( ! $has_object) { |
|
43 | + $txn->set_old_txn_status($txn->status_ID()); |
|
44 | 44 | } |
45 | 45 | return $txn; |
46 | 46 | } |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @return EE_Transaction |
55 | 55 | * @throws \EE_Error |
56 | 56 | */ |
57 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
58 | - $txn = new self( $props_n_values, TRUE, $timezone ); |
|
59 | - $txn->set_old_txn_status( $txn->status_ID() ); |
|
57 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
58 | + $txn = new self($props_n_values, TRUE, $timezone); |
|
59 | + $txn->set_old_txn_status($txn->status_ID()); |
|
60 | 60 | return $txn; |
61 | 61 | } |
62 | 62 | |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function lock() { |
75 | 75 | // attempt to set lock, but if that fails... |
76 | - if ( ! $this->add_extra_meta( 'lock', time(), true ) ) { |
|
76 | + if ( ! $this->add_extra_meta('lock', time(), true)) { |
|
77 | 77 | // then attempt to remove the lock in case it is expired |
78 | - if ( $this->_remove_expired_lock() ) { |
|
78 | + if ($this->_remove_expired_lock()) { |
|
79 | 79 | // if removal was successful, then try setting lock again |
80 | 80 | $this->lock(); |
81 | 81 | } else { |
82 | 82 | // but if the lock can not be removed, then throw an exception |
83 | 83 | throw new EE_Error( |
84 | 84 | sprintf( |
85 | - __( 'Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso' ), |
|
85 | + __('Could not lock Transaction %1$d because it is already locked, meaning another part of the system is currently editing it. It should already be unlocked by the time you read this, so please refresh the page and try again.', 'event_espresso'), |
|
86 | 86 | $this->ID() |
87 | 87 | ) |
88 | 88 | ); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @throws \EE_Error |
102 | 102 | */ |
103 | 103 | public function unlock() { |
104 | - return $this->delete_extra_meta( 'lock' ); |
|
104 | + return $this->delete_extra_meta('lock'); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function is_locked() { |
124 | 124 | // if TXN is not locked, then return false immediately |
125 | - if ( ! $this->_get_lock() ) { |
|
125 | + if ( ! $this->_get_lock()) { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | // if not, then let's try and remove the lock in case it's expired... |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @throws \EE_Error |
144 | 144 | */ |
145 | 145 | protected function _get_lock() { |
146 | - return (int)$this->get_extra_meta( 'lock', true, 0 ); |
|
146 | + return (int) $this->get_extra_meta('lock', true, 0); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | protected function _remove_expired_lock() { |
160 | 160 | $locked = $this->_get_lock(); |
161 | - if ( $locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked ) { |
|
161 | + if ($locked && time() - EE_Transaction::LOCK_EXPIRATION > $locked) { |
|
162 | 162 | return $this->unlock(); |
163 | 163 | } |
164 | 164 | return 0; |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param float $total total value of transaction |
174 | 174 | * @throws \EE_Error |
175 | 175 | */ |
176 | - public function set_total( $total = 0.00 ) { |
|
177 | - $this->set( 'TXN_total', (float)$total ); |
|
176 | + public function set_total($total = 0.00) { |
|
177 | + $this->set('TXN_total', (float) $total); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param float $total_paid total amount paid to date (sum of all payments) |
187 | 187 | * @throws \EE_Error |
188 | 188 | */ |
189 | - public function set_paid( $total_paid = 0.00 ) { |
|
190 | - $this->set( 'TXN_paid', (float)$total_paid ); |
|
189 | + public function set_paid($total_paid = 0.00) { |
|
190 | + $this->set('TXN_paid', (float) $total_paid); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
200 | 200 | * @throws \EE_Error |
201 | 201 | */ |
202 | - public function set_status( $status = '' ) { |
|
203 | - $this->set( 'STS_ID', $status ); |
|
202 | + public function set_status($status = '') { |
|
203 | + $this->set('STS_ID', $status); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $hash_salt required for some payment gateways |
213 | 213 | * @throws \EE_Error |
214 | 214 | */ |
215 | - public function set_hash_salt( $hash_salt = '' ) { |
|
216 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
215 | + public function set_hash_salt($hash_salt = '') { |
|
216 | + $this->set('TXN_hash_salt', $hash_salt); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | * @param array $txn_reg_steps |
225 | 225 | * @throws \EE_Error |
226 | 226 | */ |
227 | - public function set_reg_steps( array $txn_reg_steps ) { |
|
228 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
227 | + public function set_reg_steps(array $txn_reg_steps) { |
|
228 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @throws \EE_Error |
238 | 238 | */ |
239 | 239 | public function reg_steps() { |
240 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
241 | - return is_array( $TXN_reg_steps ) ? (array)$TXN_reg_steps : array(); |
|
240 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
241 | + return is_array($TXN_reg_steps) ? (array) $TXN_reg_steps : array(); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @throws \EE_Error |
249 | 249 | */ |
250 | 250 | public function pretty_total() { |
251 | - return $this->get_pretty( 'TXN_total' ); |
|
251 | + return $this->get_pretty('TXN_total'); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @throws \EE_Error |
261 | 261 | */ |
262 | 262 | public function pretty_paid() { |
263 | - return $this->get_pretty( 'TXN_paid' ); |
|
263 | + return $this->get_pretty('TXN_paid'); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @throws \EE_Error |
274 | 274 | */ |
275 | 275 | public function remaining() { |
276 | - return (float)( $this->total() - $this->paid() ); |
|
276 | + return (float) ($this->total() - $this->paid()); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @throws \EE_Error |
287 | 287 | */ |
288 | 288 | public function total() { |
289 | - return (float)$this->get( 'TXN_total' ); |
|
289 | + return (float) $this->get('TXN_total'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @throws \EE_Error |
300 | 300 | */ |
301 | 301 | public function paid() { |
302 | - return (float)$this->get( 'TXN_paid' ); |
|
302 | + return (float) $this->get('TXN_paid'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | * @throws \EE_Error |
312 | 312 | */ |
313 | 313 | public function get_cart_session() { |
314 | - $session_data = (array)$this->get( 'TXN_session_data' ); |
|
315 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart |
|
316 | - ? $session_data[ 'cart' ] |
|
314 | + $session_data = (array) $this->get('TXN_session_data'); |
|
315 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart |
|
316 | + ? $session_data['cart'] |
|
317 | 317 | : null; |
318 | 318 | } |
319 | 319 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | * @throws \EE_Error |
327 | 327 | */ |
328 | 328 | public function session_data() { |
329 | - $session_data = $this->get( 'TXN_session_data' ); |
|
330 | - if ( empty( $session_data ) ) { |
|
329 | + $session_data = $this->get('TXN_session_data'); |
|
330 | + if (empty($session_data)) { |
|
331 | 331 | $session_data = array( |
332 | 332 | 'id' => null, |
333 | 333 | 'user_id' => null, |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | * @param EE_Session|array $session_data |
351 | 351 | * @throws \EE_Error |
352 | 352 | */ |
353 | - public function set_txn_session_data( $session_data ) { |
|
354 | - if ( $session_data instanceof EE_Session ) { |
|
355 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
353 | + public function set_txn_session_data($session_data) { |
|
354 | + if ($session_data instanceof EE_Session) { |
|
355 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
356 | 356 | } else { |
357 | - $this->set( 'TXN_session_data', $session_data ); |
|
357 | + $this->set('TXN_session_data', $session_data); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * @throws \EE_Error |
368 | 368 | */ |
369 | 369 | public function hash_salt_() { |
370 | - return $this->get( 'TXN_hash_salt' ); |
|
370 | + return $this->get('TXN_hash_salt'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | * @return string | int |
388 | 388 | * @throws \EE_Error |
389 | 389 | */ |
390 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
391 | - if ( $format ) { |
|
392 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
393 | - } else if ( $gmt ) { |
|
394 | - return $this->get_raw( 'TXN_timestamp' ); |
|
390 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
391 | + if ($format) { |
|
392 | + return $this->get_pretty('TXN_timestamp'); |
|
393 | + } else if ($gmt) { |
|
394 | + return $this->get_raw('TXN_timestamp'); |
|
395 | 395 | } else { |
396 | - return $this->get( 'TXN_timestamp' ); |
|
396 | + return $this->get('TXN_timestamp'); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * @return EE_Registration[] |
408 | 408 | * @throws \EE_Error |
409 | 409 | */ |
410 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
411 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) |
|
410 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
411 | + $query_params = (empty($query_params) || ! is_array($query_params)) |
|
412 | 412 | ? array( |
413 | 413 | 'order_by' => array( |
414 | 414 | 'Event.EVT_name' => 'ASC', |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | ) |
419 | 419 | : $query_params; |
420 | 420 | $query_params = $get_cached ? array() : $query_params; |
421 | - return $this->get_many_related( 'Registration', $query_params ); |
|
421 | + return $this->get_many_related('Registration', $query_params); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @throws \EE_Error |
432 | 432 | */ |
433 | 433 | public function attendees() { |
434 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
434 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -443,8 +443,8 @@ discard block |
||
443 | 443 | * @return EE_Payment[] |
444 | 444 | * @throws \EE_Error |
445 | 445 | */ |
446 | - public function payments( $query_params = array() ) { |
|
447 | - return $this->get_many_related( 'Payment', $query_params ); |
|
446 | + public function payments($query_params = array()) { |
|
447 | + return $this->get_many_related('Payment', $query_params); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | * @throws \EE_Error |
457 | 457 | */ |
458 | 458 | public function approved_payments() { |
459 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
460 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
459 | + EE_Registry::instance()->load_model('Payment'); |
|
460 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | |
@@ -491,8 +491,8 @@ discard block |
||
491 | 491 | * @return string |
492 | 492 | * @throws \EE_Error |
493 | 493 | */ |
494 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
495 | - echo $this->pretty_status( $show_icons ); |
|
494 | + public function e_pretty_status($show_icons = FALSE) { |
|
495 | + echo $this->pretty_status($show_icons); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | * @return string |
505 | 505 | * @throws \EE_Error |
506 | 506 | */ |
507 | - public function pretty_status( $show_icons = FALSE ) { |
|
508 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
507 | + public function pretty_status($show_icons = FALSE) { |
|
508 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
509 | 509 | $icon = ''; |
510 | - switch ( $this->status_ID() ) { |
|
510 | + switch ($this->status_ID()) { |
|
511 | 511 | case EEM_Transaction::complete_status_code: |
512 | 512 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
513 | 513 | break; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
525 | 525 | break; |
526 | 526 | } |
527 | - return $icon . $status[ $this->status_ID() ]; |
|
527 | + return $icon.$status[$this->status_ID()]; |
|
528 | 528 | } |
529 | 529 | |
530 | 530 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | * @throws \EE_Error |
537 | 537 | */ |
538 | 538 | public function status_ID() { |
539 | - return $this->get( 'STS_ID' ); |
|
539 | + return $this->get('STS_ID'); |
|
540 | 540 | } |
541 | 541 | |
542 | 542 | |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | * @throws \EE_Error |
549 | 549 | */ |
550 | 550 | public function is_free() { |
551 | - return EEH_Money::compare_floats( $this->get( 'TXN_total' ), 0, '==' ); |
|
551 | + return EEH_Money::compare_floats($this->get('TXN_total'), 0, '=='); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -628,12 +628,12 @@ discard block |
||
628 | 628 | * @return string |
629 | 629 | * @throws \EE_Error |
630 | 630 | */ |
631 | - public function invoice_url( $type = 'html' ) { |
|
631 | + public function invoice_url($type = 'html') { |
|
632 | 632 | $REG = $this->primary_registration(); |
633 | - if ( ! $REG instanceof EE_Registration ) { |
|
633 | + if ( ! $REG instanceof EE_Registration) { |
|
634 | 634 | return ''; |
635 | 635 | } |
636 | - return $REG->invoice_url( $type ); |
|
636 | + return $REG->invoice_url($type); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | ); |
651 | 651 | foreach ($registrations as $registration) { |
652 | 652 | // valid registration that is NOT cancelled or declined ? |
653 | - if( |
|
653 | + if ( |
|
654 | 654 | $registration instanceof EE_Registration |
655 | 655 | && ! in_array($registration->status_ID(), EEM_Registration::closed_reg_statuses(), true) |
656 | 656 | ) { |
@@ -670,12 +670,12 @@ discard block |
||
670 | 670 | * @return string |
671 | 671 | * @throws \EE_Error |
672 | 672 | */ |
673 | - public function receipt_url( $type = 'html' ) { |
|
673 | + public function receipt_url($type = 'html') { |
|
674 | 674 | $REG = $this->primary_registration(); |
675 | - if ( ! $REG instanceof EE_Registration ) { |
|
675 | + if ( ! $REG instanceof EE_Registration) { |
|
676 | 676 | return ''; |
677 | 677 | } |
678 | - return $REG->receipt_url( $type ); |
|
678 | + return $REG->receipt_url($type); |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * @throws \EE_Error |
701 | 701 | */ |
702 | 702 | public function gateway_response_on_transaction() { |
703 | - $payment = $this->get_first_related( 'Payment' ); |
|
703 | + $payment = $this->get_first_related('Payment'); |
|
704 | 704 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
705 | 705 | } |
706 | 706 | |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | * @throws \EE_Error |
714 | 714 | */ |
715 | 715 | public function status_obj() { |
716 | - return $this->get_first_related( 'Status' ); |
|
716 | + return $this->get_first_related('Status'); |
|
717 | 717 | } |
718 | 718 | |
719 | 719 | |
@@ -725,8 +725,8 @@ discard block |
||
725 | 725 | * @return EE_Extra_Meta |
726 | 726 | * @throws \EE_Error |
727 | 727 | */ |
728 | - public function extra_meta( $query_params = array() ) { |
|
729 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
728 | + public function extra_meta($query_params = array()) { |
|
729 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
730 | 730 | } |
731 | 731 | |
732 | 732 | |
@@ -738,8 +738,8 @@ discard block |
||
738 | 738 | * @return EE_Base_Class the relation was added to |
739 | 739 | * @throws \EE_Error |
740 | 740 | */ |
741 | - public function add_registration( EE_Registration $registration ) { |
|
742 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
741 | + public function add_registration(EE_Registration $registration) { |
|
742 | + return $this->_add_relation_to($registration, 'Registration'); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | * @return EE_Base_Class that was removed from being related |
753 | 753 | * @throws \EE_Error |
754 | 754 | */ |
755 | - public function remove_registration_with_id( $registration_or_id ) { |
|
756 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
755 | + public function remove_registration_with_id($registration_or_id) { |
|
756 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | * @throws \EE_Error |
766 | 766 | */ |
767 | 767 | public function items_purchased() { |
768 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
768 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | * @return EE_Base_Class the relation was added to |
778 | 778 | * @throws \EE_Error |
779 | 779 | */ |
780 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
781 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
780 | + public function add_line_item(EE_Line_Item $line_item) { |
|
781 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | * @return EE_Line_Item[] |
791 | 791 | * @throws \EE_Error |
792 | 792 | */ |
793 | - public function line_items( $query_params = array() ) { |
|
794 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
793 | + public function line_items($query_params = array()) { |
|
794 | + return $this->get_many_related('Line_Item', $query_params); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @throws \EE_Error |
804 | 804 | */ |
805 | 805 | public function tax_items() { |
806 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
806 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
807 | 807 | } |
808 | 808 | |
809 | 809 | |
@@ -816,10 +816,10 @@ discard block |
||
816 | 816 | * @return \EE_Line_Item |
817 | 817 | * @throws \EE_Error |
818 | 818 | */ |
819 | - public function total_line_item( $create_if_not_found = true ) { |
|
820 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
821 | - if( ! $item && $create_if_not_found ){ |
|
822 | - $item = EEH_Line_Item::create_total_line_item( $this ); |
|
819 | + public function total_line_item($create_if_not_found = true) { |
|
820 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
821 | + if ( ! $item && $create_if_not_found) { |
|
822 | + $item = EEH_Line_Item::create_total_line_item($this); |
|
823 | 823 | } |
824 | 824 | return $item; |
825 | 825 | } |
@@ -835,10 +835,10 @@ discard block |
||
835 | 835 | */ |
836 | 836 | public function tax_total() { |
837 | 837 | $tax_line_item = $this->tax_total_line_item(); |
838 | - if ( $tax_line_item ) { |
|
839 | - return (float)$tax_line_item->total(); |
|
838 | + if ($tax_line_item) { |
|
839 | + return (float) $tax_line_item->total(); |
|
840 | 840 | } else { |
841 | - return (float)0; |
|
841 | + return (float) 0; |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | * @throws \EE_Error |
852 | 852 | */ |
853 | 853 | public function tax_total_line_item() { |
854 | - return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() ); |
|
854 | + return EEH_Line_Item::get_taxes_subtotal($this->total_line_item()); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | |
@@ -862,20 +862,20 @@ discard block |
||
862 | 862 | * @return EE_Form_Section_Proper |
863 | 863 | * @throws \EE_Error |
864 | 864 | */ |
865 | - public function billing_info(){ |
|
865 | + public function billing_info() { |
|
866 | 866 | $payment_method = $this->payment_method(); |
867 | - if ( !$payment_method){ |
|
867 | + if ( ! $payment_method) { |
|
868 | 868 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
869 | 869 | return false; |
870 | 870 | } |
871 | 871 | $primary_reg = $this->primary_registration(); |
872 | - if ( ! $primary_reg ) { |
|
873 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
872 | + if ( ! $primary_reg) { |
|
873 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
874 | 874 | return FALSE; |
875 | 875 | } |
876 | 876 | $attendee = $primary_reg->attendee(); |
877 | - if ( ! $attendee ) { |
|
878 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
877 | + if ( ! $attendee) { |
|
878 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
879 | 879 | return FALSE; |
880 | 880 | } |
881 | 881 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -916,15 +916,15 @@ discard block |
||
916 | 916 | * @return EE_Payment_Method |
917 | 917 | * @throws \EE_Error |
918 | 918 | */ |
919 | - public function payment_method(){ |
|
919 | + public function payment_method() { |
|
920 | 920 | $pm = $this->get_first_related('Payment_Method'); |
921 | - if( $pm instanceof EE_Payment_Method ){ |
|
921 | + if ($pm instanceof EE_Payment_Method) { |
|
922 | 922 | return $pm; |
923 | - }else{ |
|
923 | + } else { |
|
924 | 924 | $last_payment = $this->last_payment(); |
925 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
925 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
926 | 926 | return $last_payment->payment_method(); |
927 | - }else{ |
|
927 | + } else { |
|
928 | 928 | return NULL; |
929 | 929 | } |
930 | 930 | } |
@@ -939,7 +939,7 @@ discard block |
||
939 | 939 | * @throws \EE_Error |
940 | 940 | */ |
941 | 941 | public function last_payment() { |
942 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
942 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | |
@@ -950,8 +950,8 @@ discard block |
||
950 | 950 | * @return EE_Line_Item[] |
951 | 951 | * @throws \EE_Error |
952 | 952 | */ |
953 | - public function non_ticket_line_items(){ |
|
954 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
953 | + public function non_ticket_line_items() { |
|
954 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
955 | 955 | } |
956 | 956 | |
957 | 957 | |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | public function update_based_on_payments() |
1000 | 1000 | { |
1001 | 1001 | EE_Error::doing_it_wrong( |
1002 | - __CLASS__ . '::' . __FUNCTION__, |
|
1002 | + __CLASS__.'::'.__FUNCTION__, |
|
1003 | 1003 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
1004 | 1004 | 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
1005 | 1005 | '4.6.0' |
@@ -1023,9 +1023,9 @@ discard block |
||
1023 | 1023 | /** |
1024 | 1024 | * @param string $old_txn_status |
1025 | 1025 | */ |
1026 | - public function set_old_txn_status( $old_txn_status ) { |
|
1026 | + public function set_old_txn_status($old_txn_status) { |
|
1027 | 1027 | // only set the first time |
1028 | - if ( $this->_old_txn_status === null ) { |
|
1028 | + if ($this->_old_txn_status === null) { |
|
1029 | 1029 | $this->_old_txn_status = $old_txn_status; |
1030 | 1030 | } |
1031 | 1031 | } |
@@ -1054,17 +1054,17 @@ discard block |
||
1054 | 1054 | * @param bool $check_all |
1055 | 1055 | * @return boolean | int |
1056 | 1056 | */ |
1057 | - private function _reg_steps_completed( $reg_step_slug = '', $check_all = true ) { |
|
1057 | + private function _reg_steps_completed($reg_step_slug = '', $check_all = true) { |
|
1058 | 1058 | $reg_steps = $this->reg_steps(); |
1059 | - if ( ! is_array( $reg_steps ) || empty( $reg_steps ) ) { |
|
1059 | + if ( ! is_array($reg_steps) || empty($reg_steps)) { |
|
1060 | 1060 | return false; |
1061 | 1061 | } |
1062 | 1062 | // loop thru reg steps array) |
1063 | - foreach ( $reg_steps as $slug => $reg_step_completed ) { |
|
1063 | + foreach ($reg_steps as $slug => $reg_step_completed) { |
|
1064 | 1064 | // if NOT checking ALL steps (only checking one step) |
1065 | - if ( ! $check_all ) { |
|
1065 | + if ( ! $check_all) { |
|
1066 | 1066 | // and this is the one |
1067 | - if ( $slug === $reg_step_slug ) { |
|
1067 | + if ($slug === $reg_step_slug) { |
|
1068 | 1068 | return $reg_step_completed; |
1069 | 1069 | } else { |
1070 | 1070 | // skip to next reg step in loop |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | } |
1074 | 1074 | // $check_all must be true, else we would never have gotten to this point |
1075 | - if ( $slug === $reg_step_slug ) { |
|
1075 | + if ($slug === $reg_step_slug) { |
|
1076 | 1076 | // if we reach this point, then we are testing either: |
1077 | 1077 | // all_reg_steps_completed_except() or |
1078 | 1078 | // all_reg_steps_completed_except_final_step(), |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | // ie: "is everything completed except the final step?" |
1082 | 1082 | // "that is correct... the final step is not completed, but all others are." |
1083 | 1083 | return $reg_step_completed !== true ? true : false; |
1084 | - } else if ( $reg_step_completed !== true ) { |
|
1084 | + } else if ($reg_step_completed !== true) { |
|
1085 | 1085 | // if any reg step is NOT completed, then ALL steps are not completed |
1086 | 1086 | return false; |
1087 | 1087 | } |
@@ -1115,8 +1115,8 @@ discard block |
||
1115 | 1115 | * @param string $exception |
1116 | 1116 | * @return boolean |
1117 | 1117 | */ |
1118 | - public function all_reg_steps_completed_except( $exception = '' ) { |
|
1119 | - return $this->_reg_steps_completed( $exception ); |
|
1118 | + public function all_reg_steps_completed_except($exception = '') { |
|
1119 | + return $this->_reg_steps_completed($exception); |
|
1120 | 1120 | } |
1121 | 1121 | |
1122 | 1122 | |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | * @return boolean |
1132 | 1132 | */ |
1133 | 1133 | public function all_reg_steps_completed_except_final_step() { |
1134 | - return $this->_reg_steps_completed( 'finalize_registration' ); |
|
1134 | + return $this->_reg_steps_completed('finalize_registration'); |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | |
@@ -1146,8 +1146,8 @@ discard block |
||
1146 | 1146 | * @param string $reg_step_slug |
1147 | 1147 | * @return boolean | int |
1148 | 1148 | */ |
1149 | - public function reg_step_completed( $reg_step_slug ) { |
|
1150 | - return $this->_reg_steps_completed( $reg_step_slug, false ); |
|
1149 | + public function reg_step_completed($reg_step_slug) { |
|
1150 | + return $this->_reg_steps_completed($reg_step_slug, false); |
|
1151 | 1151 | } |
1152 | 1152 | |
1153 | 1153 | |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | * @return boolean | int |
1163 | 1163 | */ |
1164 | 1164 | public function final_reg_step_completed() { |
1165 | - return $this->_reg_steps_completed( 'finalize_registration', false ); |
|
1165 | + return $this->_reg_steps_completed('finalize_registration', false); |
|
1166 | 1166 | } |
1167 | 1167 | |
1168 | 1168 | |
@@ -1176,8 +1176,8 @@ discard block |
||
1176 | 1176 | * @return boolean |
1177 | 1177 | * @throws \EE_Error |
1178 | 1178 | */ |
1179 | - public function set_reg_step_initiated( $reg_step_slug ) { |
|
1180 | - return $this->_set_reg_step_completed_status( $reg_step_slug, time() ); |
|
1179 | + public function set_reg_step_initiated($reg_step_slug) { |
|
1180 | + return $this->_set_reg_step_completed_status($reg_step_slug, time()); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | |
@@ -1191,8 +1191,8 @@ discard block |
||
1191 | 1191 | * @return boolean |
1192 | 1192 | * @throws \EE_Error |
1193 | 1193 | */ |
1194 | - public function set_reg_step_completed( $reg_step_slug ) { |
|
1195 | - return $this->_set_reg_step_completed_status( $reg_step_slug, true ); |
|
1194 | + public function set_reg_step_completed($reg_step_slug) { |
|
1195 | + return $this->_set_reg_step_completed_status($reg_step_slug, true); |
|
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | |
@@ -1206,8 +1206,8 @@ discard block |
||
1206 | 1206 | * @return boolean |
1207 | 1207 | * @throws \EE_Error |
1208 | 1208 | */ |
1209 | - public function set_reg_step_not_completed( $reg_step_slug ) { |
|
1210 | - return $this->_set_reg_step_completed_status( $reg_step_slug, false ); |
|
1209 | + public function set_reg_step_not_completed($reg_step_slug) { |
|
1210 | + return $this->_set_reg_step_completed_status($reg_step_slug, false); |
|
1211 | 1211 | } |
1212 | 1212 | |
1213 | 1213 | |
@@ -1222,37 +1222,37 @@ discard block |
||
1222 | 1222 | * @return boolean |
1223 | 1223 | * @throws \EE_Error |
1224 | 1224 | */ |
1225 | - private function _set_reg_step_completed_status( $reg_step_slug, $status ) { |
|
1225 | + private function _set_reg_step_completed_status($reg_step_slug, $status) { |
|
1226 | 1226 | // validate status |
1227 | - $status = is_bool( $status ) || is_int( $status ) ? $status : false; |
|
1227 | + $status = is_bool($status) || is_int($status) ? $status : false; |
|
1228 | 1228 | // get reg steps array |
1229 | 1229 | $txn_reg_steps = $this->reg_steps(); |
1230 | 1230 | // if reg step does NOT exist |
1231 | - if ( ! isset( $txn_reg_steps[ $reg_step_slug ] ) ) { |
|
1231 | + if ( ! isset($txn_reg_steps[$reg_step_slug])) { |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // if we're trying to complete a step that is already completed |
1235 | - if ( $txn_reg_steps[ $reg_step_slug ] === true ) { |
|
1235 | + if ($txn_reg_steps[$reg_step_slug] === true) { |
|
1236 | 1236 | return true; |
1237 | 1237 | } |
1238 | 1238 | // if we're trying to complete a step that hasn't even started |
1239 | - if ( $status === true && $txn_reg_steps[ $reg_step_slug ] === false ) { |
|
1239 | + if ($status === true && $txn_reg_steps[$reg_step_slug] === false) { |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // if current status value matches the incoming value (no change) |
1243 | 1243 | // type casting as int means values should collapse to either 0, 1, or a timestamp like 1234567890 |
1244 | - if ( (int) $txn_reg_steps[ $reg_step_slug ] === (int) $status ) { |
|
1244 | + if ((int) $txn_reg_steps[$reg_step_slug] === (int) $status) { |
|
1245 | 1245 | // this will happen in cases where multiple AJAX requests occur during the same step |
1246 | 1246 | return true; |
1247 | 1247 | } |
1248 | 1248 | // if we're trying to set a start time, but it has already been set... |
1249 | - if ( is_numeric( $status ) && is_numeric( $txn_reg_steps[ $reg_step_slug ] ) ) { |
|
1249 | + if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) { |
|
1250 | 1250 | // skip the update below, but don't return FALSE so that errors won't be displayed |
1251 | 1251 | return true; |
1252 | 1252 | } |
1253 | 1253 | // update completed status |
1254 | - $txn_reg_steps[ $reg_step_slug ] = $status; |
|
1255 | - $this->set_reg_steps( $txn_reg_steps ); |
|
1254 | + $txn_reg_steps[$reg_step_slug] = $status; |
|
1255 | + $this->set_reg_steps($txn_reg_steps); |
|
1256 | 1256 | $this->save(); |
1257 | 1257 | return true; |
1258 | 1258 | } |
@@ -1268,11 +1268,11 @@ discard block |
||
1268 | 1268 | * @param string $reg_step_slug |
1269 | 1269 | * @return void |
1270 | 1270 | */ |
1271 | - public function remove_reg_step( $reg_step_slug ) { |
|
1271 | + public function remove_reg_step($reg_step_slug) { |
|
1272 | 1272 | // get reg steps array |
1273 | 1273 | $txn_reg_steps = $this->reg_steps(); |
1274 | - unset( $txn_reg_steps[ $reg_step_slug ] ); |
|
1275 | - $this->set_reg_steps( $txn_reg_steps ); |
|
1274 | + unset($txn_reg_steps[$reg_step_slug]); |
|
1275 | + $this->set_reg_steps($txn_reg_steps); |
|
1276 | 1276 | } |
1277 | 1277 | |
1278 | 1278 | |
@@ -1286,11 +1286,11 @@ discard block |
||
1286 | 1286 | * @param bool $save |
1287 | 1287 | * @return bool |
1288 | 1288 | */ |
1289 | - public function toggle_failed_transaction_status( $save = true ) { |
|
1289 | + public function toggle_failed_transaction_status($save = true) { |
|
1290 | 1290 | // if TXN status is still set as "failed"... |
1291 | - if ( $this->status_ID() === EEM_Transaction::failed_status_code ) { |
|
1292 | - $this->set_status( EEM_Transaction::abandoned_status_code ); |
|
1293 | - if ( $save ) { |
|
1291 | + if ($this->status_ID() === EEM_Transaction::failed_status_code) { |
|
1292 | + $this->set_status(EEM_Transaction::abandoned_status_code); |
|
1293 | + if ($save) { |
|
1294 | 1294 | $this->save(); |
1295 | 1295 | } |
1296 | 1296 | return true; |
@@ -1319,10 +1319,10 @@ discard block |
||
1319 | 1319 | $this->primary_registration() instanceof EE_Registration |
1320 | 1320 | && $this->primary_registration()->attendee() instanceof EE_Attendee |
1321 | 1321 | ) { |
1322 | - $this->set_status( EEM_Transaction::incomplete_status_code ); |
|
1322 | + $this->set_status(EEM_Transaction::incomplete_status_code); |
|
1323 | 1323 | } else { |
1324 | 1324 | // no contact record? yer abandoned! |
1325 | - $this->set_status( EEM_Transaction::abandoned_status_code ); |
|
1325 | + $this->set_status(EEM_Transaction::abandoned_status_code); |
|
1326 | 1326 | } |
1327 | 1327 | return true; |
1328 | 1328 | } |
@@ -1336,16 +1336,16 @@ discard block |
||
1336 | 1336 | * updates the TXN status based on the amount paid |
1337 | 1337 | */ |
1338 | 1338 | public function verify_abandoned_transaction_status() { |
1339 | - if ( $this->status_ID() !== EEM_Transaction::abandoned_status_code ) { |
|
1339 | + if ($this->status_ID() !== EEM_Transaction::abandoned_status_code) { |
|
1340 | 1340 | return; |
1341 | 1341 | } |
1342 | - $payments = $this->get_many_related( 'Payment' ); |
|
1343 | - if ( ! empty( $payments ) ) { |
|
1344 | - foreach ( $payments as $payment ) { |
|
1345 | - if ( $payment instanceof EE_Payment ) { |
|
1342 | + $payments = $this->get_many_related('Payment'); |
|
1343 | + if ( ! empty($payments)) { |
|
1344 | + foreach ($payments as $payment) { |
|
1345 | + if ($payment instanceof EE_Payment) { |
|
1346 | 1346 | // kk this TXN should NOT be abandoned |
1347 | 1347 | $this->update_status_based_on_total_paid(); |
1348 | - if ( is_admin() && ! ( defined('DOING_AJAX') && DOING_AJAX ) ) { |
|
1348 | + if (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)) { |
|
1349 | 1349 | EE_Error::add_attention( |
1350 | 1350 | sprintf( |
1351 | 1351 | esc_html__( |
@@ -1361,8 +1361,8 @@ discard block |
||
1361 | 1361 | $finalized = $this->final_reg_step_completed(); |
1362 | 1362 | // if the 'finalize_registration' step has been initiated (has a timestamp) |
1363 | 1363 | // but has not yet been fully completed (TRUE) |
1364 | - if ( is_int( $finalized ) && $finalized !== false && $finalized !== true ) { |
|
1365 | - $this->set_reg_step_completed( 'finalize_registration' ); |
|
1364 | + if (is_int($finalized) && $finalized !== false && $finalized !== true) { |
|
1365 | + $this->set_reg_step_completed('finalize_registration'); |
|
1366 | 1366 | $this->save(); |
1367 | 1367 | } |
1368 | 1368 | } |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
86 | - * _get_countries |
|
87 | - * |
|
88 | - * @access public |
|
89 | - * @return array |
|
90 | - */ |
|
86 | + * _get_countries |
|
87 | + * |
|
88 | + * @access public |
|
89 | + * @return array |
|
90 | + */ |
|
91 | 91 | public function get_all_countries() { |
92 | 92 | if ( ! self::$_all_countries ) { |
93 | 93 | self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 ))); |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * _get_countries |
|
100 | - * Gets and caches the list of active countries. If you know the list of active countries |
|
101 | - * has changed during this request, first use EEM_Country::reset() to flush the cache |
|
102 | - * @access public |
|
103 | - * @return array |
|
104 | - */ |
|
99 | + * _get_countries |
|
100 | + * Gets and caches the list of active countries. If you know the list of active countries |
|
101 | + * has changed during this request, first use EEM_Country::reset() to flush the cache |
|
102 | + * @access public |
|
103 | + * @return array |
|
104 | + */ |
|
105 | 105 | public function get_all_active_countries() { |
106 | 106 | if ( ! self::$_active_countries ) { |
107 | 107 | self::$_active_countries = $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 ))); |
@@ -36,15 +36,15 @@ discard block |
||
36 | 36 | * Resets the country |
37 | 37 | * @return EEM_Country |
38 | 38 | */ |
39 | - public static function reset( $timezone = NULL ){ |
|
39 | + public static function reset($timezone = NULL) { |
|
40 | 40 | self::$_active_countries = NULL; |
41 | 41 | self::$_all_countries = NULL; |
42 | - return parent::reset( $timezone ); |
|
42 | + return parent::reset($timezone); |
|
43 | 43 | } |
44 | 44 | |
45 | - protected function __construct( $timezone = NULL ){ |
|
46 | - $this->singular_item = __('Country','event_espresso'); |
|
47 | - $this->plural_item = __('Countries','event_espresso'); |
|
45 | + protected function __construct($timezone = NULL) { |
|
46 | + $this->singular_item = __('Country', 'event_espresso'); |
|
47 | + $this->plural_item = __('Countries', 'event_espresso'); |
|
48 | 48 | |
49 | 49 | |
50 | 50 | $this->_tables = array( |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | ); |
53 | 53 | $this->_fields = array( |
54 | 54 | 'Country'=>array( |
55 | - 'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true), |
|
56 | - 'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')), |
|
57 | - 'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''), |
|
58 | - 'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID','event_espresso'), false,0),//should be a foreign key, but no region table exists yet |
|
59 | - 'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''), |
|
60 | - 'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false), |
|
61 | - 'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false), |
|
62 | - 'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false), |
|
63 | - 'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false), |
|
64 | - 'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true), |
|
65 | - 'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2), |
|
66 | - 'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'), |
|
67 | - 'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','), |
|
68 | - 'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''), |
|
69 | - 'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false) |
|
55 | + 'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true), |
|
56 | + 'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')), |
|
57 | + 'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''), |
|
58 | + 'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), //should be a foreign key, but no region table exists yet |
|
59 | + 'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''), |
|
60 | + 'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false), |
|
61 | + 'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false), |
|
62 | + 'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false), |
|
63 | + 'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false), |
|
64 | + 'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true), |
|
65 | + 'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2), |
|
66 | + 'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'), |
|
67 | + 'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','), |
|
68 | + 'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''), |
|
69 | + 'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false) |
|
70 | 70 | )); |
71 | 71 | $this->_model_relations = array( |
72 | 72 | 'Attendee'=>new EE_Has_Many_Relation(), |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | 'Venue'=>new EE_Has_Many_Relation(), |
75 | 75 | ); |
76 | 76 | //only anyone to view, but only those with the default role can do anything |
77 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
77 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
78 | 78 | |
79 | - parent::__construct( $timezone ); |
|
79 | + parent::__construct($timezone); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @return array |
90 | 90 | */ |
91 | 91 | public function get_all_countries() { |
92 | - if ( ! self::$_all_countries ) { |
|
93 | - self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 ))); |
|
92 | + if ( ! self::$_all_countries) { |
|
93 | + self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999))); |
|
94 | 94 | } |
95 | 95 | return self::$_all_countries; |
96 | 96 | } |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | * @return array |
104 | 104 | */ |
105 | 105 | public function get_all_active_countries() { |
106 | - if ( ! self::$_active_countries ) { |
|
107 | - self::$_active_countries = $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 ))); |
|
106 | + if ( ! self::$_active_countries) { |
|
107 | + self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999))); |
|
108 | 108 | } |
109 | 109 | return self::$_active_countries; |
110 | 110 | } |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @param string $country_ISO |
115 | 115 | * @return string |
116 | 116 | */ |
117 | - public function get_country_name_by_ISO( $country_ISO ){ |
|
118 | - if( isset( self::$_all_countries[ $country_ISO ] ) && |
|
119 | - self::$_all_countries[ $country_ISO ] instanceof EE_Country ){ |
|
120 | - return self::$_all_countries[ $country_ISO ]->name(); |
|
117 | + public function get_country_name_by_ISO($country_ISO) { |
|
118 | + if (isset(self::$_all_countries[$country_ISO]) && |
|
119 | + self::$_all_countries[$country_ISO] instanceof EE_Country) { |
|
120 | + return self::$_all_countries[$country_ISO]->name(); |
|
121 | 121 | } |
122 | - $names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' ); |
|
123 | - if( is_array( $names ) && ! empty( $names ) ){ |
|
124 | - return reset( $names ); |
|
125 | - }else{ |
|
122 | + $names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name'); |
|
123 | + if (is_array($names) && ! empty($names)) { |
|
124 | + return reset($names); |
|
125 | + } else { |
|
126 | 126 | return ''; |
127 | 127 | } |
128 | 128 | } |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -122,7 +124,7 @@ discard block |
||
122 | 124 | $names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' ); |
123 | 125 | if( is_array( $names ) && ! empty( $names ) ){ |
124 | 126 | return reset( $names ); |
125 | - }else{ |
|
127 | + } else{ |
|
126 | 128 | return ''; |
127 | 129 | } |
128 | 130 | } |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -75,12 +76,12 @@ discard block |
||
75 | 76 | if($payment_method_type instanceof EE_PMT_Base && |
76 | 77 | $payment_method_type->get_gateway()){ |
77 | 78 | $currencies_supported = $payment_method_type->get_gateway()->currencies_supported(); |
78 | - }else{ |
|
79 | + } else{ |
|
79 | 80 | $currencies_supported = EE_Gateway::all_currencies_supported; |
80 | 81 | } |
81 | 82 | if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) { |
82 | 83 | $currencies = $this->get_all_active(); |
83 | - }else{ |
|
84 | + } else{ |
|
84 | 85 | $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported)))); |
85 | 86 | } |
86 | 87 | return $currencies; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,32 +25,32 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEM_Currency extends EEM_Base{ |
|
28 | +class EEM_Currency extends EEM_Base { |
|
29 | 29 | // private instance of the Attendee object |
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | - protected function __construct( $timezone = NULL ) { |
|
33 | - $this->singular_item = __('Currency','event_espresso'); |
|
34 | - $this->plural_item = __('Currencies','event_espresso'); |
|
32 | + protected function __construct($timezone = NULL) { |
|
33 | + $this->singular_item = __('Currency', 'event_espresso'); |
|
34 | + $this->plural_item = __('Currencies', 'event_espresso'); |
|
35 | 35 | $this->_tables = array( |
36 | 36 | 'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code') |
37 | 37 | ); |
38 | 38 | $this->_fields = array( |
39 | 39 | 'Currency'=>array( |
40 | - 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code','event_espresso')), |
|
41 | - 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false), |
|
42 | - 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false), |
|
43 | - 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false), |
|
44 | - 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2), |
|
45 | - 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false,true), |
|
40 | + 'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso')), |
|
41 | + 'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false), |
|
42 | + 'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false), |
|
43 | + 'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false), |
|
44 | + 'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2), |
|
45 | + 'CUR_active'=>new EE_Boolean_Field('CUR_active', __('Active?', 'event_espresso'), false, true), |
|
46 | 46 | )); |
47 | 47 | $this->_model_relations = array( |
48 | 48 | 'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'), |
49 | 49 | ); |
50 | 50 | //this model is generally available for reading |
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
51 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
52 | 52 | |
53 | - parent::__construct( $timezone ); |
|
53 | + parent::__construct($timezone); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @param array $query_params see EEM_Base::get_all |
60 | 60 | * @return EE_Currency[] |
61 | 61 | */ |
62 | - public function get_all_active($query_params = array()){ |
|
62 | + public function get_all_active($query_params = array()) { |
|
63 | 63 | $query_params[0]['CUR_active'] = true; |
64 | - if( ! isset($query_params['order_by'])){ |
|
65 | - $query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC'); |
|
64 | + if ( ! isset($query_params['order_by'])) { |
|
65 | + $query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC'); |
|
66 | 66 | } |
67 | 67 | return $this->get_all($query_params); |
68 | 68 | } |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @param EE_PMT_Base $payment_method_type |
72 | 72 | * @return EE_Currency[] |
73 | 73 | */ |
74 | - public function get_all_currencies_usable_by($payment_method_type){ |
|
75 | - if($payment_method_type instanceof EE_PMT_Base && |
|
76 | - $payment_method_type->get_gateway()){ |
|
74 | + public function get_all_currencies_usable_by($payment_method_type) { |
|
75 | + if ($payment_method_type instanceof EE_PMT_Base && |
|
76 | + $payment_method_type->get_gateway()) { |
|
77 | 77 | $currencies_supported = $payment_method_type->get_gateway()->currencies_supported(); |
78 | - }else{ |
|
78 | + } else { |
|
79 | 79 | $currencies_supported = EE_Gateway::all_currencies_supported; |
80 | 80 | } |
81 | - if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) { |
|
81 | + if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) { |
|
82 | 82 | $currencies = $this->get_all_active(); |
83 | - }else{ |
|
84 | - $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported)))); |
|
83 | + } else { |
|
84 | + $currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported)))); |
|
85 | 85 | } |
86 | 86 | return $currencies; |
87 | 87 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -25,22 +25,22 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEM_Currency_Payment_Method extends EEM_Base{ |
|
28 | +class EEM_Currency_Payment_Method extends EEM_Base { |
|
29 | 29 | // private instance of the Attendee object |
30 | 30 | protected static $_instance = NULL; |
31 | 31 | |
32 | 32 | |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singular_item = __('Currency Usable by Payment Method','event_espresso'); |
|
35 | - $this->plural_item = __('Currencies Usable by Payment Methods','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singular_item = __('Currency Usable by Payment Method', 'event_espresso'); |
|
35 | + $this->plural_item = __('Currencies Usable by Payment Methods', 'event_espresso'); |
|
36 | 36 | $this->_tables = array( |
37 | - 'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method','CPM_ID') |
|
37 | + 'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID') |
|
38 | 38 | ); |
39 | 39 | $this->_fields = array( |
40 | 40 | 'Currency_Payment_Method'=>array( |
41 | - 'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID','event_espresso')), |
|
42 | - 'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code','event_espresso'), false, 0, 'Currency'), |
|
43 | - 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID','event_espresso'), false, 0, 'Payment_Method') |
|
41 | + 'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID', 'event_espresso')), |
|
42 | + 'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso'), false, 0, 'Currency'), |
|
43 | + 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID', 'event_espresso'), false, 0, 'Payment_Method') |
|
44 | 44 | ) |
45 | 45 | ); |
46 | 46 | $this->_model_relations = array( |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | 'Payment_Method'=>new EE_Belongs_To_Relation() |
49 | 49 | ); |
50 | 50 | //this model is generally available for reading |
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
51 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
52 | 52 | $this->_caps_slug = 'payment_methods'; |
53 | - parent::__construct( $timezone ); |
|
53 | + parent::__construct($timezone); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 |
@@ -1,7 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('No direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Datetime_Ticket.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Datetime_Ticket.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Datetime_Ticket extends EEM_Base { |
28 | 28 | |
@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | * @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) |
38 | 38 | * @return void |
39 | 39 | */ |
40 | - protected function __construct( $timezone ) { |
|
41 | - $this->singular_item = __('Datetime Ticket','event_espresso'); |
|
42 | - $this->plural_item = __('Datetime Tickets','event_espresso'); |
|
40 | + protected function __construct($timezone) { |
|
41 | + $this->singular_item = __('Datetime Ticket', 'event_espresso'); |
|
42 | + $this->plural_item = __('Datetime Tickets', 'event_espresso'); |
|
43 | 43 | |
44 | 44 | $this->_tables = array( |
45 | 45 | 'Datetime_Ticket'=> new EE_Primary_Table('esp_datetime_ticket', 'DTK_ID') |
46 | 46 | ); |
47 | 47 | $this->_fields = array( |
48 | 48 | 'Datetime_Ticket'=>array( |
49 | - 'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID','event_espresso')), |
|
50 | - 'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime','event_espresso'), false, 0, 'Datetime' ), |
|
51 | - 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket','event_espresso'), false, 0, 'Ticket' ) |
|
49 | + 'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID', 'event_espresso')), |
|
50 | + 'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime', 'event_espresso'), false, 0, 'Datetime'), |
|
51 | + 'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket', 'event_espresso'), false, 0, 'Ticket') |
|
52 | 52 | )); |
53 | 53 | $this->_model_relations = array( |
54 | 54 | 'Ticket'=>new EE_Belongs_To_Relation(), |
55 | 55 | 'Datetime'=>new EE_Belongs_To_Relation() |
56 | 56 | ); |
57 | 57 | //this model is generally available for reading |
58 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Datetime.Event' ); |
|
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' ); |
|
60 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' ); |
|
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event', EEM_Base::caps_edit ); |
|
62 | - parent::__construct( $timezone ); |
|
58 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Datetime.Event'); |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event'); |
|
60 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event'); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event', EEM_Base::caps_edit); |
|
62 | + parent::__construct($timezone); |
|
63 | 63 | } |
64 | 64 | } //end EEM_Datetime_Ticket class |
65 | 65 | \ No newline at end of file |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -7,16 +7,16 @@ |
||
7 | 7 | */ |
8 | 8 | if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
9 | 9 | /** |
10 | - * EEM_Event_Message_Template |
|
11 | - * Model for relation table between EEM_Message_Template_Group and EEM_Event |
|
12 | - * |
|
13 | - * @package Event Espresso |
|
14 | - * @subpackage models |
|
15 | - * @since 4.3.0 |
|
16 | - * @author Darren Ethier |
|
17 | - * |
|
18 | - * ------------------------------------------------------------------------ |
|
19 | - */ |
|
10 | + * EEM_Event_Message_Template |
|
11 | + * Model for relation table between EEM_Message_Template_Group and EEM_Event |
|
12 | + * |
|
13 | + * @package Event Espresso |
|
14 | + * @subpackage models |
|
15 | + * @since 4.3.0 |
|
16 | + * @author Darren Ethier |
|
17 | + * |
|
18 | + * ------------------------------------------------------------------------ |
|
19 | + */ |
|
20 | 20 | require_once( EE_MODELS . 'EEM_Base.model.php' ); |
21 | 21 | |
22 | 22 | class EEM_Event_Message_Template extends EEM_Base { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * ------------------------------------------------------------------------ |
19 | 19 | */ |
20 | -require_once( EE_MODELS . 'EEM_Base.model.php' ); |
|
20 | +require_once(EE_MODELS.'EEM_Base.model.php'); |
|
21 | 21 | |
22 | 22 | class EEM_Event_Message_Template extends EEM_Base { |
23 | 23 | |
@@ -30,29 +30,29 @@ discard block |
||
30 | 30 | * @access private |
31 | 31 | * @return void |
32 | 32 | */ |
33 | - protected function __construct( $timezone = NULL ) { |
|
34 | - $this->singlular_item = __('Event Message Template','event_espresso'); |
|
35 | - $this->plural_item = __('Event Message Templates','event_espresso'); |
|
33 | + protected function __construct($timezone = NULL) { |
|
34 | + $this->singlular_item = __('Event Message Template', 'event_espresso'); |
|
35 | + $this->plural_item = __('Event Message Templates', 'event_espresso'); |
|
36 | 36 | |
37 | 37 | $this->_tables = array( |
38 | 38 | 'Event_Message_Template'=> new EE_Primary_Table('esp_event_message_template', 'EMT_ID') |
39 | 39 | ); |
40 | 40 | $this->_fields = array( |
41 | 41 | 'Event_Message_Template'=>array( |
42 | - 'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID','event_espresso')), |
|
43 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event','event_espresso'), false, 0, 'Event' ), |
|
44 | - 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group','event_espresso'), false, 0, 'Message_Template_Group' ) |
|
42 | + 'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID', 'event_espresso')), |
|
43 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event', 'event_espresso'), false, 0, 'Event'), |
|
44 | + 'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group', 'event_espresso'), false, 0, 'Message_Template_Group') |
|
45 | 45 | )); |
46 | 46 | $this->_model_relations = array( |
47 | 47 | 'Event'=>new EE_Belongs_To_Relation(), |
48 | 48 | 'Message_Template_Group'=>new EE_Belongs_To_Relation() |
49 | 49 | ); |
50 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
51 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
52 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
53 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
50 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
51 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
52 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
53 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
54 | 54 | |
55 | - parent::__construct( $timezone ); |
|
55 | + parent::__construct($timezone); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | * @param int $GRP_ID The MTP group we want attached events for. |
67 | 67 | * @return array An array of event ids. |
68 | 68 | */ |
69 | - public function get_attached_event_ids( $GRP_ID ) { |
|
70 | - $event_ids = $this->_get_all_wpdb_results( array( array( 'GRP_ID' => $GRP_ID ) ), ARRAY_N, 'EVT_ID' ); |
|
71 | - $event_ids = call_user_func_array( 'array_merge', $event_ids ); |
|
69 | + public function get_attached_event_ids($GRP_ID) { |
|
70 | + $event_ids = $this->_get_all_wpdb_results(array(array('GRP_ID' => $GRP_ID)), ARRAY_N, 'EVT_ID'); |
|
71 | + $event_ids = call_user_func_array('array_merge', $event_ids); |
|
72 | 72 | return $event_ids; |
73 | 73 | } |
74 | 74 | |
@@ -81,17 +81,17 @@ discard block |
||
81 | 81 | * GRPIDs. |
82 | 82 | * @return int How many rows were deleted. |
83 | 83 | */ |
84 | - public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) { |
|
85 | - if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) |
|
86 | - throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) ); |
|
84 | + public function delete_event_group_relations($GRP_IDs = array(), $EVT_IDs = array()) { |
|
85 | + if (empty($GRP_IDs) && empty($EVT_IDs)) |
|
86 | + throw new EE_Error(sprintf(__('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso'), __METHOD__)); |
|
87 | 87 | |
88 | - if ( !empty( $GRP_IDs ) ) |
|
89 | - $where['GRP_ID'] = array( 'IN', (array) $GRP_IDs ); |
|
88 | + if ( ! empty($GRP_IDs)) |
|
89 | + $where['GRP_ID'] = array('IN', (array) $GRP_IDs); |
|
90 | 90 | |
91 | - if ( !empty( $EVT_IDs ) ) |
|
92 | - $where['EVT_ID'] = array( 'IN', (array) $EVT_IDs ); |
|
91 | + if ( ! empty($EVT_IDs)) |
|
92 | + $where['EVT_ID'] = array('IN', (array) $EVT_IDs); |
|
93 | 93 | |
94 | - return $this->delete( array( $where ), FALSE ); |
|
94 | + return $this->delete(array($where), FALSE); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | } //end class EEM_Event_Message_Template |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage models |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | - if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | + if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | + } |
|
9 | 11 | /** |
10 | 12 | * EEM_Event_Message_Template |
11 | 13 | * Model for relation table between EEM_Message_Template_Group and EEM_Event |
@@ -82,14 +84,17 @@ discard block |
||
82 | 84 | * @return int How many rows were deleted. |
83 | 85 | */ |
84 | 86 | public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) { |
85 | - if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) |
|
86 | - throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) ); |
|
87 | + if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) { |
|
88 | + throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) ); |
|
89 | + } |
|
87 | 90 | |
88 | - if ( !empty( $GRP_IDs ) ) |
|
89 | - $where['GRP_ID'] = array( 'IN', (array) $GRP_IDs ); |
|
91 | + if ( !empty( $GRP_IDs ) ) { |
|
92 | + $where['GRP_ID'] = array( 'IN', (array) $GRP_IDs ); |
|
93 | + } |
|
90 | 94 | |
91 | - if ( !empty( $EVT_IDs ) ) |
|
92 | - $where['EVT_ID'] = array( 'IN', (array) $EVT_IDs ); |
|
95 | + if ( !empty( $EVT_IDs ) ) { |
|
96 | + $where['EVT_ID'] = array( 'IN', (array) $EVT_IDs ); |
|
97 | + } |
|
93 | 98 | |
94 | 99 | return $this->delete( array( $where ), FALSE ); |
95 | 100 | } |
@@ -5,24 +5,24 @@ discard block |
||
5 | 5 | * You'll need to use each's EE_Has_Many_Relation relation to this model. Eg, when querying for question groups which apply to primary attendees, |
6 | 6 | * you'd do a query like EEM_Question_Group::instance()->get_all(array(array('Event_Question_Group.EQG_primary'=>1))); |
7 | 7 | */ |
8 | -require_once( EE_CLASSES . 'EE_Event_Question_Group.class.php'); |
|
8 | +require_once(EE_CLASSES.'EE_Event_Question_Group.class.php'); |
|
9 | 9 | |
10 | -class EEM_Event_Question_Group extends EEM_Base{ |
|
10 | +class EEM_Event_Question_Group extends EEM_Base { |
|
11 | 11 | // private instance of the Attendee object |
12 | 12 | protected static $_instance = NULL; |
13 | 13 | |
14 | - protected function __construct( $timezone = NULL ) { |
|
15 | - $this->singular_item = __('Event to Question Group Link','event_espresso'); |
|
16 | - $this->plural_item = __('Event to Question Group Links','event_espresso'); |
|
14 | + protected function __construct($timezone = NULL) { |
|
15 | + $this->singular_item = __('Event to Question Group Link', 'event_espresso'); |
|
16 | + $this->plural_item = __('Event to Question Group Links', 'event_espresso'); |
|
17 | 17 | $this->_tables = array( |
18 | - 'Event_Question_Group'=>new EE_Primary_Table('esp_event_question_group','EQG_ID') |
|
18 | + 'Event_Question_Group'=>new EE_Primary_Table('esp_event_question_group', 'EQG_ID') |
|
19 | 19 | ); |
20 | 20 | $this->_fields = array( |
21 | 21 | 'Event_Question_Group'=>array( |
22 | - 'EQG_ID'=>new EE_Primary_Key_Int_Field('EQG_ID', __('Event to Question Group Link ID','event_espresso')), |
|
23 | - 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'), |
|
24 | - 'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group Id','event_espresso'), false, 0, 'Question_Group'), |
|
25 | - 'EQG_primary'=>new EE_Boolean_Field('EQG_primary', __('Flag indicating question is only for primary attendees','event_espresso'), false, false) |
|
22 | + 'EQG_ID'=>new EE_Primary_Key_Int_Field('EQG_ID', __('Event to Question Group Link ID', 'event_espresso')), |
|
23 | + 'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
24 | + 'QSG_ID'=>new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group Id', 'event_espresso'), false, 0, 'Question_Group'), |
|
25 | + 'EQG_primary'=>new EE_Boolean_Field('EQG_primary', __('Flag indicating question is only for primary attendees', 'event_espresso'), false, false) |
|
26 | 26 | ) |
27 | 27 | ); |
28 | 28 | $this->_model_relations = array( |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | 'Question_Group'=>new EE_Belongs_To_Relation() |
31 | 31 | ); |
32 | 32 | //this model is generally available for reading |
33 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' ); |
|
34 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
35 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' ); |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit ); |
|
37 | - parent::__construct( $timezone ); |
|
33 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); |
|
34 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
35 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); |
|
36 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); |
|
37 | + parent::__construct($timezone); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 |