@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * Payment Model |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @author Michael Nelson, Brent Christensen |
10 | 10 | * |
11 | 11 | */ |
12 | -class EEM_Payment extends EEM_Base implements EEMI_Payment{ |
|
12 | +class EEM_Payment extends EEM_Base implements EEMI_Payment { |
|
13 | 13 | |
14 | 14 | // private instance of the Payment object |
15 | 15 | protected static $_instance = NULL; |
@@ -57,28 +57,28 @@ discard block |
||
57 | 57 | * @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) |
58 | 58 | * @return EEM_Payment |
59 | 59 | */ |
60 | - protected function __construct( $timezone ) { |
|
60 | + protected function __construct($timezone) { |
|
61 | 61 | |
62 | - $this->singular_item = __('Payment','event_espresso'); |
|
63 | - $this->plural_item = __('Payments','event_espresso'); |
|
62 | + $this->singular_item = __('Payment', 'event_espresso'); |
|
63 | + $this->plural_item = __('Payments', 'event_espresso'); |
|
64 | 64 | |
65 | 65 | $this->_tables = array( |
66 | - 'Payment'=>new EE_Primary_Table('esp_payment','PAY_ID') |
|
66 | + 'Payment'=>new EE_Primary_Table('esp_payment', 'PAY_ID') |
|
67 | 67 | ); |
68 | 68 | $this->_fields = array( |
69 | 69 | 'Payment'=>array( |
70 | - 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID','event_espresso')), |
|
71 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
72 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
73 | - 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
74 | - 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment','event_espresso'), false, 'CART'), |
|
75 | - 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for','event_espresso'), false, 0), |
|
70 | + 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso')), |
|
71 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
72 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
73 | + 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
74 | + 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment', 'event_espresso'), false, 'CART'), |
|
75 | + 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for', 'event_espresso'), false, 0), |
|
76 | 76 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Payment Method ID", 'event_espresso'), false, NULL, 'Payment_Method'), |
77 | - 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment','event_espresso'), false, ''), |
|
78 | - 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number','event_espresso'), true, ''), |
|
79 | - 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number','event_espresso'), true, ''), |
|
80 | - 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info','event_espresso'), true, ''), |
|
81 | - 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment','event_espresso'), true, ''), |
|
77 | + 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment', 'event_espresso'), false, ''), |
|
78 | + 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number', 'event_espresso'), true, ''), |
|
79 | + 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number', 'event_espresso'), true, ''), |
|
80 | + 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info', 'event_espresso'), true, ''), |
|
81 | + 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment', 'event_espresso'), true, ''), |
|
82 | 82 | 'PAY_redirect_url'=>new EE_Plain_Text_Field('PAY_redirect_url', __("Redirect URL", 'event_espresso'), true), |
83 | 83 | 'PAY_redirect_args'=>new EE_Serialized_Text_Field('PAY_redirect_args', __("Key-Value POST vars to send along with redirect", 'event_espresso'), true) |
84 | 84 | ) |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | 'Status'=> new EE_Belongs_To_Relation(), |
89 | 89 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
90 | 90 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
91 | - 'Registration' => new EE_HABTM_Relation( 'Registration_Payment' ), |
|
91 | + 'Registration' => new EE_HABTM_Relation('Registration_Payment'), |
|
92 | 92 | ); |
93 | 93 | $this->_model_chain_to_wp_user = 'Payment_Method'; |
94 | 94 | $this->_caps_slug = 'transactions'; |
95 | - parent::__construct( $timezone ); |
|
95 | + parent::__construct($timezone); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $PAY_txn_id_chq_nmbr |
105 | 105 | * @return EE_Payment |
106 | 106 | */ |
107 | - public function get_payment_by_txn_id_chq_nmbr( $PAY_txn_id_chq_nmbr ){ |
|
107 | + public function get_payment_by_txn_id_chq_nmbr($PAY_txn_id_chq_nmbr) { |
|
108 | 108 | return $this->get_one(array(array('PAY_txn_id_chq_nmbr'=>$PAY_txn_id_chq_nmbr))); |
109 | 109 | } |
110 | 110 | |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | * @param string $status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status |
121 | 121 | * @return EE_Payment[] |
122 | 122 | */ |
123 | - public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) { |
|
123 | + public function get_payments_for_transaction($TXN_ID = FALSE, $status_of_payment = null) { |
|
124 | 124 | // all payments for a TXN ordered chronologically |
125 | - $query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
125 | + $query_params = array(array('TXN_ID' => $TXN_ID), 'order_by' => array('PAY_timestamp' => 'ASC')); |
|
126 | 126 | // if provided with a status, search specifically for that status. Otherwise get them all |
127 | - if ( $status_of_payment ){ |
|
127 | + if ($status_of_payment) { |
|
128 | 128 | $query_params[0]['STS_ID'] = $status_of_payment; |
129 | 129 | } |
130 | 130 | // retrieve payments |
131 | - return $this->get_all ( $query_params ); |
|
131 | + return $this->get_all($query_params); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @param int $TXN_ID |
139 | 139 | * @return EE_Payment[] |
140 | 140 | */ |
141 | - public function get_approved_payments_for_transaction( $TXN_ID = 0 ) { |
|
142 | - return $this->get_payments_for_transaction( $TXN_ID, EEM_Payment::status_id_approved ); |
|
141 | + public function get_approved_payments_for_transaction($TXN_ID = 0) { |
|
142 | + return $this->get_payments_for_transaction($TXN_ID, EEM_Payment::status_id_approved); |
|
143 | 143 | |
144 | 144 | } |
145 | 145 | |
@@ -160,36 +160,36 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return EE_Payment[] |
162 | 162 | */ |
163 | - public function get_payments_made_between_dates( $start_date = '', $end_date = '', $format = '', $timezone = '' ) { |
|
164 | - $timezone = empty( $timezone ) ? EEH_DTT_Helper::get_timezone() : $timezone; |
|
163 | + public function get_payments_made_between_dates($start_date = '', $end_date = '', $format = '', $timezone = '') { |
|
164 | + $timezone = empty($timezone) ? EEH_DTT_Helper::get_timezone() : $timezone; |
|
165 | 165 | //if $start_date or $end date, verify $format is included. |
166 | - if ( ( ! empty( $start_date ) || ! empty( $end_date ) ) && empty( $format ) ) { |
|
167 | - throw new EE_Error( __('You included a start date and/or a end date for this method but did not include a format string. The format string is needed for setting up the query', 'event_espresso' ) ); |
|
166 | + if (( ! empty($start_date) || ! empty($end_date)) && empty($format)) { |
|
167 | + throw new EE_Error(__('You included a start date and/or a end date for this method but did not include a format string. The format string is needed for setting up the query', 'event_espresso')); |
|
168 | 168 | } |
169 | - $now = new DateTime( 'now' ); |
|
169 | + $now = new DateTime('now'); |
|
170 | 170 | // setup timezone objects once |
171 | - $modelDateTimeZone = new DateTimeZone( $this->_timezone ); |
|
172 | - $passedDateTimeZone = new DateTimeZone( $timezone ); |
|
171 | + $modelDateTimeZone = new DateTimeZone($this->_timezone); |
|
172 | + $passedDateTimeZone = new DateTimeZone($timezone); |
|
173 | 173 | // setup start date |
174 | - $start_date = ! empty( $start_date ) ? date_create_from_format( $format, $start_date, $passedDateTimeZone ) : $now; |
|
175 | - $start_date->setTimeZone( $modelDateTimeZone ); |
|
176 | - $start_date = $start_date->format( 'Y-m-d' ) . ' 00:00:00'; |
|
177 | - $start_date = strtotime( $start_date ); |
|
174 | + $start_date = ! empty($start_date) ? date_create_from_format($format, $start_date, $passedDateTimeZone) : $now; |
|
175 | + $start_date->setTimeZone($modelDateTimeZone); |
|
176 | + $start_date = $start_date->format('Y-m-d').' 00:00:00'; |
|
177 | + $start_date = strtotime($start_date); |
|
178 | 178 | // setup end date |
179 | - $end_date = ! empty( $end_date ) ? date_create_from_format( $format, $end_date, $passedDateTimeZone ) : $now; |
|
180 | - $end_date->setTimeZone( $modelDateTimeZone ); |
|
181 | - $end_date = $end_date->format('Y-m-d') . ' 23:59:59'; |
|
182 | - $end_date = strtotime( $end_date ); |
|
179 | + $end_date = ! empty($end_date) ? date_create_from_format($format, $end_date, $passedDateTimeZone) : $now; |
|
180 | + $end_date->setTimeZone($modelDateTimeZone); |
|
181 | + $end_date = $end_date->format('Y-m-d').' 23:59:59'; |
|
182 | + $end_date = strtotime($end_date); |
|
183 | 183 | |
184 | 184 | // make sure our start date is the lowest value and vice versa |
185 | - $start = min( $start_date, $end_date ); |
|
186 | - $end = max( $start_date, $end_date ); |
|
185 | + $start = min($start_date, $end_date); |
|
186 | + $end = max($start_date, $end_date); |
|
187 | 187 | |
188 | 188 | //yes we generated the date and time string in utc but we WANT this start date and time used in the set timezone on the model. |
189 | - $start_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $start ) . ' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone() ); |
|
190 | - $end_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $end) . ' 23:59:59' , 'Y-m-d H:i:s', $this->get_timezone() ); |
|
189 | + $start_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $start).' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone()); |
|
190 | + $end_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $end).' 23:59:59', 'Y-m-d H:i:s', $this->get_timezone()); |
|
191 | 191 | |
192 | - return $this->get_all(array(array('PAY_timestamp'=>array('>=',$start_date),'PAY_timestamp*'=>array('<=',$end_date)))); |
|
192 | + return $this->get_all(array(array('PAY_timestamp'=>array('>=', $start_date), 'PAY_timestamp*'=>array('<=', $end_date)))); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -199,35 +199,35 @@ discard block |
||
199 | 199 | * returns a string for the approved status |
200 | 200 | * @return string |
201 | 201 | */ |
202 | - function approved_status(){ |
|
202 | + function approved_status() { |
|
203 | 203 | return self::status_id_approved; |
204 | 204 | } |
205 | 205 | /** |
206 | 206 | * returns a string for the pending status |
207 | 207 | * @return string |
208 | 208 | */ |
209 | - function pending_status(){ |
|
209 | + function pending_status() { |
|
210 | 210 | return self::status_id_pending; |
211 | 211 | } |
212 | 212 | /** |
213 | 213 | * returns a string for the cancelled status |
214 | 214 | * @return string |
215 | 215 | */ |
216 | - function cancelled_status(){ |
|
216 | + function cancelled_status() { |
|
217 | 217 | return self::status_id_cancelled; |
218 | 218 | } |
219 | 219 | /** |
220 | 220 | * returns a string for the failed status |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - function failed_status(){ |
|
223 | + function failed_status() { |
|
224 | 224 | return self::status_id_failed; |
225 | 225 | } |
226 | 226 | /** |
227 | 227 | * returns a string for the declined status |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - function declined_status(){ |
|
230 | + function declined_status() { |
|
231 | 231 | return self::status_id_declined; |
232 | 232 | } |
233 | 233 |
@@ -21,16 +21,16 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
25 | 25 | |
26 | 26 | class EEM_Venue extends EEM_CPT_Base { |
27 | 27 | |
28 | 28 | // private instance of the Attendee object |
29 | 29 | protected static $_instance = NULL; |
30 | 30 | |
31 | - protected function __construct( $timezone = NULL ) { |
|
32 | - $this->singular_item = __('Venue','event_espresso'); |
|
33 | - $this->plural_item = __('Venues','event_espresso'); |
|
31 | + protected function __construct($timezone = NULL) { |
|
32 | + $this->singular_item = __('Venue', 'event_espresso'); |
|
33 | + $this->plural_item = __('Venues', 'event_espresso'); |
|
34 | 34 | $this->_tables = array( |
35 | 35 | 'Venue_CPT'=> new EE_Primary_Table('posts', 'ID'), |
36 | 36 | 'Venue_Meta'=>new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID') |
@@ -39,32 +39,32 @@ discard block |
||
39 | 39 | 'Venue_CPT'=>array( |
40 | 40 | 'VNU_ID'=>new EE_Primary_Key_Int_Field('ID', __("Venue ID", "event_espresso")), |
41 | 41 | 'VNU_name'=>new EE_Plain_Text_Field('post_title', __("Venue Name", "event_espresso"), false, ''), |
42 | - 'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false,''), |
|
43 | - 'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false,''), |
|
44 | - 'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, EE_Datetime_Field::now ), |
|
45 | - 'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true,''), |
|
46 | - 'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, EE_Datetime_Field::now ), |
|
47 | - 'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false ), |
|
48 | - 'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false,0), |
|
42 | + 'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false, ''), |
|
43 | + 'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false, ''), |
|
44 | + 'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, EE_Datetime_Field::now), |
|
45 | + 'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true, ''), |
|
46 | + 'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, EE_Datetime_Field::now), |
|
47 | + 'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false), |
|
48 | + 'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false, 0), |
|
49 | 49 | 'VNU_order'=>new EE_Integer_Field('menu_order', __("Venue order", "event_espresso"), false, 1), |
50 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'),// EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'), |
|
50 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'), // EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'), |
|
51 | 51 | ), |
52 | 52 | 'Venue_Meta'=>array( |
53 | 53 | 'VNUM_ID'=>new EE_DB_Only_Int_Field('VNUM_ID', __("ID of Venue Meta Row", "event_espresso"), false), |
54 | 54 | 'VNU_ID_fk'=>new EE_DB_Only_Int_Field('VNU_ID', __("Foreign Key to Venue Post ", "event_espresso"), false), |
55 | 55 | 'VNU_address'=>new EE_Plain_Text_Field('VNU_address', __("Venue Address line 1", "event_espresso"), true, ''), |
56 | - 'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true,''), |
|
56 | + 'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true, ''), |
|
57 | 57 | 'VNU_city'=>new EE_Plain_Text_Field('VNU_city', __("Venue City", "event_espresso"), true, ''), |
58 | 58 | 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __("State ID", "event_espresso"), true, null, 'State'), |
59 | 59 | 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __("Country Code", "event_espresso"), true, null, 'Country'), |
60 | 60 | 'VNU_zip'=>new EE_Plain_Text_Field('VNU_zip', __("Venue Zip/Postal Code", "event_espresso"), true), |
61 | 61 | 'VNU_phone'=>new EE_Plain_Text_Field('VNU_phone', __("Venue Phone", "event_espresso"), true), |
62 | - 'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true,EE_INF), |
|
62 | + 'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true, EE_INF), |
|
63 | 63 | 'VNU_url'=>new EE_Plain_Text_Field('VNU_url', __('Venue Website', 'event_espresso'), true), |
64 | 64 | 'VNU_virtual_phone'=>new EE_Plain_Text_Field('VNU_virtual_phone', __('Call in Number', 'event_espresso'), true), |
65 | - 'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true ), |
|
66 | - 'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true ), |
|
67 | - 'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false ) |
|
65 | + 'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true), |
|
66 | + 'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true), |
|
67 | + 'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false) |
|
68 | 68 | |
69 | 69 | )); |
70 | 70 | $this->_model_relations = array( |
@@ -75,8 +75,8 @@ discard block |
||
75 | 75 | 'WP_User' => new EE_Belongs_To_Relation() |
76 | 76 | ); |
77 | 77 | //this model is generally available for reading |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
79 | - parent::__construct( $timezone ); |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
79 | + parent::__construct($timezone); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * |
24 | 24 | * ------------------------------------------------------------------------ |
25 | 25 | */ |
26 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
27 | -require_once ( EE_CLASSES . 'EE_Checkin.class.php' ); |
|
26 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
27 | +require_once (EE_CLASSES.'EE_Checkin.class.php'); |
|
28 | 28 | |
29 | 29 | class EEM_Checkin extends EEM_Base { |
30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * @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) |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - protected function __construct( $timezone = NULL ) { |
|
44 | - $this->singular_item = __('Check-In','event_espresso'); |
|
45 | - $this->plural_item = __('Check-Ins','event_espresso'); |
|
43 | + protected function __construct($timezone = NULL) { |
|
44 | + $this->singular_item = __('Check-In', 'event_espresso'); |
|
45 | + $this->plural_item = __('Check-Ins', 'event_espresso'); |
|
46 | 46 | |
47 | 47 | $this->_tables = array( |
48 | - 'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID') |
|
48 | + 'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID') |
|
49 | 49 | ); |
50 | 50 | $this->_fields = array( |
51 | 51 | 'Checkin'=> array( |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'), |
54 | 54 | 'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'), |
55 | 55 | 'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true), |
56 | - 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, EE_Datetime_Field::now, $timezone ) |
|
56 | + 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, EE_Datetime_Field::now, $timezone) |
|
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | $this->_model_relations = array( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | 'Datetime'=>new EE_Belongs_To_Relation() |
62 | 62 | ); |
63 | 63 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
64 | - parent::__construct( $timezone ); |
|
64 | + parent::__construct($timezone); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 |
@@ -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,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EEM_Change_Log extends EEM_Base{ |
|
28 | +class EEM_Change_Log extends EEM_Base { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * the related object was created log type |
@@ -68,19 +68,19 @@ discard block |
||
68 | 68 | * @access protected |
69 | 69 | * @return EEM_Change_Log |
70 | 70 | */ |
71 | - protected function __construct( $timezone = null ){ |
|
71 | + protected function __construct($timezone = null) { |
|
72 | 72 | global $current_user; |
73 | - $this->singular_item = __('Log','event_espresso'); |
|
74 | - $this->plural_item = __('Logs','event_espresso'); |
|
73 | + $this->singular_item = __('Log', 'event_espresso'); |
|
74 | + $this->plural_item = __('Logs', 'event_espresso'); |
|
75 | 75 | $this->_tables = array( |
76 | 76 | 'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID') |
77 | 77 | ); |
78 | 78 | $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models); |
79 | 79 | $this->_fields = array( |
80 | 80 | 'Log'=>array( |
81 | - 'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')), |
|
82 | - 'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now ), |
|
83 | - 'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to), |
|
81 | + 'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')), |
|
82 | + 'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, EE_Datetime_Field::now), |
|
83 | + 'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to), |
|
84 | 84 | 'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to), |
85 | 85 | 'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug, |
86 | 86 | array( |
@@ -92,24 +92,24 @@ discard block |
||
92 | 92 | self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'), |
93 | 93 | )), |
94 | 94 | 'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true), |
95 | - 'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ), |
|
95 | + 'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true), |
|
96 | 96 | |
97 | 97 | )); |
98 | 98 | $this->_model_relations = array(); |
99 | - foreach($models_this_can_attach_to as $model){ |
|
100 | - if( $model == 'WP_User' ){ |
|
101 | - $this->_model_relations[ $model ] = new EE_Belongs_To_Relation(); |
|
102 | - }elseif( $model != 'Change_Log' ) { |
|
99 | + foreach ($models_this_can_attach_to as $model) { |
|
100 | + if ($model == 'WP_User') { |
|
101 | + $this->_model_relations[$model] = new EE_Belongs_To_Relation(); |
|
102 | + }elseif ($model != 'Change_Log') { |
|
103 | 103 | $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation(); |
104 | 104 | } |
105 | 105 | } |
106 | 106 | //use completely custom caps for this |
107 | 107 | $this->_cap_restriction_generators = false; |
108 | 108 | //caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing |
109 | - foreach( $this->_cap_contexts_to_cap_action_map as $cap_context => $action ) { |
|
110 | - $this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] = new EE_Return_None_Where_Conditions(); |
|
109 | + foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) { |
|
110 | + $this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] = new EE_Return_None_Where_Conditions(); |
|
111 | 111 | } |
112 | - parent::__construct( $timezone ); |
|
112 | + parent::__construct($timezone); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | * @param EE_Base_Class $related_model_obj |
120 | 120 | * @return EE_Change_Log |
121 | 121 | */ |
122 | - public function log($log_type,$message,$related_model_obj){ |
|
123 | - if($related_model_obj instanceof EE_Base_Class){ |
|
122 | + public function log($log_type, $message, $related_model_obj) { |
|
123 | + if ($related_model_obj instanceof EE_Base_Class) { |
|
124 | 124 | $obj_id = $related_model_obj->ID(); |
125 | 125 | $obj_type = $related_model_obj->get_model()->get_this_model_name(); |
126 | - }else{ |
|
126 | + } else { |
|
127 | 127 | $obj_id = NULL; |
128 | 128 | $obj_type = NULL; |
129 | 129 | } |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * @throws EE_Error |
148 | 148 | * @return EE_Change_Log |
149 | 149 | */ |
150 | - public function gateway_log( $message, $related_obj_id, $related_obj_type ){ |
|
151 | - if( ! EE_Registry::instance()->is_model_name($related_obj_type)){ |
|
152 | - throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type)); |
|
150 | + public function gateway_log($message, $related_obj_id, $related_obj_type) { |
|
151 | + if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) { |
|
152 | + throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type)); |
|
153 | 153 | } |
154 | 154 | $log = EE_Change_Log::new_instance(array( |
155 | 155 | 'LOG_type'=>EEM_Change_Log::type_gateway, |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * @param array $query_params @see EEM_Base::get_all |
169 | 169 | * @return array of arrays |
170 | 170 | */ |
171 | - public function get_all_efficiently($query_params){ |
|
171 | + public function get_all_efficiently($query_params) { |
|
172 | 172 | return $this->_get_all_wpdb_results($query_params); |
173 | 173 | } |
174 | 174 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -21,60 +21,60 @@ discard block |
||
21 | 21 | * Please instead use the EEM_Attendee::system_question_* constants |
22 | 22 | * @deprecated |
23 | 23 | */ |
24 | - const fname_question_id=1; |
|
24 | + const fname_question_id = 1; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @deprecated |
28 | 28 | */ |
29 | - const lname_question_id=2; |
|
29 | + const lname_question_id = 2; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * @deprecated |
34 | 34 | */ |
35 | - const email_question_id=3; |
|
35 | + const email_question_id = 3; |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @deprecated |
40 | 40 | */ |
41 | - const address_question_id=4; |
|
41 | + const address_question_id = 4; |
|
42 | 42 | |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * @deprecated |
46 | 46 | */ |
47 | - const address2_question_id=5; |
|
47 | + const address2_question_id = 5; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | /** |
51 | 51 | * @deprecated |
52 | 52 | */ |
53 | - const city_question_id=6; |
|
53 | + const city_question_id = 6; |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @deprecated |
58 | 58 | */ |
59 | - const state_question_id=7; |
|
59 | + const state_question_id = 7; |
|
60 | 60 | |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @deprecated |
64 | 64 | */ |
65 | - const country_question_id=8; |
|
65 | + const country_question_id = 8; |
|
66 | 66 | |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * @deprecated |
70 | 70 | */ |
71 | - const zip_question_id=9; |
|
71 | + const zip_question_id = 9; |
|
72 | 72 | |
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @deprecated |
76 | 76 | */ |
77 | - const phone_question_id=10; |
|
77 | + const phone_question_id = 10; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * When looking for questions that correspond to attendee fields, |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | * @access protected |
120 | 120 | * @param null $timezone |
121 | 121 | */ |
122 | - protected function __construct( $timezone = NULL ) { |
|
123 | - $this->singular_item = __('Attendee','event_espresso'); |
|
124 | - $this->plural_item = __('Attendees','event_espresso'); |
|
122 | + protected function __construct($timezone = NULL) { |
|
123 | + $this->singular_item = __('Attendee', 'event_espresso'); |
|
124 | + $this->plural_item = __('Attendees', 'event_espresso'); |
|
125 | 125 | $this->_tables = array( |
126 | 126 | 'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'), |
127 | 127 | 'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID') |
@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | 'ATT_full_name'=>new EE_Plain_Text_Field('post_title', __("Attendee Full Name", "event_espresso"), false, __("Unknown", "event_espresso")), |
133 | 133 | 'ATT_bio'=>new EE_Post_Content_Field('post_content', __("Attendee Biography", "event_espresso"), false, __("No Biography Provided", "event_espresso")), |
134 | 134 | 'ATT_slug'=>new EE_Slug_Field('post_name', __("Attendee URL Slug", "event_espresso"), false), |
135 | - 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now ), |
|
135 | + 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, EE_Datetime_Field::now), |
|
136 | 136 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
137 | - 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now ), |
|
138 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
137 | + 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, EE_Datetime_Field::now), |
|
138 | + 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false), |
|
139 | 139 | 'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0), |
140 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
140 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
141 | 141 | 'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish') |
142 | 142 | ), |
143 | 143 | 'Attendee_Meta'=>array( |
144 | - 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false), |
|
144 | + 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false), |
|
145 | 145 | 'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false), |
146 | - 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''), |
|
147 | - 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''), |
|
148 | - 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''), |
|
149 | - 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''), |
|
150 | - 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''), |
|
151 | - 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'), |
|
152 | - 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'), |
|
153 | - 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''), |
|
154 | - 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''), |
|
155 | - 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '') |
|
146 | + 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''), |
|
147 | + 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''), |
|
148 | + 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''), |
|
149 | + 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''), |
|
150 | + 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''), |
|
151 | + 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'), |
|
152 | + 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'), |
|
153 | + 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''), |
|
154 | + 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''), |
|
155 | + 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '') |
|
156 | 156 | )); |
157 | 157 | $this->_model_relations = array( |
158 | 158 | 'Registration'=>new EE_Has_Many_Relation(), |
159 | 159 | 'State'=>new EE_Belongs_To_Relation(), |
160 | 160 | 'Country'=>new EE_Belongs_To_Relation(), |
161 | - 'Event'=>new EE_HABTM_Relation('Registration', FALSE ), |
|
161 | + 'Event'=>new EE_HABTM_Relation('Registration', FALSE), |
|
162 | 162 | 'WP_User' => new EE_Belongs_To_Relation(), |
163 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them. |
|
163 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them. |
|
164 | 164 | ); |
165 | 165 | $this->_caps_slug = 'contacts'; |
166 | - parent::__construct( $timezone ); |
|
166 | + parent::__construct($timezone); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * @param string $system_question_string |
174 | 174 | * @return string|null if not found |
175 | 175 | */ |
176 | - public function get_attendee_field_for_system_question( $system_question_string ) { |
|
177 | - return isset( $this->_system_question_to_attendee_field_name[ $system_question_string ] ) ? $this->_system_question_to_attendee_field_name[ $system_question_string ] : null; |
|
176 | + public function get_attendee_field_for_system_question($system_question_string) { |
|
177 | + return isset($this->_system_question_to_attendee_field_name[$system_question_string]) ? $this->_system_question_to_attendee_field_name[$system_question_string] : null; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | |
@@ -185,8 +185,8 @@ discard block |
||
185 | 185 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
186 | 186 | * @return EE_Attendee[] |
187 | 187 | */ |
188 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
189 | - return $this->get_all( array( array( |
|
188 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
189 | + return $this->get_all(array(array( |
|
190 | 190 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
191 | 191 | ))); |
192 | 192 | } |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | * @return mixed array on success, FALSE on fail |
202 | 202 | * @deprecated |
203 | 203 | */ |
204 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
204 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
205 | 205 | // retrieve a particular EE_Attendee |
206 | - return $this->get_one_by_ID( $ATT_ID ); |
|
206 | + return $this->get_one_by_ID($ATT_ID); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | |
@@ -216,14 +216,14 @@ discard block |
||
216 | 216 | * @param array $where_cols_n_values |
217 | 217 | * @return mixed array on success, FALSE on fail |
218 | 218 | */ |
219 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
219 | + public function get_attendee($where_cols_n_values = array()) { |
|
220 | 220 | |
221 | - if ( empty( $where_cols_n_values )) { |
|
221 | + if (empty($where_cols_n_values)) { |
|
222 | 222 | return FALSE; |
223 | 223 | } |
224 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
225 | - if ( ! empty( $attendee )) { |
|
226 | - return array_shift( $attendee ); |
|
224 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
225 | + if ( ! empty($attendee)) { |
|
226 | + return array_shift($attendee); |
|
227 | 227 | } else { |
228 | 228 | return FALSE; |
229 | 229 | } |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | * @param array $where_cols_n_values |
240 | 240 | * @return bool|mixed |
241 | 241 | */ |
242 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
242 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
243 | 243 | // search by combo of first and last names plus the email address |
244 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
244 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
245 | 245 | // no search params means attendee object already exists. |
246 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
246 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
247 | 247 | $valid_data = TRUE; |
248 | 248 | // check for required values |
249 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
250 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
251 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
249 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
250 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
251 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
252 | 252 | |
253 | - if ( $valid_data ) { |
|
254 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
255 | - if ( $attendee instanceof EE_Attendee ) { |
|
253 | + if ($valid_data) { |
|
254 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
255 | + if ($attendee instanceof EE_Attendee) { |
|
256 | 256 | return $attendee; |
257 | 257 | } |
258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | * @param array $ids array of EE_Registration ids |
271 | 271 | * @return EE_Attendee[] |
272 | 272 | */ |
273 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
273 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
274 | 274 | $ids = (array) $ids; |
275 | 275 | $_where = array( |
276 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
276 | + 'Registration.REG_ID' => array('in', $ids) |
|
277 | 277 | ); |
278 | - return $this->get_all( array( $_where ) ); |
|
278 | + return $this->get_all(array($_where)); |
|
279 | 279 | } |
280 | 280 | |
281 | 281 |
@@ -88,10 +88,10 @@ discard block |
||
88 | 88 | * @param \EE_Registry $Registry |
89 | 89 | * @return \EE_System |
90 | 90 | */ |
91 | - public static function instance( EE_Registry $Registry = null ) { |
|
91 | + public static function instance(EE_Registry $Registry = null) { |
|
92 | 92 | // check if class object is instantiated |
93 | - if ( ! self::$_instance instanceof EE_System ) { |
|
94 | - self::$_instance = new self( $Registry ); |
|
93 | + if ( ! self::$_instance instanceof EE_System) { |
|
94 | + self::$_instance = new self($Registry); |
|
95 | 95 | } |
96 | 96 | return self::$_instance; |
97 | 97 | } |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * resets the instance and returns it |
102 | 102 | * @return EE_System |
103 | 103 | */ |
104 | - public static function reset(){ |
|
104 | + public static function reset() { |
|
105 | 105 | self::$_instance->_req_type = NULL; |
106 | 106 | |
107 | 107 | //make sure none of the old hooks are left hanging around |
108 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
108 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
109 | 109 | |
110 | 110 | //we need to reset the migration manager in order for it to detect DMSs properly |
111 | 111 | EE_Data_Migration_Manager::reset(); |
@@ -125,28 +125,28 @@ discard block |
||
125 | 125 | * @access private |
126 | 126 | * @param \EE_Registry $Registry |
127 | 127 | */ |
128 | - private function __construct( EE_Registry $Registry ) { |
|
128 | + private function __construct(EE_Registry $Registry) { |
|
129 | 129 | $this->registry = $Registry; |
130 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
130 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
131 | 131 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
132 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
132 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
133 | 133 | // when an ee addon is activated, we want to call the core hook(s) again |
134 | 134 | // because the newly-activated addon didn't get a chance to run at all |
135 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
135 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
136 | 136 | // detect whether install or upgrade |
137 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
137 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
138 | 138 | // load EE_Config, EE_Textdomain, etc |
139 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
139 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
140 | 140 | // load EE_Config, EE_Textdomain, etc |
141 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
141 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
142 | 142 | // you wanna get going? I wanna get going... let's get going! |
143 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
143 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
144 | 144 | //other housekeeping |
145 | 145 | //exclude EE critical pages from wp_list_pages |
146 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
146 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
147 | 147 | // ALL EE Addons should use the following hook point to attach their initial setup too |
148 | 148 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
149 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
149 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -166,30 +166,30 @@ discard block |
||
166 | 166 | public function load_espresso_addons() { |
167 | 167 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
168 | 168 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
169 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
169 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
170 | 170 | //load and setup EE_Capabilities |
171 | - $this->registry->load_core( 'Capabilities' ); |
|
171 | + $this->registry->load_core('Capabilities'); |
|
172 | 172 | //caps need to be initialized on every request so that capability maps are set. |
173 | 173 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
174 | 174 | $this->registry->CAP->init_caps(); |
175 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
175 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
176 | 176 | //if the WP API basic auth plugin isn't already loaded, load it now. |
177 | 177 | //We want it for mobile apps. Just include the entire plugin |
178 | 178 | //also, don't load the basic auth when a plugin is getting activated, because |
179 | 179 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
180 | 180 | //and causes a fatal error |
181 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
182 | - && ! function_exists( 'json_basic_auth_error' ) |
|
181 | + if ( ! function_exists('json_basic_auth_handler') |
|
182 | + && ! function_exists('json_basic_auth_error') |
|
183 | 183 | && ! ( |
184 | - isset( $_GET[ 'action'] ) |
|
185 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
184 | + isset($_GET['action']) |
|
185 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
186 | 186 | ) |
187 | 187 | && ! ( |
188 | - isset( $_GET['activate' ] ) |
|
189 | - && $_GET['activate' ] === 'true' |
|
188 | + isset($_GET['activate']) |
|
189 | + && $_GET['activate'] === 'true' |
|
190 | 190 | ) |
191 | 191 | ) { |
192 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
192 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
193 | 193 | } |
194 | 194 | } |
195 | 195 | |
@@ -205,10 +205,10 @@ discard block |
||
205 | 205 | * @access public |
206 | 206 | * @return void |
207 | 207 | */ |
208 | - public function detect_activations_or_upgrades(){ |
|
208 | + public function detect_activations_or_upgrades() { |
|
209 | 209 | //first off: let's make sure to handle core |
210 | 210 | $this->detect_if_activation_or_upgrade(); |
211 | - foreach($this->registry->addons as $addon){ |
|
211 | + foreach ($this->registry->addons as $addon) { |
|
212 | 212 | //detect teh request type for that addon |
213 | 213 | $addon->detect_activation_or_upgrade(); |
214 | 214 | } |
@@ -229,41 +229,41 @@ discard block |
||
229 | 229 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
230 | 230 | |
231 | 231 | // load M-Mode class |
232 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
232 | + $this->registry->load_core('Maintenance_Mode'); |
|
233 | 233 | // check if db has been updated, or if its a brand-new installation |
234 | 234 | |
235 | 235 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
236 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
236 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
237 | 237 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
238 | 238 | |
239 | - switch($request_type){ |
|
239 | + switch ($request_type) { |
|
240 | 240 | case EE_System::req_type_new_activation: |
241 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
242 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
241 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
242 | + $this->_handle_core_version_change($espresso_db_update); |
|
243 | 243 | break; |
244 | 244 | case EE_System::req_type_reactivation: |
245 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
246 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
245 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
246 | + $this->_handle_core_version_change($espresso_db_update); |
|
247 | 247 | break; |
248 | 248 | case EE_System::req_type_upgrade: |
249 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
249 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
250 | 250 | //migrations may be required now that we've upgraded |
251 | 251 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
252 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
252 | + $this->_handle_core_version_change($espresso_db_update); |
|
253 | 253 | // echo "done upgrade";die; |
254 | 254 | break; |
255 | 255 | case EE_System::req_type_downgrade: |
256 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
256 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
257 | 257 | //its possible migrations are no longer required |
258 | 258 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
259 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
259 | + $this->_handle_core_version_change($espresso_db_update); |
|
260 | 260 | break; |
261 | 261 | case EE_System::req_type_normal: |
262 | 262 | default: |
263 | 263 | // $this->_maybe_redirect_to_ee_about(); |
264 | 264 | break; |
265 | 265 | } |
266 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
266 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | * initializing the database later during the request |
272 | 272 | * @param array $espresso_db_update |
273 | 273 | */ |
274 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
275 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
274 | + protected function _handle_core_version_change($espresso_db_update) { |
|
275 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
276 | 276 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
277 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
277 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | |
@@ -289,44 +289,44 @@ discard block |
||
289 | 289 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
290 | 290 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
291 | 291 | */ |
292 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
293 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
294 | - if( ! $espresso_db_update){ |
|
295 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
292 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
293 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
294 | + if ( ! $espresso_db_update) { |
|
295 | + $espresso_db_update = get_option('espresso_db_update'); |
|
296 | 296 | } |
297 | 297 | // check that option is an array |
298 | - if( ! is_array( $espresso_db_update )) { |
|
298 | + if ( ! is_array($espresso_db_update)) { |
|
299 | 299 | // if option is FALSE, then it never existed |
300 | - if ( $espresso_db_update === FALSE ) { |
|
300 | + if ($espresso_db_update === FALSE) { |
|
301 | 301 | // make $espresso_db_update an array and save option with autoload OFF |
302 | - $espresso_db_update = array(); |
|
303 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
302 | + $espresso_db_update = array(); |
|
303 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
304 | 304 | } else { |
305 | 305 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
306 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
307 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
306 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
307 | + update_option('espresso_db_update', $espresso_db_update); |
|
308 | 308 | } |
309 | - }else{ |
|
309 | + } else { |
|
310 | 310 | $corrected_db_update = array(); |
311 | 311 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
312 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
313 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
312 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
313 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
314 | 314 | //the key is an int, and the value IS NOT an array |
315 | 315 | //so it must be numerically-indexed, where values are versions installed... |
316 | 316 | //fix it! |
317 | 317 | $version_string = $should_be_array; |
318 | 318 | $corrected_db_update[$version_string] = array('unknown-date'); |
319 | - }else{ |
|
319 | + } else { |
|
320 | 320 | //ok it checks out |
321 | 321 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
322 | 322 | } |
323 | 323 | } |
324 | 324 | $espresso_db_update = $corrected_db_update; |
325 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
325 | + update_option('espresso_db_update', $espresso_db_update); |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
329 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
329 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
330 | 330 | return $espresso_db_update; |
331 | 331 | } |
332 | 332 | |
@@ -346,34 +346,34 @@ discard block |
||
346 | 346 | * so we prefer to only do it when necessary |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
349 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
350 | 350 | $request_type = $this->detect_req_type(); |
351 | 351 | //only initialize system if we're not in maintenance mode. |
352 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
353 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
352 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
353 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
354 | 354 | |
355 | - if( $verify_schema ) { |
|
355 | + if ($verify_schema) { |
|
356 | 356 | EEH_Activation::initialize_db_and_folders(); |
357 | 357 | } |
358 | 358 | EEH_Activation::initialize_db_content(); |
359 | 359 | EEH_Activation::system_initialization(); |
360 | - if( $initialize_addons_too ) { |
|
360 | + if ($initialize_addons_too) { |
|
361 | 361 | $this->initialize_addons(); |
362 | 362 | } |
363 | - }else{ |
|
364 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
363 | + } else { |
|
364 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
365 | 365 | } |
366 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
367 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
366 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
367 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Initializes the db for all registered addons |
373 | 373 | */ |
374 | - public function initialize_addons(){ |
|
374 | + public function initialize_addons() { |
|
375 | 375 | //foreach registered addon, make sure its db is up-to-date too |
376 | - foreach($this->registry->addons as $addon){ |
|
376 | + foreach ($this->registry->addons as $addon) { |
|
377 | 377 | $addon->initialize_db_if_no_migrations_required(); |
378 | 378 | } |
379 | 379 | } |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * @param string $current_version_to_add version to be added to the version history |
386 | 386 | * @return boolean success as to whether or not this option was changed |
387 | 387 | */ |
388 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
389 | - if( ! $version_history ) { |
|
388 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
389 | + if ( ! $version_history) { |
|
390 | 390 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
391 | 391 | } |
392 | - if( $current_version_to_add == NULL){ |
|
392 | + if ($current_version_to_add == NULL) { |
|
393 | 393 | $current_version_to_add = espresso_version(); |
394 | 394 | } |
395 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
395 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
396 | 396 | // re-save |
397 | - return update_option( 'espresso_db_update', $version_history ); |
|
397 | + return update_option('espresso_db_update', $version_history); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -411,10 +411,10 @@ discard block |
||
411 | 411 | * but still know if this is a new install or not |
412 | 412 | * @return int one of the constants on EE_System::req_type_ |
413 | 413 | */ |
414 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
415 | - if ( $this->_req_type === NULL ){ |
|
416 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
414 | + public function detect_req_type($espresso_db_update = NULL) { |
|
415 | + if ($this->_req_type === NULL) { |
|
416 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
417 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
418 | 418 | } |
419 | 419 | return $this->_req_type; |
420 | 420 | } |
@@ -430,39 +430,39 @@ discard block |
||
430 | 430 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
431 | 431 | * @return int one of the constants on EE_System::req_type_* |
432 | 432 | */ |
433 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
434 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
435 | - if( $activation_history_for_addon ){ |
|
433 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
434 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
435 | + if ($activation_history_for_addon) { |
|
436 | 436 | //it exists, so this isn't a completely new install |
437 | 437 | //check if this version already in that list of previously installed versions |
438 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
438 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
439 | 439 | //it a version we haven't seen before |
440 | - if( $version_is_higher === 1 ){ |
|
440 | + if ($version_is_higher === 1) { |
|
441 | 441 | $req_type = EE_System::req_type_upgrade; |
442 | - }else{ |
|
442 | + } else { |
|
443 | 443 | $req_type = EE_System::req_type_downgrade; |
444 | 444 | } |
445 | - delete_option( $activation_indicator_option_name ); |
|
445 | + delete_option($activation_indicator_option_name); |
|
446 | 446 | } else { |
447 | 447 | // its not an update. maybe a reactivation? |
448 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
449 | - if ( $version_is_higher === -1 ){ |
|
448 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
449 | + if ($version_is_higher === -1) { |
|
450 | 450 | $req_type = EE_System::req_type_downgrade; |
451 | - }elseif( $version_is_higher === 0 ){ |
|
451 | + }elseif ($version_is_higher === 0) { |
|
452 | 452 | //we've seen this version before, but it's an activation. must be a reactivation |
453 | 453 | $req_type = EE_System::req_type_reactivation; |
454 | - }else{//$version_is_higher === 1 |
|
454 | + } else {//$version_is_higher === 1 |
|
455 | 455 | $req_type = EE_System::req_type_upgrade; |
456 | 456 | } |
457 | - delete_option( $activation_indicator_option_name ); |
|
457 | + delete_option($activation_indicator_option_name); |
|
458 | 458 | } else { |
459 | 459 | //we've seen this version before and the activation indicate doesn't show it was just activated |
460 | - if ( $version_is_higher === -1 ){ |
|
460 | + if ($version_is_higher === -1) { |
|
461 | 461 | $req_type = EE_System::req_type_downgrade; |
462 | - }elseif( $version_is_higher === 0 ){ |
|
462 | + }elseif ($version_is_higher === 0) { |
|
463 | 463 | //we've seen this version before and it's not an activation. its normal request |
464 | 464 | $req_type = EE_System::req_type_normal; |
465 | - }else{//$version_is_higher === 1 |
|
465 | + } else {//$version_is_higher === 1 |
|
466 | 466 | $req_type = EE_System::req_type_upgrade; |
467 | 467 | } |
468 | 468 | } |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } else { |
471 | 471 | //brand new install |
472 | 472 | $req_type = EE_System::req_type_new_activation; |
473 | - delete_option( $activation_indicator_option_name ); |
|
473 | + delete_option($activation_indicator_option_name); |
|
474 | 474 | } |
475 | 475 | return $req_type; |
476 | 476 | } |
@@ -488,30 +488,30 @@ discard block |
||
488 | 488 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
489 | 489 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
490 | 490 | */ |
491 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
491 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
492 | 492 | //find the most recently-activated version |
493 | 493 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
494 | 494 | $most_recently_active_version = '0.0.0.dev.000'; |
495 | - if( is_array( $activation_history_for_addon ) ){ |
|
496 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
495 | + if (is_array($activation_history_for_addon)) { |
|
496 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
497 | 497 | //check there is a record of when this version was activated. Otherwise, |
498 | 498 | //mark it as unknown |
499 | - if( ! $times_activated ){ |
|
500 | - $times_activated = array( 'unknown-date'); |
|
499 | + if ( ! $times_activated) { |
|
500 | + $times_activated = array('unknown-date'); |
|
501 | 501 | } |
502 | - if( is_string( $times_activated ) ){ |
|
503 | - $times_activated = array( $times_activated ); |
|
502 | + if (is_string($times_activated)) { |
|
503 | + $times_activated = array($times_activated); |
|
504 | 504 | } |
505 | - foreach( $times_activated as $an_activation ){ |
|
506 | - if( $an_activation != 'unknown-date' && |
|
507 | - $an_activation > $most_recently_active_version_activation ){ |
|
505 | + foreach ($times_activated as $an_activation) { |
|
506 | + if ($an_activation != 'unknown-date' && |
|
507 | + $an_activation > $most_recently_active_version_activation) { |
|
508 | 508 | $most_recently_active_version = $version; |
509 | 509 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
510 | 510 | } |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
514 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | |
@@ -521,24 +521,24 @@ discard block |
||
521 | 521 | * @return void |
522 | 522 | */ |
523 | 523 | public function redirect_to_about_ee() { |
524 | - $notices = EE_Error::get_notices( FALSE ); |
|
524 | + $notices = EE_Error::get_notices(FALSE); |
|
525 | 525 | //if current user is an admin and it's not an ajax request |
526 | 526 | if ( |
527 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
528 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
529 | - && ! isset( $notices[ 'errors' ] ) |
|
527 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
528 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
529 | + && ! isset($notices['errors']) |
|
530 | 530 | ) { |
531 | - $query_params = array( 'page' => 'espresso_about' ); |
|
531 | + $query_params = array('page' => 'espresso_about'); |
|
532 | 532 | |
533 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
533 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
534 | 534 | $query_params['new_activation'] = TRUE; |
535 | 535 | } |
536 | 536 | |
537 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
537 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
538 | 538 | $query_params['reactivation'] = TRUE; |
539 | 539 | } |
540 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
541 | - wp_safe_redirect( $url ); |
|
540 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
541 | + wp_safe_redirect($url); |
|
542 | 542 | exit(); |
543 | 543 | } |
544 | 544 | } |
@@ -552,31 +552,31 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - public function load_core_configuration(){ |
|
556 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
557 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
555 | + public function load_core_configuration() { |
|
556 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
557 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
558 | 558 | //load textdomain |
559 | 559 | EE_Load_Textdomain::load_textdomain(); |
560 | 560 | // load and setup EE_Config and EE_Network_Config |
561 | - $this->registry->load_core( 'Config' ); |
|
562 | - $this->registry->load_core( 'Network_Config' ); |
|
561 | + $this->registry->load_core('Config'); |
|
562 | + $this->registry->load_core('Network_Config'); |
|
563 | 563 | // setup autoloaders |
564 | 564 | // enable logging? |
565 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
566 | - $this->registry->load_core( 'Log' ); |
|
565 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
566 | + $this->registry->load_core('Log'); |
|
567 | 567 | } |
568 | 568 | // check for activation errors |
569 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
570 | - if ( $activation_errors ) { |
|
571 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
572 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
569 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
570 | + if ($activation_errors) { |
|
571 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
572 | + update_option('ee_plugin_activation_errors', FALSE); |
|
573 | 573 | } |
574 | 574 | // get model names |
575 | 575 | $this->_parse_model_names(); |
576 | 576 | |
577 | 577 | //load caf stuff a chance to play during the activation process too. |
578 | 578 | $this->_maybe_brew_regular(); |
579 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
579 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
580 | 580 | } |
581 | 581 | |
582 | 582 | |
@@ -585,23 +585,23 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return void |
587 | 587 | */ |
588 | - private function _parse_model_names(){ |
|
588 | + private function _parse_model_names() { |
|
589 | 589 | //get all the files in the EE_MODELS folder that end in .model.php |
590 | - $models = glob( EE_MODELS.'*.model.php'); |
|
590 | + $models = glob(EE_MODELS.'*.model.php'); |
|
591 | 591 | $model_names = array(); |
592 | 592 | $non_abstract_db_models = array(); |
593 | - foreach( $models as $model ){ |
|
593 | + foreach ($models as $model) { |
|
594 | 594 | // get model classname |
595 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
596 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
595 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
596 | + $short_name = str_replace('EEM_', '', $classname); |
|
597 | 597 | $reflectionClass = new ReflectionClass($classname); |
598 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
599 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
598 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
599 | + $non_abstract_db_models[$short_name] = $classname; |
|
600 | 600 | } |
601 | - $model_names[ $short_name ] = $classname; |
|
601 | + $model_names[$short_name] = $classname; |
|
602 | 602 | } |
603 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
604 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
603 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
604 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | |
@@ -611,8 +611,8 @@ discard block |
||
611 | 611 | * @return void |
612 | 612 | */ |
613 | 613 | private function _maybe_brew_regular() { |
614 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
615 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
614 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
615 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
@@ -629,9 +629,9 @@ discard block |
||
629 | 629 | * @return void |
630 | 630 | */ |
631 | 631 | public function register_shortcodes_modules_and_widgets() { |
632 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
632 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
633 | 633 | // check for addons using old hookpoint |
634 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
634 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
635 | 635 | $this->_incompatible_addon_error(); |
636 | 636 | } |
637 | 637 | } |
@@ -645,19 +645,19 @@ discard block |
||
645 | 645 | */ |
646 | 646 | private function _incompatible_addon_error() { |
647 | 647 | // get array of classes hooking into here |
648 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
649 | - if ( ! empty( $class_names )) { |
|
650 | - $msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' ); |
|
648 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
649 | + if ( ! empty($class_names)) { |
|
650 | + $msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso'); |
|
651 | 651 | $msg .= '<ul>'; |
652 | - foreach ( $class_names as $class_name ) { |
|
653 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
652 | + foreach ($class_names as $class_name) { |
|
653 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
654 | 654 | } |
655 | 655 | $msg .= '</ul>'; |
656 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
656 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
657 | 657 | // save list of incompatible addons to wp-options for later use |
658 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
659 | - if ( is_admin() ) { |
|
660 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
658 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
659 | + if (is_admin()) { |
|
660 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -674,26 +674,26 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @return void |
676 | 676 | */ |
677 | - public function brew_espresso(){ |
|
678 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
677 | + public function brew_espresso() { |
|
678 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
679 | 679 | // load some final core systems |
680 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
681 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
682 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
683 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
684 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
685 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
686 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
687 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
688 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
689 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
690 | - |
|
691 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
680 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
681 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
682 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
683 | + add_action('init', array($this, 'load_controllers'), 7); |
|
684 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
685 | + add_action('init', array($this, 'initialize'), 10); |
|
686 | + add_action('init', array($this, 'initialize_last'), 100); |
|
687 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
689 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
690 | + |
|
691 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
692 | 692 | // pew pew pew |
693 | - $this->registry->load_core( 'PUE' ); |
|
694 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
693 | + $this->registry->load_core('PUE'); |
|
694 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
695 | 695 | } |
696 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
696 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function set_hooks_for_core() { |
709 | 709 | $this->_deactivate_incompatible_addons(); |
710 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
710 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | |
@@ -716,15 +716,15 @@ discard block |
||
716 | 716 | * Using the information gathered in EE_System::_incompatible_addon_error, |
717 | 717 | * deactivates any addons considered incompatible with the current version of EE |
718 | 718 | */ |
719 | - private function _deactivate_incompatible_addons(){ |
|
720 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
721 | - if ( ! empty( $incompatible_addons )) { |
|
722 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
723 | - foreach ( $active_plugins as $active_plugin ) { |
|
724 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
725 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
726 | - unset( $_GET['activate'] ); |
|
727 | - espresso_deactivate_plugin( $active_plugin ); |
|
719 | + private function _deactivate_incompatible_addons() { |
|
720 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
721 | + if ( ! empty($incompatible_addons)) { |
|
722 | + $active_plugins = get_option('active_plugins', array()); |
|
723 | + foreach ($active_plugins as $active_plugin) { |
|
724 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
725 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
726 | + unset($_GET['activate']); |
|
727 | + espresso_deactivate_plugin($active_plugin); |
|
728 | 728 | } |
729 | 729 | } |
730 | 730 | } |
@@ -741,10 +741,10 @@ discard block |
||
741 | 741 | */ |
742 | 742 | public function perform_activations_upgrades_and_migrations() { |
743 | 743 | //first check if we had previously attempted to setup EE's directories but failed |
744 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
744 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
745 | 745 | EEH_Activation::create_upload_directories(); |
746 | 746 | } |
747 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
747 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | * @return void |
757 | 757 | */ |
758 | 758 | public function load_CPTs_and_session() { |
759 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
759 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
760 | 760 | // register Custom Post Types |
761 | - $this->registry->load_core( 'Register_CPTs' ); |
|
762 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
761 | + $this->registry->load_core('Register_CPTs'); |
|
762 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | |
@@ -774,16 +774,16 @@ discard block |
||
774 | 774 | * @return void |
775 | 775 | */ |
776 | 776 | public function load_controllers() { |
777 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
777 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
778 | 778 | // let's get it started |
779 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
780 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
781 | - $this->registry->load_core( 'Front_Controller', array(), false, true ); |
|
782 | - } else if ( ! EE_FRONT_AJAX ) { |
|
783 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
784 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
779 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
780 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
781 | + $this->registry->load_core('Front_Controller', array(), false, true); |
|
782 | + } else if ( ! EE_FRONT_AJAX) { |
|
783 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
784 | + EE_Registry::instance()->load_core('Admin'); |
|
785 | 785 | } |
786 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
786 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | |
@@ -797,9 +797,9 @@ discard block |
||
797 | 797 | * @return void |
798 | 798 | */ |
799 | 799 | public function core_loaded_and_ready() { |
800 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
801 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
802 | - $this->registry->load_core( 'Session' ); |
|
800 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
801 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
802 | + $this->registry->load_core('Session'); |
|
803 | 803 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
804 | 804 | } |
805 | 805 | |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | * @return void |
815 | 815 | */ |
816 | 816 | public function initialize() { |
817 | - do_action( 'AHEE__EE_System__initialize' ); |
|
817 | + do_action('AHEE__EE_System__initialize'); |
|
818 | 818 | } |
819 | 819 | |
820 | 820 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | * @return void |
829 | 829 | */ |
830 | 830 | public function initialize_last() { |
831 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
831 | + do_action('AHEE__EE_System__initialize_last'); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -860,21 +860,21 @@ discard block |
||
860 | 860 | */ |
861 | 861 | public static function do_not_cache() { |
862 | 862 | // set no cache constants |
863 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
864 | - define( 'DONOTCACHEPAGE', true ); |
|
863 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
864 | + define('DONOTCACHEPAGE', true); |
|
865 | 865 | } |
866 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
867 | - define( 'DONOTCACHCEOBJECT', true ); |
|
866 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
867 | + define('DONOTCACHCEOBJECT', true); |
|
868 | 868 | } |
869 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
870 | - define( 'DONOTCACHEDB', true ); |
|
869 | + if ( ! defined('DONOTCACHEDB')) { |
|
870 | + define('DONOTCACHEDB', true); |
|
871 | 871 | } |
872 | 872 | // add no cache headers |
873 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
873 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
874 | 874 | // plus a little extra for nginx and Google Chrome |
875 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
875 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
876 | 876 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
877 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
877 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | * @param $headers |
887 | 887 | * @return array |
888 | 888 | */ |
889 | - public static function extra_nocache_headers ( $headers ) { |
|
889 | + public static function extra_nocache_headers($headers) { |
|
890 | 890 | // for NGINX |
891 | 891 | $headers['X-Accel-Expires'] = 0; |
892 | 892 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | * @param WP_Admin_Bar $admin_bar |
916 | 916 | * @return void |
917 | 917 | */ |
918 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
918 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
919 | 919 | |
920 | 920 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
921 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) { |
|
921 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) { |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | |
925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
926 | 926 | $menu_class = 'espresso_menu_item_class'; |
927 | 927 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
928 | 928 | //because they're only defined in each of their respective constructors |
@@ -934,20 +934,20 @@ discard block |
||
934 | 934 | //Top Level |
935 | 935 | $admin_bar->add_menu(array( |
936 | 936 | 'id' => 'espresso-toolbar', |
937 | - 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>', |
|
937 | + 'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>', |
|
938 | 938 | 'href' => $events_admin_url, |
939 | 939 | 'meta' => array( |
940 | 940 | 'title' => __('Event Espresso', 'event_espresso'), |
941 | - 'class' => $menu_class . 'first' |
|
941 | + 'class' => $menu_class.'first' |
|
942 | 942 | ), |
943 | 943 | )); |
944 | 944 | |
945 | 945 | //Events |
946 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
946 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
947 | 947 | $admin_bar->add_menu(array( |
948 | 948 | 'id' => 'espresso-toolbar-events', |
949 | 949 | 'parent' => 'espresso-toolbar', |
950 | - 'title' => __( 'Events', 'event_espresso' ), |
|
950 | + 'title' => __('Events', 'event_espresso'), |
|
951 | 951 | 'href' => $events_admin_url, |
952 | 952 | 'meta' => array( |
953 | 953 | 'title' => __('Events', 'event_espresso'), |
@@ -958,13 +958,13 @@ discard block |
||
958 | 958 | } |
959 | 959 | |
960 | 960 | |
961 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
961 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
962 | 962 | //Events Add New |
963 | 963 | $admin_bar->add_menu(array( |
964 | 964 | 'id' => 'espresso-toolbar-events-new', |
965 | 965 | 'parent' => 'espresso-toolbar-events', |
966 | 966 | 'title' => __('Add New', 'event_espresso'), |
967 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
967 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
968 | 968 | 'meta' => array( |
969 | 969 | 'title' => __('Add New', 'event_espresso'), |
970 | 970 | 'target' => '', |
@@ -973,18 +973,18 @@ discard block |
||
973 | 973 | )); |
974 | 974 | } |
975 | 975 | |
976 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
976 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
977 | 977 | |
978 | 978 | //Current post |
979 | 979 | global $post; |
980 | 980 | |
981 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
981 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
982 | 982 | //Events Edit Current Event |
983 | 983 | $admin_bar->add_menu(array( |
984 | 984 | 'id' => 'espresso-toolbar-events-edit', |
985 | 985 | 'parent' => 'espresso-toolbar-events', |
986 | 986 | 'title' => __('Edit Event', 'event_espresso'), |
987 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
987 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
988 | 988 | 'meta' => array( |
989 | 989 | 'title' => __('Edit Event', 'event_espresso'), |
990 | 990 | 'target' => '', |
@@ -996,11 +996,11 @@ discard block |
||
996 | 996 | } |
997 | 997 | |
998 | 998 | //Events View |
999 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
999 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1000 | 1000 | $admin_bar->add_menu(array( |
1001 | 1001 | 'id' => 'espresso-toolbar-events-view', |
1002 | 1002 | 'parent' => 'espresso-toolbar-events', |
1003 | - 'title' => __( 'View', 'event_espresso' ), |
|
1003 | + 'title' => __('View', 'event_espresso'), |
|
1004 | 1004 | 'href' => $events_admin_url, |
1005 | 1005 | 'meta' => array( |
1006 | 1006 | 'title' => __('View', 'event_espresso'), |
@@ -1010,12 +1010,12 @@ discard block |
||
1010 | 1010 | )); |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1013 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1014 | 1014 | //Events View All |
1015 | 1015 | $admin_bar->add_menu(array( |
1016 | 1016 | 'id' => 'espresso-toolbar-events-all', |
1017 | 1017 | 'parent' => 'espresso-toolbar-events-view', |
1018 | - 'title' => __( 'All', 'event_espresso' ), |
|
1018 | + 'title' => __('All', 'event_espresso'), |
|
1019 | 1019 | 'href' => $events_admin_url, |
1020 | 1020 | 'meta' => array( |
1021 | 1021 | 'title' => __('All', 'event_espresso'), |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | } |
1027 | 1027 | |
1028 | 1028 | |
1029 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1029 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1030 | 1030 | //Events View Today |
1031 | 1031 | $admin_bar->add_menu(array( |
1032 | 1032 | 'id' => 'espresso-toolbar-events-today', |
1033 | 1033 | 'parent' => 'espresso-toolbar-events-view', |
1034 | 1034 | 'title' => __('Today', 'event_espresso'), |
1035 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1035 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1036 | 1036 | 'meta' => array( |
1037 | 1037 | 'title' => __('Today', 'event_espresso'), |
1038 | 1038 | 'target' => '', |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | |
1045 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1045 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1046 | 1046 | //Events View This Month |
1047 | 1047 | $admin_bar->add_menu(array( |
1048 | 1048 | 'id' => 'espresso-toolbar-events-month', |
1049 | 1049 | 'parent' => 'espresso-toolbar-events-view', |
1050 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1051 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1050 | + 'title' => __('This Month', 'event_espresso'), |
|
1051 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1052 | 1052 | 'meta' => array( |
1053 | 1053 | 'title' => __('This Month', 'event_espresso'), |
1054 | 1054 | 'target' => '', |
@@ -1058,11 +1058,11 @@ discard block |
||
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | //Registration Overview |
1061 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1061 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1062 | 1062 | $admin_bar->add_menu(array( |
1063 | 1063 | 'id' => 'espresso-toolbar-registrations', |
1064 | 1064 | 'parent' => 'espresso-toolbar', |
1065 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1065 | + 'title' => __('Registrations', 'event_espresso'), |
|
1066 | 1066 | 'href' => $reg_admin_url, |
1067 | 1067 | 'meta' => array( |
1068 | 1068 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1073,12 +1073,12 @@ discard block |
||
1073 | 1073 | } |
1074 | 1074 | |
1075 | 1075 | //Registration Overview Today |
1076 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1076 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1077 | 1077 | $admin_bar->add_menu(array( |
1078 | 1078 | 'id' => 'espresso-toolbar-registrations-today', |
1079 | 1079 | 'parent' => 'espresso-toolbar-registrations', |
1080 | - 'title' => __( 'Today', 'event_espresso'), |
|
1081 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1080 | + 'title' => __('Today', 'event_espresso'), |
|
1081 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1082 | 1082 | 'meta' => array( |
1083 | 1083 | 'title' => __('Today', 'event_espresso'), |
1084 | 1084 | 'target' => '', |
@@ -1088,14 +1088,14 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | //Registration Overview Today Completed |
1091 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1091 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1092 | 1092 | $admin_bar->add_menu(array( |
1093 | 1093 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1094 | 1094 | 'parent' => 'espresso-toolbar-registrations-today', |
1095 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1096 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1095 | + 'title' => __('Approved', 'event_espresso'), |
|
1096 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1097 | 1097 | 'meta' => array( |
1098 | - 'title' => __('Approved', 'event_espresso' ), |
|
1098 | + 'title' => __('Approved', 'event_espresso'), |
|
1099 | 1099 | 'target' => '', |
1100 | 1100 | 'class' => $menu_class |
1101 | 1101 | ), |
@@ -1103,14 +1103,14 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | //Registration Overview Today Pending\ |
1106 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1106 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1107 | 1107 | $admin_bar->add_menu(array( |
1108 | 1108 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1109 | 1109 | 'parent' => 'espresso-toolbar-registrations-today', |
1110 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1111 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1110 | + 'title' => __('Pending', 'event_espresso'), |
|
1111 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1112 | 1112 | 'meta' => array( |
1113 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1113 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1114 | 1114 | 'target' => '', |
1115 | 1115 | 'class' => $menu_class |
1116 | 1116 | ), |
@@ -1118,14 +1118,14 @@ discard block |
||
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | //Registration Overview Today Incomplete |
1121 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1121 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1122 | 1122 | $admin_bar->add_menu(array( |
1123 | 1123 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1124 | 1124 | 'parent' => 'espresso-toolbar-registrations-today', |
1125 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1126 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1125 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1126 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1127 | 1127 | 'meta' => array( |
1128 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1128 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1129 | 1129 | 'target' => '', |
1130 | 1130 | 'class' => $menu_class |
1131 | 1131 | ), |
@@ -1133,12 +1133,12 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | //Registration Overview Today Incomplete |
1136 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1136 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1137 | 1137 | $admin_bar->add_menu(array( |
1138 | 1138 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1139 | 1139 | 'parent' => 'espresso-toolbar-registrations-today', |
1140 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1141 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1140 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1141 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1142 | 1142 | 'meta' => array( |
1143 | 1143 | 'title' => __('Cancelled', 'event_espresso'), |
1144 | 1144 | 'target' => '', |
@@ -1148,12 +1148,12 @@ discard block |
||
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | //Registration Overview This Month |
1151 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1151 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1152 | 1152 | $admin_bar->add_menu(array( |
1153 | 1153 | 'id' => 'espresso-toolbar-registrations-month', |
1154 | 1154 | 'parent' => 'espresso-toolbar-registrations', |
1155 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1156 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1155 | + 'title' => __('This Month', 'event_espresso'), |
|
1156 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1157 | 1157 | 'meta' => array( |
1158 | 1158 | 'title' => __('This Month', 'event_espresso'), |
1159 | 1159 | 'target' => '', |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | |
1165 | 1165 | //Registration Overview This Month Approved |
1166 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1166 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1167 | 1167 | $admin_bar->add_menu(array( |
1168 | 1168 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1169 | 1169 | 'parent' => 'espresso-toolbar-registrations-month', |
1170 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1171 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1170 | + 'title' => __('Approved', 'event_espresso'), |
|
1171 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1172 | 1172 | 'meta' => array( |
1173 | 1173 | 'title' => __('Approved', 'event_espresso'), |
1174 | 1174 | 'target' => '', |
@@ -1178,12 +1178,12 @@ discard block |
||
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | //Registration Overview This Month Pending |
1181 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1181 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1182 | 1182 | $admin_bar->add_menu(array( |
1183 | 1183 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1184 | 1184 | 'parent' => 'espresso-toolbar-registrations-month', |
1185 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1186 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1185 | + 'title' => __('Pending', 'event_espresso'), |
|
1186 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1187 | 1187 | 'meta' => array( |
1188 | 1188 | 'title' => __('Pending', 'event_espresso'), |
1189 | 1189 | 'target' => '', |
@@ -1193,14 +1193,14 @@ discard block |
||
1193 | 1193 | } |
1194 | 1194 | |
1195 | 1195 | //Registration Overview This Month Not Approved |
1196 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1196 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1197 | 1197 | $admin_bar->add_menu(array( |
1198 | 1198 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1199 | 1199 | 'parent' => 'espresso-toolbar-registrations-month', |
1200 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1201 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1200 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1201 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1202 | 1202 | 'meta' => array( |
1203 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1203 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1204 | 1204 | 'target' => '', |
1205 | 1205 | 'class' => $menu_class |
1206 | 1206 | ), |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | |
1211 | 1211 | //Registration Overview This Month Cancelled |
1212 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1212 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1213 | 1213 | $admin_bar->add_menu(array( |
1214 | 1214 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1215 | 1215 | 'parent' => 'espresso-toolbar-registrations-month', |
1216 | 1216 | 'title' => __('Cancelled', 'event_espresso'), |
1217 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1217 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1218 | 1218 | 'meta' => array( |
1219 | 1219 | 'title' => __('Cancelled', 'event_espresso'), |
1220 | 1220 | 'target' => '', |
@@ -1224,11 +1224,11 @@ discard block |
||
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | //Extensions & Services |
1227 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1227 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1228 | 1228 | $admin_bar->add_menu(array( |
1229 | 1229 | 'id' => 'espresso-toolbar-extensions-and-services', |
1230 | 1230 | 'parent' => 'espresso-toolbar', |
1231 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1231 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1232 | 1232 | 'href' => $extensions_admin_url, |
1233 | 1233 | 'meta' => array( |
1234 | 1234 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | * @param array $exclude_array any existing pages being excluded are in this array. |
1251 | 1251 | * @return array |
1252 | 1252 | */ |
1253 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1254 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1253 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1254 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | |
@@ -1271,12 +1271,12 @@ discard block |
||
1271 | 1271 | */ |
1272 | 1272 | public function wp_enqueue_scripts() { |
1273 | 1273 | // unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' ); |
1274 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1274 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1275 | 1275 | // jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
1276 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1276 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1277 | 1277 | // register jQuery Validate and additional methods |
1278 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1279 | - wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE ); |
|
1278 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1279 | + wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE); |
|
1280 | 1280 | } |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @since $VID:$ |
13 | 13 | * |
14 | 14 | */ |
15 | -class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy{ |
|
15 | +class EE_Select2_Display_Strategy extends EE_Select_Display_Strategy { |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Arguments that will be passed into the select2 javascript constructor |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param array $select2_js_args pass in the EXACT array of JS arguments you want |
26 | 26 | * to pass into the select2 js/html input. See https://select2.github.io |
27 | 27 | */ |
28 | - public function __construct( $select2_js_args = array() ) { |
|
28 | + public function __construct($select2_js_args = array()) { |
|
29 | 29 | $this->_select2_js_args = $select2_js_args; |
30 | 30 | parent::__construct(); |
31 | 31 | } |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | public function enqueue_js() { |
38 | 38 | // need to first deregister the select2 script in case some other plugin **cough cough Toolset Types cough** |
39 | 39 | // is carelessly registering an older version of Select2 on admin pages that don't even belong to them |
40 | - wp_deregister_script( 'select2' ); |
|
41 | - wp_deregister_style( 'select2' ); |
|
42 | - wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true ); |
|
43 | - wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
44 | - wp_enqueue_script( 'form_section_select2_init', EE_GLOBAL_ASSETS_URL . 'scripts/form_section_select2_init.js', array( 'select2' ), '1.0.0', true ); |
|
45 | - wp_enqueue_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' ); |
|
40 | + wp_deregister_script('select2'); |
|
41 | + wp_deregister_style('select2'); |
|
42 | + wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true); |
|
43 | + wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
44 | + wp_enqueue_script('form_section_select2_init', EE_GLOBAL_ASSETS_URL.'scripts/form_section_select2_init.js', array('select2'), '1.0.0', true); |
|
45 | + wp_enqueue_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * Sets the exact js args which will be passed into the select2 js/html input |
58 | 58 | * @param array $js_args |
59 | 59 | */ |
60 | - public function set_js_args( $js_args ) { |
|
60 | + public function set_js_args($js_args) { |
|
61 | 61 | $this->_select2_js_args = $js_args; |
62 | 62 | } |
63 | 63 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @param array $other_js_data |
67 | 67 | * @return array |
68 | 68 | */ |
69 | - public function get_other_js_data( $other_js_data = array() ) { |
|
70 | - $other_js_data = parent::get_other_js_data( $other_js_data ); |
|
71 | - if( ! isset( $other_js_data[ 'select2s' ] ) ) { |
|
69 | + public function get_other_js_data($other_js_data = array()) { |
|
70 | + $other_js_data = parent::get_other_js_data($other_js_data); |
|
71 | + if ( ! isset($other_js_data['select2s'])) { |
|
72 | 72 | $other_js_data['select2s'] = array(); |
73 | 73 | } |
74 | - $other_js_data[ 'select2s' ][ $this->_input->html_id() ] = $this->get_js_args(); |
|
74 | + $other_js_data['select2s'][$this->_input->html_id()] = $this->get_js_args(); |
|
75 | 75 | return $other_js_data; |
76 | 76 | } |
77 | 77 | } |
78 | 78 | \ No newline at end of file |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\exceptions\UnexpectedEntityException; |
8 | 8 | |
9 | 9 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
10 | - exit('No direct script access allowed'); |
|
10 | + exit('No direct script access allowed'); |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | |
@@ -24,97 +24,97 @@ discard block |
||
24 | 24 | { |
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * @param \EE_Event $event |
|
29 | - * @param \EE_Transaction $transaction |
|
30 | - * @param \EE_Ticket $ticket |
|
31 | - * @param \EE_Line_Item $ticket_line_item |
|
32 | - * @param $reg_count |
|
33 | - * @param $reg_group_size |
|
34 | - * @return \EE_Registration |
|
35 | - * @throws \EE_Error |
|
36 | - * @throws UnexpectedEntityException |
|
37 | - */ |
|
38 | - public function create( |
|
39 | - \EE_Event $event, |
|
40 | - \EE_Transaction $transaction, |
|
41 | - \EE_Ticket $ticket, |
|
42 | - \EE_Line_Item $ticket_line_item, |
|
43 | - $reg_count, |
|
44 | - $reg_group_size |
|
45 | - ) { |
|
46 | - $registrations = $transaction->registrations(); |
|
47 | - $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | - $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | - $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | - // generate new EE_Registration |
|
51 | - $registration = \EE_Registration::new_instance( |
|
52 | - array( |
|
53 | - 'EVT_ID' => $event->ID(), |
|
54 | - 'TXN_ID' => $transaction->ID(), |
|
55 | - 'TKT_ID' => $ticket->ID(), |
|
56 | - 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | - 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | - 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | - 'REG_count' => $reg_count, |
|
60 | - 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | - 'REG_url_link' => $reg_url_link, |
|
62 | - 'REG_code' => $reg_code, |
|
63 | - ) |
|
64 | - ); |
|
65 | - if ( ! $registration instanceof \EE_Registration) { |
|
66 | - throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | - } |
|
68 | - $registration->save(); |
|
69 | - $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | - $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | - $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | - $registration->save(); |
|
73 | - return $registration; |
|
74 | - } |
|
27 | + /** |
|
28 | + * @param \EE_Event $event |
|
29 | + * @param \EE_Transaction $transaction |
|
30 | + * @param \EE_Ticket $ticket |
|
31 | + * @param \EE_Line_Item $ticket_line_item |
|
32 | + * @param $reg_count |
|
33 | + * @param $reg_group_size |
|
34 | + * @return \EE_Registration |
|
35 | + * @throws \EE_Error |
|
36 | + * @throws UnexpectedEntityException |
|
37 | + */ |
|
38 | + public function create( |
|
39 | + \EE_Event $event, |
|
40 | + \EE_Transaction $transaction, |
|
41 | + \EE_Ticket $ticket, |
|
42 | + \EE_Line_Item $ticket_line_item, |
|
43 | + $reg_count, |
|
44 | + $reg_group_size |
|
45 | + ) { |
|
46 | + $registrations = $transaction->registrations(); |
|
47 | + $reg_count = $reg_count ? $reg_count : count($registrations) + 1; |
|
48 | + $reg_url_link = new RegUrlLink($reg_count, $ticket_line_item); |
|
49 | + $reg_code = new RegCode($reg_url_link, $transaction, $ticket); |
|
50 | + // generate new EE_Registration |
|
51 | + $registration = \EE_Registration::new_instance( |
|
52 | + array( |
|
53 | + 'EVT_ID' => $event->ID(), |
|
54 | + 'TXN_ID' => $transaction->ID(), |
|
55 | + 'TKT_ID' => $ticket->ID(), |
|
56 | + 'STS_ID' => \EEM_Registration::status_id_incomplete, |
|
57 | + 'REG_final_price' => $this->resolveFinalPrice($transaction, $ticket, $ticket_line_item), |
|
58 | + 'REG_session' => \EE_Registry::instance()->SSN->id(), |
|
59 | + 'REG_count' => $reg_count, |
|
60 | + 'REG_group_size' => $reg_group_size ? $reg_group_size : $this->incrementRegCount($registrations), |
|
61 | + 'REG_url_link' => $reg_url_link, |
|
62 | + 'REG_code' => $reg_code, |
|
63 | + ) |
|
64 | + ); |
|
65 | + if ( ! $registration instanceof \EE_Registration) { |
|
66 | + throw new UnexpectedEntityException($registration, 'EE_Registration'); |
|
67 | + } |
|
68 | + $registration->save(); |
|
69 | + $registration->_add_relation_to($event, 'Event', array(), $event->ID()); |
|
70 | + $registration->_add_relation_to($ticket, 'Ticket', array(), $ticket->ID()); |
|
71 | + $transaction->_add_relation_to($registration, 'Registration', array(), $registration->ID()); |
|
72 | + $registration->save(); |
|
73 | + return $registration; |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @param \EE_Transaction $transaction |
|
80 | - * @param \EE_Ticket $ticket |
|
81 | - * @param \EE_Line_Item $ticket_line_item |
|
82 | - * @return float |
|
83 | - */ |
|
84 | - protected function resolveFinalPrice( |
|
85 | - \EE_Transaction $transaction, |
|
86 | - \EE_Ticket $ticket, |
|
87 | - \EE_Line_Item $ticket_line_item |
|
88 | - ) { |
|
89 | - $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | - $transaction->total_line_item(), |
|
91 | - $ticket_line_item |
|
92 | - ); |
|
93 | - $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | - return (float)$final_price; |
|
95 | - } |
|
78 | + /** |
|
79 | + * @param \EE_Transaction $transaction |
|
80 | + * @param \EE_Ticket $ticket |
|
81 | + * @param \EE_Line_Item $ticket_line_item |
|
82 | + * @return float |
|
83 | + */ |
|
84 | + protected function resolveFinalPrice( |
|
85 | + \EE_Transaction $transaction, |
|
86 | + \EE_Ticket $ticket, |
|
87 | + \EE_Line_Item $ticket_line_item |
|
88 | + ) { |
|
89 | + $final_price = \EEH_Line_Item::calculate_final_price_for_ticket_line_item( |
|
90 | + $transaction->total_line_item(), |
|
91 | + $ticket_line_item |
|
92 | + ); |
|
93 | + $final_price = $final_price !== null ? $final_price : $ticket->get_ticket_total_with_taxes(); |
|
94 | + return (float)$final_price; |
|
95 | + } |
|
96 | 96 | |
97 | 97 | |
98 | 98 | |
99 | - /** |
|
100 | - * @param \EE_Registration[] $registrations |
|
101 | - * @param boolean $update_existing_registrations |
|
102 | - * @return int |
|
103 | - * @throws \EE_Error |
|
104 | - */ |
|
105 | - protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | - { |
|
107 | - $new_reg_count = count($registrations) + 1; |
|
108 | - if ($update_existing_registrations) { |
|
109 | - foreach ($registrations as $registration) { |
|
110 | - if ($registration instanceof \EE_Registration) { |
|
111 | - $registration->set_count($new_reg_count); |
|
112 | - $registration->save(); |
|
113 | - } |
|
114 | - } |
|
115 | - } |
|
116 | - return $new_reg_count; |
|
117 | - } |
|
99 | + /** |
|
100 | + * @param \EE_Registration[] $registrations |
|
101 | + * @param boolean $update_existing_registrations |
|
102 | + * @return int |
|
103 | + * @throws \EE_Error |
|
104 | + */ |
|
105 | + protected function incrementRegCount(array $registrations, $update_existing_registrations = true) |
|
106 | + { |
|
107 | + $new_reg_count = count($registrations) + 1; |
|
108 | + if ($update_existing_registrations) { |
|
109 | + foreach ($registrations as $registration) { |
|
110 | + if ($registration instanceof \EE_Registration) { |
|
111 | + $registration->set_count($new_reg_count); |
|
112 | + $registration->save(); |
|
113 | + } |
|
114 | + } |
|
115 | + } |
|
116 | + return $new_reg_count; |
|
117 | + } |
|
118 | 118 | |
119 | 119 | |
120 | 120 | } |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | * @param bool $routing |
57 | 57 | * @return Transactions_Admin_Page |
58 | 58 | */ |
59 | - public function __construct( $routing = TRUE ) { |
|
60 | - parent::__construct( $routing ); |
|
59 | + public function __construct($routing = TRUE) { |
|
60 | + parent::__construct($routing); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | protected function _ajax_hooks() { |
83 | - add_action('wp_ajax_espresso_apply_payment', array( $this, 'apply_payments_or_refunds')); |
|
84 | - add_action('wp_ajax_espresso_apply_refund', array( $this, 'apply_payments_or_refunds')); |
|
85 | - add_action('wp_ajax_espresso_delete_payment', array( $this, 'delete_payment')); |
|
83 | + add_action('wp_ajax_espresso_apply_payment', array($this, 'apply_payments_or_refunds')); |
|
84 | + add_action('wp_ajax_espresso_apply_refund', array($this, 'apply_payments_or_refunds')); |
|
85 | + add_action('wp_ajax_espresso_delete_payment', array($this, 'delete_payment')); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | 'buttons' => array( |
98 | 98 | 'add' => esc_html__('Add New Transaction', 'event_espresso'), |
99 | 99 | 'edit' => esc_html__('Edit Transaction', 'event_espresso'), |
100 | - 'delete' => esc_html__('Delete Transaction','event_espresso'), |
|
100 | + 'delete' => esc_html__('Delete Transaction', 'event_espresso'), |
|
101 | 101 | ) |
102 | 102 | ); |
103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
115 | 115 | |
116 | - $txn_id = ! empty( $this->_req_data['TXN_ID'] ) && ! is_array( $this->_req_data['TXN_ID'] ) ? $this->_req_data['TXN_ID'] : 0; |
|
116 | + $txn_id = ! empty($this->_req_data['TXN_ID']) && ! is_array($this->_req_data['TXN_ID']) ? $this->_req_data['TXN_ID'] : 0; |
|
117 | 117 | |
118 | 118 | $this->_page_routes = array( |
119 | 119 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | 'filename' => 'transactions_overview_views_filters_search' |
186 | 186 | ), |
187 | 187 | ), |
188 | - 'help_tour' => array( 'Transactions_Overview_Help_Tour' ), |
|
188 | + 'help_tour' => array('Transactions_Overview_Help_Tour'), |
|
189 | 189 | /** |
190 | 190 | * commented out because currently we are not displaying tips for transaction list table status but this |
191 | 191 | * may change in a later iteration so want to keep the code for then. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | 'nav' => array( |
198 | 198 | 'label' => esc_html__('View Transaction', 'event_espresso'), |
199 | 199 | 'order' => 5, |
200 | - 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
200 | + 'url' => isset($this->_req_data['TXN_ID']) ? add_query_arg(array('TXN_ID' => $this->_req_data['TXN_ID']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
201 | 201 | 'persistent' => FALSE |
202 | 202 | ), |
203 | 203 | 'help_tabs' => array( |
@@ -218,8 +218,8 @@ discard block |
||
218 | 218 | 'filename' => 'transactions_view_transaction_primary_registrant_billing_information' |
219 | 219 | ), |
220 | 220 | ), |
221 | - 'qtips' => array( 'Transaction_Details_Tips' ), |
|
222 | - 'help_tour' => array( 'Transaction_Details_Help_Tour' ), |
|
221 | + 'qtips' => array('Transaction_Details_Tips'), |
|
222 | + 'help_tour' => array('Transaction_Details_Help_Tour'), |
|
223 | 223 | 'metaboxes' => array('_transaction_details_metaboxes'), |
224 | 224 | |
225 | 225 | 'require_nonce' => FALSE |
@@ -237,23 +237,23 @@ discard block |
||
237 | 237 | // IF a registration was JUST added via the admin... |
238 | 238 | if ( |
239 | 239 | isset( |
240 | - $this->_req_data[ 'redirect_from' ], |
|
241 | - $this->_req_data[ 'EVT_ID' ], |
|
242 | - $this->_req_data[ 'event_name' ] |
|
240 | + $this->_req_data['redirect_from'], |
|
241 | + $this->_req_data['EVT_ID'], |
|
242 | + $this->_req_data['event_name'] |
|
243 | 243 | ) |
244 | 244 | ) { |
245 | 245 | // then set a cookie so that we can block any attempts to use |
246 | 246 | // the back button as a way to enter another registration. |
247 | - setcookie( 'ee_registration_added', $this->_req_data[ 'EVT_ID' ], time() + WEEK_IN_SECONDS, '/' ); |
|
247 | + setcookie('ee_registration_added', $this->_req_data['EVT_ID'], time() + WEEK_IN_SECONDS, '/'); |
|
248 | 248 | // and update the global |
249 | - $_COOKIE[ 'ee_registration_added' ] = $this->_req_data[ 'EVT_ID' ]; |
|
249 | + $_COOKIE['ee_registration_added'] = $this->_req_data['EVT_ID']; |
|
250 | 250 | } |
251 | - EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = esc_html__( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' ); |
|
252 | - EE_Registry::$i18n_js_strings[ 'error_occurred' ] = esc_html__( 'An error occurred! Please refresh the page and try again.', 'event_espresso' ); |
|
253 | - EE_Registry::$i18n_js_strings[ 'txn_status_array' ] = self::$_txn_status; |
|
254 | - EE_Registry::$i18n_js_strings[ 'pay_status_array' ] = self::$_pay_status; |
|
255 | - EE_Registry::$i18n_js_strings[ 'payments_total' ] = esc_html__( 'Payments Total', 'event_espresso' ); |
|
256 | - EE_Registry::$i18n_js_strings[ 'transaction_overpaid' ] = esc_html__( 'This transaction has been overpaid ! Payments Total', 'event_espresso' ); |
|
251 | + EE_Registry::$i18n_js_strings['invalid_server_response'] = esc_html__('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso'); |
|
252 | + EE_Registry::$i18n_js_strings['error_occurred'] = esc_html__('An error occurred! Please refresh the page and try again.', 'event_espresso'); |
|
253 | + EE_Registry::$i18n_js_strings['txn_status_array'] = self::$_txn_status; |
|
254 | + EE_Registry::$i18n_js_strings['pay_status_array'] = self::$_pay_status; |
|
255 | + EE_Registry::$i18n_js_strings['payments_total'] = esc_html__('Payments Total', 'event_espresso'); |
|
256 | + EE_Registry::$i18n_js_strings['transaction_overpaid'] = esc_html__('This transaction has been overpaid ! Payments Total', 'event_espresso'); |
|
257 | 257 | } |
258 | 258 | public function admin_notices() {} |
259 | 259 | public function admin_footer_scripts() {} |
@@ -320,14 +320,14 @@ discard block |
||
320 | 320 | */ |
321 | 321 | public function load_scripts_styles() { |
322 | 322 | //enqueue style |
323 | - wp_register_style( 'espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
323 | + wp_register_style('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
324 | 324 | wp_enqueue_style('espresso_txn'); |
325 | 325 | |
326 | 326 | //scripts |
327 | 327 | add_filter('FHEE_load_accounting_js', '__return_true'); |
328 | 328 | |
329 | 329 | //scripts |
330 | - wp_register_script('espresso_txn', TXN_ASSETS_URL . 'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
330 | + wp_register_script('espresso_txn', TXN_ASSETS_URL.'espresso_transactions_admin.js', array('ee_admin_js', 'ee-datepicker', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'ee-dialog', 'ee-accounting', 'ee-serialize-full-array'), EVENT_ESPRESSO_VERSION, TRUE); |
|
331 | 331 | wp_enqueue_script('espresso_txn'); |
332 | 332 | |
333 | 333 | } |
@@ -367,8 +367,8 @@ discard block |
||
367 | 367 | * @return void |
368 | 368 | */ |
369 | 369 | protected function _set_list_table_views_default() { |
370 | - $this->_views = array ( |
|
371 | - 'all' => array ( |
|
370 | + $this->_views = array( |
|
371 | + 'all' => array( |
|
372 | 372 | 'slug' => 'all', |
373 | 373 | 'label' => esc_html__('View All Transactions', 'event_espresso'), |
374 | 374 | 'count' => 0 |
@@ -396,20 +396,20 @@ discard block |
||
396 | 396 | * @return void |
397 | 397 | */ |
398 | 398 | private function _set_transaction_object() { |
399 | - if ( is_object( $this->_transaction) ) |
|
399 | + if (is_object($this->_transaction)) |
|
400 | 400 | return; //get out we've already set the object |
401 | 401 | |
402 | 402 | $TXN = EEM_Transaction::instance(); |
403 | 403 | |
404 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
404 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
405 | 405 | |
406 | 406 | //get transaction object |
407 | 407 | $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
408 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
408 | + $this->_session = ! empty($this->_transaction) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
409 | 409 | |
410 | - if ( empty( $this->_transaction ) ) { |
|
411 | - $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso') . $TXN_ID . esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
410 | + if (empty($this->_transaction)) { |
|
411 | + $error_msg = esc_html__('An error occurred and the details for Transaction ID #', 'event_espresso').$TXN_ID.esc_html__(' could not be retrieved.', 'event_espresso'); |
|
412 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | * @return array |
423 | 423 | */ |
424 | 424 | protected function _transaction_legend_items() { |
425 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
425 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
426 | 426 | $items = array(); |
427 | 427 | |
428 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
429 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
430 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
428 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
429 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
430 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
431 | 431 | $items['view_related_messages'] = array( |
432 | 432 | 'class' => $related_for_icon['css_class'], |
433 | 433 | 'desc' => $related_for_icon['label'], |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | $items = apply_filters( |
439 | 439 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
440 | - array_merge( $items, |
|
440 | + array_merge($items, |
|
441 | 441 | array( |
442 | 442 | 'view_details' => array( |
443 | 443 | 'class' => 'dashicons dashicons-cart', |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | ), |
450 | 450 | 'view_receipt' => array( |
451 | 451 | 'class' => 'dashicons dashicons-media-default', |
452 | - 'desc' => esc_html__('View Transaction Receipt', 'event_espresso' ) |
|
452 | + 'desc' => esc_html__('View Transaction Receipt', 'event_espresso') |
|
453 | 453 | ), |
454 | 454 | 'view_registration' => array( |
455 | 455 | 'class' => 'dashicons dashicons-clipboard', |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | ) |
460 | 460 | ); |
461 | 461 | |
462 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
463 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
462 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
463 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
464 | 464 | $items['send_payment_reminder'] = array( |
465 | 465 | 'class' => 'dashicons dashicons-email-alt', |
466 | 466 | 'desc' => esc_html__('Send Payment Reminder', 'event_espresso') |
@@ -481,29 +481,29 @@ discard block |
||
481 | 481 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
482 | 482 | array( |
483 | 483 | 'overpaid' => array( |
484 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
485 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
484 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
485 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
486 | 486 | ), |
487 | 487 | 'complete' => array( |
488 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
489 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
488 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
489 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
490 | 490 | ), |
491 | 491 | 'incomplete' => array( |
492 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
493 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
492 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
493 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
494 | 494 | ), |
495 | 495 | 'abandoned' => array( |
496 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
497 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
496 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
497 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
498 | 498 | ), |
499 | 499 | 'failed' => array( |
500 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
501 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
500 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
501 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
502 | 502 | ) |
503 | 503 | ) |
504 | 504 | ); |
505 | 505 | |
506 | - return array_merge( $items, $more_items); |
|
506 | + return array_merge($items, $more_items); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | */ |
517 | 517 | protected function _transactions_overview_list_table() { |
518 | 518 | $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
519 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
520 | - $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf( esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="' . EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL ) . '" title="' . esc_attr__('Click to Edit event', 'event_espresso') . '">' . $event->get('EVT_name') . '</a>', '</h3>' ) : ''; |
|
521 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
519 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
520 | + $this->_template_args['admin_page_header'] = $event instanceof EE_Event ? sprintf(esc_html__('%sViewing Transactions for the Event: %s%s', 'event_espresso'), '<h3>', '<a href="'.EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit', 'post' => $event->ID()), EVENTS_ADMIN_URL).'" title="'.esc_attr__('Click to Edit event', 'event_espresso').'">'.$event->get('EVT_name').'</a>', '</h3>') : ''; |
|
521 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
522 | 522 | $this->display_admin_list_table_page_with_no_sidebar(); |
523 | 523 | } |
524 | 524 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * @return void |
533 | 533 | */ |
534 | 534 | protected function _transaction_details() { |
535 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
535 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
536 | 536 | |
537 | 537 | $this->_set_transaction_status_array(); |
538 | 538 | |
@@ -545,14 +545,14 @@ discard block |
||
545 | 545 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
546 | 546 | |
547 | 547 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
548 | - $this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' ); |
|
548 | + $this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); |
|
549 | 549 | |
550 | 550 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
551 | - $this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' ); |
|
551 | + $this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
552 | 552 | |
553 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
554 | - $this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' ); |
|
555 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
553 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
554 | + $this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); |
|
555 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
556 | 556 | |
557 | 557 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
558 | 558 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ) |
566 | 566 | ) { |
567 | 567 | $this->_template_args['send_payment_reminder_button'] = |
568 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
568 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
569 | 569 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
570 | 570 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
571 | 571 | ? EEH_Template::get_button_or_link( |
@@ -587,40 +587,40 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
590 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
591 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
592 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
590 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
591 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
592 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
593 | 593 | } else { |
594 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
594 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
595 | 595 | } |
596 | - $this->_template_args['amount_due_class'] = ''; |
|
596 | + $this->_template_args['amount_due_class'] = ''; |
|
597 | 597 | |
598 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
598 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
599 | 599 | // paid in full |
600 | - $this->_template_args['amount_due'] = FALSE; |
|
601 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
600 | + $this->_template_args['amount_due'] = FALSE; |
|
601 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
602 | 602 | // overpaid |
603 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
603 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
604 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
605 | 605 | // monies owing |
606 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
606 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
607 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
608 | 608 | // no payments made yet |
609 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
609 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
610 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
611 | 611 | // free event |
612 | - $this->_template_args['amount_due'] = FALSE; |
|
612 | + $this->_template_args['amount_due'] = FALSE; |
|
613 | 613 | } |
614 | 614 | |
615 | 615 | $payment_method = $this->_transaction->payment_method(); |
616 | 616 | |
617 | 617 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
618 | 618 | ? $payment_method->admin_name() |
619 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
619 | + : esc_html__('Unknown', 'event_espresso'); |
|
620 | 620 | |
621 | 621 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
622 | 622 | // link back to overview |
623 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
623 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
624 | 624 | ? $_SERVER['HTTP_REFERER'] |
625 | 625 | : TXN_ADMIN_URL; |
626 | 626 | |
@@ -628,13 +628,13 @@ discard block |
||
628 | 628 | // next link |
629 | 629 | $next_txn = $this->_transaction->next( |
630 | 630 | null, |
631 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
631 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
632 | 632 | 'TXN_ID' |
633 | 633 | ); |
634 | 634 | $this->_template_args['next_transaction'] = $next_txn |
635 | 635 | ? $this->_next_link( |
636 | 636 | EE_Admin_Page::add_query_args_and_nonce( |
637 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
637 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
638 | 638 | TXN_ADMIN_URL |
639 | 639 | ), |
640 | 640 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | // previous link |
644 | 644 | $previous_txn = $this->_transaction->previous( |
645 | 645 | null, |
646 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
646 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
647 | 647 | 'TXN_ID' |
648 | 648 | ); |
649 | 649 | $this->_template_args['previous_transaction'] = $previous_txn |
650 | 650 | ? $this->_previous_link( |
651 | 651 | EE_Admin_Page::add_query_args_and_nonce( |
652 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
652 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
653 | 653 | TXN_ADMIN_URL |
654 | 654 | ), |
655 | 655 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -659,16 +659,16 @@ discard block |
||
659 | 659 | // were we just redirected here after adding a new registration ??? |
660 | 660 | if ( |
661 | 661 | isset( |
662 | - $this->_req_data[ 'redirect_from' ], |
|
663 | - $this->_req_data[ 'EVT_ID' ], |
|
664 | - $this->_req_data[ 'event_name' ] |
|
662 | + $this->_req_data['redirect_from'], |
|
663 | + $this->_req_data['EVT_ID'], |
|
664 | + $this->_req_data['event_name'] |
|
665 | 665 | ) |
666 | 666 | ) { |
667 | 667 | if ( |
668 | 668 | EE_Registry::instance()->CAP->current_user_can( |
669 | 669 | 'ee_edit_registrations', |
670 | 670 | 'espresso_registrations_new_registration', |
671 | - $this->_req_data[ 'EVT_ID' ] |
|
671 | + $this->_req_data['EVT_ID'] |
|
672 | 672 | ) |
673 | 673 | ) { |
674 | 674 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -678,25 +678,25 @@ discard block |
||
678 | 678 | 'action' => 'new_registration', |
679 | 679 | 'return' => 'default', |
680 | 680 | 'TXN_ID' => $this->_transaction->ID(), |
681 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
681 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
682 | 682 | ), |
683 | 683 | REG_ADMIN_URL |
684 | 684 | ); |
685 | 685 | $this->_admin_page_title .= '">'; |
686 | 686 | |
687 | 687 | $this->_admin_page_title .= sprintf( |
688 | - esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ), |
|
689 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
688 | + esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), |
|
689 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
690 | 690 | ); |
691 | 691 | $this->_admin_page_title .= '</a>'; |
692 | 692 | } |
693 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
693 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
694 | 694 | } |
695 | 695 | // grab messages at the last second |
696 | 696 | $this->_template_args['notices'] = EE_Error::get_notices(); |
697 | 697 | // path to template |
698 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
699 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
698 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
699 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
700 | 700 | |
701 | 701 | // the details template wrapper |
702 | 702 | $this->display_admin_page_with_sidebar(); |
@@ -715,18 +715,18 @@ discard block |
||
715 | 715 | |
716 | 716 | $this->_set_transaction_object(); |
717 | 717 | |
718 | - add_meta_box( 'edit-txn-details-mbox', esc_html__( 'Transaction Details', 'event_espresso' ), array( $this, 'txn_details_meta_box' ), $this->_wp_page_slug, 'normal', 'high' ); |
|
718 | + add_meta_box('edit-txn-details-mbox', esc_html__('Transaction Details', 'event_espresso'), array($this, 'txn_details_meta_box'), $this->_wp_page_slug, 'normal', 'high'); |
|
719 | 719 | add_meta_box( |
720 | 720 | 'edit-txn-attendees-mbox', |
721 | - esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
722 | - array( $this, 'txn_attendees_meta_box' ), |
|
721 | + esc_html__('Attendees Registered in this Transaction', 'event_espresso'), |
|
722 | + array($this, 'txn_attendees_meta_box'), |
|
723 | 723 | $this->_wp_page_slug, |
724 | 724 | 'normal', |
725 | 725 | 'high', |
726 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
726 | + array('TXN_ID' => $this->_transaction->ID()) |
|
727 | 727 | ); |
728 | - add_meta_box( 'edit-txn-registrant-mbox', esc_html__( 'Primary Contact', 'event_espresso' ), array( $this, 'txn_registrant_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
729 | - add_meta_box( 'edit-txn-billing-info-mbox', esc_html__( 'Billing Information', 'event_espresso' ), array( $this, 'txn_billing_info_side_meta_box' ), $this->_wp_page_slug, 'side', 'high' ); |
|
728 | + add_meta_box('edit-txn-registrant-mbox', esc_html__('Primary Contact', 'event_espresso'), array($this, 'txn_registrant_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
729 | + add_meta_box('edit-txn-billing-info-mbox', esc_html__('Billing Information', 'event_espresso'), array($this, 'txn_billing_info_side_meta_box'), $this->_wp_page_slug, 'side', 'high'); |
|
730 | 730 | |
731 | 731 | } |
732 | 732 | |
@@ -747,15 +747,15 @@ discard block |
||
747 | 747 | |
748 | 748 | //get line table |
749 | 749 | EEH_Autoloader::register_line_item_display_autoloaders(); |
750 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
751 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
750 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
751 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
752 | 752 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
753 | 753 | |
754 | 754 | // process taxes |
755 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
756 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
755 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
756 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
757 | 757 | |
758 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
758 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
759 | 759 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
760 | 760 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
761 | 761 | |
@@ -763,63 +763,63 @@ discard block |
||
763 | 763 | |
764 | 764 | // process payment details |
765 | 765 | $payments = $this->_transaction->get_many_related('Payment'); |
766 | - if( ! empty( $payments ) ) { |
|
767 | - $this->_template_args[ 'payments' ] = $payments; |
|
768 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
766 | + if ( ! empty($payments)) { |
|
767 | + $this->_template_args['payments'] = $payments; |
|
768 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
769 | 769 | } else { |
770 | - $this->_template_args[ 'payments' ] = false; |
|
771 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
770 | + $this->_template_args['payments'] = false; |
|
771 | + $this->_template_args['existing_reg_payments'] = array(); |
|
772 | 772 | } |
773 | 773 | |
774 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
775 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
774 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
775 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
776 | 776 | |
777 | - if ( isset( $txn_details['invoice_number'] )) { |
|
777 | + if (isset($txn_details['invoice_number'])) { |
|
778 | 778 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
779 | - $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' ); |
|
779 | + $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso'); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
783 | - $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' ); |
|
783 | + $this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso'); |
|
784 | 784 | |
785 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
786 | - $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' ); |
|
785 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
786 | + $this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso'); |
|
787 | 787 | |
788 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
789 | - $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' ); |
|
788 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
789 | + $this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso'); |
|
790 | 790 | |
791 | 791 | $reg_steps = '<ul>'; |
792 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
793 | - if ( $reg_step_status === true ) { |
|
794 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
795 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
796 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
797 | - esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
798 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
799 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
800 | - ) . '</li>'; |
|
792 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
793 | + if ($reg_step_status === true) { |
|
794 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
795 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
796 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
797 | + esc_html__('%1$s : Initiated %2$s', 'event_espresso'), |
|
798 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
799 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
800 | + ).'</li>'; |
|
801 | 801 | } else { |
802 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
802 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | $reg_steps .= '</ul>'; |
806 | 806 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
807 | - $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' ); |
|
807 | + $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso'); |
|
808 | 808 | |
809 | 809 | |
810 | 810 | $this->_get_registrations_to_apply_payment_to(); |
811 | - $this->_get_payment_methods( $payments ); |
|
811 | + $this->_get_payment_methods($payments); |
|
812 | 812 | $this->_get_payment_status_array(); |
813 | 813 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
814 | 814 | |
815 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
816 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
817 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
815 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
816 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
817 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
818 | 818 | |
819 | 819 | // 'espresso_delete_payment_nonce' |
820 | 820 | |
821 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
821 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
822 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
823 | 823 | |
824 | 824 | } |
825 | 825 | |
@@ -834,27 +834,27 @@ discard block |
||
834 | 834 | * @param EE_Payment[] $payments |
835 | 835 | * @return array |
836 | 836 | */ |
837 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
837 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
838 | 838 | $existing_reg_payments = array(); |
839 | 839 | // get all reg payments for these payments |
840 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
840 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
841 | 841 | array( |
842 | 842 | 'PAY_ID' => array( |
843 | 843 | 'IN', |
844 | - array_keys( $payments ) |
|
844 | + array_keys($payments) |
|
845 | 845 | ) |
846 | 846 | ) |
847 | - ) ); |
|
848 | - if ( ! empty( $reg_payments ) ) { |
|
849 | - foreach ( $payments as $payment ) { |
|
850 | - if ( ! $payment instanceof EE_Payment ) { |
|
847 | + )); |
|
848 | + if ( ! empty($reg_payments)) { |
|
849 | + foreach ($payments as $payment) { |
|
850 | + if ( ! $payment instanceof EE_Payment) { |
|
851 | 851 | continue; |
852 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
853 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
852 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
853 | + $existing_reg_payments[$payment->ID()] = array(); |
|
854 | 854 | } |
855 | - foreach ( $reg_payments as $reg_payment ) { |
|
856 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
857 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
855 | + foreach ($reg_payments as $reg_payment) { |
|
856 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
857 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
858 | 858 | } |
859 | 859 | } |
860 | 860 | } |
@@ -887,54 +887,54 @@ discard block |
||
887 | 887 | ) |
888 | 888 | ) |
889 | 889 | ); |
890 | - $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( |
|
890 | + $registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div( |
|
891 | 891 | '', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;' |
892 | 892 | ); |
893 | - $registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' ); |
|
894 | - $registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' ); |
|
893 | + $registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); |
|
894 | + $registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl'); |
|
895 | 895 | $registrations_to_apply_payment_to .= EEH_HTML::thead( |
896 | 896 | EEH_HTML::tr( |
897 | - EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) . |
|
898 | - EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) . |
|
899 | - EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) . |
|
900 | - EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) . |
|
901 | - EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
902 | - EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
903 | - EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' ) |
|
897 | + EEH_HTML::th(esc_html__('ID', 'event_espresso')). |
|
898 | + EEH_HTML::th(esc_html__('Registrant', 'event_espresso')). |
|
899 | + EEH_HTML::th(esc_html__('Ticket', 'event_espresso')). |
|
900 | + EEH_HTML::th(esc_html__('Event', 'event_espresso')). |
|
901 | + EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
902 | + EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
903 | + EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') |
|
904 | 904 | ) |
905 | 905 | ); |
906 | 906 | $registrations_to_apply_payment_to .= EEH_HTML::tbody(); |
907 | 907 | // get registrations for TXN |
908 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
909 | - foreach ( $registrations as $registration ) { |
|
910 | - if ( $registration instanceof EE_Registration ) { |
|
908 | + $registrations = $this->_transaction->registrations($query_params); |
|
909 | + foreach ($registrations as $registration) { |
|
910 | + if ($registration instanceof EE_Registration) { |
|
911 | 911 | $attendee_name = $registration->attendee() instanceof EE_Attendee |
912 | 912 | ? $registration->attendee()->full_name() |
913 | - : esc_html__( 'Unknown Attendee', 'event_espresso' ); |
|
913 | + : esc_html__('Unknown Attendee', 'event_espresso'); |
|
914 | 914 | $owing = $registration->final_price() - $registration->paid(); |
915 | 915 | $taxable = $registration->ticket()->taxable() |
916 | - ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' |
|
916 | + ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' |
|
917 | 917 | : ''; |
918 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) |
|
918 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) |
|
919 | 919 | ? ' checked="checked"' |
920 | 920 | : ''; |
921 | 921 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
922 | 922 | $registrations_to_apply_payment_to .= EEH_HTML::tr( |
923 | - EEH_HTML::td( $registration->ID() ) . |
|
924 | - EEH_HTML::td( $attendee_name ) . |
|
923 | + EEH_HTML::td($registration->ID()). |
|
924 | + EEH_HTML::td($attendee_name). |
|
925 | 925 | EEH_HTML::td( |
926 | - $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable |
|
927 | - ) . |
|
928 | - EEH_HTML::td( $registration->event_name() ) . |
|
929 | - EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
930 | - EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
926 | + $registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable |
|
927 | + ). |
|
928 | + EEH_HTML::td($registration->event_name()). |
|
929 | + EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
930 | + EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
931 | 931 | EEH_HTML::td( |
932 | - '<input type="checkbox" value="' . $registration->ID() |
|
932 | + '<input type="checkbox" value="'.$registration->ID() |
|
933 | 933 | . '" name="txn_admin_payment[registrations]"' |
934 | - . $checked . $disabled . '>', |
|
934 | + . $checked.$disabled.'>', |
|
935 | 935 | '', 'jst-cntr' |
936 | 936 | ), |
937 | - 'apply-payment-registration-row-' . $registration->ID() |
|
937 | + 'apply-payment-registration-row-'.$registration->ID() |
|
938 | 938 | ); |
939 | 939 | } |
940 | 940 | } |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | '', 'clear description' |
950 | 950 | ); |
951 | 951 | $registrations_to_apply_payment_to .= EEH_HTML::divx(); |
952 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
952 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | |
@@ -966,9 +966,9 @@ discard block |
||
966 | 966 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
967 | 967 | //let's add a "don't change" option. |
968 | 968 | $status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso'); |
969 | - $status_array = array_merge( $status_array, $statuses ); |
|
970 | - $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input( 'txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status' ); |
|
971 | - $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input( 'delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status' ); |
|
969 | + $status_array = array_merge($status_array, $statuses); |
|
970 | + $this->_template_args['status_change_select'] = EEH_Form_Fields::select_input('txn_reg_status_change[reg_status]', $status_array, 'NAN', 'id="txn-admin-payment-reg-status-inp"', 'txn-reg-status-change-reg-status'); |
|
971 | + $this->_template_args['delete_status_change_select'] = EEH_Form_Fields::select_input('delete_txn_reg_status_change[reg_status]', $status_array, 'NAN', 'delete-txn-admin-payment-reg-status-inp', 'delete-txn-reg-status-change-reg-status'); |
|
972 | 972 | |
973 | 973 | } |
974 | 974 | |
@@ -983,21 +983,21 @@ discard block |
||
983 | 983 | * @param EE_Payment[] to show on this page |
984 | 984 | * @return void |
985 | 985 | */ |
986 | - private function _get_payment_methods( $payments = array() ) { |
|
986 | + private function _get_payment_methods($payments = array()) { |
|
987 | 987 | $payment_methods_of_payments = array(); |
988 | - foreach( $payments as $payment ){ |
|
989 | - if( $payment instanceof EE_Payment ){ |
|
990 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
988 | + foreach ($payments as $payment) { |
|
989 | + if ($payment instanceof EE_Payment) { |
|
990 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
991 | 991 | } |
992 | 992 | } |
993 | - if( $payment_methods_of_payments ){ |
|
994 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
995 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
996 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
997 | - }else{ |
|
998 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
993 | + if ($payment_methods_of_payments) { |
|
994 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
995 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
996 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
997 | + } else { |
|
998 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
999 | 999 | } |
1000 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
1000 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | |
@@ -1011,17 +1011,17 @@ discard block |
||
1011 | 1011 | * @param array $metabox |
1012 | 1012 | * @return void |
1013 | 1013 | */ |
1014 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
1014 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
1015 | 1015 | |
1016 | - extract( $metabox['args'] ); |
|
1016 | + extract($metabox['args']); |
|
1017 | 1017 | $this->_template_args['post'] = $post; |
1018 | 1018 | $this->_template_args['event_attendees'] = array(); |
1019 | 1019 | // process items in cart |
1020 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
1021 | - if ( ! empty( $line_items )) { |
|
1022 | - foreach ( $line_items as $item ) { |
|
1023 | - if ( $item instanceof EE_Line_Item ) { |
|
1024 | - switch( $item->OBJ_type() ) { |
|
1020 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
1021 | + if ( ! empty($line_items)) { |
|
1022 | + foreach ($line_items as $item) { |
|
1023 | + if ($item instanceof EE_Line_Item) { |
|
1024 | + switch ($item->OBJ_type()) { |
|
1025 | 1025 | |
1026 | 1026 | case 'Event' : |
1027 | 1027 | break; |
@@ -1029,39 +1029,39 @@ discard block |
||
1029 | 1029 | case 'Ticket' : |
1030 | 1030 | $ticket = $item->ticket(); |
1031 | 1031 | //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1032 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
1032 | + if ( ! $ticket instanceof EE_Ticket) { |
|
1033 | 1033 | continue; |
1034 | 1034 | } |
1035 | 1035 | try { |
1036 | 1036 | $event_name = $ticket->get_event_name(); |
1037 | - } catch ( Exception $e ) { |
|
1038 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1039 | - $event_name = esc_html__( 'Unknown Event', 'event_espresso' ); |
|
1037 | + } catch (Exception $e) { |
|
1038 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1039 | + $event_name = esc_html__('Unknown Event', 'event_espresso'); |
|
1040 | 1040 | } |
1041 | - $event_name .= ' - ' . $item->get( 'LIN_name' ); |
|
1042 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ) ); |
|
1041 | + $event_name .= ' - '.$item->get('LIN_name'); |
|
1042 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1043 | 1043 | // now get all of the registrations for this transaction that use this ticket |
1044 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1045 | - foreach( $registrations as $registration ) { |
|
1046 | - if ( ! $registration instanceof EE_Registration ) { |
|
1044 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1045 | + foreach ($registrations as $registration) { |
|
1046 | + if ( ! $registration instanceof EE_Registration) { |
|
1047 | 1047 | continue; |
1048 | 1048 | } |
1049 | - $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1050 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1051 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1052 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1049 | + $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1050 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1051 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1052 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1053 | 1053 | // attendee info |
1054 | 1054 | $attendee = $registration->get_first_related('Attendee'); |
1055 | - if ( $attendee instanceof EE_Attendee ) { |
|
1056 | - $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1057 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1058 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1059 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format( $attendee, 'inline', false, false ); |
|
1055 | + if ($attendee instanceof EE_Attendee) { |
|
1056 | + $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1057 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1058 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1059 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format($attendee, 'inline', false, false); |
|
1060 | 1060 | } else { |
1061 | 1061 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1062 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1062 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1063 | 1063 | $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
1064 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1064 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | break; |
@@ -1070,12 +1070,12 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | } |
1072 | 1072 | |
1073 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1074 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1073 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1074 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1075 | 1075 | |
1076 | 1076 | } else { |
1077 | 1077 | echo sprintf( |
1078 | - esc_html__( '%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso' ), |
|
1078 | + esc_html__('%1$sFor some reason, there are no attendees registered for this transaction. Likely the registration was abandoned in process.%2$s', 'event_espresso'), |
|
1079 | 1079 | '<p class="important-notice">', |
1080 | 1080 | '</p>' |
1081 | 1081 | ); |
@@ -1094,19 +1094,19 @@ discard block |
||
1094 | 1094 | */ |
1095 | 1095 | public function txn_registrant_side_meta_box() { |
1096 | 1096 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1097 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1097 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1098 | 1098 | $this->_template_args['no_attendee_message'] = esc_html__('There is no attached contact for this transaction. The transaction either failed due to an error or was abandoned.', 'event_espresso'); |
1099 | 1099 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1100 | 1100 | } |
1101 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1101 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1102 | 1102 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1103 | 1103 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1104 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1104 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1105 | 1105 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1106 | - $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'edit_attendee', 'post' => $primary_att->ID() ), REG_ADMIN_URL ); |
|
1106 | + $this->_template_args['edit_attendee_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'edit_attendee', 'post' => $primary_att->ID()), REG_ADMIN_URL); |
|
1107 | 1107 | // get formatted address for registrant |
1108 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1109 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1108 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1109 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | |
@@ -1122,12 +1122,12 @@ discard block |
||
1122 | 1122 | |
1123 | 1123 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1124 | 1124 | $this->_template_args['billing_form_url'] = add_query_arg( |
1125 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1125 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1126 | 1126 | TXN_ADMIN_URL |
1127 | 1127 | ); |
1128 | 1128 | |
1129 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1130 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1129 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1130 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | |
@@ -1140,42 +1140,42 @@ discard block |
||
1140 | 1140 | * @return void |
1141 | 1141 | */ |
1142 | 1142 | public function apply_payments_or_refunds() { |
1143 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1143 | + $json_response_data = array('return_data' => FALSE); |
|
1144 | 1144 | $valid_data = $this->_validate_payment_request_data(); |
1145 | - if ( ! empty( $valid_data ) ) { |
|
1146 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1145 | + if ( ! empty($valid_data)) { |
|
1146 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1147 | 1147 | //save the new payment |
1148 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1148 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1149 | 1149 | // get the TXN for this payment |
1150 | 1150 | $transaction = $payment->transaction(); |
1151 | 1151 | // verify transaction |
1152 | - if ( $transaction instanceof EE_Transaction ) { |
|
1152 | + if ($transaction instanceof EE_Transaction) { |
|
1153 | 1153 | // calculate_total_payments_and_update_status |
1154 | - $this->_process_transaction_payments( $transaction ); |
|
1155 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1156 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1154 | + $this->_process_transaction_payments($transaction); |
|
1155 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1156 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1157 | 1157 | // apply payment to registrations (if applicable) |
1158 | - if ( ! empty( $REG_IDs ) ) { |
|
1159 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1158 | + if ( ! empty($REG_IDs)) { |
|
1159 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1160 | 1160 | $this->_maybe_send_notifications(); |
1161 | 1161 | // now process status changes for the same registrations |
1162 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1162 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1163 | 1163 | } |
1164 | - $this->_maybe_send_notifications( $payment ); |
|
1164 | + $this->_maybe_send_notifications($payment); |
|
1165 | 1165 | //prepare to render page |
1166 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1167 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1166 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1167 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1168 | 1168 | } else { |
1169 | 1169 | EE_Error::add_error( |
1170 | - esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1170 | + esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1171 | 1171 | __FILE__, __FUNCTION__, __LINE__ |
1172 | 1172 | ); |
1173 | 1173 | } |
1174 | 1174 | } else { |
1175 | - EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1175 | + EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1178 | + $notices = EE_Error::get_notices(false, false, false); |
|
1179 | 1179 | $this->_template_args = array( |
1180 | 1180 | 'data' => $json_response_data, |
1181 | 1181 | 'error' => $notices['errors'], |
@@ -1192,30 +1192,30 @@ discard block |
||
1192 | 1192 | * @return array |
1193 | 1193 | */ |
1194 | 1194 | protected function _validate_payment_request_data() { |
1195 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1195 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1196 | 1196 | return false; |
1197 | 1197 | } |
1198 | 1198 | $payment_form = $this->_generate_payment_form_section(); |
1199 | 1199 | try { |
1200 | - if ( $payment_form->was_submitted() ) { |
|
1200 | + if ($payment_form->was_submitted()) { |
|
1201 | 1201 | $payment_form->receive_form_submission(); |
1202 | - if ( ! $payment_form->is_valid() ) { |
|
1202 | + if ( ! $payment_form->is_valid()) { |
|
1203 | 1203 | $submission_error_messages = array(); |
1204 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1205 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1204 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1205 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1206 | 1206 | $submission_error_messages[] = sprintf( |
1207 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1207 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1208 | 1208 | $validation_error->get_form_section()->html_label_text(), |
1209 | 1209 | $validation_error->getMessage() |
1210 | 1210 | ); |
1211 | 1211 | } |
1212 | 1212 | } |
1213 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1213 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1214 | 1214 | return array(); |
1215 | 1215 | } |
1216 | 1216 | } |
1217 | - } catch ( EE_Error $e ) { |
|
1218 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1217 | + } catch (EE_Error $e) { |
|
1218 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1219 | 1219 | return array(); |
1220 | 1220 | } |
1221 | 1221 | return $payment_form->valid_data(); |
@@ -1237,63 +1237,63 @@ discard block |
||
1237 | 1237 | array( |
1238 | 1238 | 'default' => 0, |
1239 | 1239 | 'required' => false, |
1240 | - 'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ), |
|
1241 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1240 | + 'html_label_text' => esc_html__('Payment ID', 'event_espresso'), |
|
1241 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1242 | 1242 | ) |
1243 | 1243 | ), |
1244 | 1244 | 'TXN_ID' => new EE_Text_Input( |
1245 | 1245 | array( |
1246 | 1246 | 'default' => 0, |
1247 | 1247 | 'required' => true, |
1248 | - 'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ), |
|
1249 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1248 | + 'html_label_text' => esc_html__('Transaction ID', 'event_espresso'), |
|
1249 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1250 | 1250 | ) |
1251 | 1251 | ), |
1252 | 1252 | 'type' => new EE_Text_Input( |
1253 | 1253 | array( |
1254 | 1254 | 'default' => 1, |
1255 | 1255 | 'required' => true, |
1256 | - 'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ), |
|
1257 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1256 | + 'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'), |
|
1257 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1258 | 1258 | ) |
1259 | 1259 | ), |
1260 | 1260 | 'amount' => new EE_Text_Input( |
1261 | 1261 | array( |
1262 | 1262 | 'default' => 0, |
1263 | 1263 | 'required' => true, |
1264 | - 'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ), |
|
1265 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1264 | + 'html_label_text' => esc_html__('Payment amount', 'event_espresso'), |
|
1265 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1266 | 1266 | ) |
1267 | 1267 | ), |
1268 | 1268 | 'status' => new EE_Text_Input( |
1269 | 1269 | array( |
1270 | 1270 | 'default' => EEM_Payment::status_id_approved, |
1271 | 1271 | 'required' => true, |
1272 | - 'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ), |
|
1272 | + 'html_label_text' => esc_html__('Payment status', 'event_espresso'), |
|
1273 | 1273 | ) |
1274 | 1274 | ), |
1275 | 1275 | 'PMD_ID' => new EE_Text_Input( |
1276 | 1276 | array( |
1277 | 1277 | 'default' => 2, |
1278 | 1278 | 'required' => true, |
1279 | - 'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ), |
|
1280 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1279 | + 'html_label_text' => esc_html__('Payment Method', 'event_espresso'), |
|
1280 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1281 | 1281 | ) |
1282 | 1282 | ), |
1283 | 1283 | 'date' => new EE_Text_Input( |
1284 | 1284 | array( |
1285 | 1285 | 'default' => time(), |
1286 | 1286 | 'required' => true, |
1287 | - 'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ), |
|
1287 | + 'html_label_text' => esc_html__('Payment date', 'event_espresso'), |
|
1288 | 1288 | ) |
1289 | 1289 | ), |
1290 | 1290 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1291 | 1291 | array( |
1292 | 1292 | 'default' => '', |
1293 | 1293 | 'required' => false, |
1294 | - 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1294 | + 'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'), |
|
1295 | 1295 | 'validation_strategies' => array( |
1296 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1296 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1297 | 1297 | ) |
1298 | 1298 | ) |
1299 | 1299 | ), |
@@ -1301,9 +1301,9 @@ discard block |
||
1301 | 1301 | array( |
1302 | 1302 | 'default' => '', |
1303 | 1303 | 'required' => false, |
1304 | - 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
|
1304 | + 'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'), |
|
1305 | 1305 | 'validation_strategies' => array( |
1306 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1306 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1307 | 1307 | ) |
1308 | 1308 | ) |
1309 | 1309 | ), |
@@ -1311,9 +1311,9 @@ discard block |
||
1311 | 1311 | array( |
1312 | 1312 | 'default' => '', |
1313 | 1313 | 'required' => false, |
1314 | - 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
|
1314 | + 'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'), |
|
1315 | 1315 | 'validation_strategies' => array( |
1316 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1316 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1317 | 1317 | ) |
1318 | 1318 | ) |
1319 | 1319 | ), |
@@ -1330,37 +1330,37 @@ discard block |
||
1330 | 1330 | * @param array $valid_data |
1331 | 1331 | * @return EE_Payment |
1332 | 1332 | */ |
1333 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1334 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1333 | + protected function _create_payment_from_request_data($valid_data) { |
|
1334 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1335 | 1335 | // get payment amount |
1336 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1336 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1337 | 1337 | // payments have a type value of 1 and refunds have a type value of -1 |
1338 | 1338 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1339 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1339 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1340 | 1340 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1341 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1341 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1342 | 1342 | $payment = EE_Payment::new_instance( |
1343 | 1343 | array( |
1344 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1345 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1344 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1345 | + 'STS_ID' => $valid_data['status'], |
|
1346 | 1346 | 'PAY_timestamp' => $date, |
1347 | 1347 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1348 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1348 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1349 | 1349 | 'PAY_amount' => $amount, |
1350 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1351 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1352 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1350 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1351 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1352 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1353 | 1353 | 'PAY_details' => $valid_data, |
1354 | 1354 | 'PAY_ID' => $PAY_ID |
1355 | 1355 | ), |
1356 | 1356 | '', |
1357 | - array( 'Y-m-d', 'g:i a' ) |
|
1357 | + array('Y-m-d', 'g:i a') |
|
1358 | 1358 | ); |
1359 | 1359 | |
1360 | - if ( ! $payment->save() ) { |
|
1360 | + if ( ! $payment->save()) { |
|
1361 | 1361 | EE_Error::add_error( |
1362 | 1362 | sprintf( |
1363 | - esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1363 | + esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1364 | 1364 | $payment->ID() |
1365 | 1365 | ), |
1366 | 1366 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1377,15 +1377,15 @@ discard block |
||
1377 | 1377 | * @param \EE_Transaction $transaction |
1378 | 1378 | * @return array |
1379 | 1379 | */ |
1380 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1380 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1381 | 1381 | /** @type EE_Transaction_Payments $transaction_payments */ |
1382 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1382 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1383 | 1383 | //update the transaction with this payment |
1384 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1385 | - EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1384 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1385 | + EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1386 | 1386 | } else { |
1387 | 1387 | EE_Error::add_error( |
1388 | - esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1388 | + esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1389 | 1389 | , __FILE__, __FUNCTION__, __LINE__ |
1390 | 1390 | ); |
1391 | 1391 | } |
@@ -1401,19 +1401,19 @@ discard block |
||
1401 | 1401 | * @param \EE_Payment $payment |
1402 | 1402 | * @return array |
1403 | 1403 | */ |
1404 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1404 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1405 | 1405 | $REG_IDs = array(); |
1406 | 1406 | // grab array of IDs for specific registrations to apply changes to |
1407 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1408 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1407 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1408 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1409 | 1409 | } |
1410 | 1410 | //nothing specified ? then get all reg IDs |
1411 | - if ( empty( $REG_IDs ) ) { |
|
1411 | + if (empty($REG_IDs)) { |
|
1412 | 1412 | $registrations = $payment->transaction()->registrations(); |
1413 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1413 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1414 | 1414 | } |
1415 | 1415 | // ensure that REG_IDs are integers and NOT strings |
1416 | - return array_map( 'intval', $REG_IDs ); |
|
1416 | + return array_map('intval', $REG_IDs); |
|
1417 | 1417 | } |
1418 | 1418 | |
1419 | 1419 | |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | /** |
1431 | 1431 | * @param array $existing_reg_payment_REG_IDs |
1432 | 1432 | */ |
1433 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1433 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1434 | 1434 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1435 | 1435 | } |
1436 | 1436 | |
@@ -1445,13 +1445,13 @@ discard block |
||
1445 | 1445 | * @param \EE_Payment $payment |
1446 | 1446 | * @return array |
1447 | 1447 | */ |
1448 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1449 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1448 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1449 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1450 | 1450 | // let's get any existing reg payment records for this payment |
1451 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1451 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1452 | 1452 | // but we only want the REG IDs, so grab the array keys |
1453 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1454 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1453 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1454 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1455 | 1455 | } |
1456 | 1456 | return $this->existing_reg_payment_REG_IDs(); |
1457 | 1457 | } |
@@ -1470,23 +1470,23 @@ discard block |
||
1470 | 1470 | * @param int $PAY_ID |
1471 | 1471 | * @return bool; |
1472 | 1472 | */ |
1473 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1473 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1474 | 1474 | // newly created payments will have nothing recorded for $PAY_ID |
1475 | - if ( $PAY_ID == 0 ) { |
|
1475 | + if ($PAY_ID == 0) { |
|
1476 | 1476 | return false; |
1477 | 1477 | } |
1478 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1479 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1478 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1479 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1480 | 1480 | return false; |
1481 | 1481 | } |
1482 | 1482 | /** @type EE_Transaction_Payments $transaction_payments */ |
1483 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1483 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1484 | 1484 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1485 | 1485 | $payment, |
1486 | 1486 | array( |
1487 | 1487 | array( |
1488 | 1488 | 'PAY_ID' => $payment->ID(), |
1489 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1489 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1490 | 1490 | ) |
1491 | 1491 | ) |
1492 | 1492 | ); |
@@ -1505,25 +1505,25 @@ discard block |
||
1505 | 1505 | * @param array $REG_IDs |
1506 | 1506 | * @return bool |
1507 | 1507 | */ |
1508 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1508 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1509 | 1509 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1510 | 1510 | // so let's do that using our set of REG_IDs from the form |
1511 | 1511 | $registration_query_where_params = array( |
1512 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1512 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1513 | 1513 | ); |
1514 | 1514 | // but add in some conditions regarding payment, |
1515 | 1515 | // so that we don't apply payments to registrations that are free or have already been paid for |
1516 | 1516 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1517 | - if ( ! $payment->is_a_refund() ) { |
|
1518 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1519 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1517 | + if ( ! $payment->is_a_refund()) { |
|
1518 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1519 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1520 | 1520 | } |
1521 | 1521 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1522 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1523 | - if ( ! empty( $registrations ) ) { |
|
1522 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1523 | + if ( ! empty($registrations)) { |
|
1524 | 1524 | /** @type EE_Payment_Processor $payment_processor */ |
1525 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1526 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1525 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1526 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | |
@@ -1539,22 +1539,22 @@ discard block |
||
1539 | 1539 | * @param array $REG_IDs |
1540 | 1540 | * @return bool |
1541 | 1541 | */ |
1542 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1542 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1543 | 1543 | // first if there is no change in status then we get out. |
1544 | 1544 | if ( |
1545 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1545 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1546 | 1546 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1547 | 1547 | ) { |
1548 | 1548 | //no error message, no change requested, just nothing to do man. |
1549 | 1549 | return FALSE; |
1550 | 1550 | } |
1551 | 1551 | /** @type EE_Transaction_Processor $transaction_processor */ |
1552 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1552 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1553 | 1553 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1554 | 1554 | return $transaction_processor->manually_update_registration_statuses( |
1555 | 1555 | $transaction, |
1556 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1557 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1556 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1557 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1558 | 1558 | ); |
1559 | 1559 | } |
1560 | 1560 | |
@@ -1569,16 +1569,16 @@ discard block |
||
1569 | 1569 | * @param bool | null $delete_txn_reg_status_change |
1570 | 1570 | * @return array |
1571 | 1571 | */ |
1572 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1572 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1573 | 1573 | // was the payment deleted ? |
1574 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1574 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1575 | 1575 | return array( |
1576 | 1576 | 'PAY_ID' => $payment->ID(), |
1577 | 1577 | 'amount' => $payment->amount(), |
1578 | 1578 | 'total_paid' => $payment->transaction()->paid(), |
1579 | 1579 | 'txn_status' => $payment->transaction()->status_ID(), |
1580 | 1580 | 'pay_status' => $payment->STS_ID(), |
1581 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1581 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1582 | 1582 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1583 | 1583 | ); |
1584 | 1584 | } else { |
@@ -1590,16 +1590,16 @@ discard block |
||
1590 | 1590 | 'pay_status' => $payment->STS_ID(), |
1591 | 1591 | 'PAY_ID' => $payment->ID(), |
1592 | 1592 | 'STS_ID' => $payment->STS_ID(), |
1593 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1594 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1595 | - 'method' => strtoupper( $payment->source() ), |
|
1593 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1594 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1595 | + 'method' => strtoupper($payment->source()), |
|
1596 | 1596 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1597 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ), |
|
1597 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'), |
|
1598 | 1598 | 'gateway_response' => $payment->gateway_response(), |
1599 | 1599 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1600 | 1600 | 'po_number' => $payment->po_number(), |
1601 | 1601 | 'extra_accntng' => $payment->extra_accntng(), |
1602 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1602 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1603 | 1603 | ); |
1604 | 1604 | } |
1605 | 1605 | } |
@@ -1614,39 +1614,39 @@ discard block |
||
1614 | 1614 | * @return void |
1615 | 1615 | */ |
1616 | 1616 | public function delete_payment() { |
1617 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1618 | - $PAY_ID = isset( $this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) ? absint( $this->_req_data['delete_txn_admin_payment']['PAY_ID'] ) : 0; |
|
1619 | - if ( $PAY_ID ) { |
|
1620 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1621 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1622 | - if ( $payment instanceof EE_Payment ) { |
|
1623 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1617 | + $json_response_data = array('return_data' => FALSE); |
|
1618 | + $PAY_ID = isset($this->_req_data['delete_txn_admin_payment'], $this->_req_data['delete_txn_admin_payment']['PAY_ID']) ? absint($this->_req_data['delete_txn_admin_payment']['PAY_ID']) : 0; |
|
1619 | + if ($PAY_ID) { |
|
1620 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1621 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1622 | + if ($payment instanceof EE_Payment) { |
|
1623 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1624 | 1624 | /** @type EE_Transaction_Payments $transaction_payments */ |
1625 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1626 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1627 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1628 | - if ( $delete_txn_reg_status_change ) { |
|
1625 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1626 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1627 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1628 | + if ($delete_txn_reg_status_change) { |
|
1629 | 1629 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1630 | 1630 | //MAKE sure we also add the delete_txn_req_status_change to the |
1631 | 1631 | //$_REQUEST global because that's how messages will be looking for it. |
1632 | 1632 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1633 | 1633 | $this->_maybe_send_notifications(); |
1634 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1634 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1635 | 1635 | } |
1636 | 1636 | } |
1637 | 1637 | } else { |
1638 | 1638 | EE_Error::add_error( |
1639 | - esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1639 | + esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1640 | 1640 | __FILE__, __FUNCTION__, __LINE__ |
1641 | 1641 | ); |
1642 | 1642 | } |
1643 | 1643 | } else { |
1644 | 1644 | EE_Error::add_error( |
1645 | - esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1645 | + esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1646 | 1646 | __FILE__, __FUNCTION__, __LINE__ |
1647 | 1647 | ); |
1648 | 1648 | } |
1649 | - $notices = EE_Error::get_notices( false, false, false); |
|
1649 | + $notices = EE_Error::get_notices(false, false, false); |
|
1650 | 1650 | $this->_template_args = array( |
1651 | 1651 | 'data' => $json_response_data, |
1652 | 1652 | 'success' => $notices['success'], |
@@ -1666,16 +1666,16 @@ discard block |
||
1666 | 1666 | * @param array $REG_IDs |
1667 | 1667 | * @return array |
1668 | 1668 | */ |
1669 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1669 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1670 | 1670 | $registration_payment_data = array(); |
1671 | 1671 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1672 | - if ( ! empty( $REG_IDs ) ) { |
|
1673 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1674 | - foreach ( $registrations as $registration ) { |
|
1675 | - if ( $registration instanceof EE_Registration ) { |
|
1676 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1672 | + if ( ! empty($REG_IDs)) { |
|
1673 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1674 | + foreach ($registrations as $registration) { |
|
1675 | + if ($registration instanceof EE_Registration) { |
|
1676 | + $registration_payment_data[$registration->ID()] = array( |
|
1677 | 1677 | 'paid' => $registration->pretty_paid(), |
1678 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1678 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1679 | 1679 | ); |
1680 | 1680 | } |
1681 | 1681 | } |
@@ -1695,30 +1695,30 @@ discard block |
||
1695 | 1695 | * @access protected |
1696 | 1696 | * @param \EE_Payment | null $payment |
1697 | 1697 | */ |
1698 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1699 | - switch ( $payment instanceof EE_Payment ) { |
|
1698 | + protected function _maybe_send_notifications($payment = null) { |
|
1699 | + switch ($payment instanceof EE_Payment) { |
|
1700 | 1700 | // payment notifications |
1701 | 1701 | case true : |
1702 | 1702 | if ( |
1703 | 1703 | isset( |
1704 | - $this->_req_data[ 'txn_payments' ], |
|
1705 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1704 | + $this->_req_data['txn_payments'], |
|
1705 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1706 | 1706 | ) && |
1707 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1707 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1708 | 1708 | ) { |
1709 | - $this->_process_payment_notification( $payment ); |
|
1709 | + $this->_process_payment_notification($payment); |
|
1710 | 1710 | } |
1711 | 1711 | break; |
1712 | 1712 | // registration notifications |
1713 | 1713 | case false : |
1714 | 1714 | if ( |
1715 | 1715 | isset( |
1716 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1717 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1716 | + $this->_req_data['txn_reg_status_change'], |
|
1717 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1718 | 1718 | ) && |
1719 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1719 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1720 | 1720 | ) { |
1721 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1721 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1722 | 1722 | } |
1723 | 1723 | break; |
1724 | 1724 | } |
@@ -1734,11 +1734,11 @@ discard block |
||
1734 | 1734 | * @return void |
1735 | 1735 | */ |
1736 | 1736 | protected function _send_payment_reminder() { |
1737 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1738 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1739 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1740 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1741 | - $this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE ); |
|
1737 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1738 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1739 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1740 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1741 | + $this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE); |
|
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | |
@@ -1752,36 +1752,36 @@ discard block |
||
1752 | 1752 | * @param string $view |
1753 | 1753 | * @return mixed int = count || array of transaction objects |
1754 | 1754 | */ |
1755 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1755 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1756 | 1756 | |
1757 | 1757 | $TXN = EEM_Transaction::instance(); |
1758 | 1758 | |
1759 | - $start_date = isset( $this->_req_data['txn-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-10 year' )); |
|
1760 | - $end_date = isset( $this->_req_data['txn-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['txn-filter-end-date'] ) : date( 'm/d/Y' ); |
|
1759 | + $start_date = isset($this->_req_data['txn-filter-start-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-start-date']) : date('m/d/Y', strtotime('-10 year')); |
|
1760 | + $end_date = isset($this->_req_data['txn-filter-end-date']) ? wp_strip_all_tags($this->_req_data['txn-filter-end-date']) : date('m/d/Y'); |
|
1761 | 1761 | |
1762 | 1762 | //make sure our timestamps start and end right at the boundaries for each day |
1763 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1764 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1763 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1764 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1765 | 1765 | |
1766 | 1766 | |
1767 | 1767 | //convert to timestamps |
1768 | - $start_date = strtotime( $start_date ); |
|
1769 | - $end_date = strtotime( $end_date ); |
|
1768 | + $start_date = strtotime($start_date); |
|
1769 | + $end_date = strtotime($end_date); |
|
1770 | 1770 | |
1771 | 1771 | //makes sure start date is the lowest value and vice versa |
1772 | - $start_date = min( $start_date, $end_date ); |
|
1773 | - $end_date = max( $start_date, $end_date ); |
|
1772 | + $start_date = min($start_date, $end_date); |
|
1773 | + $end_date = max($start_date, $end_date); |
|
1774 | 1774 | |
1775 | 1775 | //convert to correct format for query |
1776 | - $start_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' ); |
|
1777 | - $end_date = EEM_Transaction::instance()->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' ); |
|
1776 | + $start_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s'); |
|
1777 | + $end_date = EEM_Transaction::instance()->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s'); |
|
1778 | 1778 | |
1779 | 1779 | |
1780 | 1780 | |
1781 | 1781 | //set orderby |
1782 | 1782 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1783 | 1783 | |
1784 | - switch ( $this->_req_data['orderby'] ) { |
|
1784 | + switch ($this->_req_data['orderby']) { |
|
1785 | 1785 | case 'TXN_ID': |
1786 | 1786 | $orderby = 'TXN_ID'; |
1787 | 1787 | break; |
@@ -1795,66 +1795,66 @@ discard block |
||
1795 | 1795 | $orderby = 'TXN_timestamp'; |
1796 | 1796 | } |
1797 | 1797 | |
1798 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1799 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1800 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1801 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1798 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1799 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1800 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1801 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1802 | 1802 | |
1803 | - $offset = ($current_page-1)*$per_page; |
|
1804 | - $limit = array( $offset, $per_page ); |
|
1803 | + $offset = ($current_page - 1) * $per_page; |
|
1804 | + $limit = array($offset, $per_page); |
|
1805 | 1805 | |
1806 | 1806 | $_where = array( |
1807 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1807 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1808 | 1808 | 'Registration.REG_count' => 1 |
1809 | 1809 | ); |
1810 | 1810 | |
1811 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1811 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1812 | 1812 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1813 | 1813 | } |
1814 | 1814 | |
1815 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1816 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1815 | + if (isset($this->_req_data['s'])) { |
|
1816 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1817 | 1817 | $_where['OR'] = array( |
1818 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1819 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1820 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1821 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1822 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1823 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1824 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1825 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1826 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1827 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1828 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1829 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1830 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1831 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1832 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1833 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1834 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1835 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1836 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1837 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1838 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1818 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1819 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1820 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1821 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1822 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1823 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1824 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1825 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1826 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1827 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1828 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1829 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1830 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1831 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1832 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1833 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1834 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1835 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1836 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1837 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1838 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1839 | 1839 | ); |
1840 | 1840 | } |
1841 | 1841 | |
1842 | 1842 | //failed transactions |
1843 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) || ( $count && $view == 'failed' ) ? TRUE: FALSE; |
|
1844 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) || ( $count && $view == 'abandoned' ) ? TRUE: FALSE; |
|
1843 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) || ($count && $view == 'failed') ? TRUE : FALSE; |
|
1844 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) || ($count && $view == 'abandoned') ? TRUE : FALSE; |
|
1845 | 1845 | |
1846 | - if ( $failed ) { |
|
1847 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1848 | - } else if ( $abandoned ) { |
|
1846 | + if ($failed) { |
|
1847 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1848 | + } else if ($abandoned) { |
|
1849 | 1849 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1850 | 1850 | } else { |
1851 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1852 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1851 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1852 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1853 | 1853 | } |
1854 | 1854 | |
1855 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1855 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1856 | 1856 | |
1857 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1857 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1858 | 1858 | |
1859 | 1859 | |
1860 | 1860 | return $transactions; |