@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class EE_Messages_Html_Invoice_Validator extends EE_Messages_Validator { |
| 26 | 26 | |
| 27 | - public function __construct( $fields, $context ) { |
|
| 27 | + public function __construct($fields, $context) { |
|
| 28 | 28 | $this->_m_name = 'html'; |
| 29 | 29 | $this->_mt_name = 'invoice'; |
| 30 | 30 | |
| 31 | - parent::__construct( $fields, $context ); |
|
| 31 | + parent::__construct($fields, $context); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | 11 | |
| 12 | 12 | /** |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | class EE_Messages_Html_Receipt_Validator extends EE_Messages_Validator { |
| 26 | 26 | |
| 27 | - public function __construct( $fields, $context ) { |
|
| 27 | + public function __construct($fields, $context) { |
|
| 28 | 28 | $this->_m_name = 'html'; |
| 29 | 29 | $this->_mt_name = 'receipt'; |
| 30 | 30 | |
| 31 | - parent::__construct( $fields, $context ); |
|
| 31 | + parent::__construct($fields, $context); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -6,8 +6,9 @@ |
||
| 6 | 6 | * @package Event Espresso |
| 7 | 7 | * @subpackage messages |
| 8 | 8 | */ |
| 9 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 9 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 10 | 10 | exit('NO direct script access allowed'); |
| 11 | +} |
|
| 11 | 12 | |
| 12 | 13 | /** |
| 13 | 14 | * |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | * |
| 6 | 6 | * allows gateways to be used by different systems other than Event Espresso |
| 7 | 7 | */ |
| 8 | -interface EEI_Payment extends EEI_Base{ |
|
| 8 | +interface EEI_Payment extends EEI_Base { |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * @return string indicating which the payment is approved, pending, cancelled or failed |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Interface EEI_Payment_Method |
| 154 | 154 | */ |
| 155 | -interface EEI_Payment_Method{ |
|
| 155 | +interface EEI_Payment_Method { |
|
| 156 | 156 | |
| 157 | 157 | } |
| 158 | 158 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param string $model_name |
| 172 | 172 | * @return EE_Log |
| 173 | 173 | */ |
| 174 | - function gateway_log($message,$id,$model_name); |
|
| 174 | + function gateway_log($message, $id, $model_name); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * ------------------------------------------------------------------------ |
| 26 | 26 | */ |
| 27 | -abstract class EE_Offsite_Gateway extends EE_Gateway{ |
|
| 27 | +abstract class EE_Offsite_Gateway extends EE_Gateway { |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * whether or not the gateway uses an IPN |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $cancel_url URL to send the user to after a cancelled payment attempt on teh payment provider's website |
| 57 | 57 | * @return EE_Payment |
| 58 | 58 | */ |
| 59 | - public abstract function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
| 59 | + public abstract function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param EEI_Transaction $transaction |
| 69 | 69 | * @return EEI_Payment updated |
| 70 | 70 | */ |
| 71 | - public abstract function handle_payment_update($update_info,$transaction); |
|
| 71 | + public abstract function handle_payment_update($update_info, $transaction); |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | |
@@ -94,8 +94,8 @@ discard block |
||
| 94 | 94 | * @access protected |
| 95 | 95 | * @param boolean $uses_separate_IPN_request |
| 96 | 96 | */ |
| 97 | - protected function set_uses_separate_IPN_request( $uses_separate_IPN_request ) { |
|
| 98 | - $this->_uses_separate_IPN_request = filter_var( $uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN ); |
|
| 97 | + protected function set_uses_separate_IPN_request($uses_separate_IPN_request) { |
|
| 98 | + $this->_uses_separate_IPN_request = filter_var($uses_separate_IPN_request, FILTER_VALIDATE_BOOLEAN); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * ------------------------------------------------------------------------ |
| 26 | 26 | */ |
| 27 | -abstract class EE_Onsite_Gateway extends EE_Gateway{ |
|
| 27 | +abstract class EE_Onsite_Gateway extends EE_Gateway { |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * @return EE_Onsite_Gateway |
@@ -53,5 +53,5 @@ discard block |
||
| 53 | 53 | * } unless a child class specifies these array keys are NOT present |
| 54 | 54 | * @return EE_Payment updated |
| 55 | 55 | */ |
| 56 | - public abstract function do_direct_payment($payment,$billing_info = null); |
|
| 56 | + public abstract function do_direct_payment($payment, $billing_info = null); |
|
| 57 | 57 | } |
@@ -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 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | public function process_refund($payment, $refund_info = array()){ |
| 568 | 568 | if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
| 569 | 569 | return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
| 570 | - }else{ |
|
| 570 | + } else{ |
|
| 571 | 571 | throw new EE_Error(sprintf(__("Payment Method Type '%s' does not support sending refund requests", "event_espresso"),get_class($this))); |
| 572 | 572 | } |
| 573 | 573 | } |
@@ -583,11 +583,11 @@ discard block |
||
| 583 | 583 | public function payment_occurs(){ |
| 584 | 584 | if( ! $this->_gateway){ |
| 585 | 585 | return EE_PMT_Base::offline; |
| 586 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
| 586 | + } elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
| 587 | 587 | return EE_PMT_Base::onsite; |
| 588 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
| 588 | + } elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
| 589 | 589 | return EE_PMT_Base::offsite; |
| 590 | - }else{ |
|
| 590 | + } else{ |
|
| 591 | 591 | 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))); |
| 592 | 592 | } |
| 593 | 593 | } |
@@ -304,7 +304,7 @@ |
||
| 304 | 304 | * @param null $fail_url |
| 305 | 305 | * @param string $method |
| 306 | 306 | * @param bool $by_admin |
| 307 | - * @return \EE_Base_Class|\EE_Payment|null |
|
| 307 | + * @return EE_Payment|null |
|
| 308 | 308 | * @throws EE_Error |
| 309 | 309 | */ |
| 310 | 310 | function process_payment( EE_Transaction $transaction, $amount = NULL, $billing_info = NULL, $return_url = NULL,$fail_url = NULL, $method = 'CART', $by_admin = FALSE ){ |
@@ -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'; |
@@ -90,27 +90,27 @@ discard block |
||
| 90 | 90 | * @return EE_PMT_Base |
| 91 | 91 | */ |
| 92 | 92 | function __construct($pm_instance = NULL) { |
| 93 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
| 93 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
| 94 | 94 | $this->set_instance($pm_instance); |
| 95 | 95 | } |
| 96 | 96 | $this->_set_file_folder(); |
| 97 | 97 | $this->_set_file_url(); |
| 98 | - if($this->_gateway){ |
|
| 99 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
| 100 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
| 101 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 102 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
| 103 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 104 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
| 105 | - EE_Registry::instance()->load_helper( 'Money' ); |
|
| 106 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
| 98 | + if ($this->_gateway) { |
|
| 99 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
| 100 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
| 101 | + EE_Registry::instance()->load_helper('Template'); |
|
| 102 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
| 103 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 104 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
| 105 | + EE_Registry::instance()->load_helper('Money'); |
|
| 106 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
| 107 | 107 | } |
| 108 | - if( ! $this->_pretty_name){ |
|
| 108 | + if ( ! $this->_pretty_name) { |
|
| 109 | 109 | 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"))); |
| 110 | 110 | } |
| 111 | 111 | //if the child didn't specify a default button, use the credit card one |
| 112 | - if( $this->_default_button_url === NULL){ |
|
| 113 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
| 112 | + if ($this->_default_button_url === NULL) { |
|
| 113 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,10 +119,10 @@ discard block |
||
| 119 | 119 | /** |
| 120 | 120 | * sets the file_folder property |
| 121 | 121 | */ |
| 122 | - protected function _set_file_folder(){ |
|
| 122 | + protected function _set_file_folder() { |
|
| 123 | 123 | $reflector = new ReflectionClass(get_class($this)); |
| 124 | 124 | $fn = $reflector->getFileName(); |
| 125 | - $this->_file_folder = dirname($fn).DS; |
|
| 125 | + $this->_file_folder = dirname($fn).DS; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | |
@@ -130,10 +130,10 @@ discard block |
||
| 130 | 130 | /** |
| 131 | 131 | * sets the file URL with a trailing slash for this PMT |
| 132 | 132 | */ |
| 133 | - protected function _set_file_url(){ |
|
| 134 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
| 135 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
| 136 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
| 133 | + protected function _set_file_url() { |
|
| 134 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
| 135 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
| 136 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
| 137 | 137 | $this->_file_url = $file_path; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * Gets the default description on all payment methods of this type |
| 142 | 142 | * @return string |
| 143 | 143 | */ |
| 144 | - public function default_description(){ |
|
| 144 | + public function default_description() { |
|
| 145 | 145 | return $this->_default_description; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * Returns the folder containing the PMT child class, with a trailing slash |
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | - public function file_folder(){ |
|
| 154 | + public function file_folder() { |
|
| 155 | 155 | return $this->_file_folder; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | /** |
| 161 | 161 | * @return string |
| 162 | 162 | */ |
| 163 | - public function file_url(){ |
|
| 163 | + public function file_url() { |
|
| 164 | 164 | return $this->_file_url; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -171,14 +171,14 @@ discard block |
||
| 171 | 171 | * Its important teh payment method instance is set before |
| 172 | 172 | * @param EE_Payment_Method $payment_method_instance |
| 173 | 173 | */ |
| 174 | - function set_instance($payment_method_instance){ |
|
| 174 | + function set_instance($payment_method_instance) { |
|
| 175 | 175 | $this->_pm_instance = $payment_method_instance; |
| 176 | 176 | //if they have already requested the settings form, make sure its |
| 177 | 177 | //data matches this model object |
| 178 | - if($this->_settings_form){ |
|
| 178 | + if ($this->_settings_form) { |
|
| 179 | 179 | $this->settings_form()->populate_model_obj($payment_method_instance); |
| 180 | 180 | } |
| 181 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
| 181 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
| 182 | 182 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
| 183 | 183 | } |
| 184 | 184 | } |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | * Gets teh form for displaying to admins where they setup the payment method |
| 190 | 190 | * @return EE_Payment_Method_Form |
| 191 | 191 | */ |
| 192 | - function settings_form(){ |
|
| 193 | - if( ! $this->_settings_form){ |
|
| 192 | + function settings_form() { |
|
| 193 | + if ( ! $this->_settings_form) { |
|
| 194 | 194 | $this->_settings_form = $this->generate_new_settings_form(); |
| 195 | - $this->_settings_form->set_payment_method_type( $this ); |
|
| 196 | - $this->_settings_form->_construct_finalize(NULL, NULL ); |
|
| 195 | + $this->_settings_form->set_payment_method_type($this); |
|
| 196 | + $this->_settings_form->_construct_finalize(NULL, NULL); |
|
| 197 | 197 | //if we have already assigned a model object to this pmt, make |
| 198 | 198 | //sure its reflected in teh form we just generated |
| 199 | - if($this->_pm_instance){ |
|
| 199 | + if ($this->_pm_instance) { |
|
| 200 | 200 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * this payment method type's settings form later in the request |
| 223 | 223 | * @param EE_Payment_Method_Form $form |
| 224 | 224 | */ |
| 225 | - public function set_settings_form($form){ |
|
| 225 | + public function set_settings_form($form) { |
|
| 226 | 226 | $this->_settings_form = $form; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -235,18 +235,18 @@ discard block |
||
| 235 | 235 | * @param \EE_Transaction $transaction |
| 236 | 236 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form |
| 237 | 237 | */ |
| 238 | - public function billing_form( EE_Transaction $transaction = NULL ){ |
|
| 238 | + public function billing_form(EE_Transaction $transaction = NULL) { |
|
| 239 | 239 | // has billing form already been regenerated ? or overwrite cache? |
| 240 | - if( ! $this->_billing_form || ! $this->_cache_billing_form ){ |
|
| 241 | - $this->_billing_form = $this->generate_new_billing_form( $transaction ); |
|
| 240 | + if ( ! $this->_billing_form || ! $this->_cache_billing_form) { |
|
| 241 | + $this->_billing_form = $this->generate_new_billing_form($transaction); |
|
| 242 | 242 | } |
| 243 | 243 | //if we know who the attendee is, and this is a billing form |
| 244 | 244 | //that uses attendee info, populate it |
| 245 | - if( $this->_billing_form instanceof EE_Billing_Attendee_Info_Form && |
|
| 245 | + if ($this->_billing_form instanceof EE_Billing_Attendee_Info_Form && |
|
| 246 | 246 | $transaction instanceof EE_Transaction && |
| 247 | 247 | $transaction->primary_registration() instanceof EE_Registration && |
| 248 | - $transaction->primary_registration()->attendee() instanceof EE_Attendee ){ |
|
| 249 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
| 248 | + $transaction->primary_registration()->attendee() instanceof EE_Attendee) { |
|
| 249 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
| 250 | 250 | } |
| 251 | 251 | return $this->_billing_form; |
| 252 | 252 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @param \EE_Transaction $transaction |
| 258 | 258 | * @return \EE_Billing_Info_Form |
| 259 | 259 | */ |
| 260 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
| 260 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | * @param \EE_Billing_Info_Form $billing_form |
| 269 | 269 | * @return \EE_Billing_Info_Form |
| 270 | 270 | */ |
| 271 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
| 271 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
| 272 | 272 | return $billing_form; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * if you have form |
| 280 | 280 | * @param EE_Payment_Method $form |
| 281 | 281 | */ |
| 282 | - public function set_billing_form($form){ |
|
| 282 | + public function set_billing_form($form) { |
|
| 283 | 283 | $this->_billing_form = $form; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | * Returns whether or not this payment method requires HTTPS to be used |
| 290 | 290 | * @return boolean |
| 291 | 291 | */ |
| 292 | - function requires_https(){ |
|
| 292 | + function requires_https() { |
|
| 293 | 293 | return $this->_requires_https; |
| 294 | 294 | } |
| 295 | 295 | |
@@ -307,9 +307,9 @@ discard block |
||
| 307 | 307 | * @return \EE_Base_Class|\EE_Payment|null |
| 308 | 308 | * @throws EE_Error |
| 309 | 309 | */ |
| 310 | - function process_payment( EE_Transaction $transaction, $amount = NULL, $billing_info = NULL, $return_url = NULL,$fail_url = NULL, $method = 'CART', $by_admin = FALSE ){ |
|
| 310 | + function process_payment(EE_Transaction $transaction, $amount = NULL, $billing_info = NULL, $return_url = NULL, $fail_url = NULL, $method = 'CART', $by_admin = FALSE) { |
|
| 311 | 311 | // @todo: add surcharge for the payment method, if any |
| 312 | - if ( $this->_gateway ) { |
|
| 312 | + if ($this->_gateway) { |
|
| 313 | 313 | //there is a gateway, so we're going to make a payment object |
| 314 | 314 | //but wait! do they already have a payment in progress that we thought was failed? |
| 315 | 315 | $duplicate_properties = array( |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | 'PMD_ID' => $this->_pm_instance->ID(), |
| 321 | 321 | 'PAY_gateway_response'=>NULL, |
| 322 | 322 | ); |
| 323 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
| 323 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
| 324 | 324 | //if we didn't already have a payment in progress for the same thing, |
| 325 | 325 | //then we actually want to make a new payment |
| 326 | - if ( ! $payment instanceof EE_Payment ){ |
|
| 326 | + if ( ! $payment instanceof EE_Payment) { |
|
| 327 | 327 | $payment = EE_Payment::new_instance( |
| 328 | 328 | array_merge( |
| 329 | 329 | $duplicate_properties, |
| 330 | 330 | array( |
| 331 | - 'PAY_timestamp' => current_time( 'mysql' ), |
|
| 331 | + 'PAY_timestamp' => current_time('mysql'), |
|
| 332 | 332 | 'PAY_txn_id_chq_nmbr' => NULL, |
| 333 | 333 | 'PAY_po_number' => NULL, |
| 334 | 334 | 'PAY_extra_accntng' => NULL, |
@@ -339,10 +339,10 @@ discard block |
||
| 339 | 339 | } |
| 340 | 340 | //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 |
| 341 | 341 | $payment->save(); |
| 342 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
| 342 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
| 343 | 343 | |
| 344 | 344 | // Offsite Gateway |
| 345 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
| 345 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
| 346 | 346 | |
| 347 | 347 | $payment = $this->_gateway->set_redirection_info( |
| 348 | 348 | $payment, |
@@ -358,17 +358,17 @@ discard block |
||
| 358 | 358 | ); |
| 359 | 359 | |
| 360 | 360 | // Onsite Gateway |
| 361 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
| 361 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
| 362 | 362 | |
| 363 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
| 363 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
| 364 | 364 | $payment->save(); |
| 365 | 365 | |
| 366 | 366 | } else { |
| 367 | 367 | throw new EE_Error( |
| 368 | 368 | sprintf( |
| 369 | - __('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' ), |
|
| 369 | + __('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'), |
|
| 370 | 370 | get_class($this), |
| 371 | - gettype( $this->_gateway ) |
|
| 371 | + gettype($this->_gateway) |
|
| 372 | 372 | ) |
| 373 | 373 | ); |
| 374 | 374 | } |
@@ -380,8 +380,8 @@ discard block |
||
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // if there is billing info, clean it and save it now |
| 383 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
| 384 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
| 383 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
| 384 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | return $payment; |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | * @param EE_Billing_Info_Form $billing_form |
| 395 | 395 | * @return array |
| 396 | 396 | */ |
| 397 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
| 398 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
| 399 | - return $billing_form->input_pretty_values( true ); |
|
| 400 | - }else{ |
|
| 397 | + protected function _get_billing_values_from_form($billing_form) { |
|
| 398 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
| 399 | + return $billing_form->input_pretty_values(true); |
|
| 400 | + } else { |
|
| 401 | 401 | return NULL; |
| 402 | 402 | } |
| 403 | 403 | } |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | * @return EE_Payment |
| 412 | 412 | * @throws EE_Error |
| 413 | 413 | */ |
| 414 | - public function handle_ipn($req_data,$transaction){ |
|
| 414 | + public function handle_ipn($req_data, $transaction) { |
|
| 415 | 415 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
| 416 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
| 417 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
| 416 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
| 417 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
| 418 | 418 | |
| 419 | 419 | } |
| 420 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
| 420 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
| 421 | 421 | return $payment; |
| 422 | 422 | } |
| 423 | 423 | |
@@ -430,22 +430,22 @@ discard block |
||
| 430 | 430 | * @param EE_Transaction $transaction |
| 431 | 431 | * @return boolean success |
| 432 | 432 | */ |
| 433 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
| 434 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
| 433 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
| 434 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
| 435 | 435 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
| 436 | 436 | return false; |
| 437 | 437 | } |
| 438 | 438 | $primary_reg = $transaction->primary_registration(); |
| 439 | - if( ! $primary_reg ){ |
|
| 439 | + if ( ! $primary_reg) { |
|
| 440 | 440 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
| 441 | 441 | return false; |
| 442 | 442 | } |
| 443 | 443 | $attendee = $primary_reg->attendee(); |
| 444 | - if( ! $attendee ){ |
|
| 444 | + if ( ! $attendee) { |
|
| 445 | 445 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
| 446 | 446 | return false; |
| 447 | 447 | } |
| 448 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
| 448 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
| 449 | 449 | |
| 450 | 450 | } |
| 451 | 451 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @param array $req_data |
| 459 | 459 | * @return EE_Payment |
| 460 | 460 | */ |
| 461 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
| 461 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
| 462 | 462 | return $transaction->last_payment(); |
| 463 | 463 | } |
| 464 | 464 | |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
| 476 | 476 | * @throws EE_Error |
| 477 | 477 | */ |
| 478 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
| 479 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
| 478 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
| 479 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * @param EE_Transaction $transaction |
| 493 | 493 | * @return EE_Payment |
| 494 | 494 | */ |
| 495 | - public function finalize_payment_for($transaction){ |
|
| 495 | + public function finalize_payment_for($transaction) { |
|
| 496 | 496 | return $transaction->last_payment(); |
| 497 | 497 | } |
| 498 | 498 | |
@@ -502,10 +502,10 @@ discard block |
||
| 502 | 502 | * Whether or not this payment method's gateway supports sending refund requests |
| 503 | 503 | * @return boolean |
| 504 | 504 | */ |
| 505 | - public function supports_sending_refunds(){ |
|
| 506 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
| 505 | + public function supports_sending_refunds() { |
|
| 506 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
| 507 | 507 | return $this->_gateway->supports_sending_refunds(); |
| 508 | - }else{ |
|
| 508 | + } else { |
|
| 509 | 509 | return false; |
| 510 | 510 | } |
| 511 | 511 | } |
@@ -519,11 +519,11 @@ discard block |
||
| 519 | 519 | * @throws EE_Error |
| 520 | 520 | * @return EE_Payment |
| 521 | 521 | */ |
| 522 | - public function process_refund($payment, $refund_info = array()){ |
|
| 523 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
| 524 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
| 525 | - }else{ |
|
| 526 | - throw new EE_Error(sprintf(__("Payment Method Type '%s' does not support sending refund requests", "event_espresso"),get_class($this))); |
|
| 522 | + public function process_refund($payment, $refund_info = array()) { |
|
| 523 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
| 524 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
| 525 | + } else { |
|
| 526 | + throw new EE_Error(sprintf(__("Payment Method Type '%s' does not support sending refund requests", "event_espresso"), get_class($this))); |
|
| 527 | 527 | } |
| 528 | 528 | } |
| 529 | 529 | |
@@ -535,15 +535,15 @@ discard block |
||
| 535 | 535 | * @return string |
| 536 | 536 | * @throws EE_Error |
| 537 | 537 | */ |
| 538 | - public function payment_occurs(){ |
|
| 539 | - if( ! $this->_gateway){ |
|
| 538 | + public function payment_occurs() { |
|
| 539 | + if ( ! $this->_gateway) { |
|
| 540 | 540 | return EE_PMT_Base::offline; |
| 541 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
| 541 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
| 542 | 542 | return EE_PMT_Base::onsite; |
| 543 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
| 543 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
| 544 | 544 | return EE_PMT_Base::offsite; |
| 545 | - }else{ |
|
| 546 | - 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))); |
|
| 545 | + } else { |
|
| 546 | + 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))); |
|
| 547 | 547 | } |
| 548 | 548 | } |
| 549 | 549 | |
@@ -556,9 +556,9 @@ discard block |
||
| 556 | 556 | * @param EE_Payment $payment |
| 557 | 557 | * @return string |
| 558 | 558 | */ |
| 559 | - public function payment_overview_content(EE_Payment $payment){ |
|
| 559 | + public function payment_overview_content(EE_Payment $payment) { |
|
| 560 | 560 | EE_Registry::instance()->load_helper('Template'); |
| 561 | - 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); |
|
| 561 | + 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); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | /** |
| 567 | 567 | * @return array exactly like EE_Admin_Page _page_config's 'help_tabs' attribute. @see EE_Admin_Page::_set_page_config() |
| 568 | 568 | */ |
| 569 | - public function help_tabs_config(){ |
|
| 569 | + public function help_tabs_config() { |
|
| 570 | 570 | return array(); |
| 571 | 571 | } |
| 572 | 572 | |
@@ -577,9 +577,9 @@ discard block |
||
| 577 | 577 | * the payment method's table's PMT_type column) |
| 578 | 578 | * @return string |
| 579 | 579 | */ |
| 580 | - public function system_name(){ |
|
| 580 | + public function system_name() { |
|
| 581 | 581 | $classname = get_class($this); |
| 582 | - return str_replace("EE_PMT_",'',$classname); |
|
| 582 | + return str_replace("EE_PMT_", '', $classname); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | * A pretty i18n version of the PMT name |
| 589 | 589 | * @return string |
| 590 | 590 | */ |
| 591 | - public function pretty_name(){ |
|
| 591 | + public function pretty_name() { |
|
| 592 | 592 | return $this->_pretty_name; |
| 593 | 593 | } |
| 594 | 594 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | * Gets the default absolute URL to the payment method type's button |
| 599 | 599 | * @return string |
| 600 | 600 | */ |
| 601 | - public function default_button_url(){ |
|
| 601 | + public function default_button_url() { |
|
| 602 | 602 | return $this->_default_button_url; |
| 603 | 603 | } |
| 604 | 604 | |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | * Gets the gateway used by this payment method (if any) |
| 609 | 609 | * @return EE_Gateway |
| 610 | 610 | */ |
| 611 | - public function get_gateway(){ |
|
| 611 | + public function get_gateway() { |
|
| 612 | 612 | return $this->_gateway; |
| 613 | 613 | } |
| 614 | 614 | |
@@ -617,9 +617,9 @@ discard block |
||
| 617 | 617 | /** |
| 618 | 618 | * @return string html for the link to a help tab |
| 619 | 619 | */ |
| 620 | - public function get_help_tab_link(){ |
|
| 621 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
| 622 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
| 620 | + public function get_help_tab_link() { |
|
| 621 | + EE_Registry::instance()->load_helper('Template'); |
|
| 622 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | * Returns the name of the help tab for this PMT |
| 629 | 629 | * @return string |
| 630 | 630 | */ |
| 631 | - public function get_help_tab_name(){ |
|
| 632 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
| 631 | + public function get_help_tab_name() { |
|
| 632 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /** |
@@ -637,8 +637,8 @@ discard block |
||
| 637 | 637 | * this PMT by an admin |
| 638 | 638 | * @return string |
| 639 | 639 | */ |
| 640 | - public function cap_name(){ |
|
| 641 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
| 640 | + public function cap_name() { |
|
| 641 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | /** |
@@ -650,9 +650,9 @@ discard block |
||
| 650 | 650 | * @param EE_Payment $payment |
| 651 | 651 | * @return void |
| 652 | 652 | */ |
| 653 | - public function update_txn_based_on_payment( $payment ){ |
|
| 654 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
| 655 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
| 653 | + public function update_txn_based_on_payment($payment) { |
|
| 654 | + if ($this->_gateway instanceof EE_Gateway) { |
|
| 655 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
| 656 | 656 | } |
| 657 | 657 | } |
| 658 | 658 | |
@@ -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 | * |
| 4 | 6 | * Class EE_Payment_Method_Manager |
@@ -139,7 +141,7 @@ discard block |
||
| 139 | 141 | if(isset($this->_payment_method_types[$payment_method_name])){ |
| 140 | 142 | require_once($this->_payment_method_types[$payment_method_name]); |
| 141 | 143 | return true; |
| 142 | - }else{ |
|
| 144 | + } else{ |
|
| 143 | 145 | return false; |
| 144 | 146 | } |
| 145 | 147 | } |
@@ -159,7 +161,7 @@ discard block |
||
| 159 | 161 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
| 160 | 162 | } |
| 161 | 163 | return $payment_methods; |
| 162 | - }else{ |
|
| 164 | + } else{ |
|
| 163 | 165 | return array_keys($this->_payment_method_types); |
| 164 | 166 | } |
| 165 | 167 | } |
@@ -242,7 +244,7 @@ discard block |
||
| 242 | 244 | } |
| 243 | 245 | } |
| 244 | 246 | |
| 245 | - }else{ |
|
| 247 | + } else{ |
|
| 246 | 248 | $payment_method->set_active(); |
| 247 | 249 | $payment_method->save(); |
| 248 | 250 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public static function instance() { |
| 32 | 32 | // check if class object is instantiated, and instantiated properly |
| 33 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Payment_Method_Manager )) { |
|
| 33 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Payment_Method_Manager)) { |
|
| 34 | 34 | self::$_instance = new self(); |
| 35 | 35 | } |
| 36 | 36 | EE_Registry::instance()->load_lib('PMT_Base'); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * Resets the instance and returns a new one |
| 42 | 42 | * @return EE_Payment_Method_Manager |
| 43 | 43 | */ |
| 44 | - public static function reset(){ |
|
| 44 | + public static function reset() { |
|
| 45 | 45 | self::$_instance = NULL; |
| 46 | 46 | return self::instance(); |
| 47 | 47 | } |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | * or just re-use the PMTs we found last time we checked during this request (if |
| 53 | 53 | * we have not yet checked during this request, then we need to check anyways) |
| 54 | 54 | */ |
| 55 | - public function maybe_register_payment_methods( $force_recheck = FALSE ){ |
|
| 56 | - if( ! $this->_payment_method_types || $force_recheck ){ |
|
| 55 | + public function maybe_register_payment_methods($force_recheck = FALSE) { |
|
| 56 | + if ( ! $this->_payment_method_types || $force_recheck) { |
|
| 57 | 57 | $this->_register_payment_methods(); |
| 58 | 58 | //if in admin lets ensure caps are set. |
| 59 | - if ( is_admin() ) { |
|
| 60 | - add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) ); |
|
| 59 | + if (is_admin()) { |
|
| 60 | + add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps')); |
|
| 61 | 61 | EE_Registry::instance()->CAP->init_caps(); |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | protected function _register_payment_methods() { |
| 72 | 72 | // grab list of installed modules |
| 73 | - $pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
| 73 | + $pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
| 74 | 74 | // filter list of modules to register |
| 75 | - $pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register ); |
|
| 75 | + $pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register); |
|
| 76 | 76 | |
| 77 | 77 | // loop through folders |
| 78 | - foreach ( $pm_to_register as $pm_path ) { |
|
| 79 | - $this->register_payment_method( $pm_path ); |
|
| 78 | + foreach ($pm_to_register as $pm_path) { |
|
| 79 | + $this->register_payment_method($pm_path); |
|
| 80 | 80 | } |
| 81 | - do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' ); |
|
| 81 | + do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods'); |
|
| 82 | 82 | // filter list of installed modules |
| 83 | 83 | //keep them organized alphabetically by the payment method type's name |
| 84 | - ksort( $this->_payment_method_types ); |
|
| 85 | - return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types ); |
|
| 84 | + ksort($this->_payment_method_types); |
|
| 85 | + return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -94,35 +94,35 @@ discard block |
||
| 94 | 94 | * @param string $payment_method_path - full path up to and including payment method folder |
| 95 | 95 | * @return boolean |
| 96 | 96 | */ |
| 97 | - public function register_payment_method( $payment_method_path = '' ) { |
|
| 98 | - do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path ); |
|
| 97 | + public function register_payment_method($payment_method_path = '') { |
|
| 98 | + do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path); |
|
| 99 | 99 | $module_ext = '.pm.php'; |
| 100 | 100 | // make all separators match |
| 101 | - $payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS ); |
|
| 101 | + $payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS); |
|
| 102 | 102 | // grab and sanitize module name |
| 103 | - $module_dir = basename( $payment_method_path ); |
|
| 103 | + $module_dir = basename($payment_method_path); |
|
| 104 | 104 | // create classname from module directory name |
| 105 | - $module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir )); |
|
| 105 | + $module = str_replace(' ', '_', str_replace('_', ' ', $module_dir)); |
|
| 106 | 106 | // add class prefix |
| 107 | - $module_class = 'EE_PMT_' . $module; |
|
| 107 | + $module_class = 'EE_PMT_'.$module; |
|
| 108 | 108 | // does the module exist ? |
| 109 | - if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) { |
|
| 110 | - $msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module ); |
|
| 111 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 109 | + if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) { |
|
| 110 | + $msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module); |
|
| 111 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 112 | 112 | return FALSE; |
| 113 | 113 | } |
| 114 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); } |
|
| 114 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); } |
|
| 115 | 115 | // load the module class file |
| 116 | - require_once( $payment_method_path . DS . $module_class . $module_ext ); |
|
| 117 | - if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
| 116 | + require_once($payment_method_path.DS.$module_class.$module_ext); |
|
| 117 | + if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); } |
|
| 118 | 118 | // verify that class exists |
| 119 | - if ( ! class_exists( $module_class )) { |
|
| 120 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
| 121 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 119 | + if ( ! class_exists($module_class)) { |
|
| 120 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
| 121 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 122 | 122 | return FALSE; |
| 123 | 123 | } |
| 124 | 124 | // add to array of registered modules |
| 125 | - $this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext; |
|
| 125 | + $this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext; |
|
| 126 | 126 | return TRUE; |
| 127 | 127 | } |
| 128 | 128 | /** |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
| 132 | 132 | * @return boolean |
| 133 | 133 | */ |
| 134 | - public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){ |
|
| 135 | - if ( ! is_array( $this->_payment_method_types ) || ! isset( $this->_payment_method_types[$payment_method_name] ) |
|
| 136 | - || $force_recheck ) { |
|
| 134 | + public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) { |
|
| 135 | + if ( ! is_array($this->_payment_method_types) || ! isset($this->_payment_method_types[$payment_method_name]) |
|
| 136 | + || $force_recheck) { |
|
| 137 | 137 | $this->maybe_register_payment_methods($force_recheck); |
| 138 | 138 | } |
| 139 | - if(isset($this->_payment_method_types[$payment_method_name])){ |
|
| 139 | + if (isset($this->_payment_method_types[$payment_method_name])) { |
|
| 140 | 140 | require_once($this->_payment_method_types[$payment_method_name]); |
| 141 | 141 | return true; |
| 142 | - }else{ |
|
| 142 | + } else { |
|
| 143 | 143 | return false; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -150,16 +150,16 @@ discard block |
||
| 150 | 150 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
| 151 | 151 | * @return array |
| 152 | 152 | */ |
| 153 | - public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){ |
|
| 153 | + public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) { |
|
| 154 | 154 | $this->maybe_register_payment_methods($force_recheck); |
| 155 | - if($with_prefixes){ |
|
| 155 | + if ($with_prefixes) { |
|
| 156 | 156 | $classnames = array_keys($this->_payment_method_types); |
| 157 | 157 | $payment_methods = array(); |
| 158 | - foreach($classnames as $classname){ |
|
| 158 | + foreach ($classnames as $classname) { |
|
| 159 | 159 | $payment_methods[] = $this->payment_method_class_from_type($classname); |
| 160 | 160 | } |
| 161 | 161 | return $payment_methods; |
| 162 | - }else{ |
|
| 162 | + } else { |
|
| 163 | 163 | return array_keys($this->_payment_method_types); |
| 164 | 164 | } |
| 165 | 165 | } |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | * @param boolean $force_recheck whether to force re-checking for new payment method types |
| 170 | 170 | * @return EE_PMT_Base[] |
| 171 | 171 | */ |
| 172 | - public function payment_method_types( $force_recheck = FALSE ){ |
|
| 172 | + public function payment_method_types($force_recheck = FALSE) { |
|
| 173 | 173 | $this->maybe_register_payment_methods($force_recheck); |
| 174 | 174 | $pmt_objs = array(); |
| 175 | - foreach($this->payment_method_type_names(true) as $classname){ |
|
| 175 | + foreach ($this->payment_method_type_names(true) as $classname) { |
|
| 176 | 176 | $pmt_objs[] = new $classname; |
| 177 | 177 | } |
| 178 | 178 | return $pmt_objs; |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | * @param string $classname |
| 185 | 185 | * @return string |
| 186 | 186 | */ |
| 187 | - public function payment_method_type_sans_class_prefix($classname){ |
|
| 188 | - $pmt_name = str_replace("EE_PMT_","",$classname); |
|
| 187 | + public function payment_method_type_sans_class_prefix($classname) { |
|
| 188 | + $pmt_name = str_replace("EE_PMT_", "", $classname); |
|
| 189 | 189 | return $pmt_name; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param string $type |
| 195 | 195 | * @return string |
| 196 | 196 | */ |
| 197 | - public function payment_method_class_from_type($type){ |
|
| 197 | + public function payment_method_class_from_type($type) { |
|
| 198 | 198 | $this->maybe_register_payment_methods(); |
| 199 | 199 | return "EE_PMT_".$type; |
| 200 | 200 | } |
@@ -205,51 +205,51 @@ discard block |
||
| 205 | 205 | * @param string $payment_method_type the PMT_type; for EE_PMT_Invoice this would be 'Invoice' |
| 206 | 206 | * @return EE_Payment_Method |
| 207 | 207 | */ |
| 208 | - public function activate_a_payment_method_of_type( $payment_method_type ){ |
|
| 208 | + public function activate_a_payment_method_of_type($payment_method_type) { |
|
| 209 | 209 | $payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type); |
| 210 | - if( ! $payment_method){ |
|
| 210 | + if ( ! $payment_method) { |
|
| 211 | 211 | global $current_user; |
| 212 | 212 | $pm_type_class = $this->payment_method_class_from_type($payment_method_type); |
| 213 | - if(class_exists($pm_type_class)){ |
|
| 213 | + if (class_exists($pm_type_class)) { |
|
| 214 | 214 | /** @var $pm_type_obj EE_PMT_Base */ |
| 215 | 215 | $pm_type_obj = new $pm_type_class; |
| 216 | 216 | $payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name()); |
| 217 | - if( ! $payment_method){ |
|
| 217 | + if ( ! $payment_method) { |
|
| 218 | 218 | $payment_method = EE_Payment_Method::new_instance(array( |
| 219 | 219 | 'PMD_type'=>$pm_type_obj->system_name(), |
| 220 | 220 | 'PMD_name'=>$pm_type_obj->pretty_name(), |
| 221 | 221 | 'PMD_admin_name'=>$pm_type_obj->pretty_name(), |
| 222 | - 'PMD_slug'=>$pm_type_obj->system_name(),//automatically converted to slug |
|
| 222 | + 'PMD_slug'=>$pm_type_obj->system_name(), //automatically converted to slug |
|
| 223 | 223 | 'PMD_wp_user'=>$current_user->ID, |
| 224 | 224 | )); |
| 225 | 225 | } |
| 226 | 226 | $payment_method->set_active(); |
| 227 | - $payment_method->set_description( $pm_type_obj->default_description() ); |
|
| 227 | + $payment_method->set_description($pm_type_obj->default_description()); |
|
| 228 | 228 | //handles the goofy case where someone activates the invoice gateway which is also |
| 229 | 229 | $payment_method->set_type($pm_type_obj->system_name()); |
| 230 | - if( ! $payment_method->button_url() ){ |
|
| 231 | - $payment_method->set_button_url( $pm_type_obj->default_button_url() ); |
|
| 230 | + if ( ! $payment_method->button_url()) { |
|
| 231 | + $payment_method->set_button_url($pm_type_obj->default_button_url()); |
|
| 232 | 232 | } |
| 233 | 233 | $payment_method->save(); |
| 234 | - foreach($payment_method->get_all_usable_currencies() as $currency_obj){ |
|
| 234 | + foreach ($payment_method->get_all_usable_currencies() as $currency_obj) { |
|
| 235 | 235 | $payment_method->_add_relation_to($currency_obj, 'Currency'); |
| 236 | 236 | } |
| 237 | 237 | //now add setup its default extra meta properties |
| 238 | 238 | $extra_metas = $payment_method->type_obj()->settings_form()->extra_meta_inputs(); |
| 239 | - foreach( $extra_metas as $meta_name => $input ){ |
|
| 240 | - $payment_method->update_extra_meta($meta_name, $input->raw_value() ); |
|
| 239 | + foreach ($extra_metas as $meta_name => $input) { |
|
| 240 | + $payment_method->update_extra_meta($meta_name, $input->raw_value()); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - }else{ |
|
| 244 | + } else { |
|
| 245 | 245 | $payment_method->set_active(); |
| 246 | 246 | $payment_method->save(); |
| 247 | 247 | } |
| 248 | - if( $payment_method->type() == 'Invoice' ){ |
|
| 249 | - $messages = EE_Registry::instance()->load_lib( 'messages' ); |
|
| 250 | - $messages->ensure_message_type_is_active( 'invoice', 'html' ); |
|
| 251 | - $messages->ensure_messenger_is_active( 'pdf' ); |
|
| 252 | - EE_Error::add_attention( sprintf( __( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ), '<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">', '</a>' ) ); |
|
| 248 | + if ($payment_method->type() == 'Invoice') { |
|
| 249 | + $messages = EE_Registry::instance()->load_lib('messages'); |
|
| 250 | + $messages->ensure_message_type_is_active('invoice', 'html'); |
|
| 251 | + $messages->ensure_messenger_is_active('pdf'); |
|
| 252 | + EE_Error::add_attention(sprintf(__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'), '<a href="'.admin_url('admin.php?page=espresso_messages').'">', '</a>')); |
|
| 253 | 253 | } |
| 254 | 254 | return $payment_method; |
| 255 | 255 | } |
@@ -264,8 +264,8 @@ discard block |
||
| 264 | 264 | * |
| 265 | 265 | * @return int count of rows updated. |
| 266 | 266 | */ |
| 267 | - public function deactivate_payment_method( $payment_method_slug ) { |
|
| 268 | - $count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()),array(array('PMD_slug'=>$payment_method_slug))); |
|
| 267 | + public function deactivate_payment_method($payment_method_slug) { |
|
| 268 | + $count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()), array(array('PMD_slug'=>$payment_method_slug))); |
|
| 269 | 269 | return $count_updated; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param array $caps capabilities being filtered |
| 280 | 280 | */ |
| 281 | - public function add_payment_method_caps( $caps ) { |
|
| 281 | + public function add_payment_method_caps($caps) { |
|
| 282 | 282 | /* add dynamic caps from payment methods |
| 283 | 283 | * at the time of writing, october 20 2014, these are the caps added: |
| 284 | 284 | * ee_payment_method_admin_only |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * their related capability automatically added too, so long as they are |
| 294 | 294 | * registered properly using EE_Register_Payment_Method::register() |
| 295 | 295 | */ |
| 296 | - foreach( $this->payment_method_types() as $payment_method_type_obj ){ |
|
| 296 | + foreach ($this->payment_method_types() as $payment_method_type_obj) { |
|
| 297 | 297 | $caps['administrator'][] = $payment_method_type_obj->cap_name(); |
| 298 | 298 | } |
| 299 | 299 | return $caps; |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | if (!defined('EVENT_ESPRESSO_VERSION')) |
| 3 | 3 | exit('No direct script access allowed'); |
| 4 | 4 | /** |
| 5 | - * payment_details_content |
|
| 6 | - * @var EE_Payment $payment |
|
| 7 | - * @var EE_Payment_Method $payment_method |
|
| 8 | - */ |
|
| 5 | + * payment_details_content |
|
| 6 | + * @var EE_Payment $payment |
|
| 7 | + * @var EE_Payment_Method $payment_method |
|
| 8 | + */ |
|
| 9 | 9 | $gateway_response = $payment->gateway_response(); |
| 10 | 10 | if ( ! empty( $gateway_response )) { |
| 11 | 11 | echo '<span class="error payment-problem">' . $gateway_response . '</span>'; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('No direct script access allowed'); |
| 4 | 4 | /** |
| 5 | 5 | * payment_details_content |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @var EE_Payment_Method $payment_method |
| 8 | 8 | */ |
| 9 | 9 | $gateway_response = $payment->gateway_response(); |
| 10 | -if ( ! empty( $gateway_response )) { |
|
| 11 | - echo '<span class="error payment-problem">' . $gateway_response . '</span>'; |
|
| 10 | +if ( ! empty($gateway_response)) { |
|
| 11 | + echo '<span class="error payment-problem">'.$gateway_response.'</span>'; |
|
| 12 | 12 | } |
| 13 | 13 | // End of file payment_details_content.template.php |
| 14 | 14 | \ No newline at end of file |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 3 | 3 | exit('No direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | /** |
| 5 | 6 | * payment_details_content |
| 6 | 7 | * @var EE_Payment $payment |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param array $setup_args an array of key value pairs of info for registering the component |
| 35 | 35 | * @return void |
| 36 | 36 | */ |
| 37 | - public static function register( $ID = NULL, $setup_args = array() ); |
|
| 37 | + public static function register($ID = NULL, $setup_args = array()); |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | |
@@ -45,5 +45,5 @@ discard block |
||
| 45 | 45 | * @param string $ID a unique name or ID for the component being registered |
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | - public static function deregister( $ID = NULL ); |
|
| 48 | + public static function deregister($ID = NULL); |
|
| 49 | 49 | } |
@@ -5,7 +5,9 @@ |
||
| 5 | 5 | * @subpackage helpers |
| 6 | 6 | * @since 4.3.0 |
| 7 | 7 | */ |
| 8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 9 | + exit('No direct script access allowed'); |
|
| 10 | +} |
|
| 9 | 11 | |
| 10 | 12 | /** |
| 11 | 13 | * This interface is used to define the common methods shared by all "plugin api" classes. |