@@ -123,7 +123,7 @@ |
||
123 | 123 | * @access public |
124 | 124 | * @param EE_Template_Config $CFG |
125 | 125 | * @param array $REQ |
126 | - * @return EE_Events_Archive_Config |
|
126 | + * @return EE_Template_Config |
|
127 | 127 | */ |
128 | 128 | public static function update_template_settings( $CFG, $REQ ) { |
129 | 129 | $config = new EE_Events_Archive_Config(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,33 +83,33 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
88 | - remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 ); |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | + remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100); |
|
89 | 89 | } |
90 | 90 | // first just grab the template settings |
91 | 91 | $config = EE_Registry::instance()->CFG->template_settings; |
92 | 92 | // then if the Event Archive config is valid, use that, else create a new one |
93 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
95 | - $config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0; |
|
96 | - $config->display_description = isset( $config->display_description ) ? $config->display_description : 1; |
|
97 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0; |
|
98 | - $config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1; |
|
99 | - $config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0; |
|
100 | - $config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0; |
|
93 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config(); |
|
94 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
95 | + $config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0; |
|
96 | + $config->display_description = isset($config->display_description) ? $config->display_description : 1; |
|
97 | + $config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0; |
|
98 | + $config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1; |
|
99 | + $config->display_venue = isset($config->display_venue) ? $config->display_venue : 0; |
|
100 | + $config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0; |
|
101 | 101 | // display order options |
102 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order )? $config->use_sortable_display_order : false; |
|
103 | - $config->display_order_tickets = isset( $config->display_order_tickets )? $config->display_order_tickets : 100; |
|
104 | - $config->display_order_datetimes = isset( $config->display_order_datetimes )? $config->display_order_datetimes : 110; |
|
105 | - $config->display_order_event = isset( $config->display_order_event )? $config->display_order_event : 120; |
|
106 | - $config->display_order_venue = isset( $config->display_order_venue )? $config->display_order_venue : 130; |
|
102 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false; |
|
103 | + $config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100; |
|
104 | + $config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110; |
|
105 | + $config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120; |
|
106 | + $config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130; |
|
107 | 107 | // get template parts |
108 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
108 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
109 | 109 | // convert to array so that we can add more properties |
110 | - $config = get_object_vars( $config ); |
|
111 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
112 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
110 | + $config = get_object_vars($config); |
|
111 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
112 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -125,24 +125,24 @@ discard block |
||
125 | 125 | * @param array $REQ |
126 | 126 | * @return EE_Events_Archive_Config |
127 | 127 | */ |
128 | - public static function update_template_settings( $CFG, $REQ ) { |
|
128 | + public static function update_template_settings($CFG, $REQ) { |
|
129 | 129 | $config = new EE_Events_Archive_Config(); |
130 | 130 | // unless we are resetting the config... |
131 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
132 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
133 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
134 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
135 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
136 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
137 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
138 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
139 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
131 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
132 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
133 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
134 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
135 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
136 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
137 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
138 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
139 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100; |
|
140 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110; |
|
141 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120; |
|
142 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130; |
|
143 | 143 | } |
144 | 144 | $CFG->EED_Events_Archive = $config; |
145 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
145 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
146 | 146 | return $CFG; |
147 | 147 | } |
148 | 148 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function update_event_archive_order() { |
158 | 158 | $config_saved = false; |
159 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
160 | - if ( ! empty( $template_parts ) ) { |
|
161 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
162 | - foreach ( $template_parts as $key => $template_part ) { |
|
159 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
160 | + if ( ! empty($template_parts)) { |
|
161 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
162 | + foreach ($template_parts as $key => $template_part) { |
|
163 | 163 | $template_part = "display_order_$template_part"; |
164 | - $priority = ( $key * 10 ) + 100; |
|
164 | + $priority = ($key * 10) + 100; |
|
165 | 165 | if ( |
166 | 166 | property_exists( |
167 | 167 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | ) { |
171 | 171 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->{$template_part} = $priority; |
172 | 172 | } |
173 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
173 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
174 | 174 | } |
175 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
175 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
176 | 176 | } |
177 | - if ( $config_saved ) { |
|
178 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
177 | + if ($config_saved) { |
|
178 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
179 | 179 | } else { |
180 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
180 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
181 | 181 | } |
182 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
182 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
183 | 183 | exit(); |
184 | 184 | } |
185 | 185 |
@@ -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 | * |
@@ -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 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | $this->_gateway->set_template_helper( new EEH_Template() ); |
107 | 107 | $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
108 | 108 | $this->_gateway->set_money_helper( new EEH_Money() ); |
109 | - $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
110 | - $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
111 | - do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
109 | + $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
110 | + $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
111 | + do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
112 | 112 | } |
113 | 113 | if ( ! isset( $this->_has_billing_form ) ) { |
114 | 114 | // by default, On Site gateways have a billing form |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | //if we know who the attendee is, and this is a billing form |
283 | 283 | //that uses attendee info, populate it |
284 | 284 | if ( |
285 | - apply_filters( |
|
286 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
287 | - ( |
|
288 | - $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
289 | - && $transaction instanceof EE_Transaction |
|
290 | - && $transaction->primary_registration() instanceof EE_Registration |
|
291 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
292 | - ), |
|
293 | - $this->_billing_form, |
|
294 | - $transaction |
|
295 | - ) |
|
285 | + apply_filters( |
|
286 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
287 | + ( |
|
288 | + $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
289 | + && $transaction instanceof EE_Transaction |
|
290 | + && $transaction->primary_registration() instanceof EE_Registration |
|
291 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
292 | + ), |
|
293 | + $this->_billing_form, |
|
294 | + $transaction |
|
295 | + ) |
|
296 | 296 | ){ |
297 | 297 | $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
298 | 298 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @since $VID:$ |
17 | 17 | * |
18 | 18 | */ |
19 | -abstract class EE_PMT_Base{ |
|
19 | +abstract class EE_PMT_Base { |
|
20 | 20 | |
21 | 21 | const onsite = 'on-site'; |
22 | 22 | const offsite = 'off-site'; |
@@ -97,34 +97,34 @@ discard block |
||
97 | 97 | * @return EE_PMT_Base |
98 | 98 | */ |
99 | 99 | function __construct($pm_instance = NULL) { |
100 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
100 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
101 | 101 | $this->set_instance($pm_instance); |
102 | 102 | } |
103 | - if($this->_gateway){ |
|
104 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
105 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
106 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
107 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
108 | - $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 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
107 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
108 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
109 | 109 | $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
110 | 110 | $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
111 | - do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
111 | + do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway); |
|
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,8 +174,8 @@ 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(){ |
|
178 | - if( ! $this->_file_folder ) { |
|
177 | + public function file_folder() { |
|
178 | + if ( ! $this->_file_folder) { |
|
179 | 179 | $this->_set_file_folder(); |
180 | 180 | } |
181 | 181 | return $this->_file_folder; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public function file_url(){ |
|
190 | - if( ! $this->_file_url ) { |
|
189 | + public function file_url() { |
|
190 | + if ( ! $this->_file_url) { |
|
191 | 191 | $this->_set_file_url(); |
192 | 192 | } |
193 | 193 | return $this->_file_url; |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | * Its important teh payment method instance is set before |
201 | 201 | * @param EE_Payment_Method $payment_method_instance |
202 | 202 | */ |
203 | - function set_instance($payment_method_instance){ |
|
203 | + function set_instance($payment_method_instance) { |
|
204 | 204 | $this->_pm_instance = $payment_method_instance; |
205 | 205 | //if they have already requested the settings form, make sure its |
206 | 206 | //data matches this model object |
207 | - if($this->_settings_form){ |
|
207 | + if ($this->_settings_form) { |
|
208 | 208 | $this->settings_form()->populate_model_obj($payment_method_instance); |
209 | 209 | } |
210 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
210 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
211 | 211 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
212 | 212 | } |
213 | 213 | } |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | * Gets teh form for displaying to admins where they setup the payment method |
219 | 219 | * @return EE_Payment_Method_Form |
220 | 220 | */ |
221 | - function settings_form(){ |
|
222 | - if( ! $this->_settings_form){ |
|
221 | + function settings_form() { |
|
222 | + if ( ! $this->_settings_form) { |
|
223 | 223 | $this->_settings_form = $this->generate_new_settings_form(); |
224 | - $this->_settings_form->set_payment_method_type( $this ); |
|
224 | + $this->_settings_form->set_payment_method_type($this); |
|
225 | 225 | //if we have already assigned a model object to this pmt, make |
226 | 226 | //sure its reflected in teh form we just generated |
227 | - if($this->_pm_instance){ |
|
227 | + if ($this->_pm_instance) { |
|
228 | 228 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
229 | 229 | } |
230 | 230 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * this payment method type's settings form later in the request |
251 | 251 | * @param EE_Payment_Method_Form $form |
252 | 252 | */ |
253 | - public function set_settings_form($form){ |
|
253 | + public function set_settings_form($form) { |
|
254 | 254 | $this->_settings_form = $form; |
255 | 255 | } |
256 | 256 | |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @param array $extra_args |
274 | 274 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
275 | 275 | */ |
276 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
276 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
277 | 277 | // has billing form already been regenerated ? or overwrite cache? |
278 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
279 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
278 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
279 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
280 | 280 | } |
281 | 281 | //if we know who the attendee is, and this is a billing form |
282 | 282 | //that uses attendee info, populate it |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $this->_billing_form, |
293 | 293 | $transaction |
294 | 294 | ) |
295 | - ){ |
|
296 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
295 | + ) { |
|
296 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
297 | 297 | } |
298 | 298 | return $this->_billing_form; |
299 | 299 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param \EE_Transaction $transaction |
305 | 305 | * @return \EE_Billing_Info_Form |
306 | 306 | */ |
307 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
307 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
308 | 308 | |
309 | 309 | |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @param \EE_Billing_Info_Form $billing_form |
316 | 316 | * @return \EE_Billing_Info_Form |
317 | 317 | */ |
318 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
318 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
319 | 319 | return $billing_form; |
320 | 320 | } |
321 | 321 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * if you have form |
327 | 327 | * @param EE_Payment_Method $form |
328 | 328 | */ |
329 | - public function set_billing_form($form){ |
|
329 | + public function set_billing_form($form) { |
|
330 | 330 | $this->_billing_form = $form; |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * Returns whether or not this payment method requires HTTPS to be used |
337 | 337 | * @return boolean |
338 | 338 | */ |
339 | - function requires_https(){ |
|
339 | + function requires_https() { |
|
340 | 340 | return $this->_requires_https; |
341 | 341 | } |
342 | 342 | |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | * @return EE_Payment |
355 | 355 | * @throws EE_Error |
356 | 356 | */ |
357 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
357 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
358 | 358 | // @todo: add surcharge for the payment method, if any |
359 | - if ( $this->_gateway ) { |
|
359 | + if ($this->_gateway) { |
|
360 | 360 | //there is a gateway, so we're going to make a payment object |
361 | 361 | //but wait! do they already have a payment in progress that we thought was failed? |
362 | 362 | $duplicate_properties = array( |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
368 | 368 | 'PAY_gateway_response' => null, |
369 | 369 | ); |
370 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
370 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
371 | 371 | //if we didn't already have a payment in progress for the same thing, |
372 | 372 | //then we actually want to make a new payment |
373 | - if ( ! $payment instanceof EE_Payment ){ |
|
373 | + if ( ! $payment instanceof EE_Payment) { |
|
374 | 374 | $payment = EE_Payment::new_instance( |
375 | 375 | array_merge( |
376 | 376 | $duplicate_properties, |
@@ -386,10 +386,10 @@ discard block |
||
386 | 386 | } |
387 | 387 | //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 |
388 | 388 | $payment->save(); |
389 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
389 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
390 | 390 | |
391 | 391 | // Offsite Gateway |
392 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
392 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
393 | 393 | |
394 | 394 | $payment = $this->_gateway->set_redirection_info( |
395 | 395 | $payment, |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | ); |
406 | 406 | $payment->save(); |
407 | 407 | // Onsite Gateway |
408 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
408 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
409 | 409 | |
410 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
410 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
411 | 411 | $payment->save(); |
412 | 412 | |
413 | 413 | } else { |
414 | 414 | throw new EE_Error( |
415 | 415 | sprintf( |
416 | - __('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' ), |
|
416 | + __('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'), |
|
417 | 417 | get_class($this), |
418 | - gettype( $this->_gateway ) |
|
418 | + gettype($this->_gateway) |
|
419 | 419 | ) |
420 | 420 | ); |
421 | 421 | } |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | // if there is billing info, clean it and save it now |
440 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
441 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
440 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
441 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $payment; |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | * @param EE_Billing_Info_Form $billing_form |
452 | 452 | * @return array |
453 | 453 | */ |
454 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
455 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
456 | - return $billing_form->input_pretty_values( true ); |
|
457 | - }else{ |
|
454 | + protected function _get_billing_values_from_form($billing_form) { |
|
455 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
456 | + return $billing_form->input_pretty_values(true); |
|
457 | + } else { |
|
458 | 458 | return NULL; |
459 | 459 | } |
460 | 460 | } |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | * @return EE_Payment |
469 | 469 | * @throws EE_Error |
470 | 470 | */ |
471 | - public function handle_ipn($req_data,$transaction){ |
|
471 | + public function handle_ipn($req_data, $transaction) { |
|
472 | 472 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
473 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
474 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
473 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
474 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
475 | 475 | |
476 | 476 | } |
477 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
477 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
478 | 478 | return $payment; |
479 | 479 | } |
480 | 480 | |
@@ -487,22 +487,22 @@ discard block |
||
487 | 487 | * @param EE_Transaction $transaction |
488 | 488 | * @return boolean success |
489 | 489 | */ |
490 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
491 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
490 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
491 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
492 | 492 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | $primary_reg = $transaction->primary_registration(); |
496 | - if( ! $primary_reg ){ |
|
496 | + if ( ! $primary_reg) { |
|
497 | 497 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
498 | 498 | return false; |
499 | 499 | } |
500 | 500 | $attendee = $primary_reg->attendee(); |
501 | - if( ! $attendee ){ |
|
501 | + if ( ! $attendee) { |
|
502 | 502 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
503 | 503 | return false; |
504 | 504 | } |
505 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
505 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
506 | 506 | |
507 | 507 | } |
508 | 508 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @param array $req_data |
516 | 516 | * @return EE_Payment |
517 | 517 | */ |
518 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
518 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
519 | 519 | return $transaction->last_payment(); |
520 | 520 | } |
521 | 521 | |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
533 | 533 | * @throws EE_Error |
534 | 534 | */ |
535 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
536 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
535 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
536 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * @param EE_Transaction $transaction |
550 | 550 | * @return EE_Payment |
551 | 551 | */ |
552 | - public function finalize_payment_for($transaction){ |
|
552 | + public function finalize_payment_for($transaction) { |
|
553 | 553 | return $transaction->last_payment(); |
554 | 554 | } |
555 | 555 | |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | * Whether or not this payment method's gateway supports sending refund requests |
560 | 560 | * @return boolean |
561 | 561 | */ |
562 | - public function supports_sending_refunds(){ |
|
563 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
562 | + public function supports_sending_refunds() { |
|
563 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
564 | 564 | return $this->_gateway->supports_sending_refunds(); |
565 | - }else{ |
|
565 | + } else { |
|
566 | 566 | return false; |
567 | 567 | } |
568 | 568 | } |
@@ -576,14 +576,14 @@ discard block |
||
576 | 576 | * @throws EE_Error |
577 | 577 | * @return EE_Payment |
578 | 578 | */ |
579 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
580 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
581 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
579 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
580 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
581 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
582 | 582 | } else { |
583 | 583 | throw new EE_Error( |
584 | 584 | sprintf( |
585 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
586 | - get_class( $this ) |
|
585 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
586 | + get_class($this) |
|
587 | 587 | ) |
588 | 588 | ); |
589 | 589 | } |
@@ -597,15 +597,15 @@ discard block |
||
597 | 597 | * @return string |
598 | 598 | * @throws EE_Error |
599 | 599 | */ |
600 | - public function payment_occurs(){ |
|
601 | - if( ! $this->_gateway){ |
|
600 | + public function payment_occurs() { |
|
601 | + if ( ! $this->_gateway) { |
|
602 | 602 | return EE_PMT_Base::offline; |
603 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
603 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
604 | 604 | return EE_PMT_Base::onsite; |
605 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
605 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
606 | 606 | return EE_PMT_Base::offsite; |
607 | - }else{ |
|
608 | - 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))); |
|
607 | + } else { |
|
608 | + 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))); |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @param EE_Payment $payment |
619 | 619 | * @return string |
620 | 620 | */ |
621 | - public function payment_overview_content(EE_Payment $payment){ |
|
622 | - 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); |
|
621 | + public function payment_overview_content(EE_Payment $payment) { |
|
622 | + 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); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @type array $template_args any arguments you want passed to the template file while rendering. |
633 | 633 | * Keys will be variable names and values with be their values. |
634 | 634 | */ |
635 | - public function help_tabs_config(){ |
|
635 | + public function help_tabs_config() { |
|
636 | 636 | return array(); |
637 | 637 | } |
638 | 638 | |
@@ -643,9 +643,9 @@ discard block |
||
643 | 643 | * the payment method's table's PMT_type column) |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - public function system_name(){ |
|
646 | + public function system_name() { |
|
647 | 647 | $classname = get_class($this); |
648 | - return str_replace("EE_PMT_",'',$classname); |
|
648 | + return str_replace("EE_PMT_", '', $classname); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * A pretty i18n version of the PMT name |
655 | 655 | * @return string |
656 | 656 | */ |
657 | - public function pretty_name(){ |
|
657 | + public function pretty_name() { |
|
658 | 658 | return $this->_pretty_name; |
659 | 659 | } |
660 | 660 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * Gets the default absolute URL to the payment method type's button |
665 | 665 | * @return string |
666 | 666 | */ |
667 | - public function default_button_url(){ |
|
667 | + public function default_button_url() { |
|
668 | 668 | return $this->_default_button_url; |
669 | 669 | } |
670 | 670 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * Gets the gateway used by this payment method (if any) |
675 | 675 | * @return EE_Gateway |
676 | 676 | */ |
677 | - public function get_gateway(){ |
|
677 | + public function get_gateway() { |
|
678 | 678 | return $this->_gateway; |
679 | 679 | } |
680 | 680 | |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | /** |
684 | 684 | * @return string html for the link to a help tab |
685 | 685 | */ |
686 | - public function get_help_tab_link(){ |
|
687 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
686 | + public function get_help_tab_link() { |
|
687 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | * Returns the name of the help tab for this PMT |
694 | 694 | * @return string |
695 | 695 | */ |
696 | - public function get_help_tab_name(){ |
|
697 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
696 | + public function get_help_tab_name() { |
|
697 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /** |
@@ -702,8 +702,8 @@ discard block |
||
702 | 702 | * this PMT by an admin |
703 | 703 | * @return string |
704 | 704 | */ |
705 | - public function cap_name(){ |
|
706 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
705 | + public function cap_name() { |
|
706 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -715,9 +715,9 @@ discard block |
||
715 | 715 | * @param EE_Payment $payment |
716 | 716 | * @return void |
717 | 717 | */ |
718 | - public function update_txn_based_on_payment( $payment ){ |
|
719 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
720 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
718 | + public function update_txn_based_on_payment($payment) { |
|
719 | + if ($this->_gateway instanceof EE_Gateway) { |
|
720 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
721 | 721 | } |
722 | 722 | } |
723 | 723 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function introductory_html() { |
735 | - return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) ); |
|
735 | + return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | * @param string $shortcode |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - protected function _parser( $shortcode ) { |
|
64 | + protected function _parser($shortcode) { |
|
65 | 65 | |
66 | - if ( ! $this->_data instanceof EE_Datetime ) { |
|
66 | + if ( ! $this->_data instanceof EE_Datetime) { |
|
67 | 67 | return ''; //get out cause we can only parse with the datetime object. |
68 | 68 | } |
69 | 69 | |
70 | - switch ( $shortcode ) { |
|
70 | + switch ($shortcode) { |
|
71 | 71 | |
72 | 72 | case '[DATETIME_START]' : |
73 | 73 | return $this->_data->get_i18n_datetime('DTT_EVT_start'); |
@@ -81,27 +81,27 @@ discard block |
||
81 | 81 | return $this->_data->get_timezone(); |
82 | 82 | break; |
83 | 83 | case '[DATE_START]' : |
84 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'date_format' ) ); |
|
84 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format')); |
|
85 | 85 | break; |
86 | 86 | case '[DATE_END]' : |
87 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'date_format' ) ); |
|
87 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format')); |
|
88 | 88 | break; |
89 | 89 | case '[TIME_START]' : |
90 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'time_format' ) ); |
|
90 | + return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format')); |
|
91 | 91 | break; |
92 | 92 | case '[TIME_END]' : |
93 | - return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'time_format' ) ); |
|
93 | + return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format')); |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | |
97 | - if ( strpos( $shortcode, '[ICAL_LINK_*') !== FALSE ) { |
|
98 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
97 | + if (strpos($shortcode, '[ICAL_LINK_*') !== FALSE) { |
|
98 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
99 | 99 | |
100 | - $link_text = empty( $attrs['link_text'] ) ? __( 'Add to iCal Calendar', 'event_espresso' ) : $attrs['link_text']; |
|
100 | + $link_text = empty($attrs['link_text']) ? __('Add to iCal Calendar', 'event_espresso') : $attrs['link_text']; |
|
101 | 101 | |
102 | - $URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $this->_data->ID() ), site_url() ); |
|
102 | + $URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url()); |
|
103 | 103 | |
104 | - return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>'; |
|
104 | + return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>'; |
|
105 | 105 | |
106 | 106 | } |
107 | 107 |
@@ -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 | /** |
6 | 7 | * Event Espresso |
@@ -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,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; |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | * @return EE_Request_Stack_Builder |
45 | 45 | */ |
46 | 46 | public function unshift( /*$class_name, $args*/ ) { |
47 | - if ( func_num_args() === 0 ) { |
|
48 | - throw new InvalidArgumentException( "Missing argument(s) when calling unshift" ); |
|
47 | + if (func_num_args() === 0) { |
|
48 | + throw new InvalidArgumentException("Missing argument(s) when calling unshift"); |
|
49 | 49 | } |
50 | 50 | $middleware = func_get_args(); |
51 | 51 | //$this->middleware_stack->unshift( $middleware ); |
52 | - array_unshift( $this->_middleware_stack, $middleware ); |
|
52 | + array_unshift($this->_middleware_stack, $middleware); |
|
53 | 53 | return $this; |
54 | 54 | } |
55 | 55 | |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | * @return EE_Request_Stack_Builder |
67 | 67 | */ |
68 | 68 | public function push( /*$class_name, $args...*/ ) { |
69 | - if ( func_num_args() === 0 ) { |
|
70 | - throw new InvalidArgumentException( "Missing argument(s) when calling push" ); |
|
69 | + if (func_num_args() === 0) { |
|
70 | + throw new InvalidArgumentException("Missing argument(s) when calling push"); |
|
71 | 71 | } |
72 | 72 | $middleware = func_get_args(); |
73 | 73 | //$this->middleware_stack->push( $middleware ); |
74 | - array_push( $this->_middleware_stack, $middleware ); |
|
74 | + array_push($this->_middleware_stack, $middleware); |
|
75 | 75 | return $this; |
76 | 76 | } |
77 | 77 | |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | * @param EEI_Request_Decorator $application |
85 | 85 | * @return EE_Request_Stack |
86 | 86 | */ |
87 | - public function resolve( EEI_Request_Decorator $application ) { |
|
88 | - $middlewares = array( $application ); |
|
89 | - foreach ( $this->_middleware_stack as $middleware_args ) { |
|
90 | - $class_name = array_shift( $middleware_args ); |
|
91 | - if ( is_callable( $class_name ) ) { |
|
92 | - $application = $class_name( $application ); |
|
87 | + public function resolve(EEI_Request_Decorator $application) { |
|
88 | + $middlewares = array($application); |
|
89 | + foreach ($this->_middleware_stack as $middleware_args) { |
|
90 | + $class_name = array_shift($middleware_args); |
|
91 | + if (is_callable($class_name)) { |
|
92 | + $application = $class_name($application); |
|
93 | 93 | } else { |
94 | - array_unshift( $middleware_args, $application ); |
|
95 | - $reflection = new ReflectionClass( $class_name ); |
|
96 | - $application = $reflection->newInstanceArgs( $middleware_args ); |
|
94 | + array_unshift($middleware_args, $application); |
|
95 | + $reflection = new ReflectionClass($class_name); |
|
96 | + $application = $reflection->newInstanceArgs($middleware_args); |
|
97 | 97 | } |
98 | - array_unshift( $middlewares, $application ); |
|
98 | + array_unshift($middlewares, $application); |
|
99 | 99 | } |
100 | - return new EE_Request_Stack( $application, $middlewares ); |
|
100 | + return new EE_Request_Stack($application, $middlewares); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @return \EE_Response |
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | - $this->terminate_request( false ); |
|
43 | + $this->terminate_request(false); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | * @param $value |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function set_notice( $key, $value ) { |
|
57 | - $this->_notice[ $key ] = $value; |
|
56 | + public function set_notice($key, $value) { |
|
57 | + $this->_notice[$key] = $value; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | * @param $key |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | - public function get_notice( $key ) { |
|
70 | - return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : NULL; |
|
69 | + public function get_notice($key) { |
|
70 | + return isset($this->_notice[$key]) ? $this->_notice[$key] : NULL; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -91,8 +91,8 @@ discard block |
||
91 | 91 | * @param $string |
92 | 92 | * @param bool $append |
93 | 93 | */ |
94 | - public function add_output( $string, $append = true ) { |
|
95 | - $this->_output = $append ? $this->_output . $string : $string . $this->_output; |
|
94 | + public function add_output($string, $append = true) { |
|
95 | + $this->_output = $append ? $this->_output.$string : $string.$this->_output; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | /** |
122 | 122 | * @param boolean $request_terminated |
123 | 123 | */ |
124 | - public function terminate_request( $request_terminated = true ) { |
|
125 | - $this->request_terminated = filter_var( $request_terminated, FILTER_VALIDATE_BOOLEAN ); |
|
124 | + public function terminate_request($request_terminated = true) { |
|
125 | + $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 |
@@ -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 | * class EE_Response |
4 | 6 | * |
@@ -3,7 +3,7 @@ |
||
3 | 3 | /** @type string $events_requiring_pre_approval_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso');?></span></h4> |
|
6 | +<h4><span class="orange-text"><?php _e('Important Notice: Events Requiring Pre-Approval', 'event_espresso'); ?></span></h4> |
|
7 | 7 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
8 | 8 | <?php echo $events_requiring_pre_approval_msg; ?> |
9 | 9 | </p> |
@@ -3,9 +3,9 @@ |
||
3 | 3 | /** @type string $sold_out_events_msg */ |
4 | 4 | ?> |
5 | 5 | |
6 | -<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso');?></b></h4> |
|
6 | +<h4 class="ee-status sold-out"><b><?php _e('Sold Out', 'event_espresso'); ?></b></h4> |
|
7 | 7 | <ul id="spco-sold-out-events-ul"><?php echo $sold_out_events; ?></ul> |
8 | - <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso');?></h6> |
|
8 | + <h6 class="pink-text"><?php _e("We're Sorry", 'event_espresso'); ?></h6> |
|
9 | 9 | <p id="events-requiring-pre-approval-pg" class="small-text drk-grey-text"> |
10 | 10 | <?php echo $sold_out_events_msg; ?> |
11 | 11 | </p> |