@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since $VID:$ |
15 | 15 | * |
16 | 16 | */ |
17 | -abstract class EE_PMT_Base{ |
|
17 | +abstract class EE_PMT_Base { |
|
18 | 18 | |
19 | 19 | const onsite = 'on-site'; |
20 | 20 | const offsite = 'off-site'; |
@@ -95,36 +95,36 @@ discard block |
||
95 | 95 | * @return EE_PMT_Base |
96 | 96 | */ |
97 | 97 | function __construct($pm_instance = NULL) { |
98 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
98 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
99 | 99 | $this->set_instance($pm_instance); |
100 | 100 | } |
101 | 101 | $this->_set_file_folder(); |
102 | 102 | $this->_set_file_url(); |
103 | - if($this->_gateway){ |
|
104 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
105 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
106 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
107 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
108 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
109 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
110 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
111 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
103 | + if ($this->_gateway) { |
|
104 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
105 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
106 | + EE_Registry::instance()->load_helper('Template'); |
|
107 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
108 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
109 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
110 | + EE_Registry::instance()->load_helper('Money'); |
|
111 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
112 | 112 | } |
113 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
113 | + if ( ! isset($this->_has_billing_form)) { |
|
114 | 114 | // by default, On Site gateways have a billing form |
115 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
116 | - $this->set_has_billing_form( true ); |
|
115 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
116 | + $this->set_has_billing_form(true); |
|
117 | 117 | } else { |
118 | - $this->set_has_billing_form( false ); |
|
118 | + $this->set_has_billing_form(false); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - if( ! $this->_pretty_name){ |
|
122 | + if ( ! $this->_pretty_name) { |
|
123 | 123 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
124 | 124 | } |
125 | 125 | //if the child didn't specify a default button, use the credit card one |
126 | - if( $this->_default_button_url === NULL){ |
|
127 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
126 | + if ($this->_default_button_url === NULL) { |
|
127 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * @param boolean $has_billing_form |
135 | 135 | */ |
136 | - public function set_has_billing_form( $has_billing_form ) { |
|
137 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
136 | + public function set_has_billing_form($has_billing_form) { |
|
137 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * sets the file_folder property |
144 | 144 | */ |
145 | - protected function _set_file_folder(){ |
|
145 | + protected function _set_file_folder() { |
|
146 | 146 | $reflector = new ReflectionClass(get_class($this)); |
147 | 147 | $fn = $reflector->getFileName(); |
148 | - $this->_file_folder = dirname($fn).DS; |
|
148 | + $this->_file_folder = dirname($fn).DS; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * sets the file URL with a trailing slash for this PMT |
155 | 155 | */ |
156 | - protected function _set_file_url(){ |
|
157 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
158 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
159 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
156 | + protected function _set_file_url() { |
|
157 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
158 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
159 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
160 | 160 | $this->_file_url = $file_path; |
161 | 161 | } |
162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * Gets the default description on all payment methods of this type |
165 | 165 | * @return string |
166 | 166 | */ |
167 | - public function default_description(){ |
|
167 | + public function default_description() { |
|
168 | 168 | return $this->_default_description; |
169 | 169 | } |
170 | 170 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * Returns the folder containing the PMT child class, with a trailing slash |
175 | 175 | * @return string |
176 | 176 | */ |
177 | - public function file_folder(){ |
|
177 | + public function file_folder() { |
|
178 | 178 | return $this->_file_folder; |
179 | 179 | } |
180 | 180 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | /** |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - public function file_url(){ |
|
186 | + public function file_url() { |
|
187 | 187 | return $this->_file_url; |
188 | 188 | } |
189 | 189 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * Its important teh payment method instance is set before |
195 | 195 | * @param EE_Payment_Method $payment_method_instance |
196 | 196 | */ |
197 | - function set_instance($payment_method_instance){ |
|
197 | + function set_instance($payment_method_instance) { |
|
198 | 198 | $this->_pm_instance = $payment_method_instance; |
199 | 199 | //if they have already requested the settings form, make sure its |
200 | 200 | //data matches this model object |
201 | - if($this->_settings_form){ |
|
201 | + if ($this->_settings_form) { |
|
202 | 202 | $this->settings_form()->populate_model_obj($payment_method_instance); |
203 | 203 | } |
204 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
204 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
205 | 205 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
206 | 206 | } |
207 | 207 | } |
@@ -212,14 +212,14 @@ discard block |
||
212 | 212 | * Gets teh form for displaying to admins where they setup the payment method |
213 | 213 | * @return EE_Payment_Method_Form |
214 | 214 | */ |
215 | - function settings_form(){ |
|
216 | - if( ! $this->_settings_form){ |
|
215 | + function settings_form() { |
|
216 | + if ( ! $this->_settings_form) { |
|
217 | 217 | $this->_settings_form = $this->generate_new_settings_form(); |
218 | - $this->_settings_form->set_payment_method_type( $this ); |
|
219 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
218 | + $this->_settings_form->set_payment_method_type($this); |
|
219 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
220 | 220 | //if we have already assigned a model object to this pmt, make |
221 | 221 | //sure its reflected in teh form we just generated |
222 | - if($this->_pm_instance){ |
|
222 | + if ($this->_pm_instance) { |
|
223 | 223 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
224 | 224 | } |
225 | 225 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | * this payment method type's settings form later in the request |
246 | 246 | * @param EE_Payment_Method_Form $form |
247 | 247 | */ |
248 | - public function set_settings_form($form){ |
|
248 | + public function set_settings_form($form) { |
|
249 | 249 | $this->_settings_form = $form; |
250 | 250 | } |
251 | 251 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param array $extra_args |
269 | 269 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
270 | 270 | */ |
271 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
271 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
272 | 272 | // has billing form already been regenerated ? or overwrite cache? |
273 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
274 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
273 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
274 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
275 | 275 | } |
276 | 276 | //if we know who the attendee is, and this is a billing form |
277 | 277 | //that uses attendee info, populate it |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | $transaction instanceof EE_Transaction && |
281 | 281 | $transaction->primary_registration() instanceof EE_Registration && |
282 | 282 | $transaction->primary_registration()->attendee() instanceof EE_Attendee |
283 | - ){ |
|
284 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
283 | + ) { |
|
284 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
285 | 285 | } |
286 | 286 | return $this->_billing_form; |
287 | 287 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * @param \EE_Transaction $transaction |
293 | 293 | * @return \EE_Billing_Info_Form |
294 | 294 | */ |
295 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
295 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
296 | 296 | |
297 | 297 | |
298 | 298 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param \EE_Billing_Info_Form $billing_form |
304 | 304 | * @return \EE_Billing_Info_Form |
305 | 305 | */ |
306 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
306 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
307 | 307 | return $billing_form; |
308 | 308 | } |
309 | 309 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * if you have form |
315 | 315 | * @param EE_Payment_Method $form |
316 | 316 | */ |
317 | - public function set_billing_form($form){ |
|
317 | + public function set_billing_form($form) { |
|
318 | 318 | $this->_billing_form = $form; |
319 | 319 | } |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * Returns whether or not this payment method requires HTTPS to be used |
325 | 325 | * @return boolean |
326 | 326 | */ |
327 | - function requires_https(){ |
|
327 | + function requires_https() { |
|
328 | 328 | return $this->_requires_https; |
329 | 329 | } |
330 | 330 | |
@@ -342,9 +342,9 @@ discard block |
||
342 | 342 | * @return EE_Payment |
343 | 343 | * @throws EE_Error |
344 | 344 | */ |
345 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
345 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
346 | 346 | // @todo: add surcharge for the payment method, if any |
347 | - if ( $this->_gateway ) { |
|
347 | + if ($this->_gateway) { |
|
348 | 348 | //there is a gateway, so we're going to make a payment object |
349 | 349 | //but wait! do they already have a payment in progress that we thought was failed? |
350 | 350 | $duplicate_properties = array( |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
356 | 356 | 'PAY_gateway_response' => null, |
357 | 357 | ); |
358 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
358 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
359 | 359 | //if we didn't already have a payment in progress for the same thing, |
360 | 360 | //then we actually want to make a new payment |
361 | - if ( ! $payment instanceof EE_Payment ){ |
|
361 | + if ( ! $payment instanceof EE_Payment) { |
|
362 | 362 | $payment = EE_Payment::new_instance( |
363 | 363 | array_merge( |
364 | 364 | $duplicate_properties, |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | } |
375 | 375 | //make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it |
376 | 376 | $payment->save(); |
377 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
377 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
378 | 378 | |
379 | 379 | // Offsite Gateway |
380 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
380 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
381 | 381 | |
382 | 382 | $payment = $this->_gateway->set_redirection_info( |
383 | 383 | $payment, |
@@ -393,17 +393,17 @@ discard block |
||
393 | 393 | ); |
394 | 394 | $payment->save(); |
395 | 395 | // Onsite Gateway |
396 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
396 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
397 | 397 | |
398 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
398 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
399 | 399 | $payment->save(); |
400 | 400 | |
401 | 401 | } else { |
402 | 402 | throw new EE_Error( |
403 | 403 | sprintf( |
404 | - __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ), |
|
404 | + __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'), |
|
405 | 405 | get_class($this), |
406 | - gettype( $this->_gateway ) |
|
406 | + gettype($this->_gateway) |
|
407 | 407 | ) |
408 | 408 | ); |
409 | 409 | } |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | } |
426 | 426 | |
427 | 427 | // if there is billing info, clean it and save it now |
428 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
429 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
428 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
429 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | return $payment; |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | * @param EE_Billing_Info_Form $billing_form |
440 | 440 | * @return array |
441 | 441 | */ |
442 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
443 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
444 | - return $billing_form->input_pretty_values( true ); |
|
445 | - }else{ |
|
442 | + protected function _get_billing_values_from_form($billing_form) { |
|
443 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
444 | + return $billing_form->input_pretty_values(true); |
|
445 | + } else { |
|
446 | 446 | return NULL; |
447 | 447 | } |
448 | 448 | } |
@@ -456,13 +456,13 @@ discard block |
||
456 | 456 | * @return EE_Payment |
457 | 457 | * @throws EE_Error |
458 | 458 | */ |
459 | - public function handle_ipn($req_data,$transaction){ |
|
459 | + public function handle_ipn($req_data, $transaction) { |
|
460 | 460 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
461 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
462 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
461 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
462 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
463 | 463 | |
464 | 464 | } |
465 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
465 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
466 | 466 | return $payment; |
467 | 467 | } |
468 | 468 | |
@@ -475,22 +475,22 @@ discard block |
||
475 | 475 | * @param EE_Transaction $transaction |
476 | 476 | * @return boolean success |
477 | 477 | */ |
478 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
479 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
478 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
479 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
480 | 480 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
481 | 481 | return false; |
482 | 482 | } |
483 | 483 | $primary_reg = $transaction->primary_registration(); |
484 | - if( ! $primary_reg ){ |
|
484 | + if ( ! $primary_reg) { |
|
485 | 485 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
486 | 486 | return false; |
487 | 487 | } |
488 | 488 | $attendee = $primary_reg->attendee(); |
489 | - if( ! $attendee ){ |
|
489 | + if ( ! $attendee) { |
|
490 | 490 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
491 | 491 | return false; |
492 | 492 | } |
493 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
493 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
494 | 494 | |
495 | 495 | } |
496 | 496 | |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * @param array $req_data |
504 | 504 | * @return EE_Payment |
505 | 505 | */ |
506 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
506 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
507 | 507 | return $transaction->last_payment(); |
508 | 508 | } |
509 | 509 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
521 | 521 | * @throws EE_Error |
522 | 522 | */ |
523 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
524 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
523 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
524 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @param EE_Transaction $transaction |
538 | 538 | * @return EE_Payment |
539 | 539 | */ |
540 | - public function finalize_payment_for($transaction){ |
|
540 | + public function finalize_payment_for($transaction) { |
|
541 | 541 | return $transaction->last_payment(); |
542 | 542 | } |
543 | 543 | |
@@ -547,10 +547,10 @@ discard block |
||
547 | 547 | * Whether or not this payment method's gateway supports sending refund requests |
548 | 548 | * @return boolean |
549 | 549 | */ |
550 | - public function supports_sending_refunds(){ |
|
551 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
550 | + public function supports_sending_refunds() { |
|
551 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
552 | 552 | return $this->_gateway->supports_sending_refunds(); |
553 | - }else{ |
|
553 | + } else { |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | } |
@@ -564,14 +564,14 @@ discard block |
||
564 | 564 | * @throws EE_Error |
565 | 565 | * @return EE_Payment |
566 | 566 | */ |
567 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
568 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
569 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
567 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
568 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
569 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
570 | 570 | } else { |
571 | 571 | throw new EE_Error( |
572 | 572 | sprintf( |
573 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
574 | - get_class( $this ) |
|
573 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
574 | + get_class($this) |
|
575 | 575 | ) |
576 | 576 | ); |
577 | 577 | } |
@@ -585,15 +585,15 @@ discard block |
||
585 | 585 | * @return string |
586 | 586 | * @throws EE_Error |
587 | 587 | */ |
588 | - public function payment_occurs(){ |
|
589 | - if( ! $this->_gateway){ |
|
588 | + public function payment_occurs() { |
|
589 | + if ( ! $this->_gateway) { |
|
590 | 590 | return EE_PMT_Base::offline; |
591 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
591 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
592 | 592 | return EE_PMT_Base::onsite; |
593 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
593 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
594 | 594 | return EE_PMT_Base::offsite; |
595 | - }else{ |
|
596 | - throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
|
595 | + } else { |
|
596 | + throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this))); |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | * @param EE_Payment $payment |
607 | 607 | * @return string |
608 | 608 | */ |
609 | - public function payment_overview_content(EE_Payment $payment){ |
|
609 | + public function payment_overview_content(EE_Payment $payment) { |
|
610 | 610 | EE_Registry::instance()->load_helper('Template'); |
611 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
611 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | /** |
617 | 617 | * @return array exactly like EE_Admin_Page _page_config's 'help_tabs' attribute. @see EE_Admin_Page::_set_page_config() |
618 | 618 | */ |
619 | - public function help_tabs_config(){ |
|
619 | + public function help_tabs_config() { |
|
620 | 620 | return array(); |
621 | 621 | } |
622 | 622 | |
@@ -627,9 +627,9 @@ discard block |
||
627 | 627 | * the payment method's table's PMT_type column) |
628 | 628 | * @return string |
629 | 629 | */ |
630 | - public function system_name(){ |
|
630 | + public function system_name() { |
|
631 | 631 | $classname = get_class($this); |
632 | - return str_replace("EE_PMT_",'',$classname); |
|
632 | + return str_replace("EE_PMT_", '', $classname); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | * A pretty i18n version of the PMT name |
639 | 639 | * @return string |
640 | 640 | */ |
641 | - public function pretty_name(){ |
|
641 | + public function pretty_name() { |
|
642 | 642 | return $this->_pretty_name; |
643 | 643 | } |
644 | 644 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | * Gets the default absolute URL to the payment method type's button |
649 | 649 | * @return string |
650 | 650 | */ |
651 | - public function default_button_url(){ |
|
651 | + public function default_button_url() { |
|
652 | 652 | return $this->_default_button_url; |
653 | 653 | } |
654 | 654 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * Gets the gateway used by this payment method (if any) |
659 | 659 | * @return EE_Gateway |
660 | 660 | */ |
661 | - public function get_gateway(){ |
|
661 | + public function get_gateway() { |
|
662 | 662 | return $this->_gateway; |
663 | 663 | } |
664 | 664 | |
@@ -667,9 +667,9 @@ discard block |
||
667 | 667 | /** |
668 | 668 | * @return string html for the link to a help tab |
669 | 669 | */ |
670 | - public function get_help_tab_link(){ |
|
671 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
672 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
670 | + public function get_help_tab_link() { |
|
671 | + EE_Registry::instance()->load_helper('Template'); |
|
672 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | * Returns the name of the help tab for this PMT |
679 | 679 | * @return string |
680 | 680 | */ |
681 | - public function get_help_tab_name(){ |
|
682 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
681 | + public function get_help_tab_name() { |
|
682 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
683 | 683 | } |
684 | 684 | |
685 | 685 | /** |
@@ -687,8 +687,8 @@ discard block |
||
687 | 687 | * this PMT by an admin |
688 | 688 | * @return string |
689 | 689 | */ |
690 | - public function cap_name(){ |
|
691 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
690 | + public function cap_name() { |
|
691 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
692 | 692 | } |
693 | 693 | |
694 | 694 | /** |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | * @param EE_Payment $payment |
701 | 701 | * @return void |
702 | 702 | */ |
703 | - public function update_txn_based_on_payment( $payment ){ |
|
704 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
705 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
703 | + public function update_txn_based_on_payment($payment) { |
|
704 | + if ($this->_gateway instanceof EE_Gateway) { |
|
705 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | protected function _get_billing_values_from_form( $billing_form ){ |
443 | 443 | if($billing_form instanceof EE_Form_Section_Proper ){ |
444 | 444 | return $billing_form->input_pretty_values( true ); |
445 | - }else{ |
|
445 | + } else{ |
|
446 | 446 | return NULL; |
447 | 447 | } |
448 | 448 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | public function supports_sending_refunds(){ |
551 | 551 | if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
552 | 552 | return $this->_gateway->supports_sending_refunds(); |
553 | - }else{ |
|
553 | + } else{ |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | } |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | public function payment_occurs(){ |
589 | 589 | if( ! $this->_gateway){ |
590 | 590 | return EE_PMT_Base::offline; |
591 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
591 | + } elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
592 | 592 | return EE_PMT_Base::onsite; |
593 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
593 | + } elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
594 | 594 | return EE_PMT_Base::offsite; |
595 | - }else{ |
|
595 | + } else{ |
|
596 | 596 | throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
597 | 597 | } |
598 | 598 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param string $template |
48 | 48 | * @param int $priority |
49 | 49 | */ |
50 | - public function __construct( $name, $label, $template, $priority = 100 ) { |
|
51 | - $this->set_name( $name ); |
|
52 | - $this->set_label( $label ); |
|
53 | - $this->set_template( $template ); |
|
54 | - $this->set_priority( $priority ); |
|
50 | + public function __construct($name, $label, $template, $priority = 100) { |
|
51 | + $this->set_name($name); |
|
52 | + $this->set_label($label); |
|
53 | + $this->set_template($template); |
|
54 | + $this->set_priority($priority); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @param mixed $name |
70 | 70 | */ |
71 | - public function set_name( $name ) { |
|
71 | + public function set_name($name) { |
|
72 | 72 | $this->name = $name; |
73 | 73 | } |
74 | 74 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @param string $label |
88 | 88 | */ |
89 | - public function set_label( $label ) { |
|
89 | + public function set_label($label) { |
|
90 | 90 | $this->label = $label; |
91 | 91 | } |
92 | 92 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param string $template |
106 | 106 | */ |
107 | - public function set_template( $template ) { |
|
107 | + public function set_template($template) { |
|
108 | 108 | $this->template = $template; |
109 | 109 | } |
110 | 110 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * @param int $priority |
124 | 124 | */ |
125 | - public function set_priority( $priority ) { |
|
126 | - $this->priority = intval( $priority ); |
|
125 | + public function set_priority($priority) { |
|
126 | + $this->priority = intval($priority); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
4 | - exit( 'No direct script access allowed' ); |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | + exit('No direct script access allowed'); |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | |
@@ -70,23 +70,23 @@ discard block |
||
70 | 70 | * @param string $template - name or path of template to be used by EEH_Template::locate_template() |
71 | 71 | * @param int $priority - order in which template parts should be applied |
72 | 72 | */ |
73 | - public function add_template_part( $name, $label, $template, $priority ) { |
|
73 | + public function add_template_part($name, $label, $template, $priority) { |
|
74 | 74 | // SplPriorityQueue doesn't play nice with multiple items having the same priority |
75 | 75 | // so if the incoming priority is already occupied, then let's increment it by one, |
76 | 76 | // and then pass everything back into this method and try again with the new priority |
77 | - if ( isset( $this->priorities[ $priority ] ) ) { |
|
77 | + if (isset($this->priorities[$priority])) { |
|
78 | 78 | $priority++; |
79 | - $this->add_template_part( $name, $label, $template, $priority ); |
|
79 | + $this->add_template_part($name, $label, $template, $priority); |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | // kk now we can mark this priority as being occupied |
83 | - $this->priorities[ $priority ] = true; |
|
83 | + $this->priorities[$priority] = true; |
|
84 | 84 | // create the template part and add to the queue |
85 | 85 | $this->template_parts->insert( |
86 | - new EE_Template_Part( $name, $label, $template, $priority ), |
|
86 | + new EE_Template_Part($name, $label, $template, $priority), |
|
87 | 87 | $priority |
88 | 88 | ); |
89 | - if ( $name == 'event' ) { |
|
89 | + if ($name == 'event') { |
|
90 | 90 | $this->event_desc_priority = $priority; |
91 | 91 | } |
92 | 92 | } |
@@ -103,10 +103,10 @@ discard block |
||
103 | 103 | * @param string $content |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function apply_template_part_filters( $content = '' ) { |
|
106 | + public function apply_template_part_filters($content = '') { |
|
107 | 107 | $this->template_parts->rewind(); |
108 | 108 | // loop through template parts and position content |
109 | - while ( $this->template_parts->valid() ) { |
|
109 | + while ($this->template_parts->valid()) { |
|
110 | 110 | $this->_position_template_part( |
111 | 111 | $content, |
112 | 112 | $this->template_parts->current()->template(), |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $this->template_parts->next(); |
116 | 116 | } |
117 | 117 | // now simply add our three strings of content together |
118 | - return $this->before_event_content . $this->event_content . $this->after_event_content; |
|
118 | + return $this->before_event_content.$this->event_content.$this->after_event_content; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * @param int $priority |
137 | 137 | * @return string |
138 | 138 | */ |
139 | - protected function _position_template_part( $content, $template, $priority ) { |
|
139 | + protected function _position_template_part($content, $template, $priority) { |
|
140 | 140 | // Event Description content is the actual incoming content itself |
141 | - if ( $priority === $this->event_desc_priority ) { |
|
141 | + if ($priority === $this->event_desc_priority) { |
|
142 | 142 | $this->event_content = $content; |
143 | - } else if ( $priority < $this->event_desc_priority ) { |
|
143 | + } else if ($priority < $this->event_desc_priority) { |
|
144 | 144 | // everything BEFORE the Event Description |
145 | - $this->before_event_content .= EEH_Template::locate_template( $template ); |
|
146 | - } else if ( $priority > $this->event_desc_priority ) { |
|
145 | + $this->before_event_content .= EEH_Template::locate_template($template); |
|
146 | + } else if ($priority > $this->event_desc_priority) { |
|
147 | 147 | // everything AFTER the Event Description |
148 | - $this->after_event_content .= EEH_Template::locate_template( $template ); |
|
148 | + $this->after_event_content .= EEH_Template::locate_template($template); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | $list_item_css_class = '', |
171 | 171 | $list_item_css_id_prefix = '' |
172 | 172 | ) { |
173 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
174 | - $event_archive_display_order = EEH_HTML::ul( $list_css_id, $list_css_class ); |
|
173 | + EE_Registry::instance()->load_helper('HTML'); |
|
174 | + $event_archive_display_order = EEH_HTML::ul($list_css_id, $list_css_class); |
|
175 | 175 | $this->template_parts->rewind(); |
176 | 176 | // loop through template parts and add template content |
177 | - while ( $this->template_parts->valid() ) { |
|
177 | + while ($this->template_parts->valid()) { |
|
178 | 178 | $event_archive_display_order .= EEH_HTML::li( |
179 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-up-alt2' ) . |
|
180 | - EEH_HTML::span( '', '', 'dashicons dashicons-arrow-down-alt2' ) . |
|
179 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-up-alt2'). |
|
180 | + EEH_HTML::span('', '', 'dashicons dashicons-arrow-down-alt2'). |
|
181 | 181 | $this->template_parts->current()->label(), |
182 | - $list_item_css_id_prefix . $this->template_parts->current()->name(), |
|
182 | + $list_item_css_id_prefix.$this->template_parts->current()->name(), |
|
183 | 183 | $list_item_css_class |
184 | 184 | ); |
185 | 185 | $this->template_parts->next(); |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | * @return string |
200 | 200 | */ |
201 | 201 | public function display_template_parts() { |
202 | - if ( WP_DEBUG ) { |
|
202 | + if (WP_DEBUG) { |
|
203 | 203 | $this->template_parts->rewind(); |
204 | - while ( $this->template_parts->valid() ) { |
|
205 | - EEH_Debug_Tools::printr( $this->template_parts->current(), 'template_part', __FILE__, __LINE__ ); |
|
204 | + while ($this->template_parts->valid()) { |
|
205 | + EEH_Debug_Tools::printr($this->template_parts->current(), 'template_part', __FILE__, __LINE__); |
|
206 | 206 | $this->template_parts->next(); |
207 | 207 | } |
208 | 208 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part_PriorityQueue |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param int $priority |
32 | 32 | * @return bool |
33 | 33 | */ |
34 | - public function insert( $object, $priority = 100 ) { |
|
35 | - if ( $object instanceof EE_Template_Part ) { |
|
36 | - parent::insert( $object, $priority ); |
|
34 | + public function insert($object, $priority = 100) { |
|
35 | + if ($object instanceof EE_Template_Part) { |
|
36 | + parent::insert($object, $priority); |
|
37 | 37 | return true; |
38 | 38 | } else { |
39 | 39 | return false; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param int $priority2 |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - public function compare( $priority1, $priority2 ) { |
|
56 | - if ( $priority1 === $priority2 ) { |
|
55 | + public function compare($priority1, $priority2) { |
|
56 | + if ($priority1 === $priority2) { |
|
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | return $priority1 > $priority2 ? -1 : 1; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @param EE_Response $response |
22 | 22 | * @return EE_Response |
23 | 23 | */ |
24 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
24 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
25 | 25 | $this->_request = $request; |
26 | 26 | $this->_response = $response; |
27 | 27 | $this->display_alpha_banner_warning(); |
28 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
28 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
29 | 29 | return $this->_response; |
30 | 30 | } |
31 | 31 | |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function display_alpha_banner_warning() { |
43 | 43 | // skip AJAX requests |
44 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
44 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | // skip stable releases |
48 | - if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) { |
|
48 | + if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | // post release candidate warning |
52 | - if ( is_admin() ) { |
|
53 | - add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 ); |
|
52 | + if (is_admin()) { |
|
53 | + add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999); |
|
54 | 54 | } else { |
55 | 55 | // site admin has authorized use of non-stable release candidate for production |
56 | - if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) { |
|
56 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | - add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 ); |
|
59 | + add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function alpha_banner_admin_notice() { |
73 | 73 | EE_Error::add_attention( |
74 | 74 | sprintf( |
75 | - __( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ), |
|
75 | + __('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'), |
|
76 | 76 | '<strong>', |
77 | 77 | '</strong>' |
78 | 78 | ), |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function alpha_banner_warning_notice() { |
93 | 93 | global $pagenow; |
94 | - if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) { |
|
94 | + if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) { |
|
95 | 95 | return; |
96 | 96 | } |
97 | 97 | printf( |
98 | - __( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ), |
|
98 | + __('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'), |
|
99 | 99 | '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>', |
100 | 100 | '<strong>', |
101 | 101 | '</strong>', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param \EEI_Request_Decorator $request_stack |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $request_stack ) { |
|
46 | + public function __construct(EEI_Request_Decorator $request_stack) { |
|
47 | 47 | $this->request_stack = $request_stack; |
48 | 48 | } |
49 | 49 | |
@@ -57,13 +57,13 @@ discard block |
||
57 | 57 | * @param EE_Response $response |
58 | 58 | * @return EE_Response |
59 | 59 | */ |
60 | - protected function process_request_stack( EE_Request $request, EE_Response $response ) { |
|
60 | + protected function process_request_stack(EE_Request $request, EE_Response $response) { |
|
61 | 61 | $this->_request = $request; |
62 | 62 | $this->_response = $response; |
63 | - if ( ! $this->_response->request_terminated() ) { |
|
64 | - $this->_response = $this->request_stack->handle_request( $this->_request, $this->_response ); |
|
63 | + if ( ! $this->_response->request_terminated()) { |
|
64 | + $this->_response = $this->request_stack->handle_request($this->_request, $this->_response); |
|
65 | 65 | } else { |
66 | - espresso_deactivate_plugin( EE_PLUGIN_BASENAME ); |
|
66 | + espresso_deactivate_plugin(EE_PLUGIN_BASENAME); |
|
67 | 67 | } |
68 | 68 | return $this->_response; |
69 | 69 | } |
@@ -22,34 +22,34 @@ discard block |
||
22 | 22 | * @param EE_Response $response |
23 | 23 | * @return EE_Response |
24 | 24 | */ |
25 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
25 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
26 | 26 | $this->_request = $request; |
27 | 27 | $this->_response = $response; |
28 | 28 | //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
29 | 29 | //$this->_response->set_notice( 1, 'hey look at this' ); |
30 | 30 | // check required WP version |
31 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
32 | - $this->_request->un_set( 'activate', true ); |
|
33 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
31 | + if ( ! $this->_minimum_wp_version_required()) { |
|
32 | + $this->_request->un_set('activate', true); |
|
33 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
34 | 34 | //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
35 | 35 | $this->_response->terminate_request(); |
36 | 36 | } |
37 | 37 | // check required PHP version |
38 | - if ( ! $this->_minimum_php_version_required() ) { |
|
39 | - $this->_request->un_set( 'activate', true ); |
|
40 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
38 | + if ( ! $this->_minimum_php_version_required()) { |
|
39 | + $this->_request->un_set('activate', true); |
|
40 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
41 | 41 | //$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' ); |
42 | 42 | $this->_response->terminate_request(); |
43 | 43 | } |
44 | 44 | // check recommended WP version |
45 | - if ( ! $this->_minimum_wp_version_recommended() ) { |
|
45 | + if ( ! $this->_minimum_wp_version_recommended()) { |
|
46 | 46 | $this->_display_minimum_recommended_wp_version_notice(); |
47 | 47 | } |
48 | 48 | // check recommended PHP version |
49 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
49 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
50 | 50 | $this->_display_minimum_recommended_php_version_notice(); |
51 | 51 | } |
52 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
52 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
53 | 53 | //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
54 | 54 | return $this->_response; |
55 | 55 | } |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param string $min_version |
64 | 64 | * @return boolean |
65 | 65 | */ |
66 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
66 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
67 | 67 | global $wp_version; |
68 | - return version_compare( $wp_version, $min_version, '>=' ) ? true : false; |
|
68 | + return version_compare($wp_version, $min_version, '>=') ? true : false; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | 79 | private function _minimum_wp_version_required() { |
80 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
80 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return boolean |
90 | 90 | */ |
91 | 91 | private function _minimum_wp_version_recommended() { |
92 | - return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED ); |
|
92 | + return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * @param string $min_version |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
105 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false; |
|
104 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
105 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @return boolean |
115 | 115 | */ |
116 | 116 | private function _minimum_php_version_required() { |
117 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
117 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return boolean |
127 | 127 | */ |
128 | 128 | private function _minimum_php_version_recommended() { |
129 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
129 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | <p> |
144 | 144 | <?php |
145 | 145 | printf( |
146 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
146 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
147 | 147 | EE_MIN_WP_VER_REQUIRED, |
148 | 148 | $wp_version, |
149 | 149 | '<br/>', |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | <p> |
169 | 169 | <?php |
170 | 170 | printf( |
171 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
171 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
172 | 172 | EE_MIN_PHP_VER_REQUIRED, |
173 | 173 | PHP_VERSION, |
174 | 174 | '<br/>', |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | private function _display_minimum_recommended_wp_version_notice() { |
192 | 192 | global $wp_version; |
193 | 193 | EE_Error::add_persistent_admin_notice( |
194 | - 'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended', |
|
194 | + 'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended', |
|
195 | 195 | sprintf( |
196 | - __( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
196 | + __('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
197 | 197 | EE_MIN_WP_VER_RECOMMENDED, |
198 | 198 | $wp_version, |
199 | 199 | '<br/>', |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | */ |
213 | 213 | private function _display_minimum_recommended_php_version_notice() { |
214 | 214 | EE_Error::add_persistent_admin_notice( |
215 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
215 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
216 | 216 | sprintf( |
217 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
217 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
218 | 218 | EE_MIN_PHP_VER_RECOMMENDED, |
219 | 219 | PHP_VERSION, |
220 | 220 | '<br/>', |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @access public |
39 | 39 | * @param array $request |
40 | 40 | */ |
41 | - public function __construct( $request ) { |
|
41 | + public function __construct($request) { |
|
42 | 42 | // grab request vars |
43 | 43 | $this->_params = $request; |
44 | 44 | // AJAX ??? |
45 | - $this->ajax = defined( 'DOING_AJAX' ) ? TRUE : FALSE; |
|
46 | - $this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? TRUE : FALSE; |
|
45 | + $this->ajax = defined('DOING_AJAX') ? TRUE : FALSE; |
|
46 | + $this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? TRUE : FALSE; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * @param bool $override_ee |
68 | 68 | * @return void |
69 | 69 | */ |
70 | - public function set( $key, $value, $override_ee = FALSE ) { |
|
70 | + public function set($key, $value, $override_ee = FALSE) { |
|
71 | 71 | // don't allow "ee" to be overwritten unless explicitly instructed to do so |
72 | - if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) { |
|
73 | - $this->_params[ $key ] = $value; |
|
72 | + if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) { |
|
73 | + $this->_params[$key] = $value; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | * @param null $default |
85 | 85 | * @return mixed |
86 | 86 | */ |
87 | - public function get( $key, $default = NULL ) { |
|
88 | - return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default; |
|
87 | + public function get($key, $default = NULL) { |
|
88 | + return isset($this->_params[$key]) ? $this->_params[$key] : $default; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param $key |
98 | 98 | * @return boolean |
99 | 99 | */ |
100 | - public function is_set( $key ) { |
|
101 | - return isset( $this->_params[ $key ] ) ? TRUE : FALSE; |
|
100 | + public function is_set($key) { |
|
101 | + return isset($this->_params[$key]) ? TRUE : FALSE; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * @param $key |
111 | 111 | * @param bool $unset_from_global_too |
112 | 112 | */ |
113 | - public function un_set( $key, $unset_from_global_too = false ) { |
|
114 | - unset( $this->_params[ $key ] ); |
|
115 | - if ( $unset_from_global_too ) { |
|
116 | - unset( $_REQUEST[ $key ] ); |
|
113 | + public function un_set($key, $unset_from_global_too = false) { |
|
114 | + unset($this->_params[$key]); |
|
115 | + if ($unset_from_global_too) { |
|
116 | + unset($_REQUEST[$key]); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param EEI_Request_Decorator $application |
44 | 44 | * @param array $middlewares |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $application, $middlewares = array() ) { |
|
46 | + public function __construct(EEI_Request_Decorator $application, $middlewares = array()) { |
|
47 | 47 | $this->_application = $application; |
48 | 48 | $this->_middlewares = $middlewares; |
49 | 49 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @param EE_Response $response |
56 | 56 | * @return EE_Response |
57 | 57 | */ |
58 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
58 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
59 | 59 | $this->_request = $request; |
60 | 60 | $this->_response = $response; |
61 | - return $this->_application->handle_request( $request, $response ); |
|
61 | + return $this->_application->handle_request($request, $response); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -70,9 +70,9 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function handle_response() { |
72 | 72 | $prev_middleware = null; |
73 | - foreach ( $this->_middlewares as $middleware ) { |
|
74 | - if ( ! $prev_middleware instanceof EEI_Request_Stack_Core_App && $middleware instanceof EEI_Request_Stack_Core_App ) { |
|
75 | - $middleware->handle_response( $this->_request, $this->_response ); |
|
73 | + foreach ($this->_middlewares as $middleware) { |
|
74 | + if ( ! $prev_middleware instanceof EEI_Request_Stack_Core_App && $middleware instanceof EEI_Request_Stack_Core_App) { |
|
75 | + $middleware->handle_response($this->_request, $this->_response); |
|
76 | 76 | } |
77 | 77 | $prev_middleware = $middleware; |
78 | 78 | } |