@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | */ |
14 | 14 | class EE_Payment_Processor extends EE_Processor_Base { |
15 | 15 | /** |
16 | - * @var EE_Payment_Processor $_instance |
|
16 | + * @var EE_Payment_Processor $_instance |
|
17 | 17 | * @access private |
18 | - */ |
|
18 | + */ |
|
19 | 19 | private static $_instance; |
20 | 20 | |
21 | 21 | |
@@ -51,7 +51,6 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * Using the selected gateway, processes the payment for that transaction, and updates the transaction appropriately. |
53 | 53 | * Saves the payment that is generated |
54 | - |
|
55 | 54 | * |
56 | 55 | *@param EE_Payment_Method $payment_method |
57 | 56 | * @param EE_Transaction $transaction |
@@ -131,7 +130,6 @@ discard block |
||
131 | 130 | |
132 | 131 | |
133 | 132 | /** |
134 | - |
|
135 | 133 | * @param EE_Transaction|int $transaction |
136 | 134 | * @param EE_Payment_Method $payment_method |
137 | 135 | * @throws EE_Error |
@@ -694,12 +692,12 @@ discard block |
||
694 | 692 | } |
695 | 693 | |
696 | 694 | /** |
697 | - * Force posts to PayPal to use TLS v1.2. See: |
|
698 | - * https://core.trac.wordpress.org/ticket/36320 |
|
699 | - * https://core.trac.wordpress.org/ticket/34924#comment:15 |
|
700 | - * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
|
695 | + * Force posts to PayPal to use TLS v1.2. See: |
|
696 | + * https://core.trac.wordpress.org/ticket/36320 |
|
697 | + * https://core.trac.wordpress.org/ticket/34924#comment:15 |
|
698 | + * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
|
701 | 699 | * This will affect paypal standard, pro, express, and payflow. |
702 | - */ |
|
700 | + */ |
|
703 | 701 | public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) { |
704 | 702 | if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) { |
705 | 703 | //Use the value of the constant CURL_SSLVERSION_TLSv1 = 1 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EE_Payment_Processor |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public static function instance() { |
29 | 29 | // check if class object is instantiated |
30 | - if ( ! self::$_instance instanceof EE_Payment_Processor ) { |
|
30 | + if ( ! self::$_instance instanceof EE_Payment_Processor) { |
|
31 | 31 | self::$_instance = new self(); |
32 | 32 | } |
33 | 33 | return self::$_instance; |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | *@access private |
42 | 42 | */ |
43 | 43 | private function __construct() { |
44 | - do_action( 'AHEE__EE_Payment_Processor__construct' ); |
|
45 | - add_action( 'http_api_curl', array( $this, '_curl_requests_to_paypal_use_tls' ), 10, 3 ); |
|
44 | + do_action('AHEE__EE_Payment_Processor__construct'); |
|
45 | + add_action('http_api_curl', array($this, '_curl_requests_to_paypal_use_tls'), 10, 3); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $update_txn = true, |
82 | 82 | $cancel_url = '' |
83 | 83 | ) { |
84 | - if( (float)$amount < 0 ) { |
|
84 | + if ((float) $amount < 0) { |
|
85 | 85 | throw new EE_Error( |
86 | 86 | sprintf( |
87 | 87 | __( |
@@ -94,33 +94,33 @@ discard block |
||
94 | 94 | ); |
95 | 95 | } |
96 | 96 | // verify payment method |
97 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj( $payment_method, TRUE ); |
|
97 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, TRUE); |
|
98 | 98 | // verify transaction |
99 | - EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
100 | - $transaction->set_payment_method_ID( $payment_method->ID() ); |
|
99 | + EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
100 | + $transaction->set_payment_method_ID($payment_method->ID()); |
|
101 | 101 | // verify payment method type |
102 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
102 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
103 | 103 | $payment = $payment_method->type_obj()->process_payment( |
104 | 104 | $transaction, |
105 | - min( $amount, $transaction->remaining() ),//make sure we don't overcharge |
|
105 | + min($amount, $transaction->remaining()), //make sure we don't overcharge |
|
106 | 106 | $billing_form, |
107 | 107 | $return_url, |
108 | - add_query_arg( array( 'ee_cancel_payment' => true ), $cancel_url ), |
|
108 | + add_query_arg(array('ee_cancel_payment' => true), $cancel_url), |
|
109 | 109 | $method, |
110 | 110 | $by_admin |
111 | 111 | ); |
112 | 112 | // check if payment method uses an off-site gateway |
113 | - if ( $payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite ) { |
|
113 | + if ($payment_method->type_obj()->payment_occurs() !== EE_PMT_Base::offsite) { |
|
114 | 114 | // don't process payments for off-site gateways yet because no payment has occurred yet |
115 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
115 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
116 | 116 | } |
117 | 117 | return $payment; |
118 | 118 | } else { |
119 | 119 | EE_Error::add_error( |
120 | 120 | sprintf( |
121 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
121 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
122 | 122 | '<br/>', |
123 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
123 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
124 | 124 | ), __FILE__, __FUNCTION__, __LINE__ |
125 | 125 | ); |
126 | 126 | return NULL; |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * @throws EE_Error |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - public function get_ipn_url_for_payment_method( $transaction, $payment_method ){ |
|
139 | + public function get_ipn_url_for_payment_method($transaction, $payment_method) { |
|
140 | 140 | /** @type \EE_Transaction $transaction */ |
141 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
141 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
142 | 142 | $primary_reg = $transaction->primary_registration(); |
143 | - if( ! $primary_reg instanceof EE_Registration ){ |
|
143 | + if ( ! $primary_reg instanceof EE_Registration) { |
|
144 | 144 | throw new EE_Error( |
145 | 145 | sprintf( |
146 | 146 | __( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ) |
152 | 152 | ); |
153 | 153 | } |
154 | - $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method,true); |
|
154 | + $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method, true); |
|
155 | 155 | $url = add_query_arg( |
156 | 156 | array( |
157 | 157 | 'e_reg_url_link'=>$primary_reg->reg_url_link(), |
@@ -188,92 +188,92 @@ discard block |
||
188 | 188 | $update_txn = true, |
189 | 189 | $separate_IPN_request = true |
190 | 190 | ) { |
191 | - EE_Registry::instance()->load_model( 'Change_Log' ); |
|
192 | - $_req_data = $this->_remove_unusable_characters_from_array( (array)$_req_data ); |
|
193 | - EE_Processor_Base::set_IPN( $separate_IPN_request ); |
|
191 | + EE_Registry::instance()->load_model('Change_Log'); |
|
192 | + $_req_data = $this->_remove_unusable_characters_from_array((array) $_req_data); |
|
193 | + EE_Processor_Base::set_IPN($separate_IPN_request); |
|
194 | 194 | $obj_for_log = null; |
195 | - if( $transaction instanceof EE_Transaction ){ |
|
195 | + if ($transaction instanceof EE_Transaction) { |
|
196 | 196 | $obj_for_log = $transaction; |
197 | - if( $payment_method instanceof EE_Payment_Method ) { |
|
197 | + if ($payment_method instanceof EE_Payment_Method) { |
|
198 | 198 | $obj_for_log = EEM_Payment::instance()->get_one( |
199 | 199 | array( |
200 | - array( 'TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID() ), |
|
201 | - 'order_by' => array( 'PAY_timestamp' => 'desc' ) |
|
200 | + array('TXN_ID' => $transaction->ID(), 'PMD_ID' => $payment_method->ID()), |
|
201 | + 'order_by' => array('PAY_timestamp' => 'desc') |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | } |
205 | - } else if( $payment_method instanceof EE_Payment ) { |
|
205 | + } else if ($payment_method instanceof EE_Payment) { |
|
206 | 206 | $obj_for_log = $payment_method; |
207 | 207 | } |
208 | 208 | $log = EEM_Change_Log::instance()->log( |
209 | 209 | EEM_Change_Log::type_gateway, |
210 | - array( 'IPN data received' => $_req_data ), |
|
210 | + array('IPN data received' => $_req_data), |
|
211 | 211 | $obj_for_log |
212 | 212 | ); |
213 | - try{ |
|
213 | + try { |
|
214 | 214 | /** |
215 | 215 | * @var EE_Payment $payment |
216 | 216 | */ |
217 | 217 | $payment = NULL; |
218 | - if($transaction && $payment_method){ |
|
218 | + if ($transaction && $payment_method) { |
|
219 | 219 | /** @type EE_Transaction $transaction */ |
220 | 220 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
221 | 221 | /** @type EE_Payment_Method $payment_method */ |
222 | 222 | $payment_method = EEM_Payment_Method::instance()->ensure_is_obj($payment_method); |
223 | - if ( $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
224 | - $payment = $payment_method->type_obj()->handle_ipn( $_req_data, $transaction ); |
|
223 | + if ($payment_method->type_obj() instanceof EE_PMT_Base) { |
|
224 | + $payment = $payment_method->type_obj()->handle_ipn($_req_data, $transaction); |
|
225 | 225 | $log->set_object($payment); |
226 | 226 | } else { |
227 | 227 | // not a payment |
228 | 228 | EE_Error::add_error( |
229 | 229 | sprintf( |
230 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso' ), |
|
230 | + __('A valid payment method could not be determined due to a technical issue.%sPlease refresh your browser and try again or contact %s for assistance.', 'event_espresso'), |
|
231 | 231 | '<br/>', |
232 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
232 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
233 | 233 | ), |
234 | 234 | __FILE__, __FUNCTION__, __LINE__ |
235 | 235 | ); |
236 | 236 | } |
237 | - }else{ |
|
237 | + } else { |
|
238 | 238 | //that's actually pretty ok. The IPN just wasn't able |
239 | 239 | //to identify which transaction or payment method this was for |
240 | 240 | // give all active payment methods a chance to claim it |
241 | 241 | $active_payment_methods = EEM_Payment_Method::instance()->get_all_active(); |
242 | - foreach( $active_payment_methods as $active_payment_method ){ |
|
243 | - try{ |
|
244 | - $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn( $_req_data ); |
|
242 | + foreach ($active_payment_methods as $active_payment_method) { |
|
243 | + try { |
|
244 | + $payment = $active_payment_method->type_obj()->handle_unclaimed_ipn($_req_data); |
|
245 | 245 | $payment_method = $active_payment_method; |
246 | 246 | EEM_Change_Log::instance()->log( |
247 | 247 | EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment |
248 | 248 | ); |
249 | 249 | break; |
250 | - } catch( EE_Error $e ) { |
|
250 | + } catch (EE_Error $e) { |
|
251 | 251 | //that's fine- it apparently couldn't handle the IPN |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | } |
256 | 256 | // EEM_Payment_Log::instance()->log("got to 7",$transaction,$payment_method); |
257 | - if( $payment instanceof EE_Payment){ |
|
257 | + if ($payment instanceof EE_Payment) { |
|
258 | 258 | $payment->save(); |
259 | 259 | // update the TXN |
260 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn, $separate_IPN_request ); |
|
261 | - }else{ |
|
260 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn, $separate_IPN_request); |
|
261 | + } else { |
|
262 | 262 | //we couldn't find the payment for this IPN... let's try and log at least SOMETHING |
263 | - if($payment_method){ |
|
263 | + if ($payment_method) { |
|
264 | 264 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $payment_method); |
265 | - }elseif($transaction){ |
|
265 | + }elseif ($transaction) { |
|
266 | 266 | EEM_Change_Log::instance()->log(EEM_Change_Log::type_gateway, array('IPN data'=>$_req_data), $transaction); |
267 | 267 | } |
268 | 268 | } |
269 | 269 | return $payment; |
270 | 270 | |
271 | - } catch( EE_Error $e ) { |
|
271 | + } catch (EE_Error $e) { |
|
272 | 272 | do_action( |
273 | 273 | 'AHEE__log', __FILE__, __FUNCTION__, sprintf( |
274 | - __( 'Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso' ), |
|
275 | - print_r( $transaction, TRUE ), |
|
276 | - print_r( $_req_data, TRUE ), |
|
274 | + __('Error occurred while receiving IPN. Transaction: %1$s, req data: %2$s. The error was "%3$s"', 'event_espresso'), |
|
275 | + print_r($transaction, TRUE), |
|
276 | + print_r($_req_data, TRUE), |
|
277 | 277 | $e->getMessage() |
278 | 278 | ) |
279 | 279 | ); |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param array $request_data |
289 | 289 | * @return array |
290 | 290 | */ |
291 | - protected function _remove_unusable_characters_from_array( array $request_data ) { |
|
291 | + protected function _remove_unusable_characters_from_array(array $request_data) { |
|
292 | 292 | $return_data = array(); |
293 | - foreach( $request_data as $key => $value ) { |
|
294 | - $return_data[ $this->_remove_unusable_characters( $key ) ] = $this->_remove_unusable_characters( $value ); |
|
293 | + foreach ($request_data as $key => $value) { |
|
294 | + $return_data[$this->_remove_unusable_characters($key)] = $this->_remove_unusable_characters($value); |
|
295 | 295 | } |
296 | 296 | return $return_data; |
297 | 297 | } |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | * @param string $request_data |
304 | 304 | * @return string |
305 | 305 | */ |
306 | - protected function _remove_unusable_characters( $request_data ) { |
|
307 | - return preg_replace( '/[^[:print:]]/', '', $request_data ); |
|
306 | + protected function _remove_unusable_characters($request_data) { |
|
307 | + return preg_replace('/[^[:print:]]/', '', $request_data); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | |
@@ -326,13 +326,13 @@ discard block |
||
326 | 326 | * @deprecated 4.6.24 method is no longer used. Instead it is up to client code, like SPCO, |
327 | 327 | * to call handle_ipn() for offsite gateways that don't receive separate IPNs |
328 | 328 | */ |
329 | - public function finalize_payment_for( $transaction, $update_txn = TRUE ){ |
|
329 | + public function finalize_payment_for($transaction, $update_txn = TRUE) { |
|
330 | 330 | /** @var $transaction EE_Transaction */ |
331 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
331 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
332 | 332 | $last_payment_method = $transaction->payment_method(); |
333 | - if ( $last_payment_method instanceof EE_Payment_Method ) { |
|
334 | - $payment = $last_payment_method->type_obj()->finalize_payment_for( $transaction ); |
|
335 | - $this->update_txn_based_on_payment( $transaction, $payment, $update_txn ); |
|
333 | + if ($last_payment_method instanceof EE_Payment_Method) { |
|
334 | + $payment = $last_payment_method->type_obj()->finalize_payment_for($transaction); |
|
335 | + $this->update_txn_based_on_payment($transaction, $payment, $update_txn); |
|
336 | 336 | return $payment; |
337 | 337 | } else { |
338 | 338 | return NULL; |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | EE_Payment $payment_to_refund, |
356 | 356 | $refund_info = array() |
357 | 357 | ) { |
358 | - if ( $payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds() ) { |
|
359 | - $payment_method->type_obj()->process_refund( $payment_to_refund, $refund_info ); |
|
360 | - $this->update_txn_based_on_payment( $payment_to_refund->transaction(), $payment_to_refund ); |
|
358 | + if ($payment_method instanceof EE_Payment_Method && $payment_method->type_obj()->supports_sending_refunds()) { |
|
359 | + $payment_method->type_obj()->process_refund($payment_to_refund, $refund_info); |
|
360 | + $this->update_txn_based_on_payment($payment_to_refund->transaction(), $payment_to_refund); |
|
361 | 361 | } |
362 | 362 | return $payment_to_refund; |
363 | 363 | } |
@@ -398,12 +398,12 @@ discard block |
||
398 | 398 | * TXN is locked before updating |
399 | 399 | * @throws \EE_Error |
400 | 400 | */ |
401 | - public function update_txn_based_on_payment( $transaction, $payment, $update_txn = true, $IPN = false ){ |
|
401 | + public function update_txn_based_on_payment($transaction, $payment, $update_txn = true, $IPN = false) { |
|
402 | 402 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__not_successful'; |
403 | 403 | /** @type EE_Transaction $transaction */ |
404 | - $transaction = EEM_Transaction::instance()->ensure_is_obj( $transaction ); |
|
404 | + $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
|
405 | 405 | // can we freely update the TXN at this moment? |
406 | - if ( $IPN && $transaction->is_locked() ) { |
|
406 | + if ($IPN && $transaction->is_locked()) { |
|
407 | 407 | // don't update the transaction at this exact moment |
408 | 408 | // because the TXN is active in another request |
409 | 409 | EE_Cron_Tasks::schedule_update_transaction_with_payment( |
@@ -413,38 +413,38 @@ discard block |
||
413 | 413 | ); |
414 | 414 | } else { |
415 | 415 | // verify payment and that it has been saved |
416 | - if ( $payment instanceof EE_Payment && $payment->ID() ) { |
|
417 | - if( |
|
416 | + if ($payment instanceof EE_Payment && $payment->ID()) { |
|
417 | + if ( |
|
418 | 418 | $payment->payment_method() instanceof EE_Payment_Method |
419 | 419 | && $payment->payment_method()->type_obj() instanceof EE_PMT_Base |
420 | - ){ |
|
421 | - $payment->payment_method()->type_obj()->update_txn_based_on_payment( $payment ); |
|
420 | + ) { |
|
421 | + $payment->payment_method()->type_obj()->update_txn_based_on_payment($payment); |
|
422 | 422 | // update TXN registrations with payment info |
423 | - $this->process_registration_payments( $transaction, $payment ); |
|
423 | + $this->process_registration_payments($transaction, $payment); |
|
424 | 424 | } |
425 | 425 | $do_action = $payment->just_approved() |
426 | 426 | ? 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__successful' |
427 | 427 | : $do_action; |
428 | 428 | } else { |
429 | 429 | // send out notifications |
430 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
430 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
431 | 431 | $do_action = 'AHEE__EE_Payment_Processor__update_txn_based_on_payment__no_payment_made'; |
432 | 432 | } |
433 | - if ( $payment->status() !== EEM_Payment::status_id_failed ) { |
|
433 | + if ($payment->status() !== EEM_Payment::status_id_failed) { |
|
434 | 434 | /** @type EE_Transaction_Payments $transaction_payments */ |
435 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
435 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
436 | 436 | // set new value for total paid |
437 | - $transaction_payments->calculate_total_payments_and_update_status( $transaction ); |
|
437 | + $transaction_payments->calculate_total_payments_and_update_status($transaction); |
|
438 | 438 | // call EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment() ??? |
439 | - if ( $update_txn ) { |
|
440 | - $this->_post_payment_processing( $transaction, $payment, $IPN ); |
|
439 | + if ($update_txn) { |
|
440 | + $this->_post_payment_processing($transaction, $payment, $IPN); |
|
441 | 441 | } |
442 | 442 | } |
443 | 443 | // granular hook for others to use. |
444 | - do_action( $do_action, $transaction, $payment ); |
|
445 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action' ); |
|
444 | + do_action($do_action, $transaction, $payment); |
|
445 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $do_action, '$do_action'); |
|
446 | 446 | //global hook for others to use. |
447 | - do_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment ); |
|
447 | + do_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', $transaction, $payment); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -464,25 +464,25 @@ discard block |
||
464 | 464 | $registrations = array() |
465 | 465 | ) { |
466 | 466 | // only process if payment was successful |
467 | - if ( $payment->status() !== EEM_Payment::status_id_approved ) { |
|
467 | + if ($payment->status() !== EEM_Payment::status_id_approved) { |
|
468 | 468 | return; |
469 | 469 | } |
470 | 470 | //EEM_Registration::instance()->show_next_x_db_queries(); |
471 | - if ( empty( $registrations )) { |
|
471 | + if (empty($registrations)) { |
|
472 | 472 | // find registrations with monies owing that can receive a payment |
473 | 473 | $registrations = $transaction->registrations( |
474 | 474 | array( |
475 | 475 | array( |
476 | 476 | // only these reg statuses can receive payments |
477 | - 'STS_ID' => array( 'IN', EEM_Registration::reg_statuses_that_allow_payment() ), |
|
478 | - 'REG_final_price' => array( '!=', 0 ), |
|
479 | - 'REG_final_price*' => array( '!=', 'REG_paid', true ), |
|
477 | + 'STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), |
|
478 | + 'REG_final_price' => array('!=', 0), |
|
479 | + 'REG_final_price*' => array('!=', 'REG_paid', true), |
|
480 | 480 | ) |
481 | 481 | ) |
482 | 482 | ); |
483 | 483 | } |
484 | 484 | // still nothing ??!?? |
485 | - if ( empty( $registrations )) { |
|
485 | + if (empty($registrations)) { |
|
486 | 486 | return; |
487 | 487 | } |
488 | 488 | // todo: break out the following logic into a separate strategy class |
@@ -494,28 +494,28 @@ discard block |
||
494 | 494 | |
495 | 495 | $refund = $payment->is_a_refund(); |
496 | 496 | // how much is available to apply to registrations? |
497 | - $available_payment_amount = abs( $payment->amount() ); |
|
498 | - foreach ( $registrations as $registration ) { |
|
499 | - if ( $registration instanceof EE_Registration ) { |
|
497 | + $available_payment_amount = abs($payment->amount()); |
|
498 | + foreach ($registrations as $registration) { |
|
499 | + if ($registration instanceof EE_Registration) { |
|
500 | 500 | // nothing left? |
501 | - if ( $available_payment_amount <= 0 ) { |
|
501 | + if ($available_payment_amount <= 0) { |
|
502 | 502 | break; |
503 | 503 | } |
504 | - if ( $refund ) { |
|
505 | - $available_payment_amount = $this->process_registration_refund( $registration, $payment, $available_payment_amount ); |
|
504 | + if ($refund) { |
|
505 | + $available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount); |
|
506 | 506 | } else { |
507 | - $available_payment_amount = $this->process_registration_payment( $registration, $payment, $available_payment_amount ); |
|
507 | + $available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount); |
|
508 | 508 | } |
509 | 509 | } |
510 | 510 | } |
511 | - if ( $available_payment_amount > 0 && apply_filters( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false ) ) { |
|
511 | + if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) { |
|
512 | 512 | EE_Error::add_attention( |
513 | 513 | sprintf( |
514 | - __( 'A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso' ), |
|
515 | - EEH_Template::format_currency( $available_payment_amount ), |
|
516 | - implode( ', ', array_keys( $registrations ) ), |
|
514 | + __('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), |
|
515 | + EEH_Template::format_currency($available_payment_amount), |
|
516 | + implode(', ', array_keys($registrations)), |
|
517 | 517 | '<br/>', |
518 | - EEH_Template::format_currency( $payment->amount() ) |
|
518 | + EEH_Template::format_currency($payment->amount()) |
|
519 | 519 | ), |
520 | 520 | __FILE__, __FUNCTION__, __LINE__ |
521 | 521 | ); |
@@ -533,17 +533,17 @@ discard block |
||
533 | 533 | * @return float |
534 | 534 | * @throws \EE_Error |
535 | 535 | */ |
536 | - public function process_registration_payment( EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00 ) { |
|
536 | + public function process_registration_payment(EE_Registration $registration, EE_Payment $payment, $available_payment_amount = 0.00) { |
|
537 | 537 | $owing = $registration->final_price() - $registration->paid(); |
538 | - if ( $owing > 0 ) { |
|
538 | + if ($owing > 0) { |
|
539 | 539 | // don't allow payment amount to exceed the available payment amount, OR the amount owing |
540 | - $payment_amount = min( $available_payment_amount, $owing ); |
|
540 | + $payment_amount = min($available_payment_amount, $owing); |
|
541 | 541 | // update $available_payment_amount |
542 | 542 | $available_payment_amount -= $payment_amount; |
543 | 543 | //calculate and set new REG_paid |
544 | - $registration->set_paid( $registration->paid() + $payment_amount ); |
|
544 | + $registration->set_paid($registration->paid() + $payment_amount); |
|
545 | 545 | // now save it |
546 | - $this->_apply_registration_payment( $registration, $payment, $payment_amount ); |
|
546 | + $this->_apply_registration_payment($registration, $payment, $payment_amount); |
|
547 | 547 | } |
548 | 548 | return $available_payment_amount; |
549 | 549 | } |
@@ -559,19 +559,19 @@ discard block |
||
559 | 559 | * @return void |
560 | 560 | * @throws \EE_Error |
561 | 561 | */ |
562 | - protected function _apply_registration_payment( EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00 ) { |
|
562 | + protected function _apply_registration_payment(EE_Registration $registration, EE_Payment $payment, $payment_amount = 0.00) { |
|
563 | 563 | // find any existing reg payment records for this registration and payment |
564 | 564 | $existing_reg_payment = EEM_Registration_Payment::instance()->get_one( |
565 | - array( array( 'REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID() ) ) |
|
565 | + array(array('REG_ID' => $registration->ID(), 'PAY_ID' => $payment->ID())) |
|
566 | 566 | ); |
567 | 567 | // if existing registration payment exists |
568 | - if ( $existing_reg_payment instanceof EE_Registration_Payment ) { |
|
568 | + if ($existing_reg_payment instanceof EE_Registration_Payment) { |
|
569 | 569 | // then update that record |
570 | - $existing_reg_payment->set_amount( $payment_amount ); |
|
570 | + $existing_reg_payment->set_amount($payment_amount); |
|
571 | 571 | $existing_reg_payment->save(); |
572 | 572 | } else { |
573 | 573 | // or add new relation between registration and payment and set amount |
574 | - $registration->_add_relation_to( $payment, 'Payment', array( 'RPY_amount' => $payment_amount ) ); |
|
574 | + $registration->_add_relation_to($payment, 'Payment', array('RPY_amount' => $payment_amount)); |
|
575 | 575 | // make it stick |
576 | 576 | $registration->save(); |
577 | 577 | } |
@@ -588,21 +588,21 @@ discard block |
||
588 | 588 | * @return float |
589 | 589 | * @throws \EE_Error |
590 | 590 | */ |
591 | - public function process_registration_refund( EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00 ) { |
|
591 | + public function process_registration_refund(EE_Registration $registration, EE_Payment $payment, $available_refund_amount = 0.00) { |
|
592 | 592 | //EEH_Debug_Tools::printr( $payment->amount(), '$payment->amount()', __FILE__, __LINE__ ); |
593 | - if ( $registration->paid() > 0 ) { |
|
593 | + if ($registration->paid() > 0) { |
|
594 | 594 | // ensure $available_refund_amount is NOT negative |
595 | - $available_refund_amount = (float)abs( $available_refund_amount ); |
|
595 | + $available_refund_amount = (float) abs($available_refund_amount); |
|
596 | 596 | // don't allow refund amount to exceed the available payment amount, OR the amount paid |
597 | - $refund_amount = min( $available_refund_amount, (float)$registration->paid() ); |
|
597 | + $refund_amount = min($available_refund_amount, (float) $registration->paid()); |
|
598 | 598 | // update $available_payment_amount |
599 | 599 | $available_refund_amount -= $refund_amount; |
600 | 600 | //calculate and set new REG_paid |
601 | - $registration->set_paid( $registration->paid() - $refund_amount ); |
|
601 | + $registration->set_paid($registration->paid() - $refund_amount); |
|
602 | 602 | // convert payment amount back to a negative value for storage in the db |
603 | - $refund_amount = (float)abs( $refund_amount ) * -1; |
|
603 | + $refund_amount = (float) abs($refund_amount) * -1; |
|
604 | 604 | // now save it |
605 | - $this->_apply_registration_payment( $registration, $payment, $refund_amount ); |
|
605 | + $this->_apply_registration_payment($registration, $payment, $refund_amount); |
|
606 | 606 | } |
607 | 607 | return $available_refund_amount; |
608 | 608 | } |
@@ -621,53 +621,53 @@ discard block |
||
621 | 621 | * @param bool $IPN |
622 | 622 | * @throws \EE_Error |
623 | 623 | */ |
624 | - protected function _post_payment_processing( EE_Transaction $transaction, EE_Payment $payment, $IPN = false ) { |
|
624 | + protected function _post_payment_processing(EE_Transaction $transaction, EE_Payment $payment, $IPN = false) { |
|
625 | 625 | |
626 | 626 | /** @type EE_Transaction_Processor $transaction_processor */ |
627 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
627 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
628 | 628 | // is the Payment Options Reg Step completed ? |
629 | - $payment_options_step_completed = $transaction->reg_step_completed( 'payment_options' ); |
|
629 | + $payment_options_step_completed = $transaction->reg_step_completed('payment_options'); |
|
630 | 630 | // if the Payment Options Reg Step is completed... |
631 | 631 | $revisit = $payment_options_step_completed === true ? true : false; |
632 | 632 | // then this is kinda sorta a revisit with regards to payments at least |
633 | - $transaction_processor->set_revisit( $revisit ); |
|
633 | + $transaction_processor->set_revisit($revisit); |
|
634 | 634 | // if this is an IPN, let's consider the Payment Options Reg Step completed if not already |
635 | 635 | if ( |
636 | 636 | $IPN && |
637 | 637 | $payment_options_step_completed !== true && |
638 | - ( $payment->is_approved() || $payment->is_pending() ) |
|
638 | + ($payment->is_approved() || $payment->is_pending()) |
|
639 | 639 | ) { |
640 | 640 | $payment_options_step_completed = $transaction->set_reg_step_completed( |
641 | 641 | 'payment_options' |
642 | 642 | ); |
643 | 643 | } |
644 | 644 | // maybe update status, but don't save transaction just yet |
645 | - $transaction->update_status_based_on_total_paid( false ); |
|
645 | + $transaction->update_status_based_on_total_paid(false); |
|
646 | 646 | // check if 'finalize_registration' step has been completed... |
647 | - $finalized = $transaction->reg_step_completed( 'finalize_registration' ); |
|
647 | + $finalized = $transaction->reg_step_completed('finalize_registration'); |
|
648 | 648 | // if this is an IPN and the final step has not been initiated |
649 | - if ( $IPN && $payment_options_step_completed && $finalized === false ) { |
|
649 | + if ($IPN && $payment_options_step_completed && $finalized === false) { |
|
650 | 650 | // and if it hasn't already been set as being started... |
651 | - $finalized = $transaction->set_reg_step_initiated( 'finalize_registration' ); |
|
651 | + $finalized = $transaction->set_reg_step_initiated('finalize_registration'); |
|
652 | 652 | } |
653 | 653 | $transaction->save(); |
654 | 654 | // because the above will return false if the final step was not fully completed, we need to check again... |
655 | - if ( $IPN && $finalized !== false ) { |
|
655 | + if ($IPN && $finalized !== false) { |
|
656 | 656 | // and if we are all good to go, then send out notifications |
657 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
657 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
658 | 658 | //ok, now process the transaction according to the payment |
659 | - $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $transaction, $payment ); |
|
659 | + $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($transaction, $payment); |
|
660 | 660 | } |
661 | 661 | // DEBUG LOG |
662 | 662 | $payment_method = $payment->payment_method(); |
663 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
663 | + if ($payment_method instanceof EE_Payment_Method) { |
|
664 | 664 | $payment_method_type_obj = $payment_method->type_obj(); |
665 | - if ( $payment_method_type_obj instanceof EE_PMT_Base ) { |
|
665 | + if ($payment_method_type_obj instanceof EE_PMT_Base) { |
|
666 | 666 | $gateway = $payment_method_type_obj->get_gateway(); |
667 | - if ( $gateway instanceof EE_Gateway ){ |
|
667 | + if ($gateway instanceof EE_Gateway) { |
|
668 | 668 | $gateway->log( |
669 | 669 | array( |
670 | - 'message' => __( 'Post Payment Transaction Details', 'event_espresso' ), |
|
670 | + 'message' => __('Post Payment Transaction Details', 'event_espresso'), |
|
671 | 671 | 'transaction' => $transaction->model_field_array(), |
672 | 672 | 'finalized' => $finalized, |
673 | 673 | 'IPN' => $IPN, |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US |
690 | 690 | * This will affect paypal standard, pro, express, and payflow. |
691 | 691 | */ |
692 | - public static function _curl_requests_to_paypal_use_tls( $handle, $r, $url ) { |
|
693 | - if ( strstr( $url, 'https://' ) && strstr( $url, '.paypal.com' ) ) { |
|
692 | + public static function _curl_requests_to_paypal_use_tls($handle, $r, $url) { |
|
693 | + if (strstr($url, 'https://') && strstr($url, '.paypal.com')) { |
|
694 | 694 | //Use the value of the constant CURL_SSLVERSION_TLSv1 = 1 |
695 | 695 | //instead of the constant because it might not be defined |
696 | - curl_setopt( $handle, CURLOPT_SSLVERSION, 1 ); |
|
696 | + curl_setopt($handle, CURLOPT_SSLVERSION, 1); |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | } |
@@ -1311,8 +1311,8 @@ discard block |
||
1311 | 1311 | * verifies user access for this admin page |
1312 | 1312 | * @param string $route_to_check if present then the capability for the route matching this string is checked. |
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | - * @return BOOL|wp_die() |
|
1315 | - */ |
|
1314 | + * @return BOOL|wp_die() |
|
1315 | + */ |
|
1316 | 1316 | public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
1317 | 1317 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1318 | 1318 | $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
@@ -1698,11 +1698,11 @@ discard block |
||
1698 | 1698 | |
1699 | 1699 | |
1700 | 1700 | /** |
1701 | - * admin_footer_scripts_eei18n_js_strings |
|
1702 | - * |
|
1703 | - * @access public |
|
1704 | - * @return void |
|
1705 | - */ |
|
1701 | + * admin_footer_scripts_eei18n_js_strings |
|
1702 | + * |
|
1703 | + * @access public |
|
1704 | + * @return void |
|
1705 | + */ |
|
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
@@ -1758,11 +1758,11 @@ discard block |
||
1758 | 1758 | |
1759 | 1759 | |
1760 | 1760 | /** |
1761 | - * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | - * |
|
1763 | - * @access public |
|
1764 | - * @return void |
|
1765 | - */ |
|
1761 | + * load enhanced xdebug styles for ppl with failing eyesight |
|
1762 | + * |
|
1763 | + * @access public |
|
1764 | + * @return void |
|
1765 | + */ |
|
1766 | 1766 | public function add_xdebug_style() { |
1767 | 1767 | echo '<style>.xdebug-error { font-size:1.5em; }</style>'; |
1768 | 1768 | } |
@@ -1819,9 +1819,9 @@ discard block |
||
1819 | 1819 | |
1820 | 1820 | /** |
1821 | 1821 | * set current view for List Table |
1822 | - * @access public |
|
1823 | - * @return array |
|
1824 | - */ |
|
1822 | + * @access public |
|
1823 | + * @return array |
|
1824 | + */ |
|
1825 | 1825 | protected function _set_list_table_view() { |
1826 | 1826 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1827 | 1827 | |
@@ -1910,7 +1910,7 @@ discard block |
||
1910 | 1910 | * @access protected |
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | - */ |
|
1913 | + */ |
|
1914 | 1914 | protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
1915 | 1915 | |
1916 | 1916 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1955,9 +1955,9 @@ discard block |
||
1955 | 1955 | |
1956 | 1956 | /** |
1957 | 1957 | * _set_search_attributes |
1958 | - * @access protected |
|
1959 | - * @return void |
|
1960 | - */ |
|
1958 | + * @access protected |
|
1959 | + * @return void |
|
1960 | + */ |
|
1961 | 1961 | public function _set_search_attributes() { |
1962 | 1962 | $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
1963 | 1963 | $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | * @link http://codex.wordpress.org/Function_Reference/add_meta_box |
1978 | 1978 | * @access private |
1979 | 1979 | * @return void |
1980 | - */ |
|
1980 | + */ |
|
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | 1982 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1983 | 1983 | |
@@ -2027,13 +2027,13 @@ discard block |
||
2027 | 2027 | * @return void |
2028 | 2028 | */ |
2029 | 2029 | private function _add_screen_columns() { |
2030 | - if ( |
|
2031 | - is_array($this->_route_config) |
|
2032 | - && isset( $this->_route_config['columns'] ) |
|
2033 | - && is_array($this->_route_config['columns']) |
|
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2035 | - ) { |
|
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2030 | + if ( |
|
2031 | + is_array($this->_route_config) |
|
2032 | + && isset( $this->_route_config['columns'] ) |
|
2033 | + && is_array($this->_route_config['columns']) |
|
2034 | + && count( $this->_route_config['columns'] ) === 2 |
|
2035 | + ) { |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
@@ -2213,7 +2213,6 @@ discard block |
||
2213 | 2213 | * Note: currently there is no validation for this. However if you want the delete button, the |
2214 | 2214 | * save, and save and close buttons to work properly, then you will want to include a |
2215 | 2215 | * values for the name and id arguments. |
2216 | - |
|
2217 | 2216 | * |
2218 | 2217 | *@todo Add in validation for name/id arguments. |
2219 | 2218 | * @param string $name key used for the action ID (i.e. event_id) |
@@ -2272,9 +2271,9 @@ discard block |
||
2272 | 2271 | |
2273 | 2272 | /** |
2274 | 2273 | * displays an error message to ppl who have javascript disabled |
2275 | - * @access private |
|
2276 | - * @return string |
|
2277 | - */ |
|
2274 | + * @access private |
|
2275 | + * @return string |
|
2276 | + */ |
|
2278 | 2277 | private function _display_no_javascript_warning() { |
2279 | 2278 | ?> |
2280 | 2279 | <noscript> |
@@ -2297,9 +2296,9 @@ discard block |
||
2297 | 2296 | |
2298 | 2297 | /** |
2299 | 2298 | * displays espresso success and/or error notices |
2300 | - * @access private |
|
2301 | - * @return string |
|
2302 | - */ |
|
2299 | + * @access private |
|
2300 | + * @return string |
|
2301 | + */ |
|
2303 | 2302 | private function _display_espresso_notices() { |
2304 | 2303 | $notices = $this->_get_transient( TRUE ); |
2305 | 2304 | echo stripslashes($notices); |
@@ -2311,10 +2310,10 @@ discard block |
||
2311 | 2310 | |
2312 | 2311 | |
2313 | 2312 | /** |
2314 | - * spinny things pacify the masses |
|
2315 | - * @access private |
|
2316 | - * @return string |
|
2317 | - */ |
|
2313 | + * spinny things pacify the masses |
|
2314 | + * @access private |
|
2315 | + * @return string |
|
2316 | + */ |
|
2318 | 2317 | protected function _add_admin_page_ajax_loading_img() { |
2319 | 2318 | ?> |
2320 | 2319 | <div id="espresso-ajax-loading" class="ajax-loading-grey"> |
@@ -2328,10 +2327,10 @@ discard block |
||
2328 | 2327 | |
2329 | 2328 | |
2330 | 2329 | /** |
2331 | - * add admin page overlay for modal boxes |
|
2332 | - * @access private |
|
2333 | - * @return string |
|
2334 | - */ |
|
2330 | + * add admin page overlay for modal boxes |
|
2331 | + * @access private |
|
2332 | + * @return string |
|
2333 | + */ |
|
2335 | 2334 | protected function _add_admin_page_overlay() { |
2336 | 2335 | ?> |
2337 | 2336 | <div id="espresso-admin-page-overlay-dv" class=""></div> |
@@ -2393,10 +2392,10 @@ discard block |
||
2393 | 2392 | |
2394 | 2393 | |
2395 | 2394 | /** |
2396 | - * generates HTML wrapper for an admin details page |
|
2397 | - * @access public |
|
2398 | - * @return void |
|
2399 | - */ |
|
2395 | + * generates HTML wrapper for an admin details page |
|
2396 | + * @access public |
|
2397 | + * @return void |
|
2398 | + */ |
|
2400 | 2399 | public function display_admin_page_with_sidebar() { |
2401 | 2400 | |
2402 | 2401 | $this->_display_admin_page(TRUE); |
@@ -2406,10 +2405,10 @@ discard block |
||
2406 | 2405 | |
2407 | 2406 | |
2408 | 2407 | /** |
2409 | - * generates HTML wrapper for an admin details page (except no sidebar) |
|
2410 | - * @access public |
|
2411 | - * @return void |
|
2412 | - */ |
|
2408 | + * generates HTML wrapper for an admin details page (except no sidebar) |
|
2409 | + * @access public |
|
2410 | + * @return void |
|
2411 | + */ |
|
2413 | 2412 | public function display_admin_page_with_no_sidebar() { |
2414 | 2413 | $this->_display_admin_page(); |
2415 | 2414 | } |
@@ -2448,18 +2447,18 @@ discard block |
||
2448 | 2447 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
2449 | 2448 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2450 | 2449 | $this->_template_args['admin_page_wrapper_div_id'] = $this->_cpt_route |
2451 | - ? 'poststuff' |
|
2452 | - : 'espresso-default-admin'; |
|
2450 | + ? 'poststuff' |
|
2451 | + : 'espresso-default-admin'; |
|
2453 | 2452 | |
2454 | - $template_path = $sidebar |
|
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2453 | + $template_path = $sidebar |
|
2454 | + ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2455 | + : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2456 | |
2458 | 2457 | if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
2459 | 2458 | $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
2460 | - } |
|
2459 | + } |
|
2461 | 2460 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2461 | + $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2462 | |
2464 | 2463 | $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
2465 | 2464 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
@@ -2672,11 +2671,11 @@ discard block |
||
2672 | 2671 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | 2672 | if ( NULL === error_get_last() || ! headers_sent() ) |
2674 | 2673 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2677 | - } else { |
|
2678 | - echo json_encode( $json ); |
|
2679 | - } |
|
2674 | + if( function_exists( 'wp_json_encode' ) ) { |
|
2675 | + echo wp_json_encode( $json ); |
|
2676 | + } else { |
|
2677 | + echo json_encode( $json ); |
|
2678 | + } |
|
2680 | 2679 | exit(); |
2681 | 2680 | } |
2682 | 2681 | |
@@ -2715,11 +2714,11 @@ discard block |
||
2715 | 2714 | |
2716 | 2715 | |
2717 | 2716 | /** |
2718 | - * generates HTML wrapper with Tabbed nav for an admin page |
|
2719 | - * @access public |
|
2720 | - * @param boolean $about whether to use the special about page wrapper or default. |
|
2721 | - * @return void |
|
2722 | - */ |
|
2717 | + * generates HTML wrapper with Tabbed nav for an admin page |
|
2718 | + * @access public |
|
2719 | + * @param boolean $about whether to use the special about page wrapper or default. |
|
2720 | + * @return void |
|
2721 | + */ |
|
2723 | 2722 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2723 | |
2725 | 2724 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -2776,9 +2775,9 @@ discard block |
||
2776 | 2775 | */ |
2777 | 2776 | private function _sort_nav_tabs( $a, $b ) { |
2778 | 2777 | if ($a['order'] == $b['order']) { |
2779 | - return 0; |
|
2780 | - } |
|
2781 | - return ($a['order'] < $b['order']) ? -1 : 1; |
|
2778 | + return 0; |
|
2779 | + } |
|
2780 | + return ($a['order'] < $b['order']) ? -1 : 1; |
|
2782 | 2781 | } |
2783 | 2782 | |
2784 | 2783 |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
159 | 159 | * @access public |
160 | 160 | */ |
161 | - public function __construct( $routing = TRUE ) { |
|
161 | + public function __construct($routing = TRUE) { |
|
162 | 162 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
163 | + if (strpos($this->_get_dir(), 'caffeinated') !== false) |
|
164 | 164 | $this->_is_caf = TRUE; |
165 | 165 | |
166 | 166 | $this->_yes_no_values = array( |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | //set the _req_data property. |
174 | - $this->_req_data = array_merge( $_GET, $_POST ); |
|
174 | + $this->_req_data = array_merge($_GET, $_POST); |
|
175 | 175 | |
176 | 176 | |
177 | 177 | //routing enabled? |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $this->_do_other_page_hooks(); |
193 | 193 | |
194 | 194 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
195 | + if (method_exists($this, '_before_page_setup')) |
|
196 | 196 | $this->_before_page_setup(); |
197 | 197 | |
198 | 198 | //set up page dependencies |
@@ -462,16 +462,16 @@ discard block |
||
462 | 462 | */ |
463 | 463 | protected function _global_ajax_hooks() { |
464 | 464 | //for lazy loading of metabox content |
465 | - add_action( 'wp_ajax_espresso-ajax-content', array( $this, 'ajax_metabox_content'), 10 ); |
|
465 | + add_action('wp_ajax_espresso-ajax-content', array($this, 'ajax_metabox_content'), 10); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | |
469 | 469 | |
470 | 470 | public function ajax_metabox_content() { |
471 | - $contentid = isset( $this->_req_data['contentid'] ) ? $this->_req_data['contentid'] : ''; |
|
472 | - $url = isset( $this->_req_data['contenturl'] ) ? $this->_req_data['contenturl'] : ''; |
|
471 | + $contentid = isset($this->_req_data['contentid']) ? $this->_req_data['contentid'] : ''; |
|
472 | + $url = isset($this->_req_data['contenturl']) ? $this->_req_data['contenturl'] : ''; |
|
473 | 473 | |
474 | - self::cached_rss_display( $contentid, $url ); |
|
474 | + self::cached_rss_display($contentid, $url); |
|
475 | 475 | wp_die(); |
476 | 476 | } |
477 | 477 | |
@@ -490,87 +490,87 @@ discard block |
||
490 | 490 | //requires? |
491 | 491 | |
492 | 492 | //admin_init stuff - global - we're setting this REALLY early so if EE_Admin pages have to hook into other WP pages they can. But keep in mind, not everything is available from the EE_Admin Page object at this point. |
493 | - add_action( 'admin_init', array( $this, 'admin_init_global' ), 5 ); |
|
493 | + add_action('admin_init', array($this, 'admin_init_global'), 5); |
|
494 | 494 | |
495 | 495 | |
496 | 496 | //next verify if we need to load anything... |
497 | - $this->_current_page = !empty( $_GET['page'] ) ? sanitize_key( $_GET['page'] ) : ''; |
|
498 | - $this->page_folder = strtolower( str_replace( '_Admin_Page', '', str_replace( 'Extend_', '', get_class($this) ) ) ); |
|
497 | + $this->_current_page = ! empty($_GET['page']) ? sanitize_key($_GET['page']) : ''; |
|
498 | + $this->page_folder = strtolower(str_replace('_Admin_Page', '', str_replace('Extend_', '', get_class($this)))); |
|
499 | 499 | |
500 | 500 | global $ee_menu_slugs; |
501 | 501 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 502 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
503 | + if (( ! $this->_current_page || ! isset($ee_menu_slugs[$this->_current_page])) && ! defined('DOING_AJAX')) return FALSE; |
|
504 | 504 | |
505 | 505 | |
506 | 506 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
507 | - if ( isset( $this->_req_data['action2'] ) && $this->_req_data['action'] == -1 ) { |
|
508 | - $this->_req_data['action'] = ! empty( $this->_req_data['action2'] ) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
507 | + if (isset($this->_req_data['action2']) && $this->_req_data['action'] == -1) { |
|
508 | + $this->_req_data['action'] = ! empty($this->_req_data['action2']) && $this->_req_data['action2'] != -1 ? $this->_req_data['action2'] : $this->_req_data['action']; |
|
509 | 509 | } |
510 | 510 | // then set blank or -1 action values to 'default' |
511 | - $this->_req_action = isset( $this->_req_data['action'] ) && ! empty( $this->_req_data['action'] ) && $this->_req_data['action'] != -1 ? sanitize_key( $this->_req_data['action'] ) : 'default'; |
|
511 | + $this->_req_action = isset($this->_req_data['action']) && ! empty($this->_req_data['action']) && $this->_req_data['action'] != -1 ? sanitize_key($this->_req_data['action']) : 'default'; |
|
512 | 512 | |
513 | 513 | //if action is 'default' after the above BUT we have 'route' var set, then let's use the route as the action. This covers cases where we're coming in from a list table that isn't on the default route. |
514 | - $this->_req_action = $this->_req_action == 'default' && isset( $this->_req_data['route'] ) ? $this->_req_data['route'] : $this->_req_action; |
|
514 | + $this->_req_action = $this->_req_action == 'default' && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
|
515 | 515 | |
516 | 516 | //however if we are doing_ajax and we've got a 'route' set then that's what the req_action will be |
517 | 517 | $this->_req_action = defined('DOING_AJAX') && isset($this->_req_data['route']) ? $this->_req_data['route'] : $this->_req_action; |
518 | 518 | |
519 | 519 | $this->_current_view = $this->_req_action; |
520 | - $this->_req_nonce = $this->_req_action . '_nonce'; |
|
520 | + $this->_req_nonce = $this->_req_action.'_nonce'; |
|
521 | 521 | $this->_define_page_props(); |
522 | 522 | |
523 | - $this->_current_page_view_url = add_query_arg( array( 'page' => $this->_current_page, 'action' => $this->_current_view ), $this->_admin_base_url ); |
|
523 | + $this->_current_page_view_url = add_query_arg(array('page' => $this->_current_page, 'action' => $this->_current_view), $this->_admin_base_url); |
|
524 | 524 | |
525 | 525 | //default things |
526 | - $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box' ); |
|
526 | + $this->_default_espresso_metaboxes = array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_ratings_request', '_espresso_sponsors_post_box'); |
|
527 | 527 | |
528 | 528 | //set page configs |
529 | 529 | $this->_set_page_routes(); |
530 | 530 | $this->_set_page_config(); |
531 | 531 | |
532 | 532 | //let's include any referrer data in our default_query_args for this route for "stickiness". |
533 | - if ( isset( $this->_req_data['wp_referer'] ) ) { |
|
533 | + if (isset($this->_req_data['wp_referer'])) { |
|
534 | 534 | $this->_default_route_query_args['wp_referer'] = $this->_req_data['wp_referer']; |
535 | 535 | } |
536 | 536 | |
537 | 537 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
538 | + if (method_exists($this, '_extend_page_config')) |
|
539 | 539 | $this->_extend_page_config(); |
540 | 540 | |
541 | 541 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
542 | + if (method_exists($this, '_extend_page_config_for_cpt')) |
|
543 | 543 | $this->_extend_page_config_for_cpt(); |
544 | 544 | |
545 | 545 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | - $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
|
547 | - $this->_page_config = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_config', $this->_page_config, $this ); |
|
546 | + $this->_page_routes = apply_filters('FHEE__'.get_class($this).'__page_setup__page_routes', $this->_page_routes, $this); |
|
547 | + $this->_page_config = apply_filters('FHEE__'.get_class($this).'__page_setup__page_config', $this->_page_config, $this); |
|
548 | 548 | |
549 | 549 | |
550 | 550 | //if AHEE__EE_Admin_Page__route_admin_request_$this->_current_view method is present then we call it hooked into the AHEE__EE_Admin_Page__route_admin_request action |
551 | - if ( method_exists( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ) ) { |
|
552 | - add_action( 'AHEE__EE_Admin_Page__route_admin_request', array( $this, 'AHEE__EE_Admin_Page__route_admin_request_' . $this->_current_view ), 10, 2 ); |
|
551 | + if (method_exists($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view)) { |
|
552 | + add_action('AHEE__EE_Admin_Page__route_admin_request', array($this, 'AHEE__EE_Admin_Page__route_admin_request_'.$this->_current_view), 10, 2); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
556 | 556 | //next route only if routing enabled |
557 | - if ( $this->_routing && !defined('DOING_AJAX') ) { |
|
557 | + if ($this->_routing && ! defined('DOING_AJAX')) { |
|
558 | 558 | |
559 | 559 | $this->_verify_routes(); |
560 | 560 | |
561 | 561 | //next let's just check user_access and kill if no access |
562 | 562 | $this->check_user_access(); |
563 | 563 | |
564 | - if ( $this->_is_UI_request ) { |
|
564 | + if ($this->_is_UI_request) { |
|
565 | 565 | //admin_init stuff - global, all views for this page class, specific view |
566 | - add_action( 'admin_init', array( $this, 'admin_init' ), 10 ); |
|
567 | - if ( method_exists( $this, 'admin_init_' . $this->_current_view )) { |
|
568 | - add_action( 'admin_init', array( $this, 'admin_init_' . $this->_current_view ), 15 ); |
|
566 | + add_action('admin_init', array($this, 'admin_init'), 10); |
|
567 | + if (method_exists($this, 'admin_init_'.$this->_current_view)) { |
|
568 | + add_action('admin_init', array($this, 'admin_init_'.$this->_current_view), 15); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | } else { |
572 | 572 | //hijack regular WP loading and route admin request immediately |
573 | - @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); |
|
573 | + @ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT)); |
|
574 | 574 | $this->route_admin_request(); |
575 | 575 | } |
576 | 576 | } |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | * @return void |
588 | 588 | */ |
589 | 589 | private function _do_other_page_hooks() { |
590 | - $registered_pages = apply_filters( 'FHEE_do_other_page_hooks_' . $this->page_slug, array() ); |
|
590 | + $registered_pages = apply_filters('FHEE_do_other_page_hooks_'.$this->page_slug, array()); |
|
591 | 591 | |
592 | - foreach ( $registered_pages as $page ) { |
|
592 | + foreach ($registered_pages as $page) { |
|
593 | 593 | |
594 | 594 | //now let's setup the file name and class that should be present |
595 | 595 | $classname = str_replace('.class.php', '', $page); |
596 | 596 | |
597 | 597 | //autoloaders should take care of loading file |
598 | - if ( !class_exists( $classname ) ) { |
|
599 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s admin hooks page.', 'event_espresso' ), $page); |
|
600 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname ); |
|
601 | - throw new EE_Error( implode( '||', $error_msg )); |
|
598 | + if ( ! class_exists($classname)) { |
|
599 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s admin hooks page.', 'event_espresso'), $page); |
|
600 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s admin hooks page.%sMake sure you have <strong>%s</strong> defined. If this is a non-EE-core admin page then you also must have an autoloader in place for your class', 'event_espresso'), $page, '<br />', $classname); |
|
601 | + throw new EE_Error(implode('||', $error_msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | $a = new ReflectionClass($classname); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | public function load_page_dependencies() { |
614 | 614 | try { |
615 | 615 | $this->_load_page_dependencies(); |
616 | - } catch ( EE_Error $e ) { |
|
616 | + } catch (EE_Error $e) { |
|
617 | 617 | $e->get_error(); |
618 | 618 | } |
619 | 619 | } |
@@ -631,16 +631,16 @@ discard block |
||
631 | 631 | $this->_current_screen = get_current_screen(); |
632 | 632 | |
633 | 633 | //load admin_notices - global, page class, and view specific |
634 | - add_action( 'admin_notices', array( $this, 'admin_notices_global'), 5 ); |
|
635 | - add_action( 'admin_notices', array( $this, 'admin_notices' ), 10 ); |
|
636 | - if ( method_exists( $this, 'admin_notices_' . $this->_current_view ) ) { |
|
637 | - add_action( 'admin_notices', array( $this, 'admin_notices_' . $this->_current_view ), 15 ); |
|
634 | + add_action('admin_notices', array($this, 'admin_notices_global'), 5); |
|
635 | + add_action('admin_notices', array($this, 'admin_notices'), 10); |
|
636 | + if (method_exists($this, 'admin_notices_'.$this->_current_view)) { |
|
637 | + add_action('admin_notices', array($this, 'admin_notices_'.$this->_current_view), 15); |
|
638 | 638 | } |
639 | 639 | |
640 | 640 | //load network admin_notices - global, page class, and view specific |
641 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_global'), 5 ); |
|
642 | - if ( method_exists( $this, 'network_admin_notices_' . $this->_current_view ) ) { |
|
643 | - add_action( 'network_admin_notices', array( $this, 'network_admin_notices_' . $this->_current_view ) ); |
|
641 | + add_action('network_admin_notices', array($this, 'network_admin_notices_global'), 5); |
|
642 | + if (method_exists($this, 'network_admin_notices_'.$this->_current_view)) { |
|
643 | + add_action('network_admin_notices', array($this, 'network_admin_notices_'.$this->_current_view)); |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | //this will save any per_page screen options if they are present |
@@ -656,8 +656,8 @@ discard block |
||
656 | 656 | //add screen options - global, page child class, and view specific |
657 | 657 | $this->_add_global_screen_options(); |
658 | 658 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
659 | + if (method_exists($this, '_add_screen_options_'.$this->_current_view)) |
|
660 | + call_user_func(array($this, '_add_screen_options_'.$this->_current_view)); |
|
661 | 661 | |
662 | 662 | |
663 | 663 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,33 +668,33 @@ discard block |
||
668 | 668 | //add feature_pointers - global, page child class, and view specific |
669 | 669 | $this->_add_feature_pointers(); |
670 | 670 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
671 | + if (method_exists($this, '_add_feature_pointer_'.$this->_current_view)) |
|
672 | + call_user_func(array($this, '_add_feature_pointer_'.$this->_current_view)); |
|
673 | 673 | |
674 | 674 | //enqueue scripts/styles - global, page class, and view specific |
675 | - add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
|
676 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
|
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
675 | + add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5); |
|
676 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10); |
|
677 | + if (method_exists($this, 'load_scripts_styles_'.$this->_current_view)) |
|
678 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_'.$this->_current_view), 15); |
|
679 | 679 | |
680 | - add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
|
680 | + add_action('admin_enqueue_scripts', array($this, 'admin_footer_scripts_eei18n_js_strings'), 100); |
|
681 | 681 | |
682 | 682 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
|
684 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
|
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
683 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_global'), 99); |
|
684 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts'), 100); |
|
685 | + if (method_exists($this, 'admin_footer_scripts_'.$this->_current_view)) |
|
686 | + add_action('admin_print_footer_scripts', array($this, 'admin_footer_scripts_'.$this->_current_view), 101); |
|
687 | 687 | |
688 | 688 | //admin footer scripts |
689 | - add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
|
690 | - add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
|
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
689 | + add_action('admin_footer', array($this, 'admin_footer_global'), 99); |
|
690 | + add_action('admin_footer', array($this, 'admin_footer'), 100); |
|
691 | + if (method_exists($this, 'admin_footer_'.$this->_current_view)) |
|
692 | + add_action('admin_footer', array($this, 'admin_footer_'.$this->_current_view), 101); |
|
693 | 693 | |
694 | 694 | |
695 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
|
695 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug); |
|
696 | 696 | //targeted hook |
697 | - do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load__' . $this->page_slug . '__' . $this->_req_action ); |
|
697 | + do_action('FHEE__EE_Admin_Page___load_page_dependencies__after_load__'.$this->page_slug.'__'.$this->_req_action); |
|
698 | 698 | |
699 | 699 | } |
700 | 700 | |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | private function _set_defaults() { |
710 | 710 | $this->_current_screen = $this->_admin_page_title = $this->_req_action = $this->_req_nonce = $this->_event = $this->_template_path = $this->_column_template_path = NULL; |
711 | 711 | |
712 | - $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
712 | + $this->_nav_tabs = $this_views = $this->_page_routes = $this->_page_config = $this->_default_route_query_args = array(); |
|
713 | 713 | |
714 | 714 | $this->default_nav_tab_name = 'overview'; |
715 | 715 | |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | public function route_admin_request() { |
737 | 737 | try { |
738 | 738 | $this->_route_admin_request(); |
739 | - } catch ( EE_Error $e ) { |
|
739 | + } catch (EE_Error $e) { |
|
740 | 740 | $e->get_error(); |
741 | 741 | } |
742 | 742 | } |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | $this->_wp_page_slug = $wp_page_slug; |
748 | 748 | |
749 | 749 | //if in network admin then we need to append "-network" to the page slug. Why? Because that's how WP rolls... |
750 | - if ( is_network_admin() ) { |
|
750 | + if (is_network_admin()) { |
|
751 | 751 | $this->_wp_page_slug .= '-network'; |
752 | 752 | } |
753 | 753 | } |
@@ -760,53 +760,53 @@ discard block |
||
760 | 760 | * @return void |
761 | 761 | */ |
762 | 762 | protected function _verify_routes() { |
763 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
763 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
764 | 764 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
765 | + if ( ! $this->_current_page && ! defined('DOING_AJAX')) return FALSE; |
|
766 | 766 | |
767 | 767 | $this->_route = FALSE; |
768 | 768 | $func = FALSE; |
769 | 769 | $args = array(); |
770 | 770 | |
771 | 771 | // check that the page_routes array is not empty |
772 | - if ( empty( $this->_page_routes )) { |
|
772 | + if (empty($this->_page_routes)) { |
|
773 | 773 | // user error msg |
774 | - $error_msg = sprintf( __('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title ); |
|
774 | + $error_msg = sprintf(__('No page routes have been set for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
775 | 775 | // developer error msg |
776 | - $error_msg .= '||' . $error_msg . __( ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso' ); |
|
777 | - throw new EE_Error( $error_msg ); |
|
776 | + $error_msg .= '||'.$error_msg.__(' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.', 'event_espresso'); |
|
777 | + throw new EE_Error($error_msg); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | // and that the requested page route exists |
781 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
782 | - $this->_route = $this->_page_routes[ $this->_req_action ]; |
|
781 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
782 | + $this->_route = $this->_page_routes[$this->_req_action]; |
|
783 | 783 | $this->_route_config = isset($this->_page_config[$this->_req_action]) ? $this->_page_config[$this->_req_action] : array(); |
784 | 784 | } else { |
785 | 785 | // user error msg |
786 | - $error_msg = sprintf( __( 'The requested page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
786 | + $error_msg = sprintf(__('The requested page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
787 | 787 | // developer error msg |
788 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso' ), $this->_req_action ); |
|
789 | - throw new EE_Error( $error_msg ); |
|
788 | + $error_msg .= '||'.$error_msg.sprintf(__(' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.', 'event_espresso'), $this->_req_action); |
|
789 | + throw new EE_Error($error_msg); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // and that a default route exists |
793 | - if ( ! array_key_exists( 'default', $this->_page_routes )) { |
|
793 | + if ( ! array_key_exists('default', $this->_page_routes)) { |
|
794 | 794 | // user error msg |
795 | - $error_msg = sprintf( __( 'A default page route has not been set for the % admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
795 | + $error_msg = sprintf(__('A default page route has not been set for the % admin page.', 'event_espresso'), $this->_admin_page_title); |
|
796 | 796 | // developer error msg |
797 | - $error_msg .= '||' . $error_msg . __( ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso' ); |
|
798 | - throw new EE_Error( $error_msg ); |
|
797 | + $error_msg .= '||'.$error_msg.__(' Create a key in the "_page_routes" array named "default" and set its value to your default page method.', 'event_espresso'); |
|
798 | + throw new EE_Error($error_msg); |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | |
802 | 802 | //first lets' catch if the UI request has EVER been set. |
803 | - if ( $this->_is_UI_request === NULL ) { |
|
803 | + if ($this->_is_UI_request === NULL) { |
|
804 | 804 | //lets set if this is a UI request or not. |
805 | - $this->_is_UI_request = ( ! isset( $this->_req_data['noheader'] ) || $this->_req_data['noheader'] !== TRUE ) ? TRUE : FALSE; |
|
805 | + $this->_is_UI_request = ( ! isset($this->_req_data['noheader']) || $this->_req_data['noheader'] !== TRUE) ? TRUE : FALSE; |
|
806 | 806 | |
807 | 807 | |
808 | 808 | //wait a minute... we might have a noheader in the route array |
809 | - $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader'] ) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
809 | + $this->_is_UI_request = is_array($this->_route) && isset($this->_route['noheader']) && $this->_route['noheader'] ? FALSE : $this->_is_UI_request; |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | $this->_set_current_labels(); |
@@ -821,15 +821,15 @@ discard block |
||
821 | 821 | * @param string $route the route name we're verifying |
822 | 822 | * @return mixed (bool|Exception) we'll throw an exception if this isn't a valid route. |
823 | 823 | */ |
824 | - protected function _verify_route( $route ) { |
|
825 | - if ( array_key_exists( $this->_req_action, $this->_page_routes )) { |
|
824 | + protected function _verify_route($route) { |
|
825 | + if (array_key_exists($this->_req_action, $this->_page_routes)) { |
|
826 | 826 | return true; |
827 | 827 | } else { |
828 | 828 | // user error msg |
829 | - $error_msg = sprintf( __( 'The given page route does not exist for the %s admin page.', 'event_espresso' ), $this->_admin_page_title ); |
|
829 | + $error_msg = sprintf(__('The given page route does not exist for the %s admin page.', 'event_espresso'), $this->_admin_page_title); |
|
830 | 830 | // developer error msg |
831 | - $error_msg .= '||' . $error_msg . sprintf( __( ' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso' ), $route ); |
|
832 | - throw new EE_Error( $error_msg ); |
|
831 | + $error_msg .= '||'.$error_msg.sprintf(__(' Check the route you are using in your method (%s) and make sure it matches a route set in your "_page_routes" array property', 'event_espresso'), $route); |
|
832 | + throw new EE_Error($error_msg); |
|
833 | 833 | } |
834 | 834 | } |
835 | 835 | |
@@ -843,18 +843,18 @@ discard block |
||
843 | 843 | * @param string $nonce_ref The nonce reference string (name0) |
844 | 844 | * @return mixed (bool|die) |
845 | 845 | */ |
846 | - protected function _verify_nonce( $nonce, $nonce_ref ) { |
|
846 | + protected function _verify_nonce($nonce, $nonce_ref) { |
|
847 | 847 | // verify nonce against expected value |
848 | - if ( ! wp_verify_nonce( $nonce, $nonce_ref) ) { |
|
848 | + if ( ! wp_verify_nonce($nonce, $nonce_ref)) { |
|
849 | 849 | // these are not the droids you are looking for !!! |
850 | - $msg = sprintf(__('%sNonce Fail.%s' , 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>' ); |
|
851 | - if ( WP_DEBUG ) { |
|
852 | - $msg .= "\n " . sprintf( __('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso' ), __CLASS__ ); |
|
850 | + $msg = sprintf(__('%sNonce Fail.%s', 'event_espresso'), '<a href="http://www.youtube.com/watch?v=56_S0WeTkzs">', '</a>'); |
|
851 | + if (WP_DEBUG) { |
|
852 | + $msg .= "\n ".sprintf(__('In order to dynamically generate nonces for your actions, use the %s::add_query_args_and_nonce() method. May the Nonce be with you!', 'event_espresso'), __CLASS__); |
|
853 | 853 | } |
854 | - if ( ! defined( 'DOING_AJAX' )) { |
|
855 | - wp_die( $msg ); |
|
854 | + if ( ! defined('DOING_AJAX')) { |
|
855 | + wp_die($msg); |
|
856 | 856 | } else { |
857 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
857 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
858 | 858 | $this->_return_json(); |
859 | 859 | } |
860 | 860 | } |
@@ -872,63 +872,63 @@ discard block |
||
872 | 872 | * @return void |
873 | 873 | */ |
874 | 874 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
875 | + if ( ! $this->_is_UI_request) |
|
876 | 876 | $this->_verify_routes(); |
877 | 877 | |
878 | - $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
|
878 | + $nonce_check = isset($this->_route_config['require_nonce']) ? $this->_route_config['require_nonce'] : TRUE; |
|
879 | 879 | |
880 | - if ( $this->_req_action != 'default' && $nonce_check ) { |
|
880 | + if ($this->_req_action != 'default' && $nonce_check) { |
|
881 | 881 | // set nonce from post data |
882 | - $nonce = isset($this->_req_data[ $this->_req_nonce ]) ? sanitize_text_field( $this->_req_data[ $this->_req_nonce ] ) : ''; |
|
883 | - $this->_verify_nonce( $nonce, $this->_req_nonce ); |
|
882 | + $nonce = isset($this->_req_data[$this->_req_nonce]) ? sanitize_text_field($this->_req_data[$this->_req_nonce]) : ''; |
|
883 | + $this->_verify_nonce($nonce, $this->_req_nonce); |
|
884 | 884 | } |
885 | 885 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
886 | + if ($this->_is_UI_request) |
|
887 | 887 | $this->_set_nav_tabs(); |
888 | 888 | |
889 | 889 | // grab callback function |
890 | - $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
|
890 | + $func = is_array($this->_route) ? $this->_route['func'] : $this->_route; |
|
891 | 891 | |
892 | 892 | // check if callback has args |
893 | - $args = is_array( $this->_route ) && isset( $this->_route['args'] ) ? $this->_route['args'] : array(); |
|
893 | + $args = is_array($this->_route) && isset($this->_route['args']) ? $this->_route['args'] : array(); |
|
894 | 894 | |
895 | 895 | $error_msg = ''; |
896 | 896 | |
897 | 897 | //action right before calling route (hook is something like 'AHEE__Registrations_Admin_Page__route_admin_request') |
898 | - if ( !did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | - do_action( 'AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this ); |
|
898 | + if ( ! did_action('AHEE__EE_Admin_Page__route_admin_request')) { |
|
899 | + do_action('AHEE__EE_Admin_Page__route_admin_request', $this->_current_view, $this); |
|
900 | 900 | } |
901 | 901 | |
902 | 902 | //right before calling the route, let's remove _wp_http_referer from the $_SERVER[REQUEST_URI] global (its now in _req_data for route processing). |
903 | - $_SERVER['REQUEST_URI'] = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
903 | + $_SERVER['REQUEST_URI'] = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
904 | 904 | |
905 | - if ( ! empty( $func )) { |
|
905 | + if ( ! empty($func)) { |
|
906 | 906 | $base_call = $addon_call = FALSE; |
907 | 907 | //try to access page route via this class |
908 | - if ( ! is_array( $func ) && method_exists( $this, $func ) && ( $base_call = call_user_func_array( array( $this, &$func ), $args ) ) === FALSE ) { |
|
908 | + if ( ! is_array($func) && method_exists($this, $func) && ($base_call = call_user_func_array(array($this, &$func), $args)) === FALSE) { |
|
909 | 909 | // user error msg |
910 | - $error_msg = __( 'An error occurred. The requested page route could not be found.', 'event_espresso' ); |
|
910 | + $error_msg = __('An error occurred. The requested page route could not be found.', 'event_espresso'); |
|
911 | 911 | // developer error msg |
912 | - $error_msg .= '||' . sprintf( __( 'Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso' ), $func ); |
|
912 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for method names and actions in the "_page_routes" array are all correct.', 'event_espresso'), $func); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | //for pluggability by addons first let's see if just the function exists (this will also work in the case where $func is an array indicating class/method) |
916 | 916 | $args['admin_page_object'] = $this; //send along this admin page object for access by addons. |
917 | 917 | |
918 | - if ( $base_call === FALSE && ( $addon_call = call_user_func_array( $func, $args ) )=== FALSE ) { |
|
919 | - $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso' ); |
|
920 | - $error_msg .= '||' . sprintf( __('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func ); |
|
918 | + if ($base_call === FALSE && ($addon_call = call_user_func_array($func, $args)) === FALSE) { |
|
919 | + $error_msg = __('An error occurred. The requested page route could not be found', 'event_espresso'); |
|
920 | + $error_msg .= '||'.sprintf(__('Page route "%s" could not be called. Check that the spelling for the function name and action in the "_page_routes" array filtered by your plugin is correct.', 'event_espresso'), $func); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
924 | + if ( ! empty($error_msg) && $base_call === FALSE && $addon_call === FALSE) |
|
925 | + throw new EE_Error($error_msg); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
929 | 929 | //now if UI request is FALSE and noheader is true AND we have a headers_sent_route in the route array then let's set UI_request to true because the no header route has a second func after headers have been sent. |
930 | - if ( $this->_is_UI_request === FALSE && is_array( $this->_route) && ! empty( $this->_route['headers_sent_route'] ) ) { |
|
931 | - $this->_reset_routing_properties( $this->_route['headers_sent_route'] ); |
|
930 | + if ($this->_is_UI_request === FALSE && is_array($this->_route) && ! empty($this->_route['headers_sent_route'])) { |
|
931 | + $this->_reset_routing_properties($this->_route['headers_sent_route']); |
|
932 | 932 | } |
933 | 933 | } |
934 | 934 | |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * @param string $new_route New (non header) route to redirect to. |
945 | 945 | * @return void |
946 | 946 | */ |
947 | - protected function _reset_routing_properties( $new_route ) { |
|
947 | + protected function _reset_routing_properties($new_route) { |
|
948 | 948 | $this->_is_UI_request = TRUE; |
949 | 949 | //now we set the current route to whatever the headers_sent_route is set at |
950 | 950 | $this->_req_data['action'] = $new_route; |
@@ -990,23 +990,23 @@ discard block |
||
990 | 990 | * @param bool $exclude_nonce If true, the the nonce will be excluded from the generated nonce. |
991 | 991 | * @return string |
992 | 992 | */ |
993 | - public static function add_query_args_and_nonce( $args = array(), $url = false, $sticky = false, $exclude_nonce = false ) { |
|
993 | + public static function add_query_args_and_nonce($args = array(), $url = false, $sticky = false, $exclude_nonce = false) { |
|
994 | 994 | |
995 | 995 | //if there is a _wp_http_referer include the values from the request but only if sticky = true |
996 | - if ( $sticky ) { |
|
996 | + if ($sticky) { |
|
997 | 997 | $request = $_REQUEST; |
998 | - unset( $request['_wp_http_referer'] ); |
|
999 | - unset( $request['wp_referer'] ); |
|
1000 | - foreach ( $request as $key => $value ) { |
|
998 | + unset($request['_wp_http_referer']); |
|
999 | + unset($request['wp_referer']); |
|
1000 | + foreach ($request as $key => $value) { |
|
1001 | 1001 | //do not add nonces |
1002 | - if ( strpos( $key, 'nonce' ) !== false ) { |
|
1002 | + if (strpos($key, 'nonce') !== false) { |
|
1003 | 1003 | continue; |
1004 | 1004 | } |
1005 | - $args['wp_referer[' . $key . ']'] = $value; |
|
1005 | + $args['wp_referer['.$key.']'] = $value; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | |
1009 | - return EEH_URL::add_query_args_and_nonce( $args, $url, $exclude_nonce ); |
|
1009 | + return EEH_URL::add_query_args_and_nonce($args, $url, $exclude_nonce); |
|
1010 | 1010 | } |
1011 | 1011 | |
1012 | 1012 | |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | * @uses EEH_Template::get_help_tab_link() |
1023 | 1023 | * @return string generated link |
1024 | 1024 | */ |
1025 | - protected function _get_help_tab_link( $help_tab_id, $icon_style = FALSE, $help_text = FALSE ) { |
|
1026 | - return EEH_Template::get_help_tab_link( $help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text ); |
|
1025 | + protected function _get_help_tab_link($help_tab_id, $icon_style = FALSE, $help_text = FALSE) { |
|
1026 | + return EEH_Template::get_help_tab_link($help_tab_id, $this->page_slug, $this->_req_action, $icon_style, $help_text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
@@ -1040,30 +1040,30 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | protected function _add_help_tabs() { |
1042 | 1042 | $tour_buttons = ''; |
1043 | - if ( isset( $this->_page_config[$this->_req_action] ) ) { |
|
1043 | + if (isset($this->_page_config[$this->_req_action])) { |
|
1044 | 1044 | $config = $this->_page_config[$this->_req_action]; |
1045 | 1045 | |
1046 | 1046 | //is there a help tour for the current route? if there is let's setup the tour buttons |
1047 | - if ( isset( $this->_help_tour[$this->_req_action]) ) { |
|
1047 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1048 | 1048 | $tb = array(); |
1049 | 1049 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1050 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1051 | 1051 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1052 | + if ($tour instanceof EE_Help_Tour_final_stop) |
|
1053 | 1053 | continue; |
1054 | - $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
|
1054 | + $tb[] = '<button id="trigger-tour-'.$tour->get_slug().'" class="button-primary trigger-ee-help-tour">'.$tour->get_label().'</button>'; |
|
1055 | 1055 | } |
1056 | 1056 | $tour_buttons .= implode('<br />', $tb); |
1057 | 1057 | $tour_buttons .= '</div></div>'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | - if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
|
1061 | + if (is_array($config) && isset($config['help_sidebar'])) { |
|
1062 | 1062 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1063 | + if ( ! method_exists($this, $config['help_sidebar'])) |
|
1064 | + throw new EE_Error(sprintf(__('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this))); |
|
1065 | 1065 | |
1066 | - $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
|
1066 | + $content = apply_filters('FHEE__'.get_class($this).'__add_help_tabs__help_sidebar', call_user_func(array($this, $config['help_sidebar']))); |
|
1067 | 1067 | |
1068 | 1068 | $content .= $tour_buttons; //add help tour buttons. |
1069 | 1069 | |
@@ -1072,49 +1072,49 @@ discard block |
||
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | //if we DON'T have config help sidebar and there ARE toure buttons then we'll just add the tour buttons to the sidebar. |
1075 | - if ( !isset( $config['help_sidebar'] ) && !empty( $tour_buttons ) ) { |
|
1075 | + if ( ! isset($config['help_sidebar']) && ! empty($tour_buttons)) { |
|
1076 | 1076 | $this->_current_screen->set_help_sidebar($tour_buttons); |
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | //handle if no help_tabs are set so the sidebar will still show for the help tour buttons |
1080 | - if ( !isset( $config['help_tabs'] ) && !empty($tour_buttons) ) { |
|
1080 | + if ( ! isset($config['help_tabs']) && ! empty($tour_buttons)) { |
|
1081 | 1081 | $_ht['id'] = $this->page_slug; |
1082 | 1082 | $_ht['title'] = __('Help Tours', 'event_espresso'); |
1083 | - $_ht['content'] = '<p>' . __('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso') . '</p>'; |
|
1083 | + $_ht['content'] = '<p>'.__('The buttons to the right allow you to start/restart any help tours available for this page', 'event_espresso').'</p>'; |
|
1084 | 1084 | $this->_current_screen->add_help_tab($_ht); |
1085 | 1085 | }/**/ |
1086 | 1086 | |
1087 | 1087 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1088 | + if ( ! isset($config['help_tabs'])) return; //no help tabs for this route |
|
1089 | 1089 | |
1090 | - foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
|
1090 | + foreach ((array) $config['help_tabs'] as $tab_id => $cfg) { |
|
1091 | 1091 | //we're here so there ARE help tabs! |
1092 | 1092 | |
1093 | 1093 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1094 | + if ( ! isset($cfg['title'])) |
|
1095 | + throw new EE_Error(__('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso')); |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1098 | + if ( ! isset($cfg['filename']) && ! isset($cfg['callback']) && ! isset($cfg['content'])) |
|
1099 | + throw new EE_Error(__('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso')); |
|
1100 | 1100 | |
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | //first priority goes to content. |
1104 | - if ( !empty($cfg['content'] ) ) { |
|
1105 | - $content = !empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1104 | + if ( ! empty($cfg['content'])) { |
|
1105 | + $content = ! empty($cfg['content']) ? $cfg['content'] : NULL; |
|
1106 | 1106 | |
1107 | 1107 | //second priority goes to filename |
1108 | - } else if ( !empty($cfg['filename'] ) ) { |
|
1109 | - $file_path = $this->_get_dir() . '/help_tabs/' . $cfg['filename'] . '.help_tab.php'; |
|
1108 | + } else if ( ! empty($cfg['filename'])) { |
|
1109 | + $file_path = $this->_get_dir().'/help_tabs/'.$cfg['filename'].'.help_tab.php'; |
|
1110 | 1110 | |
1111 | 1111 | |
1112 | 1112 | //it's possible that the file is located on decaf route (and above sets up for caf route, if this is the case then lets check decaf route too) |
1113 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tabs/' . $cfg['filename'] . '.help_tab.php' : $file_path; |
|
1113 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tabs/'.$cfg['filename'].'.help_tab.php' : $file_path; |
|
1114 | 1114 | |
1115 | 1115 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1116 | - if ( !is_readable($file_path) && !isset($cfg['callback']) ) { |
|
1117 | - EE_Error::add_error( sprintf( __('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1116 | + if ( ! is_readable($file_path) && ! isset($cfg['callback'])) { |
|
1117 | + EE_Error::add_error(sprintf(__('The filename given for the help tab %s is not a valid file and there is no other configuration for the tab content. Please check that the string you set for the help tab on this route (%s) is the correct spelling. The file should be in %s', 'event_espresso'), $tab_id, key($config), $file_path), __FILE__, __FUNCTION__, __LINE__); |
|
1118 | 1118 | return; |
1119 | 1119 | } |
1120 | 1120 | $template_args['admin_page_obj'] = $this; |
@@ -1125,21 +1125,21 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | |
1127 | 1127 | //check if callback is valid |
1128 | - if ( empty($content) && ( !isset($cfg['callback']) || !method_exists( $this, $cfg['callback'] ) ) ) { |
|
1129 | - EE_Error::add_error( sprintf( __('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title'] ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1128 | + if (empty($content) && ( ! isset($cfg['callback']) || ! method_exists($this, $cfg['callback']))) { |
|
1129 | + EE_Error::add_error(sprintf(__('The callback given for a %s help tab on this page does not content OR a corresponding method for generating the content. Check the spelling or make sure the method is present.', 'event_espresso'), $cfg['title']), __FILE__, __FUNCTION__, __LINE__); |
|
1130 | 1130 | return; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | 1133 | //setup config array for help tab method |
1134 | - $id = $this->page_slug . '-' . $this->_req_action . '-' . $tab_id; |
|
1134 | + $id = $this->page_slug.'-'.$this->_req_action.'-'.$tab_id; |
|
1135 | 1135 | $_ht = array( |
1136 | 1136 | 'id' => $id, |
1137 | 1137 | 'title' => $cfg['title'], |
1138 | - 'callback' => isset( $cfg['callback'] ) && empty($content) ? array( $this, $cfg['callback'] ) : NULL, |
|
1138 | + 'callback' => isset($cfg['callback']) && empty($content) ? array($this, $cfg['callback']) : NULL, |
|
1139 | 1139 | 'content' => $content |
1140 | 1140 | ); |
1141 | 1141 | |
1142 | - $this->_current_screen->add_help_tab( $_ht ); |
|
1142 | + $this->_current_screen->add_help_tab($_ht); |
|
1143 | 1143 | } |
1144 | 1144 | } |
1145 | 1145 | } |
@@ -1159,49 +1159,49 @@ discard block |
||
1159 | 1159 | $this->_help_tour = array(); |
1160 | 1160 | |
1161 | 1161 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1162 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || (defined('EE_DISABLE_HELP_TOURS') && EE_DISABLE_HELP_TOURS)) |
|
1163 | 1163 | return; |
1164 | 1164 | |
1165 | 1165 | //loop through _page_config to find any help_tour defined |
1166 | - foreach ( $this->_page_config as $route => $config ) { |
|
1166 | + foreach ($this->_page_config as $route => $config) { |
|
1167 | 1167 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1168 | + if ($route !== $this->_req_action) |
|
1169 | 1169 | continue; |
1170 | 1170 | |
1171 | - if ( isset( $config['help_tour'] ) ) { |
|
1171 | + if (isset($config['help_tour'])) { |
|
1172 | 1172 | |
1173 | - foreach( $config['help_tour'] as $tour ) { |
|
1174 | - $file_path = $this->_get_dir() . '/help_tours/' . $tour . '.class.php'; |
|
1173 | + foreach ($config['help_tour'] as $tour) { |
|
1174 | + $file_path = $this->_get_dir().'/help_tours/'.$tour.'.class.php'; |
|
1175 | 1175 | //let's see if we can get that file... if not its possible this is a decaf route not set in caffienated so lets try and get the caffeinated equivalent |
1176 | - $file_path = !is_readable($file_path) ? EE_ADMIN_PAGES . basename($this->_get_dir()) . '/help_tours/' . $tour . '.class.php' : $file_path; |
|
1176 | + $file_path = ! is_readable($file_path) ? EE_ADMIN_PAGES.basename($this->_get_dir()).'/help_tours/'.$tour.'.class.php' : $file_path; |
|
1177 | 1177 | |
1178 | 1178 | //if file is STILL not readable then let's do a EE_Error so its more graceful than a fatal error. |
1179 | - if ( !is_readable($file_path) ) { |
|
1180 | - EE_Error::add_error( sprintf( __('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1179 | + if ( ! is_readable($file_path)) { |
|
1180 | + EE_Error::add_error(sprintf(__('The file path given for the help tour (%s) is not a valid path. Please check that the string you set for the help tour on this route (%s) is the correct spelling', 'event_espresso'), $file_path, $tour), __FILE__, __FUNCTION__, __LINE__); |
|
1181 | 1181 | return; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | require_once $file_path; |
1185 | - if ( !class_exists( $tour ) ) { |
|
1186 | - $error_msg[] = sprintf( __('Something went wrong with loading the %s Help Tour Class.', 'event_espresso' ), $tour); |
|
1187 | - $error_msg[] = $error_msg[0] . "\r\n" . sprintf( __( 'There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this) ); |
|
1188 | - throw new EE_Error( implode( '||', $error_msg )); |
|
1185 | + if ( ! class_exists($tour)) { |
|
1186 | + $error_msg[] = sprintf(__('Something went wrong with loading the %s Help Tour Class.', 'event_espresso'), $tour); |
|
1187 | + $error_msg[] = $error_msg[0]."\r\n".sprintf(__('There is no class in place for the %s help tour.%s Make sure you have <strong>%s</strong> defined in the "help_tour" array for the %s route of the % admin page.', 'event_espresso'), $tour, '<br />', $tour, $this->_req_action, get_class($this)); |
|
1188 | + throw new EE_Error(implode('||', $error_msg)); |
|
1189 | 1189 | } |
1190 | 1190 | $a = new ReflectionClass($tour); |
1191 | 1191 | $tour_obj = $a->newInstance($this->_is_caf); |
1192 | 1192 | |
1193 | 1193 | $tours[] = $tour_obj; |
1194 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $tour_obj ); |
|
1194 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($tour_obj); |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | //let's inject the end tour stop element common to all pages... this will only get seen once per machine. |
1198 | 1198 | $end_stop_tour = new EE_Help_Tour_final_stop($this->_is_caf); |
1199 | 1199 | $tours[] = $end_stop_tour; |
1200 | - $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator( $end_stop_tour ); |
|
1200 | + $this->_help_tour[$route][] = EEH_Template::help_tour_stops_generator($end_stop_tour); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | |
1204 | - if ( !empty( $tours ) ) |
|
1204 | + if ( ! empty($tours)) |
|
1205 | 1205 | $this->_help_tour['tours'] = $tours; |
1206 | 1206 | |
1207 | 1207 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
@@ -1217,12 +1217,12 @@ discard block |
||
1217 | 1217 | * @return void |
1218 | 1218 | */ |
1219 | 1219 | protected function _add_qtips() { |
1220 | - if ( isset( $this->_route_config['qtips'] ) ) { |
|
1220 | + if (isset($this->_route_config['qtips'])) { |
|
1221 | 1221 | $qtips = (array) $this->_route_config['qtips']; |
1222 | 1222 | //load qtip loader |
1223 | 1223 | $path = array( |
1224 | - $this->_get_dir() . '/qtips/', |
|
1225 | - EE_ADMIN_PAGES . basename($this->_get_dir()) . '/qtips/' |
|
1224 | + $this->_get_dir().'/qtips/', |
|
1225 | + EE_ADMIN_PAGES.basename($this->_get_dir()).'/qtips/' |
|
1226 | 1226 | ); |
1227 | 1227 | EEH_Qtip_Loader::instance()->register($qtips, $path); |
1228 | 1228 | } |
@@ -1239,41 +1239,41 @@ discard block |
||
1239 | 1239 | * @return void |
1240 | 1240 | */ |
1241 | 1241 | protected function _set_nav_tabs() { |
1242 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1242 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1243 | 1243 | $i = 0; |
1244 | - foreach ( $this->_page_config as $slug => $config ) { |
|
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1244 | + foreach ($this->_page_config as $slug => $config) { |
|
1245 | + if ( ! is_array($config) || (is_array($config) && (isset($config['nav']) && ! $config['nav']) || ! isset($config['nav']))) |
|
1246 | 1246 | continue; //no nav tab for this config |
1247 | 1247 | |
1248 | 1248 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1249 | + if (isset($config['nav']['persistent']) && ! $config['nav']['persistent'] && $slug !== $this->_req_action) |
|
1250 | 1250 | continue; //nav tab is only to appear when route requested. |
1251 | 1251 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1252 | + if ( ! $this->check_user_access($slug, TRUE)) |
|
1253 | 1253 | continue; //no nav tab becasue current user does not have access. |
1254 | 1254 | |
1255 | - $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
|
1255 | + $css_class = isset($config['css_class']) ? $config['css_class'].' ' : ''; |
|
1256 | 1256 | $this->_nav_tabs[$slug] = array( |
1257 | - 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce( array( 'action'=>$slug ), $this->_admin_base_url ), |
|
1258 | - 'link_text' => isset( $config['nav']['label'] ) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug ) ), |
|
1259 | - 'css_class' => $this->_req_action == $slug ? $css_class . 'nav-tab-active' : $css_class, |
|
1260 | - 'order' => isset( $config['nav']['order'] ) ? $config['nav']['order'] : $i |
|
1257 | + 'url' => isset($config['nav']['url']) ? $config['nav']['url'] : self::add_query_args_and_nonce(array('action'=>$slug), $this->_admin_base_url), |
|
1258 | + 'link_text' => isset($config['nav']['label']) ? $config['nav']['label'] : ucwords(str_replace('_', ' ', $slug)), |
|
1259 | + 'css_class' => $this->_req_action == $slug ? $css_class.'nav-tab-active' : $css_class, |
|
1260 | + 'order' => isset($config['nav']['order']) ? $config['nav']['order'] : $i |
|
1261 | 1261 | ); |
1262 | 1262 | $i++; |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | //if $this->_nav_tabs is empty then lets set the default |
1266 | - if ( empty( $this->_nav_tabs ) ) { |
|
1266 | + if (empty($this->_nav_tabs)) { |
|
1267 | 1267 | $this->_nav_tabs[$this->default_nav_tab_name] = array( |
1268 | 1268 | 'url' => $this->admin_base_url, |
1269 | - 'link_text' => ucwords( str_replace( '_', ' ', $this->default_nav_tab_name ) ), |
|
1269 | + 'link_text' => ucwords(str_replace('_', ' ', $this->default_nav_tab_name)), |
|
1270 | 1270 | 'css_class' => 'nav-tab-active', |
1271 | 1271 | 'order' => 10 |
1272 | 1272 | ); |
1273 | 1273 | } |
1274 | 1274 | |
1275 | 1275 | //now let's sort the tabs according to order |
1276 | - usort( $this->_nav_tabs, array($this, '_sort_nav_tabs' )); |
|
1276 | + usort($this->_nav_tabs, array($this, '_sort_nav_tabs')); |
|
1277 | 1277 | |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1289,10 +1289,10 @@ discard block |
||
1289 | 1289 | * @return void |
1290 | 1290 | */ |
1291 | 1291 | private function _set_current_labels() { |
1292 | - if ( is_array($this->_route_config) && isset($this->_route_config['labels']) ) { |
|
1293 | - foreach ( $this->_route_config['labels'] as $label => $text ) { |
|
1294 | - if ( is_array($text) ) { |
|
1295 | - foreach ( $text as $sublabel => $subtext ) { |
|
1292 | + if (is_array($this->_route_config) && isset($this->_route_config['labels'])) { |
|
1293 | + foreach ($this->_route_config['labels'] as $label => $text) { |
|
1294 | + if (is_array($text)) { |
|
1295 | + foreach ($text as $sublabel => $subtext) { |
|
1296 | 1296 | $this->_labels[$label][$sublabel] = $subtext; |
1297 | 1297 | } |
1298 | 1298 | } else { |
@@ -1313,24 +1313,24 @@ discard block |
||
1313 | 1313 | * @param bool $verify_only Default is FALSE which means if user check fails then wp_die(). Otherwise just return false if verify fail. |
1314 | 1314 | * @return BOOL|wp_die() |
1315 | 1315 | */ |
1316 | - public function check_user_access( $route_to_check = '', $verify_only = FALSE ) { |
|
1317 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1318 | - $route_to_check = empty( $route_to_check ) ? $this->_req_action : $route_to_check; |
|
1319 | - $capability = ! empty( $route_to_check ) && isset( $this->_page_routes[$route_to_check] ) && is_array( $this->_page_routes[$route_to_check] ) && ! empty( $this->_page_routes[$route_to_check]['capability'] ) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1316 | + public function check_user_access($route_to_check = '', $verify_only = FALSE) { |
|
1317 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1318 | + $route_to_check = empty($route_to_check) ? $this->_req_action : $route_to_check; |
|
1319 | + $capability = ! empty($route_to_check) && isset($this->_page_routes[$route_to_check]) && is_array($this->_page_routes[$route_to_check]) && ! empty($this->_page_routes[$route_to_check]['capability']) ? $this->_page_routes[$route_to_check]['capability'] : NULL; |
|
1320 | 1320 | |
1321 | - if ( empty( $capability ) && empty( $route_to_check ) ) { |
|
1322 | - $capability = is_array( $this->_route ) && empty( $this->_route['capability'] ) ? 'manage_options' : $this->_route['capability']; |
|
1321 | + if (empty($capability) && empty($route_to_check)) { |
|
1322 | + $capability = is_array($this->_route) && empty($this->_route['capability']) ? 'manage_options' : $this->_route['capability']; |
|
1323 | 1323 | } else { |
1324 | - $capability = empty( $capability ) ? 'manage_options' : $capability; |
|
1324 | + $capability = empty($capability) ? 'manage_options' : $capability; |
|
1325 | 1325 | } |
1326 | 1326 | |
1327 | - $id = is_array( $this->_route ) && ! empty( $this->_route['obj_id'] ) ? $this->_route['obj_id'] : 0; |
|
1327 | + $id = is_array($this->_route) && ! empty($this->_route['obj_id']) ? $this->_route['obj_id'] : 0; |
|
1328 | 1328 | |
1329 | - if (( ! function_exists( 'is_admin' ) || ! EE_Registry::instance()->CAP->current_user_can( $capability, $this->page_slug . '_' . $route_to_check, $id ) ) && ! defined( 'DOING_AJAX')) { |
|
1330 | - if ( $verify_only ) { |
|
1329 | + if (( ! function_exists('is_admin') || ! EE_Registry::instance()->CAP->current_user_can($capability, $this->page_slug.'_'.$route_to_check, $id)) && ! defined('DOING_AJAX')) { |
|
1330 | + if ($verify_only) { |
|
1331 | 1331 | return FALSE; |
1332 | 1332 | } else { |
1333 | - wp_die( __('You do not have access to this route.', 'event_espresso' ) ); |
|
1333 | + wp_die(__('You do not have access to this route.', 'event_espresso')); |
|
1334 | 1334 | } |
1335 | 1335 | } |
1336 | 1336 | return TRUE; |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | $this->_add_admin_page_overlay(); |
1408 | 1408 | |
1409 | 1409 | //if metaboxes are present we need to add the nonce field |
1410 | - if ( ( isset($this->_route_config['metaboxes']) || ( isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes'] ) || isset($this->_route_config['list_table']) ) ) { |
|
1410 | + if ((isset($this->_route_config['metaboxes']) || (isset($this->_route_config['has_metaboxes']) && $this->_route_config['has_metaboxes']) || isset($this->_route_config['list_table']))) { |
|
1411 | 1411 | wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
1412 | 1412 | wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
1413 | 1413 | } |
@@ -1426,19 +1426,19 @@ discard block |
||
1426 | 1426 | */ |
1427 | 1427 | public function admin_footer_global() { |
1428 | 1428 | //dialog container for dialog helper |
1429 | - $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">' . "\n"; |
|
1429 | + $d_cont = '<div class="ee-admin-dialog-container auto-hide hidden">'."\n"; |
|
1430 | 1430 | $d_cont .= '<div class="ee-notices"></div>'; |
1431 | 1431 | $d_cont .= '<div class="ee-admin-dialog-container-inner-content"></div>'; |
1432 | 1432 | $d_cont .= '</div>'; |
1433 | 1433 | echo $d_cont; |
1434 | 1434 | |
1435 | 1435 | //help tour stuff? |
1436 | - if ( isset( $this->_help_tour[$this->_req_action] ) ) { |
|
1436 | + if (isset($this->_help_tour[$this->_req_action])) { |
|
1437 | 1437 | echo implode('<br />', $this->_help_tour[$this->_req_action]); |
1438 | 1438 | } |
1439 | 1439 | |
1440 | 1440 | //current set timezone for timezone js |
1441 | - echo '<span id="current_timezone" class="hidden">' . EEH_DTT_Helper::get_timezone() . '</span>'; |
|
1441 | + echo '<span id="current_timezone" class="hidden">'.EEH_DTT_Helper::get_timezone().'</span>'; |
|
1442 | 1442 | } |
1443 | 1443 | |
1444 | 1444 | |
@@ -1462,18 +1462,18 @@ discard block |
||
1462 | 1462 | * @access protected |
1463 | 1463 | * @return string content |
1464 | 1464 | */ |
1465 | - protected function _set_help_popup_content( $help_array = array(), $display = FALSE ) { |
|
1465 | + protected function _set_help_popup_content($help_array = array(), $display = FALSE) { |
|
1466 | 1466 | $content = ''; |
1467 | 1467 | |
1468 | - $help_array = empty( $help_array ) ? $this->_get_help_content() : $help_array; |
|
1469 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_help_popup.template.php'; |
|
1468 | + $help_array = empty($help_array) ? $this->_get_help_content() : $help_array; |
|
1469 | + $template_path = EE_ADMIN_TEMPLATE.'admin_help_popup.template.php'; |
|
1470 | 1470 | |
1471 | 1471 | |
1472 | 1472 | //loop through the array and setup content |
1473 | - foreach ( $help_array as $trigger => $help ) { |
|
1473 | + foreach ($help_array as $trigger => $help) { |
|
1474 | 1474 | //make sure the array is setup properly |
1475 | - if ( !isset($help['title']) || !isset($help['content'] ) ) { |
|
1476 | - throw new EE_Error( __('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso') ); |
|
1475 | + if ( ! isset($help['title']) || ! isset($help['content'])) { |
|
1476 | + throw new EE_Error(__('Does not look like the popup content array has been setup correctly. Might want to double check that. Read the comments for the _get_help_popup_content method found in "EE_Admin_Page" class', 'event_espresso')); |
|
1477 | 1477 | } |
1478 | 1478 | |
1479 | 1479 | //we're good so let'd setup the template vars and then assign parsed template content to our content. |
@@ -1483,10 +1483,10 @@ discard block |
||
1483 | 1483 | 'help_popup_content' => $help['content'] |
1484 | 1484 | ); |
1485 | 1485 | |
1486 | - $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
1486 | + $content .= EEH_Template::display_template($template_path, $template_args, TRUE); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | - if ( $display ) |
|
1489 | + if ($display) |
|
1490 | 1490 | echo $content; |
1491 | 1491 | else |
1492 | 1492 | return $content; |
@@ -1503,18 +1503,18 @@ discard block |
||
1503 | 1503 | */ |
1504 | 1504 | private function _get_help_content() { |
1505 | 1505 | //what is the method we're looking for? |
1506 | - $method_name = '_help_popup_content_' . $this->_req_action; |
|
1506 | + $method_name = '_help_popup_content_'.$this->_req_action; |
|
1507 | 1507 | |
1508 | 1508 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1509 | + if ( ! method_exists($this, $method_name)) |
|
1510 | 1510 | return array(); |
1511 | 1511 | |
1512 | 1512 | //k we're good to go let's retrieve the help array |
1513 | - $help_array = call_user_func( array( $this, $method_name ) ); |
|
1513 | + $help_array = call_user_func(array($this, $method_name)); |
|
1514 | 1514 | |
1515 | 1515 | //make sure we've got an array! |
1516 | - if ( !is_array($help_array) ) { |
|
1517 | - throw new EE_Error( __('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso' ) ); |
|
1516 | + if ( ! is_array($help_array)) { |
|
1517 | + throw new EE_Error(__('Something went wrong with help popup content generation. Expecting an array and well, this ain\'t no array bub.', 'event_espresso')); |
|
1518 | 1518 | } |
1519 | 1519 | |
1520 | 1520 | return $help_array; |
@@ -1536,27 +1536,27 @@ discard block |
||
1536 | 1536 | * @param array $dimensions an array of dimensions for the box (array(h,w)) |
1537 | 1537 | * @return string |
1538 | 1538 | */ |
1539 | - protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
|
1539 | + protected function _set_help_trigger($trigger_id, $display = TRUE, $dimensions = array('400', '640')) { |
|
1540 | 1540 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1541 | + if (defined('DOING_AJAX')) return; |
|
1542 | 1542 | |
1543 | 1543 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1544 | $help_array = $this->_get_help_content(); |
1545 | 1545 | $help_content = ''; |
1546 | 1546 | |
1547 | - if ( empty( $help_array ) || !isset( $help_array[$trigger_id] ) ) { |
|
1547 | + if (empty($help_array) || ! isset($help_array[$trigger_id])) { |
|
1548 | 1548 | $help_array[$trigger_id] = array( |
1549 | 1549 | 'title' => __('Missing Content', 'event_espresso'), |
1550 | 1550 | 'content' => __('A trigger has been set that doesn\'t have any corresponding content. Make sure you have set the help content. (see the "_set_help_popup_content" method in the EE_Admin_Page for instructions.)', 'event_espresso') |
1551 | 1551 | ); |
1552 | - $help_content = $this->_set_help_popup_content( $help_array, FALSE ); |
|
1552 | + $help_content = $this->_set_help_popup_content($help_array, FALSE); |
|
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | //let's setup the trigger |
1556 | - $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | - $content = $content . $help_content; |
|
1556 | + $content = '<a class="ee-dialog" href="?height='.$dimensions[0].'&width='.$dimensions[1].'&inlineId='.$trigger_id.'" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
|
1557 | + $content = $content.$help_content; |
|
1558 | 1558 | |
1559 | - if ( $display ) |
|
1559 | + if ($display) |
|
1560 | 1560 | echo $content; |
1561 | 1561 | else |
1562 | 1562 | return $content; |
@@ -1613,15 +1613,15 @@ discard block |
||
1613 | 1613 | public function load_global_scripts_styles() { |
1614 | 1614 | /** STYLES **/ |
1615 | 1615 | // add debugging styles |
1616 | - if ( WP_DEBUG ) { |
|
1617 | - add_action('admin_head', array( $this, 'add_xdebug_style' )); |
|
1616 | + if (WP_DEBUG) { |
|
1617 | + add_action('admin_head', array($this, 'add_xdebug_style')); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | //register all styles |
1621 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(),EVENT_ESPRESSO_VERSION ); |
|
1622 | - wp_register_style('ee-admin-css', EE_ADMIN_URL . 'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1621 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1622 | + wp_register_style('ee-admin-css', EE_ADMIN_URL.'assets/ee-admin-page.css', array(), EVENT_ESPRESSO_VERSION); |
|
1623 | 1623 | //helpers styles |
1624 | - wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1624 | + wp_register_style('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.css', array(), EVENT_ESPRESSO_VERSION); |
|
1625 | 1625 | //enqueue global styles |
1626 | 1626 | wp_enqueue_style('ee-admin-css'); |
1627 | 1627 | |
@@ -1629,66 +1629,66 @@ discard block |
||
1629 | 1629 | /** SCRIPTS **/ |
1630 | 1630 | |
1631 | 1631 | //register all scripts |
1632 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1633 | - wp_register_script('ee-dialog', EE_ADMIN_URL . 'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1634 | - wp_register_script('ee_admin_js', EE_ADMIN_URL . 'assets/ee-admin-page.js', array( 'espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true ); |
|
1632 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1633 | + wp_register_script('ee-dialog', EE_ADMIN_URL.'assets/ee-dialog-helper.js', array('jquery', 'jquery-ui-draggable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1634 | + wp_register_script('ee_admin_js', EE_ADMIN_URL.'assets/ee-admin-page.js', array('espresso_core', 'ee-parse-uri', 'ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
1635 | 1635 | |
1636 | - wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL . 'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true ); |
|
1636 | + wp_register_script('jquery-ui-timepicker-addon', EE_GLOBAL_ASSETS_URL.'scripts/jquery-ui-timepicker-addon.js', array('jquery-ui-datepicker', 'jquery-ui-slider'), EVENT_ESPRESSO_VERSION, true); |
|
1637 | 1637 | // register jQuery Validate - see /includes/functions/wp_hooks.php |
1638 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
1638 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
1639 | 1639 | add_filter('FHEE_load_joyride', '__return_true'); |
1640 | 1640 | |
1641 | 1641 | //script for sorting tables |
1642 | - wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL . "assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1642 | + wp_register_script('espresso_ajax_table_sorting', EE_ADMIN_URL."assets/espresso_ajax_table_sorting.js", array('ee_admin_js', 'jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1643 | 1643 | //script for parsing uri's |
1644 | - wp_register_script( 'ee-parse-uri', EE_GLOBAL_ASSETS_URL . 'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1644 | + wp_register_script('ee-parse-uri', EE_GLOBAL_ASSETS_URL.'scripts/parseuri.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1645 | 1645 | //and parsing associative serialized form elements |
1646 | - wp_register_script( 'ee-serialize-full-array', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1646 | + wp_register_script('ee-serialize-full-array', EE_GLOBAL_ASSETS_URL.'scripts/jquery.serializefullarray.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1647 | 1647 | //helpers scripts |
1648 | - wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL . 'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1649 | - wp_register_script( 'ee-moment-core', EE_THIRD_PARTY_URL . 'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1650 | - wp_register_script( 'ee-moment', EE_THIRD_PARTY_URL . 'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1651 | - wp_register_script( 'ee-datepicker', EE_ADMIN_URL . 'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon','ee-moment'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1648 | + wp_register_script('ee-text-links', EE_PLUGIN_DIR_URL.'core/helpers/assets/ee_text_list_helper.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1649 | + wp_register_script('ee-moment-core', EE_THIRD_PARTY_URL.'moment/moment-with-locales.min.js', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
1650 | + wp_register_script('ee-moment', EE_THIRD_PARTY_URL.'moment/moment-timezone-with-data.min.js', array('ee-moment-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1651 | + wp_register_script('ee-datepicker', EE_ADMIN_URL.'assets/ee-datepicker.js', array('jquery-ui-timepicker-addon', 'ee-moment'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1652 | 1652 | |
1653 | 1653 | //google charts |
1654 | - wp_register_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false ); |
|
1654 | + wp_register_script('google-charts', 'https://www.gstatic.com/charts/loader.js', array(), EVENT_ESPRESSO_VERSION, false); |
|
1655 | 1655 | |
1656 | 1656 | //enqueue global scripts |
1657 | 1657 | |
1658 | 1658 | //taking care of metaboxes |
1659 | - if ( ( isset($this->_route_config['metaboxes'] ) || isset($this->_route_config['has_metaboxes']) ) && empty( $this->_cpt_route) ) { |
|
1659 | + if ((isset($this->_route_config['metaboxes']) || isset($this->_route_config['has_metaboxes'])) && empty($this->_cpt_route)) { |
|
1660 | 1660 | wp_enqueue_script('dashboard'); |
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | //enqueue thickbox for ee help popups. default is to enqueue unless its explicitly set to false since we're assuming all EE pages will have popups |
1664 | - if ( ! isset( $this->_route_config['has_help_popups']) || ( isset( $this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'] ) ) { |
|
1664 | + if ( ! isset($this->_route_config['has_help_popups']) || (isset($this->_route_config['has_help_popups']) && $this->_route_config['has_help_popups'])) { |
|
1665 | 1665 | wp_enqueue_script('ee_admin_js'); |
1666 | 1666 | wp_enqueue_style('ee-admin-css'); |
1667 | 1667 | } |
1668 | 1668 | |
1669 | 1669 | |
1670 | 1670 | //localize script for ajax lazy loading |
1671 | - $lazy_loader_container_ids = apply_filters( 'FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content') ); |
|
1672 | - wp_localize_script( 'ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1671 | + $lazy_loader_container_ids = apply_filters('FHEE__EE_Admin_Page_Core__load_global_scripts_styles__loader_containers', array('espresso_news_post_box_content')); |
|
1672 | + wp_localize_script('ee_admin_js', 'eeLazyLoadingContainers', $lazy_loader_container_ids); |
|
1673 | 1673 | |
1674 | 1674 | |
1675 | 1675 | /** |
1676 | 1676 | * help tour stuff |
1677 | 1677 | */ |
1678 | - if ( !empty( $this->_help_tour ) ) { |
|
1678 | + if ( ! empty($this->_help_tour)) { |
|
1679 | 1679 | |
1680 | 1680 | //register the js for kicking things off |
1681 | - wp_enqueue_script('ee-help-tour', EE_ADMIN_URL . 'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1681 | + wp_enqueue_script('ee-help-tour', EE_ADMIN_URL.'assets/ee-help-tour.js', array('jquery-joyride'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1682 | 1682 | |
1683 | 1683 | //setup tours for the js tour object |
1684 | - foreach ( $this->_help_tour['tours'] as $tour ) { |
|
1684 | + foreach ($this->_help_tour['tours'] as $tour) { |
|
1685 | 1685 | $tours[] = array( |
1686 | 1686 | 'id' => $tour->get_slug(), |
1687 | 1687 | 'options' => $tour->get_options() |
1688 | 1688 | ); |
1689 | 1689 | } |
1690 | 1690 | |
1691 | - wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours ) ); |
|
1691 | + wp_localize_script('ee-help-tour', 'EE_HELP_TOUR', array('tours' => $tours)); |
|
1692 | 1692 | |
1693 | 1693 | //admin_footer_global will take care of making sure our help_tour skeleton gets printed via the info stored in $this->_help_tour |
1694 | 1694 | } |
@@ -1706,52 +1706,52 @@ discard block |
||
1706 | 1706 | public function admin_footer_scripts_eei18n_js_strings() { |
1707 | 1707 | |
1708 | 1708 | EE_Registry::$i18n_js_strings['ajax_url'] = WP_AJAX_URL; |
1709 | - EE_Registry::$i18n_js_strings['confirm_delete'] = __( 'Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso' ); |
|
1710 | - |
|
1711 | - EE_Registry::$i18n_js_strings['January'] = __( 'January', 'event_espresso' ); |
|
1712 | - EE_Registry::$i18n_js_strings['February'] = __( 'February', 'event_espresso' ); |
|
1713 | - EE_Registry::$i18n_js_strings['March'] = __( 'March', 'event_espresso' ); |
|
1714 | - EE_Registry::$i18n_js_strings['April'] = __( 'April', 'event_espresso' ); |
|
1715 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1716 | - EE_Registry::$i18n_js_strings['June'] = __( 'June', 'event_espresso' ); |
|
1717 | - EE_Registry::$i18n_js_strings['July'] = __( 'July', 'event_espresso' ); |
|
1718 | - EE_Registry::$i18n_js_strings['August'] = __( 'August', 'event_espresso' ); |
|
1719 | - EE_Registry::$i18n_js_strings['September'] = __( 'September', 'event_espresso' ); |
|
1720 | - EE_Registry::$i18n_js_strings['October'] = __( 'October', 'event_espresso' ); |
|
1721 | - EE_Registry::$i18n_js_strings['November'] = __( 'November', 'event_espresso' ); |
|
1722 | - EE_Registry::$i18n_js_strings['December'] = __( 'December', 'event_espresso' ); |
|
1723 | - EE_Registry::$i18n_js_strings['Jan'] = __( 'Jan', 'event_espresso' ); |
|
1724 | - EE_Registry::$i18n_js_strings['Feb'] = __( 'Feb', 'event_espresso' ); |
|
1725 | - EE_Registry::$i18n_js_strings['Mar'] = __( 'Mar', 'event_espresso' ); |
|
1726 | - EE_Registry::$i18n_js_strings['Apr'] = __( 'Apr', 'event_espresso' ); |
|
1727 | - EE_Registry::$i18n_js_strings['May'] = __( 'May', 'event_espresso' ); |
|
1728 | - EE_Registry::$i18n_js_strings['Jun'] = __( 'Jun', 'event_espresso' ); |
|
1729 | - EE_Registry::$i18n_js_strings['Jul'] = __( 'Jul', 'event_espresso' ); |
|
1730 | - EE_Registry::$i18n_js_strings['Aug'] = __( 'Aug', 'event_espresso' ); |
|
1731 | - EE_Registry::$i18n_js_strings['Sep'] = __( 'Sep', 'event_espresso' ); |
|
1732 | - EE_Registry::$i18n_js_strings['Oct'] = __( 'Oct', 'event_espresso' ); |
|
1733 | - EE_Registry::$i18n_js_strings['Nov'] = __( 'Nov', 'event_espresso' ); |
|
1734 | - EE_Registry::$i18n_js_strings['Dec'] = __( 'Dec', 'event_espresso' ); |
|
1735 | - |
|
1736 | - EE_Registry::$i18n_js_strings['Sunday'] = __( 'Sunday', 'event_espresso' ); |
|
1737 | - EE_Registry::$i18n_js_strings['Monday'] = __( 'Monday', 'event_espresso' ); |
|
1738 | - EE_Registry::$i18n_js_strings['Tuesday'] = __( 'Tuesday', 'event_espresso' ); |
|
1739 | - EE_Registry::$i18n_js_strings['Wednesday'] = __( 'Wednesday', 'event_espresso' ); |
|
1740 | - EE_Registry::$i18n_js_strings['Thursday'] = __( 'Thursday', 'event_espresso' ); |
|
1741 | - EE_Registry::$i18n_js_strings['Friday'] = __( 'Friday', 'event_espresso' ); |
|
1742 | - EE_Registry::$i18n_js_strings['Saturday'] = __( 'Saturday', 'event_espresso' ); |
|
1743 | - EE_Registry::$i18n_js_strings['Sun'] = __( 'Sun', 'event_espresso' ); |
|
1744 | - EE_Registry::$i18n_js_strings['Mon'] = __( 'Mon', 'event_espresso' ); |
|
1745 | - EE_Registry::$i18n_js_strings['Tue'] = __( 'Tue', 'event_espresso' ); |
|
1746 | - EE_Registry::$i18n_js_strings['Wed'] = __( 'Wed', 'event_espresso' ); |
|
1747 | - EE_Registry::$i18n_js_strings['Thu'] = __( 'Thu', 'event_espresso' ); |
|
1748 | - EE_Registry::$i18n_js_strings['Fri'] = __( 'Fri', 'event_espresso' ); |
|
1749 | - EE_Registry::$i18n_js_strings['Sat'] = __( 'Sat', 'event_espresso' ); |
|
1709 | + EE_Registry::$i18n_js_strings['confirm_delete'] = __('Are you absolutely sure you want to delete this item?\nThis action will delete ALL DATA associated with this item!!!\nThis can NOT be undone!!!', 'event_espresso'); |
|
1710 | + |
|
1711 | + EE_Registry::$i18n_js_strings['January'] = __('January', 'event_espresso'); |
|
1712 | + EE_Registry::$i18n_js_strings['February'] = __('February', 'event_espresso'); |
|
1713 | + EE_Registry::$i18n_js_strings['March'] = __('March', 'event_espresso'); |
|
1714 | + EE_Registry::$i18n_js_strings['April'] = __('April', 'event_espresso'); |
|
1715 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1716 | + EE_Registry::$i18n_js_strings['June'] = __('June', 'event_espresso'); |
|
1717 | + EE_Registry::$i18n_js_strings['July'] = __('July', 'event_espresso'); |
|
1718 | + EE_Registry::$i18n_js_strings['August'] = __('August', 'event_espresso'); |
|
1719 | + EE_Registry::$i18n_js_strings['September'] = __('September', 'event_espresso'); |
|
1720 | + EE_Registry::$i18n_js_strings['October'] = __('October', 'event_espresso'); |
|
1721 | + EE_Registry::$i18n_js_strings['November'] = __('November', 'event_espresso'); |
|
1722 | + EE_Registry::$i18n_js_strings['December'] = __('December', 'event_espresso'); |
|
1723 | + EE_Registry::$i18n_js_strings['Jan'] = __('Jan', 'event_espresso'); |
|
1724 | + EE_Registry::$i18n_js_strings['Feb'] = __('Feb', 'event_espresso'); |
|
1725 | + EE_Registry::$i18n_js_strings['Mar'] = __('Mar', 'event_espresso'); |
|
1726 | + EE_Registry::$i18n_js_strings['Apr'] = __('Apr', 'event_espresso'); |
|
1727 | + EE_Registry::$i18n_js_strings['May'] = __('May', 'event_espresso'); |
|
1728 | + EE_Registry::$i18n_js_strings['Jun'] = __('Jun', 'event_espresso'); |
|
1729 | + EE_Registry::$i18n_js_strings['Jul'] = __('Jul', 'event_espresso'); |
|
1730 | + EE_Registry::$i18n_js_strings['Aug'] = __('Aug', 'event_espresso'); |
|
1731 | + EE_Registry::$i18n_js_strings['Sep'] = __('Sep', 'event_espresso'); |
|
1732 | + EE_Registry::$i18n_js_strings['Oct'] = __('Oct', 'event_espresso'); |
|
1733 | + EE_Registry::$i18n_js_strings['Nov'] = __('Nov', 'event_espresso'); |
|
1734 | + EE_Registry::$i18n_js_strings['Dec'] = __('Dec', 'event_espresso'); |
|
1735 | + |
|
1736 | + EE_Registry::$i18n_js_strings['Sunday'] = __('Sunday', 'event_espresso'); |
|
1737 | + EE_Registry::$i18n_js_strings['Monday'] = __('Monday', 'event_espresso'); |
|
1738 | + EE_Registry::$i18n_js_strings['Tuesday'] = __('Tuesday', 'event_espresso'); |
|
1739 | + EE_Registry::$i18n_js_strings['Wednesday'] = __('Wednesday', 'event_espresso'); |
|
1740 | + EE_Registry::$i18n_js_strings['Thursday'] = __('Thursday', 'event_espresso'); |
|
1741 | + EE_Registry::$i18n_js_strings['Friday'] = __('Friday', 'event_espresso'); |
|
1742 | + EE_Registry::$i18n_js_strings['Saturday'] = __('Saturday', 'event_espresso'); |
|
1743 | + EE_Registry::$i18n_js_strings['Sun'] = __('Sun', 'event_espresso'); |
|
1744 | + EE_Registry::$i18n_js_strings['Mon'] = __('Mon', 'event_espresso'); |
|
1745 | + EE_Registry::$i18n_js_strings['Tue'] = __('Tue', 'event_espresso'); |
|
1746 | + EE_Registry::$i18n_js_strings['Wed'] = __('Wed', 'event_espresso'); |
|
1747 | + EE_Registry::$i18n_js_strings['Thu'] = __('Thu', 'event_espresso'); |
|
1748 | + EE_Registry::$i18n_js_strings['Fri'] = __('Fri', 'event_espresso'); |
|
1749 | + EE_Registry::$i18n_js_strings['Sat'] = __('Sat', 'event_espresso'); |
|
1750 | 1750 | |
1751 | 1751 | //setting on espresso_core instead of ee_admin_js because espresso_core is enqueued by the maintenance |
1752 | 1752 | //admin page when in maintenance mode and ee_admin_js is not loaded then. This works everywhere else because |
1753 | 1753 | //espresso_core is listed as a dependency of ee_admin_js. |
1754 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
1754 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
1755 | 1755 | |
1756 | 1756 | } |
1757 | 1757 | |
@@ -1785,23 +1785,23 @@ discard block |
||
1785 | 1785 | protected function _set_list_table() { |
1786 | 1786 | |
1787 | 1787 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1788 | + if ( ! isset($this->_route_config['list_table'])) |
|
1789 | 1789 | return; //not a list_table view so get out. |
1790 | 1790 | |
1791 | 1791 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1792 | |
1793 | - if ( call_user_func( array( $this, '_set_list_table_views_' . $this->_req_action ) ) === FALSE ) { |
|
1793 | + if (call_user_func(array($this, '_set_list_table_views_'.$this->_req_action)) === FALSE) { |
|
1794 | 1794 | //user error msg |
1795 | - $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso' ); |
|
1795 | + $error_msg = __('An error occurred. The requested list table views could not be found.', 'event_espresso'); |
|
1796 | 1796 | //developer error msg |
1797 | - $error_msg .= '||' . sprintf( __('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso' ), $this->_req_action, '_set_list_table_views_' . $this->_req_action ); |
|
1798 | - throw new EE_Error( $error_msg ); |
|
1797 | + $error_msg .= '||'.sprintf(__('List table views for "%s" route could not be setup. Check that you have the corresponding method, "%s" set up for defining list_table_views for this route.', 'event_espresso'), $this->_req_action, '_set_list_table_views_'.$this->_req_action); |
|
1798 | + throw new EE_Error($error_msg); |
|
1799 | 1799 | } |
1800 | 1800 | |
1801 | 1801 | //let's provide the ability to filter the views per PAGE AND ROUTE, per PAGE, and globally |
1802 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug . '_' . $this->_req_action, $this->_views ); |
|
1803 | - $this->_views = apply_filters( 'FHEE_list_table_views_' . $this->page_slug, $this->_views ); |
|
1804 | - $this->_views = apply_filters( 'FHEE_list_table_views', $this->_views ); |
|
1802 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug.'_'.$this->_req_action, $this->_views); |
|
1803 | + $this->_views = apply_filters('FHEE_list_table_views_'.$this->page_slug, $this->_views); |
|
1804 | + $this->_views = apply_filters('FHEE_list_table_views', $this->_views); |
|
1805 | 1805 | |
1806 | 1806 | $this->_set_list_table_view(); |
1807 | 1807 | $this->_set_list_table_object(); |
@@ -1823,14 +1823,14 @@ discard block |
||
1823 | 1823 | * @return array |
1824 | 1824 | */ |
1825 | 1825 | protected function _set_list_table_view() { |
1826 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1826 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1827 | 1827 | |
1828 | 1828 | |
1829 | 1829 | // looking at active items or dumpster diving ? |
1830 | - if ( ! isset( $this->_req_data['status'] ) || ! array_key_exists( $this->_req_data['status'], $this->_views )) { |
|
1831 | - $this->_view = isset( $this->_views['in_use'] ) ? 'in_use' : 'all'; |
|
1830 | + if ( ! isset($this->_req_data['status']) || ! array_key_exists($this->_req_data['status'], $this->_views)) { |
|
1831 | + $this->_view = isset($this->_views['in_use']) ? 'in_use' : 'all'; |
|
1832 | 1832 | } else { |
1833 | - $this->_view = sanitize_key( $this->_req_data['status'] ); |
|
1833 | + $this->_view = sanitize_key($this->_req_data['status']); |
|
1834 | 1834 | } |
1835 | 1835 | } |
1836 | 1836 | |
@@ -1843,8 +1843,8 @@ discard block |
||
1843 | 1843 | * @throws \EE_Error |
1844 | 1844 | */ |
1845 | 1845 | protected function _set_list_table_object() { |
1846 | - if ( isset( $this->_route_config['list_table'] ) ) { |
|
1847 | - if ( ! class_exists( $this->_route_config['list_table'] ) ) { |
|
1846 | + if (isset($this->_route_config['list_table'])) { |
|
1847 | + if ( ! class_exists($this->_route_config['list_table'])) { |
|
1848 | 1848 | throw new EE_Error( |
1849 | 1849 | sprintf( |
1850 | 1850 | __( |
@@ -1852,12 +1852,12 @@ discard block |
||
1852 | 1852 | 'event_espresso' |
1853 | 1853 | ), |
1854 | 1854 | $this->_route_config['list_table'], |
1855 | - get_class( $this ) |
|
1855 | + get_class($this) |
|
1856 | 1856 | ) |
1857 | 1857 | ); |
1858 | 1858 | } |
1859 | 1859 | $list_table = $this->_route_config['list_table']; |
1860 | - $this->_list_table_object = new $list_table( $this ); |
|
1860 | + $this->_list_table_object = new $list_table($this); |
|
1861 | 1861 | } |
1862 | 1862 | } |
1863 | 1863 | |
@@ -1874,27 +1874,27 @@ discard block |
||
1874 | 1874 | * |
1875 | 1875 | * @return array |
1876 | 1876 | */ |
1877 | - public function get_list_table_view_RLs( $extra_query_args = array() ) { |
|
1877 | + public function get_list_table_view_RLs($extra_query_args = array()) { |
|
1878 | 1878 | |
1879 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1879 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1880 | 1880 | |
1881 | - if ( empty( $this->_views )) { |
|
1881 | + if (empty($this->_views)) { |
|
1882 | 1882 | $this->_views = array(); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | 1885 | // cycle thru views |
1886 | - foreach ( $this->_views as $key => $view ) { |
|
1886 | + foreach ($this->_views as $key => $view) { |
|
1887 | 1887 | $query_args = array(); |
1888 | 1888 | // check for current view |
1889 | - $this->_views[ $key ]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1889 | + $this->_views[$key]['class'] = $this->_view == $view['slug'] ? 'current' : ''; |
|
1890 | 1890 | $query_args['action'] = $this->_req_action; |
1891 | - $query_args[$this->_req_action.'_nonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
1891 | + $query_args[$this->_req_action.'_nonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
1892 | 1892 | $query_args['status'] = $view['slug']; |
1893 | 1893 | //merge any other arguments sent in. |
1894 | - if ( isset( $extra_query_args[$view['slug']] ) ) { |
|
1895 | - $query_args = array_merge( $query_args, $extra_query_args[$view['slug']] ); |
|
1894 | + if (isset($extra_query_args[$view['slug']])) { |
|
1895 | + $query_args = array_merge($query_args, $extra_query_args[$view['slug']]); |
|
1896 | 1896 | } |
1897 | - $this->_views[ $key ]['url'] = EE_Admin_Page::add_query_args_and_nonce( $query_args, $this->_admin_base_url ); |
|
1897 | + $this->_views[$key]['url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, $this->_admin_base_url); |
|
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | return $this->_views; |
@@ -1911,15 +1911,15 @@ discard block |
||
1911 | 1911 | * @param int $max_entries total number of rows in the table |
1912 | 1912 | * @return string |
1913 | 1913 | */ |
1914 | - protected function _entries_per_page_dropdown( $max_entries = FALSE ) { |
|
1914 | + protected function _entries_per_page_dropdown($max_entries = FALSE) { |
|
1915 | 1915 | |
1916 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1917 | - $values = array( 10, 25, 50, 100 ); |
|
1918 | - $per_page = ( ! empty( $this->_req_data['per_page'] )) ? absint( $this->_req_data['per_page'] ) : 10; |
|
1916 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1917 | + $values = array(10, 25, 50, 100); |
|
1918 | + $per_page = ( ! empty($this->_req_data['per_page'])) ? absint($this->_req_data['per_page']) : 10; |
|
1919 | 1919 | |
1920 | - if ( $max_entries ) { |
|
1920 | + if ($max_entries) { |
|
1921 | 1921 | $values[] = $max_entries; |
1922 | - sort( $values ); |
|
1922 | + sort($values); |
|
1923 | 1923 | } |
1924 | 1924 | |
1925 | 1925 | $entries_per_page_dropdown = ' |
@@ -1928,15 +1928,15 @@ discard block |
||
1928 | 1928 | Show |
1929 | 1929 | <select id="entries-per-page-slct" name="entries-per-page-slct">'; |
1930 | 1930 | |
1931 | - foreach ( $values as $value ) { |
|
1932 | - if ( $value < $max_entries ) { |
|
1933 | - $selected = $value == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1931 | + foreach ($values as $value) { |
|
1932 | + if ($value < $max_entries) { |
|
1933 | + $selected = $value == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1934 | 1934 | $entries_per_page_dropdown .= ' |
1935 | 1935 | <option value="'.$value.'"'.$selected.'>'.$value.' </option>'; |
1936 | 1936 | } |
1937 | 1937 | } |
1938 | 1938 | |
1939 | - $selected = $max_entries == $per_page ? ' selected="' . $per_page . '"' : ''; |
|
1939 | + $selected = $max_entries == $per_page ? ' selected="'.$per_page.'"' : ''; |
|
1940 | 1940 | $entries_per_page_dropdown .= ' |
1941 | 1941 | <option value="'.$max_entries.'"'.$selected.'>All </option>'; |
1942 | 1942 | |
@@ -1959,8 +1959,8 @@ discard block |
||
1959 | 1959 | * @return void |
1960 | 1960 | */ |
1961 | 1961 | public function _set_search_attributes() { |
1962 | - $this->_template_args['search']['btn_label'] = sprintf( __( 'Search %s', 'event_espresso' ), empty( $this->_search_btn_label ) ? $this->page_label : $this->_search_btn_label ); |
|
1963 | - $this->_template_args['search']['callback'] = 'search_' . $this->page_slug; |
|
1962 | + $this->_template_args['search']['btn_label'] = sprintf(__('Search %s', 'event_espresso'), empty($this->_search_btn_label) ? $this->page_label : $this->_search_btn_label); |
|
1963 | + $this->_template_args['search']['callback'] = 'search_'.$this->page_slug; |
|
1964 | 1964 | } |
1965 | 1965 | |
1966 | 1966 | /*** END LIST TABLE METHODS **/ |
@@ -1979,10 +1979,10 @@ discard block |
||
1979 | 1979 | * @return void |
1980 | 1980 | */ |
1981 | 1981 | private function _add_registered_meta_boxes() { |
1982 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1982 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1983 | 1983 | |
1984 | 1984 | //we only add meta boxes if the page_route calls for it |
1985 | - if ( is_array( $this->_route_config ) && isset( $this->_route_config['metaboxes'] ) |
|
1985 | + if (is_array($this->_route_config) && isset($this->_route_config['metaboxes']) |
|
1986 | 1986 | && is_array( |
1987 | 1987 | $this->_route_config['metaboxes'] |
1988 | 1988 | ) |
@@ -1990,27 +1990,27 @@ discard block |
||
1990 | 1990 | // this simply loops through the callbacks provided |
1991 | 1991 | // and checks if there is a corresponding callback registered by the child |
1992 | 1992 | // if there is then we go ahead and process the metabox loader. |
1993 | - foreach ( $this->_route_config['metaboxes'] as $metabox_callback ) { |
|
1993 | + foreach ($this->_route_config['metaboxes'] as $metabox_callback) { |
|
1994 | 1994 | // first check for Closures |
1995 | - if ( $metabox_callback instanceof Closure ) { |
|
1995 | + if ($metabox_callback instanceof Closure) { |
|
1996 | 1996 | $result = $metabox_callback(); |
1997 | - } else if ( is_array( $metabox_callback ) && isset( $metabox_callback[0], $metabox_callback[1] ) ) { |
|
1998 | - $result = call_user_func( array( $metabox_callback[0], $metabox_callback[1] ) ); |
|
1997 | + } else if (is_array($metabox_callback) && isset($metabox_callback[0], $metabox_callback[1])) { |
|
1998 | + $result = call_user_func(array($metabox_callback[0], $metabox_callback[1])); |
|
1999 | 1999 | } else { |
2000 | - $result = call_user_func( array( $this, &$metabox_callback ) ); |
|
2000 | + $result = call_user_func(array($this, &$metabox_callback)); |
|
2001 | 2001 | } |
2002 | - if ( $result === FALSE ) { |
|
2002 | + if ($result === FALSE) { |
|
2003 | 2003 | // user error msg |
2004 | - $error_msg = __( 'An error occurred. The requested metabox could not be found.', 'event_espresso' ); |
|
2004 | + $error_msg = __('An error occurred. The requested metabox could not be found.', 'event_espresso'); |
|
2005 | 2005 | // developer error msg |
2006 | - $error_msg .= '||' . sprintf( |
|
2006 | + $error_msg .= '||'.sprintf( |
|
2007 | 2007 | __( |
2008 | 2008 | 'The metabox with the string "%s" could not be called. Check that the spelling for method names and actions in the "_page_config[\'metaboxes\']" array are all correct.', |
2009 | 2009 | 'event_espresso' |
2010 | 2010 | ), |
2011 | 2011 | $metabox_callback |
2012 | 2012 | ); |
2013 | - throw new EE_Error( $error_msg ); |
|
2013 | + throw new EE_Error($error_msg); |
|
2014 | 2014 | } |
2015 | 2015 | } |
2016 | 2016 | } |
@@ -2029,19 +2029,19 @@ discard block |
||
2029 | 2029 | private function _add_screen_columns() { |
2030 | 2030 | if ( |
2031 | 2031 | is_array($this->_route_config) |
2032 | - && isset( $this->_route_config['columns'] ) |
|
2032 | + && isset($this->_route_config['columns']) |
|
2033 | 2033 | && is_array($this->_route_config['columns']) |
2034 | - && count( $this->_route_config['columns'] ) === 2 |
|
2034 | + && count($this->_route_config['columns']) === 2 |
|
2035 | 2035 | ) { |
2036 | - add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1] ) ); |
|
2036 | + add_screen_option('layout_columns', array('max' => (int) $this->_route_config['columns'][0], 'default' => (int) $this->_route_config['columns'][1])); |
|
2037 | 2037 | $this->_template_args['num_columns'] = $this->_route_config['columns'][0]; |
2038 | 2038 | $screen_id = $this->_current_screen->id; |
2039 | 2039 | $screen_columns = (int) get_user_option("screen_layout_$screen_id"); |
2040 | - $total_columns = !empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | - $this->_template_args['current_screen_widget_class'] = 'columns-' . $total_columns; |
|
2040 | + $total_columns = ! empty($screen_columns) ? $screen_columns : $this->_route_config['columns'][1]; |
|
2041 | + $this->_template_args['current_screen_widget_class'] = 'columns-'.$total_columns; |
|
2042 | 2042 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2043 | 2043 | $this->_template_args['screen'] = $this->_current_screen; |
2044 | - $this->_column_template_path = EE_ADMIN_TEMPLATE . 'admin_details_metabox_column_wrapper.template.php'; |
|
2044 | + $this->_column_template_path = EE_ADMIN_TEMPLATE.'admin_details_metabox_column_wrapper.template.php'; |
|
2045 | 2045 | |
2046 | 2046 | //finally if we don't have has_metaboxes set in the route config let's make sure it IS set other wise the necessary hidden fields for this won't be loaded. |
2047 | 2047 | $this->_route_config['has_metaboxes'] = TRUE; |
@@ -2058,11 +2058,11 @@ discard block |
||
2058 | 2058 | */ |
2059 | 2059 | |
2060 | 2060 | private function _espresso_news_post_box() { |
2061 | - $news_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __( 'New @ Event Espresso', 'event_espresso' ) ); |
|
2062 | - add_meta_box( 'espresso_news_post_box', $news_box_title, array( |
|
2061 | + $news_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('New @ Event Espresso', 'event_espresso')); |
|
2062 | + add_meta_box('espresso_news_post_box', $news_box_title, array( |
|
2063 | 2063 | $this, |
2064 | 2064 | 'espresso_news_post_box' |
2065 | - ), $this->_wp_page_slug, 'side' ); |
|
2065 | + ), $this->_wp_page_slug, 'side'); |
|
2066 | 2066 | } |
2067 | 2067 | |
2068 | 2068 | |
@@ -2070,14 +2070,14 @@ discard block |
||
2070 | 2070 | * Code for setting up espresso ratings request metabox. |
2071 | 2071 | */ |
2072 | 2072 | protected function _espresso_ratings_request() { |
2073 | - if ( ! apply_filters( 'FHEE_show_ratings_request_meta_box', true ) ) { |
|
2073 | + if ( ! apply_filters('FHEE_show_ratings_request_meta_box', true)) { |
|
2074 | 2074 | return ''; |
2075 | 2075 | } |
2076 | - $ratings_box_title = apply_filters( 'FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso') ); |
|
2077 | - add_meta_box( 'espresso_ratings_request', $ratings_box_title, array( |
|
2076 | + $ratings_box_title = apply_filters('FHEE__EE_Admin_Page___espresso_news_post_box__news_box_title', __('Keep Event Espresso Decaf Free', 'event_espresso')); |
|
2077 | + add_meta_box('espresso_ratings_request', $ratings_box_title, array( |
|
2078 | 2078 | $this, |
2079 | 2079 | 'espresso_ratings_request' |
2080 | - ), $this->_wp_page_slug, 'side' ); |
|
2080 | + ), $this->_wp_page_slug, 'side'); |
|
2081 | 2081 | } |
2082 | 2082 | |
2083 | 2083 | |
@@ -2085,34 +2085,34 @@ discard block |
||
2085 | 2085 | * Code for setting up espresso ratings request metabox content. |
2086 | 2086 | */ |
2087 | 2087 | public function espresso_ratings_request() { |
2088 | - $template_path = EE_ADMIN_TEMPLATE . 'espresso_ratings_request_content.template.php'; |
|
2089 | - EEH_Template::display_template( $template_path, array() ); |
|
2088 | + $template_path = EE_ADMIN_TEMPLATE.'espresso_ratings_request_content.template.php'; |
|
2089 | + EEH_Template::display_template($template_path, array()); |
|
2090 | 2090 | } |
2091 | 2091 | |
2092 | 2092 | |
2093 | 2093 | |
2094 | 2094 | |
2095 | - public static function cached_rss_display( $rss_id, $url ) { |
|
2096 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>'; |
|
2097 | - $doing_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
2098 | - $pre = '<div class="espresso-rss-display">' . "\n\t"; |
|
2099 | - $pre .= '<span id="' . $rss_id . '_url" class="hidden">' . $url . '</span>'; |
|
2100 | - $post = '</div>' . "\n"; |
|
2095 | + public static function cached_rss_display($rss_id, $url) { |
|
2096 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>'; |
|
2097 | + $doing_ajax = (defined('DOING_AJAX') && DOING_AJAX); |
|
2098 | + $pre = '<div class="espresso-rss-display">'."\n\t"; |
|
2099 | + $pre .= '<span id="'.$rss_id.'_url" class="hidden">'.$url.'</span>'; |
|
2100 | + $post = '</div>'."\n"; |
|
2101 | 2101 | |
2102 | - $cache_key = 'ee_rss_' . md5( $rss_id ); |
|
2103 | - if ( FALSE != ( $output = get_transient( $cache_key ) ) ) { |
|
2104 | - echo $pre . $output . $post; |
|
2102 | + $cache_key = 'ee_rss_'.md5($rss_id); |
|
2103 | + if (FALSE != ($output = get_transient($cache_key))) { |
|
2104 | + echo $pre.$output.$post; |
|
2105 | 2105 | return TRUE; |
2106 | 2106 | } |
2107 | 2107 | |
2108 | - if ( ! $doing_ajax ) { |
|
2109 | - echo $pre . $loading . $post; |
|
2108 | + if ( ! $doing_ajax) { |
|
2109 | + echo $pre.$loading.$post; |
|
2110 | 2110 | return FALSE; |
2111 | 2111 | } |
2112 | 2112 | |
2113 | 2113 | ob_start(); |
2114 | - wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5) ); |
|
2115 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); |
|
2114 | + wp_widget_rss_output($url, array('show_date' => 0, 'items' => 5)); |
|
2115 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); |
|
2116 | 2116 | return TRUE; |
2117 | 2117 | |
2118 | 2118 | } |
@@ -2124,13 +2124,13 @@ discard block |
||
2124 | 2124 | <div id="espresso_news_post_box_content" class="infolinks"> |
2125 | 2125 | <?php |
2126 | 2126 | // Get RSS Feed(s) |
2127 | - $feed_url = apply_filters( 'FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/' ); |
|
2127 | + $feed_url = apply_filters('FHEE__EE_Admin_Page__espresso_news_post_box__feed_url', 'http://eventespresso.com/feed/'); |
|
2128 | 2128 | $url = urlencode($feed_url); |
2129 | - self::cached_rss_display( 'espresso_news_post_box_content', $url ); |
|
2129 | + self::cached_rss_display('espresso_news_post_box_content', $url); |
|
2130 | 2130 | |
2131 | 2131 | ?> |
2132 | 2132 | </div> |
2133 | - <?php do_action( 'AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2133 | + <?php do_action('AHEE__EE_Admin_Page__espresso_news_post_box__after_content'); ?> |
|
2134 | 2134 | </div> |
2135 | 2135 | <?php |
2136 | 2136 | } |
@@ -2151,32 +2151,32 @@ discard block |
||
2151 | 2151 | |
2152 | 2152 | protected function _espresso_sponsors_post_box() { |
2153 | 2153 | |
2154 | - $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
|
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2154 | + $show_sponsors = apply_filters('FHEE_show_sponsors_meta_box', TRUE); |
|
2155 | + if ($show_sponsors) |
|
2156 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array($this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2157 | 2157 | } |
2158 | 2158 | |
2159 | 2159 | |
2160 | 2160 | public function espresso_sponsors_post_box() { |
2161 | - $templatepath = EE_ADMIN_TEMPLATE . 'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | - EEH_Template::display_template( $templatepath ); |
|
2161 | + $templatepath = EE_ADMIN_TEMPLATE.'admin_general_metabox_contents_espresso_sponsors.template.php'; |
|
2162 | + EEH_Template::display_template($templatepath); |
|
2163 | 2163 | } |
2164 | 2164 | |
2165 | 2165 | |
2166 | 2166 | |
2167 | 2167 | private function _publish_post_box() { |
2168 | - $meta_box_ref = 'espresso_' . $this->page_slug . '_editor_overview'; |
|
2168 | + $meta_box_ref = 'espresso_'.$this->page_slug.'_editor_overview'; |
|
2169 | 2169 | |
2170 | 2170 | //if there is a array('label' => array('publishbox' => 'some title') ) present in the _page_config array then we'll use that for the metabox label. Otherwise we'll just use publish (publishbox itself could be an array of labels indexed by routes) |
2171 | - if ( !empty( $this->_labels['publishbox'] ) ) { |
|
2172 | - $box_label = is_array( $this->_labels['publishbox'] ) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2171 | + if ( ! empty($this->_labels['publishbox'])) { |
|
2172 | + $box_label = is_array($this->_labels['publishbox']) ? $this->_labels['publishbox'][$this->_req_action] : $this->_labels['publishbox']; |
|
2173 | 2173 | } else { |
2174 | 2174 | $box_label = __('Publish', 'event_espresso'); |
2175 | 2175 | } |
2176 | 2176 | |
2177 | - $box_label = apply_filters( 'FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this ); |
|
2177 | + $box_label = apply_filters('FHEE__EE_Admin_Page___publish_post_box__box_label', $box_label, $this->_req_action, $this); |
|
2178 | 2178 | |
2179 | - add_meta_box( $meta_box_ref, $box_label, array( $this, 'editor_overview' ), $this->_current_screen->id, 'side', 'high' ); |
|
2179 | + add_meta_box($meta_box_ref, $box_label, array($this, 'editor_overview'), $this->_current_screen->id, 'side', 'high'); |
|
2180 | 2180 | |
2181 | 2181 | } |
2182 | 2182 | |
@@ -2184,9 +2184,9 @@ discard block |
||
2184 | 2184 | |
2185 | 2185 | public function editor_overview() { |
2186 | 2186 | //if we have extra content set let's add it in if not make sure its empty |
2187 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_publish_metabox.template.php'; |
|
2189 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2187 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2188 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_publish_metabox.template.php'; |
|
2189 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2190 | 2190 | } |
2191 | 2191 | |
2192 | 2192 | |
@@ -2202,8 +2202,8 @@ discard block |
||
2202 | 2202 | * @see $this->_set_publish_post_box_vars for param details |
2203 | 2203 | * @since 4.6.0 |
2204 | 2204 | */ |
2205 | - public function set_publish_post_box_vars( $name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true ) { |
|
2206 | - $this->_set_publish_post_box_vars( $name, $id, $delete, $save_close_redirect_URL, $both_btns ); |
|
2205 | + public function set_publish_post_box_vars($name = null, $id = false, $delete = false, $save_close_redirect_URL = null, $both_btns = true) { |
|
2206 | + $this->_set_publish_post_box_vars($name, $id, $delete, $save_close_redirect_URL, $both_btns); |
|
2207 | 2207 | } |
2208 | 2208 | |
2209 | 2209 | |
@@ -2231,17 +2231,17 @@ discard block |
||
2231 | 2231 | $both_btns = true |
2232 | 2232 | ) { |
2233 | 2233 | // if Save & Close, use a custom redirect URL or default to the main page? |
2234 | - $save_close_redirect_URL = ! empty( $save_close_redirect_URL ) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2234 | + $save_close_redirect_URL = ! empty($save_close_redirect_URL) ? $save_close_redirect_URL : $this->_admin_base_url; |
|
2235 | 2235 | // create the Save & Close and Save buttons |
2236 | - $this->_set_save_buttons( $both_btns, array(), array(), $save_close_redirect_URL ); |
|
2236 | + $this->_set_save_buttons($both_btns, array(), array(), $save_close_redirect_URL); |
|
2237 | 2237 | //if we have extra content set let's add it in if not make sure its empty |
2238 | - $this->_template_args['publish_box_extra_content'] = isset( $this->_template_args['publish_box_extra_content'] ) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2238 | + $this->_template_args['publish_box_extra_content'] = isset($this->_template_args['publish_box_extra_content']) ? $this->_template_args['publish_box_extra_content'] : ''; |
|
2239 | 2239 | |
2240 | 2240 | |
2241 | - if ( $delete && ! empty( $id ) ) { |
|
2241 | + if ($delete && ! empty($id)) { |
|
2242 | 2242 | //make sure we have a default if just true is sent. |
2243 | 2243 | $delete = ! empty($delete) ? $delete : 'delete'; |
2244 | - $delete_link_args = array( $name => $id ); |
|
2244 | + $delete_link_args = array($name => $id); |
|
2245 | 2245 | $delete = $this->get_action_link_or_button( |
2246 | 2246 | $delete, |
2247 | 2247 | $delete, |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | ); |
2253 | 2253 | } |
2254 | 2254 | |
2255 | - $this->_template_args['publish_delete_link'] = !empty( $id ) ? $delete : ''; |
|
2256 | - if ( ! empty( $name ) && ! empty( $id ) ) { |
|
2255 | + $this->_template_args['publish_delete_link'] = ! empty($id) ? $delete : ''; |
|
2256 | + if ( ! empty($name) && ! empty($id)) { |
|
2257 | 2257 | $hidden_field_arr[$name] = array( |
2258 | 2258 | 'type' => 'hidden', |
2259 | 2259 | 'value' => $id |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | $hf = ''; |
2264 | 2264 | } |
2265 | 2265 | // add hidden field |
2266 | - $this->_template_args['publish_hidden_fields'] = ! empty( $hf ) ? $hf[$name]['field'] : $hf; |
|
2266 | + $this->_template_args['publish_hidden_fields'] = ! empty($hf) ? $hf[$name]['field'] : $hf; |
|
2267 | 2267 | |
2268 | 2268 | } |
2269 | 2269 | |
@@ -2280,8 +2280,8 @@ discard block |
||
2280 | 2280 | <noscript> |
2281 | 2281 | <div id="no-js-message" class="error"> |
2282 | 2282 | <p style="font-size:1.3em;"> |
2283 | - <span style="color:red;"><?php _e( 'Warning!', 'event_espresso' ); ?></span> |
|
2284 | - <?php _e( 'Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso' ); ?> |
|
2283 | + <span style="color:red;"><?php _e('Warning!', 'event_espresso'); ?></span> |
|
2284 | + <?php _e('Javascript is currently turned off for your browser. Javascript must be enabled in order for all of the features on this page to function properly. Please turn your javascript back on.', 'event_espresso'); ?> |
|
2285 | 2285 | </p> |
2286 | 2286 | </div> |
2287 | 2287 | </noscript> |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | * @return string |
2302 | 2302 | */ |
2303 | 2303 | private function _display_espresso_notices() { |
2304 | - $notices = $this->_get_transient( TRUE ); |
|
2304 | + $notices = $this->_get_transient(TRUE); |
|
2305 | 2305 | echo stripslashes($notices); |
2306 | 2306 | } |
2307 | 2307 | |
@@ -2353,11 +2353,11 @@ discard block |
||
2353 | 2353 | * @param string $priority give this metabox a priority (using accepted priorities for wp meta boxes) |
2354 | 2354 | * @param boolean $create_func default is true. Basically we can say we don't WANT to have the runtime function created but just set our own callback for wp's add_meta_box. |
2355 | 2355 | */ |
2356 | - public function _add_admin_page_meta_box( $action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true ) { |
|
2357 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, $callback ); |
|
2356 | + public function _add_admin_page_meta_box($action, $title, $callback, $callback_args, $column = 'normal', $priority = 'high', $create_func = true) { |
|
2357 | + do_action('AHEE_log', __FILE__, __FUNCTION__, $callback); |
|
2358 | 2358 | |
2359 | 2359 | //if we have empty callback args and we want to automatically create the metabox callback then we need to make sure the callback args are generated. |
2360 | - if ( empty( $callback_args ) && $create_func ) { |
|
2360 | + if (empty($callback_args) && $create_func) { |
|
2361 | 2361 | $callback_args = array( |
2362 | 2362 | 'template_path' => $this->_template_path, |
2363 | 2363 | 'template_args' => $this->_template_args, |
@@ -2367,7 +2367,7 @@ discard block |
||
2367 | 2367 | //if $create_func is true (default) then we automatically create the function for displaying the actual meta box. If false then we take the $callback reference passed through and use it instead (so callers can define their own callback function/method if they wish) |
2368 | 2368 | $call_back_func = $create_func ? create_function('$post, $metabox', 'do_action( "AHEE_log", __FILE__, __FUNCTION__, ""); echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );') : $callback; |
2369 | 2369 | |
2370 | - add_meta_box( str_replace( '_', '-', $action ) . '-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args ); |
|
2370 | + add_meta_box(str_replace('_', '-', $action).'-mbox', $title, $call_back_func, $this->_wp_page_slug, $column, $priority, $callback_args); |
|
2371 | 2371 | } |
2372 | 2372 | |
2373 | 2373 | |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | */ |
2381 | 2381 | public function display_admin_page_with_metabox_columns() { |
2382 | 2382 | $this->_template_args['post_body_content'] = $this->_template_args['admin_page_content']; |
2383 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $this->_column_template_path, $this->_template_args, TRUE); |
|
2383 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_column_template_path, $this->_template_args, TRUE); |
|
2384 | 2384 | |
2385 | 2385 | //the final wrapper |
2386 | 2386 | $this->admin_page_wrapper(); |
@@ -2423,7 +2423,7 @@ discard block |
||
2423 | 2423 | * @return void |
2424 | 2424 | */ |
2425 | 2425 | public function display_about_admin_page() { |
2426 | - $this->_display_admin_page( FALSE, TRUE ); |
|
2426 | + $this->_display_admin_page(FALSE, TRUE); |
|
2427 | 2427 | } |
2428 | 2428 | |
2429 | 2429 | |
@@ -2439,10 +2439,10 @@ discard block |
||
2439 | 2439 | * @return void |
2440 | 2440 | */ |
2441 | 2441 | private function _display_admin_page($sidebar = false, $about = FALSE) { |
2442 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2442 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2443 | 2443 | |
2444 | 2444 | //custom remove metaboxes hook to add or remove any metaboxes to/from Admin pages. |
2445 | - do_action( 'AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes' ); |
|
2445 | + do_action('AHEE__EE_Admin_Page___display_admin_page__modify_metaboxes'); |
|
2446 | 2446 | |
2447 | 2447 | // set current wp page slug - looks like: event-espresso_page_event_categories |
2448 | 2448 | // keep in mind "event-espresso" COULD be something else if the top level menu label has been translated. |
@@ -2452,19 +2452,19 @@ discard block |
||
2452 | 2452 | : 'espresso-default-admin'; |
2453 | 2453 | |
2454 | 2454 | $template_path = $sidebar |
2455 | - ? EE_ADMIN_TEMPLATE . 'admin_details_wrapper.template.php' |
|
2456 | - : EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar.template.php'; |
|
2455 | + ? EE_ADMIN_TEMPLATE.'admin_details_wrapper.template.php' |
|
2456 | + : EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar.template.php'; |
|
2457 | 2457 | |
2458 | - if ( defined('DOING_AJAX' ) && DOING_AJAX ){ |
|
2459 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2458 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
2459 | + $template_path = EE_ADMIN_TEMPLATE.'admin_details_wrapper_no_sidebar_ajax.template.php'; |
|
2460 | 2460 | } |
2461 | 2461 | |
2462 | - $template_path = !empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2462 | + $template_path = ! empty($this->_column_template_path) ? $this->_column_template_path : $template_path; |
|
2463 | 2463 | |
2464 | - $this->_template_args['post_body_content'] = isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : ''; |
|
2464 | + $this->_template_args['post_body_content'] = isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : ''; |
|
2465 | 2465 | $this->_template_args['before_admin_page_content'] = isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''; |
2466 | 2466 | $this->_template_args['after_admin_page_content'] = isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''; |
2467 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2467 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2468 | 2468 | |
2469 | 2469 | |
2470 | 2470 | // the final template wrapper |
@@ -2482,7 +2482,7 @@ discard block |
||
2482 | 2482 | * @return void |
2483 | 2483 | * @throws \EE_Error |
2484 | 2484 | */ |
2485 | - public function display_admin_caf_preview_page( $utm_campaign_source = '', $display_sidebar = TRUE ) { |
|
2485 | + public function display_admin_caf_preview_page($utm_campaign_source = '', $display_sidebar = TRUE) { |
|
2486 | 2486 | //let's generate a default preview action button if there isn't one already present. |
2487 | 2487 | $this->_labels['buttons']['buy_now'] = __('Upgrade Now', 'event_espresso'); |
2488 | 2488 | $buy_now_url = add_query_arg( |
@@ -2495,7 +2495,7 @@ discard block |
||
2495 | 2495 | ), |
2496 | 2496 | 'http://eventespresso.com/pricing/' |
2497 | 2497 | ); |
2498 | - $this->_template_args['preview_action_button'] = ! isset( $this->_template_args['preview_action_button'] ) |
|
2498 | + $this->_template_args['preview_action_button'] = ! isset($this->_template_args['preview_action_button']) |
|
2499 | 2499 | ? $this->get_action_link_or_button( |
2500 | 2500 | '', |
2501 | 2501 | 'buy_now', |
@@ -2505,13 +2505,13 @@ discard block |
||
2505 | 2505 | true |
2506 | 2506 | ) |
2507 | 2507 | : $this->_template_args['preview_action_button']; |
2508 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_caf_full_page_preview.template.php'; |
|
2508 | + $template_path = EE_ADMIN_TEMPLATE.'admin_caf_full_page_preview.template.php'; |
|
2509 | 2509 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
2510 | 2510 | $template_path, |
2511 | 2511 | $this->_template_args, |
2512 | 2512 | true |
2513 | 2513 | ); |
2514 | - $this->_display_admin_page( $display_sidebar ); |
|
2514 | + $this->_display_admin_page($display_sidebar); |
|
2515 | 2515 | } |
2516 | 2516 | |
2517 | 2517 | |
@@ -2545,49 +2545,49 @@ discard block |
||
2545 | 2545 | * @param boolean $sidebar whether to display with sidebar or not. |
2546 | 2546 | * @return void |
2547 | 2547 | */ |
2548 | - private function _display_admin_list_table_page( $sidebar = false ) { |
|
2548 | + private function _display_admin_list_table_page($sidebar = false) { |
|
2549 | 2549 | //setup search attributes |
2550 | 2550 | $this->_set_search_attributes(); |
2551 | 2551 | $this->_template_args['current_page'] = $this->_wp_page_slug; |
2552 | - $template_path = EE_ADMIN_TEMPLATE . 'admin_list_wrapper.template.php'; |
|
2552 | + $template_path = EE_ADMIN_TEMPLATE.'admin_list_wrapper.template.php'; |
|
2553 | 2553 | |
2554 | - $this->_template_args['table_url'] = defined( 'DOING_AJAX') |
|
2555 | - ? add_query_arg( array( 'noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url ) |
|
2556 | - : add_query_arg( array( 'route' => $this->_req_action), $this->_admin_base_url); |
|
2554 | + $this->_template_args['table_url'] = defined('DOING_AJAX') |
|
2555 | + ? add_query_arg(array('noheader' => 'true', 'route' => $this->_req_action), $this->_admin_base_url) |
|
2556 | + : add_query_arg(array('route' => $this->_req_action), $this->_admin_base_url); |
|
2557 | 2557 | $this->_template_args['list_table'] = $this->_list_table_object; |
2558 | 2558 | $this->_template_args['current_route'] = $this->_req_action; |
2559 | - $this->_template_args['list_table_class'] = get_class( $this->_list_table_object ); |
|
2559 | + $this->_template_args['list_table_class'] = get_class($this->_list_table_object); |
|
2560 | 2560 | |
2561 | 2561 | $ajax_sorting_callback = $this->_list_table_object->get_ajax_sorting_callback(); |
2562 | - if( ! empty( $ajax_sorting_callback )) { |
|
2562 | + if ( ! empty($ajax_sorting_callback)) { |
|
2563 | 2563 | $sortable_list_table_form_fields = wp_nonce_field( |
2564 | - $ajax_sorting_callback . '_nonce', |
|
2565 | - $ajax_sorting_callback . '_nonce', |
|
2564 | + $ajax_sorting_callback.'_nonce', |
|
2565 | + $ajax_sorting_callback.'_nonce', |
|
2566 | 2566 | FALSE, |
2567 | 2567 | FALSE |
2568 | 2568 | ); |
2569 | 2569 | // $reorder_action = 'espresso_' . $ajax_sorting_callback . '_nonce'; |
2570 | 2570 | // $sortable_list_table_form_fields = wp_nonce_field( $reorder_action, 'ajax_table_sort_nonce', FALSE, FALSE ); |
2571 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="' . $this->page_slug .'" />'; |
|
2572 | - $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="' . $ajax_sorting_callback . '" />'; |
|
2571 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_page" name="ajax_table_sort_page" value="'.$this->page_slug.'" />'; |
|
2572 | + $sortable_list_table_form_fields .= '<input type="hidden" id="ajax_table_sort_action" name="ajax_table_sort_action" value="'.$ajax_sorting_callback.'" />'; |
|
2573 | 2573 | } else { |
2574 | 2574 | $sortable_list_table_form_fields = ''; |
2575 | 2575 | } |
2576 | 2576 | |
2577 | 2577 | $this->_template_args['sortable_list_table_form_fields'] = $sortable_list_table_form_fields; |
2578 | - $hidden_form_fields = isset( $this->_template_args['list_table_hidden_fields'] ) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | - $nonce_ref = $this->_req_action . '_nonce'; |
|
2580 | - $hidden_form_fields .= '<input type="hidden" name="' . $nonce_ref . '" value="' . wp_create_nonce( $nonce_ref ) . '">'; |
|
2578 | + $hidden_form_fields = isset($this->_template_args['list_table_hidden_fields']) ? $this->_template_args['list_table_hidden_fields'] : ''; |
|
2579 | + $nonce_ref = $this->_req_action.'_nonce'; |
|
2580 | + $hidden_form_fields .= '<input type="hidden" name="'.$nonce_ref.'" value="'.wp_create_nonce($nonce_ref).'">'; |
|
2581 | 2581 | $this->_template_args['list_table_hidden_fields'] = $hidden_form_fields; |
2582 | 2582 | |
2583 | 2583 | //display message about search results? |
2584 | 2584 | $this->_template_args['before_list_table'] .= apply_filters( |
2585 | 2585 | 'FHEE__EE_Admin_Page___display_admin_list_table_page__before_list_table__template_arg', |
2586 | - ! empty( $this->_req_data['s'] ) |
|
2587 | - ? '<p class="ee-search-results">' . sprintf( |
|
2588 | - __( 'Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso' ), |
|
2589 | - trim( $this->_req_data['s'], '%' ) |
|
2590 | - ) . '</p>' |
|
2586 | + ! empty($this->_req_data['s']) |
|
2587 | + ? '<p class="ee-search-results">'.sprintf( |
|
2588 | + __('Displaying search results for the search string: <strong><em>%s</em></strong>', 'event_espresso'), |
|
2589 | + trim($this->_req_data['s'], '%') |
|
2590 | + ).'</p>' |
|
2591 | 2591 | : '', |
2592 | 2592 | $this->page_slug, |
2593 | 2593 | $this->_req_data, |
@@ -2599,7 +2599,7 @@ discard block |
||
2599 | 2599 | true |
2600 | 2600 | ); |
2601 | 2601 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2602 | + if ($sidebar) |
|
2603 | 2603 | $this->display_admin_page_with_sidebar(); |
2604 | 2604 | else |
2605 | 2605 | $this->display_admin_page_with_no_sidebar(); |
@@ -2622,9 +2622,9 @@ discard block |
||
2622 | 2622 | * @param array $items see above for format of array |
2623 | 2623 | * @return string html string of legend |
2624 | 2624 | */ |
2625 | - protected function _display_legend( $items ) { |
|
2626 | - $this->_template_args['items'] = apply_filters( 'FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this ); |
|
2627 | - $legend_template = EE_ADMIN_TEMPLATE . 'admin_details_legend.template.php'; |
|
2625 | + protected function _display_legend($items) { |
|
2626 | + $this->_template_args['items'] = apply_filters('FHEE__EE_Admin_Page___display_legend__items', (array) $items, $this); |
|
2627 | + $legend_template = EE_ADMIN_TEMPLATE.'admin_details_legend.template.php'; |
|
2628 | 2628 | return EEH_Template::display_template($legend_template, $this->_template_args, TRUE); |
2629 | 2629 | } |
2630 | 2630 | |
@@ -2649,33 +2649,33 @@ discard block |
||
2649 | 2649 | * |
2650 | 2650 | * @return void |
2651 | 2651 | */ |
2652 | - protected function _return_json( $sticky_notices = false ) { |
|
2652 | + protected function _return_json($sticky_notices = false) { |
|
2653 | 2653 | |
2654 | 2654 | //make sure any EE_Error notices have been handled. |
2655 | - $this->_process_notices( array(), true, $sticky_notices ); |
|
2655 | + $this->_process_notices(array(), true, $sticky_notices); |
|
2656 | 2656 | |
2657 | 2657 | |
2658 | - $data = isset( $this->_template_args['data'] ) ? $this->_template_args['data'] : array(); |
|
2658 | + $data = isset($this->_template_args['data']) ? $this->_template_args['data'] : array(); |
|
2659 | 2659 | unset($this->_template_args['data']); |
2660 | 2660 | $json = array( |
2661 | - 'error' => isset( $this->_template_args['error'] ) ? $this->_template_args['error'] : false, |
|
2662 | - 'success' => isset( $this->_template_args['success'] ) ? $this->_template_args['success'] : false, |
|
2663 | - 'errors' => isset( $this->_template_args['errors'] ) ? $this->_template_args['errors'] : false, |
|
2664 | - 'attention' => isset( $this->_template_args['attention'] ) ? $this->_template_args['attention'] : false, |
|
2661 | + 'error' => isset($this->_template_args['error']) ? $this->_template_args['error'] : false, |
|
2662 | + 'success' => isset($this->_template_args['success']) ? $this->_template_args['success'] : false, |
|
2663 | + 'errors' => isset($this->_template_args['errors']) ? $this->_template_args['errors'] : false, |
|
2664 | + 'attention' => isset($this->_template_args['attention']) ? $this->_template_args['attention'] : false, |
|
2665 | 2665 | 'notices' => EE_Error::get_notices(), |
2666 | - 'content' => isset( $this->_template_args['admin_page_content'] ) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | - 'data' => array_merge( $data, array('template_args' => $this->_template_args ) ), |
|
2666 | + 'content' => isset($this->_template_args['admin_page_content']) ? $this->_template_args['admin_page_content'] : '', |
|
2667 | + 'data' => array_merge($data, array('template_args' => $this->_template_args)), |
|
2668 | 2668 | 'isEEajax' => TRUE //special flag so any ajax.Success methods in js can identify this return package as a EEajax package. |
2669 | 2669 | ); |
2670 | 2670 | |
2671 | 2671 | |
2672 | 2672 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2673 | + if (NULL === error_get_last() || ! headers_sent()) |
|
2674 | 2674 | header('Content-Type: application/json; charset=UTF-8'); |
2675 | - if( function_exists( 'wp_json_encode' ) ) { |
|
2676 | - echo wp_json_encode( $json ); |
|
2675 | + if (function_exists('wp_json_encode')) { |
|
2676 | + echo wp_json_encode($json); |
|
2677 | 2677 | } else { |
2678 | - echo json_encode( $json ); |
|
2678 | + echo json_encode($json); |
|
2679 | 2679 | } |
2680 | 2680 | exit(); |
2681 | 2681 | } |
@@ -2689,11 +2689,11 @@ discard block |
||
2689 | 2689 | * @throws EE_Error |
2690 | 2690 | */ |
2691 | 2691 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2692 | + if (defined('DOING_AJAX') && DOING_AJAX) |
|
2693 | 2693 | $this->_return_json(); |
2694 | 2694 | |
2695 | 2695 | else { |
2696 | - throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
|
2696 | + throw new EE_Error(sprintf(__('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__)); |
|
2697 | 2697 | } |
2698 | 2698 | } |
2699 | 2699 | |
@@ -2706,7 +2706,7 @@ discard block |
||
2706 | 2706 | * |
2707 | 2707 | * @access public |
2708 | 2708 | */ |
2709 | - public function set_hook_object( EE_Admin_Hooks $hook_obj ) { |
|
2709 | + public function set_hook_object(EE_Admin_Hooks $hook_obj) { |
|
2710 | 2710 | $this->_hook_obj = $hook_obj; |
2711 | 2711 | } |
2712 | 2712 | |
@@ -2722,33 +2722,33 @@ discard block |
||
2722 | 2722 | */ |
2723 | 2723 | public function admin_page_wrapper($about = FALSE) { |
2724 | 2724 | |
2725 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2725 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2726 | 2726 | |
2727 | 2727 | $this->_nav_tabs = $this->_get_main_nav_tabs(); |
2728 | 2728 | |
2729 | 2729 | $this->_template_args['nav_tabs'] = $this->_nav_tabs; |
2730 | 2730 | $this->_template_args['admin_page_title'] = $this->_admin_page_title; |
2731 | 2731 | |
2732 | - $this->_template_args['before_admin_page_content'] = apply_filters( 'FHEE_before_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['before_admin_page_content'] ) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2733 | - $this->_template_args['after_admin_page_content'] = apply_filters( 'FHEE_after_admin_page_content' . $this->_current_page . $this->_current_view, isset( $this->_template_args['after_admin_page_content'] ) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2732 | + $this->_template_args['before_admin_page_content'] = apply_filters('FHEE_before_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['before_admin_page_content']) ? $this->_template_args['before_admin_page_content'] : ''); |
|
2733 | + $this->_template_args['after_admin_page_content'] = apply_filters('FHEE_after_admin_page_content'.$this->_current_page.$this->_current_view, isset($this->_template_args['after_admin_page_content']) ? $this->_template_args['after_admin_page_content'] : ''); |
|
2734 | 2734 | |
2735 | 2735 | $this->_template_args['after_admin_page_content'] .= $this->_set_help_popup_content(); |
2736 | 2736 | |
2737 | 2737 | |
2738 | 2738 | |
2739 | 2739 | // load settings page wrapper template |
2740 | - $template_path = !defined( 'DOING_AJAX' ) ? EE_ADMIN_TEMPLATE . 'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE . 'admin_wrapper_ajax.template.php'; |
|
2740 | + $template_path = ! defined('DOING_AJAX') ? EE_ADMIN_TEMPLATE.'admin_wrapper.template.php' : EE_ADMIN_TEMPLATE.'admin_wrapper_ajax.template.php'; |
|
2741 | 2741 | |
2742 | 2742 | //about page? |
2743 | - $template_path = $about ? EE_ADMIN_TEMPLATE . 'about_admin_wrapper.template.php' : $template_path; |
|
2743 | + $template_path = $about ? EE_ADMIN_TEMPLATE.'about_admin_wrapper.template.php' : $template_path; |
|
2744 | 2744 | |
2745 | 2745 | |
2746 | - if ( defined( 'DOING_AJAX' ) ) { |
|
2747 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
2746 | + if (defined('DOING_AJAX')) { |
|
2747 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
2748 | 2748 | |
2749 | 2749 | $this->_return_json(); |
2750 | 2750 | } else { |
2751 | - EEH_Template::display_template( $template_path, $this->_template_args ); |
|
2751 | + EEH_Template::display_template($template_path, $this->_template_args); |
|
2752 | 2752 | } |
2753 | 2753 | |
2754 | 2754 | } |
@@ -2774,7 +2774,7 @@ discard block |
||
2774 | 2774 | * @param $b |
2775 | 2775 | * @return int |
2776 | 2776 | */ |
2777 | - private function _sort_nav_tabs( $a, $b ) { |
|
2777 | + private function _sort_nav_tabs($a, $b) { |
|
2778 | 2778 | if ($a['order'] == $b['order']) { |
2779 | 2779 | return 0; |
2780 | 2780 | } |
@@ -2794,7 +2794,7 @@ discard block |
||
2794 | 2794 | * @uses EEH_Form_Fields::get_form_fields (/helper/EEH_Form_Fields.helper.php) |
2795 | 2795 | * @uses EEH_Form_Fields::get_form_fields_array (/helper/EEH_Form_Fields.helper.php) |
2796 | 2796 | */ |
2797 | - protected function _generate_admin_form_fields( $input_vars = array(), $generator = 'string', $id = FALSE ) { |
|
2797 | + protected function _generate_admin_form_fields($input_vars = array(), $generator = 'string', $id = FALSE) { |
|
2798 | 2798 | $content = $generator == 'string' ? EEH_Form_Fields::get_form_fields($input_vars, $id) : EEH_Form_Fields::get_form_fields_array($input_vars); |
2799 | 2799 | return $content; |
2800 | 2800 | } |
@@ -2816,25 +2816,25 @@ discard block |
||
2816 | 2816 | * @param array $actions if included allows us to set the actions that each button will carry out (i.e. via the "name" value in the button). We can also use this to just dump default actions by submitting some other value. |
2817 | 2817 | * @param bool|string|null $referrer if false then we just do the default action on save and close. Other wise it will use the $referrer string. IF null, then we don't do ANYTHING on save and close (normal form handling). |
2818 | 2818 | */ |
2819 | - protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL ) { |
|
2819 | + protected function _set_save_buttons($both = TRUE, $text = array(), $actions = array(), $referrer = NULL) { |
|
2820 | 2820 | //make sure $text and $actions are in an array |
2821 | 2821 | $text = (array) $text; |
2822 | 2822 | $actions = (array) $actions; |
2823 | 2823 | $referrer_url = empty($referrer) ? '' : $referrer; |
2824 | - $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $_SERVER['REQUEST_URI'] .'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="' . $referrer .'" />'; |
|
2824 | + $referrer_url = ! $referrer ? '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$_SERVER['REQUEST_URI'].'" />' : '<input type="hidden" id="save_and_close_referrer" name="save_and_close_referrer" value="'.$referrer.'" />'; |
|
2825 | 2825 | |
2826 | - $button_text = !empty($text) ? $text : array( __('Save', 'event_espresso'), __('Save and Close', 'event_espresso') ); |
|
2827 | - $default_names = array( 'save', 'save_and_close' ); |
|
2826 | + $button_text = ! empty($text) ? $text : array(__('Save', 'event_espresso'), __('Save and Close', 'event_espresso')); |
|
2827 | + $default_names = array('save', 'save_and_close'); |
|
2828 | 2828 | |
2829 | 2829 | //add in a hidden index for the current page (so save and close redirects properly) |
2830 | 2830 | $this->_template_args['save_buttons'] = $referrer_url; |
2831 | 2831 | |
2832 | - foreach ( $button_text as $key => $button ) { |
|
2832 | + foreach ($button_text as $key => $button) { |
|
2833 | 2833 | $ref = $default_names[$key]; |
2834 | - $id = $this->_current_view . '_' . $ref; |
|
2835 | - $name = !empty($actions) ? $actions[$key] : $ref; |
|
2836 | - $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
|
2837 | - if ( !$both ) break; |
|
2834 | + $id = $this->_current_view.'_'.$ref; |
|
2835 | + $name = ! empty($actions) ? $actions[$key] : $ref; |
|
2836 | + $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary '.$ref.'" value="'.$button.'" name="'.$name.'" id="'.$id.'" />'; |
|
2837 | + if ( ! $both) break; |
|
2838 | 2838 | } |
2839 | 2839 | |
2840 | 2840 | } |
@@ -2849,8 +2849,8 @@ discard block |
||
2849 | 2849 | * @param string $route |
2850 | 2850 | * @param array $additional_hidden_fields |
2851 | 2851 | */ |
2852 | - public function set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2853 | - $this->_set_add_edit_form_tags( $route, $additional_hidden_fields ); |
|
2852 | + public function set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2853 | + $this->_set_add_edit_form_tags($route, $additional_hidden_fields); |
|
2854 | 2854 | } |
2855 | 2855 | |
2856 | 2856 | |
@@ -2863,30 +2863,30 @@ discard block |
||
2863 | 2863 | * @param array $additional_hidden_fields any additional hidden fields required in the form header |
2864 | 2864 | * @return void |
2865 | 2865 | */ |
2866 | - protected function _set_add_edit_form_tags( $route = '', $additional_hidden_fields = array() ) { |
|
2866 | + protected function _set_add_edit_form_tags($route = '', $additional_hidden_fields = array()) { |
|
2867 | 2867 | |
2868 | - if ( empty( $route )) { |
|
2868 | + if (empty($route)) { |
|
2869 | 2869 | $user_msg = __('An error occurred. No action was set for this page\'s form.', 'event_espresso'); |
2870 | - $dev_msg = $user_msg . "\n" . sprintf( __('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__ ); |
|
2871 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2870 | + $dev_msg = $user_msg."\n".sprintf(__('The $route argument is required for the %s->%s method.', 'event_espresso'), __FUNCTION__, __CLASS__); |
|
2871 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
2872 | 2872 | } |
2873 | 2873 | // open form |
2874 | - $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="' . $this->_admin_base_url . '" id="' . $route . '_event_form" >'; |
|
2874 | + $this->_template_args['before_admin_page_content'] = '<form name="form" method="post" action="'.$this->_admin_base_url.'" id="'.$route.'_event_form" >'; |
|
2875 | 2875 | // add nonce |
2876 | - $nonce = wp_nonce_field( $route . '_nonce', $route . '_nonce', FALSE, FALSE ); |
|
2876 | + $nonce = wp_nonce_field($route.'_nonce', $route.'_nonce', FALSE, FALSE); |
|
2877 | 2877 | // $nonce = wp_nonce_field( $route . '_nonce', '_wpnonce', FALSE, FALSE ); |
2878 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $nonce; |
|
2878 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$nonce; |
|
2879 | 2879 | // add REQUIRED form action |
2880 | 2880 | $hidden_fields = array( |
2881 | - 'action' => array( 'type' => 'hidden', 'value' => $route ), |
|
2881 | + 'action' => array('type' => 'hidden', 'value' => $route), |
|
2882 | 2882 | ); |
2883 | 2883 | // merge arrays |
2884 | - $hidden_fields = is_array( $additional_hidden_fields) ? array_merge( $hidden_fields, $additional_hidden_fields ) : $hidden_fields; |
|
2884 | + $hidden_fields = is_array($additional_hidden_fields) ? array_merge($hidden_fields, $additional_hidden_fields) : $hidden_fields; |
|
2885 | 2885 | // generate form fields |
2886 | - $form_fields = $this->_generate_admin_form_fields( $hidden_fields, 'array' ); |
|
2886 | + $form_fields = $this->_generate_admin_form_fields($hidden_fields, 'array'); |
|
2887 | 2887 | // add fields to form |
2888 | - foreach ( (array)$form_fields as $field_name => $form_field ) { |
|
2889 | - $this->_template_args['before_admin_page_content'] .= "\n\t" . $form_field['field']; |
|
2888 | + foreach ((array) $form_fields as $field_name => $form_field) { |
|
2889 | + $this->_template_args['before_admin_page_content'] .= "\n\t".$form_field['field']; |
|
2890 | 2890 | } |
2891 | 2891 | |
2892 | 2892 | // close form |
@@ -2903,8 +2903,8 @@ discard block |
||
2903 | 2903 | * @see EE_Admin_Page::_redirect_after_action() for params. |
2904 | 2904 | * @since 4.5.0 |
2905 | 2905 | */ |
2906 | - public function redirect_after_action( $success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2907 | - $this->_redirect_after_action( $success, $what, $action_desc, $query_args, $override_overwrite ); |
|
2906 | + public function redirect_after_action($success = FALSE, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2907 | + $this->_redirect_after_action($success, $what, $action_desc, $query_args, $override_overwrite); |
|
2908 | 2908 | } |
2909 | 2909 | |
2910 | 2910 | |
@@ -2920,38 +2920,38 @@ discard block |
||
2920 | 2920 | * @access protected |
2921 | 2921 | * @return void |
2922 | 2922 | */ |
2923 | - protected function _redirect_after_action( $success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE ) { |
|
2923 | + protected function _redirect_after_action($success = 0, $what = 'item', $action_desc = 'processed', $query_args = array(), $override_overwrite = FALSE) { |
|
2924 | 2924 | |
2925 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
2925 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
2926 | 2926 | |
2927 | 2927 | //class name for actions/filters. |
2928 | 2928 | $classname = get_class($this); |
2929 | 2929 | |
2930 | 2930 | //set redirect url. Note if there is a "page" index in the $query_args then we go with vanilla admin.php route, otherwise we go with whatever is set as the _admin_base_url |
2931 | - $redirect_url = isset( $query_args['page'] ) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | - $notices = EE_Error::get_notices( FALSE ); |
|
2931 | + $redirect_url = isset($query_args['page']) ? admin_url('admin.php') : $this->_admin_base_url; |
|
2932 | + $notices = EE_Error::get_notices(FALSE); |
|
2933 | 2933 | |
2934 | 2934 | // overwrite default success messages //BUT ONLY if overwrite not overridden |
2935 | - if ( ! $override_overwrite || ! empty( $notices['errors'] )) { |
|
2935 | + if ( ! $override_overwrite || ! empty($notices['errors'])) { |
|
2936 | 2936 | EE_Error::overwrite_success(); |
2937 | 2937 | } |
2938 | - if ( ! empty( $what ) && ! empty( $action_desc ) ) { |
|
2938 | + if ( ! empty($what) && ! empty($action_desc)) { |
|
2939 | 2939 | // how many records affected ? more than one record ? or just one ? |
2940 | - if ( $success > 1 && empty( $notices[ 'errors' ] ) ) { |
|
2940 | + if ($success > 1 && empty($notices['errors'])) { |
|
2941 | 2941 | // set plural msg |
2942 | 2942 | EE_Error::add_success( |
2943 | 2943 | sprintf( |
2944 | - __( 'The "%s" have been successfully %s.', 'event_espresso' ), |
|
2944 | + __('The "%s" have been successfully %s.', 'event_espresso'), |
|
2945 | 2945 | $what, |
2946 | 2946 | $action_desc |
2947 | 2947 | ), |
2948 | 2948 | __FILE__, __FUNCTION__, __LINE__ |
2949 | 2949 | ); |
2950 | - } else if ( $success == 1 && empty( $notices[ 'errors' ] ) ) { |
|
2950 | + } else if ($success == 1 && empty($notices['errors'])) { |
|
2951 | 2951 | // set singular msg |
2952 | 2952 | EE_Error::add_success( |
2953 | 2953 | sprintf( |
2954 | - __( 'The "%s" has been successfully %s.', 'event_espresso' ), |
|
2954 | + __('The "%s" has been successfully %s.', 'event_espresso'), |
|
2955 | 2955 | $what, |
2956 | 2956 | $action_desc |
2957 | 2957 | ), |
@@ -2960,7 +2960,7 @@ discard block |
||
2960 | 2960 | } |
2961 | 2961 | } |
2962 | 2962 | // check that $query_args isn't something crazy |
2963 | - if ( ! is_array( $query_args )) { |
|
2963 | + if ( ! is_array($query_args)) { |
|
2964 | 2964 | $query_args = array(); |
2965 | 2965 | } |
2966 | 2966 | |
@@ -2973,36 +2973,36 @@ discard block |
||
2973 | 2973 | * @param array $query_args The original query_args array coming into the |
2974 | 2974 | * method. |
2975 | 2975 | */ |
2976 | - do_action( 'AHEE__' . $classname . '___redirect_after_action__before_redirect_modification_' . $this->_req_action, $query_args ); |
|
2976 | + do_action('AHEE__'.$classname.'___redirect_after_action__before_redirect_modification_'.$this->_req_action, $query_args); |
|
2977 | 2977 | |
2978 | 2978 | //calculate where we're going (if we have a "save and close" button pushed) |
2979 | - if ( isset($this->_req_data['save_and_close'] ) && isset($this->_req_data['save_and_close_referrer'] ) ) { |
|
2979 | + if (isset($this->_req_data['save_and_close']) && isset($this->_req_data['save_and_close_referrer'])) { |
|
2980 | 2980 | // even though we have the save_and_close referrer, we need to parse the url for the action in order to generate a nonce |
2981 | - $parsed_url = parse_url( $this->_req_data['save_and_close_referrer'] ); |
|
2981 | + $parsed_url = parse_url($this->_req_data['save_and_close_referrer']); |
|
2982 | 2982 | // regenerate query args array from referrer URL |
2983 | - parse_str( $parsed_url['query'], $query_args ); |
|
2983 | + parse_str($parsed_url['query'], $query_args); |
|
2984 | 2984 | // correct page and action will be in the query args now |
2985 | - $redirect_url = admin_url( 'admin.php' ); |
|
2985 | + $redirect_url = admin_url('admin.php'); |
|
2986 | 2986 | } |
2987 | 2987 | |
2988 | 2988 | //merge any default query_args set in _default_route_query_args property |
2989 | - if ( ! empty( $this->_default_route_query_args ) && ! $this->_is_UI_request ) { |
|
2989 | + if ( ! empty($this->_default_route_query_args) && ! $this->_is_UI_request) { |
|
2990 | 2990 | $args_to_merge = array(); |
2991 | - foreach ( $this->_default_route_query_args as $query_param => $query_value ) { |
|
2991 | + foreach ($this->_default_route_query_args as $query_param => $query_value) { |
|
2992 | 2992 | //is there a wp_referer array in our _default_route_query_args property? |
2993 | - if ( $query_param == 'wp_referer' ) { |
|
2993 | + if ($query_param == 'wp_referer') { |
|
2994 | 2994 | $query_value = (array) $query_value; |
2995 | - foreach ( $query_value as $reference => $value ) { |
|
2996 | - if ( strpos( $reference, 'nonce' ) !== false ) { |
|
2995 | + foreach ($query_value as $reference => $value) { |
|
2996 | + if (strpos($reference, 'nonce') !== false) { |
|
2997 | 2997 | continue; |
2998 | 2998 | } |
2999 | 2999 | |
3000 | 3000 | //finally we will override any arguments in the referer with |
3001 | 3001 | //what might be set on the _default_route_query_args array. |
3002 | - if ( isset( $this->_default_route_query_args[$reference] ) ) { |
|
3003 | - $args_to_merge[$reference] = urlencode( $this->_default_route_query_args[$reference] ); |
|
3002 | + if (isset($this->_default_route_query_args[$reference])) { |
|
3003 | + $args_to_merge[$reference] = urlencode($this->_default_route_query_args[$reference]); |
|
3004 | 3004 | } else { |
3005 | - $args_to_merge[$reference] = urlencode( $value ); |
|
3005 | + $args_to_merge[$reference] = urlencode($value); |
|
3006 | 3006 | } |
3007 | 3007 | } |
3008 | 3008 | continue; |
@@ -3013,7 +3013,7 @@ discard block |
||
3013 | 3013 | |
3014 | 3014 | //now let's merge these arguments but override with what was specifically sent in to the |
3015 | 3015 | //redirect. |
3016 | - $query_args = array_merge( $args_to_merge, $query_args ); |
|
3016 | + $query_args = array_merge($args_to_merge, $query_args); |
|
3017 | 3017 | } |
3018 | 3018 | |
3019 | 3019 | $this->_process_notices($query_args); |
@@ -3022,19 +3022,19 @@ discard block |
||
3022 | 3022 | // generate redirect url |
3023 | 3023 | |
3024 | 3024 | // if redirecting to anything other than the main page, add a nonce |
3025 | - if ( isset( $query_args['action'] )) { |
|
3025 | + if (isset($query_args['action'])) { |
|
3026 | 3026 | // manually generate wp_nonce and merge that with the query vars becuz the wp_nonce_url function wrecks havoc on some vars |
3027 | - $query_args['_wpnonce'] = wp_create_nonce( $query_args['action'] . '_nonce' ); |
|
3027 | + $query_args['_wpnonce'] = wp_create_nonce($query_args['action'].'_nonce'); |
|
3028 | 3028 | } |
3029 | 3029 | |
3030 | 3030 | //we're adding some hooks and filters in here for processing any things just before redirects (example: an admin page has done an insert or update and we want to run something after that). |
3031 | - do_action( 'AHEE_redirect_' . $classname . $this->_req_action, $query_args ); |
|
3031 | + do_action('AHEE_redirect_'.$classname.$this->_req_action, $query_args); |
|
3032 | 3032 | |
3033 | - $redirect_url = apply_filters( 'FHEE_redirect_' . $classname . $this->_req_action, self::add_query_args_and_nonce( $query_args, $redirect_url ), $query_args ); |
|
3033 | + $redirect_url = apply_filters('FHEE_redirect_'.$classname.$this->_req_action, self::add_query_args_and_nonce($query_args, $redirect_url), $query_args); |
|
3034 | 3034 | |
3035 | 3035 | |
3036 | 3036 | // check if we're doing ajax. If we are then lets just return the results and js can handle how it wants. |
3037 | - if ( defined('DOING_AJAX' ) ) { |
|
3037 | + if (defined('DOING_AJAX')) { |
|
3038 | 3038 | $default_data = array( |
3039 | 3039 | 'close' => TRUE, |
3040 | 3040 | 'redirect_url' => $redirect_url, |
@@ -3043,11 +3043,11 @@ discard block |
||
3043 | 3043 | ); |
3044 | 3044 | |
3045 | 3045 | $this->_template_args['success'] = $success; |
3046 | - $this->_template_args['data'] = !empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data'] ): $default_data; |
|
3046 | + $this->_template_args['data'] = ! empty($this->_template_args['data']) ? array_merge($default_data, $this->_template_args['data']) : $default_data; |
|
3047 | 3047 | $this->_return_json(); |
3048 | 3048 | } |
3049 | 3049 | |
3050 | - wp_safe_redirect( $redirect_url ); |
|
3050 | + wp_safe_redirect($redirect_url); |
|
3051 | 3051 | exit(); |
3052 | 3052 | } |
3053 | 3053 | |
@@ -3063,30 +3063,30 @@ discard block |
||
3063 | 3063 | * @param bool $sticky_notices This is used to flag that regardless of whether this is doing_ajax or not, we still save a transient for the notice. |
3064 | 3064 | * @return void |
3065 | 3065 | */ |
3066 | - protected function _process_notices( $query_args = array(), $skip_route_verify = FALSE , $sticky_notices = TRUE ) { |
|
3066 | + protected function _process_notices($query_args = array(), $skip_route_verify = FALSE, $sticky_notices = TRUE) { |
|
3067 | 3067 | |
3068 | 3068 | //first let's set individual error properties if doing_ajax and the properties aren't already set. |
3069 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
3070 | - $notices = EE_Error::get_notices( false ); |
|
3071 | - if ( empty( $this->_template_args['success'] ) ) { |
|
3072 | - $this->_template_args['success'] = isset( $notices['success'] ) ? $notices['success'] : false; |
|
3069 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
3070 | + $notices = EE_Error::get_notices(false); |
|
3071 | + if (empty($this->_template_args['success'])) { |
|
3072 | + $this->_template_args['success'] = isset($notices['success']) ? $notices['success'] : false; |
|
3073 | 3073 | } |
3074 | 3074 | |
3075 | - if ( empty( $this->_template_args['errors'] ) ) { |
|
3076 | - $this->_template_args['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : false; |
|
3075 | + if (empty($this->_template_args['errors'])) { |
|
3076 | + $this->_template_args['errors'] = isset($notices['errors']) ? $notices['errors'] : false; |
|
3077 | 3077 | } |
3078 | 3078 | |
3079 | - if ( empty( $this->_template_args['attention'] ) ) { |
|
3080 | - $this->_template_args['attention'] = isset( $notices['attention'] ) ? $notices['attention'] : false; |
|
3079 | + if (empty($this->_template_args['attention'])) { |
|
3080 | + $this->_template_args['attention'] = isset($notices['attention']) ? $notices['attention'] : false; |
|
3081 | 3081 | } |
3082 | 3082 | } |
3083 | 3083 | |
3084 | 3084 | $this->_template_args['notices'] = EE_Error::get_notices(); |
3085 | 3085 | |
3086 | 3086 | //IF this isn't ajax we need to create a transient for the notices using the route (however, overridden if $sticky_notices == true) |
3087 | - if ( ! defined( 'DOING_AJAX' ) || $sticky_notices ) { |
|
3088 | - $route = isset( $query_args['action'] ) ? $query_args['action'] : 'default'; |
|
3089 | - $this->_add_transient( $route, $this->_template_args['notices'], TRUE, $skip_route_verify ); |
|
3087 | + if ( ! defined('DOING_AJAX') || $sticky_notices) { |
|
3088 | + $route = isset($query_args['action']) ? $query_args['action'] : 'default'; |
|
3089 | + $this->_add_transient($route, $this->_template_args['notices'], TRUE, $skip_route_verify); |
|
3090 | 3090 | } |
3091 | 3091 | } |
3092 | 3092 | |
@@ -3116,7 +3116,7 @@ discard block |
||
3116 | 3116 | $exclude_nonce = false |
3117 | 3117 | ) { |
3118 | 3118 | //first let's validate the action (if $base_url is FALSE otherwise validation will happen further along) |
3119 | - if ( empty( $base_url ) && ! isset( $this->_page_routes[ $action ] ) ) { |
|
3119 | + if (empty($base_url) && ! isset($this->_page_routes[$action])) { |
|
3120 | 3120 | throw new EE_Error( |
3121 | 3121 | sprintf( |
3122 | 3122 | __( |
@@ -3127,7 +3127,7 @@ discard block |
||
3127 | 3127 | ) |
3128 | 3128 | ); |
3129 | 3129 | } |
3130 | - if ( ! isset( $this->_labels['buttons'][ $type ] ) ) { |
|
3130 | + if ( ! isset($this->_labels['buttons'][$type])) { |
|
3131 | 3131 | throw new EE_Error( |
3132 | 3132 | sprintf( |
3133 | 3133 | __( |
@@ -3139,8 +3139,8 @@ discard block |
||
3139 | 3139 | ); |
3140 | 3140 | } |
3141 | 3141 | //finally check user access for this button. |
3142 | - $has_access = $this->check_user_access( $action, true ); |
|
3143 | - if ( ! $has_access ) { |
|
3142 | + $has_access = $this->check_user_access($action, true); |
|
3143 | + if ( ! $has_access) { |
|
3144 | 3144 | return ''; |
3145 | 3145 | } |
3146 | 3146 | $_base_url = ! $base_url ? $this->_admin_base_url : $base_url; |
@@ -3148,11 +3148,11 @@ discard block |
||
3148 | 3148 | 'action' => $action |
3149 | 3149 | ); |
3150 | 3150 | //merge extra_request args but make sure our original action takes precedence and doesn't get overwritten. |
3151 | - if ( ! empty( $extra_request ) ) { |
|
3152 | - $query_args = array_merge( $extra_request, $query_args ); |
|
3151 | + if ( ! empty($extra_request)) { |
|
3152 | + $query_args = array_merge($extra_request, $query_args); |
|
3153 | 3153 | } |
3154 | - $url = self::add_query_args_and_nonce( $query_args, $_base_url, false, $exclude_nonce ); |
|
3155 | - return EEH_Template::get_button_or_link( $url, $this->_labels['buttons'][ $type ], $class ); |
|
3154 | + $url = self::add_query_args_and_nonce($query_args, $_base_url, false, $exclude_nonce); |
|
3155 | + return EEH_Template::get_button_or_link($url, $this->_labels['buttons'][$type], $class); |
|
3156 | 3156 | } |
3157 | 3157 | |
3158 | 3158 | |
@@ -3167,11 +3167,11 @@ discard block |
||
3167 | 3167 | $args = array( |
3168 | 3168 | 'label' => $this->_admin_page_title, |
3169 | 3169 | 'default' => 10, |
3170 | - 'option' => $this->_current_page . '_' . $this->_current_view . '_per_page' |
|
3170 | + 'option' => $this->_current_page.'_'.$this->_current_view.'_per_page' |
|
3171 | 3171 | ); |
3172 | 3172 | //ONLY add the screen option if the user has access to it. |
3173 | - if ( $this->check_user_access( $this->_current_view, true ) ) { |
|
3174 | - add_screen_option( $option, $args ); |
|
3173 | + if ($this->check_user_access($this->_current_view, true)) { |
|
3174 | + add_screen_option($option, $args); |
|
3175 | 3175 | } |
3176 | 3176 | } |
3177 | 3177 | |
@@ -3187,36 +3187,36 @@ discard block |
||
3187 | 3187 | * @return void |
3188 | 3188 | */ |
3189 | 3189 | private function _set_per_page_screen_options() { |
3190 | - if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
|
3191 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
3190 | + if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) { |
|
3191 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
3192 | 3192 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3193 | + if ( ! $user = wp_get_current_user()) |
|
3194 | 3194 | return; |
3195 | 3195 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3196 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3197 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3198 | + if ($option != sanitize_key($option)) |
|
3199 | 3199 | return; |
3200 | 3200 | |
3201 | 3201 | $map_option = $option; |
3202 | 3202 | |
3203 | 3203 | $option = str_replace('-', '_', $option); |
3204 | 3204 | |
3205 | - switch ( $map_option ) { |
|
3206 | - case $this->_current_page . '_' . $this->_current_view . '_per_page': |
|
3205 | + switch ($map_option) { |
|
3206 | + case $this->_current_page.'_'.$this->_current_view.'_per_page': |
|
3207 | 3207 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3208 | + if ($value < 1 || $value > 999) |
|
3209 | 3209 | return; |
3210 | 3210 | break; |
3211 | 3211 | default: |
3212 | - $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
|
3213 | - if ( false === $value ) |
|
3212 | + $value = apply_filters('FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value); |
|
3213 | + if (false === $value) |
|
3214 | 3214 | return; |
3215 | 3215 | break; |
3216 | 3216 | } |
3217 | 3217 | |
3218 | 3218 | update_user_meta($user->ID, $option, $value); |
3219 | - wp_safe_redirect( remove_query_arg( array('pagenum', 'apage', 'paged'), wp_get_referer() ) ); |
|
3219 | + wp_safe_redirect(remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer())); |
|
3220 | 3220 | exit; |
3221 | 3221 | } |
3222 | 3222 | } |
@@ -3227,8 +3227,8 @@ discard block |
||
3227 | 3227 | * This just allows for setting the $_template_args property if it needs to be set outside the object |
3228 | 3228 | * @param array $data array that will be assigned to template args. |
3229 | 3229 | */ |
3230 | - public function set_template_args( $data ) { |
|
3231 | - $this->_template_args = array_merge( $this->_template_args, (array) $data ); |
|
3230 | + public function set_template_args($data) { |
|
3231 | + $this->_template_args = array_merge($this->_template_args, (array) $data); |
|
3232 | 3232 | } |
3233 | 3233 | |
3234 | 3234 | |
@@ -3244,26 +3244,26 @@ discard block |
||
3244 | 3244 | * @param bool $skip_route_verify Used to indicate we want to skip route verification. This is usually ONLY used when we are adding a transient before page_routes have been defined. |
3245 | 3245 | * @return void |
3246 | 3246 | */ |
3247 | - protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
|
3247 | + protected function _add_transient($route, $data, $notices = FALSE, $skip_route_verify = FALSE) { |
|
3248 | 3248 | $user_id = get_current_user_id(); |
3249 | 3249 | |
3250 | - if ( !$skip_route_verify ) |
|
3250 | + if ( ! $skip_route_verify) |
|
3251 | 3251 | $this->_verify_route($route); |
3252 | 3252 | |
3253 | 3253 | |
3254 | 3254 | //now let's set the string for what kind of transient we're setting |
3255 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3256 | - $data = $notices ? array( 'notices' => $data ) : $data; |
|
3255 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3256 | + $data = $notices ? array('notices' => $data) : $data; |
|
3257 | 3257 | //is there already a transient for this route? If there is then let's ADD to that transient |
3258 | - $existing = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3259 | - if ( $existing ) { |
|
3260 | - $data = array_merge( (array) $data, (array) $existing ); |
|
3258 | + $existing = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3259 | + if ($existing) { |
|
3260 | + $data = array_merge((array) $data, (array) $existing); |
|
3261 | 3261 | } |
3262 | 3262 | |
3263 | - if ( is_multisite() && is_network_admin() ) { |
|
3264 | - set_site_transient( $transient, $data, 8 ); |
|
3263 | + if (is_multisite() && is_network_admin()) { |
|
3264 | + set_site_transient($transient, $data, 8); |
|
3265 | 3265 | } else { |
3266 | - set_transient( $transient, $data, 8 ); |
|
3266 | + set_transient($transient, $data, 8); |
|
3267 | 3267 | } |
3268 | 3268 | } |
3269 | 3269 | |
@@ -3275,18 +3275,18 @@ discard block |
||
3275 | 3275 | * @param bool $notices true we get notices transient. False we just return normal route transient |
3276 | 3276 | * @return mixed data |
3277 | 3277 | */ |
3278 | - protected function _get_transient( $notices = FALSE, $route = FALSE ) { |
|
3278 | + protected function _get_transient($notices = FALSE, $route = FALSE) { |
|
3279 | 3279 | $user_id = get_current_user_id(); |
3280 | - $route = !$route ? $this->_req_action : $route; |
|
3281 | - $transient = $notices ? 'ee_rte_n_tx_' . $route . '_' . $user_id : 'rte_tx_' . $route . '_' . $user_id; |
|
3282 | - $data = is_multisite() && is_network_admin() ? get_site_transient( $transient ) : get_transient( $transient ); |
|
3280 | + $route = ! $route ? $this->_req_action : $route; |
|
3281 | + $transient = $notices ? 'ee_rte_n_tx_'.$route.'_'.$user_id : 'rte_tx_'.$route.'_'.$user_id; |
|
3282 | + $data = is_multisite() && is_network_admin() ? get_site_transient($transient) : get_transient($transient); |
|
3283 | 3283 | //delete transient after retrieval (just in case it hasn't expired); |
3284 | - if ( is_multisite() && is_network_admin() ) { |
|
3285 | - delete_site_transient( $transient ); |
|
3284 | + if (is_multisite() && is_network_admin()) { |
|
3285 | + delete_site_transient($transient); |
|
3286 | 3286 | } else { |
3287 | - delete_transient( $transient ); |
|
3287 | + delete_transient($transient); |
|
3288 | 3288 | } |
3289 | - return $notices && isset( $data['notices'] ) ? $data['notices'] : $data; |
|
3289 | + return $notices && isset($data['notices']) ? $data['notices'] : $data; |
|
3290 | 3290 | } |
3291 | 3291 | |
3292 | 3292 | |
@@ -3303,12 +3303,12 @@ discard block |
||
3303 | 3303 | |
3304 | 3304 | //retrieve all existing transients |
3305 | 3305 | $query = "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%rte_tx_%' OR option_name LIKE '%rte_n_tx_%'"; |
3306 | - if ( $results = $wpdb->get_results( $query ) ) { |
|
3307 | - foreach ( $results as $result ) { |
|
3308 | - $transient = str_replace( '_transient_', '', $result->option_name ); |
|
3309 | - get_transient( $transient ); |
|
3310 | - if ( is_multisite() && is_network_admin() ) { |
|
3311 | - get_site_transient( $transient ); |
|
3306 | + if ($results = $wpdb->get_results($query)) { |
|
3307 | + foreach ($results as $result) { |
|
3308 | + $transient = str_replace('_transient_', '', $result->option_name); |
|
3309 | + get_transient($transient); |
|
3310 | + if (is_multisite() && is_network_admin()) { |
|
3311 | + get_site_transient($transient); |
|
3312 | 3312 | } |
3313 | 3313 | } |
3314 | 3314 | } |
@@ -3458,23 +3458,23 @@ discard block |
||
3458 | 3458 | * @param string $line line no where error occurred |
3459 | 3459 | * @return boolean |
3460 | 3460 | */ |
3461 | - protected function _update_espresso_configuration( $tab, $config, $file = '', $func = '', $line = '' ) { |
|
3461 | + protected function _update_espresso_configuration($tab, $config, $file = '', $func = '', $line = '') { |
|
3462 | 3462 | |
3463 | 3463 | //remove any options that are NOT going to be saved with the config settings. |
3464 | - if ( isset( $config->core->ee_ueip_optin ) ) { |
|
3464 | + if (isset($config->core->ee_ueip_optin)) { |
|
3465 | 3465 | $config->core->ee_ueip_has_notified = TRUE; |
3466 | 3466 | // TODO: remove the following two lines and make sure values are migrated from 3.1 |
3467 | - update_option( 'ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | - update_option( 'ee_ueip_has_notified', TRUE ); |
|
3467 | + update_option('ee_ueip_optin', $config->core->ee_ueip_optin); |
|
3468 | + update_option('ee_ueip_has_notified', TRUE); |
|
3469 | 3469 | } |
3470 | 3470 | // and save it (note we're also doing the network save here) |
3471 | - $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config( FALSE, FALSE ) : TRUE; |
|
3472 | - $config_saved = EE_Config::instance()->update_espresso_config( FALSE, FALSE ); |
|
3473 | - if ( $config_saved && $net_saved ) { |
|
3474 | - EE_Error::add_success( sprintf( __('"%s" have been successfully updated.', 'event_espresso'), $tab )); |
|
3471 | + $net_saved = is_main_site() ? EE_Network_Config::instance()->update_config(FALSE, FALSE) : TRUE; |
|
3472 | + $config_saved = EE_Config::instance()->update_espresso_config(FALSE, FALSE); |
|
3473 | + if ($config_saved && $net_saved) { |
|
3474 | + EE_Error::add_success(sprintf(__('"%s" have been successfully updated.', 'event_espresso'), $tab)); |
|
3475 | 3475 | return TRUE; |
3476 | 3476 | } else { |
3477 | - EE_Error::add_error( sprintf( __('The "%s" were not updated.', 'event_espresso'), $tab ), $file, $func, $line ); |
|
3477 | + EE_Error::add_error(sprintf(__('The "%s" were not updated.', 'event_espresso'), $tab), $file, $func, $line); |
|
3478 | 3478 | return FALSE; |
3479 | 3479 | } |
3480 | 3480 | } |
@@ -3487,7 +3487,7 @@ discard block |
||
3487 | 3487 | * Returns an array to be used for EE_FOrm_Fields.helper.php's select_input as the $values argument. |
3488 | 3488 | * @return array |
3489 | 3489 | */ |
3490 | - public function get_yes_no_values(){ |
|
3490 | + public function get_yes_no_values() { |
|
3491 | 3491 | return $this->_yes_no_values; |
3492 | 3492 | } |
3493 | 3493 | |
@@ -3509,8 +3509,8 @@ discard block |
||
3509 | 3509 | * |
3510 | 3510 | * @return string |
3511 | 3511 | */ |
3512 | - protected function _next_link( $url, $class = 'dashicons dashicons-arrow-right' ) { |
|
3513 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3512 | + protected function _next_link($url, $class = 'dashicons dashicons-arrow-right') { |
|
3513 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3514 | 3514 | } |
3515 | 3515 | |
3516 | 3516 | |
@@ -3524,8 +3524,8 @@ discard block |
||
3524 | 3524 | * |
3525 | 3525 | * @return string |
3526 | 3526 | */ |
3527 | - protected function _previous_link( $url, $class = 'dashicons dashicons-arrow-left' ) { |
|
3528 | - return '<a class="' . $class . '" href="' . $url . '"></a>'; |
|
3527 | + protected function _previous_link($url, $class = 'dashicons dashicons-arrow-left') { |
|
3528 | + return '<a class="'.$class.'" href="'.$url.'"></a>'; |
|
3529 | 3529 | } |
3530 | 3530 | |
3531 | 3531 | |
@@ -3544,8 +3544,8 @@ discard block |
||
3544 | 3544 | * @return bool success/fail |
3545 | 3545 | */ |
3546 | 3546 | protected function _process_resend_registration() { |
3547 | - $this->_template_args['success'] = EED_Messages::process_resend( $this->_req_data ); |
|
3548 | - do_action( 'AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data ); |
|
3547 | + $this->_template_args['success'] = EED_Messages::process_resend($this->_req_data); |
|
3548 | + do_action('AHEE__EE_Admin_Page___process_resend_registration', $this->_template_args['success'], $this->_req_data); |
|
3549 | 3549 | return $this->_template_args['success']; |
3550 | 3550 | } |
3551 | 3551 | |
@@ -3558,11 +3558,11 @@ discard block |
||
3558 | 3558 | * @param \EE_Payment $payment |
3559 | 3559 | * @return bool success/fail |
3560 | 3560 | */ |
3561 | - protected function _process_payment_notification( EE_Payment $payment ) { |
|
3562 | - add_filter( 'FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true' ); |
|
3563 | - do_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', $payment ); |
|
3564 | - $this->_template_args['success'] = apply_filters( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment ); |
|
3565 | - return $this->_template_args[ 'success' ]; |
|
3561 | + protected function _process_payment_notification(EE_Payment $payment) { |
|
3562 | + add_filter('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', '__return_true'); |
|
3563 | + do_action('AHEE__EE_Admin_Page___process_admin_payment_notification', $payment); |
|
3564 | + $this->_template_args['success'] = apply_filters('FHEE__EE_Admin_Page___process_admin_payment_notification__success', false, $payment); |
|
3565 | + return $this->_template_args['success']; |
|
3566 | 3566 | } |
3567 | 3567 | |
3568 | 3568 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -160,8 +162,9 @@ discard block |
||
160 | 162 | */ |
161 | 163 | public function __construct( $routing = TRUE ) { |
162 | 164 | |
163 | - if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) |
|
164 | - $this->_is_caf = TRUE; |
|
165 | + if ( strpos( $this->_get_dir(), 'caffeinated' ) !== false ) { |
|
166 | + $this->_is_caf = TRUE; |
|
167 | + } |
|
165 | 168 | |
166 | 169 | $this->_yes_no_values = array( |
167 | 170 | array('id' => TRUE, 'text' => __('Yes', 'event_espresso')), |
@@ -192,8 +195,9 @@ discard block |
||
192 | 195 | $this->_do_other_page_hooks(); |
193 | 196 | |
194 | 197 | //This just allows us to have extending clases do something specific before the parent constructor runs _page_setup. |
195 | - if ( method_exists( $this, '_before_page_setup' ) ) |
|
196 | - $this->_before_page_setup(); |
|
198 | + if ( method_exists( $this, '_before_page_setup' ) ) { |
|
199 | + $this->_before_page_setup(); |
|
200 | + } |
|
197 | 201 | |
198 | 202 | //set up page dependencies |
199 | 203 | $this->_page_setup(); |
@@ -500,7 +504,9 @@ discard block |
||
500 | 504 | global $ee_menu_slugs; |
501 | 505 | $ee_menu_slugs = (array) $ee_menu_slugs; |
502 | 506 | |
503 | - if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) return FALSE; |
|
507 | + if ( ( !$this->_current_page || ! isset( $ee_menu_slugs[$this->_current_page] ) ) && !defined( 'DOING_AJAX') ) { |
|
508 | + return FALSE; |
|
509 | + } |
|
504 | 510 | |
505 | 511 | |
506 | 512 | // becuz WP List tables have two duplicate select inputs for choosing bulk actions, we need to copy the action from the second to the first |
@@ -535,12 +541,14 @@ discard block |
||
535 | 541 | } |
536 | 542 | |
537 | 543 | //for caffeinated and other extended functionality. If there is a _extend_page_config method then let's run that to modify the all the various page configuration arrays |
538 | - if ( method_exists( $this, '_extend_page_config' ) ) |
|
539 | - $this->_extend_page_config(); |
|
544 | + if ( method_exists( $this, '_extend_page_config' ) ) { |
|
545 | + $this->_extend_page_config(); |
|
546 | + } |
|
540 | 547 | |
541 | 548 | //for CPT and other extended functionality. If there is an _extend_page_config_for_cpt then let's run that to modify all the various page configuration arrays. |
542 | - if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) |
|
543 | - $this->_extend_page_config_for_cpt(); |
|
549 | + if ( method_exists( $this, '_extend_page_config_for_cpt' ) ) { |
|
550 | + $this->_extend_page_config_for_cpt(); |
|
551 | + } |
|
544 | 552 | |
545 | 553 | //filter routes and page_config so addons can add their stuff. Filtering done per class |
546 | 554 | $this->_page_routes = apply_filters( 'FHEE__' . get_class($this) . '__page_setup__page_routes', $this->_page_routes, $this ); |
@@ -656,8 +664,9 @@ discard block |
||
656 | 664 | //add screen options - global, page child class, and view specific |
657 | 665 | $this->_add_global_screen_options(); |
658 | 666 | $this->_add_screen_options(); |
659 | - if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) |
|
660 | - call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
667 | + if ( method_exists( $this, '_add_screen_options_' . $this->_current_view ) ) { |
|
668 | + call_user_func( array( $this, '_add_screen_options_' . $this->_current_view ) ); |
|
669 | + } |
|
661 | 670 | |
662 | 671 | |
663 | 672 | //add help tab(s) and tours- set via page_config and qtips. |
@@ -668,28 +677,32 @@ discard block |
||
668 | 677 | //add feature_pointers - global, page child class, and view specific |
669 | 678 | $this->_add_feature_pointers(); |
670 | 679 | $this->_add_global_feature_pointers(); |
671 | - if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) |
|
672 | - call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
680 | + if ( method_exists( $this, '_add_feature_pointer_' . $this->_current_view ) ) { |
|
681 | + call_user_func( array( $this, '_add_feature_pointer_' . $this->_current_view ) ); |
|
682 | + } |
|
673 | 683 | |
674 | 684 | //enqueue scripts/styles - global, page class, and view specific |
675 | 685 | add_action('admin_enqueue_scripts', array($this, 'load_global_scripts_styles'), 5 ); |
676 | 686 | add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles'), 10 ); |
677 | - if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) |
|
678 | - add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
687 | + if ( method_exists( $this, 'load_scripts_styles_' . $this->_current_view ) ) { |
|
688 | + add_action('admin_enqueue_scripts', array($this, 'load_scripts_styles_' . $this->_current_view ), 15 ); |
|
689 | + } |
|
679 | 690 | |
680 | 691 | add_action('admin_enqueue_scripts', array( $this, 'admin_footer_scripts_eei18n_js_strings' ), 100 ); |
681 | 692 | |
682 | 693 | //admin_print_footer_scripts - global, page child class, and view specific. NOTE, despite the name, whenever possible, scripts should NOT be loaded using this. In most cases that's doing_it_wrong(). But adding hidden container elements etc. is a good use case. Notice the late priority we're giving these |
683 | 694 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_global' ), 99 ); |
684 | 695 | add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts' ), 100 ); |
685 | - if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) |
|
686 | - add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
696 | + if ( method_exists( $this, 'admin_footer_scripts_' . $this->_current_view ) ) { |
|
697 | + add_action('admin_print_footer_scripts', array( $this, 'admin_footer_scripts_' . $this->_current_view ), 101 ); |
|
698 | + } |
|
687 | 699 | |
688 | 700 | //admin footer scripts |
689 | 701 | add_action('admin_footer', array( $this, 'admin_footer_global' ), 99 ); |
690 | 702 | add_action('admin_footer', array( $this, 'admin_footer'), 100 ); |
691 | - if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) |
|
692 | - add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
703 | + if ( method_exists( $this, 'admin_footer_' . $this->_current_view ) ) { |
|
704 | + add_action('admin_footer', array( $this, 'admin_footer_' . $this->_current_view ), 101 ); |
|
705 | + } |
|
693 | 706 | |
694 | 707 | |
695 | 708 | do_action( 'FHEE__EE_Admin_Page___load_page_dependencies__after_load', $this->page_slug ); |
@@ -762,7 +775,9 @@ discard block |
||
762 | 775 | protected function _verify_routes() { |
763 | 776 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
764 | 777 | |
765 | - if ( !$this->_current_page && !defined( 'DOING_AJAX')) return FALSE; |
|
778 | + if ( !$this->_current_page && !defined( 'DOING_AJAX')) { |
|
779 | + return FALSE; |
|
780 | + } |
|
766 | 781 | |
767 | 782 | $this->_route = FALSE; |
768 | 783 | $func = FALSE; |
@@ -872,8 +887,9 @@ discard block |
||
872 | 887 | * @return void |
873 | 888 | */ |
874 | 889 | protected function _route_admin_request() { |
875 | - if ( ! $this->_is_UI_request ) |
|
876 | - $this->_verify_routes(); |
|
890 | + if ( ! $this->_is_UI_request ) { |
|
891 | + $this->_verify_routes(); |
|
892 | + } |
|
877 | 893 | |
878 | 894 | $nonce_check = isset( $this->_route_config['require_nonce'] ) ? $this->_route_config['require_nonce'] : TRUE; |
879 | 895 | |
@@ -883,8 +899,9 @@ discard block |
||
883 | 899 | $this->_verify_nonce( $nonce, $this->_req_nonce ); |
884 | 900 | } |
885 | 901 | //set the nav_tabs array but ONLY if this is UI_request |
886 | - if ( $this->_is_UI_request ) |
|
887 | - $this->_set_nav_tabs(); |
|
902 | + if ( $this->_is_UI_request ) { |
|
903 | + $this->_set_nav_tabs(); |
|
904 | + } |
|
888 | 905 | |
889 | 906 | // grab callback function |
890 | 907 | $func = is_array( $this->_route ) ? $this->_route['func'] : $this->_route; |
@@ -921,8 +938,9 @@ discard block |
||
921 | 938 | } |
922 | 939 | |
923 | 940 | |
924 | - if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) |
|
925 | - throw new EE_Error( $error_msg ); |
|
941 | + if ( !empty( $error_msg ) && $base_call === FALSE && $addon_call === FALSE ) { |
|
942 | + throw new EE_Error( $error_msg ); |
|
943 | + } |
|
926 | 944 | } |
927 | 945 | |
928 | 946 | //if we've routed and this route has a no headers route AND a sent_headers_route, then we need to reset the routing properties to the new route. |
@@ -1049,8 +1067,9 @@ discard block |
||
1049 | 1067 | $tour_buttons = '<div class="ee-abs-container"><div class="ee-help-tour-restart-buttons">'; |
1050 | 1068 | foreach ( $this->_help_tour['tours'] as $tour ) { |
1051 | 1069 | //if this is the end tour then we don't need to setup a button |
1052 | - if ( $tour instanceof EE_Help_Tour_final_stop ) |
|
1053 | - continue; |
|
1070 | + if ( $tour instanceof EE_Help_Tour_final_stop ) { |
|
1071 | + continue; |
|
1072 | + } |
|
1054 | 1073 | $tb[] = '<button id="trigger-tour-' . $tour->get_slug() . '" class="button-primary trigger-ee-help-tour">' . $tour->get_label() . '</button>'; |
1055 | 1074 | } |
1056 | 1075 | $tour_buttons .= implode('<br />', $tb); |
@@ -1060,8 +1079,9 @@ discard block |
||
1060 | 1079 | // let's see if there is a help_sidebar set for the current route and we'll set that up for usage as well. |
1061 | 1080 | if ( is_array( $config ) && isset( $config['help_sidebar'] ) ) { |
1062 | 1081 | //check that the callback given is valid |
1063 | - if ( !method_exists($this, $config['help_sidebar'] ) ) |
|
1064 | - throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1082 | + if ( !method_exists($this, $config['help_sidebar'] ) ) { |
|
1083 | + throw new EE_Error( sprintf( __('The _page_config array has a callback set for the "help_sidebar" option. However the callback given (%s) is not a valid callback. Doublecheck the spelling and make sure this method exists for the class %s', 'event_espresso'), $config['help_sidebar'], get_class($this) ) ); |
|
1084 | + } |
|
1065 | 1085 | |
1066 | 1086 | $content = apply_filters( 'FHEE__' . get_class($this) . '__add_help_tabs__help_sidebar', call_user_func( array( $this, $config['help_sidebar'] ) ) ); |
1067 | 1087 | |
@@ -1085,18 +1105,23 @@ discard block |
||
1085 | 1105 | }/**/ |
1086 | 1106 | |
1087 | 1107 | |
1088 | - if ( !isset( $config['help_tabs'] ) ) return; //no help tabs for this route |
|
1108 | + if ( !isset( $config['help_tabs'] ) ) { |
|
1109 | + return; |
|
1110 | + } |
|
1111 | + //no help tabs for this route |
|
1089 | 1112 | |
1090 | 1113 | foreach ( (array) $config['help_tabs'] as $tab_id => $cfg ) { |
1091 | 1114 | //we're here so there ARE help tabs! |
1092 | 1115 | |
1093 | 1116 | //make sure we've got what we need |
1094 | - if ( !isset( $cfg['title'] ) ) |
|
1095 | - throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1117 | + if ( !isset( $cfg['title'] ) ) { |
|
1118 | + throw new EE_Error( __('The _page_config array is not set up properly for help tabs. It is missing a title', 'event_espresso') ); |
|
1119 | + } |
|
1096 | 1120 | |
1097 | 1121 | |
1098 | - if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) |
|
1099 | - throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1122 | + if ( !isset($cfg['filename']) && !isset( $cfg['callback'] ) && !isset( $cfg['content'] ) ) { |
|
1123 | + throw new EE_Error( __('The _page_config array is not setup properly for help tabs. It is missing a either a filename reference, or a callback reference or a content reference so there is no way to know the content for the help tab', 'event_espresso') ); |
|
1124 | + } |
|
1100 | 1125 | |
1101 | 1126 | |
1102 | 1127 | |
@@ -1159,14 +1184,16 @@ discard block |
||
1159 | 1184 | $this->_help_tour = array(); |
1160 | 1185 | |
1161 | 1186 | //exit early if help tours are turned off globally |
1162 | - if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) |
|
1163 | - return; |
|
1187 | + if ( ! EE_Registry::instance()->CFG->admin->help_tour_activation || ( defined( 'EE_DISABLE_HELP_TOURS' ) && EE_DISABLE_HELP_TOURS ) ) { |
|
1188 | + return; |
|
1189 | + } |
|
1164 | 1190 | |
1165 | 1191 | //loop through _page_config to find any help_tour defined |
1166 | 1192 | foreach ( $this->_page_config as $route => $config ) { |
1167 | 1193 | //we're only going to set things up for this route |
1168 | - if ( $route !== $this->_req_action ) |
|
1169 | - continue; |
|
1194 | + if ( $route !== $this->_req_action ) { |
|
1195 | + continue; |
|
1196 | + } |
|
1170 | 1197 | |
1171 | 1198 | if ( isset( $config['help_tour'] ) ) { |
1172 | 1199 | |
@@ -1201,8 +1228,9 @@ discard block |
||
1201 | 1228 | } |
1202 | 1229 | } |
1203 | 1230 | |
1204 | - if ( !empty( $tours ) ) |
|
1205 | - $this->_help_tour['tours'] = $tours; |
|
1231 | + if ( !empty( $tours ) ) { |
|
1232 | + $this->_help_tour['tours'] = $tours; |
|
1233 | + } |
|
1206 | 1234 | |
1207 | 1235 | //thats it! Now that the $_help_tours property is set (or not) the scripts and html should be taken care of automatically. |
1208 | 1236 | } |
@@ -1242,15 +1270,21 @@ discard block |
||
1242 | 1270 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1243 | 1271 | $i = 0; |
1244 | 1272 | foreach ( $this->_page_config as $slug => $config ) { |
1245 | - if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) |
|
1246 | - continue; //no nav tab for this config |
|
1273 | + if ( !is_array( $config ) || ( is_array($config) && (isset($config['nav']) && !$config['nav'] ) || !isset($config['nav'] ) ) ) { |
|
1274 | + continue; |
|
1275 | + } |
|
1276 | + //no nav tab for this config |
|
1247 | 1277 | |
1248 | 1278 | //check for persistent flag |
1249 | - if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) |
|
1250 | - continue; //nav tab is only to appear when route requested. |
|
1279 | + if ( isset( $config['nav']['persistent']) && !$config['nav']['persistent'] && $slug !== $this->_req_action ) { |
|
1280 | + continue; |
|
1281 | + } |
|
1282 | + //nav tab is only to appear when route requested. |
|
1251 | 1283 | |
1252 | - if ( ! $this->check_user_access( $slug, TRUE ) ) |
|
1253 | - continue; //no nav tab becasue current user does not have access. |
|
1284 | + if ( ! $this->check_user_access( $slug, TRUE ) ) { |
|
1285 | + continue; |
|
1286 | + } |
|
1287 | + //no nav tab becasue current user does not have access. |
|
1254 | 1288 | |
1255 | 1289 | $css_class = isset( $config['css_class'] ) ? $config['css_class'] . ' ' : ''; |
1256 | 1290 | $this->_nav_tabs[$slug] = array( |
@@ -1486,10 +1520,11 @@ discard block |
||
1486 | 1520 | $content .= EEH_Template::display_template( $template_path, $template_args, TRUE ); |
1487 | 1521 | } |
1488 | 1522 | |
1489 | - if ( $display ) |
|
1490 | - echo $content; |
|
1491 | - else |
|
1492 | - return $content; |
|
1523 | + if ( $display ) { |
|
1524 | + echo $content; |
|
1525 | + } else { |
|
1526 | + return $content; |
|
1527 | + } |
|
1493 | 1528 | } |
1494 | 1529 | |
1495 | 1530 | |
@@ -1506,8 +1541,9 @@ discard block |
||
1506 | 1541 | $method_name = '_help_popup_content_' . $this->_req_action; |
1507 | 1542 | |
1508 | 1543 | //if method doesn't exist let's get out. |
1509 | - if ( !method_exists( $this, $method_name ) ) |
|
1510 | - return array(); |
|
1544 | + if ( !method_exists( $this, $method_name ) ) { |
|
1545 | + return array(); |
|
1546 | + } |
|
1511 | 1547 | |
1512 | 1548 | //k we're good to go let's retrieve the help array |
1513 | 1549 | $help_array = call_user_func( array( $this, $method_name ) ); |
@@ -1538,7 +1574,9 @@ discard block |
||
1538 | 1574 | */ |
1539 | 1575 | protected function _set_help_trigger( $trigger_id, $display = TRUE, $dimensions = array( '400', '640') ) { |
1540 | 1576 | |
1541 | - if ( defined('DOING_AJAX') ) return; |
|
1577 | + if ( defined('DOING_AJAX') ) { |
|
1578 | + return; |
|
1579 | + } |
|
1542 | 1580 | |
1543 | 1581 | //let's check and see if there is any content set for this popup. If there isn't then we'll include a default title and content so that developers know something needs to be corrected |
1544 | 1582 | $help_array = $this->_get_help_content(); |
@@ -1556,10 +1594,11 @@ discard block |
||
1556 | 1594 | $content = '<a class="ee-dialog" href="?height='. $dimensions[0] . '&width=' . $dimensions[1] . '&inlineId=' . $trigger_id . '" target="_blank"><span class="question ee-help-popup-question"></span></a>'; |
1557 | 1595 | $content = $content . $help_content; |
1558 | 1596 | |
1559 | - if ( $display ) |
|
1560 | - echo $content; |
|
1561 | - else |
|
1562 | - return $content; |
|
1597 | + if ( $display ) { |
|
1598 | + echo $content; |
|
1599 | + } else { |
|
1600 | + return $content; |
|
1601 | + } |
|
1563 | 1602 | } |
1564 | 1603 | |
1565 | 1604 | |
@@ -1785,8 +1824,10 @@ discard block |
||
1785 | 1824 | protected function _set_list_table() { |
1786 | 1825 | |
1787 | 1826 | //first is this a list_table view? |
1788 | - if ( !isset($this->_route_config['list_table']) ) |
|
1789 | - return; //not a list_table view so get out. |
|
1827 | + if ( !isset($this->_route_config['list_table']) ) { |
|
1828 | + return; |
|
1829 | + } |
|
1830 | + //not a list_table view so get out. |
|
1790 | 1831 | |
1791 | 1832 | //list table functions are per view specific (because some admin pages might have more than one listtable!) |
1792 | 1833 | |
@@ -2152,8 +2193,9 @@ discard block |
||
2152 | 2193 | protected function _espresso_sponsors_post_box() { |
2153 | 2194 | |
2154 | 2195 | $show_sponsors = apply_filters( 'FHEE_show_sponsors_meta_box', TRUE ); |
2155 | - if ( $show_sponsors ) |
|
2156 | - add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2196 | + if ( $show_sponsors ) { |
|
2197 | + add_meta_box('espresso_sponsors_post_box', __('Event Espresso Highlights', 'event_espresso'), array( $this, 'espresso_sponsors_post_box'), $this->_wp_page_slug, 'side'); |
|
2198 | + } |
|
2157 | 2199 | } |
2158 | 2200 | |
2159 | 2201 | |
@@ -2599,10 +2641,11 @@ discard block |
||
2599 | 2641 | true |
2600 | 2642 | ); |
2601 | 2643 | // the final template wrapper |
2602 | - if ( $sidebar ) |
|
2603 | - $this->display_admin_page_with_sidebar(); |
|
2604 | - else |
|
2605 | - $this->display_admin_page_with_no_sidebar(); |
|
2644 | + if ( $sidebar ) { |
|
2645 | + $this->display_admin_page_with_sidebar(); |
|
2646 | + } else { |
|
2647 | + $this->display_admin_page_with_no_sidebar(); |
|
2648 | + } |
|
2606 | 2649 | } |
2607 | 2650 | |
2608 | 2651 | |
@@ -2670,8 +2713,9 @@ discard block |
||
2670 | 2713 | |
2671 | 2714 | |
2672 | 2715 | // make sure there are no php errors or headers_sent. Then we can set correct json header. |
2673 | - if ( NULL === error_get_last() || ! headers_sent() ) |
|
2674 | - header('Content-Type: application/json; charset=UTF-8'); |
|
2716 | + if ( NULL === error_get_last() || ! headers_sent() ) { |
|
2717 | + header('Content-Type: application/json; charset=UTF-8'); |
|
2718 | + } |
|
2675 | 2719 | if( function_exists( 'wp_json_encode' ) ) { |
2676 | 2720 | echo wp_json_encode( $json ); |
2677 | 2721 | } else { |
@@ -2689,10 +2733,9 @@ discard block |
||
2689 | 2733 | * @throws EE_Error |
2690 | 2734 | */ |
2691 | 2735 | public function return_json() { |
2692 | - if ( defined('DOING_AJAX') && DOING_AJAX ) |
|
2693 | - $this->_return_json(); |
|
2694 | - |
|
2695 | - else { |
|
2736 | + if ( defined('DOING_AJAX') && DOING_AJAX ) { |
|
2737 | + $this->_return_json(); |
|
2738 | + } else { |
|
2696 | 2739 | throw new EE_Error( sprintf( __('The public %s method can only be called when DOING_AJAX = TRUE', 'event_espresso'), __FUNCTION__ ) ); |
2697 | 2740 | } |
2698 | 2741 | } |
@@ -2834,7 +2877,9 @@ discard block |
||
2834 | 2877 | $id = $this->_current_view . '_' . $ref; |
2835 | 2878 | $name = !empty($actions) ? $actions[$key] : $ref; |
2836 | 2879 | $this->_template_args['save_buttons'] .= '<input type="submit" class="button-primary ' . $ref . '" value="' . $button . '" name="' . $name . '" id="' . $id . '" />'; |
2837 | - if ( !$both ) break; |
|
2880 | + if ( !$both ) { |
|
2881 | + break; |
|
2882 | + } |
|
2838 | 2883 | } |
2839 | 2884 | |
2840 | 2885 | } |
@@ -3190,13 +3235,15 @@ discard block |
||
3190 | 3235 | if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) { |
3191 | 3236 | check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
3192 | 3237 | |
3193 | - if ( !$user = wp_get_current_user() ) |
|
3194 | - return; |
|
3238 | + if ( !$user = wp_get_current_user() ) { |
|
3239 | + return; |
|
3240 | + } |
|
3195 | 3241 | $option = $_POST['wp_screen_options']['option']; |
3196 | 3242 | $value = $_POST['wp_screen_options']['value']; |
3197 | 3243 | |
3198 | - if ( $option != sanitize_key( $option ) ) |
|
3199 | - return; |
|
3244 | + if ( $option != sanitize_key( $option ) ) { |
|
3245 | + return; |
|
3246 | + } |
|
3200 | 3247 | |
3201 | 3248 | $map_option = $option; |
3202 | 3249 | |
@@ -3205,13 +3252,15 @@ discard block |
||
3205 | 3252 | switch ( $map_option ) { |
3206 | 3253 | case $this->_current_page . '_' . $this->_current_view . '_per_page': |
3207 | 3254 | $value = (int) $value; |
3208 | - if ( $value < 1 || $value > 999 ) |
|
3209 | - return; |
|
3255 | + if ( $value < 1 || $value > 999 ) { |
|
3256 | + return; |
|
3257 | + } |
|
3210 | 3258 | break; |
3211 | 3259 | default: |
3212 | 3260 | $value = apply_filters( 'FHEE__EE_Admin_Page___set_per_page_screen_options__value', false, $option, $value ); |
3213 | - if ( false === $value ) |
|
3214 | - return; |
|
3261 | + if ( false === $value ) { |
|
3262 | + return; |
|
3263 | + } |
|
3215 | 3264 | break; |
3216 | 3265 | } |
3217 | 3266 | |
@@ -3247,8 +3296,9 @@ discard block |
||
3247 | 3296 | protected function _add_transient( $route, $data, $notices = FALSE, $skip_route_verify = FALSE ) { |
3248 | 3297 | $user_id = get_current_user_id(); |
3249 | 3298 | |
3250 | - if ( !$skip_route_verify ) |
|
3251 | - $this->_verify_route($route); |
|
3299 | + if ( !$skip_route_verify ) { |
|
3300 | + $this->_verify_route($route); |
|
3301 | + } |
|
3252 | 3302 | |
3253 | 3303 | |
3254 | 3304 | //now let's set the string for what kind of transient we're setting |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,103 +67,103 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.14.rc.009' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.14.rc.009'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
80 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
80 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
81 | 81 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
82 | - if ( ! defined( 'DS' ) ) { |
|
83 | - define( 'DS', '/' ); |
|
82 | + if ( ! defined('DS')) { |
|
83 | + define('DS', '/'); |
|
84 | 84 | } |
85 | - if ( ! defined( 'PS' ) ) { |
|
86 | - define( 'PS', PATH_SEPARATOR ); |
|
85 | + if ( ! defined('PS')) { |
|
86 | + define('PS', PATH_SEPARATOR); |
|
87 | 87 | } |
88 | - if ( ! defined( 'SP' ) ) { |
|
89 | - define( 'SP', ' ' ); |
|
88 | + if ( ! defined('SP')) { |
|
89 | + define('SP', ' '); |
|
90 | 90 | } |
91 | - if ( ! defined( 'EENL' ) ) { |
|
92 | - define( 'EENL', "\n" ); |
|
91 | + if ( ! defined('EENL')) { |
|
92 | + define('EENL', "\n"); |
|
93 | 93 | } |
94 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
94 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
95 | 95 | // define the plugin directory and URL |
96 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
98 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
99 | 99 | // main root folder paths |
100 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
101 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
102 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
103 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
104 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
105 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
106 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
107 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
100 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
101 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
102 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
103 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
104 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
105 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
106 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
107 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
108 | 108 | // core system paths |
109 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
110 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
111 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
112 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
113 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
114 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
115 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
116 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
117 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
118 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
119 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
120 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
109 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
110 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
111 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
112 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
113 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
114 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
115 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
116 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
117 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
118 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
119 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
120 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
121 | 121 | // gateways |
122 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
123 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
122 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
123 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
124 | 124 | // asset URL paths |
125 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
126 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
127 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
128 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
129 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
130 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
125 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
126 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
127 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
128 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
129 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
130 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
131 | 131 | // define upload paths |
132 | 132 | $uploads = wp_upload_dir(); |
133 | 133 | // define the uploads directory and URL |
134 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
135 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
135 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
136 | 136 | // define the templates directory and URL |
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
138 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
138 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
139 | 139 | // define the gateway directory and URL |
140 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
141 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
142 | 142 | // languages folder/path |
143 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
144 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
143 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
144 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
145 | 145 | //check for dompdf fonts in uploads |
146 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
147 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
146 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
147 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
148 | 148 | } |
149 | 149 | //ajax constants |
150 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
151 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
150 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
151 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
152 | 152 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
153 | 153 | //you're better to use this than its straight value (currently -1) in case you ever |
154 | 154 | //want to change its default value! or find when -1 means infinity |
155 | - define( 'EE_INF_IN_DB', -1 ); |
|
156 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
157 | - define( 'EE_DEBUG', false ); |
|
155 | + define('EE_INF_IN_DB', -1); |
|
156 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
157 | + define('EE_DEBUG', false); |
|
158 | 158 | |
159 | 159 | /** |
160 | 160 | * espresso_plugin_activation |
161 | 161 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
162 | 162 | */ |
163 | 163 | function espresso_plugin_activation() { |
164 | - update_option( 'ee_espresso_activation', true ); |
|
164 | + update_option('ee_espresso_activation', true); |
|
165 | 165 | } |
166 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
166 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
167 | 167 | |
168 | 168 | |
169 | 169 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // } |
178 | 178 | // |
179 | 179 | } |
180 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
180 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
181 | 181 | |
182 | 182 | |
183 | 183 | |
@@ -187,15 +187,15 @@ discard block |
||
187 | 187 | */ |
188 | 188 | function espresso_load_error_handling() { |
189 | 189 | // load debugging tools |
190 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
191 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
190 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
191 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
192 | 192 | EEH_Debug_Tools::instance(); |
193 | 193 | } |
194 | 194 | // load error handling |
195 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
196 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
195 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
196 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
197 | 197 | } else { |
198 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
198 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -209,25 +209,25 @@ discard block |
||
209 | 209 | * @param string $full_path_to_file |
210 | 210 | * @throws EE_Error |
211 | 211 | */ |
212 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
212 | + function espresso_load_required($classname, $full_path_to_file) { |
|
213 | 213 | static $error_handling_loaded = false; |
214 | - if ( ! $error_handling_loaded ) { |
|
214 | + if ( ! $error_handling_loaded) { |
|
215 | 215 | espresso_load_error_handling(); |
216 | 216 | $error_handling_loaded = true; |
217 | 217 | } |
218 | - if ( is_readable( $full_path_to_file ) ) { |
|
219 | - require_once( $full_path_to_file ); |
|
218 | + if (is_readable($full_path_to_file)) { |
|
219 | + require_once($full_path_to_file); |
|
220 | 220 | } else { |
221 | - throw new EE_Error ( sprintf( |
|
222 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
221 | + throw new EE_Error(sprintf( |
|
222 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
223 | 223 | $classname |
224 | - ) ); |
|
224 | + )); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
229 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
230 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
228 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
229 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
230 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
231 | 231 | new EE_Bootstrap(); |
232 | 232 | |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | |
238 | 238 | |
239 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
239 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
240 | 240 | /** |
241 | 241 | * deactivate_plugin |
242 | 242 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
246 | 246 | * @return void |
247 | 247 | */ |
248 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
249 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
250 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
248 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
249 | + if ( ! function_exists('deactivate_plugins')) { |
|
250 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
251 | 251 | } |
252 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
253 | - deactivate_plugins( $plugin_basename ); |
|
252 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
253 | + deactivate_plugins($plugin_basename); |
|
254 | 254 | } |
255 | 255 | } |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | |
54 | 54 | /** |
55 | - * @return Collection|null |
|
55 | + * @return \EventEspresso\core\services\collections\CollectionInterface |
|
56 | 56 | * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
57 | 57 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
58 | 58 | * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
@@ -22,109 +22,109 @@ |
||
22 | 22 | class ActionItemManager |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * @var Collection $action_items |
|
27 | - */ |
|
28 | - private $action_items; |
|
29 | - |
|
30 | - /** |
|
31 | - * @type CapabilitiesChecker $capabilities_checker |
|
32 | - */ |
|
33 | - private $capabilities_checker; |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * CapChecker constructor |
|
39 | - * |
|
40 | - * @param CapabilitiesChecker $capabilities_checker |
|
41 | - */ |
|
42 | - public function __construct( CapabilitiesChecker $capabilities_checker ) |
|
43 | - { |
|
44 | - $this->capabilities_checker = $capabilities_checker; |
|
45 | - add_action( |
|
46 | - 'admin_notices', |
|
47 | - // 'in_admin_header', |
|
48 | - array( $this,'processConditionChecks' ) |
|
49 | - ); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @return Collection|null |
|
56 | - * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
57 | - * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
58 | - * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
|
59 | - * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
60 | - * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
61 | - * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
62 | - */ |
|
63 | - protected function loadActionItemCollection() |
|
64 | - { |
|
65 | - if ( ! $this->action_items instanceof Collection ) { |
|
66 | - $loader = new CollectionLoader( |
|
67 | - new CollectionDetails( |
|
68 | - // collection name |
|
69 | - 'action_items', |
|
70 | - // collection interface |
|
71 | - '\EventEspresso\core\services\action_items\ActionItemInterface', |
|
72 | - // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
73 | - array('EventEspresso\core\domain\services\action_items'), |
|
74 | - // filepaths to classes to add |
|
75 | - array(), |
|
76 | - // filemask to use if parsing folder for files to add |
|
77 | - '', |
|
78 | - // what to use as identifier for collection entities |
|
79 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
80 | - CollectionDetails::ID_CLASS_NAME |
|
81 | - ) |
|
82 | - ); |
|
83 | - $this->action_items = $loader->getCollection(); |
|
84 | - } |
|
85 | - return $this->action_items; |
|
86 | - } |
|
87 | - |
|
88 | - |
|
89 | - |
|
90 | - public function setConditionCheckHooks() |
|
91 | - { |
|
92 | - foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
93 | - /** @var ActionItemInterface $action_item */ |
|
94 | - if ( $action_item instanceof RequiresCapCheckInterface ) { |
|
95 | - $this->capabilities_checker->processCapCheck( |
|
96 | - $action_item->getCapCheck() |
|
97 | - ); |
|
98 | - } |
|
99 | - $action_item->setConditionCheckHooks(); |
|
100 | - } |
|
101 | - } |
|
102 | - |
|
103 | - |
|
104 | - |
|
105 | - public function processConditionChecks() |
|
106 | - { |
|
107 | - foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
108 | - /** @var ActionItemInterface $action_item */ |
|
109 | - if ( ! $action_item->conditionPassed() ) { |
|
110 | - continue; |
|
111 | - } |
|
112 | - $notice = \EEH_HTML::div( |
|
113 | - \EEH_HTML::link( |
|
114 | - $action_item->getActionItemUrl(), |
|
115 | - $action_item->getActionItemButtonText(), |
|
116 | - '', '', 'button button-primary', 'float:right; margin:.25em 0 .25em 2em;' |
|
117 | - ) . |
|
118 | - \EEH_HTML::p( |
|
119 | - $action_item->getActionItemNotice() |
|
120 | - ), |
|
121 | - 'message', |
|
122 | - 'ee-action-item-notice-dv updated notice', |
|
123 | - 'border-left-color:gold;' |
|
124 | - ); |
|
125 | - echo $notice; |
|
126 | - } |
|
127 | - } |
|
25 | + /** |
|
26 | + * @var Collection $action_items |
|
27 | + */ |
|
28 | + private $action_items; |
|
29 | + |
|
30 | + /** |
|
31 | + * @type CapabilitiesChecker $capabilities_checker |
|
32 | + */ |
|
33 | + private $capabilities_checker; |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * CapChecker constructor |
|
39 | + * |
|
40 | + * @param CapabilitiesChecker $capabilities_checker |
|
41 | + */ |
|
42 | + public function __construct( CapabilitiesChecker $capabilities_checker ) |
|
43 | + { |
|
44 | + $this->capabilities_checker = $capabilities_checker; |
|
45 | + add_action( |
|
46 | + 'admin_notices', |
|
47 | + // 'in_admin_header', |
|
48 | + array( $this,'processConditionChecks' ) |
|
49 | + ); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @return Collection|null |
|
56 | + * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
|
57 | + * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
|
58 | + * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
|
59 | + * @throws \EventEspresso\core\exceptions\InvalidEntityException |
|
60 | + * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
|
61 | + * @throws \EventEspresso\core\exceptions\InvalidClassException |
|
62 | + */ |
|
63 | + protected function loadActionItemCollection() |
|
64 | + { |
|
65 | + if ( ! $this->action_items instanceof Collection ) { |
|
66 | + $loader = new CollectionLoader( |
|
67 | + new CollectionDetails( |
|
68 | + // collection name |
|
69 | + 'action_items', |
|
70 | + // collection interface |
|
71 | + '\EventEspresso\core\services\action_items\ActionItemInterface', |
|
72 | + // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
73 | + array('EventEspresso\core\domain\services\action_items'), |
|
74 | + // filepaths to classes to add |
|
75 | + array(), |
|
76 | + // filemask to use if parsing folder for files to add |
|
77 | + '', |
|
78 | + // what to use as identifier for collection entities |
|
79 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
80 | + CollectionDetails::ID_CLASS_NAME |
|
81 | + ) |
|
82 | + ); |
|
83 | + $this->action_items = $loader->getCollection(); |
|
84 | + } |
|
85 | + return $this->action_items; |
|
86 | + } |
|
87 | + |
|
88 | + |
|
89 | + |
|
90 | + public function setConditionCheckHooks() |
|
91 | + { |
|
92 | + foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
93 | + /** @var ActionItemInterface $action_item */ |
|
94 | + if ( $action_item instanceof RequiresCapCheckInterface ) { |
|
95 | + $this->capabilities_checker->processCapCheck( |
|
96 | + $action_item->getCapCheck() |
|
97 | + ); |
|
98 | + } |
|
99 | + $action_item->setConditionCheckHooks(); |
|
100 | + } |
|
101 | + } |
|
102 | + |
|
103 | + |
|
104 | + |
|
105 | + public function processConditionChecks() |
|
106 | + { |
|
107 | + foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
108 | + /** @var ActionItemInterface $action_item */ |
|
109 | + if ( ! $action_item->conditionPassed() ) { |
|
110 | + continue; |
|
111 | + } |
|
112 | + $notice = \EEH_HTML::div( |
|
113 | + \EEH_HTML::link( |
|
114 | + $action_item->getActionItemUrl(), |
|
115 | + $action_item->getActionItemButtonText(), |
|
116 | + '', '', 'button button-primary', 'float:right; margin:.25em 0 .25em 2em;' |
|
117 | + ) . |
|
118 | + \EEH_HTML::p( |
|
119 | + $action_item->getActionItemNotice() |
|
120 | + ), |
|
121 | + 'message', |
|
122 | + 'ee-action-item-notice-dv updated notice', |
|
123 | + 'border-left-color:gold;' |
|
124 | + ); |
|
125 | + echo $notice; |
|
126 | + } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | // End of file ActionItemManager.php |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use EventEspresso\core\services\collections\CollectionDetails; |
8 | 8 | use EventEspresso\core\services\collections\CollectionLoader; |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | |
13 | 13 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param CapabilitiesChecker $capabilities_checker |
41 | 41 | */ |
42 | - public function __construct( CapabilitiesChecker $capabilities_checker ) |
|
42 | + public function __construct(CapabilitiesChecker $capabilities_checker) |
|
43 | 43 | { |
44 | 44 | $this->capabilities_checker = $capabilities_checker; |
45 | 45 | add_action( |
46 | 46 | 'admin_notices', |
47 | 47 | // 'in_admin_header', |
48 | - array( $this,'processConditionChecks' ) |
|
48 | + array($this, 'processConditionChecks') |
|
49 | 49 | ); |
50 | 50 | } |
51 | 51 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function loadActionItemCollection() |
64 | 64 | { |
65 | - if ( ! $this->action_items instanceof Collection ) { |
|
65 | + if ( ! $this->action_items instanceof Collection) { |
|
66 | 66 | $loader = new CollectionLoader( |
67 | 67 | new CollectionDetails( |
68 | 68 | // collection name |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | |
90 | 90 | public function setConditionCheckHooks() |
91 | 91 | { |
92 | - foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
92 | + foreach ($this->loadActionItemCollection() as $action_item) { |
|
93 | 93 | /** @var ActionItemInterface $action_item */ |
94 | - if ( $action_item instanceof RequiresCapCheckInterface ) { |
|
94 | + if ($action_item instanceof RequiresCapCheckInterface) { |
|
95 | 95 | $this->capabilities_checker->processCapCheck( |
96 | 96 | $action_item->getCapCheck() |
97 | 97 | ); |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | |
105 | 105 | public function processConditionChecks() |
106 | 106 | { |
107 | - foreach ( $this->loadActionItemCollection() as $action_item ) { |
|
107 | + foreach ($this->loadActionItemCollection() as $action_item) { |
|
108 | 108 | /** @var ActionItemInterface $action_item */ |
109 | - if ( ! $action_item->conditionPassed() ) { |
|
109 | + if ( ! $action_item->conditionPassed()) { |
|
110 | 110 | continue; |
111 | 111 | } |
112 | 112 | $notice = \EEH_HTML::div( |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $action_item->getActionItemUrl(), |
115 | 115 | $action_item->getActionItemButtonText(), |
116 | 116 | '', '', 'button button-primary', 'float:right; margin:.25em 0 .25em 2em;' |
117 | - ) . |
|
117 | + ). |
|
118 | 118 | \EEH_HTML::p( |
119 | 119 | $action_item->getActionItemNotice() |
120 | 120 | ), |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | |
107 | 107 | /** |
108 | 108 | * grab url requests and route them |
109 | - * @access private |
|
110 | - * @return void |
|
111 | - */ |
|
109 | + * @access private |
|
110 | + * @return void |
|
111 | + */ |
|
112 | 112 | public function _set_page_routes() { |
113 | 113 | |
114 | 114 | $this->_set_transaction_status_array(); |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * _set_transaction_status_array |
265 | 265 | * sets list of transaction statuses |
266 | - * |
|
266 | + * |
|
267 | 267 | * @access private |
268 | - * @return void |
|
269 | - */ |
|
268 | + * @return void |
|
269 | + */ |
|
270 | 270 | private function _set_transaction_status_array() { |
271 | 271 | self::$_txn_status = EEM_Transaction::instance()->status_array(TRUE); |
272 | 272 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | |
289 | 289 | /** |
290 | 290 | * get list of payment statuses |
291 | - * |
|
291 | + * |
|
292 | 292 | * @access private |
293 | - * @return void |
|
294 | - */ |
|
293 | + * @return void |
|
294 | + */ |
|
295 | 295 | private function _get_payment_status_array() { |
296 | 296 | self::$_pay_status = EEM_Payment::instance()->status_array(TRUE); |
297 | 297 | $this->_template_args['payment_status'] = self::$_pay_status; |
@@ -399,19 +399,19 @@ discard block |
||
399 | 399 | if ( is_object( $this->_transaction) ) |
400 | 400 | return; //get out we've already set the object |
401 | 401 | |
402 | - $TXN = EEM_Transaction::instance(); |
|
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 | - //get transaction object |
|
407 | - $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
408 | - $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
406 | + //get transaction object |
|
407 | + $this->_transaction = $TXN->get_one_by_ID($TXN_ID); |
|
408 | + $this->_session = !empty( $this->_transaction ) ? $this->_transaction->get('TXN_session_data') : NULL; |
|
409 | 409 | $this->_transaction->verify_abandoned_transaction_status(); |
410 | 410 | |
411 | 411 | if ( empty( $this->_transaction ) ) { |
412 | - $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 | + $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'); |
|
413 | 413 | EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
414 | - } |
|
414 | + } |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | |
527 | 527 | |
528 | 528 | /** |
529 | - * _transaction_details |
|
529 | + * _transaction_details |
|
530 | 530 | * generates HTML for the View Transaction Details Admin page |
531 | - * |
|
531 | + * |
|
532 | 532 | * @access protected |
533 | - * @return void |
|
534 | - */ |
|
533 | + * @return void |
|
534 | + */ |
|
535 | 535 | protected function _transaction_details() { |
536 | 536 | do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
537 | 537 | |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | 'button secondary-button right', |
583 | 583 | 'dashicons dashicons-email-alt' |
584 | 584 | ) |
585 | - : ''; |
|
585 | + : ''; |
|
586 | 586 | } else { |
587 | 587 | $this->_template_args['send_payment_reminder_button'] = ''; |
588 | 588 | } |
@@ -736,10 +736,10 @@ discard block |
||
736 | 736 | /** |
737 | 737 | * txn_details_meta_box |
738 | 738 | * generates HTML for the Transaction main meta box |
739 | - * |
|
739 | + * |
|
740 | 740 | * @access public |
741 | - * @return void |
|
742 | - */ |
|
741 | + * @return void |
|
742 | + */ |
|
743 | 743 | public function txn_details_meta_box() { |
744 | 744 | |
745 | 745 | $this->_set_transaction_object(); |
@@ -1115,10 +1115,10 @@ discard block |
||
1115 | 1115 | /** |
1116 | 1116 | * txn_billing_info_side_meta_box |
1117 | 1117 | * generates HTML for the Edit Transaction side meta box |
1118 | - * |
|
1118 | + * |
|
1119 | 1119 | * @access public |
1120 | - * @return void |
|
1121 | - */ |
|
1120 | + * @return void |
|
1121 | + */ |
|
1122 | 1122 | public function txn_billing_info_side_meta_box() { |
1123 | 1123 | |
1124 | 1124 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
@@ -1136,10 +1136,10 @@ discard block |
||
1136 | 1136 | /** |
1137 | 1137 | * apply_payments_or_refunds |
1138 | 1138 | * registers a payment or refund made towards a transaction |
1139 | - * |
|
1139 | + * |
|
1140 | 1140 | * @access public |
1141 | - * @return void |
|
1142 | - */ |
|
1141 | + * @return void |
|
1142 | + */ |
|
1143 | 1143 | public function apply_payments_or_refunds() { |
1144 | 1144 | $json_response_data = array( 'return_data' => FALSE ); |
1145 | 1145 | $valid_data = $this->_validate_payment_request_data(); |
@@ -1293,9 +1293,9 @@ discard block |
||
1293 | 1293 | 'default' => '', |
1294 | 1294 | 'required' => false, |
1295 | 1295 | 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
1296 | - 'validation_strategies' => array( |
|
1297 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1298 | - ) |
|
1296 | + 'validation_strategies' => array( |
|
1297 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1298 | + ) |
|
1299 | 1299 | ) |
1300 | 1300 | ), |
1301 | 1301 | 'po_number' => new EE_Text_Input( |
@@ -1303,9 +1303,9 @@ discard block |
||
1303 | 1303 | 'default' => '', |
1304 | 1304 | 'required' => false, |
1305 | 1305 | 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
1306 | - 'validation_strategies' => array( |
|
1307 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1308 | - ) |
|
1306 | + 'validation_strategies' => array( |
|
1307 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1308 | + ) |
|
1309 | 1309 | ) |
1310 | 1310 | ), |
1311 | 1311 | 'accounting' => new EE_Text_Input( |
@@ -1313,9 +1313,9 @@ discard block |
||
1313 | 1313 | 'default' => '', |
1314 | 1314 | 'required' => false, |
1315 | 1315 | 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
1316 | - 'validation_strategies' => array( |
|
1317 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1318 | - ) |
|
1316 | + 'validation_strategies' => array( |
|
1317 | + new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1318 | + ) |
|
1319 | 1319 | ) |
1320 | 1320 | ), |
1321 | 1321 | ) |
@@ -1610,10 +1610,10 @@ discard block |
||
1610 | 1610 | /** |
1611 | 1611 | * delete_payment |
1612 | 1612 | * delete a payment or refund made towards a transaction |
1613 | - * |
|
1613 | + * |
|
1614 | 1614 | * @access public |
1615 | - * @return void |
|
1616 | - */ |
|
1615 | + * @return void |
|
1616 | + */ |
|
1617 | 1617 | public function delete_payment() { |
1618 | 1618 | $json_response_data = array( 'return_data' => FALSE ); |
1619 | 1619 | $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; |
@@ -1730,12 +1730,12 @@ discard block |
||
1730 | 1730 | /** |
1731 | 1731 | * _send_payment_reminder |
1732 | 1732 | * generates HTML for the View Transaction Details Admin page |
1733 | - * |
|
1733 | + * |
|
1734 | 1734 | * @access protected |
1735 | - * @return void |
|
1736 | - */ |
|
1735 | + * @return void |
|
1736 | + */ |
|
1737 | 1737 | protected function _send_payment_reminder() { |
1738 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1738 | + $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1739 | 1739 | $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
1740 | 1740 | $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
1741 | 1741 | do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
@@ -1757,29 +1757,29 @@ discard block |
||
1757 | 1757 | |
1758 | 1758 | $TXN = EEM_Transaction::instance(); |
1759 | 1759 | |
1760 | - $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' )); |
|
1761 | - $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' ); |
|
1760 | + $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' )); |
|
1761 | + $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' ); |
|
1762 | 1762 | |
1763 | - //make sure our timestamps start and end right at the boundaries for each day |
|
1764 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1765 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1763 | + //make sure our timestamps start and end right at the boundaries for each day |
|
1764 | + $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1765 | + $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1766 | 1766 | |
1767 | 1767 | |
1768 | - //convert to timestamps |
|
1769 | - $start_date = strtotime( $start_date ); |
|
1770 | - $end_date = strtotime( $end_date ); |
|
1768 | + //convert to timestamps |
|
1769 | + $start_date = strtotime( $start_date ); |
|
1770 | + $end_date = strtotime( $end_date ); |
|
1771 | 1771 | |
1772 | - //makes sure start date is the lowest value and vice versa |
|
1773 | - $start_date = min( $start_date, $end_date ); |
|
1774 | - $end_date = max( $start_date, $end_date ); |
|
1772 | + //makes sure start date is the lowest value and vice versa |
|
1773 | + $start_date = min( $start_date, $end_date ); |
|
1774 | + $end_date = max( $start_date, $end_date ); |
|
1775 | 1775 | |
1776 | - //convert to correct format for query |
|
1776 | + //convert to correct format for query |
|
1777 | 1777 | $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' ); |
1778 | 1778 | $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' ); |
1779 | 1779 | |
1780 | 1780 | |
1781 | 1781 | |
1782 | - //set orderby |
|
1782 | + //set orderby |
|
1783 | 1783 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1784 | 1784 | |
1785 | 1785 | switch ( $this->_req_data['orderby'] ) { |
@@ -1842,17 +1842,17 @@ discard block |
||
1842 | 1842 | |
1843 | 1843 | //failed transactions |
1844 | 1844 | $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) |
1845 | - || ( $count && $view == 'failed' ) |
|
1846 | - ? TRUE |
|
1847 | - : FALSE; |
|
1845 | + || ( $count && $view == 'failed' ) |
|
1846 | + ? TRUE |
|
1847 | + : FALSE; |
|
1848 | 1848 | $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) |
1849 | - || ( $count && $view == 'abandoned' ) |
|
1850 | - ? TRUE |
|
1851 | - : FALSE; |
|
1849 | + || ( $count && $view == 'abandoned' ) |
|
1850 | + ? TRUE |
|
1851 | + : FALSE; |
|
1852 | 1852 | $overpaid = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'overpaid' && ! $count ) |
1853 | - || ( $count && $view == 'overpaid' ) |
|
1854 | - ? TRUE |
|
1855 | - : FALSE; |
|
1853 | + || ( $count && $view == 'overpaid' ) |
|
1854 | + ? TRUE |
|
1855 | + : FALSE; |
|
1856 | 1856 | |
1857 | 1857 | if ( $failed ) { |
1858 | 1858 | $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
@@ -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,21 +396,21 @@ 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 | $this->_transaction->verify_abandoned_transaction_status(); |
410 | 410 | |
411 | - if ( empty( $this->_transaction ) ) { |
|
412 | - $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'); |
|
413 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
411 | + if (empty($this->_transaction)) { |
|
412 | + $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'); |
|
413 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | * @return array |
424 | 424 | */ |
425 | 425 | protected function _transaction_legend_items() { |
426 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
426 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
427 | 427 | $items = array(); |
428 | 428 | |
429 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_global_messages', 'view_filtered_messages' ) ) { |
|
430 | - $related_for_icon = EEH_MSG_Template::get_message_action_icon( 'see_notifications_for' ); |
|
431 | - if ( isset( $related_for_icon['css_class']) && isset( $related_for_icon['label'] ) ) { |
|
429 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_global_messages', 'view_filtered_messages')) { |
|
430 | + $related_for_icon = EEH_MSG_Template::get_message_action_icon('see_notifications_for'); |
|
431 | + if (isset($related_for_icon['css_class']) && isset($related_for_icon['label'])) { |
|
432 | 432 | $items['view_related_messages'] = array( |
433 | 433 | 'class' => $related_for_icon['css_class'], |
434 | 434 | 'desc' => $related_for_icon['label'], |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | |
439 | 439 | $items = apply_filters( |
440 | 440 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__items', |
441 | - array_merge( $items, |
|
441 | + array_merge($items, |
|
442 | 442 | array( |
443 | 443 | 'view_details' => array( |
444 | 444 | 'class' => 'dashicons dashicons-cart', |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | ), |
451 | 451 | 'view_receipt' => array( |
452 | 452 | 'class' => 'dashicons dashicons-media-default', |
453 | - 'desc' => esc_html__('View Transaction Receipt', 'event_espresso' ) |
|
453 | + 'desc' => esc_html__('View Transaction Receipt', 'event_espresso') |
|
454 | 454 | ), |
455 | 455 | 'view_registration' => array( |
456 | 456 | 'class' => 'dashicons dashicons-clipboard', |
@@ -460,8 +460,8 @@ discard block |
||
460 | 460 | ) |
461 | 461 | ); |
462 | 462 | |
463 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'espresso_transactions_send_payment_reminder' ) ) { |
|
464 | - if ( EEH_MSG_Template::is_mt_active( 'payment_reminder' ) ) { |
|
463 | + if (EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'espresso_transactions_send_payment_reminder')) { |
|
464 | + if (EEH_MSG_Template::is_mt_active('payment_reminder')) { |
|
465 | 465 | $items['send_payment_reminder'] = array( |
466 | 466 | 'class' => 'dashicons dashicons-email-alt', |
467 | 467 | 'desc' => esc_html__('Send Payment Reminder', 'event_espresso') |
@@ -482,29 +482,29 @@ discard block |
||
482 | 482 | 'FHEE__Transactions_Admin_Page___transaction_legend_items__more_items', |
483 | 483 | array( |
484 | 484 | 'overpaid' => array( |
485 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::overpaid_status_code, |
|
486 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::overpaid_status_code, FALSE, 'sentence' ) |
|
485 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::overpaid_status_code, |
|
486 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::overpaid_status_code, FALSE, 'sentence') |
|
487 | 487 | ), |
488 | 488 | 'complete' => array( |
489 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::complete_status_code, |
|
490 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::complete_status_code, FALSE, 'sentence' ) |
|
489 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::complete_status_code, |
|
490 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::complete_status_code, FALSE, 'sentence') |
|
491 | 491 | ), |
492 | 492 | 'incomplete' => array( |
493 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::incomplete_status_code, |
|
494 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::incomplete_status_code, FALSE, 'sentence' ) |
|
493 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::incomplete_status_code, |
|
494 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::incomplete_status_code, FALSE, 'sentence') |
|
495 | 495 | ), |
496 | 496 | 'abandoned' => array( |
497 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::abandoned_status_code, |
|
498 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::abandoned_status_code, FALSE, 'sentence' ) |
|
497 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::abandoned_status_code, |
|
498 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::abandoned_status_code, FALSE, 'sentence') |
|
499 | 499 | ), |
500 | 500 | 'failed' => array( |
501 | - 'class' => 'ee-status-legend ee-status-legend-' . EEM_Transaction::failed_status_code, |
|
502 | - 'desc' => EEH_Template::pretty_status( EEM_Transaction::failed_status_code, FALSE, 'sentence' ) |
|
501 | + 'class' => 'ee-status-legend ee-status-legend-'.EEM_Transaction::failed_status_code, |
|
502 | + 'desc' => EEH_Template::pretty_status(EEM_Transaction::failed_status_code, FALSE, 'sentence') |
|
503 | 503 | ) |
504 | 504 | ) |
505 | 505 | ); |
506 | 506 | |
507 | - return array_merge( $items, $more_items); |
|
507 | + return array_merge($items, $more_items); |
|
508 | 508 | } |
509 | 509 | |
510 | 510 | |
@@ -517,9 +517,9 @@ discard block |
||
517 | 517 | */ |
518 | 518 | protected function _transactions_overview_list_table() { |
519 | 519 | $this->_admin_page_title = esc_html__('Transactions', 'event_espresso'); |
520 | - $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID'] ) : NULL; |
|
521 | - $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>' ) : ''; |
|
522 | - $this->_template_args['after_list_table'] = $this->_display_legend( $this->_transaction_legend_items() ); |
|
520 | + $event = isset($this->_req_data['EVT_ID']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['EVT_ID']) : NULL; |
|
521 | + $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>') : ''; |
|
522 | + $this->_template_args['after_list_table'] = $this->_display_legend($this->_transaction_legend_items()); |
|
523 | 523 | $this->display_admin_list_table_page_with_no_sidebar(); |
524 | 524 | } |
525 | 525 | |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | * @return void |
534 | 534 | */ |
535 | 535 | protected function _transaction_details() { |
536 | - do_action( 'AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction ); |
|
536 | + do_action('AHEE__Transactions_Admin_Page__transaction_details__start', $this->_transaction); |
|
537 | 537 | |
538 | 538 | $this->_set_transaction_status_array(); |
539 | 539 | |
@@ -546,14 +546,14 @@ discard block |
||
546 | 546 | $attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : NULL; |
547 | 547 | |
548 | 548 | $this->_template_args['txn_nmbr']['value'] = $this->_transaction->ID(); |
549 | - $this->_template_args['txn_nmbr']['label'] = esc_html__( 'Transaction Number', 'event_espresso' ); |
|
549 | + $this->_template_args['txn_nmbr']['label'] = esc_html__('Transaction Number', 'event_espresso'); |
|
550 | 550 | |
551 | 551 | $this->_template_args['txn_datetime']['value'] = $this->_transaction->get_i18n_datetime('TXN_timestamp'); |
552 | - $this->_template_args['txn_datetime']['label'] = esc_html__( 'Date', 'event_espresso' ); |
|
552 | + $this->_template_args['txn_datetime']['label'] = esc_html__('Date', 'event_espresso'); |
|
553 | 553 | |
554 | - $this->_template_args['txn_status']['value'] = self::$_txn_status[ $this->_transaction->get('STS_ID') ]; |
|
555 | - $this->_template_args['txn_status']['label'] = esc_html__( 'Transaction Status', 'event_espresso' ); |
|
556 | - $this->_template_args['txn_status']['class'] = 'status-' . $this->_transaction->get('STS_ID'); |
|
554 | + $this->_template_args['txn_status']['value'] = self::$_txn_status[$this->_transaction->get('STS_ID')]; |
|
555 | + $this->_template_args['txn_status']['label'] = esc_html__('Transaction Status', 'event_espresso'); |
|
556 | + $this->_template_args['txn_status']['class'] = 'status-'.$this->_transaction->get('STS_ID'); |
|
557 | 557 | |
558 | 558 | $this->_template_args['grand_total'] = $this->_transaction->get('TXN_total'); |
559 | 559 | $this->_template_args['total_paid'] = $this->_transaction->get('TXN_paid'); |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | ) |
567 | 567 | ) { |
568 | 568 | $this->_template_args['send_payment_reminder_button'] = |
569 | - EEH_MSG_Template::is_mt_active( 'payment_reminder' ) |
|
569 | + EEH_MSG_Template::is_mt_active('payment_reminder') |
|
570 | 570 | && $this->_transaction->get('STS_ID') != EEM_Transaction::complete_status_code |
571 | 571 | && $this->_transaction->get('STS_ID') != EEM_Transaction::overpaid_status_code |
572 | 572 | ? EEH_Template::get_button_or_link( |
@@ -588,40 +588,40 @@ discard block |
||
588 | 588 | } |
589 | 589 | |
590 | 590 | $amount_due = $this->_transaction->get('TXN_total') - $this->_transaction->get('TXN_paid'); |
591 | - $this->_template_args['amount_due'] = EEH_Template::format_currency( $amount_due, TRUE ); |
|
592 | - if ( EE_Registry::instance()->CFG->currency->sign_b4 ) { |
|
593 | - $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign . $this->_template_args['amount_due']; |
|
591 | + $this->_template_args['amount_due'] = EEH_Template::format_currency($amount_due, TRUE); |
|
592 | + if (EE_Registry::instance()->CFG->currency->sign_b4) { |
|
593 | + $this->_template_args['amount_due'] = EE_Registry::instance()->CFG->currency->sign.$this->_template_args['amount_due']; |
|
594 | 594 | } else { |
595 | - $this->_template_args['amount_due'] = $this->_template_args['amount_due'] . EE_Registry::instance()->CFG->currency->sign; |
|
595 | + $this->_template_args['amount_due'] = $this->_template_args['amount_due'].EE_Registry::instance()->CFG->currency->sign; |
|
596 | 596 | } |
597 | - $this->_template_args['amount_due_class'] = ''; |
|
597 | + $this->_template_args['amount_due_class'] = ''; |
|
598 | 598 | |
599 | - if ( $this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total') ) { |
|
599 | + if ($this->_transaction->get('TXN_paid') == $this->_transaction->get('TXN_total')) { |
|
600 | 600 | // paid in full |
601 | - $this->_template_args['amount_due'] = FALSE; |
|
602 | - } elseif ( $this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total') ) { |
|
601 | + $this->_template_args['amount_due'] = FALSE; |
|
602 | + } elseif ($this->_transaction->get('TXN_paid') > $this->_transaction->get('TXN_total')) { |
|
603 | 603 | // overpaid |
604 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
605 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') > 0 )) { |
|
604 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
605 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') > 0)) { |
|
606 | 606 | // monies owing |
607 | - $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
608 | - } elseif (( $this->_transaction->get('TXN_total') > 0 ) && ( $this->_transaction->get('TXN_paid') == 0 )) { |
|
607 | + $this->_template_args['amount_due_class'] = 'txn-overview-part-payment-spn'; |
|
608 | + } elseif (($this->_transaction->get('TXN_total') > 0) && ($this->_transaction->get('TXN_paid') == 0)) { |
|
609 | 609 | // no payments made yet |
610 | - $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
611 | - } elseif ( $this->_transaction->get('TXN_total') == 0 ) { |
|
610 | + $this->_template_args['amount_due_class'] = 'txn-overview-no-payment-spn'; |
|
611 | + } elseif ($this->_transaction->get('TXN_total') == 0) { |
|
612 | 612 | // free event |
613 | - $this->_template_args['amount_due'] = FALSE; |
|
613 | + $this->_template_args['amount_due'] = FALSE; |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | $payment_method = $this->_transaction->payment_method(); |
617 | 617 | |
618 | 618 | $this->_template_args['method_of_payment_name'] = $payment_method instanceof EE_Payment_Method |
619 | 619 | ? $payment_method->admin_name() |
620 | - : esc_html__( 'Unknown', 'event_espresso' ); |
|
620 | + : esc_html__('Unknown', 'event_espresso'); |
|
621 | 621 | |
622 | 622 | $this->_template_args['currency_sign'] = EE_Registry::instance()->CFG->currency->sign; |
623 | 623 | // link back to overview |
624 | - $this->_template_args['txn_overview_url'] = ! empty ( $_SERVER['HTTP_REFERER'] ) |
|
624 | + $this->_template_args['txn_overview_url'] = ! empty ($_SERVER['HTTP_REFERER']) |
|
625 | 625 | ? $_SERVER['HTTP_REFERER'] |
626 | 626 | : TXN_ADMIN_URL; |
627 | 627 | |
@@ -629,13 +629,13 @@ discard block |
||
629 | 629 | // next link |
630 | 630 | $next_txn = $this->_transaction->next( |
631 | 631 | null, |
632 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
632 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
633 | 633 | 'TXN_ID' |
634 | 634 | ); |
635 | 635 | $this->_template_args['next_transaction'] = $next_txn |
636 | 636 | ? $this->_next_link( |
637 | 637 | EE_Admin_Page::add_query_args_and_nonce( |
638 | - array( 'action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID'] ), |
|
638 | + array('action' => 'view_transaction', 'TXN_ID' => $next_txn['TXN_ID']), |
|
639 | 639 | TXN_ADMIN_URL |
640 | 640 | ), |
641 | 641 | 'dashicons dashicons-arrow-right ee-icon-size-22' |
@@ -644,13 +644,13 @@ discard block |
||
644 | 644 | // previous link |
645 | 645 | $previous_txn = $this->_transaction->previous( |
646 | 646 | null, |
647 | - array( array( 'STS_ID' => array( '!=', EEM_Transaction::failed_status_code ) ) ), |
|
647 | + array(array('STS_ID' => array('!=', EEM_Transaction::failed_status_code))), |
|
648 | 648 | 'TXN_ID' |
649 | 649 | ); |
650 | 650 | $this->_template_args['previous_transaction'] = $previous_txn |
651 | 651 | ? $this->_previous_link( |
652 | 652 | EE_Admin_Page::add_query_args_and_nonce( |
653 | - array( 'action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID'] ), |
|
653 | + array('action' => 'view_transaction', 'TXN_ID' => $previous_txn['TXN_ID']), |
|
654 | 654 | TXN_ADMIN_URL |
655 | 655 | ), |
656 | 656 | 'dashicons dashicons-arrow-left ee-icon-size-22' |
@@ -660,16 +660,16 @@ discard block |
||
660 | 660 | // were we just redirected here after adding a new registration ??? |
661 | 661 | if ( |
662 | 662 | isset( |
663 | - $this->_req_data[ 'redirect_from' ], |
|
664 | - $this->_req_data[ 'EVT_ID' ], |
|
665 | - $this->_req_data[ 'event_name' ] |
|
663 | + $this->_req_data['redirect_from'], |
|
664 | + $this->_req_data['EVT_ID'], |
|
665 | + $this->_req_data['event_name'] |
|
666 | 666 | ) |
667 | 667 | ) { |
668 | 668 | if ( |
669 | 669 | EE_Registry::instance()->CAP->current_user_can( |
670 | 670 | 'ee_edit_registrations', |
671 | 671 | 'espresso_registrations_new_registration', |
672 | - $this->_req_data[ 'EVT_ID' ] |
|
672 | + $this->_req_data['EVT_ID'] |
|
673 | 673 | ) |
674 | 674 | ) { |
675 | 675 | $this->_admin_page_title .= '<a id="add-new-registration" class="add-new-h2 button-primary" href="'; |
@@ -679,25 +679,25 @@ discard block |
||
679 | 679 | 'action' => 'new_registration', |
680 | 680 | 'return' => 'default', |
681 | 681 | 'TXN_ID' => $this->_transaction->ID(), |
682 | - 'event_id' => $this->_req_data[ 'EVT_ID' ], |
|
682 | + 'event_id' => $this->_req_data['EVT_ID'], |
|
683 | 683 | ), |
684 | 684 | REG_ADMIN_URL |
685 | 685 | ); |
686 | 686 | $this->_admin_page_title .= '">'; |
687 | 687 | |
688 | 688 | $this->_admin_page_title .= sprintf( |
689 | - esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso' ), |
|
690 | - htmlentities( urldecode( $this->_req_data[ 'event_name' ] ), ENT_QUOTES, 'UTF-8' ) |
|
689 | + esc_html__('Add Another New Registration to Event: "%1$s" ?', 'event_espresso'), |
|
690 | + htmlentities(urldecode($this->_req_data['event_name']), ENT_QUOTES, 'UTF-8') |
|
691 | 691 | ); |
692 | 692 | $this->_admin_page_title .= '</a>'; |
693 | 693 | } |
694 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
694 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
695 | 695 | } |
696 | 696 | // grab messages at the last second |
697 | 697 | $this->_template_args['notices'] = EE_Error::get_notices(); |
698 | 698 | // path to template |
699 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_header.template.php'; |
|
700 | - $this->_template_args['admin_page_header'] = EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
699 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_header.template.php'; |
|
700 | + $this->_template_args['admin_page_header'] = EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
701 | 701 | |
702 | 702 | // the details template wrapper |
703 | 703 | $this->display_admin_page_with_sidebar(); |
@@ -716,18 +716,18 @@ discard block |
||
716 | 716 | |
717 | 717 | $this->_set_transaction_object(); |
718 | 718 | |
719 | - 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 | + 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'); |
|
720 | 720 | add_meta_box( |
721 | 721 | 'edit-txn-attendees-mbox', |
722 | - esc_html__( 'Attendees Registered in this Transaction', 'event_espresso' ), |
|
723 | - array( $this, 'txn_attendees_meta_box' ), |
|
722 | + esc_html__('Attendees Registered in this Transaction', 'event_espresso'), |
|
723 | + array($this, 'txn_attendees_meta_box'), |
|
724 | 724 | $this->_wp_page_slug, |
725 | 725 | 'normal', |
726 | 726 | 'high', |
727 | - array( 'TXN_ID' => $this->_transaction->ID() ) |
|
727 | + array('TXN_ID' => $this->_transaction->ID()) |
|
728 | 728 | ); |
729 | - 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' ); |
|
730 | - 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' ); |
|
729 | + 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'); |
|
730 | + 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'); |
|
731 | 731 | |
732 | 732 | } |
733 | 733 | |
@@ -748,15 +748,15 @@ discard block |
||
748 | 748 | |
749 | 749 | //get line table |
750 | 750 | EEH_Autoloader::register_line_item_display_autoloaders(); |
751 | - $Line_Item_Display = new EE_Line_Item_Display( 'admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy' ); |
|
752 | - $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item( $this->_transaction->total_line_item() ); |
|
751 | + $Line_Item_Display = new EE_Line_Item_Display('admin_table', 'EE_Admin_Table_Line_Item_Display_Strategy'); |
|
752 | + $this->_template_args['line_item_table'] = $Line_Item_Display->display_line_item($this->_transaction->total_line_item()); |
|
753 | 753 | $this->_template_args['REG_code'] = $this->_transaction->get_first_related('Registration')->get('REG_code'); |
754 | 754 | |
755 | 755 | // process taxes |
756 | - $taxes = $this->_transaction->get_many_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_tax ))); |
|
757 | - $this->_template_args['taxes'] = ! empty( $taxes ) ? $taxes : FALSE; |
|
756 | + $taxes = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
757 | + $this->_template_args['taxes'] = ! empty($taxes) ? $taxes : FALSE; |
|
758 | 758 | |
759 | - $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE ); |
|
759 | + $this->_template_args['grand_total'] = EEH_Template::format_currency($this->_transaction->get('TXN_total'), FALSE, FALSE); |
|
760 | 760 | $this->_template_args['grand_raw_total'] = $this->_transaction->get('TXN_total'); |
761 | 761 | $this->_template_args['TXN_status'] = $this->_transaction->get('STS_ID'); |
762 | 762 | |
@@ -764,63 +764,63 @@ discard block |
||
764 | 764 | |
765 | 765 | // process payment details |
766 | 766 | $payments = $this->_transaction->get_many_related('Payment'); |
767 | - if( ! empty( $payments ) ) { |
|
768 | - $this->_template_args[ 'payments' ] = $payments; |
|
769 | - $this->_template_args[ 'existing_reg_payments' ] = $this->_get_registration_payment_IDs( $payments ); |
|
767 | + if ( ! empty($payments)) { |
|
768 | + $this->_template_args['payments'] = $payments; |
|
769 | + $this->_template_args['existing_reg_payments'] = $this->_get_registration_payment_IDs($payments); |
|
770 | 770 | } else { |
771 | - $this->_template_args[ 'payments' ] = false; |
|
772 | - $this->_template_args[ 'existing_reg_payments' ] = array(); |
|
771 | + $this->_template_args['payments'] = false; |
|
772 | + $this->_template_args['existing_reg_payments'] = array(); |
|
773 | 773 | } |
774 | 774 | |
775 | - $this->_template_args['edit_payment_url'] = add_query_arg( array( 'action' => 'edit_payment' ), TXN_ADMIN_URL ); |
|
776 | - $this->_template_args['delete_payment_url'] = add_query_arg( array( 'action' => 'espresso_delete_payment' ), TXN_ADMIN_URL ); |
|
775 | + $this->_template_args['edit_payment_url'] = add_query_arg(array('action' => 'edit_payment'), TXN_ADMIN_URL); |
|
776 | + $this->_template_args['delete_payment_url'] = add_query_arg(array('action' => 'espresso_delete_payment'), TXN_ADMIN_URL); |
|
777 | 777 | |
778 | - if ( isset( $txn_details['invoice_number'] )) { |
|
778 | + if (isset($txn_details['invoice_number'])) { |
|
779 | 779 | $this->_template_args['txn_details']['invoice_number']['value'] = $this->_template_args['REG_code']; |
780 | - $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__( 'Invoice Number', 'event_espresso' ); |
|
780 | + $this->_template_args['txn_details']['invoice_number']['label'] = esc_html__('Invoice Number', 'event_espresso'); |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | $this->_template_args['txn_details']['registration_session']['value'] = $this->_transaction->get_first_related('Registration')->get('REG_session'); |
784 | - $this->_template_args['txn_details']['registration_session']['label'] = esc_html__( 'Registration Session', 'event_espresso' ); |
|
784 | + $this->_template_args['txn_details']['registration_session']['label'] = esc_html__('Registration Session', 'event_espresso'); |
|
785 | 785 | |
786 | - $this->_template_args['txn_details']['ip_address']['value'] = isset( $this->_session['ip_address'] ) ? $this->_session['ip_address'] : ''; |
|
787 | - $this->_template_args['txn_details']['ip_address']['label'] = esc_html__( 'Transaction placed from IP', 'event_espresso' ); |
|
786 | + $this->_template_args['txn_details']['ip_address']['value'] = isset($this->_session['ip_address']) ? $this->_session['ip_address'] : ''; |
|
787 | + $this->_template_args['txn_details']['ip_address']['label'] = esc_html__('Transaction placed from IP', 'event_espresso'); |
|
788 | 788 | |
789 | - $this->_template_args['txn_details']['user_agent']['value'] = isset( $this->_session['user_agent'] ) ? $this->_session['user_agent'] : ''; |
|
790 | - $this->_template_args['txn_details']['user_agent']['label'] = esc_html__( 'Registrant User Agent', 'event_espresso' ); |
|
789 | + $this->_template_args['txn_details']['user_agent']['value'] = isset($this->_session['user_agent']) ? $this->_session['user_agent'] : ''; |
|
790 | + $this->_template_args['txn_details']['user_agent']['label'] = esc_html__('Registrant User Agent', 'event_espresso'); |
|
791 | 791 | |
792 | 792 | $reg_steps = '<ul>'; |
793 | - foreach ( $this->_transaction->reg_steps() as $reg_step => $reg_step_status ) { |
|
794 | - if ( $reg_step_status === true ) { |
|
795 | - $reg_steps .= '<li style="color:#70cc50">' . sprintf( esc_html__( '%1$s : Completed', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
796 | - } else if ( is_numeric( $reg_step_status ) && $reg_step_status !== false ) { |
|
797 | - $reg_steps .= '<li style="color:#2EA2CC">' . sprintf( |
|
798 | - esc_html__( '%1$s : Initiated %2$s', 'event_espresso' ), |
|
799 | - ucwords( str_replace( '_', ' ', $reg_step ) ), |
|
800 | - gmdate( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), ( $reg_step_status + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) ) |
|
801 | - ) . '</li>'; |
|
793 | + foreach ($this->_transaction->reg_steps() as $reg_step => $reg_step_status) { |
|
794 | + if ($reg_step_status === true) { |
|
795 | + $reg_steps .= '<li style="color:#70cc50">'.sprintf(esc_html__('%1$s : Completed', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
796 | + } else if (is_numeric($reg_step_status) && $reg_step_status !== false) { |
|
797 | + $reg_steps .= '<li style="color:#2EA2CC">'.sprintf( |
|
798 | + esc_html__('%1$s : Initiated %2$s', 'event_espresso'), |
|
799 | + ucwords(str_replace('_', ' ', $reg_step)), |
|
800 | + gmdate(get_option('date_format').' '.get_option('time_format'), ($reg_step_status + (get_option('gmt_offset') * HOUR_IN_SECONDS))) |
|
801 | + ).'</li>'; |
|
802 | 802 | } else { |
803 | - $reg_steps .= '<li style="color:#E76700">' . sprintf( esc_html__( '%1$s : Never Initiated', 'event_espresso' ), ucwords( str_replace( '_', ' ', $reg_step ) ) ) . '</li>'; |
|
803 | + $reg_steps .= '<li style="color:#E76700">'.sprintf(esc_html__('%1$s : Never Initiated', 'event_espresso'), ucwords(str_replace('_', ' ', $reg_step))).'</li>'; |
|
804 | 804 | } |
805 | 805 | } |
806 | 806 | $reg_steps .= '</ul>'; |
807 | 807 | $this->_template_args['txn_details']['reg_steps']['value'] = $reg_steps; |
808 | - $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__( 'Registration Step Progress', 'event_espresso' ); |
|
808 | + $this->_template_args['txn_details']['reg_steps']['label'] = esc_html__('Registration Step Progress', 'event_espresso'); |
|
809 | 809 | |
810 | 810 | |
811 | 811 | $this->_get_registrations_to_apply_payment_to(); |
812 | - $this->_get_payment_methods( $payments ); |
|
812 | + $this->_get_payment_methods($payments); |
|
813 | 813 | $this->_get_payment_status_array(); |
814 | 814 | $this->_get_reg_status_selection(); //sets up the template args for the reg status array for the transaction. |
815 | 815 | |
816 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'transaction' ), TXN_ADMIN_URL ); |
|
817 | - $this->_template_args['apply_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_apply_payment' ), WP_AJAX_URL ); |
|
818 | - $this->_template_args['delete_payment_form_url'] = add_query_arg( array( 'page' => 'espresso_transactions', 'action' => 'espresso_delete_payment' ), WP_AJAX_URL ); |
|
816 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'transaction'), TXN_ADMIN_URL); |
|
817 | + $this->_template_args['apply_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_apply_payment'), WP_AJAX_URL); |
|
818 | + $this->_template_args['delete_payment_form_url'] = add_query_arg(array('page' => 'espresso_transactions', 'action' => 'espresso_delete_payment'), WP_AJAX_URL); |
|
819 | 819 | |
820 | 820 | // 'espresso_delete_payment_nonce' |
821 | 821 | |
822 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
823 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE ); |
|
822 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_txn_details.template.php'; |
|
823 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); |
|
824 | 824 | |
825 | 825 | } |
826 | 826 | |
@@ -835,27 +835,27 @@ discard block |
||
835 | 835 | * @param EE_Payment[] $payments |
836 | 836 | * @return array |
837 | 837 | */ |
838 | - protected function _get_registration_payment_IDs( $payments = array() ) { |
|
838 | + protected function _get_registration_payment_IDs($payments = array()) { |
|
839 | 839 | $existing_reg_payments = array(); |
840 | 840 | // get all reg payments for these payments |
841 | - $reg_payments = EEM_Registration_Payment::instance()->get_all( array( |
|
841 | + $reg_payments = EEM_Registration_Payment::instance()->get_all(array( |
|
842 | 842 | array( |
843 | 843 | 'PAY_ID' => array( |
844 | 844 | 'IN', |
845 | - array_keys( $payments ) |
|
845 | + array_keys($payments) |
|
846 | 846 | ) |
847 | 847 | ) |
848 | - ) ); |
|
849 | - if ( ! empty( $reg_payments ) ) { |
|
850 | - foreach ( $payments as $payment ) { |
|
851 | - if ( ! $payment instanceof EE_Payment ) { |
|
848 | + )); |
|
849 | + if ( ! empty($reg_payments)) { |
|
850 | + foreach ($payments as $payment) { |
|
851 | + if ( ! $payment instanceof EE_Payment) { |
|
852 | 852 | continue; |
853 | - } else if ( ! isset( $existing_reg_payments[ $payment->ID() ] ) ) { |
|
854 | - $existing_reg_payments[ $payment->ID() ] = array(); |
|
853 | + } else if ( ! isset($existing_reg_payments[$payment->ID()])) { |
|
854 | + $existing_reg_payments[$payment->ID()] = array(); |
|
855 | 855 | } |
856 | - foreach ( $reg_payments as $reg_payment ) { |
|
857 | - if ( $reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID() ) { |
|
858 | - $existing_reg_payments[ $payment->ID() ][ ] = $reg_payment->registration_ID(); |
|
856 | + foreach ($reg_payments as $reg_payment) { |
|
857 | + if ($reg_payment instanceof EE_Registration_Payment && $reg_payment->payment_ID() === $payment->ID()) { |
|
858 | + $existing_reg_payments[$payment->ID()][] = $reg_payment->registration_ID(); |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | } |
@@ -888,54 +888,54 @@ discard block |
||
888 | 888 | ) |
889 | 889 | ) |
890 | 890 | ); |
891 | - $registrations_to_apply_payment_to = EEH_HTML::br() . EEH_HTML::div( |
|
891 | + $registrations_to_apply_payment_to = EEH_HTML::br().EEH_HTML::div( |
|
892 | 892 | '', 'txn-admin-apply-payment-to-registrations-dv', '', 'clear: both; margin: 1.5em 0 0; display: none;' |
893 | 893 | ); |
894 | - $registrations_to_apply_payment_to .= EEH_HTML::br() . EEH_HTML::div( '', '', 'admin-primary-mbox-tbl-wrap' ); |
|
895 | - $registrations_to_apply_payment_to .= EEH_HTML::table( '', '', 'admin-primary-mbox-tbl' ); |
|
894 | + $registrations_to_apply_payment_to .= EEH_HTML::br().EEH_HTML::div('', '', 'admin-primary-mbox-tbl-wrap'); |
|
895 | + $registrations_to_apply_payment_to .= EEH_HTML::table('', '', 'admin-primary-mbox-tbl'); |
|
896 | 896 | $registrations_to_apply_payment_to .= EEH_HTML::thead( |
897 | 897 | EEH_HTML::tr( |
898 | - EEH_HTML::th( esc_html__( 'ID', 'event_espresso' ) ) . |
|
899 | - EEH_HTML::th( esc_html__( 'Registrant', 'event_espresso' ) ) . |
|
900 | - EEH_HTML::th( esc_html__( 'Ticket', 'event_espresso' ) ) . |
|
901 | - EEH_HTML::th( esc_html__( 'Event', 'event_espresso' ) ) . |
|
902 | - EEH_HTML::th( esc_html__( 'Paid', 'event_espresso' ), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
903 | - EEH_HTML::th( esc_html__( 'Owing', 'event_espresso' ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
904 | - EEH_HTML::th( esc_html__( 'Apply', 'event_espresso' ), '', 'jst-cntr' ) |
|
898 | + EEH_HTML::th(esc_html__('ID', 'event_espresso')). |
|
899 | + EEH_HTML::th(esc_html__('Registrant', 'event_espresso')). |
|
900 | + EEH_HTML::th(esc_html__('Ticket', 'event_espresso')). |
|
901 | + EEH_HTML::th(esc_html__('Event', 'event_espresso')). |
|
902 | + EEH_HTML::th(esc_html__('Paid', 'event_espresso'), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
903 | + EEH_HTML::th(esc_html__('Owing', 'event_espresso'), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
904 | + EEH_HTML::th(esc_html__('Apply', 'event_espresso'), '', 'jst-cntr') |
|
905 | 905 | ) |
906 | 906 | ); |
907 | 907 | $registrations_to_apply_payment_to .= EEH_HTML::tbody(); |
908 | 908 | // get registrations for TXN |
909 | - $registrations = $this->_transaction->registrations( $query_params ); |
|
910 | - foreach ( $registrations as $registration ) { |
|
911 | - if ( $registration instanceof EE_Registration ) { |
|
909 | + $registrations = $this->_transaction->registrations($query_params); |
|
910 | + foreach ($registrations as $registration) { |
|
911 | + if ($registration instanceof EE_Registration) { |
|
912 | 912 | $attendee_name = $registration->attendee() instanceof EE_Attendee |
913 | 913 | ? $registration->attendee()->full_name() |
914 | - : esc_html__( 'Unknown Attendee', 'event_espresso' ); |
|
914 | + : esc_html__('Unknown Attendee', 'event_espresso'); |
|
915 | 915 | $owing = $registration->final_price() - $registration->paid(); |
916 | 916 | $taxable = $registration->ticket()->taxable() |
917 | - ? ' <span class="smaller-text lt-grey-text"> ' . esc_html__( '+ tax', 'event_espresso' ) . '</span>' |
|
917 | + ? ' <span class="smaller-text lt-grey-text"> '.esc_html__('+ tax', 'event_espresso').'</span>' |
|
918 | 918 | : ''; |
919 | - $checked = empty( $existing_reg_payments ) || in_array( $registration->ID(), $existing_reg_payments ) |
|
919 | + $checked = empty($existing_reg_payments) || in_array($registration->ID(), $existing_reg_payments) |
|
920 | 920 | ? ' checked="checked"' |
921 | 921 | : ''; |
922 | 922 | $disabled = $registration->final_price() > 0 ? '' : ' disabled'; |
923 | 923 | $registrations_to_apply_payment_to .= EEH_HTML::tr( |
924 | - EEH_HTML::td( $registration->ID() ) . |
|
925 | - EEH_HTML::td( $attendee_name ) . |
|
924 | + EEH_HTML::td($registration->ID()). |
|
925 | + EEH_HTML::td($attendee_name). |
|
926 | 926 | EEH_HTML::td( |
927 | - $registration->ticket()->name() . ' : ' . $registration->ticket()->pretty_price() . $taxable |
|
928 | - ) . |
|
929 | - EEH_HTML::td( $registration->event_name() ) . |
|
930 | - EEH_HTML::td( $registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr' ) . |
|
931 | - EEH_HTML::td( EEH_Template::format_currency( $owing ), '', 'txn-admin-payment-owing-td jst-cntr' ) . |
|
927 | + $registration->ticket()->name().' : '.$registration->ticket()->pretty_price().$taxable |
|
928 | + ). |
|
929 | + EEH_HTML::td($registration->event_name()). |
|
930 | + EEH_HTML::td($registration->pretty_paid(), '', 'txn-admin-payment-paid-td jst-cntr'). |
|
931 | + EEH_HTML::td(EEH_Template::format_currency($owing), '', 'txn-admin-payment-owing-td jst-cntr'). |
|
932 | 932 | EEH_HTML::td( |
933 | - '<input type="checkbox" value="' . $registration->ID() |
|
933 | + '<input type="checkbox" value="'.$registration->ID() |
|
934 | 934 | . '" name="txn_admin_payment[registrations]"' |
935 | - . $checked . $disabled . '>', |
|
935 | + . $checked.$disabled.'>', |
|
936 | 936 | '', 'jst-cntr' |
937 | 937 | ), |
938 | - 'apply-payment-registration-row-' . $registration->ID() |
|
938 | + 'apply-payment-registration-row-'.$registration->ID() |
|
939 | 939 | ); |
940 | 940 | } |
941 | 941 | } |
@@ -950,7 +950,7 @@ discard block |
||
950 | 950 | '', 'clear description' |
951 | 951 | ); |
952 | 952 | $registrations_to_apply_payment_to .= EEH_HTML::divx(); |
953 | - $this->_template_args[ 'registrations_to_apply_payment_to' ] = $registrations_to_apply_payment_to; |
|
953 | + $this->_template_args['registrations_to_apply_payment_to'] = $registrations_to_apply_payment_to; |
|
954 | 954 | } |
955 | 955 | |
956 | 956 | |
@@ -967,9 +967,9 @@ discard block |
||
967 | 967 | $statuses = EEM_Registration::reg_status_array(array(), TRUE); |
968 | 968 | //let's add a "don't change" option. |
969 | 969 | $status_array['NAN'] = esc_html__('Leave the Same', 'event_espresso'); |
970 | - $status_array = array_merge( $status_array, $statuses ); |
|
971 | - $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' ); |
|
972 | - $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' ); |
|
970 | + $status_array = array_merge($status_array, $statuses); |
|
971 | + $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'); |
|
972 | + $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'); |
|
973 | 973 | |
974 | 974 | } |
975 | 975 | |
@@ -984,21 +984,21 @@ discard block |
||
984 | 984 | * @param EE_Payment[] to show on this page |
985 | 985 | * @return void |
986 | 986 | */ |
987 | - private function _get_payment_methods( $payments = array() ) { |
|
987 | + private function _get_payment_methods($payments = array()) { |
|
988 | 988 | $payment_methods_of_payments = array(); |
989 | - foreach( $payments as $payment ){ |
|
990 | - if( $payment instanceof EE_Payment ){ |
|
991 | - $payment_methods_of_payments[] = $payment->get( 'PMD_ID' ); |
|
989 | + foreach ($payments as $payment) { |
|
990 | + if ($payment instanceof EE_Payment) { |
|
991 | + $payment_methods_of_payments[] = $payment->get('PMD_ID'); |
|
992 | 992 | } |
993 | 993 | } |
994 | - if( $payment_methods_of_payments ){ |
|
995 | - $query_args = array( array( 'OR*payment_method_for_payment' => array( |
|
996 | - 'PMD_ID' => array( 'IN', $payment_methods_of_payments ), |
|
997 | - 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ) ); |
|
998 | - }else{ |
|
999 | - $query_args = array( array( 'PMD_scope' => array( 'LIKE', '%' . EEM_Payment_Method::scope_admin . '%' ) ) ); |
|
994 | + if ($payment_methods_of_payments) { |
|
995 | + $query_args = array(array('OR*payment_method_for_payment' => array( |
|
996 | + 'PMD_ID' => array('IN', $payment_methods_of_payments), |
|
997 | + 'PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%') ))); |
|
998 | + } else { |
|
999 | + $query_args = array(array('PMD_scope' => array('LIKE', '%'.EEM_Payment_Method::scope_admin.'%'))); |
|
1000 | 1000 | } |
1001 | - $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all( $query_args ); |
|
1001 | + $this->_template_args['payment_methods'] = EEM_Payment_Method::instance()->get_all($query_args); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | |
@@ -1012,17 +1012,17 @@ discard block |
||
1012 | 1012 | * @param array $metabox |
1013 | 1013 | * @return void |
1014 | 1014 | */ |
1015 | - public function txn_attendees_meta_box( $post, $metabox = array( 'args' => array() )) { |
|
1015 | + public function txn_attendees_meta_box($post, $metabox = array('args' => array())) { |
|
1016 | 1016 | |
1017 | - extract( $metabox['args'] ); |
|
1017 | + extract($metabox['args']); |
|
1018 | 1018 | $this->_template_args['post'] = $post; |
1019 | 1019 | $this->_template_args['event_attendees'] = array(); |
1020 | 1020 | // process items in cart |
1021 | - $line_items = $this->_transaction->get_many_related('Line_Item', array( array( 'LIN_type' => 'line-item' ) ) ); |
|
1022 | - if ( ! empty( $line_items )) { |
|
1023 | - foreach ( $line_items as $item ) { |
|
1024 | - if ( $item instanceof EE_Line_Item ) { |
|
1025 | - switch( $item->OBJ_type() ) { |
|
1021 | + $line_items = $this->_transaction->get_many_related('Line_Item', array(array('LIN_type' => 'line-item'))); |
|
1022 | + if ( ! empty($line_items)) { |
|
1023 | + foreach ($line_items as $item) { |
|
1024 | + if ($item instanceof EE_Line_Item) { |
|
1025 | + switch ($item->OBJ_type()) { |
|
1026 | 1026 | |
1027 | 1027 | case 'Event' : |
1028 | 1028 | break; |
@@ -1030,39 +1030,39 @@ discard block |
||
1030 | 1030 | case 'Ticket' : |
1031 | 1031 | $ticket = $item->ticket(); |
1032 | 1032 | //right now we're only handling tickets here. Cause its expected that only tickets will have attendees right? |
1033 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
1033 | + if ( ! $ticket instanceof EE_Ticket) { |
|
1034 | 1034 | continue; |
1035 | 1035 | } |
1036 | 1036 | try { |
1037 | 1037 | $event_name = $ticket->get_event_name(); |
1038 | - } catch ( Exception $e ) { |
|
1039 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1040 | - $event_name = esc_html__( 'Unknown Event', 'event_espresso' ); |
|
1038 | + } catch (Exception $e) { |
|
1039 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1040 | + $event_name = esc_html__('Unknown Event', 'event_espresso'); |
|
1041 | 1041 | } |
1042 | - $event_name .= ' - ' . $item->get( 'LIN_name' ); |
|
1043 | - $ticket_price = EEH_Template::format_currency( $item->get( 'LIN_unit_price' ) ); |
|
1042 | + $event_name .= ' - '.$item->get('LIN_name'); |
|
1043 | + $ticket_price = EEH_Template::format_currency($item->get('LIN_unit_price')); |
|
1044 | 1044 | // now get all of the registrations for this transaction that use this ticket |
1045 | - $registrations = $ticket->get_many_related('Registration', array( array('TXN_ID' => $this->_transaction->ID() ))); |
|
1046 | - foreach( $registrations as $registration ) { |
|
1047 | - if ( ! $registration instanceof EE_Registration ) { |
|
1045 | + $registrations = $ticket->get_many_related('Registration', array(array('TXN_ID' => $this->_transaction->ID()))); |
|
1046 | + foreach ($registrations as $registration) { |
|
1047 | + if ( ! $registration instanceof EE_Registration) { |
|
1048 | 1048 | continue; |
1049 | 1049 | } |
1050 | - $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1051 | - $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1052 | - $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1053 | - $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1050 | + $this->_template_args['event_attendees'][$registration->ID()]['STS_ID'] = $registration->status_ID(); |
|
1051 | + $this->_template_args['event_attendees'][$registration->ID()]['att_num'] = $registration->count(); |
|
1052 | + $this->_template_args['event_attendees'][$registration->ID()]['event_ticket_name'] = $event_name; |
|
1053 | + $this->_template_args['event_attendees'][$registration->ID()]['ticket_price'] = $ticket_price; |
|
1054 | 1054 | // attendee info |
1055 | 1055 | $attendee = $registration->get_first_related('Attendee'); |
1056 | - if ( $attendee instanceof EE_Attendee ) { |
|
1057 | - $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1058 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1059 | - $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:' . $attendee->email() . '?subject=' . $event_name . esc_html__(' Event', 'event_espresso') . '">' . $attendee->email() . '</a>'; |
|
1060 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format( $attendee, 'inline', false, false ); |
|
1056 | + if ($attendee instanceof EE_Attendee) { |
|
1057 | + $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = $attendee->ID(); |
|
1058 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = $attendee->full_name(); |
|
1059 | + $this->_template_args['event_attendees'][$registration->ID()]['email'] = '<a href="mailto:'.$attendee->email().'?subject='.$event_name.esc_html__(' Event', 'event_espresso').'">'.$attendee->email().'</a>'; |
|
1060 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = EEH_Address::format($attendee, 'inline', false, false); |
|
1061 | 1061 | } else { |
1062 | 1062 | $this->_template_args['event_attendees'][$registration->ID()]['att_id'] = ''; |
1063 | - $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1063 | + $this->_template_args['event_attendees'][$registration->ID()]['attendee'] = ''; |
|
1064 | 1064 | $this->_template_args['event_attendees'][$registration->ID()]['email'] = ''; |
1065 | - $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1065 | + $this->_template_args['event_attendees'][$registration->ID()]['address'] = ''; |
|
1066 | 1066 | } |
1067 | 1067 | } |
1068 | 1068 | break; |
@@ -1071,12 +1071,12 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $this->_template_args['transaction_form_url'] = add_query_arg( array( 'action' => 'edit_transaction', 'process' => 'attendees' ), TXN_ADMIN_URL ); |
|
1075 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE ); |
|
1074 | + $this->_template_args['transaction_form_url'] = add_query_arg(array('action' => 'edit_transaction', 'process' => 'attendees'), TXN_ADMIN_URL); |
|
1075 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_main_meta_box_attendees.template.php', $this->_template_args, TRUE); |
|
1076 | 1076 | |
1077 | 1077 | } else { |
1078 | 1078 | echo sprintf( |
1079 | - 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 | + 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'), |
|
1080 | 1080 | '<p class="important-notice">', |
1081 | 1081 | '</p>' |
1082 | 1082 | ); |
@@ -1095,19 +1095,19 @@ discard block |
||
1095 | 1095 | */ |
1096 | 1096 | public function txn_registrant_side_meta_box() { |
1097 | 1097 | $primary_att = $this->_transaction->primary_registration() instanceof EE_Registration ? $this->_transaction->primary_registration()->get_first_related('Attendee') : null; |
1098 | - if ( ! $primary_att instanceof EE_Attendee ) { |
|
1098 | + if ( ! $primary_att instanceof EE_Attendee) { |
|
1099 | 1099 | $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'); |
1100 | 1100 | $primary_att = EEM_Attendee::instance()->create_default_object(); |
1101 | 1101 | } |
1102 | - $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1102 | + $this->_template_args['ATT_ID'] = $primary_att->ID(); |
|
1103 | 1103 | $this->_template_args['prime_reg_fname'] = $primary_att->fname(); |
1104 | 1104 | $this->_template_args['prime_reg_lname'] = $primary_att->lname(); |
1105 | - $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1105 | + $this->_template_args['prime_reg_email'] = $primary_att->email(); |
|
1106 | 1106 | $this->_template_args['prime_reg_phone'] = $primary_att->phone(); |
1107 | - $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 | + $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); |
|
1108 | 1108 | // get formatted address for registrant |
1109 | - $this->_template_args[ 'formatted_address' ] = EEH_Address::format( $primary_att ); |
|
1110 | - echo EEH_Template::display_template( TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE ); |
|
1109 | + $this->_template_args['formatted_address'] = EEH_Address::format($primary_att); |
|
1110 | + echo EEH_Template::display_template(TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_registrant.template.php', $this->_template_args, TRUE); |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | 1113 | |
@@ -1123,12 +1123,12 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $this->_template_args['billing_form'] = $this->_transaction->billing_info(); |
1125 | 1125 | $this->_template_args['billing_form_url'] = add_query_arg( |
1126 | - array( 'action' => 'edit_transaction', 'process' => 'billing' ), |
|
1126 | + array('action' => 'edit_transaction', 'process' => 'billing'), |
|
1127 | 1127 | TXN_ADMIN_URL |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - $template_path = TXN_TEMPLATE_PATH . 'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1131 | - echo EEH_Template::display_template( $template_path, $this->_template_args, TRUE );/**/ |
|
1130 | + $template_path = TXN_TEMPLATE_PATH.'txn_admin_details_side_meta_box_billing_info.template.php'; |
|
1131 | + echo EEH_Template::display_template($template_path, $this->_template_args, TRUE); /**/ |
|
1132 | 1132 | } |
1133 | 1133 | |
1134 | 1134 | |
@@ -1141,42 +1141,42 @@ discard block |
||
1141 | 1141 | * @return void |
1142 | 1142 | */ |
1143 | 1143 | public function apply_payments_or_refunds() { |
1144 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1144 | + $json_response_data = array('return_data' => FALSE); |
|
1145 | 1145 | $valid_data = $this->_validate_payment_request_data(); |
1146 | - if ( ! empty( $valid_data ) ) { |
|
1147 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1146 | + if ( ! empty($valid_data)) { |
|
1147 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1148 | 1148 | //save the new payment |
1149 | - $payment = $this->_create_payment_from_request_data( $valid_data ); |
|
1149 | + $payment = $this->_create_payment_from_request_data($valid_data); |
|
1150 | 1150 | // get the TXN for this payment |
1151 | 1151 | $transaction = $payment->transaction(); |
1152 | 1152 | // verify transaction |
1153 | - if ( $transaction instanceof EE_Transaction ) { |
|
1153 | + if ($transaction instanceof EE_Transaction) { |
|
1154 | 1154 | // calculate_total_payments_and_update_status |
1155 | - $this->_process_transaction_payments( $transaction ); |
|
1156 | - $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to( $payment ); |
|
1157 | - $this->_remove_existing_registration_payments( $payment, $PAY_ID ); |
|
1155 | + $this->_process_transaction_payments($transaction); |
|
1156 | + $REG_IDs = $this->_get_REG_IDs_to_apply_payment_to($payment); |
|
1157 | + $this->_remove_existing_registration_payments($payment, $PAY_ID); |
|
1158 | 1158 | // apply payment to registrations (if applicable) |
1159 | - if ( ! empty( $REG_IDs ) ) { |
|
1160 | - $this->_update_registration_payments( $transaction, $payment, $REG_IDs ); |
|
1159 | + if ( ! empty($REG_IDs)) { |
|
1160 | + $this->_update_registration_payments($transaction, $payment, $REG_IDs); |
|
1161 | 1161 | $this->_maybe_send_notifications(); |
1162 | 1162 | // now process status changes for the same registrations |
1163 | - $this->_process_registration_status_change( $transaction, $REG_IDs ); |
|
1163 | + $this->_process_registration_status_change($transaction, $REG_IDs); |
|
1164 | 1164 | } |
1165 | - $this->_maybe_send_notifications( $payment ); |
|
1165 | + $this->_maybe_send_notifications($payment); |
|
1166 | 1166 | //prepare to render page |
1167 | - $json_response_data[ 'return_data' ] = $this->_build_payment_json_response( $payment, $REG_IDs ); |
|
1168 | - do_action( 'AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment ); |
|
1167 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs); |
|
1168 | + do_action('AHEE__Transactions_Admin_Page__apply_payments_or_refund__after_recording', $transaction, $payment); |
|
1169 | 1169 | } else { |
1170 | 1170 | EE_Error::add_error( |
1171 | - esc_html__( 'A valid Transaction for this payment could not be retrieved.', 'event_espresso' ), |
|
1171 | + esc_html__('A valid Transaction for this payment could not be retrieved.', 'event_espresso'), |
|
1172 | 1172 | __FILE__, __FUNCTION__, __LINE__ |
1173 | 1173 | ); |
1174 | 1174 | } |
1175 | 1175 | } else { |
1176 | - EE_Error::add_error( esc_html__( 'The payment form data could not be processed. Please try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1176 | + EE_Error::add_error(esc_html__('The payment form data could not be processed. Please try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1177 | 1177 | } |
1178 | 1178 | |
1179 | - $notices = EE_Error::get_notices( false, false, false ); |
|
1179 | + $notices = EE_Error::get_notices(false, false, false); |
|
1180 | 1180 | $this->_template_args = array( |
1181 | 1181 | 'data' => $json_response_data, |
1182 | 1182 | 'error' => $notices['errors'], |
@@ -1193,30 +1193,30 @@ discard block |
||
1193 | 1193 | * @return array |
1194 | 1194 | */ |
1195 | 1195 | protected function _validate_payment_request_data() { |
1196 | - if ( ! isset( $this->_req_data[ 'txn_admin_payment' ] ) ) { |
|
1196 | + if ( ! isset($this->_req_data['txn_admin_payment'])) { |
|
1197 | 1197 | return false; |
1198 | 1198 | } |
1199 | 1199 | $payment_form = $this->_generate_payment_form_section(); |
1200 | 1200 | try { |
1201 | - if ( $payment_form->was_submitted() ) { |
|
1201 | + if ($payment_form->was_submitted()) { |
|
1202 | 1202 | $payment_form->receive_form_submission(); |
1203 | - if ( ! $payment_form->is_valid() ) { |
|
1203 | + if ( ! $payment_form->is_valid()) { |
|
1204 | 1204 | $submission_error_messages = array(); |
1205 | - foreach ( $payment_form->get_validation_errors_accumulated() as $validation_error ) { |
|
1206 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1205 | + foreach ($payment_form->get_validation_errors_accumulated() as $validation_error) { |
|
1206 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1207 | 1207 | $submission_error_messages[] = sprintf( |
1208 | - _x( '%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso' ), |
|
1208 | + _x('%s : %s', 'Form Section Name : Form Validation Error', 'event_espresso'), |
|
1209 | 1209 | $validation_error->get_form_section()->html_label_text(), |
1210 | 1210 | $validation_error->getMessage() |
1211 | 1211 | ); |
1212 | 1212 | } |
1213 | 1213 | } |
1214 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1214 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
1215 | 1215 | return array(); |
1216 | 1216 | } |
1217 | 1217 | } |
1218 | - } catch ( EE_Error $e ) { |
|
1219 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
1218 | + } catch (EE_Error $e) { |
|
1219 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
1220 | 1220 | return array(); |
1221 | 1221 | } |
1222 | 1222 | return $payment_form->valid_data(); |
@@ -1238,63 +1238,63 @@ discard block |
||
1238 | 1238 | array( |
1239 | 1239 | 'default' => 0, |
1240 | 1240 | 'required' => false, |
1241 | - 'html_label_text' => esc_html__( 'Payment ID', 'event_espresso' ), |
|
1242 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1241 | + 'html_label_text' => esc_html__('Payment ID', 'event_espresso'), |
|
1242 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1243 | 1243 | ) |
1244 | 1244 | ), |
1245 | 1245 | 'TXN_ID' => new EE_Text_Input( |
1246 | 1246 | array( |
1247 | 1247 | 'default' => 0, |
1248 | 1248 | 'required' => true, |
1249 | - 'html_label_text' => esc_html__( 'Transaction ID', 'event_espresso' ), |
|
1250 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1249 | + 'html_label_text' => esc_html__('Transaction ID', 'event_espresso'), |
|
1250 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1251 | 1251 | ) |
1252 | 1252 | ), |
1253 | 1253 | 'type' => new EE_Text_Input( |
1254 | 1254 | array( |
1255 | 1255 | 'default' => 1, |
1256 | 1256 | 'required' => true, |
1257 | - 'html_label_text' => esc_html__( 'Payment or Refund', 'event_espresso' ), |
|
1258 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1257 | + 'html_label_text' => esc_html__('Payment or Refund', 'event_espresso'), |
|
1258 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1259 | 1259 | ) |
1260 | 1260 | ), |
1261 | 1261 | 'amount' => new EE_Text_Input( |
1262 | 1262 | array( |
1263 | 1263 | 'default' => 0, |
1264 | 1264 | 'required' => true, |
1265 | - 'html_label_text' => esc_html__( 'Payment amount', 'event_espresso' ), |
|
1266 | - 'validation_strategies' => array( new EE_Float_Normalization() ) |
|
1265 | + 'html_label_text' => esc_html__('Payment amount', 'event_espresso'), |
|
1266 | + 'validation_strategies' => array(new EE_Float_Normalization()) |
|
1267 | 1267 | ) |
1268 | 1268 | ), |
1269 | 1269 | 'status' => new EE_Text_Input( |
1270 | 1270 | array( |
1271 | 1271 | 'default' => EEM_Payment::status_id_approved, |
1272 | 1272 | 'required' => true, |
1273 | - 'html_label_text' => esc_html__( 'Payment status', 'event_espresso' ), |
|
1273 | + 'html_label_text' => esc_html__('Payment status', 'event_espresso'), |
|
1274 | 1274 | ) |
1275 | 1275 | ), |
1276 | 1276 | 'PMD_ID' => new EE_Text_Input( |
1277 | 1277 | array( |
1278 | 1278 | 'default' => 2, |
1279 | 1279 | 'required' => true, |
1280 | - 'html_label_text' => esc_html__( 'Payment Method', 'event_espresso' ), |
|
1281 | - 'validation_strategies' => array( new EE_Int_Normalization() ) |
|
1280 | + 'html_label_text' => esc_html__('Payment Method', 'event_espresso'), |
|
1281 | + 'validation_strategies' => array(new EE_Int_Normalization()) |
|
1282 | 1282 | ) |
1283 | 1283 | ), |
1284 | 1284 | 'date' => new EE_Text_Input( |
1285 | 1285 | array( |
1286 | 1286 | 'default' => time(), |
1287 | 1287 | 'required' => true, |
1288 | - 'html_label_text' => esc_html__( 'Payment date', 'event_espresso' ), |
|
1288 | + 'html_label_text' => esc_html__('Payment date', 'event_espresso'), |
|
1289 | 1289 | ) |
1290 | 1290 | ), |
1291 | 1291 | 'txn_id_chq_nmbr' => new EE_Text_Input( |
1292 | 1292 | array( |
1293 | 1293 | 'default' => '', |
1294 | 1294 | 'required' => false, |
1295 | - 'html_label_text' => esc_html__( 'Transaction or Cheque Number', 'event_espresso' ), |
|
1295 | + 'html_label_text' => esc_html__('Transaction or Cheque Number', 'event_espresso'), |
|
1296 | 1296 | 'validation_strategies' => array( |
1297 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1297 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1298 | 1298 | ) |
1299 | 1299 | ) |
1300 | 1300 | ), |
@@ -1302,9 +1302,9 @@ discard block |
||
1302 | 1302 | array( |
1303 | 1303 | 'default' => '', |
1304 | 1304 | 'required' => false, |
1305 | - 'html_label_text' => esc_html__( 'Purchase Order Number', 'event_espresso' ), |
|
1305 | + 'html_label_text' => esc_html__('Purchase Order Number', 'event_espresso'), |
|
1306 | 1306 | 'validation_strategies' => array( |
1307 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1307 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1308 | 1308 | ) |
1309 | 1309 | ) |
1310 | 1310 | ), |
@@ -1312,9 +1312,9 @@ discard block |
||
1312 | 1312 | array( |
1313 | 1313 | 'default' => '', |
1314 | 1314 | 'required' => false, |
1315 | - 'html_label_text' => esc_html__( 'Extra Field for Accounting', 'event_espresso' ), |
|
1315 | + 'html_label_text' => esc_html__('Extra Field for Accounting', 'event_espresso'), |
|
1316 | 1316 | 'validation_strategies' => array( |
1317 | - new EE_Max_Length_Validation_Strategy( esc_html__('Input too long', 'event_espresso'), 100 ), |
|
1317 | + new EE_Max_Length_Validation_Strategy(esc_html__('Input too long', 'event_espresso'), 100), |
|
1318 | 1318 | ) |
1319 | 1319 | ) |
1320 | 1320 | ), |
@@ -1331,37 +1331,37 @@ discard block |
||
1331 | 1331 | * @param array $valid_data |
1332 | 1332 | * @return EE_Payment |
1333 | 1333 | */ |
1334 | - protected function _create_payment_from_request_data( $valid_data ) { |
|
1335 | - $PAY_ID = $valid_data[ 'PAY_ID' ]; |
|
1334 | + protected function _create_payment_from_request_data($valid_data) { |
|
1335 | + $PAY_ID = $valid_data['PAY_ID']; |
|
1336 | 1336 | // get payment amount |
1337 | - $amount = $valid_data[ 'amount' ] ? abs( $valid_data[ 'amount' ] ) : 0; |
|
1337 | + $amount = $valid_data['amount'] ? abs($valid_data['amount']) : 0; |
|
1338 | 1338 | // payments have a type value of 1 and refunds have a type value of -1 |
1339 | 1339 | // so multiplying amount by type will give a positive value for payments, and negative values for refunds |
1340 | - $amount = $valid_data[ 'type' ] < 0 ? $amount * -1 : $amount; |
|
1340 | + $amount = $valid_data['type'] < 0 ? $amount * -1 : $amount; |
|
1341 | 1341 | // for some reason the date string coming in has extra spaces between the date and time. This fixes that. |
1342 | - $date = $valid_data['date'] ? preg_replace( '/\s+/', ' ', $valid_data['date'] ) : date( 'Y-m-d g:i a', current_time( 'timestamp' ) ); |
|
1342 | + $date = $valid_data['date'] ? preg_replace('/\s+/', ' ', $valid_data['date']) : date('Y-m-d g:i a', current_time('timestamp')); |
|
1343 | 1343 | $payment = EE_Payment::new_instance( |
1344 | 1344 | array( |
1345 | - 'TXN_ID' => $valid_data[ 'TXN_ID' ], |
|
1346 | - 'STS_ID' => $valid_data[ 'status' ], |
|
1345 | + 'TXN_ID' => $valid_data['TXN_ID'], |
|
1346 | + 'STS_ID' => $valid_data['status'], |
|
1347 | 1347 | 'PAY_timestamp' => $date, |
1348 | 1348 | 'PAY_source' => EEM_Payment_Method::scope_admin, |
1349 | - 'PMD_ID' => $valid_data[ 'PMD_ID' ], |
|
1349 | + 'PMD_ID' => $valid_data['PMD_ID'], |
|
1350 | 1350 | 'PAY_amount' => $amount, |
1351 | - 'PAY_txn_id_chq_nmbr' => $valid_data[ 'txn_id_chq_nmbr' ], |
|
1352 | - 'PAY_po_number' => $valid_data[ 'po_number' ], |
|
1353 | - 'PAY_extra_accntng' => $valid_data[ 'accounting' ], |
|
1351 | + 'PAY_txn_id_chq_nmbr' => $valid_data['txn_id_chq_nmbr'], |
|
1352 | + 'PAY_po_number' => $valid_data['po_number'], |
|
1353 | + 'PAY_extra_accntng' => $valid_data['accounting'], |
|
1354 | 1354 | 'PAY_details' => $valid_data, |
1355 | 1355 | 'PAY_ID' => $PAY_ID |
1356 | 1356 | ), |
1357 | 1357 | '', |
1358 | - array( 'Y-m-d', 'g:i a' ) |
|
1358 | + array('Y-m-d', 'g:i a') |
|
1359 | 1359 | ); |
1360 | 1360 | |
1361 | - if ( ! $payment->save() ) { |
|
1361 | + if ( ! $payment->save()) { |
|
1362 | 1362 | EE_Error::add_error( |
1363 | 1363 | sprintf( |
1364 | - esc_html__( 'Payment %1$d has not been successfully saved to the database.', 'event_espresso' ), |
|
1364 | + esc_html__('Payment %1$d has not been successfully saved to the database.', 'event_espresso'), |
|
1365 | 1365 | $payment->ID() |
1366 | 1366 | ), |
1367 | 1367 | __FILE__, __FUNCTION__, __LINE__ |
@@ -1378,15 +1378,15 @@ discard block |
||
1378 | 1378 | * @param \EE_Transaction $transaction |
1379 | 1379 | * @return array |
1380 | 1380 | */ |
1381 | - protected function _process_transaction_payments( EE_Transaction $transaction ) { |
|
1381 | + protected function _process_transaction_payments(EE_Transaction $transaction) { |
|
1382 | 1382 | /** @type EE_Transaction_Payments $transaction_payments */ |
1383 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1383 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1384 | 1384 | //update the transaction with this payment |
1385 | - if ( $transaction_payments->calculate_total_payments_and_update_status( $transaction ) ) { |
|
1386 | - EE_Error::add_success( esc_html__( 'The payment has been processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1385 | + if ($transaction_payments->calculate_total_payments_and_update_status($transaction)) { |
|
1386 | + EE_Error::add_success(esc_html__('The payment has been processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1387 | 1387 | } else { |
1388 | 1388 | EE_Error::add_error( |
1389 | - esc_html__( 'The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso' ) |
|
1389 | + esc_html__('The payment was processed successfully but the amount paid for the transaction was not updated.', 'event_espresso') |
|
1390 | 1390 | , __FILE__, __FUNCTION__, __LINE__ |
1391 | 1391 | ); |
1392 | 1392 | } |
@@ -1402,19 +1402,19 @@ discard block |
||
1402 | 1402 | * @param \EE_Payment $payment |
1403 | 1403 | * @return array |
1404 | 1404 | */ |
1405 | - protected function _get_REG_IDs_to_apply_payment_to( EE_Payment $payment ) { |
|
1405 | + protected function _get_REG_IDs_to_apply_payment_to(EE_Payment $payment) { |
|
1406 | 1406 | $REG_IDs = array(); |
1407 | 1407 | // grab array of IDs for specific registrations to apply changes to |
1408 | - if ( isset( $this->_req_data[ 'txn_admin_payment' ][ 'registrations' ] ) ) { |
|
1409 | - $REG_IDs = (array)$this->_req_data[ 'txn_admin_payment' ][ 'registrations' ]; |
|
1408 | + if (isset($this->_req_data['txn_admin_payment']['registrations'])) { |
|
1409 | + $REG_IDs = (array) $this->_req_data['txn_admin_payment']['registrations']; |
|
1410 | 1410 | } |
1411 | 1411 | //nothing specified ? then get all reg IDs |
1412 | - if ( empty( $REG_IDs ) ) { |
|
1412 | + if (empty($REG_IDs)) { |
|
1413 | 1413 | $registrations = $payment->transaction()->registrations(); |
1414 | - $REG_IDs = ! empty( $registrations ) ? array_keys( $registrations ) : $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1414 | + $REG_IDs = ! empty($registrations) ? array_keys($registrations) : $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1415 | 1415 | } |
1416 | 1416 | // ensure that REG_IDs are integers and NOT strings |
1417 | - return array_map( 'intval', $REG_IDs ); |
|
1417 | + return array_map('intval', $REG_IDs); |
|
1418 | 1418 | } |
1419 | 1419 | |
1420 | 1420 | |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | /** |
1432 | 1432 | * @param array $existing_reg_payment_REG_IDs |
1433 | 1433 | */ |
1434 | - public function set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs = null ) { |
|
1434 | + public function set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs = null) { |
|
1435 | 1435 | $this->_existing_reg_payment_REG_IDs = $existing_reg_payment_REG_IDs; |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1446,13 +1446,13 @@ discard block |
||
1446 | 1446 | * @param \EE_Payment $payment |
1447 | 1447 | * @return array |
1448 | 1448 | */ |
1449 | - protected function _get_existing_reg_payment_REG_IDs( EE_Payment $payment ) { |
|
1450 | - if ( $this->existing_reg_payment_REG_IDs() === null ) { |
|
1449 | + protected function _get_existing_reg_payment_REG_IDs(EE_Payment $payment) { |
|
1450 | + if ($this->existing_reg_payment_REG_IDs() === null) { |
|
1451 | 1451 | // let's get any existing reg payment records for this payment |
1452 | - $existing_reg_payment_REG_IDs = $payment->get_many_related( 'Registration' ); |
|
1452 | + $existing_reg_payment_REG_IDs = $payment->get_many_related('Registration'); |
|
1453 | 1453 | // but we only want the REG IDs, so grab the array keys |
1454 | - $existing_reg_payment_REG_IDs = ! empty( $existing_reg_payment_REG_IDs ) ? array_keys( $existing_reg_payment_REG_IDs ) : array(); |
|
1455 | - $this->set_existing_reg_payment_REG_IDs( $existing_reg_payment_REG_IDs ); |
|
1454 | + $existing_reg_payment_REG_IDs = ! empty($existing_reg_payment_REG_IDs) ? array_keys($existing_reg_payment_REG_IDs) : array(); |
|
1455 | + $this->set_existing_reg_payment_REG_IDs($existing_reg_payment_REG_IDs); |
|
1456 | 1456 | } |
1457 | 1457 | return $this->existing_reg_payment_REG_IDs(); |
1458 | 1458 | } |
@@ -1471,23 +1471,23 @@ discard block |
||
1471 | 1471 | * @param int $PAY_ID |
1472 | 1472 | * @return bool; |
1473 | 1473 | */ |
1474 | - protected function _remove_existing_registration_payments( EE_Payment $payment, $PAY_ID = 0 ) { |
|
1474 | + protected function _remove_existing_registration_payments(EE_Payment $payment, $PAY_ID = 0) { |
|
1475 | 1475 | // newly created payments will have nothing recorded for $PAY_ID |
1476 | - if ( $PAY_ID == 0 ) { |
|
1476 | + if ($PAY_ID == 0) { |
|
1477 | 1477 | return false; |
1478 | 1478 | } |
1479 | - $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1480 | - if ( empty( $existing_reg_payment_REG_IDs )) { |
|
1479 | + $existing_reg_payment_REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1480 | + if (empty($existing_reg_payment_REG_IDs)) { |
|
1481 | 1481 | return false; |
1482 | 1482 | } |
1483 | 1483 | /** @type EE_Transaction_Payments $transaction_payments */ |
1484 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1484 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1485 | 1485 | return $transaction_payments->delete_registration_payments_and_update_registrations( |
1486 | 1486 | $payment, |
1487 | 1487 | array( |
1488 | 1488 | array( |
1489 | 1489 | 'PAY_ID' => $payment->ID(), |
1490 | - 'REG_ID' => array( 'IN', $existing_reg_payment_REG_IDs ), |
|
1490 | + 'REG_ID' => array('IN', $existing_reg_payment_REG_IDs), |
|
1491 | 1491 | ) |
1492 | 1492 | ) |
1493 | 1493 | ); |
@@ -1506,25 +1506,25 @@ discard block |
||
1506 | 1506 | * @param array $REG_IDs |
1507 | 1507 | * @return bool |
1508 | 1508 | */ |
1509 | - protected function _update_registration_payments( EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array() ) { |
|
1509 | + protected function _update_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $REG_IDs = array()) { |
|
1510 | 1510 | // we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments() |
1511 | 1511 | // so let's do that using our set of REG_IDs from the form |
1512 | 1512 | $registration_query_where_params = array( |
1513 | - 'REG_ID' => array( 'IN', $REG_IDs ) |
|
1513 | + 'REG_ID' => array('IN', $REG_IDs) |
|
1514 | 1514 | ); |
1515 | 1515 | // but add in some conditions regarding payment, |
1516 | 1516 | // so that we don't apply payments to registrations that are free or have already been paid for |
1517 | 1517 | // but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative ) |
1518 | - if ( ! $payment->is_a_refund() ) { |
|
1519 | - $registration_query_where_params[ 'REG_final_price' ] = array( '!=', 0 ); |
|
1520 | - $registration_query_where_params[ 'REG_final_price*' ] = array( '!=', 'REG_paid', true ); |
|
1518 | + if ( ! $payment->is_a_refund()) { |
|
1519 | + $registration_query_where_params['REG_final_price'] = array('!=', 0); |
|
1520 | + $registration_query_where_params['REG_final_price*'] = array('!=', 'REG_paid', true); |
|
1521 | 1521 | } |
1522 | 1522 | //EEH_Debug_Tools::printr( $registration_query_where_params, '$registration_query_where_params', __FILE__, __LINE__ ); |
1523 | - $registrations = $transaction->registrations( array( $registration_query_where_params ) ); |
|
1524 | - if ( ! empty( $registrations ) ) { |
|
1523 | + $registrations = $transaction->registrations(array($registration_query_where_params)); |
|
1524 | + if ( ! empty($registrations)) { |
|
1525 | 1525 | /** @type EE_Payment_Processor $payment_processor */ |
1526 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1527 | - $payment_processor->process_registration_payments( $transaction, $payment, $registrations ); |
|
1526 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1527 | + $payment_processor->process_registration_payments($transaction, $payment, $registrations); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1540,22 +1540,22 @@ discard block |
||
1540 | 1540 | * @param array $REG_IDs |
1541 | 1541 | * @return bool |
1542 | 1542 | */ |
1543 | - protected function _process_registration_status_change( EE_Transaction $transaction, $REG_IDs = array() ) { |
|
1543 | + protected function _process_registration_status_change(EE_Transaction $transaction, $REG_IDs = array()) { |
|
1544 | 1544 | // first if there is no change in status then we get out. |
1545 | 1545 | if ( |
1546 | - ! isset( $this->_req_data['txn_reg_status_change'], $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ) |
|
1546 | + ! isset($this->_req_data['txn_reg_status_change'], $this->_req_data['txn_reg_status_change']['reg_status']) |
|
1547 | 1547 | || $this->_req_data['txn_reg_status_change']['reg_status'] == 'NAN' |
1548 | 1548 | ) { |
1549 | 1549 | //no error message, no change requested, just nothing to do man. |
1550 | 1550 | return FALSE; |
1551 | 1551 | } |
1552 | 1552 | /** @type EE_Transaction_Processor $transaction_processor */ |
1553 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1553 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1554 | 1554 | // made it here dude? Oh WOW. K, let's take care of changing the statuses |
1555 | 1555 | return $transaction_processor->manually_update_registration_statuses( |
1556 | 1556 | $transaction, |
1557 | - sanitize_text_field( $this->_req_data[ 'txn_reg_status_change' ][ 'reg_status' ] ), |
|
1558 | - array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) |
|
1557 | + sanitize_text_field($this->_req_data['txn_reg_status_change']['reg_status']), |
|
1558 | + array(array('REG_ID' => array('IN', $REG_IDs))) |
|
1559 | 1559 | ); |
1560 | 1560 | } |
1561 | 1561 | |
@@ -1570,16 +1570,16 @@ discard block |
||
1570 | 1570 | * @param bool | null $delete_txn_reg_status_change |
1571 | 1571 | * @return array |
1572 | 1572 | */ |
1573 | - protected function _build_payment_json_response( EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null ) { |
|
1573 | + protected function _build_payment_json_response(EE_Payment $payment, $REG_IDs = array(), $delete_txn_reg_status_change = null) { |
|
1574 | 1574 | // was the payment deleted ? |
1575 | - if ( is_bool( $delete_txn_reg_status_change )) { |
|
1575 | + if (is_bool($delete_txn_reg_status_change)) { |
|
1576 | 1576 | return array( |
1577 | 1577 | 'PAY_ID' => $payment->ID(), |
1578 | 1578 | 'amount' => $payment->amount(), |
1579 | 1579 | 'total_paid' => $payment->transaction()->paid(), |
1580 | 1580 | 'txn_status' => $payment->transaction()->status_ID(), |
1581 | 1581 | 'pay_status' => $payment->STS_ID(), |
1582 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1582 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1583 | 1583 | 'delete_txn_reg_status_change' => $delete_txn_reg_status_change, |
1584 | 1584 | ); |
1585 | 1585 | } else { |
@@ -1591,16 +1591,16 @@ discard block |
||
1591 | 1591 | 'pay_status' => $payment->STS_ID(), |
1592 | 1592 | 'PAY_ID' => $payment->ID(), |
1593 | 1593 | 'STS_ID' => $payment->STS_ID(), |
1594 | - 'status' => self::$_pay_status[ $payment->STS_ID() ], |
|
1595 | - 'date' => $payment->timestamp( 'Y-m-d', 'h:i a' ), |
|
1596 | - 'method' => strtoupper( $payment->source() ), |
|
1594 | + 'status' => self::$_pay_status[$payment->STS_ID()], |
|
1595 | + 'date' => $payment->timestamp('Y-m-d', 'h:i a'), |
|
1596 | + 'method' => strtoupper($payment->source()), |
|
1597 | 1597 | 'PM_ID' => $payment->payment_method() ? $payment->payment_method()->ID() : 1, |
1598 | - 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__( "Unknown", 'event_espresso' ), |
|
1598 | + 'gateway' => $payment->payment_method() ? $payment->payment_method()->admin_name() : esc_html__("Unknown", 'event_espresso'), |
|
1599 | 1599 | 'gateway_response' => $payment->gateway_response(), |
1600 | 1600 | 'txn_id_chq_nmbr' => $payment->txn_id_chq_nmbr(), |
1601 | 1601 | 'po_number' => $payment->po_number(), |
1602 | 1602 | 'extra_accntng' => $payment->extra_accntng(), |
1603 | - 'registrations' => $this->_registration_payment_data_array( $REG_IDs ), |
|
1603 | + 'registrations' => $this->_registration_payment_data_array($REG_IDs), |
|
1604 | 1604 | ); |
1605 | 1605 | } |
1606 | 1606 | } |
@@ -1615,39 +1615,39 @@ discard block |
||
1615 | 1615 | * @return void |
1616 | 1616 | */ |
1617 | 1617 | public function delete_payment() { |
1618 | - $json_response_data = array( 'return_data' => FALSE ); |
|
1619 | - $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; |
|
1620 | - if ( $PAY_ID ) { |
|
1621 | - $delete_txn_reg_status_change = isset( $this->_req_data[ 'delete_txn_reg_status_change' ] ) ? $this->_req_data[ 'delete_txn_reg_status_change' ] : false; |
|
1622 | - $payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID ); |
|
1623 | - if ( $payment instanceof EE_Payment ) { |
|
1624 | - $REG_IDs = $this->_get_existing_reg_payment_REG_IDs( $payment ); |
|
1618 | + $json_response_data = array('return_data' => FALSE); |
|
1619 | + $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; |
|
1620 | + if ($PAY_ID) { |
|
1621 | + $delete_txn_reg_status_change = isset($this->_req_data['delete_txn_reg_status_change']) ? $this->_req_data['delete_txn_reg_status_change'] : false; |
|
1622 | + $payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID); |
|
1623 | + if ($payment instanceof EE_Payment) { |
|
1624 | + $REG_IDs = $this->_get_existing_reg_payment_REG_IDs($payment); |
|
1625 | 1625 | /** @type EE_Transaction_Payments $transaction_payments */ |
1626 | - $transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' ); |
|
1627 | - if ( $transaction_payments->delete_payment_and_update_transaction( $payment )) { |
|
1628 | - $json_response_data['return_data'] = $this->_build_payment_json_response( $payment, $REG_IDs, $delete_txn_reg_status_change ); |
|
1629 | - if ( $delete_txn_reg_status_change ) { |
|
1626 | + $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments'); |
|
1627 | + if ($transaction_payments->delete_payment_and_update_transaction($payment)) { |
|
1628 | + $json_response_data['return_data'] = $this->_build_payment_json_response($payment, $REG_IDs, $delete_txn_reg_status_change); |
|
1629 | + if ($delete_txn_reg_status_change) { |
|
1630 | 1630 | $this->_req_data['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1631 | 1631 | //MAKE sure we also add the delete_txn_req_status_change to the |
1632 | 1632 | //$_REQUEST global because that's how messages will be looking for it. |
1633 | 1633 | $_REQUEST['txn_reg_status_change'] = $delete_txn_reg_status_change; |
1634 | 1634 | $this->_maybe_send_notifications(); |
1635 | - $this->_process_registration_status_change( $payment->transaction(), $REG_IDs ); |
|
1635 | + $this->_process_registration_status_change($payment->transaction(), $REG_IDs); |
|
1636 | 1636 | } |
1637 | 1637 | } |
1638 | 1638 | } else { |
1639 | 1639 | EE_Error::add_error( |
1640 | - esc_html__( 'Valid Payment data could not be retrieved from the database.', 'event_espresso' ), |
|
1640 | + esc_html__('Valid Payment data could not be retrieved from the database.', 'event_espresso'), |
|
1641 | 1641 | __FILE__, __FUNCTION__, __LINE__ |
1642 | 1642 | ); |
1643 | 1643 | } |
1644 | 1644 | } else { |
1645 | 1645 | EE_Error::add_error( |
1646 | - esc_html__( 'A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso' ), |
|
1646 | + esc_html__('A valid Payment ID was not received, therefore payment form data could not be loaded.', 'event_espresso'), |
|
1647 | 1647 | __FILE__, __FUNCTION__, __LINE__ |
1648 | 1648 | ); |
1649 | 1649 | } |
1650 | - $notices = EE_Error::get_notices( false, false, false); |
|
1650 | + $notices = EE_Error::get_notices(false, false, false); |
|
1651 | 1651 | $this->_template_args = array( |
1652 | 1652 | 'data' => $json_response_data, |
1653 | 1653 | 'success' => $notices['success'], |
@@ -1667,16 +1667,16 @@ discard block |
||
1667 | 1667 | * @param array $REG_IDs |
1668 | 1668 | * @return array |
1669 | 1669 | */ |
1670 | - protected function _registration_payment_data_array( $REG_IDs ) { |
|
1670 | + protected function _registration_payment_data_array($REG_IDs) { |
|
1671 | 1671 | $registration_payment_data = array(); |
1672 | 1672 | //if non empty reg_ids lets get an array of registrations and update the values for the apply_payment/refund rows. |
1673 | - if ( ! empty( $REG_IDs ) ) { |
|
1674 | - $registrations = EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $REG_IDs ) ) ) ); |
|
1675 | - foreach ( $registrations as $registration ) { |
|
1676 | - if ( $registration instanceof EE_Registration ) { |
|
1677 | - $registration_payment_data[ $registration->ID() ] = array( |
|
1673 | + if ( ! empty($REG_IDs)) { |
|
1674 | + $registrations = EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $REG_IDs)))); |
|
1675 | + foreach ($registrations as $registration) { |
|
1676 | + if ($registration instanceof EE_Registration) { |
|
1677 | + $registration_payment_data[$registration->ID()] = array( |
|
1678 | 1678 | 'paid' => $registration->pretty_paid(), |
1679 | - 'owing' => EEH_Template::format_currency( $registration->final_price() - $registration->paid() ), |
|
1679 | + 'owing' => EEH_Template::format_currency($registration->final_price() - $registration->paid()), |
|
1680 | 1680 | ); |
1681 | 1681 | } |
1682 | 1682 | } |
@@ -1696,30 +1696,30 @@ discard block |
||
1696 | 1696 | * @access protected |
1697 | 1697 | * @param \EE_Payment | null $payment |
1698 | 1698 | */ |
1699 | - protected function _maybe_send_notifications( $payment = null ) { |
|
1700 | - switch ( $payment instanceof EE_Payment ) { |
|
1699 | + protected function _maybe_send_notifications($payment = null) { |
|
1700 | + switch ($payment instanceof EE_Payment) { |
|
1701 | 1701 | // payment notifications |
1702 | 1702 | case true : |
1703 | 1703 | if ( |
1704 | 1704 | isset( |
1705 | - $this->_req_data[ 'txn_payments' ], |
|
1706 | - $this->_req_data[ 'txn_payments' ][ 'send_notifications' ] |
|
1705 | + $this->_req_data['txn_payments'], |
|
1706 | + $this->_req_data['txn_payments']['send_notifications'] |
|
1707 | 1707 | ) && |
1708 | - filter_var( $this->_req_data[ 'txn_payments' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1708 | + filter_var($this->_req_data['txn_payments']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1709 | 1709 | ) { |
1710 | - $this->_process_payment_notification( $payment ); |
|
1710 | + $this->_process_payment_notification($payment); |
|
1711 | 1711 | } |
1712 | 1712 | break; |
1713 | 1713 | // registration notifications |
1714 | 1714 | case false : |
1715 | 1715 | if ( |
1716 | 1716 | isset( |
1717 | - $this->_req_data[ 'txn_reg_status_change' ], |
|
1718 | - $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ] |
|
1717 | + $this->_req_data['txn_reg_status_change'], |
|
1718 | + $this->_req_data['txn_reg_status_change']['send_notifications'] |
|
1719 | 1719 | ) && |
1720 | - filter_var( $this->_req_data[ 'txn_reg_status_change' ][ 'send_notifications' ], FILTER_VALIDATE_BOOLEAN ) |
|
1720 | + filter_var($this->_req_data['txn_reg_status_change']['send_notifications'], FILTER_VALIDATE_BOOLEAN) |
|
1721 | 1721 | ) { |
1722 | - add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true' ); |
|
1722 | + add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true'); |
|
1723 | 1723 | } |
1724 | 1724 | break; |
1725 | 1725 | } |
@@ -1735,11 +1735,11 @@ discard block |
||
1735 | 1735 | * @return void |
1736 | 1736 | */ |
1737 | 1737 | protected function _send_payment_reminder() { |
1738 | - $TXN_ID = ( ! empty( $this->_req_data['TXN_ID'] )) ? absint( $this->_req_data['TXN_ID'] ) : FALSE; |
|
1739 | - $transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1740 | - $query_args = isset($this->_req_data['redirect_to'] ) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID'] ) : array(); |
|
1741 | - do_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction ); |
|
1742 | - $this->_redirect_after_action( FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE ); |
|
1738 | + $TXN_ID = ( ! empty($this->_req_data['TXN_ID'])) ? absint($this->_req_data['TXN_ID']) : FALSE; |
|
1739 | + $transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1740 | + $query_args = isset($this->_req_data['redirect_to']) ? array('action' => $this->_req_data['redirect_to'], 'TXN_ID' => $this->_req_data['TXN_ID']) : array(); |
|
1741 | + do_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', $transaction); |
|
1742 | + $this->_redirect_after_action(FALSE, esc_html__('payment reminder', 'event_espresso'), esc_html__('sent', 'event_espresso'), $query_args, TRUE); |
|
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | |
@@ -1753,36 +1753,36 @@ discard block |
||
1753 | 1753 | * @param string $view |
1754 | 1754 | * @return mixed int = count || array of transaction objects |
1755 | 1755 | */ |
1756 | - public function get_transactions( $perpage, $count = FALSE, $view = '' ) { |
|
1756 | + public function get_transactions($perpage, $count = FALSE, $view = '') { |
|
1757 | 1757 | |
1758 | 1758 | $TXN = EEM_Transaction::instance(); |
1759 | 1759 | |
1760 | - $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' )); |
|
1761 | - $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' ); |
|
1760 | + $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')); |
|
1761 | + $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'); |
|
1762 | 1762 | |
1763 | 1763 | //make sure our timestamps start and end right at the boundaries for each day |
1764 | - $start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00'; |
|
1765 | - $end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59'; |
|
1764 | + $start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00'; |
|
1765 | + $end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59'; |
|
1766 | 1766 | |
1767 | 1767 | |
1768 | 1768 | //convert to timestamps |
1769 | - $start_date = strtotime( $start_date ); |
|
1770 | - $end_date = strtotime( $end_date ); |
|
1769 | + $start_date = strtotime($start_date); |
|
1770 | + $end_date = strtotime($end_date); |
|
1771 | 1771 | |
1772 | 1772 | //makes sure start date is the lowest value and vice versa |
1773 | - $start_date = min( $start_date, $end_date ); |
|
1774 | - $end_date = max( $start_date, $end_date ); |
|
1773 | + $start_date = min($start_date, $end_date); |
|
1774 | + $end_date = max($start_date, $end_date); |
|
1775 | 1775 | |
1776 | 1776 | //convert to correct format for query |
1777 | - $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' ); |
|
1778 | - $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' ); |
|
1777 | + $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'); |
|
1778 | + $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'); |
|
1779 | 1779 | |
1780 | 1780 | |
1781 | 1781 | |
1782 | 1782 | //set orderby |
1783 | 1783 | $this->_req_data['orderby'] = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
1784 | 1784 | |
1785 | - switch ( $this->_req_data['orderby'] ) { |
|
1785 | + switch ($this->_req_data['orderby']) { |
|
1786 | 1786 | case 'TXN_ID': |
1787 | 1787 | $orderby = 'TXN_ID'; |
1788 | 1788 | break; |
@@ -1796,78 +1796,78 @@ discard block |
||
1796 | 1796 | $orderby = 'TXN_timestamp'; |
1797 | 1797 | } |
1798 | 1798 | |
1799 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC'; |
|
1800 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1801 | - $per_page = isset( $perpage ) && !empty( $perpage ) ? $perpage : 10; |
|
1802 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1799 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC'; |
|
1800 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1801 | + $per_page = isset($perpage) && ! empty($perpage) ? $perpage : 10; |
|
1802 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1803 | 1803 | |
1804 | - $offset = ($current_page-1)*$per_page; |
|
1805 | - $limit = array( $offset, $per_page ); |
|
1804 | + $offset = ($current_page - 1) * $per_page; |
|
1805 | + $limit = array($offset, $per_page); |
|
1806 | 1806 | |
1807 | 1807 | $_where = array( |
1808 | - 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date) ), |
|
1808 | + 'TXN_timestamp' => array('BETWEEN', array($start_date, $end_date)), |
|
1809 | 1809 | 'Registration.REG_count' => 1 |
1810 | 1810 | ); |
1811 | 1811 | |
1812 | - if ( isset( $this->_req_data['EVT_ID'] ) ) { |
|
1812 | + if (isset($this->_req_data['EVT_ID'])) { |
|
1813 | 1813 | $_where['Registration.EVT_ID'] = $this->_req_data['EVT_ID']; |
1814 | 1814 | } |
1815 | 1815 | |
1816 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1817 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
1816 | + if (isset($this->_req_data['s'])) { |
|
1817 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
1818 | 1818 | $_where['OR'] = array( |
1819 | - 'Registration.Event.EVT_name' => array( 'LIKE', $search_string ), |
|
1820 | - 'Registration.Event.EVT_desc' => array( 'LIKE', $search_string ), |
|
1821 | - 'Registration.Event.EVT_short_desc' => array( 'LIKE' , $search_string ), |
|
1822 | - 'Registration.Attendee.ATT_full_name' => array( 'LIKE', $search_string ), |
|
1823 | - 'Registration.Attendee.ATT_fname' => array( 'LIKE', $search_string ), |
|
1824 | - 'Registration.Attendee.ATT_lname' => array( 'LIKE', $search_string ), |
|
1825 | - 'Registration.Attendee.ATT_short_bio' => array( 'LIKE', $search_string ), |
|
1826 | - 'Registration.Attendee.ATT_email' => array('LIKE', $search_string ), |
|
1827 | - 'Registration.Attendee.ATT_address' => array( 'LIKE', $search_string ), |
|
1828 | - 'Registration.Attendee.ATT_address2' => array( 'LIKE', $search_string ), |
|
1829 | - 'Registration.Attendee.ATT_city' => array( 'LIKE', $search_string ), |
|
1830 | - 'Registration.REG_final_price' => array( 'LIKE', $search_string ), |
|
1831 | - 'Registration.REG_code' => array( 'LIKE', $search_string ), |
|
1832 | - 'Registration.REG_count' => array( 'LIKE' , $search_string ), |
|
1833 | - 'Registration.REG_group_size' => array( 'LIKE' , $search_string ), |
|
1834 | - 'Registration.Ticket.TKT_name' => array( 'LIKE', $search_string ), |
|
1835 | - 'Registration.Ticket.TKT_description' => array( 'LIKE', $search_string ), |
|
1836 | - 'Payment.PAY_source' => array('LIKE', $search_string ), |
|
1837 | - 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string ), |
|
1838 | - 'TXN_session_data' => array( 'LIKE', $search_string ), |
|
1839 | - 'Payment.PAY_txn_id_chq_nmbr' => array( 'LIKE', $search_string ) |
|
1819 | + 'Registration.Event.EVT_name' => array('LIKE', $search_string), |
|
1820 | + 'Registration.Event.EVT_desc' => array('LIKE', $search_string), |
|
1821 | + 'Registration.Event.EVT_short_desc' => array('LIKE', $search_string), |
|
1822 | + 'Registration.Attendee.ATT_full_name' => array('LIKE', $search_string), |
|
1823 | + 'Registration.Attendee.ATT_fname' => array('LIKE', $search_string), |
|
1824 | + 'Registration.Attendee.ATT_lname' => array('LIKE', $search_string), |
|
1825 | + 'Registration.Attendee.ATT_short_bio' => array('LIKE', $search_string), |
|
1826 | + 'Registration.Attendee.ATT_email' => array('LIKE', $search_string), |
|
1827 | + 'Registration.Attendee.ATT_address' => array('LIKE', $search_string), |
|
1828 | + 'Registration.Attendee.ATT_address2' => array('LIKE', $search_string), |
|
1829 | + 'Registration.Attendee.ATT_city' => array('LIKE', $search_string), |
|
1830 | + 'Registration.REG_final_price' => array('LIKE', $search_string), |
|
1831 | + 'Registration.REG_code' => array('LIKE', $search_string), |
|
1832 | + 'Registration.REG_count' => array('LIKE', $search_string), |
|
1833 | + 'Registration.REG_group_size' => array('LIKE', $search_string), |
|
1834 | + 'Registration.Ticket.TKT_name' => array('LIKE', $search_string), |
|
1835 | + 'Registration.Ticket.TKT_description' => array('LIKE', $search_string), |
|
1836 | + 'Payment.PAY_source' => array('LIKE', $search_string), |
|
1837 | + 'Payment.Payment_Method.PMD_name' => array('LIKE', $search_string), |
|
1838 | + 'TXN_session_data' => array('LIKE', $search_string), |
|
1839 | + 'Payment.PAY_txn_id_chq_nmbr' => array('LIKE', $search_string) |
|
1840 | 1840 | ); |
1841 | 1841 | } |
1842 | 1842 | |
1843 | 1843 | //failed transactions |
1844 | - $failed = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'failed' && ! $count ) |
|
1845 | - || ( $count && $view == 'failed' ) |
|
1844 | + $failed = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'failed' && ! $count) |
|
1845 | + || ($count && $view == 'failed') |
|
1846 | 1846 | ? TRUE |
1847 | 1847 | : FALSE; |
1848 | - $abandoned = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'abandoned' && ! $count ) |
|
1849 | - || ( $count && $view == 'abandoned' ) |
|
1848 | + $abandoned = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'abandoned' && ! $count) |
|
1849 | + || ($count && $view == 'abandoned') |
|
1850 | 1850 | ? TRUE |
1851 | 1851 | : FALSE; |
1852 | - $overpaid = ( ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] == 'overpaid' && ! $count ) |
|
1853 | - || ( $count && $view == 'overpaid' ) |
|
1852 | + $overpaid = ( ! empty($this->_req_data['status']) && $this->_req_data['status'] == 'overpaid' && ! $count) |
|
1853 | + || ($count && $view == 'overpaid') |
|
1854 | 1854 | ? TRUE |
1855 | 1855 | : FALSE; |
1856 | 1856 | |
1857 | - if ( $failed ) { |
|
1858 | - $_where[ 'STS_ID' ] = EEM_Transaction::failed_status_code; |
|
1859 | - } else if ( $abandoned ) { |
|
1857 | + if ($failed) { |
|
1858 | + $_where['STS_ID'] = EEM_Transaction::failed_status_code; |
|
1859 | + } else if ($abandoned) { |
|
1860 | 1860 | $_where['STS_ID'] = EEM_Transaction::abandoned_status_code; |
1861 | - } else if ( $overpaid ) { |
|
1861 | + } else if ($overpaid) { |
|
1862 | 1862 | $_where['STS_ID'] = EEM_Transaction::overpaid_status_code; |
1863 | 1863 | } else { |
1864 | - $_where['STS_ID'] = array( '!=', EEM_Transaction::failed_status_code ); |
|
1865 | - $_where['STS_ID*'] = array( '!=', EEM_Transaction::abandoned_status_code ); |
|
1864 | + $_where['STS_ID'] = array('!=', EEM_Transaction::failed_status_code); |
|
1865 | + $_where['STS_ID*'] = array('!=', EEM_Transaction::abandoned_status_code); |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | - $query_params = array( $_where, 'order_by' => array( $orderby => $sort ), 'limit' => $limit ); |
|
1868 | + $query_params = array($_where, 'order_by' => array($orderby => $sort), 'limit' => $limit); |
|
1869 | 1869 | |
1870 | - $transactions = $count ? $TXN->count( array($_where), 'TXN_ID', TRUE ) : $TXN->get_all($query_params); |
|
1870 | + $transactions = $count ? $TXN->count(array($_where), 'TXN_ID', TRUE) : $TXN->get_all($query_params); |
|
1871 | 1871 | |
1872 | 1872 | |
1873 | 1873 | return $transactions; |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | |
221 | 221 | |
222 | 222 | /** |
223 | - * detect_if_activation_or_upgrade |
|
224 | - * |
|
225 | - * Takes care of detecting whether this is a brand new install or code upgrade, |
|
226 | - * and either setting up the DB or setting up maintenance mode etc. |
|
227 | - * |
|
228 | - * @access public |
|
229 | - * @return void |
|
230 | - */ |
|
223 | + * detect_if_activation_or_upgrade |
|
224 | + * |
|
225 | + * Takes care of detecting whether this is a brand new install or code upgrade, |
|
226 | + * and either setting up the DB or setting up maintenance mode etc. |
|
227 | + * |
|
228 | + * @access public |
|
229 | + * @return void |
|
230 | + */ |
|
231 | 231 | public function detect_if_activation_or_upgrade() { |
232 | 232 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
233 | 233 | |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | $query_params = array( 'page' => 'espresso_about' ); |
535 | 535 | |
536 | 536 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
537 | - $query_params['new_activation'] = TRUE; |
|
537 | + $query_params['new_activation'] = TRUE; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
541 | - $query_params['reactivation'] = TRUE; |
|
541 | + $query_params['reactivation'] = TRUE; |
|
542 | 542 | } |
543 | 543 | $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
544 | 544 | wp_safe_redirect( $url ); |
@@ -641,11 +641,11 @@ discard block |
||
641 | 641 | |
642 | 642 | |
643 | 643 | /** |
644 | - * _incompatible_addon_error |
|
645 | - * |
|
646 | - * @access public |
|
647 | - * @return void |
|
648 | - */ |
|
644 | + * _incompatible_addon_error |
|
645 | + * |
|
646 | + * @access public |
|
647 | + * @return void |
|
648 | + */ |
|
649 | 649 | private function _incompatible_addon_error() { |
650 | 650 | // get array of classes hooking into here |
651 | 651 | $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
@@ -768,14 +768,14 @@ discard block |
||
768 | 768 | |
769 | 769 | |
770 | 770 | /** |
771 | - * load_controllers |
|
772 | - * |
|
773 | - * this is the best place to load any additional controllers that needs access to EE core. |
|
774 | - * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
775 | - * |
|
776 | - * @access public |
|
777 | - * @return void |
|
778 | - */ |
|
771 | + * load_controllers |
|
772 | + * |
|
773 | + * this is the best place to load any additional controllers that needs access to EE core. |
|
774 | + * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time |
|
775 | + * |
|
776 | + * @access public |
|
777 | + * @return void |
|
778 | + */ |
|
779 | 779 | public function load_controllers() { |
780 | 780 | do_action( 'AHEE__EE_System__load_controllers__start' ); |
781 | 781 | // let's get it started |
@@ -785,12 +785,12 @@ discard block |
||
785 | 785 | } else if ( ! EE_FRONT_AJAX ) { |
786 | 786 | do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
787 | 787 | EE_Registry::instance()->load_core( 'Admin' ); |
788 | - $action_item_manager = new ActionItemManager( |
|
789 | - new CapabilitiesChecker( |
|
790 | - EE_Registry::instance()->load_core( 'Capabilities' ) |
|
791 | - ) |
|
792 | - ); |
|
793 | - $action_item_manager->setConditionCheckHooks(); |
|
788 | + $action_item_manager = new ActionItemManager( |
|
789 | + new CapabilitiesChecker( |
|
790 | + EE_Registry::instance()->load_core( 'Capabilities' ) |
|
791 | + ) |
|
792 | + ); |
|
793 | + $action_item_manager->setConditionCheckHooks(); |
|
794 | 794 | } |
795 | 795 | do_action( 'AHEE__EE_System__load_controllers__complete' ); |
796 | 796 | } |
@@ -798,13 +798,13 @@ discard block |
||
798 | 798 | |
799 | 799 | |
800 | 800 | /** |
801 | - * core_loaded_and_ready |
|
802 | - * |
|
803 | - * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
804 | - * |
|
805 | - * @access public |
|
806 | - * @return void |
|
807 | - */ |
|
801 | + * core_loaded_and_ready |
|
802 | + * |
|
803 | + * all of the basic EE core should be loaded at this point and available regardless of M-Mode |
|
804 | + * |
|
805 | + * @access public |
|
806 | + * @return void |
|
807 | + */ |
|
808 | 808 | public function core_loaded_and_ready() { |
809 | 809 | do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
810 | 810 | do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
@@ -815,13 +815,13 @@ discard block |
||
815 | 815 | |
816 | 816 | |
817 | 817 | /** |
818 | - * initialize |
|
819 | - * |
|
820 | - * this is the best place to begin initializing client code |
|
821 | - * |
|
822 | - * @access public |
|
823 | - * @return void |
|
824 | - */ |
|
818 | + * initialize |
|
819 | + * |
|
820 | + * this is the best place to begin initializing client code |
|
821 | + * |
|
822 | + * @access public |
|
823 | + * @return void |
|
824 | + */ |
|
825 | 825 | public function initialize() { |
826 | 826 | do_action( 'AHEE__EE_System__initialize' ); |
827 | 827 | } |
@@ -829,13 +829,13 @@ discard block |
||
829 | 829 | |
830 | 830 | |
831 | 831 | /** |
832 | - * initialize_last |
|
833 | - * |
|
834 | - * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
835 | - * |
|
836 | - * @access public |
|
837 | - * @return void |
|
838 | - */ |
|
832 | + * initialize_last |
|
833 | + * |
|
834 | + * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so |
|
835 | + * |
|
836 | + * @access public |
|
837 | + * @return void |
|
838 | + */ |
|
839 | 839 | public function initialize_last() { |
840 | 840 | do_action( 'AHEE__EE_System__initialize_last' ); |
841 | 841 | } |
@@ -844,14 +844,14 @@ discard block |
||
844 | 844 | |
845 | 845 | |
846 | 846 | /** |
847 | - * set_hooks_for_shortcodes_modules_and_addons |
|
848 | - * |
|
849 | - * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
850 | - * this happens at the very beginning of the wp_loaded hookpoint |
|
851 | - * |
|
852 | - * @access public |
|
853 | - * @return void |
|
854 | - */ |
|
847 | + * set_hooks_for_shortcodes_modules_and_addons |
|
848 | + * |
|
849 | + * this is the best place for other systems to set callbacks for hooking into other parts of EE |
|
850 | + * this happens at the very beginning of the wp_loaded hookpoint |
|
851 | + * |
|
852 | + * @access public |
|
853 | + * @return void |
|
854 | + */ |
|
855 | 855 | public function set_hooks_for_shortcodes_modules_and_addons() { |
856 | 856 | // do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
857 | 857 | } |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | |
861 | 861 | |
862 | 862 | /** |
863 | - * do_not_cache |
|
864 | - * |
|
865 | - * sets no cache headers and defines no cache constants for WP plugins |
|
866 | - * |
|
867 | - * @access public |
|
868 | - * @return void |
|
869 | - */ |
|
863 | + * do_not_cache |
|
864 | + * |
|
865 | + * sets no cache headers and defines no cache constants for WP plugins |
|
866 | + * |
|
867 | + * @access public |
|
868 | + * @return void |
|
869 | + */ |
|
870 | 870 | public static function do_not_cache() { |
871 | 871 | // set no cache constants |
872 | 872 | if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | //Current post |
988 | 988 | global $post; |
989 | 989 | |
990 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
990 | + if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
991 | 991 | //Events Edit Current Event |
992 | 992 | $admin_bar->add_menu(array( |
993 | 993 | 'id' => 'espresso-toolbar-events-edit', |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * @param \EE_Registry $Registry |
92 | 92 | * @return \EE_System |
93 | 93 | */ |
94 | - public static function instance( EE_Registry $Registry = null ) { |
|
94 | + public static function instance(EE_Registry $Registry = null) { |
|
95 | 95 | // check if class object is instantiated |
96 | - if ( ! self::$_instance instanceof EE_System ) { |
|
97 | - self::$_instance = new self( $Registry ); |
|
96 | + if ( ! self::$_instance instanceof EE_System) { |
|
97 | + self::$_instance = new self($Registry); |
|
98 | 98 | } |
99 | 99 | return self::$_instance; |
100 | 100 | } |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | * resets the instance and returns it |
105 | 105 | * @return EE_System |
106 | 106 | */ |
107 | - public static function reset(){ |
|
107 | + public static function reset() { |
|
108 | 108 | self::$_instance->_req_type = NULL; |
109 | 109 | |
110 | 110 | //make sure none of the old hooks are left hanging around |
111 | - remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
111 | + remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
112 | 112 | |
113 | 113 | //we need to reset the migration manager in order for it to detect DMSs properly |
114 | 114 | EE_Data_Migration_Manager::reset(); |
@@ -128,28 +128,28 @@ discard block |
||
128 | 128 | * @access private |
129 | 129 | * @param \EE_Registry $Registry |
130 | 130 | */ |
131 | - private function __construct( EE_Registry $Registry ) { |
|
131 | + private function __construct(EE_Registry $Registry) { |
|
132 | 132 | $this->registry = $Registry; |
133 | - do_action( 'AHEE__EE_System__construct__begin', $this ); |
|
133 | + do_action('AHEE__EE_System__construct__begin', $this); |
|
134 | 134 | // allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc |
135 | - add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) ); |
|
135 | + add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons')); |
|
136 | 136 | // when an ee addon is activated, we want to call the core hook(s) again |
137 | 137 | // because the newly-activated addon didn't get a chance to run at all |
138 | - add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 ); |
|
138 | + add_action('activate_plugin', array($this, 'load_espresso_addons'), 1); |
|
139 | 139 | // detect whether install or upgrade |
140 | - add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 ); |
|
140 | + add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3); |
|
141 | 141 | // load EE_Config, EE_Textdomain, etc |
142 | - add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 ); |
|
142 | + add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5); |
|
143 | 143 | // load EE_Config, EE_Textdomain, etc |
144 | - add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 ); |
|
144 | + add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7); |
|
145 | 145 | // you wanna get going? I wanna get going... let's get going! |
146 | - add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 ); |
|
146 | + add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9); |
|
147 | 147 | //other housekeeping |
148 | 148 | //exclude EE critical pages from wp_list_pages |
149 | - add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 ); |
|
149 | + add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10); |
|
150 | 150 | // ALL EE Addons should use the following hook point to attach their initial setup too |
151 | 151 | // it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads |
152 | - do_action( 'AHEE__EE_System__construct__complete', $this ); |
|
152 | + do_action('AHEE__EE_System__construct__complete', $this); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -169,30 +169,30 @@ discard block |
||
169 | 169 | public function load_espresso_addons() { |
170 | 170 | // set autoloaders for all of the classes implementing EEI_Plugin_API |
171 | 171 | // which provide helpers for EE plugin authors to more easily register certain components with EE. |
172 | - EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' ); |
|
172 | + EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api'); |
|
173 | 173 | //load and setup EE_Capabilities |
174 | - $this->registry->load_core( 'Capabilities' ); |
|
174 | + $this->registry->load_core('Capabilities'); |
|
175 | 175 | //caps need to be initialized on every request so that capability maps are set. |
176 | 176 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/8674 |
177 | 177 | $this->registry->CAP->init_caps(); |
178 | - do_action( 'AHEE__EE_System__load_espresso_addons' ); |
|
178 | + do_action('AHEE__EE_System__load_espresso_addons'); |
|
179 | 179 | //if the WP API basic auth plugin isn't already loaded, load it now. |
180 | 180 | //We want it for mobile apps. Just include the entire plugin |
181 | 181 | //also, don't load the basic auth when a plugin is getting activated, because |
182 | 182 | //it could be the basic auth plugin, and it doesn't check if its methods are already defined |
183 | 183 | //and causes a fatal error |
184 | - if( !function_exists( 'json_basic_auth_handler' ) |
|
185 | - && ! function_exists( 'json_basic_auth_error' ) |
|
184 | + if ( ! function_exists('json_basic_auth_handler') |
|
185 | + && ! function_exists('json_basic_auth_error') |
|
186 | 186 | && ! ( |
187 | - isset( $_GET[ 'action'] ) |
|
188 | - && in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) ) |
|
187 | + isset($_GET['action']) |
|
188 | + && in_array($_GET['action'], array('activate', 'activate-selected')) |
|
189 | 189 | ) |
190 | 190 | && ! ( |
191 | - isset( $_GET['activate' ] ) |
|
192 | - && $_GET['activate' ] === 'true' |
|
191 | + isset($_GET['activate']) |
|
192 | + && $_GET['activate'] === 'true' |
|
193 | 193 | ) |
194 | 194 | ) { |
195 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php'; |
|
195 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php'; |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | * @access public |
209 | 209 | * @return void |
210 | 210 | */ |
211 | - public function detect_activations_or_upgrades(){ |
|
211 | + public function detect_activations_or_upgrades() { |
|
212 | 212 | //first off: let's make sure to handle core |
213 | 213 | $this->detect_if_activation_or_upgrade(); |
214 | - foreach($this->registry->addons as $addon){ |
|
214 | + foreach ($this->registry->addons as $addon) { |
|
215 | 215 | //detect teh request type for that addon |
216 | 216 | $addon->detect_activation_or_upgrade(); |
217 | 217 | } |
@@ -232,41 +232,41 @@ discard block |
||
232 | 232 | do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin'); |
233 | 233 | |
234 | 234 | // load M-Mode class |
235 | - $this->registry->load_core( 'Maintenance_Mode' ); |
|
235 | + $this->registry->load_core('Maintenance_Mode'); |
|
236 | 236 | // check if db has been updated, or if its a brand-new installation |
237 | 237 | |
238 | 238 | $espresso_db_update = $this->fix_espresso_db_upgrade_option(); |
239 | - $request_type = $this->detect_req_type($espresso_db_update); |
|
239 | + $request_type = $this->detect_req_type($espresso_db_update); |
|
240 | 240 | //EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ ); |
241 | 241 | |
242 | - switch($request_type){ |
|
242 | + switch ($request_type) { |
|
243 | 243 | case EE_System::req_type_new_activation: |
244 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' ); |
|
245 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
244 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation'); |
|
245 | + $this->_handle_core_version_change($espresso_db_update); |
|
246 | 246 | break; |
247 | 247 | case EE_System::req_type_reactivation: |
248 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' ); |
|
249 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
248 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation'); |
|
249 | + $this->_handle_core_version_change($espresso_db_update); |
|
250 | 250 | break; |
251 | 251 | case EE_System::req_type_upgrade: |
252 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' ); |
|
252 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade'); |
|
253 | 253 | //migrations may be required now that we've upgraded |
254 | 254 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
255 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
255 | + $this->_handle_core_version_change($espresso_db_update); |
|
256 | 256 | // echo "done upgrade";die; |
257 | 257 | break; |
258 | 258 | case EE_System::req_type_downgrade: |
259 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' ); |
|
259 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade'); |
|
260 | 260 | //its possible migrations are no longer required |
261 | 261 | EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old(); |
262 | - $this->_handle_core_version_change( $espresso_db_update ); |
|
262 | + $this->_handle_core_version_change($espresso_db_update); |
|
263 | 263 | break; |
264 | 264 | case EE_System::req_type_normal: |
265 | 265 | default: |
266 | 266 | // $this->_maybe_redirect_to_ee_about(); |
267 | 267 | break; |
268 | 268 | } |
269 | - do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' ); |
|
269 | + do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete'); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -274,10 +274,10 @@ discard block |
||
274 | 274 | * initializing the database later during the request |
275 | 275 | * @param array $espresso_db_update |
276 | 276 | */ |
277 | - protected function _handle_core_version_change( $espresso_db_update ){ |
|
278 | - $this->update_list_of_installed_versions( $espresso_db_update ); |
|
277 | + protected function _handle_core_version_change($espresso_db_update) { |
|
278 | + $this->update_list_of_installed_versions($espresso_db_update); |
|
279 | 279 | //get ready to verify the DB is ok (provided we aren't in maintenance mode, of course) |
280 | - add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' )); |
|
280 | + add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required')); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -292,44 +292,44 @@ discard block |
||
292 | 292 | * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table |
293 | 293 | * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction |
294 | 294 | */ |
295 | - private function fix_espresso_db_upgrade_option($espresso_db_update = null){ |
|
296 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update ); |
|
297 | - if( ! $espresso_db_update){ |
|
298 | - $espresso_db_update = get_option( 'espresso_db_update' ); |
|
295 | + private function fix_espresso_db_upgrade_option($espresso_db_update = null) { |
|
296 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update); |
|
297 | + if ( ! $espresso_db_update) { |
|
298 | + $espresso_db_update = get_option('espresso_db_update'); |
|
299 | 299 | } |
300 | 300 | // check that option is an array |
301 | - if( ! is_array( $espresso_db_update )) { |
|
301 | + if ( ! is_array($espresso_db_update)) { |
|
302 | 302 | // if option is FALSE, then it never existed |
303 | - if ( $espresso_db_update === FALSE ) { |
|
303 | + if ($espresso_db_update === FALSE) { |
|
304 | 304 | // make $espresso_db_update an array and save option with autoload OFF |
305 | - $espresso_db_update = array(); |
|
306 | - add_option( 'espresso_db_update', $espresso_db_update, '', 'no' ); |
|
305 | + $espresso_db_update = array(); |
|
306 | + add_option('espresso_db_update', $espresso_db_update, '', 'no'); |
|
307 | 307 | } else { |
308 | 308 | // option is NOT FALSE but also is NOT an array, so make it an array and save it |
309 | - $espresso_db_update = array( $espresso_db_update=>array() ); |
|
310 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
309 | + $espresso_db_update = array($espresso_db_update=>array()); |
|
310 | + update_option('espresso_db_update', $espresso_db_update); |
|
311 | 311 | } |
312 | - }else{ |
|
312 | + } else { |
|
313 | 313 | $corrected_db_update = array(); |
314 | 314 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
315 | - foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
|
316 | - if(is_int($should_be_version_string) && ! is_array($should_be_array)){ |
|
315 | + foreach ($espresso_db_update as $should_be_version_string => $should_be_array) { |
|
316 | + if (is_int($should_be_version_string) && ! is_array($should_be_array)) { |
|
317 | 317 | //the key is an int, and the value IS NOT an array |
318 | 318 | //so it must be numerically-indexed, where values are versions installed... |
319 | 319 | //fix it! |
320 | 320 | $version_string = $should_be_array; |
321 | 321 | $corrected_db_update[$version_string] = array('unknown-date'); |
322 | - }else{ |
|
322 | + } else { |
|
323 | 323 | //ok it checks out |
324 | 324 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
325 | 325 | } |
326 | 326 | } |
327 | 327 | $espresso_db_update = $corrected_db_update; |
328 | - update_option( 'espresso_db_update', $espresso_db_update ); |
|
328 | + update_option('espresso_db_update', $espresso_db_update); |
|
329 | 329 | |
330 | 330 | } |
331 | 331 | |
332 | - do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update ); |
|
332 | + do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update); |
|
333 | 333 | return $espresso_db_update; |
334 | 334 | } |
335 | 335 | |
@@ -349,34 +349,34 @@ discard block |
||
349 | 349 | * so we prefer to only do it when necessary |
350 | 350 | * @return void |
351 | 351 | */ |
352 | - public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){ |
|
352 | + public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) { |
|
353 | 353 | $request_type = $this->detect_req_type(); |
354 | 354 | //only initialize system if we're not in maintenance mode. |
355 | - if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){ |
|
356 | - update_option( 'ee_flush_rewrite_rules', TRUE ); |
|
355 | + if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
356 | + update_option('ee_flush_rewrite_rules', TRUE); |
|
357 | 357 | |
358 | - if( $verify_schema ) { |
|
358 | + if ($verify_schema) { |
|
359 | 359 | EEH_Activation::initialize_db_and_folders(); |
360 | 360 | } |
361 | 361 | EEH_Activation::initialize_db_content(); |
362 | 362 | EEH_Activation::system_initialization(); |
363 | - if( $initialize_addons_too ) { |
|
363 | + if ($initialize_addons_too) { |
|
364 | 364 | $this->initialize_addons(); |
365 | 365 | } |
366 | - }else{ |
|
367 | - EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
|
366 | + } else { |
|
367 | + EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core'); |
|
368 | 368 | } |
369 | - if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
|
370 | - add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 ); |
|
369 | + if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) { |
|
370 | + add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | 374 | /** |
375 | 375 | * Initializes the db for all registered addons |
376 | 376 | */ |
377 | - public function initialize_addons(){ |
|
377 | + public function initialize_addons() { |
|
378 | 378 | //foreach registered addon, make sure its db is up-to-date too |
379 | - foreach($this->registry->addons as $addon){ |
|
379 | + foreach ($this->registry->addons as $addon) { |
|
380 | 380 | $addon->initialize_db_if_no_migrations_required(); |
381 | 381 | } |
382 | 382 | } |
@@ -388,16 +388,16 @@ discard block |
||
388 | 388 | * @param string $current_version_to_add version to be added to the version history |
389 | 389 | * @return boolean success as to whether or not this option was changed |
390 | 390 | */ |
391 | - public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) { |
|
392 | - if( ! $version_history ) { |
|
391 | + public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) { |
|
392 | + if ( ! $version_history) { |
|
393 | 393 | $version_history = $this->fix_espresso_db_upgrade_option($version_history); |
394 | 394 | } |
395 | - if( $current_version_to_add == NULL){ |
|
395 | + if ($current_version_to_add == NULL) { |
|
396 | 396 | $current_version_to_add = espresso_version(); |
397 | 397 | } |
398 | - $version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() ); |
|
398 | + $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time()); |
|
399 | 399 | // re-save |
400 | - return update_option( 'espresso_db_update', $version_history ); |
|
400 | + return update_option('espresso_db_update', $version_history); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | * but still know if this is a new install or not |
415 | 415 | * @return int one of the constants on EE_System::req_type_ |
416 | 416 | */ |
417 | - public function detect_req_type( $espresso_db_update = NULL ){ |
|
418 | - if ( $this->_req_type === NULL ){ |
|
419 | - $espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
420 | - $this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() ); |
|
417 | + public function detect_req_type($espresso_db_update = NULL) { |
|
418 | + if ($this->_req_type === NULL) { |
|
419 | + $espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option(); |
|
420 | + $this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version()); |
|
421 | 421 | } |
422 | 422 | return $this->_req_type; |
423 | 423 | } |
@@ -433,39 +433,39 @@ discard block |
||
433 | 433 | * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version()) |
434 | 434 | * @return int one of the constants on EE_System::req_type_* |
435 | 435 | */ |
436 | - public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){ |
|
437 | - $version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ); |
|
438 | - if( $activation_history_for_addon ){ |
|
436 | + public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) { |
|
437 | + $version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to); |
|
438 | + if ($activation_history_for_addon) { |
|
439 | 439 | //it exists, so this isn't a completely new install |
440 | 440 | //check if this version already in that list of previously installed versions |
441 | - if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) { |
|
441 | + if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) { |
|
442 | 442 | //it a version we haven't seen before |
443 | - if( $version_is_higher === 1 ){ |
|
443 | + if ($version_is_higher === 1) { |
|
444 | 444 | $req_type = EE_System::req_type_upgrade; |
445 | - }else{ |
|
445 | + } else { |
|
446 | 446 | $req_type = EE_System::req_type_downgrade; |
447 | 447 | } |
448 | - delete_option( $activation_indicator_option_name ); |
|
448 | + delete_option($activation_indicator_option_name); |
|
449 | 449 | } else { |
450 | 450 | // its not an update. maybe a reactivation? |
451 | - if( get_option( $activation_indicator_option_name, FALSE ) ){ |
|
452 | - if ( $version_is_higher === -1 ){ |
|
451 | + if (get_option($activation_indicator_option_name, FALSE)) { |
|
452 | + if ($version_is_higher === -1) { |
|
453 | 453 | $req_type = EE_System::req_type_downgrade; |
454 | - }elseif( $version_is_higher === 0 ){ |
|
454 | + }elseif ($version_is_higher === 0) { |
|
455 | 455 | //we've seen this version before, but it's an activation. must be a reactivation |
456 | 456 | $req_type = EE_System::req_type_reactivation; |
457 | - }else{//$version_is_higher === 1 |
|
457 | + } else {//$version_is_higher === 1 |
|
458 | 458 | $req_type = EE_System::req_type_upgrade; |
459 | 459 | } |
460 | - delete_option( $activation_indicator_option_name ); |
|
460 | + delete_option($activation_indicator_option_name); |
|
461 | 461 | } else { |
462 | 462 | //we've seen this version before and the activation indicate doesn't show it was just activated |
463 | - if ( $version_is_higher === -1 ){ |
|
463 | + if ($version_is_higher === -1) { |
|
464 | 464 | $req_type = EE_System::req_type_downgrade; |
465 | - }elseif( $version_is_higher === 0 ){ |
|
465 | + }elseif ($version_is_higher === 0) { |
|
466 | 466 | //we've seen this version before and it's not an activation. its normal request |
467 | 467 | $req_type = EE_System::req_type_normal; |
468 | - }else{//$version_is_higher === 1 |
|
468 | + } else {//$version_is_higher === 1 |
|
469 | 469 | $req_type = EE_System::req_type_upgrade; |
470 | 470 | } |
471 | 471 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | } else { |
474 | 474 | //brand new install |
475 | 475 | $req_type = EE_System::req_type_new_activation; |
476 | - delete_option( $activation_indicator_option_name ); |
|
476 | + delete_option($activation_indicator_option_name); |
|
477 | 477 | } |
478 | 478 | return $req_type; |
479 | 479 | } |
@@ -491,30 +491,30 @@ discard block |
||
491 | 491 | * 0 if $version_to_upgrade_to MATCHES (reactivation or normal request); |
492 | 492 | * 1 if $version_to_upgrade_to is HIGHER (upgrade) ; |
493 | 493 | */ |
494 | - protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){ |
|
494 | + protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) { |
|
495 | 495 | //find the most recently-activated version |
496 | 496 | $most_recently_active_version_activation = '1970-01-01 00:00:00'; |
497 | 497 | $most_recently_active_version = '0.0.0.dev.000'; |
498 | - if( is_array( $activation_history_for_addon ) ){ |
|
499 | - foreach( $activation_history_for_addon as $version => $times_activated ){ |
|
498 | + if (is_array($activation_history_for_addon)) { |
|
499 | + foreach ($activation_history_for_addon as $version => $times_activated) { |
|
500 | 500 | //check there is a record of when this version was activated. Otherwise, |
501 | 501 | //mark it as unknown |
502 | - if( ! $times_activated ){ |
|
503 | - $times_activated = array( 'unknown-date'); |
|
502 | + if ( ! $times_activated) { |
|
503 | + $times_activated = array('unknown-date'); |
|
504 | 504 | } |
505 | - if( is_string( $times_activated ) ){ |
|
506 | - $times_activated = array( $times_activated ); |
|
505 | + if (is_string($times_activated)) { |
|
506 | + $times_activated = array($times_activated); |
|
507 | 507 | } |
508 | - foreach( $times_activated as $an_activation ){ |
|
509 | - if( $an_activation != 'unknown-date' && |
|
510 | - $an_activation > $most_recently_active_version_activation ){ |
|
508 | + foreach ($times_activated as $an_activation) { |
|
509 | + if ($an_activation != 'unknown-date' && |
|
510 | + $an_activation > $most_recently_active_version_activation) { |
|
511 | 511 | $most_recently_active_version = $version; |
512 | 512 | $most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation; |
513 | 513 | } |
514 | 514 | } |
515 | 515 | } |
516 | 516 | } |
517 | - return version_compare( $version_to_upgrade_to, $most_recently_active_version ); |
|
517 | + return version_compare($version_to_upgrade_to, $most_recently_active_version); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -524,24 +524,24 @@ discard block |
||
524 | 524 | * @return void |
525 | 525 | */ |
526 | 526 | public function redirect_to_about_ee() { |
527 | - $notices = EE_Error::get_notices( FALSE ); |
|
527 | + $notices = EE_Error::get_notices(FALSE); |
|
528 | 528 | //if current user is an admin and it's not an ajax request |
529 | 529 | if ( |
530 | - $this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) |
|
531 | - && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) |
|
532 | - && ! isset( $notices[ 'errors' ] ) |
|
530 | + $this->registry->CAP->current_user_can('manage_options', 'espresso_about_default') |
|
531 | + && ! (defined('DOING_AJAX') && DOING_AJAX) |
|
532 | + && ! isset($notices['errors']) |
|
533 | 533 | ) { |
534 | - $query_params = array( 'page' => 'espresso_about' ); |
|
534 | + $query_params = array('page' => 'espresso_about'); |
|
535 | 535 | |
536 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) { |
|
536 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) { |
|
537 | 537 | $query_params['new_activation'] = TRUE; |
538 | 538 | } |
539 | 539 | |
540 | - if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) { |
|
540 | + if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) { |
|
541 | 541 | $query_params['reactivation'] = TRUE; |
542 | 542 | } |
543 | - $url = add_query_arg( $query_params, admin_url( 'admin.php' ) ); |
|
544 | - wp_safe_redirect( $url ); |
|
543 | + $url = add_query_arg($query_params, admin_url('admin.php')); |
|
544 | + wp_safe_redirect($url); |
|
545 | 545 | exit(); |
546 | 546 | } |
547 | 547 | } |
@@ -555,31 +555,31 @@ discard block |
||
555 | 555 | * |
556 | 556 | * @return void |
557 | 557 | */ |
558 | - public function load_core_configuration(){ |
|
559 | - do_action( 'AHEE__EE_System__load_core_configuration__begin', $this ); |
|
560 | - $this->registry->load_core( 'EE_Load_Textdomain' ); |
|
558 | + public function load_core_configuration() { |
|
559 | + do_action('AHEE__EE_System__load_core_configuration__begin', $this); |
|
560 | + $this->registry->load_core('EE_Load_Textdomain'); |
|
561 | 561 | //load textdomain |
562 | 562 | EE_Load_Textdomain::load_textdomain(); |
563 | 563 | // load and setup EE_Config and EE_Network_Config |
564 | - $this->registry->load_core( 'Config' ); |
|
565 | - $this->registry->load_core( 'Network_Config' ); |
|
564 | + $this->registry->load_core('Config'); |
|
565 | + $this->registry->load_core('Network_Config'); |
|
566 | 566 | // setup autoloaders |
567 | 567 | // enable logging? |
568 | - if ( $this->registry->CFG->admin->use_full_logging ) { |
|
569 | - $this->registry->load_core( 'Log' ); |
|
568 | + if ($this->registry->CFG->admin->use_full_logging) { |
|
569 | + $this->registry->load_core('Log'); |
|
570 | 570 | } |
571 | 571 | // check for activation errors |
572 | - $activation_errors = get_option( 'ee_plugin_activation_errors', FALSE ); |
|
573 | - if ( $activation_errors ) { |
|
574 | - EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
575 | - update_option( 'ee_plugin_activation_errors', FALSE ); |
|
572 | + $activation_errors = get_option('ee_plugin_activation_errors', FALSE); |
|
573 | + if ($activation_errors) { |
|
574 | + EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__); |
|
575 | + update_option('ee_plugin_activation_errors', FALSE); |
|
576 | 576 | } |
577 | 577 | // get model names |
578 | 578 | $this->_parse_model_names(); |
579 | 579 | |
580 | 580 | //load caf stuff a chance to play during the activation process too. |
581 | 581 | $this->_maybe_brew_regular(); |
582 | - do_action( 'AHEE__EE_System__load_core_configuration__complete', $this ); |
|
582 | + do_action('AHEE__EE_System__load_core_configuration__complete', $this); |
|
583 | 583 | } |
584 | 584 | |
585 | 585 | |
@@ -588,23 +588,23 @@ discard block |
||
588 | 588 | * |
589 | 589 | * @return void |
590 | 590 | */ |
591 | - private function _parse_model_names(){ |
|
591 | + private function _parse_model_names() { |
|
592 | 592 | //get all the files in the EE_MODELS folder that end in .model.php |
593 | - $models = glob( EE_MODELS.'*.model.php'); |
|
593 | + $models = glob(EE_MODELS.'*.model.php'); |
|
594 | 594 | $model_names = array(); |
595 | 595 | $non_abstract_db_models = array(); |
596 | - foreach( $models as $model ){ |
|
596 | + foreach ($models as $model) { |
|
597 | 597 | // get model classname |
598 | - $classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model ); |
|
599 | - $short_name = str_replace( 'EEM_', '', $classname ); |
|
598 | + $classname = EEH_File::get_classname_from_filepath_with_standard_filename($model); |
|
599 | + $short_name = str_replace('EEM_', '', $classname); |
|
600 | 600 | $reflectionClass = new ReflectionClass($classname); |
601 | - if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){ |
|
602 | - $non_abstract_db_models[ $short_name ] = $classname; |
|
601 | + if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) { |
|
602 | + $non_abstract_db_models[$short_name] = $classname; |
|
603 | 603 | } |
604 | - $model_names[ $short_name ] = $classname; |
|
604 | + $model_names[$short_name] = $classname; |
|
605 | 605 | } |
606 | - $this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names ); |
|
607 | - $this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models ); |
|
606 | + $this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names); |
|
607 | + $this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | |
@@ -614,8 +614,8 @@ discard block |
||
614 | 614 | * @return void |
615 | 615 | */ |
616 | 616 | private function _maybe_brew_regular() { |
617 | - if (( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) { |
|
618 | - require_once EE_CAFF_PATH . 'brewing_regular.php'; |
|
617 | + if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) { |
|
618 | + require_once EE_CAFF_PATH.'brewing_regular.php'; |
|
619 | 619 | } |
620 | 620 | } |
621 | 621 | |
@@ -632,9 +632,9 @@ discard block |
||
632 | 632 | * @return void |
633 | 633 | */ |
634 | 634 | public function register_shortcodes_modules_and_widgets() { |
635 | - do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' ); |
|
635 | + do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets'); |
|
636 | 636 | // check for addons using old hookpoint |
637 | - if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) { |
|
637 | + if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) { |
|
638 | 638 | $this->_incompatible_addon_error(); |
639 | 639 | } |
640 | 640 | } |
@@ -648,19 +648,19 @@ discard block |
||
648 | 648 | */ |
649 | 649 | private function _incompatible_addon_error() { |
650 | 650 | // get array of classes hooking into here |
651 | - $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' ); |
|
652 | - if ( ! empty( $class_names )) { |
|
653 | - $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 | + $class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons'); |
|
652 | + if ( ! empty($class_names)) { |
|
653 | + $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'); |
|
654 | 654 | $msg .= '<ul>'; |
655 | - foreach ( $class_names as $class_name ) { |
|
656 | - $msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>'; |
|
655 | + foreach ($class_names as $class_name) { |
|
656 | + $msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>'; |
|
657 | 657 | } |
658 | 658 | $msg .= '</ul>'; |
659 | - $msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' ); |
|
659 | + $msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso'); |
|
660 | 660 | // save list of incompatible addons to wp-options for later use |
661 | - add_option( 'ee_incompatible_addons', $class_names, '', 'no' ); |
|
662 | - if ( is_admin() ) { |
|
663 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
661 | + add_option('ee_incompatible_addons', $class_names, '', 'no'); |
|
662 | + if (is_admin()) { |
|
663 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
664 | 664 | } |
665 | 665 | } |
666 | 666 | } |
@@ -677,26 +677,26 @@ discard block |
||
677 | 677 | * |
678 | 678 | * @return void |
679 | 679 | */ |
680 | - public function brew_espresso(){ |
|
681 | - do_action( 'AHEE__EE_System__brew_espresso__begin', $this ); |
|
680 | + public function brew_espresso() { |
|
681 | + do_action('AHEE__EE_System__brew_espresso__begin', $this); |
|
682 | 682 | // load some final core systems |
683 | - add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 ); |
|
684 | - add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 ); |
|
685 | - add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 ); |
|
686 | - add_action( 'init', array( $this, 'load_controllers' ), 7 ); |
|
687 | - add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 ); |
|
688 | - add_action( 'init', array( $this, 'initialize' ), 10 ); |
|
689 | - add_action( 'init', array( $this, 'initialize_last' ), 100 ); |
|
690 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
691 | - add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 ); |
|
692 | - add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 ); |
|
693 | - |
|
694 | - if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE ) ) { |
|
683 | + add_action('init', array($this, 'set_hooks_for_core'), 1); |
|
684 | + add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3); |
|
685 | + add_action('init', array($this, 'load_CPTs_and_session'), 5); |
|
686 | + add_action('init', array($this, 'load_controllers'), 7); |
|
687 | + add_action('init', array($this, 'core_loaded_and_ready'), 9); |
|
688 | + add_action('init', array($this, 'initialize'), 10); |
|
689 | + add_action('init', array($this, 'initialize_last'), 100); |
|
690 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
691 | + add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25); |
|
692 | + add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100); |
|
693 | + |
|
694 | + if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) { |
|
695 | 695 | // pew pew pew |
696 | - $this->registry->load_core( 'PUE' ); |
|
697 | - do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' ); |
|
696 | + $this->registry->load_core('PUE'); |
|
697 | + do_action('AHEE__EE_System__brew_espresso__after_pue_init'); |
|
698 | 698 | } |
699 | - do_action( 'AHEE__EE_System__brew_espresso__complete', $this ); |
|
699 | + do_action('AHEE__EE_System__brew_espresso__complete', $this); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | */ |
711 | 711 | public function set_hooks_for_core() { |
712 | 712 | $this->_deactivate_incompatible_addons(); |
713 | - do_action( 'AHEE__EE_System__set_hooks_for_core' ); |
|
713 | + do_action('AHEE__EE_System__set_hooks_for_core'); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | |
@@ -719,15 +719,15 @@ discard block |
||
719 | 719 | * Using the information gathered in EE_System::_incompatible_addon_error, |
720 | 720 | * deactivates any addons considered incompatible with the current version of EE |
721 | 721 | */ |
722 | - private function _deactivate_incompatible_addons(){ |
|
723 | - $incompatible_addons = get_option( 'ee_incompatible_addons', array() ); |
|
724 | - if ( ! empty( $incompatible_addons )) { |
|
725 | - $active_plugins = get_option( 'active_plugins', array() ); |
|
726 | - foreach ( $active_plugins as $active_plugin ) { |
|
727 | - foreach ( $incompatible_addons as $incompatible_addon ) { |
|
728 | - if ( strpos( $active_plugin, $incompatible_addon ) !== FALSE ) { |
|
729 | - unset( $_GET['activate'] ); |
|
730 | - espresso_deactivate_plugin( $active_plugin ); |
|
722 | + private function _deactivate_incompatible_addons() { |
|
723 | + $incompatible_addons = get_option('ee_incompatible_addons', array()); |
|
724 | + if ( ! empty($incompatible_addons)) { |
|
725 | + $active_plugins = get_option('active_plugins', array()); |
|
726 | + foreach ($active_plugins as $active_plugin) { |
|
727 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
728 | + if (strpos($active_plugin, $incompatible_addon) !== FALSE) { |
|
729 | + unset($_GET['activate']); |
|
730 | + espresso_deactivate_plugin($active_plugin); |
|
731 | 731 | } |
732 | 732 | } |
733 | 733 | } |
@@ -744,10 +744,10 @@ discard block |
||
744 | 744 | */ |
745 | 745 | public function perform_activations_upgrades_and_migrations() { |
746 | 746 | //first check if we had previously attempted to setup EE's directories but failed |
747 | - if( EEH_Activation::upload_directories_incomplete() ) { |
|
747 | + if (EEH_Activation::upload_directories_incomplete()) { |
|
748 | 748 | EEH_Activation::create_upload_directories(); |
749 | 749 | } |
750 | - do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' ); |
|
750 | + do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations'); |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | |
@@ -759,10 +759,10 @@ discard block |
||
759 | 759 | * @return void |
760 | 760 | */ |
761 | 761 | public function load_CPTs_and_session() { |
762 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__start' ); |
|
762 | + do_action('AHEE__EE_System__load_CPTs_and_session__start'); |
|
763 | 763 | // register Custom Post Types |
764 | - $this->registry->load_core( 'Register_CPTs' ); |
|
765 | - do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' ); |
|
764 | + $this->registry->load_core('Register_CPTs'); |
|
765 | + do_action('AHEE__EE_System__load_CPTs_and_session__complete'); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | |
@@ -777,22 +777,22 @@ discard block |
||
777 | 777 | * @return void |
778 | 778 | */ |
779 | 779 | public function load_controllers() { |
780 | - do_action( 'AHEE__EE_System__load_controllers__start' ); |
|
780 | + do_action('AHEE__EE_System__load_controllers__start'); |
|
781 | 781 | // let's get it started |
782 | - if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) { |
|
783 | - do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' ); |
|
784 | - $this->registry->load_core( 'Front_Controller' ); |
|
785 | - } else if ( ! EE_FRONT_AJAX ) { |
|
786 | - do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' ); |
|
787 | - EE_Registry::instance()->load_core( 'Admin' ); |
|
782 | + if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) { |
|
783 | + do_action('AHEE__EE_System__load_controllers__load_front_controllers'); |
|
784 | + $this->registry->load_core('Front_Controller'); |
|
785 | + } else if ( ! EE_FRONT_AJAX) { |
|
786 | + do_action('AHEE__EE_System__load_controllers__load_admin_controllers'); |
|
787 | + EE_Registry::instance()->load_core('Admin'); |
|
788 | 788 | $action_item_manager = new ActionItemManager( |
789 | 789 | new CapabilitiesChecker( |
790 | - EE_Registry::instance()->load_core( 'Capabilities' ) |
|
790 | + EE_Registry::instance()->load_core('Capabilities') |
|
791 | 791 | ) |
792 | 792 | ); |
793 | 793 | $action_item_manager->setConditionCheckHooks(); |
794 | 794 | } |
795 | - do_action( 'AHEE__EE_System__load_controllers__complete' ); |
|
795 | + do_action('AHEE__EE_System__load_controllers__complete'); |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | |
@@ -806,9 +806,9 @@ discard block |
||
806 | 806 | * @return void |
807 | 807 | */ |
808 | 808 | public function core_loaded_and_ready() { |
809 | - do_action( 'AHEE__EE_System__core_loaded_and_ready' ); |
|
810 | - do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' ); |
|
811 | - $this->registry->load_core( 'Session' ); |
|
809 | + do_action('AHEE__EE_System__core_loaded_and_ready'); |
|
810 | + do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons'); |
|
811 | + $this->registry->load_core('Session'); |
|
812 | 812 | // add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 ); |
813 | 813 | } |
814 | 814 | |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | * @return void |
824 | 824 | */ |
825 | 825 | public function initialize() { |
826 | - do_action( 'AHEE__EE_System__initialize' ); |
|
826 | + do_action('AHEE__EE_System__initialize'); |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | * @return void |
838 | 838 | */ |
839 | 839 | public function initialize_last() { |
840 | - do_action( 'AHEE__EE_System__initialize_last' ); |
|
840 | + do_action('AHEE__EE_System__initialize_last'); |
|
841 | 841 | } |
842 | 842 | |
843 | 843 | |
@@ -869,21 +869,21 @@ discard block |
||
869 | 869 | */ |
870 | 870 | public static function do_not_cache() { |
871 | 871 | // set no cache constants |
872 | - if ( ! defined( 'DONOTCACHEPAGE' ) ) { |
|
873 | - define( 'DONOTCACHEPAGE', true ); |
|
872 | + if ( ! defined('DONOTCACHEPAGE')) { |
|
873 | + define('DONOTCACHEPAGE', true); |
|
874 | 874 | } |
875 | - if ( ! defined( 'DONOTCACHCEOBJECT' ) ) { |
|
876 | - define( 'DONOTCACHCEOBJECT', true ); |
|
875 | + if ( ! defined('DONOTCACHCEOBJECT')) { |
|
876 | + define('DONOTCACHCEOBJECT', true); |
|
877 | 877 | } |
878 | - if ( ! defined( 'DONOTCACHEDB' ) ) { |
|
879 | - define( 'DONOTCACHEDB', true ); |
|
878 | + if ( ! defined('DONOTCACHEDB')) { |
|
879 | + define('DONOTCACHEDB', true); |
|
880 | 880 | } |
881 | 881 | // add no cache headers |
882 | - add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 ); |
|
882 | + add_action('send_headers', array('EE_System', 'nocache_headers'), 10); |
|
883 | 883 | // plus a little extra for nginx and Google Chrome |
884 | - add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 ); |
|
884 | + add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1); |
|
885 | 885 | // prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process |
886 | - remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' ); |
|
886 | + remove_action('wp_head', 'adjacent_posts_rel_link_wp_head'); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | * @param $headers |
896 | 896 | * @return array |
897 | 897 | */ |
898 | - public static function extra_nocache_headers ( $headers ) { |
|
898 | + public static function extra_nocache_headers($headers) { |
|
899 | 899 | // for NGINX |
900 | 900 | $headers['X-Accel-Expires'] = 0; |
901 | 901 | // plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store" |
@@ -924,14 +924,14 @@ discard block |
||
924 | 924 | * @param WP_Admin_Bar $admin_bar |
925 | 925 | * @return void |
926 | 926 | */ |
927 | - public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) { |
|
927 | + public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) { |
|
928 | 928 | |
929 | 929 | // if in full M-Mode, or its an AJAX request, or user is NOT an admin |
930 | - 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' )) { |
|
930 | + 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')) { |
|
931 | 931 | return; |
932 | 932 | } |
933 | 933 | |
934 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
934 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
935 | 935 | $menu_class = 'espresso_menu_item_class'; |
936 | 936 | //we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL |
937 | 937 | //because they're only defined in each of their respective constructors |
@@ -943,20 +943,20 @@ discard block |
||
943 | 943 | //Top Level |
944 | 944 | $admin_bar->add_menu(array( |
945 | 945 | 'id' => 'espresso-toolbar', |
946 | - '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>', |
|
946 | + '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>', |
|
947 | 947 | 'href' => $events_admin_url, |
948 | 948 | 'meta' => array( |
949 | 949 | 'title' => __('Event Espresso', 'event_espresso'), |
950 | - 'class' => $menu_class . 'first' |
|
950 | + 'class' => $menu_class.'first' |
|
951 | 951 | ), |
952 | 952 | )); |
953 | 953 | |
954 | 954 | //Events |
955 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) { |
|
955 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) { |
|
956 | 956 | $admin_bar->add_menu(array( |
957 | 957 | 'id' => 'espresso-toolbar-events', |
958 | 958 | 'parent' => 'espresso-toolbar', |
959 | - 'title' => __( 'Events', 'event_espresso' ), |
|
959 | + 'title' => __('Events', 'event_espresso'), |
|
960 | 960 | 'href' => $events_admin_url, |
961 | 961 | 'meta' => array( |
962 | 962 | 'title' => __('Events', 'event_espresso'), |
@@ -967,13 +967,13 @@ discard block |
||
967 | 967 | } |
968 | 968 | |
969 | 969 | |
970 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) { |
|
970 | + if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) { |
|
971 | 971 | //Events Add New |
972 | 972 | $admin_bar->add_menu(array( |
973 | 973 | 'id' => 'espresso-toolbar-events-new', |
974 | 974 | 'parent' => 'espresso-toolbar-events', |
975 | 975 | 'title' => __('Add New', 'event_espresso'), |
976 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ), |
|
976 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url), |
|
977 | 977 | 'meta' => array( |
978 | 978 | 'title' => __('Add New', 'event_espresso'), |
979 | 979 | 'target' => '', |
@@ -982,18 +982,18 @@ discard block |
||
982 | 982 | )); |
983 | 983 | } |
984 | 984 | |
985 | - if ( is_single() && ( get_post_type() == 'espresso_events' ) ) { |
|
985 | + if (is_single() && (get_post_type() == 'espresso_events')) { |
|
986 | 986 | |
987 | 987 | //Current post |
988 | 988 | global $post; |
989 | 989 | |
990 | - if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) { |
|
990 | + if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) { |
|
991 | 991 | //Events Edit Current Event |
992 | 992 | $admin_bar->add_menu(array( |
993 | 993 | 'id' => 'espresso-toolbar-events-edit', |
994 | 994 | 'parent' => 'espresso-toolbar-events', |
995 | 995 | 'title' => __('Edit Event', 'event_espresso'), |
996 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ), |
|
996 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url), |
|
997 | 997 | 'meta' => array( |
998 | 998 | 'title' => __('Edit Event', 'event_espresso'), |
999 | 999 | 'target' => '', |
@@ -1005,11 +1005,11 @@ discard block |
||
1005 | 1005 | } |
1006 | 1006 | |
1007 | 1007 | //Events View |
1008 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) { |
|
1008 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) { |
|
1009 | 1009 | $admin_bar->add_menu(array( |
1010 | 1010 | 'id' => 'espresso-toolbar-events-view', |
1011 | 1011 | 'parent' => 'espresso-toolbar-events', |
1012 | - 'title' => __( 'View', 'event_espresso' ), |
|
1012 | + 'title' => __('View', 'event_espresso'), |
|
1013 | 1013 | 'href' => $events_admin_url, |
1014 | 1014 | 'meta' => array( |
1015 | 1015 | 'title' => __('View', 'event_espresso'), |
@@ -1019,12 +1019,12 @@ discard block |
||
1019 | 1019 | )); |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) { |
|
1022 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) { |
|
1023 | 1023 | //Events View All |
1024 | 1024 | $admin_bar->add_menu(array( |
1025 | 1025 | 'id' => 'espresso-toolbar-events-all', |
1026 | 1026 | 'parent' => 'espresso-toolbar-events-view', |
1027 | - 'title' => __( 'All', 'event_espresso' ), |
|
1027 | + 'title' => __('All', 'event_espresso'), |
|
1028 | 1028 | 'href' => $events_admin_url, |
1029 | 1029 | 'meta' => array( |
1030 | 1030 | 'title' => __('All', 'event_espresso'), |
@@ -1035,13 +1035,13 @@ discard block |
||
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | |
1038 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) { |
|
1038 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) { |
|
1039 | 1039 | //Events View Today |
1040 | 1040 | $admin_bar->add_menu(array( |
1041 | 1041 | 'id' => 'espresso-toolbar-events-today', |
1042 | 1042 | 'parent' => 'espresso-toolbar-events-view', |
1043 | 1043 | 'title' => __('Today', 'event_espresso'), |
1044 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ), |
|
1044 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url), |
|
1045 | 1045 | 'meta' => array( |
1046 | 1046 | 'title' => __('Today', 'event_espresso'), |
1047 | 1047 | 'target' => '', |
@@ -1051,13 +1051,13 @@ discard block |
||
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | |
1054 | - if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) { |
|
1054 | + if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) { |
|
1055 | 1055 | //Events View This Month |
1056 | 1056 | $admin_bar->add_menu(array( |
1057 | 1057 | 'id' => 'espresso-toolbar-events-month', |
1058 | 1058 | 'parent' => 'espresso-toolbar-events-view', |
1059 | - 'title' => __( 'This Month', 'event_espresso'), |
|
1060 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ), |
|
1059 | + 'title' => __('This Month', 'event_espresso'), |
|
1060 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url), |
|
1061 | 1061 | 'meta' => array( |
1062 | 1062 | 'title' => __('This Month', 'event_espresso'), |
1063 | 1063 | 'target' => '', |
@@ -1067,11 +1067,11 @@ discard block |
||
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | //Registration Overview |
1070 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) { |
|
1070 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) { |
|
1071 | 1071 | $admin_bar->add_menu(array( |
1072 | 1072 | 'id' => 'espresso-toolbar-registrations', |
1073 | 1073 | 'parent' => 'espresso-toolbar', |
1074 | - 'title' => __( 'Registrations', 'event_espresso' ), |
|
1074 | + 'title' => __('Registrations', 'event_espresso'), |
|
1075 | 1075 | 'href' => $reg_admin_url, |
1076 | 1076 | 'meta' => array( |
1077 | 1077 | 'title' => __('Registrations', 'event_espresso'), |
@@ -1082,12 +1082,12 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | //Registration Overview Today |
1085 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) { |
|
1085 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) { |
|
1086 | 1086 | $admin_bar->add_menu(array( |
1087 | 1087 | 'id' => 'espresso-toolbar-registrations-today', |
1088 | 1088 | 'parent' => 'espresso-toolbar-registrations', |
1089 | - 'title' => __( 'Today', 'event_espresso'), |
|
1090 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ), |
|
1089 | + 'title' => __('Today', 'event_espresso'), |
|
1090 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url), |
|
1091 | 1091 | 'meta' => array( |
1092 | 1092 | 'title' => __('Today', 'event_espresso'), |
1093 | 1093 | 'target' => '', |
@@ -1097,14 +1097,14 @@ discard block |
||
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | //Registration Overview Today Completed |
1100 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) { |
|
1100 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) { |
|
1101 | 1101 | $admin_bar->add_menu(array( |
1102 | 1102 | 'id' => 'espresso-toolbar-registrations-today-approved', |
1103 | 1103 | 'parent' => 'espresso-toolbar-registrations-today', |
1104 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1105 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1104 | + 'title' => __('Approved', 'event_espresso'), |
|
1105 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1106 | 1106 | 'meta' => array( |
1107 | - 'title' => __('Approved', 'event_espresso' ), |
|
1107 | + 'title' => __('Approved', 'event_espresso'), |
|
1108 | 1108 | 'target' => '', |
1109 | 1109 | 'class' => $menu_class |
1110 | 1110 | ), |
@@ -1112,14 +1112,14 @@ discard block |
||
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | //Registration Overview Today Pending\ |
1115 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) { |
|
1115 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) { |
|
1116 | 1116 | $admin_bar->add_menu(array( |
1117 | 1117 | 'id' => 'espresso-toolbar-registrations-today-pending', |
1118 | 1118 | 'parent' => 'espresso-toolbar-registrations-today', |
1119 | - 'title' => __( 'Pending', 'event_espresso' ), |
|
1120 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1119 | + 'title' => __('Pending', 'event_espresso'), |
|
1120 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1121 | 1121 | 'meta' => array( |
1122 | - 'title' => __('Pending Payment', 'event_espresso' ), |
|
1122 | + 'title' => __('Pending Payment', 'event_espresso'), |
|
1123 | 1123 | 'target' => '', |
1124 | 1124 | 'class' => $menu_class |
1125 | 1125 | ), |
@@ -1127,14 +1127,14 @@ discard block |
||
1127 | 1127 | } |
1128 | 1128 | |
1129 | 1129 | //Registration Overview Today Incomplete |
1130 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) { |
|
1130 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) { |
|
1131 | 1131 | $admin_bar->add_menu(array( |
1132 | 1132 | 'id' => 'espresso-toolbar-registrations-today-not-approved', |
1133 | 1133 | 'parent' => 'espresso-toolbar-registrations-today', |
1134 | - 'title' => __( 'Not Approved', 'event_espresso' ), |
|
1135 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1134 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1135 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1136 | 1136 | 'meta' => array( |
1137 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1137 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1138 | 1138 | 'target' => '', |
1139 | 1139 | 'class' => $menu_class |
1140 | 1140 | ), |
@@ -1142,12 +1142,12 @@ discard block |
||
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | //Registration Overview Today Incomplete |
1145 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) { |
|
1145 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) { |
|
1146 | 1146 | $admin_bar->add_menu(array( |
1147 | 1147 | 'id' => 'espresso-toolbar-registrations-today-cancelled', |
1148 | 1148 | 'parent' => 'espresso-toolbar-registrations-today', |
1149 | - 'title' => __( 'Cancelled', 'event_espresso'), |
|
1150 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1149 | + 'title' => __('Cancelled', 'event_espresso'), |
|
1150 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1151 | 1151 | 'meta' => array( |
1152 | 1152 | 'title' => __('Cancelled', 'event_espresso'), |
1153 | 1153 | 'target' => '', |
@@ -1157,12 +1157,12 @@ discard block |
||
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | //Registration Overview This Month |
1160 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) { |
|
1160 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) { |
|
1161 | 1161 | $admin_bar->add_menu(array( |
1162 | 1162 | 'id' => 'espresso-toolbar-registrations-month', |
1163 | 1163 | 'parent' => 'espresso-toolbar-registrations', |
1164 | - 'title' => __( 'This Month', 'event_espresso' ), |
|
1165 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ), |
|
1164 | + 'title' => __('This Month', 'event_espresso'), |
|
1165 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url), |
|
1166 | 1166 | 'meta' => array( |
1167 | 1167 | 'title' => __('This Month', 'event_espresso'), |
1168 | 1168 | 'target' => '', |
@@ -1172,12 +1172,12 @@ discard block |
||
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | //Registration Overview This Month Approved |
1175 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) { |
|
1175 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) { |
|
1176 | 1176 | $admin_bar->add_menu(array( |
1177 | 1177 | 'id' => 'espresso-toolbar-registrations-month-approved', |
1178 | 1178 | 'parent' => 'espresso-toolbar-registrations-month', |
1179 | - 'title' => __( 'Approved', 'event_espresso' ), |
|
1180 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ), |
|
1179 | + 'title' => __('Approved', 'event_espresso'), |
|
1180 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url), |
|
1181 | 1181 | 'meta' => array( |
1182 | 1182 | 'title' => __('Approved', 'event_espresso'), |
1183 | 1183 | 'target' => '', |
@@ -1187,12 +1187,12 @@ discard block |
||
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | //Registration Overview This Month Pending |
1190 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) { |
|
1190 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) { |
|
1191 | 1191 | $admin_bar->add_menu(array( |
1192 | 1192 | 'id' => 'espresso-toolbar-registrations-month-pending', |
1193 | 1193 | 'parent' => 'espresso-toolbar-registrations-month', |
1194 | - 'title' => __( 'Pending', 'event_espresso'), |
|
1195 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ), |
|
1194 | + 'title' => __('Pending', 'event_espresso'), |
|
1195 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url), |
|
1196 | 1196 | 'meta' => array( |
1197 | 1197 | 'title' => __('Pending', 'event_espresso'), |
1198 | 1198 | 'target' => '', |
@@ -1202,14 +1202,14 @@ discard block |
||
1202 | 1202 | } |
1203 | 1203 | |
1204 | 1204 | //Registration Overview This Month Not Approved |
1205 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) { |
|
1205 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) { |
|
1206 | 1206 | $admin_bar->add_menu(array( |
1207 | 1207 | 'id' => 'espresso-toolbar-registrations-month-not-approved', |
1208 | 1208 | 'parent' => 'espresso-toolbar-registrations-month', |
1209 | - 'title' => __( 'Not Approved', 'event_espresso'), |
|
1210 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ), |
|
1209 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1210 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url), |
|
1211 | 1211 | 'meta' => array( |
1212 | - 'title' => __('Not Approved', 'event_espresso' ), |
|
1212 | + 'title' => __('Not Approved', 'event_espresso'), |
|
1213 | 1213 | 'target' => '', |
1214 | 1214 | 'class' => $menu_class |
1215 | 1215 | ), |
@@ -1218,12 +1218,12 @@ discard block |
||
1218 | 1218 | |
1219 | 1219 | |
1220 | 1220 | //Registration Overview This Month Cancelled |
1221 | - if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) { |
|
1221 | + if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) { |
|
1222 | 1222 | $admin_bar->add_menu(array( |
1223 | 1223 | 'id' => 'espresso-toolbar-registrations-month-cancelled', |
1224 | 1224 | 'parent' => 'espresso-toolbar-registrations-month', |
1225 | 1225 | 'title' => __('Cancelled', 'event_espresso'), |
1226 | - 'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ), |
|
1226 | + 'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url), |
|
1227 | 1227 | 'meta' => array( |
1228 | 1228 | 'title' => __('Cancelled', 'event_espresso'), |
1229 | 1229 | 'target' => '', |
@@ -1233,11 +1233,11 @@ discard block |
||
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | //Extensions & Services |
1236 | - if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) { |
|
1236 | + if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) { |
|
1237 | 1237 | $admin_bar->add_menu(array( |
1238 | 1238 | 'id' => 'espresso-toolbar-extensions-and-services', |
1239 | 1239 | 'parent' => 'espresso-toolbar', |
1240 | - 'title' => __( 'Extensions & Services', 'event_espresso' ), |
|
1240 | + 'title' => __('Extensions & Services', 'event_espresso'), |
|
1241 | 1241 | 'href' => $extensions_admin_url, |
1242 | 1242 | 'meta' => array( |
1243 | 1243 | 'title' => __('Extensions & Services', 'event_espresso'), |
@@ -1259,8 +1259,8 @@ discard block |
||
1259 | 1259 | * @param array $exclude_array any existing pages being excluded are in this array. |
1260 | 1260 | * @return array |
1261 | 1261 | */ |
1262 | - public function remove_pages_from_wp_list_pages( $exclude_array ) { |
|
1263 | - return array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() ); |
|
1262 | + public function remove_pages_from_wp_list_pages($exclude_array) { |
|
1263 | + return array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array()); |
|
1264 | 1264 | } |
1265 | 1265 | |
1266 | 1266 | |
@@ -1280,12 +1280,12 @@ discard block |
||
1280 | 1280 | */ |
1281 | 1281 | public function wp_enqueue_scripts() { |
1282 | 1282 | // 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' ); |
1283 | - if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) { |
|
1283 | + if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) { |
|
1284 | 1284 | // 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' ); |
1285 | - if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) { |
|
1285 | + if (apply_filters('FHEE_load_jquery_validate', FALSE)) { |
|
1286 | 1286 | // register jQuery Validate and additional methods |
1287 | - wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE ); |
|
1288 | - 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 ); |
|
1287 | + wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE); |
|
1288 | + 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); |
|
1289 | 1289 | } |
1290 | 1290 | } |
1291 | 1291 | } |
@@ -1,7 +1,9 @@ discard block |
||
1 | 1 | <?php use EventEspresso\core\domain\services\capabilities\CapabilitiesChecker; |
2 | 2 | use EventEspresso\core\services\action_items\ActionItemManager; |
3 | 3 | |
4 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | +} |
|
5 | 7 | /** |
6 | 8 | * |
7 | 9 | * EE_System |
@@ -309,7 +311,7 @@ discard block |
||
309 | 311 | $espresso_db_update = array( $espresso_db_update=>array() ); |
310 | 312 | update_option( 'espresso_db_update', $espresso_db_update ); |
311 | 313 | } |
312 | - }else{ |
|
314 | + } else{ |
|
313 | 315 | $corrected_db_update = array(); |
314 | 316 | //if IS an array, but is it an array where KEYS are version numbers, and values are arrays? |
315 | 317 | foreach($espresso_db_update as $should_be_version_string => $should_be_array){ |
@@ -319,7 +321,7 @@ discard block |
||
319 | 321 | //fix it! |
320 | 322 | $version_string = $should_be_array; |
321 | 323 | $corrected_db_update[$version_string] = array('unknown-date'); |
322 | - }else{ |
|
324 | + } else{ |
|
323 | 325 | //ok it checks out |
324 | 326 | $corrected_db_update[$should_be_version_string] = $should_be_array; |
325 | 327 | } |
@@ -363,7 +365,7 @@ discard block |
||
363 | 365 | if( $initialize_addons_too ) { |
364 | 366 | $this->initialize_addons(); |
365 | 367 | } |
366 | - }else{ |
|
368 | + } else{ |
|
367 | 369 | EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' ); |
368 | 370 | } |
369 | 371 | if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) { |
@@ -442,7 +444,7 @@ discard block |
||
442 | 444 | //it a version we haven't seen before |
443 | 445 | if( $version_is_higher === 1 ){ |
444 | 446 | $req_type = EE_System::req_type_upgrade; |
445 | - }else{ |
|
447 | + } else{ |
|
446 | 448 | $req_type = EE_System::req_type_downgrade; |
447 | 449 | } |
448 | 450 | delete_option( $activation_indicator_option_name ); |
@@ -451,10 +453,10 @@ discard block |
||
451 | 453 | if( get_option( $activation_indicator_option_name, FALSE ) ){ |
452 | 454 | if ( $version_is_higher === -1 ){ |
453 | 455 | $req_type = EE_System::req_type_downgrade; |
454 | - }elseif( $version_is_higher === 0 ){ |
|
456 | + } elseif( $version_is_higher === 0 ){ |
|
455 | 457 | //we've seen this version before, but it's an activation. must be a reactivation |
456 | 458 | $req_type = EE_System::req_type_reactivation; |
457 | - }else{//$version_is_higher === 1 |
|
459 | + } else{//$version_is_higher === 1 |
|
458 | 460 | $req_type = EE_System::req_type_upgrade; |
459 | 461 | } |
460 | 462 | delete_option( $activation_indicator_option_name ); |
@@ -462,10 +464,10 @@ discard block |
||
462 | 464 | //we've seen this version before and the activation indicate doesn't show it was just activated |
463 | 465 | if ( $version_is_higher === -1 ){ |
464 | 466 | $req_type = EE_System::req_type_downgrade; |
465 | - }elseif( $version_is_higher === 0 ){ |
|
467 | + } elseif( $version_is_higher === 0 ){ |
|
466 | 468 | //we've seen this version before and it's not an activation. its normal request |
467 | 469 | $req_type = EE_System::req_type_normal; |
468 | - }else{//$version_is_higher === 1 |
|
470 | + } else{//$version_is_higher === 1 |
|
469 | 471 | $req_type = EE_System::req_type_upgrade; |
470 | 472 | } |
471 | 473 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\commands\CommandRequiresCapCheckInterface; |
9 | 9 | |
10 | 10 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
11 | - exit('No direct script access allowed'); |
|
11 | + exit('No direct script access allowed'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -28,41 +28,41 @@ discard block |
||
28 | 28 | class CapChecker implements CommandBusMiddlewareInterface |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @type CapabilitiesChecker $capabilities_checker |
|
33 | - */ |
|
34 | - private $capabilities_checker; |
|
31 | + /** |
|
32 | + * @type CapabilitiesChecker $capabilities_checker |
|
33 | + */ |
|
34 | + private $capabilities_checker; |
|
35 | 35 | |
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * CapChecker constructor |
|
40 | - * |
|
41 | - * @param CapabilitiesChecker $capabilities_checker |
|
42 | - */ |
|
43 | - public function __construct(CapabilitiesChecker $capabilities_checker) |
|
44 | - { |
|
45 | - $this->capabilities_checker = $capabilities_checker; |
|
46 | - } |
|
38 | + /** |
|
39 | + * CapChecker constructor |
|
40 | + * |
|
41 | + * @param CapabilitiesChecker $capabilities_checker |
|
42 | + */ |
|
43 | + public function __construct(CapabilitiesChecker $capabilities_checker) |
|
44 | + { |
|
45 | + $this->capabilities_checker = $capabilities_checker; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param CommandInterface $command |
|
52 | - * @param \Closure $next |
|
53 | - * @return mixed |
|
54 | - * @throws InvalidClassException |
|
55 | - * @throws InsufficientPermissionsException |
|
56 | - */ |
|
57 | - public function handle(CommandInterface $command, \Closure $next) |
|
58 | - { |
|
59 | - if ( $command instanceof CommandRequiresCapCheckInterface) { |
|
60 | - $this->capabilities_checker->processCapCheck( |
|
61 | - $command->getCapCheck() |
|
62 | - ); |
|
63 | - } |
|
64 | - return $next($command); |
|
65 | - } |
|
50 | + /** |
|
51 | + * @param CommandInterface $command |
|
52 | + * @param \Closure $next |
|
53 | + * @return mixed |
|
54 | + * @throws InvalidClassException |
|
55 | + * @throws InsufficientPermissionsException |
|
56 | + */ |
|
57 | + public function handle(CommandInterface $command, \Closure $next) |
|
58 | + { |
|
59 | + if ( $command instanceof CommandRequiresCapCheckInterface) { |
|
60 | + $this->capabilities_checker->processCapCheck( |
|
61 | + $command->getCapCheck() |
|
62 | + ); |
|
63 | + } |
|
64 | + return $next($command); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | 68 | } |
@@ -19,45 +19,45 @@ |
||
19 | 19 | { |
20 | 20 | |
21 | 21 | |
22 | - /* |
|
22 | + /* |
|
23 | 23 | * @var CapCheckInterface $cap_check |
24 | 24 | */ |
25 | - protected $cap_check; |
|
25 | + protected $cap_check; |
|
26 | 26 | |
27 | 27 | |
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param CapCheckInterface $cap_check |
|
32 | - */ |
|
33 | - public function setCapCheck( CapCheckInterface $cap_check ) |
|
34 | - { |
|
35 | - $this->cap_check = $cap_check; |
|
36 | - } |
|
30 | + /** |
|
31 | + * @param CapCheckInterface $cap_check |
|
32 | + */ |
|
33 | + public function setCapCheck( CapCheckInterface $cap_check ) |
|
34 | + { |
|
35 | + $this->cap_check = $cap_check; |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * default method for setting up condition checks |
|
42 | - * |
|
43 | - * @return void |
|
44 | - */ |
|
45 | - public function setConditionCheckHooks() |
|
46 | - { |
|
47 | - add_action( |
|
48 | - 'AHEE__EE_System__core_loaded_and_ready', |
|
49 | - array( $this, 'doConditionCheck' ) |
|
50 | - ); |
|
51 | - } |
|
40 | + /** |
|
41 | + * default method for setting up condition checks |
|
42 | + * |
|
43 | + * @return void |
|
44 | + */ |
|
45 | + public function setConditionCheckHooks() |
|
46 | + { |
|
47 | + add_action( |
|
48 | + 'AHEE__EE_System__core_loaded_and_ready', |
|
49 | + array( $this, 'doConditionCheck' ) |
|
50 | + ); |
|
51 | + } |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getActionItemButtonText() { |
|
59 | - return esc_html__( 'Click here to take action', 'event_espresso' ); |
|
60 | - } |
|
55 | + /** |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getActionItemButtonText() { |
|
59 | + return esc_html__( 'Click here to take action', 'event_espresso' ); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | 63 |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\domain\services\capabilities\CapCheckInterface; |
5 | 5 | |
6 | -defined( 'ABSPATH' ) || exit; |
|
6 | +defined('ABSPATH') || exit; |
|
7 | 7 | |
8 | 8 | |
9 | 9 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @param CapCheckInterface $cap_check |
32 | 32 | */ |
33 | - public function setCapCheck( CapCheckInterface $cap_check ) |
|
33 | + public function setCapCheck(CapCheckInterface $cap_check) |
|
34 | 34 | { |
35 | 35 | $this->cap_check = $cap_check; |
36 | 36 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | add_action( |
48 | 48 | 'AHEE__EE_System__core_loaded_and_ready', |
49 | - array( $this, 'doConditionCheck' ) |
|
49 | + array($this, 'doConditionCheck') |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | */ |
58 | 58 | public function getActionItemButtonText() { |
59 | - return esc_html__( 'Click here to take action', 'event_espresso' ); |
|
59 | + return esc_html__('Click here to take action', 'event_espresso'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 |
@@ -14,30 +14,30 @@ |
||
14 | 14 | interface ActionItemInterface |
15 | 15 | { |
16 | 16 | |
17 | - public function setConditionCheckHooks(); |
|
17 | + public function setConditionCheckHooks(); |
|
18 | 18 | |
19 | 19 | |
20 | - public function doConditionCheck(); |
|
20 | + public function doConditionCheck(); |
|
21 | 21 | |
22 | - /** |
|
23 | - * @return bool |
|
24 | - */ |
|
25 | - public function conditionPassed(); |
|
22 | + /** |
|
23 | + * @return bool |
|
24 | + */ |
|
25 | + public function conditionPassed(); |
|
26 | 26 | |
27 | - /** |
|
28 | - * @return string |
|
29 | - */ |
|
30 | - public function getActionItemNotice(); |
|
27 | + /** |
|
28 | + * @return string |
|
29 | + */ |
|
30 | + public function getActionItemNotice(); |
|
31 | 31 | |
32 | - /** |
|
33 | - * @return string |
|
34 | - */ |
|
35 | - public function getActionItemUrl(); |
|
32 | + /** |
|
33 | + * @return string |
|
34 | + */ |
|
35 | + public function getActionItemUrl(); |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function getActionItemButtonText(); |
|
37 | + /** |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function getActionItemButtonText(); |
|
41 | 41 | |
42 | 42 | |
43 | 43 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\action_items; |
3 | 3 | |
4 | -defined( 'ABSPATH' ) || exit; |
|
4 | +defined('ABSPATH') || exit; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Class ActionItem |