@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | /** |
| 202 | 202 | * Overrides parent ot also check by the slug |
| 203 | 203 | * @see EEM_Base::ensure_is_obj() |
| 204 | - * @param string|int|EE_Payment_Method $base_class_obj_or_id |
|
| 204 | + * @param EE_Payment_Method $base_class_obj_or_id |
|
| 205 | 205 | * @param boolean $ensure_is_in_db |
| 206 | 206 | * @return EE_Payment_Method |
| 207 | 207 | * @throws EE_Error |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | * Note: if an offline payment method was selected on the related transaction then this will have no payment methods returned. |
| 364 | 364 | * It will ONLY return a payment method for a PAYMENT recorded against the registration. |
| 365 | 365 | * |
| 366 | - * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
|
| 367 | - * @return EE_Payment|null |
|
| 366 | + * @param EE_Registration $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
|
| 367 | + * @return EE_Base_Class|null |
|
| 368 | 368 | */ |
| 369 | 369 | public function get_last_used_for_registration( $registration_or_reg_id ) { |
| 370 | 370 | $registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * |
@@ -37,33 +37,33 @@ discard block |
||
| 37 | 37 | * @access protected |
| 38 | 38 | * @return EEM_Payment_Method |
| 39 | 39 | */ |
| 40 | - protected function __construct( $timezone = NULL ) { |
|
| 41 | - $this->singlular_item = __( 'Payment Method', 'event_espresso' ); |
|
| 42 | - $this->plural_item = __( 'Payment Methods', 'event_espresso' ); |
|
| 43 | - $this->_tables = array( 'Payment_Method' => new EE_Primary_Table( 'esp_payment_method', 'PMD_ID' ) ); |
|
| 40 | + protected function __construct($timezone = NULL) { |
|
| 41 | + $this->singlular_item = __('Payment Method', 'event_espresso'); |
|
| 42 | + $this->plural_item = __('Payment Methods', 'event_espresso'); |
|
| 43 | + $this->_tables = array('Payment_Method' => new EE_Primary_Table('esp_payment_method', 'PMD_ID')); |
|
| 44 | 44 | $this->_fields = array( |
| 45 | 45 | 'Payment_Method' => array( |
| 46 | - 'PMD_ID' => new EE_Primary_Key_Int_Field( 'PMD_ID', __( "ID", 'event_espresso' ) ), |
|
| 47 | - 'PMD_type' => new EE_Plain_Text_Field( 'PMD_type', __( "Payment Method Type", 'event_espresso' ), FALSE, 'Admin_Only' ), |
|
| 48 | - 'PMD_name' => new EE_Plain_Text_Field( 'PMD_name', __( "Name", 'event_espresso' ), FALSE ), |
|
| 49 | - 'PMD_desc' => new EE_Post_Content_Field( 'PMD_desc', __( "Description", 'event_espresso' ), FALSE, '' ), |
|
| 50 | - 'PMD_admin_name' => new EE_Plain_Text_Field( 'PMD_admin_name', __( "Admin-Only Name", 'event_espresso' ), TRUE ), |
|
| 51 | - 'PMD_admin_desc' => new EE_Post_Content_Field( 'PMD_admin_desc', __( "Admin-Only Description", 'event_espresso' ), TRUE ), |
|
| 52 | - 'PMD_slug' => new EE_Slug_Field( 'PMD_slug', __( "Slug", 'event_espresso' ), FALSE ), |
|
| 53 | - 'PMD_order' => new EE_Integer_Field( 'PMD_order', __( "Order", 'event_espresso' ), FALSE, 0 ), |
|
| 54 | - 'PMD_debug_mode' => new EE_Boolean_Field( 'PMD_debug_mode', __( "Debug Mode On?", 'event_espresso' ), FALSE, FALSE ), |
|
| 55 | - 'PMD_wp_user' => new EE_WP_User_Field( 'PMD_wp_user', __( "Payment Method Creator ID", 'event_espresso' ), FALSE ), |
|
| 56 | - 'PMD_open_by_default' => new EE_Boolean_Field( 'PMD_open_by_default', __( "Open by Default?", 'event_espresso' ), FALSE, FALSE ), 'PMD_button_url' => new EE_Plain_Text_Field( 'PMD_button_url', __( "Button URL", 'event_espresso' ), TRUE, '' ), |
|
| 57 | - 'PMD_scope' => new EE_Serialized_Text_Field( 'PMD_scope', __( "Usable From?", 'event_espresso' ), FALSE, array() ), //possible values currently are 'CART','ADMIN','API' |
|
| 46 | + 'PMD_ID' => new EE_Primary_Key_Int_Field('PMD_ID', __("ID", 'event_espresso')), |
|
| 47 | + 'PMD_type' => new EE_Plain_Text_Field('PMD_type', __("Payment Method Type", 'event_espresso'), FALSE, 'Admin_Only'), |
|
| 48 | + 'PMD_name' => new EE_Plain_Text_Field('PMD_name', __("Name", 'event_espresso'), FALSE), |
|
| 49 | + 'PMD_desc' => new EE_Post_Content_Field('PMD_desc', __("Description", 'event_espresso'), FALSE, ''), |
|
| 50 | + 'PMD_admin_name' => new EE_Plain_Text_Field('PMD_admin_name', __("Admin-Only Name", 'event_espresso'), TRUE), |
|
| 51 | + 'PMD_admin_desc' => new EE_Post_Content_Field('PMD_admin_desc', __("Admin-Only Description", 'event_espresso'), TRUE), |
|
| 52 | + 'PMD_slug' => new EE_Slug_Field('PMD_slug', __("Slug", 'event_espresso'), FALSE), |
|
| 53 | + 'PMD_order' => new EE_Integer_Field('PMD_order', __("Order", 'event_espresso'), FALSE, 0), |
|
| 54 | + 'PMD_debug_mode' => new EE_Boolean_Field('PMD_debug_mode', __("Debug Mode On?", 'event_espresso'), FALSE, FALSE), |
|
| 55 | + 'PMD_wp_user' => new EE_WP_User_Field('PMD_wp_user', __("Payment Method Creator ID", 'event_espresso'), FALSE), |
|
| 56 | + 'PMD_open_by_default' => new EE_Boolean_Field('PMD_open_by_default', __("Open by Default?", 'event_espresso'), FALSE, FALSE), 'PMD_button_url' => new EE_Plain_Text_Field('PMD_button_url', __("Button URL", 'event_espresso'), TRUE, ''), |
|
| 57 | + 'PMD_scope' => new EE_Serialized_Text_Field('PMD_scope', __("Usable From?", 'event_espresso'), FALSE, array()), //possible values currently are 'CART','ADMIN','API' |
|
| 58 | 58 | ) ); |
| 59 | 59 | $this->_model_relations = array( |
| 60 | 60 | // 'Event'=>new EE_HABTM_Relation('Event_Payment_Method'), |
| 61 | 61 | 'Payment' => new EE_Has_Many_Relation(), |
| 62 | - 'Currency' => new EE_HABTM_Relation( 'Currency_Payment_Method' ), |
|
| 62 | + 'Currency' => new EE_HABTM_Relation('Currency_Payment_Method'), |
|
| 63 | 63 | 'Transaction' => new EE_Has_Many_Relation(), |
| 64 | 64 | 'WP_User' => new EE_Belongs_To_Relation(), |
| 65 | 65 | ); |
| 66 | - parent::__construct( $timezone ); |
|
| 66 | + parent::__construct($timezone); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * @param string $slug |
| 74 | 74 | * @return EE_Payment_Method |
| 75 | 75 | */ |
| 76 | - public function get_one_by_slug( $slug ) { |
|
| 77 | - return $this->get_one( array( array( 'PMD_slug' => $slug ) ) ); |
|
| 76 | + public function get_one_by_slug($slug) { |
|
| 77 | + return $this->get_one(array(array('PMD_slug' => $slug))); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
@@ -88,8 +88,8 @@ discard block |
||
| 88 | 88 | return apply_filters( |
| 89 | 89 | 'FHEE__EEM_Payment_Method__scopes', |
| 90 | 90 | array( |
| 91 | - self::scope_cart => __( "Front-end Registration Page", 'event_espresso' ), |
|
| 92 | - self::scope_admin => __( "Admin Registration Page (no online processing)", 'event_espresso' ) |
|
| 91 | + self::scope_cart => __("Front-end Registration Page", 'event_espresso'), |
|
| 92 | + self::scope_admin => __("Admin Registration Page (no online processing)", 'event_espresso') |
|
| 93 | 93 | ) |
| 94 | 94 | ); |
| 95 | 95 | } |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | * @param string $scope like one of EEM_Payment_Method::instance()->scopes() |
| 102 | 102 | * @return boolean |
| 103 | 103 | */ |
| 104 | - public function is_valid_scope( $scope ) { |
|
| 104 | + public function is_valid_scope($scope) { |
|
| 105 | 105 | $scopes = $this->scopes(); |
| 106 | - if ( isset( $scopes[ $scope ] ) ) { |
|
| 106 | + if (isset($scopes[$scope])) { |
|
| 107 | 107 | return TRUE; |
| 108 | 108 | } else { |
| 109 | 109 | return FALSE; |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | * @throws EE_Error |
| 120 | 120 | * @return EE_Payment_Method[] |
| 121 | 121 | */ |
| 122 | - public function get_all_active( $scope = NULL, $query_params = array() ) { |
|
| 123 | - if( ! isset( $query_params[ 'order_by' ] ) && ! isset( $query_params[ 'order' ] ) ) { |
|
| 124 | - $query_params = array( 'order_by' => array( 'PMD_order' => 'ASC', 'PMD_ID' => 'ASC' ) ); |
|
| 122 | + public function get_all_active($scope = NULL, $query_params = array()) { |
|
| 123 | + if ( ! isset($query_params['order_by']) && ! isset($query_params['order'])) { |
|
| 124 | + $query_params = array('order_by' => array('PMD_order' => 'ASC', 'PMD_ID' => 'ASC')); |
|
| 125 | 125 | } |
| 126 | - return $this->get_all( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
| 126 | + return $this->get_all($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -132,8 +132,8 @@ discard block |
||
| 132 | 132 | * @param array $query_params |
| 133 | 133 | * @return int |
| 134 | 134 | */ |
| 135 | - public function count_active( $scope = NULL, $query_params = array() ){ |
|
| 136 | - return $this->count( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
| 135 | + public function count_active($scope = NULL, $query_params = array()) { |
|
| 136 | + return $this->count($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -144,21 +144,21 @@ discard block |
||
| 144 | 144 | * @return array like param of EEM_Base::get_all() |
| 145 | 145 | * @throws EE_Error |
| 146 | 146 | */ |
| 147 | - protected function _get_query_params_for_all_active( $scope = NULL, $query_params = array() ){ |
|
| 148 | - if ( $scope ) { |
|
| 149 | - if ( $this->is_valid_scope( $scope ) ) { |
|
| 150 | - return array_replace_recursive( array( array( 'PMD_scope' => array( 'LIKE', "%$scope%" ) ) ), $query_params ); |
|
| 147 | + protected function _get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
| 148 | + if ($scope) { |
|
| 149 | + if ($this->is_valid_scope($scope)) { |
|
| 150 | + return array_replace_recursive(array(array('PMD_scope' => array('LIKE', "%$scope%"))), $query_params); |
|
| 151 | 151 | } else { |
| 152 | - throw new EE_Error( sprintf( __( "'%s' is not a valid scope for a payment method", "event_espresso" ), $scope ) ); |
|
| 152 | + throw new EE_Error(sprintf(__("'%s' is not a valid scope for a payment method", "event_espresso"), $scope)); |
|
| 153 | 153 | } |
| 154 | 154 | } else { |
| 155 | 155 | $acceptable_scopes = array(); |
| 156 | 156 | $count = 0; |
| 157 | - foreach ( $this->scopes() as $scope_name => $desc ) { |
|
| 157 | + foreach ($this->scopes() as $scope_name => $desc) { |
|
| 158 | 158 | $count++; |
| 159 | - $acceptable_scopes[ 'PMD_scope*' . $count ] = array( 'LIKE', '%' . $scope_name . '%' ); |
|
| 159 | + $acceptable_scopes['PMD_scope*'.$count] = array('LIKE', '%'.$scope_name.'%'); |
|
| 160 | 160 | } |
| 161 | - return array_replace_recursive( array( array( 'OR*active_scope' => $acceptable_scopes ) ), $query_params ); |
|
| 161 | + return array_replace_recursive(array(array('OR*active_scope' => $acceptable_scopes)), $query_params); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | * @return array like param of EEM_Base::get_all() |
| 171 | 171 | * @throws EE_Error |
| 172 | 172 | */ |
| 173 | - public function get_query_params_for_all_active( $scope = NULL, $query_params = array() ) { |
|
| 174 | - return $this->_get_query_params_for_all_active( $scope, $query_params ); |
|
| 173 | + public function get_query_params_for_all_active($scope = NULL, $query_params = array()) { |
|
| 174 | + return $this->_get_query_params_for_all_active($scope, $query_params); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | * @param array $query_params |
| 182 | 182 | * @return EE_Payment_Method |
| 183 | 183 | */ |
| 184 | - public function get_one_active( $scope = NULL, $query_params = array() ) { |
|
| 185 | - return $this->get_one( $this->_get_query_params_for_all_active( $scope, $query_params ) ); |
|
| 184 | + public function get_one_active($scope = NULL, $query_params = array()) { |
|
| 185 | + return $this->get_one($this->_get_query_params_for_all_active($scope, $query_params)); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -192,8 +192,8 @@ discard block |
||
| 192 | 192 | * @param string $type |
| 193 | 193 | * @return EE_Payment_Method |
| 194 | 194 | */ |
| 195 | - public function get_one_of_type( $type ) { |
|
| 196 | - return $this->get_one( array( array( 'PMD_type' => $type ) ) ); |
|
| 195 | + public function get_one_of_type($type) { |
|
| 196 | + return $this->get_one(array(array('PMD_type' => $type))); |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | |
@@ -206,22 +206,22 @@ discard block |
||
| 206 | 206 | * @return EE_Payment_Method |
| 207 | 207 | * @throws EE_Error |
| 208 | 208 | */ |
| 209 | - public function ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db = FALSE ) { |
|
| 209 | + public function ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db = FALSE) { |
|
| 210 | 210 | //first: check if it's a slug |
| 211 | - if( is_string( $base_class_obj_or_id ) ) { |
|
| 212 | - $obj = $this->get_one_by_slug( $base_class_obj_or_id ); |
|
| 213 | - if( $obj ) { |
|
| 211 | + if (is_string($base_class_obj_or_id)) { |
|
| 212 | + $obj = $this->get_one_by_slug($base_class_obj_or_id); |
|
| 213 | + if ($obj) { |
|
| 214 | 214 | return $obj; |
| 215 | 215 | } |
| 216 | 216 | } |
| 217 | 217 | //ok so it wasn't a slug we were passed. try the usual then (ie, it's an object or an ID) |
| 218 | 218 | try { |
| 219 | - return parent::ensure_is_obj( $base_class_obj_or_id, $ensure_is_in_db ); |
|
| 219 | + return parent::ensure_is_obj($base_class_obj_or_id, $ensure_is_in_db); |
|
| 220 | 220 | } |
| 221 | - catch ( EE_Error $e ) { |
|
| 221 | + catch (EE_Error $e) { |
|
| 222 | 222 | //handle it outside the catch |
| 223 | 223 | } |
| 224 | - throw new EE_Error( sprintf( __( "'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso" ), $base_class_obj_or_id ) ); |
|
| 224 | + throw new EE_Error(sprintf(__("'%s' is neither a Payment Method ID, slug, nor object.", "event_espresso"), $base_class_obj_or_id)); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
@@ -232,12 +232,12 @@ discard block |
||
| 232 | 232 | * @param mixed $base_obj_or_id_or_slug |
| 233 | 233 | * @return int |
| 234 | 234 | */ |
| 235 | - function ensure_is_ID( $base_obj_or_id_or_slug ) { |
|
| 236 | - if ( is_string( $base_obj_or_id_or_slug ) ) { |
|
| 235 | + function ensure_is_ID($base_obj_or_id_or_slug) { |
|
| 236 | + if (is_string($base_obj_or_id_or_slug)) { |
|
| 237 | 237 | //assume it's a slug |
| 238 | - $base_obj_or_id_or_slug = $this->get_one_by_slug( $base_obj_or_id_or_slug ); |
|
| 238 | + $base_obj_or_id_or_slug = $this->get_one_by_slug($base_obj_or_id_or_slug); |
|
| 239 | 239 | } |
| 240 | - return parent::ensure_is_ID( $base_obj_or_id_or_slug ); |
|
| 240 | + return parent::ensure_is_ID($base_obj_or_id_or_slug); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
@@ -246,37 +246,37 @@ discard block |
||
| 246 | 246 | * Verifies the button urls on all the passed payment methods have a valid button url. If not, resets them to their default. |
| 247 | 247 | * @param EE_Payment_Method[] $payment_methods. If NULL is provided defaults to all payment methods active in the cart |
| 248 | 248 | */ |
| 249 | - function verify_button_urls( $payment_methods = NULL ) { |
|
| 250 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
| 251 | - $payment_methods = is_array( $payment_methods ) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
| 252 | - foreach ( $payment_methods as $payment_method ) { |
|
| 249 | + function verify_button_urls($payment_methods = NULL) { |
|
| 250 | + EE_Registry::instance()->load_helper('URL'); |
|
| 251 | + $payment_methods = is_array($payment_methods) ? $payment_methods : $this->get_all_active(EEM_Payment_Method::scope_cart); |
|
| 252 | + foreach ($payment_methods as $payment_method) { |
|
| 253 | 253 | try { |
| 254 | 254 | $current_button_url = $payment_method->button_url(); |
| 255 | - $buttons_urls_to_try = apply_filters( 'FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
| 256 | - 'current_ssl' => str_replace( "http://", "https://", $current_button_url ), |
|
| 257 | - 'current' => str_replace( "https://", "http://", $current_button_url ), |
|
| 258 | - 'default_ssl' => str_replace( "http://", "https://", $payment_method->type_obj()->default_button_url() ), |
|
| 259 | - 'default' => str_replace( "https://", "http://", $payment_method->type_obj()->default_button_url() ), |
|
| 260 | - ) ); |
|
| 261 | - foreach( $buttons_urls_to_try as $button_url_to_try ) { |
|
| 262 | - if( |
|
| 255 | + $buttons_urls_to_try = apply_filters('FHEE__EEM_Payment_Method__verify_button_urls__button_urls_to_try', array( |
|
| 256 | + 'current_ssl' => str_replace("http://", "https://", $current_button_url), |
|
| 257 | + 'current' => str_replace("https://", "http://", $current_button_url), |
|
| 258 | + 'default_ssl' => str_replace("http://", "https://", $payment_method->type_obj()->default_button_url()), |
|
| 259 | + 'default' => str_replace("https://", "http://", $payment_method->type_obj()->default_button_url()), |
|
| 260 | + )); |
|
| 261 | + foreach ($buttons_urls_to_try as $button_url_to_try) { |
|
| 262 | + if ( |
|
| 263 | 263 | (//this is the current url and it exists, regardless of SSL issues |
| 264 | 264 | $button_url_to_try == $current_button_url && |
| 265 | 265 | EEH_URL::remote_file_exists( |
| 266 | 266 | $button_url_to_try, |
| 267 | 267 | array( |
| 268 | 268 | 'sslverify' => false, |
| 269 | - 'limit_response_size' => 4095,//we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
| 269 | + 'limit_response_size' => 4095, //we don't really care for a full response, but we do want headers at least. Lets just ask for a one block |
|
| 270 | 270 | ) ) |
| 271 | 271 | ) |
| 272 | 272 | || |
| 273 | 273 | (//this is NOT the current url and it exists with a working SSL cert |
| 274 | 274 | $button_url_to_try != $current_button_url && |
| 275 | - EEH_URL::remote_file_exists( $button_url_to_try ) |
|
| 275 | + EEH_URL::remote_file_exists($button_url_to_try) |
|
| 276 | 276 | ) ) { |
| 277 | - if( $current_button_url != $button_url_to_try ){ |
|
| 278 | - $payment_method->save( array( 'PMD_button_url' => $button_url_to_try ) ); |
|
| 279 | - EE_Error::add_attention( sprintf( __( "Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso" ), $payment_method->name(), $button_url_to_try ) ); |
|
| 277 | + if ($current_button_url != $button_url_to_try) { |
|
| 278 | + $payment_method->save(array('PMD_button_url' => $button_url_to_try)); |
|
| 279 | + EE_Error::add_attention(sprintf(__("Payment Method %s's button url was set to %s, because the old image either didnt exist or SSL was recently enabled.", "event_espresso"), $payment_method->name(), $button_url_to_try)); |
|
| 280 | 280 | } |
| 281 | 281 | //this image exists. So if wasn't set before, now it is; |
| 282 | 282 | //or if it was already set, we have nothing to do |
@@ -284,8 +284,8 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | - catch ( EE_Error $e ) { |
|
| 288 | - $payment_method->set_active( FALSE ); |
|
| 287 | + catch (EE_Error $e) { |
|
| 288 | + $payment_method->set_active(FALSE); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | } |
@@ -299,16 +299,16 @@ discard block |
||
| 299 | 299 | * @param array $rows |
| 300 | 300 | * @return EE_Payment_Method[] |
| 301 | 301 | */ |
| 302 | - protected function _create_objects( $rows = array() ) { |
|
| 303 | - $payment_methods = parent::_create_objects( $rows ); |
|
| 302 | + protected function _create_objects($rows = array()) { |
|
| 303 | + $payment_methods = parent::_create_objects($rows); |
|
| 304 | 304 | /* @var $payment_methods EE_Payment_Method[] */ |
| 305 | 305 | $usable_payment_methods = array(); |
| 306 | - foreach ( $payment_methods as $key => $payment_method ) { |
|
| 306 | + foreach ($payment_methods as $key => $payment_method) { |
|
| 307 | 307 | try { |
| 308 | 308 | $payment_method->type_obj(); |
| 309 | - $usable_payment_methods[ $key ] = $payment_method; |
|
| 309 | + $usable_payment_methods[$key] = $payment_method; |
|
| 310 | 310 | } |
| 311 | - catch ( EE_Error $e ) { |
|
| 311 | + catch (EE_Error $e) { |
|
| 312 | 312 | //if it threw an exception, its because the payment type object |
| 313 | 313 | //isn't defined (probably because somehow the DB got borked, |
| 314 | 314 | //or an addon which defined it got deactivated |
@@ -317,10 +317,10 @@ discard block |
||
| 317 | 317 | $payment_method->save(); |
| 318 | 318 | EE_Error::add_attention( |
| 319 | 319 | sprintf( |
| 320 | - __( 'An error occurred while attempting to use the "%1$s" payment method, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated?%2$sIt can be reactivated on the %3$sPlugins admin page%4$s||%2$sThe actual error was:%2$s%5$s', 'event_espresso' ), |
|
| 320 | + __('An error occurred while attempting to use the "%1$s" payment method, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated?%2$sIt can be reactivated on the %3$sPlugins admin page%4$s||%2$sThe actual error was:%2$s%5$s', 'event_espresso'), |
|
| 321 | 321 | $payment_method->name(), |
| 322 | 322 | '<br />', |
| 323 | - '<a href="' . admin_url('plugins.php') . '">', |
|
| 323 | + '<a href="'.admin_url('plugins.php').'">', |
|
| 324 | 324 | '</a>', |
| 325 | 325 | $e->getMessage() |
| 326 | 326 | ), |
@@ -341,16 +341,16 @@ discard block |
||
| 341 | 341 | * @param string $scope @see EEM_Payment_Method::get_all_for_events |
| 342 | 342 | * @return EE_Payment_Method[] |
| 343 | 343 | */ |
| 344 | - public function get_all_for_transaction( $transaction, $scope ) { |
|
| 344 | + public function get_all_for_transaction($transaction, $scope) { |
|
| 345 | 345 | //@todo take relations between events and payment methods into account, once that relation exists |
| 346 | - if ( $transaction instanceof EE_Transaction ) { |
|
| 346 | + if ($transaction instanceof EE_Transaction) { |
|
| 347 | 347 | //@todo take the relation between transaction and currencies into account |
| 348 | 348 | } |
| 349 | - $currencies_for_events = array( EE_Config::instance()->currency->code ); |
|
| 349 | + $currencies_for_events = array(EE_Config::instance()->currency->code); |
|
| 350 | 350 | //give addons a chance to override what payment methods are chosen based on the transaction |
| 351 | 351 | return apply_filters( |
| 352 | 352 | 'FHEE__EEM_Payment_Method__get_all_for_transaction__payment_methods', |
| 353 | - $this->get_all_active( $scope, array( array( 'Currency.CUR_code' => array( 'IN', $currencies_for_events ) ) ) ), |
|
| 353 | + $this->get_all_active($scope, array(array('Currency.CUR_code' => array('IN', $currencies_for_events)))), |
|
| 354 | 354 | $transaction, |
| 355 | 355 | $scope |
| 356 | 356 | ); |
@@ -366,16 +366,16 @@ discard block |
||
| 366 | 366 | * @param EE_Registration|int $registration_or_reg_id Either the EE_Registration object or the id for the registration. |
| 367 | 367 | * @return EE_Payment|null |
| 368 | 368 | */ |
| 369 | - public function get_last_used_for_registration( $registration_or_reg_id ) { |
|
| 370 | - $registration_id = EEM_Registration::instance()->ensure_is_ID( $registration_or_reg_id ); |
|
| 369 | + public function get_last_used_for_registration($registration_or_reg_id) { |
|
| 370 | + $registration_id = EEM_Registration::instance()->ensure_is_ID($registration_or_reg_id); |
|
| 371 | 371 | |
| 372 | 372 | $query_params = array( |
| 373 | 373 | 0 => array( |
| 374 | 374 | 'Payment.Registration.REG_ID' => $registration_id, |
| 375 | 375 | ), |
| 376 | - 'order_by' => array( 'Payment.PAY_ID' => 'DESC' ) |
|
| 376 | + 'order_by' => array('Payment.PAY_ID' => 'DESC') |
|
| 377 | 377 | ); |
| 378 | - return $this->get_one( $query_params ); |
|
| 378 | + return $this->get_one($query_params); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | } |