@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | use EventEspresso\core\libraries\rest_api\controllers\Base as Base; |
3 | 3 | use EventEspresso\core\libraries\rest_api\controllers\model\Read; |
4 | 4 | |
5 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
6 | - exit( 'No direct script access allowed' ); |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 | /** |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * @param \WP_REST_Request $request |
25 | 25 | * @return \WP_Error|\WP_REST_Response |
26 | 26 | */ |
27 | - public static function handle_request_toggle_checkin( \WP_REST_Request $request ) { |
|
27 | + public static function handle_request_toggle_checkin(\WP_REST_Request $request) { |
|
28 | 28 | $controller = new Checkin(); |
29 | - return $controller->_create_checkin_checkout_object( $request ); |
|
29 | + return $controller->_create_checkin_checkout_object($request); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -37,47 +37,47 @@ discard block |
||
37 | 37 | * @param \WP_REST_Request $request |
38 | 38 | * @return \WP_Error|\WP_REST_Response |
39 | 39 | */ |
40 | - protected function _create_checkin_checkout_object( \WP_REST_Request $request ) { |
|
41 | - $reg_id = $request->get_param( 'REG_ID' ); |
|
42 | - $dtt_id = $request->get_param( 'DTT_ID' ); |
|
43 | - $force = $request->get_param( 'force' ); |
|
44 | - if( $force == 'true' ) { |
|
40 | + protected function _create_checkin_checkout_object(\WP_REST_Request $request) { |
|
41 | + $reg_id = $request->get_param('REG_ID'); |
|
42 | + $dtt_id = $request->get_param('DTT_ID'); |
|
43 | + $force = $request->get_param('force'); |
|
44 | + if ($force == 'true') { |
|
45 | 45 | $force = true; |
46 | 46 | } else { |
47 | 47 | $force = false; |
48 | 48 | } |
49 | - $reg = \EEM_Registration::instance()->get_one_by_ID( $reg_id ); |
|
50 | - if( ! $reg instanceof \EE_Registration ) { |
|
49 | + $reg = \EEM_Registration::instance()->get_one_by_ID($reg_id); |
|
50 | + if ( ! $reg instanceof \EE_Registration) { |
|
51 | 51 | return $this->send_response( |
52 | 52 | new \WP_Error( |
53 | 53 | 'rest_registration_toggle_checkin_invalid_id', |
54 | 54 | sprintf( |
55 | - __( 'You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso' ), |
|
55 | + __('You cannot checkin registration with ID %1$s because it doesn\'t exist.', 'event_espresso'), |
|
56 | 56 | $reg_id |
57 | 57 | ), |
58 | - array( 'status' => 422 ) |
|
58 | + array('status' => 422) |
|
59 | 59 | ) |
60 | 60 | ); |
61 | 61 | } |
62 | - if( ! \EE_Capabilities::instance()->current_user_can( 'ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id ) ) { |
|
62 | + if ( ! \EE_Capabilities::instance()->current_user_can('ee_edit_checkin', 'rest_api_checkin_endpoint', $reg_id)) { |
|
63 | 63 | return $this->send_response( |
64 | 64 | new \WP_Error( |
65 | 65 | 'rest_user_cannot_toggle_checkin', |
66 | 66 | sprintf( |
67 | - __( 'You are not allowed to checkin registration with ID %1$s.', 'event_espresso' ), |
|
67 | + __('You are not allowed to checkin registration with ID %1$s.', 'event_espresso'), |
|
68 | 68 | $reg_id |
69 | 69 | ), |
70 | - array( 'status' => 403 ) |
|
70 | + array('status' => 403) |
|
71 | 71 | ) |
72 | 72 | ); |
73 | 73 | } |
74 | - $success = $reg->toggle_checkin_status( $dtt_id, ! $force ); |
|
75 | - if( $success === false ) { |
|
74 | + $success = $reg->toggle_checkin_status($dtt_id, ! $force); |
|
75 | + if ($success === false) { |
|
76 | 76 | //rely on EE_Error::add_error messages to have been added to give more data about hwy it failed |
77 | 77 | return $this->send_response( |
78 | 78 | new \WP_Error( |
79 | 79 | 'rest_toggle_checkin_failed', |
80 | - __( 'Registration checkin failed. Please see additional error data.', 'event_espresso' ) |
|
80 | + __('Registration checkin failed. Please see additional error data.', 'event_espresso') |
|
81 | 81 | ) |
82 | 82 | ); |
83 | 83 | } |
@@ -92,28 +92,28 @@ discard block |
||
92 | 92 | ) |
93 | 93 | ) |
94 | 94 | ); |
95 | - if( ! $checkin instanceof \EE_Checkin ) { |
|
95 | + if ( ! $checkin instanceof \EE_Checkin) { |
|
96 | 96 | return $this->send_response( |
97 | 97 | new \WP_Error( |
98 | 98 | 'rest_toggle_checkin_error', |
99 | 99 | sprintf( |
100 | - __( 'Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso' ), |
|
100 | + __('Supposedly we created a new checkin object for registration %1$s at datetime %2$s, but we can\'t find it.', 'event_espresso'), |
|
101 | 101 | $reg_id, |
102 | 102 | $dtt_id |
103 | 103 | ) |
104 | 104 | ) |
105 | 105 | ); |
106 | 106 | } |
107 | - $requested_version = $this->get_requested_version( $request->get_route() ); |
|
107 | + $requested_version = $this->get_requested_version($request->get_route()); |
|
108 | 108 | $get_request = new \WP_REST_Request( |
109 | 109 | 'GET', |
110 | - \EED_Core_Rest_Api::ee_api_namespace . $requested_version . '/checkins/' . $checkin->ID() |
|
110 | + \EED_Core_Rest_Api::ee_api_namespace.$requested_version.'/checkins/'.$checkin->ID() |
|
111 | 111 | ); |
112 | 112 | $get_request->set_url_params( |
113 | 113 | array( |
114 | 114 | 'id' => $checkin->ID() |
115 | 115 | ) |
116 | 116 | ); |
117 | - return Read::handle_request_get_one( $get_request ); |
|
117 | + return Read::handle_request_get_one($get_request); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | \ No newline at end of file |
@@ -22,35 +22,35 @@ discard block |
||
22 | 22 | * @param EE_Response $response |
23 | 23 | * @return EE_Response |
24 | 24 | */ |
25 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
25 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
26 | 26 | $this->_request = $request; |
27 | 27 | $this->_response = $response; |
28 | 28 | //$this->_response->add_output( "\n\t IN >> " . __CLASS__ ); |
29 | 29 | //$this->_response->set_notice( 1, 'hey look at this' ); |
30 | 30 | // check required WP version |
31 | - if ( ! $this->_minimum_wp_version_required() ) { |
|
32 | - $this->_request->un_set( 'activate', true ); |
|
33 | - add_action( 'admin_notices', array( $this, 'minimum_wp_version_error' ), 1 ); |
|
31 | + if ( ! $this->_minimum_wp_version_required()) { |
|
32 | + $this->_request->un_set('activate', true); |
|
33 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
34 | 34 | //$this->_response->add_output( "\n<br />" . 'minimum_wp_version_error' ); |
35 | 35 | $this->_response->terminate_request(); |
36 | 36 | } |
37 | 37 | // check required PHP version |
38 | - if ( ! $this->_minimum_php_version_required() ) { |
|
39 | - $this->_request->un_set( 'activate', true ); |
|
40 | - add_action( 'admin_notices', array( $this, 'minimum_php_version_error' ), 1 ); |
|
38 | + if ( ! $this->_minimum_php_version_required()) { |
|
39 | + $this->_request->un_set('activate', true); |
|
40 | + add_action('admin_notices', array($this, 'minimum_php_version_error'), 1); |
|
41 | 41 | //$this->_response->add_output( "\n<br />" . 'minimum_php_version_error' ); |
42 | 42 | $this->_response->terminate_request(); |
43 | 43 | } |
44 | 44 | // check recommended WP version |
45 | - if ( ! $this->_minimum_wp_version_recommended() ) { |
|
45 | + if ( ! $this->_minimum_wp_version_recommended()) { |
|
46 | 46 | $this->_display_minimum_recommended_wp_version_notice(); |
47 | 47 | } |
48 | 48 | // check recommended PHP version |
49 | - if ( ! $this->_minimum_php_version_recommended() ) { |
|
49 | + if ( ! $this->_minimum_php_version_recommended()) { |
|
50 | 50 | $this->_display_minimum_recommended_php_version_notice(); |
51 | 51 | } |
52 | 52 | $this->_test_for_php_version_7(); |
53 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
53 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
54 | 54 | //$this->_response->add_output( "\n\t OUT << " . __CLASS__ ); |
55 | 55 | return $this->_response; |
56 | 56 | } |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | * @param string $min_version |
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | - private function _check_wp_version( $min_version = EE_MIN_WP_VER_REQUIRED ) { |
|
67 | + private function _check_wp_version($min_version = EE_MIN_WP_VER_REQUIRED) { |
|
68 | 68 | global $wp_version; |
69 | - return version_compare( $wp_version, $min_version, '>=' ) ? true : false; |
|
69 | + return version_compare($wp_version, $min_version, '>=') ? true : false; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return boolean |
79 | 79 | */ |
80 | 80 | private function _minimum_wp_version_required() { |
81 | - return $this->_check_wp_version( EE_MIN_WP_VER_REQUIRED ); |
|
81 | + return $this->_check_wp_version(EE_MIN_WP_VER_REQUIRED); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * @return boolean |
91 | 91 | */ |
92 | 92 | private function _minimum_wp_version_recommended() { |
93 | - return $this->_check_wp_version( EE_MIN_WP_VER_RECOMMENDED ); |
|
93 | + return $this->_check_wp_version(EE_MIN_WP_VER_RECOMMENDED); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @param string $min_version |
103 | 103 | * @return boolean |
104 | 104 | */ |
105 | - private function _check_php_version( $min_version = EE_MIN_PHP_VER_RECOMMENDED ) { |
|
106 | - return version_compare( PHP_VERSION, $min_version, '>=' ) ? true : false; |
|
105 | + private function _check_php_version($min_version = EE_MIN_PHP_VER_RECOMMENDED) { |
|
106 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * @return boolean |
116 | 116 | */ |
117 | 117 | private function _minimum_php_version_required() { |
118 | - return $this->_check_php_version( EE_MIN_PHP_VER_REQUIRED ); |
|
118 | + return $this->_check_php_version(EE_MIN_PHP_VER_REQUIRED); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return boolean |
128 | 128 | */ |
129 | 129 | private function _minimum_php_version_recommended() { |
130 | - return $this->_check_php_version( EE_MIN_PHP_VER_RECOMMENDED ); |
|
130 | + return $this->_check_php_version(EE_MIN_PHP_VER_RECOMMENDED); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | <p> |
145 | 145 | <?php |
146 | 146 | printf( |
147 | - __( 'We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
147 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
148 | 148 | EE_MIN_WP_VER_REQUIRED, |
149 | 149 | $wp_version, |
150 | 150 | '<br/>', |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | <p> |
170 | 170 | <?php |
171 | 171 | printf( |
172 | - __( 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
172 | + __('We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
173 | 173 | EE_MIN_PHP_VER_REQUIRED, |
174 | 174 | PHP_VERSION, |
175 | 175 | '<br/>', |
@@ -192,9 +192,9 @@ discard block |
||
192 | 192 | private function _display_minimum_recommended_wp_version_notice() { |
193 | 193 | global $wp_version; |
194 | 194 | EE_Error::add_persistent_admin_notice( |
195 | - 'wp_version_' . str_replace( '.', '-', EE_MIN_WP_VER_RECOMMENDED ) . '_recommended', |
|
195 | + 'wp_version_'.str_replace('.', '-', EE_MIN_WP_VER_RECOMMENDED).'_recommended', |
|
196 | 196 | sprintf( |
197 | - __( 'Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso' ), |
|
197 | + __('Event Espresso recommends WordPress version %1$s or greater in order for everything to operate properly. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', 'event_espresso'), |
|
198 | 198 | EE_MIN_WP_VER_RECOMMENDED, |
199 | 199 | $wp_version, |
200 | 200 | '<br/>', |
@@ -213,9 +213,9 @@ discard block |
||
213 | 213 | */ |
214 | 214 | private function _display_minimum_recommended_php_version_notice() { |
215 | 215 | EE_Error::add_persistent_admin_notice( |
216 | - 'php_version_' . str_replace( '.', '-', EE_MIN_PHP_VER_RECOMMENDED ) . '_recommended', |
|
216 | + 'php_version_'.str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED).'_recommended', |
|
217 | 217 | sprintf( |
218 | - __( 'Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso' ), |
|
218 | + __('Event Espresso recommends PHP version %1$s or greater for optimal performance. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', 'event_espresso'), |
|
219 | 219 | EE_MIN_PHP_VER_RECOMMENDED, |
220 | 220 | PHP_VERSION, |
221 | 221 | '<br/>', |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | * @access private |
233 | 233 | */ |
234 | 234 | private function _test_for_php_version_7() { |
235 | - if ( $this->_check_php_version( '7' ) ) { |
|
236 | - define( 'EE_PHP_7', true ); |
|
235 | + if ($this->_check_php_version('7')) { |
|
236 | + define('EE_PHP_7', true); |
|
237 | 237 | } else { |
238 | - define( 'EE_PHP_7', false ); |
|
238 | + define('EE_PHP_7', false); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -194,15 +194,15 @@ discard block |
||
194 | 194 | $sold_out_events = array(); |
195 | 195 | $reg_count = 0; |
196 | 196 | // loop thru registrations to gather info |
197 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
198 | - foreach ( $registrations as $registration ) { |
|
197 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
198 | + foreach ($registrations as $registration) { |
|
199 | 199 | /** @var $registration EE_Registration */ |
200 | 200 | $reg_count++; |
201 | 201 | // if returning registrant is Approved then do NOT do this |
202 | - if ( ! ( $this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved )) { |
|
203 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true )) { |
|
202 | + if ( ! ($this->checkout->revisit && $registration->status_ID() == EEM_Registration::status_id_approved)) { |
|
203 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
204 | 204 | // add event to list of events that are sold out |
205 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
205 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
206 | 206 | do_action( |
207 | 207 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
208 | 208 | $registration->event(), |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | ); |
211 | 211 | } |
212 | 212 | // event requires admin approval |
213 | - if ( $registration->status_ID() == EEM_Registration::status_id_not_approved ) { |
|
213 | + if ($registration->status_ID() == EEM_Registration::status_id_not_approved) { |
|
214 | 214 | // add event to list of events with pre-approval reg status |
215 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
215 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
216 | 216 | do_action( |
217 | 217 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
218 | 218 | $registration->event(), |
@@ -221,29 +221,29 @@ discard block |
||
221 | 221 | } |
222 | 222 | } |
223 | 223 | // are they allowed to pay now and is there monies owing? |
224 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
225 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
224 | + if ($registration->owes_monies_and_can_pay()) { |
|
225 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
226 | 226 | do_action( |
227 | 227 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
228 | 228 | $registration->event(), |
229 | 229 | $this |
230 | 230 | ); |
231 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
232 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
231 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
232 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | $subsections = array(); |
236 | 236 | // now decide which template to load |
237 | - if ( ! empty( $sold_out_events )) { |
|
238 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
237 | + if ( ! empty($sold_out_events)) { |
|
238 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
239 | 239 | } |
240 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
241 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
240 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
241 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
242 | 242 | } |
243 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
244 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
243 | + if ( ! empty($registrations_for_free_events)) { |
|
244 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
245 | 245 | } |
246 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
246 | + if ( ! empty($registrations_requiring_payment)) { |
|
247 | 247 | // autoload Line_Item_Display classes |
248 | 248 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
249 | 249 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -254,17 +254,17 @@ discard block |
||
254 | 254 | $this->checkout->cart->get_grand_total() |
255 | 255 | ); |
256 | 256 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
257 | - if ( $this->checkout->amount_owing > 0 ) { |
|
257 | + if ($this->checkout->amount_owing > 0) { |
|
258 | 258 | EEH_Autoloader::register_line_item_display_autoloaders(); |
259 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
260 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
259 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
260 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
261 | 261 | $this->line_item_display->display_line_item( |
262 | 262 | $filtered_line_item_tree, |
263 | - array( 'registrations' => $registrations ) |
|
263 | + array('registrations' => $registrations) |
|
264 | 264 | ) |
265 | 265 | ); |
266 | 266 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
267 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
267 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
268 | 268 | } |
269 | 269 | } else { |
270 | 270 | $this->_hide_reg_step_submit_button_if_revisit(); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
298 | 298 | * @return \EE_Line_Item_Filter_Collection |
299 | 299 | */ |
300 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
300 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
301 | 301 | $line_item_filter_collection->add( |
302 | 302 | new EE_Billable_Line_Item_Filter( |
303 | 303 | EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | ) |
306 | 306 | ) |
307 | 307 | ); |
308 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
308 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
309 | 309 | return $line_item_filter_collection; |
310 | 310 | } |
311 | 311 | |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | * @return void |
320 | 320 | */ |
321 | 321 | protected function _hide_reg_step_submit_button_if_revisit() { |
322 | - if ( $this->checkout->revisit ) { |
|
323 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
322 | + if ($this->checkout->revisit) { |
|
323 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -331,12 +331,12 @@ discard block |
||
331 | 331 | * @param \EE_Event[] $sold_out_events_array |
332 | 332 | * @return \EE_Form_Section_Proper |
333 | 333 | */ |
334 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
334 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
335 | 335 | // set some defaults |
336 | 336 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
337 | 337 | $sold_out_events = ''; |
338 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
339 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
338 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
339 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
340 | 340 | } |
341 | 341 | return new EE_Form_Section_Proper( |
342 | 342 | array( |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | ), |
349 | 349 | 'layout_strategy' => new EE_Template_Layout( |
350 | 350 | array( |
351 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
351 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
352 | 352 | 'template_args' => apply_filters( |
353 | 353 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
354 | 354 | array( |
355 | 355 | 'sold_out_events' => $sold_out_events, |
356 | 356 | 'sold_out_events_msg' => apply_filters( |
357 | 357 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
358 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ) |
|
358 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso') |
|
359 | 359 | ) |
360 | 360 | ) |
361 | 361 | ) |
@@ -372,14 +372,14 @@ discard block |
||
372 | 372 | * @param array $registrations_requiring_pre_approval |
373 | 373 | * @return \EE_Form_Section_Proper |
374 | 374 | */ |
375 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
375 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
376 | 376 | $events_requiring_pre_approval = ''; |
377 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
378 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
379 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
380 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
377 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
378 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
379 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
380 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
381 | 381 | ) |
382 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
382 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
383 | 383 | ); |
384 | 384 | } |
385 | 385 | } |
@@ -391,14 +391,14 @@ discard block |
||
391 | 391 | ), |
392 | 392 | 'layout_strategy' => new EE_Template_Layout( |
393 | 393 | array( |
394 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
394 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
395 | 395 | 'template_args' => apply_filters( |
396 | 396 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
397 | 397 | array( |
398 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
398 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
399 | 399 | 'events_requiring_pre_approval_msg' => apply_filters( |
400 | 400 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
401 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
401 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
402 | 402 | ) |
403 | 403 | ) |
404 | 404 | ), |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | * @param \EE_Event[] $registrations_for_free_events |
417 | 417 | * @return \EE_Form_Section_Proper |
418 | 418 | */ |
419 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
419 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
420 | 420 | // set some defaults |
421 | 421 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
422 | 422 | // generate no_payment_required form |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | ), |
429 | 429 | 'layout_strategy' => new EE_Template_Layout( |
430 | 430 | array( |
431 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
431 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
432 | 432 | 'template_args' => apply_filters( |
433 | 433 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
434 | 434 | array( |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'registrations' => array(), |
437 | 437 | 'ticket_count' => array(), |
438 | 438 | 'registrations_for_free_events' => $registrations_for_free_events, |
439 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
439 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
440 | 440 | ) |
441 | 441 | ), |
442 | 442 | ) |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | * @param string $transaction_details |
454 | 454 | * @return \EE_Form_Section_Proper |
455 | 455 | */ |
456 | - private function _display_payment_options( $transaction_details = '' ) { |
|
456 | + private function _display_payment_options($transaction_details = '') { |
|
457 | 457 | // has method_of_payment been set by no-js user? |
458 | 458 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
459 | 459 | // build payment options form |
@@ -465,20 +465,20 @@ discard block |
||
465 | 465 | 'before_payment_options' => apply_filters( |
466 | 466 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
467 | 467 | new EE_Form_Section_Proper( |
468 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
468 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
469 | 469 | ) |
470 | 470 | ), |
471 | 471 | 'payment_options' => $this->_setup_payment_options(), |
472 | 472 | 'after_payment_options' => apply_filters( |
473 | 473 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
474 | 474 | new EE_Form_Section_Proper( |
475 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
475 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
476 | 476 | ) |
477 | 477 | ), |
478 | 478 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
479 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( FALSE ) |
|
479 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(FALSE) |
|
480 | 480 | ), |
481 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
481 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
482 | 482 | 'layout_template_file' => $this->_template, |
483 | 483 | 'template_args' => apply_filters( |
484 | 484 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -502,11 +502,11 @@ discard block |
||
502 | 502 | * @param bool $no_payment_required |
503 | 503 | * @return \EE_Form_Section_Proper |
504 | 504 | */ |
505 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
505 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
506 | 506 | |
507 | 507 | return new EE_Form_Section_Proper( |
508 | 508 | array( |
509 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
509 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
510 | 510 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
511 | 511 | 'subsections' => array( |
512 | 512 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -539,16 +539,16 @@ discard block |
||
539 | 539 | * @access protected |
540 | 540 | * @return void |
541 | 541 | */ |
542 | - protected function _apply_registration_payments_to_amount_owing( $registrations ) { |
|
542 | + protected function _apply_registration_payments_to_amount_owing($registrations) { |
|
543 | 543 | $payments = array(); |
544 | - foreach ( $registrations as $registration ) { |
|
545 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
544 | + foreach ($registrations as $registration) { |
|
545 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
546 | 546 | $payments = $payments + $registration->registration_payments(); |
547 | 547 | } |
548 | 548 | } |
549 | - if ( ! empty( $payments ) ) { |
|
550 | - foreach ( $payments as $payment ) { |
|
551 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
549 | + if ( ! empty($payments)) { |
|
550 | + foreach ($payments as $payment) { |
|
551 | + if ($payment instanceof EE_Registration_Payment) { |
|
552 | 552 | $this->checkout->amount_owing -= $payment->amount(); |
553 | 553 | } |
554 | 554 | } |
@@ -563,9 +563,9 @@ discard block |
||
563 | 563 | * @param bool $force_reset |
564 | 564 | * @return void |
565 | 565 | */ |
566 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
567 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
568 | - if ( $reset_payment_method ) { |
|
566 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
567 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
568 | + if ($reset_payment_method) { |
|
569 | 569 | $this->checkout->selected_method_of_payment = NULL; |
570 | 570 | $this->checkout->payment_method = NULL; |
571 | 571 | $this->checkout->billing_form = NULL; |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | * @param string $selected_method_of_payment |
585 | 585 | * @return EE_Billing_Info_Form |
586 | 586 | */ |
587 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
588 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
589 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
587 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
588 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
589 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
@@ -599,40 +599,40 @@ discard block |
||
599 | 599 | // load payment method classes |
600 | 600 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
601 | 601 | // switch up header depending on number of available payment methods |
602 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
603 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
604 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
602 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
603 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
604 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
605 | 605 | $available_payment_methods = array( |
606 | 606 | // display the "Payment Method" header |
607 | 607 | 'payment_method_header' => new EE_Form_Section_HTML( |
608 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
608 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
609 | 609 | ) |
610 | 610 | ); |
611 | 611 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
612 | 612 | $available_payment_method_options = array(); |
613 | 613 | $default_payment_method_option = array(); |
614 | 614 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
615 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
615 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
616 | 616 | // loop through payment methods |
617 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
618 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
619 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
617 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
618 | + if ($payment_method instanceof EE_Payment_Method) { |
|
619 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
620 | 620 | // check if any payment methods are set as default |
621 | 621 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
622 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
622 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
623 | 623 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
624 | 624 | $this->_save_selected_method_of_payment(); |
625 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
625 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
626 | 626 | } else { |
627 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
627 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
628 | 628 | } |
629 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
629 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
633 | 633 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
634 | 634 | // now generate the actual form inputs |
635 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
635 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
636 | 636 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
637 | 637 | |
638 | 638 | // build the available payment methods form |
@@ -652,19 +652,19 @@ discard block |
||
652 | 652 | * @return EE_Payment_Method[] |
653 | 653 | */ |
654 | 654 | protected function _get_available_payment_methods() { |
655 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
655 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
656 | 656 | return $this->checkout->available_payment_methods; |
657 | 657 | } |
658 | 658 | $available_payment_methods = array(); |
659 | 659 | // load EEM_Payment_Method |
660 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
660 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
661 | 661 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
662 | 662 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
663 | 663 | // get all active payment methods |
664 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
665 | - foreach ( $payment_methods as $payment_method ) { |
|
666 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
667 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
664 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
665 | + foreach ($payment_methods as $payment_method) { |
|
666 | + if ($payment_method instanceof EE_Payment_Method) { |
|
667 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
668 | 668 | } |
669 | 669 | } |
670 | 670 | return $available_payment_methods; |
@@ -680,14 +680,14 @@ discard block |
||
680 | 680 | * @param array $available_payment_method_options |
681 | 681 | * @return \EE_Form_Section_Proper |
682 | 682 | */ |
683 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
683 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
684 | 684 | // generate inputs |
685 | 685 | return new EE_Form_Section_Proper( |
686 | 686 | array( |
687 | 687 | 'html_id' => 'ee-available-payment-method-inputs', |
688 | 688 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
689 | 689 | 'subsections' => array( |
690 | - '' => new EE_Radio_Button_Input ( |
|
690 | + '' => new EE_Radio_Button_Input( |
|
691 | 691 | $available_payment_method_options, |
692 | 692 | array( |
693 | 693 | 'html_name' => 'selected_method_of_payment', |
@@ -711,36 +711,36 @@ discard block |
||
711 | 711 | * @param EE_Payment_Method $payment_method |
712 | 712 | * @return \EE_Form_Section_Proper |
713 | 713 | */ |
714 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
714 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
715 | 715 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
716 | 716 | // generate the billing form for payment method |
717 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
717 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
718 | 718 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
719 | 719 | // it's all in the details |
720 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
720 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
721 | 721 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
722 | - if ( $payment_method->description() ) { |
|
722 | + if ($payment_method->description()) { |
|
723 | 723 | $payment_method_info = $payment_method->description(); |
724 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
725 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
724 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
725 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
726 | 726 | } else { |
727 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
727 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
728 | 728 | } |
729 | - $info_html .= EEH_HTML::p ( |
|
730 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
729 | + $info_html .= EEH_HTML::p( |
|
730 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
731 | 731 | '', |
732 | 732 | 'spco-payment-method-desc ee-attention' |
733 | 733 | ); |
734 | 734 | |
735 | 735 | return new EE_Form_Section_Proper( |
736 | 736 | array( |
737 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
737 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
738 | 738 | 'html_class' => 'spco-payment-method-info-dv', |
739 | 739 | // only display the selected or default PM |
740 | 740 | 'html_style' => $currently_selected ? '' : 'display:none;', |
741 | 741 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
742 | 742 | 'subsections' => array( |
743 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
743 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
744 | 744 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
745 | 745 | ) |
746 | 746 | ) |
@@ -758,12 +758,12 @@ discard block |
||
758 | 758 | */ |
759 | 759 | public function get_billing_form_html_for_payment_method() { |
760 | 760 | // how have they chosen to pay? |
761 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
761 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
762 | 762 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
763 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
763 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
764 | 764 | return FALSE; |
765 | 765 | } |
766 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
766 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
767 | 767 | EE_Error::add_success( |
768 | 768 | apply_filters( |
769 | 769 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -772,20 +772,20 @@ discard block |
||
772 | 772 | ); |
773 | 773 | } |
774 | 774 | // now generate billing form for selected method of payment |
775 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
775 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
776 | 776 | // fill form with attendee info if applicable |
777 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
778 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
777 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
778 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
779 | 779 | } |
780 | 780 | // and debug content |
781 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
782 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
781 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
782 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
783 | 783 | } |
784 | 784 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
785 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
785 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
786 | 786 | // localize validation rules for main form |
787 | 787 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
788 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
788 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
789 | 789 | return TRUE; |
790 | 790 | } |
791 | 791 | |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | * @param EE_Payment_Method $payment_method |
799 | 799 | * @return \EE_Billing_Info_Form |
800 | 800 | */ |
801 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
802 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
803 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
804 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
805 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
801 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
802 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
803 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
804 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
805 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
806 | 806 | EE_Error::add_success( |
807 | 807 | apply_filters( |
808 | 808 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
809 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
809 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
810 | 810 | ) |
811 | 811 | ); |
812 | 812 | } |
@@ -831,27 +831,27 @@ discard block |
||
831 | 831 | * @param string $request_param |
832 | 832 | * @return NULL|string |
833 | 833 | */ |
834 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
834 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
835 | 835 | // is selected_method_of_payment set in the request ? |
836 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
837 | - if ( $selected_method_of_payment ) { |
|
836 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
837 | + if ($selected_method_of_payment) { |
|
838 | 838 | // sanitize it |
839 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
840 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
839 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
840 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
841 | 841 | // store it in the session so that it's available for all subsequent requests including AJAX |
842 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
842 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
843 | 843 | } else { |
844 | 844 | // or is is set in the session ? |
845 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
845 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
846 | 846 | } |
847 | 847 | // do ya really really gotta have it? |
848 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
848 | + if (empty($selected_method_of_payment) && $required) { |
|
849 | 849 | EE_Error::add_error( |
850 | 850 | sprintf( |
851 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
851 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
852 | 852 | '<br/>', |
853 | 853 | '<br/>', |
854 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
854 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
855 | 855 | ), |
856 | 856 | __FILE__, __FUNCTION__, __LINE__ |
857 | 857 | ); |
@@ -877,37 +877,37 @@ discard block |
||
877 | 877 | * @return string |
878 | 878 | */ |
879 | 879 | public function switch_payment_method() { |
880 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
880 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
881 | 881 | return FALSE; |
882 | 882 | } |
883 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
883 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
884 | 884 | EE_Error::add_success( |
885 | 885 | apply_filters( |
886 | 886 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
887 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
887 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
888 | 888 | ) |
889 | 889 | ); |
890 | 890 | } |
891 | 891 | // generate billing form for selected method of payment if it hasn't been done already |
892 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
893 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
892 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
893 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
894 | 894 | } |
895 | 895 | // fill form with attendee info if applicable |
896 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
897 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
896 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
897 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
898 | 898 | } |
899 | 899 | // and debug content |
900 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
901 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
900 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
901 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
902 | 902 | } |
903 | 903 | // get html and validation rules for form |
904 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
905 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
904 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
905 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
906 | 906 | // localize validation rules for main form |
907 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
908 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
907 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
908 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
909 | 909 | } else { |
910 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
910 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
911 | 911 | } |
912 | 912 | //prevents advancement to next step |
913 | 913 | $this->checkout->continue_reg = FALSE; |
@@ -922,12 +922,12 @@ discard block |
||
922 | 922 | */ |
923 | 923 | protected function _verify_payment_method_is_set() { |
924 | 924 | // generate billing form for selected method of payment if it hasn't been done already |
925 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
925 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
926 | 926 | // how have they chosen to pay? |
927 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
927 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
928 | 928 | } |
929 | 929 | // verify payment method |
930 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
930 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
931 | 931 | // get payment method for selected method of payment |
932 | 932 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
933 | 933 | } |
@@ -947,23 +947,23 @@ discard block |
||
947 | 947 | * @return void |
948 | 948 | */ |
949 | 949 | public function save_payer_details_via_ajax() { |
950 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
950 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
951 | 951 | return; |
952 | 952 | } |
953 | 953 | // generate billing form for selected method of payment if it hasn't been done already |
954 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
955 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
954 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
955 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
956 | 956 | } |
957 | 957 | // generate primary attendee from payer info if applicable |
958 | 958 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
959 | 959 | $attendee = $this->_create_attendee_from_request_data(); |
960 | - if ( $attendee instanceof EE_Attendee ) { |
|
961 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
962 | - if ( $registration->is_primary_registrant() ) { |
|
960 | + if ($attendee instanceof EE_Attendee) { |
|
961 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
962 | + if ($registration->is_primary_registrant()) { |
|
963 | 963 | $this->checkout->primary_attendee_obj = $attendee; |
964 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
965 | - $registration->set_attendee_id( $attendee->ID() ); |
|
966 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
964 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
965 | + $registration->set_attendee_id($attendee->ID()); |
|
966 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | } |
@@ -976,56 +976,56 @@ discard block |
||
976 | 976 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
977 | 977 | * @return \EE_Attendee |
978 | 978 | */ |
979 | - protected function _create_attendee_from_request_data(){ |
|
979 | + protected function _create_attendee_from_request_data() { |
|
980 | 980 | // get State ID |
981 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
982 | - if ( ! empty( $STA_ID )) { |
|
981 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
982 | + if ( ! empty($STA_ID)) { |
|
983 | 983 | // can we get state object from name ? |
984 | - EE_Registry::instance()->load_model( 'State' ); |
|
985 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
986 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
984 | + EE_Registry::instance()->load_model('State'); |
|
985 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
986 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
987 | 987 | } |
988 | 988 | // get Country ISO |
989 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
990 | - if ( ! empty( $CNT_ISO )) { |
|
989 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
990 | + if ( ! empty($CNT_ISO)) { |
|
991 | 991 | // can we get country object from name ? |
992 | - EE_Registry::instance()->load_model( 'Country' ); |
|
993 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
994 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
992 | + EE_Registry::instance()->load_model('Country'); |
|
993 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
994 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
995 | 995 | } |
996 | 996 | // grab attendee data |
997 | 997 | $attendee_data = array( |
998 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
999 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1000 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1001 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1002 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1003 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
998 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
999 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1000 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1001 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1002 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1003 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1004 | 1004 | 'STA_ID' => $STA_ID, |
1005 | 1005 | 'CNT_ISO' => $CNT_ISO, |
1006 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1007 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1006 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1007 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1008 | 1008 | ); |
1009 | 1009 | // validate the email address since it is the most important piece of info |
1010 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1011 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1010 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1011 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1012 | 1012 | } |
1013 | 1013 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1014 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1015 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1014 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1015 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1016 | 1016 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1017 | 1017 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1018 | 1018 | 'ATT_email' => $attendee_data['ATT_email'] |
1019 | 1019 | )); |
1020 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1020 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1021 | 1021 | return $existing_attendee; |
1022 | 1022 | } |
1023 | 1023 | } |
1024 | 1024 | // no existing attendee? kk let's create a new one |
1025 | 1025 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1026 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1027 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1028 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1026 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1027 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1028 | + return EE_Attendee::new_instance($attendee_data); |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | |
@@ -1045,22 +1045,22 @@ discard block |
||
1045 | 1045 | */ |
1046 | 1046 | public function process_reg_step() { |
1047 | 1047 | // how have they chosen to pay? |
1048 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1048 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1049 | 1049 | // choose your own adventure based on method_of_payment |
1050 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1050 | + switch ($this->checkout->selected_method_of_payment) { |
|
1051 | 1051 | |
1052 | 1052 | case 'events_sold_out' : |
1053 | 1053 | $this->checkout->redirect = TRUE; |
1054 | 1054 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1055 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1055 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1056 | 1056 | // mark this reg step as completed |
1057 | 1057 | $this->set_completed(); |
1058 | 1058 | return FALSE; |
1059 | 1059 | break; |
1060 | 1060 | |
1061 | 1061 | case 'payments_closed' : |
1062 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1063 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1062 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1063 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1064 | 1064 | } |
1065 | 1065 | // mark this reg step as completed |
1066 | 1066 | $this->set_completed(); |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | break; |
1069 | 1069 | |
1070 | 1070 | case 'no_payment_required' : |
1071 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1072 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1071 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1072 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1073 | 1073 | } |
1074 | 1074 | // mark this reg step as completed |
1075 | 1075 | $this->set_completed(); |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | |
1079 | 1079 | default: |
1080 | 1080 | $payment_successful = $this->_process_payment(); |
1081 | - if ( $payment_successful ) { |
|
1081 | + if ($payment_successful) { |
|
1082 | 1082 | $this->checkout->continue_reg = true; |
1083 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1083 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1084 | 1084 | } else { |
1085 | 1085 | $this->checkout->continue_reg = false; |
1086 | 1086 | } |
@@ -1098,8 +1098,8 @@ discard block |
||
1098 | 1098 | * @param \EE_Payment_Method $payment_method |
1099 | 1099 | * @return void |
1100 | 1100 | */ |
1101 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1102 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1101 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1102 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1103 | 1103 | case EE_PMT_Base::offsite : |
1104 | 1104 | break; |
1105 | 1105 | case EE_PMT_Base::onsite : |
@@ -1122,15 +1122,15 @@ discard block |
||
1122 | 1122 | public function update_reg_step() { |
1123 | 1123 | $success = TRUE; |
1124 | 1124 | // if payment required |
1125 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1126 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1125 | + if ($this->checkout->transaction->total() > 0) { |
|
1126 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1127 | 1127 | // attempt payment via payment method |
1128 | 1128 | $success = $this->process_reg_step(); |
1129 | 1129 | } |
1130 | - if ( $success && ! $this->checkout->redirect ) { |
|
1131 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1130 | + if ($success && ! $this->checkout->redirect) { |
|
1131 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1132 | 1132 | // set return URL |
1133 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1133 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1134 | 1134 | } |
1135 | 1135 | return $success; |
1136 | 1136 | } |
@@ -1150,24 +1150,24 @@ discard block |
||
1150 | 1150 | // clear any previous errors related to not selecting a payment method |
1151 | 1151 | // EE_Error::overwrite_errors(); |
1152 | 1152 | // ya gotta make a choice man |
1153 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1154 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1153 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1154 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1155 | 1155 | return FALSE; |
1156 | 1156 | } |
1157 | 1157 | // get EE_Payment_Method object |
1158 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1158 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1159 | 1159 | return FALSE; |
1160 | 1160 | } |
1161 | 1161 | // setup billing form |
1162 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1163 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1162 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1163 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1164 | 1164 | // bad billing form ? |
1165 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1165 | + if ( ! $this->_billing_form_is_valid()) { |
|
1166 | 1166 | return FALSE; |
1167 | 1167 | } |
1168 | 1168 | } |
1169 | 1169 | // ensure primary registrant has been fully processed |
1170 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1170 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1171 | 1171 | return FALSE; |
1172 | 1172 | } |
1173 | 1173 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1175,24 +1175,24 @@ discard block |
||
1175 | 1175 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1176 | 1176 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1177 | 1177 | // attempt payment |
1178 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1178 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1179 | 1179 | // process results |
1180 | - $payment = $this->_validate_payment( $payment ); |
|
1181 | - $payment = $this->_post_payment_processing( $payment ); |
|
1180 | + $payment = $this->_validate_payment($payment); |
|
1181 | + $payment = $this->_post_payment_processing($payment); |
|
1182 | 1182 | // verify payment |
1183 | - if ( $payment instanceof EE_Payment ) { |
|
1183 | + if ($payment instanceof EE_Payment) { |
|
1184 | 1184 | // store that for later |
1185 | 1185 | $this->checkout->payment = $payment; |
1186 | 1186 | /** @type EE_Transaction_Processor $transaction_processor */ |
1187 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1187 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1188 | 1188 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1189 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1190 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1189 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1190 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1191 | 1191 | return true; |
1192 | 1192 | } else { |
1193 | 1193 | return false; |
1194 | 1194 | } |
1195 | - } else if ( $payment === true ) { |
|
1195 | + } else if ($payment === true) { |
|
1196 | 1196 | // please note that offline payment methods will NOT make a payment, |
1197 | 1197 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1198 | 1198 | $this->checkout->payment = $payment; |
@@ -1211,10 +1211,10 @@ discard block |
||
1211 | 1211 | * @return bool |
1212 | 1212 | */ |
1213 | 1213 | public function redirect_form() { |
1214 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1214 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1215 | 1215 | $html = $payment_method_billing_info->get_html_and_js(); |
1216 | 1216 | $html .= $this->checkout->redirect_form; |
1217 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1217 | + EE_Registry::instance()->REQ->add_output($html); |
|
1218 | 1218 | return TRUE; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1227,36 +1227,36 @@ discard block |
||
1227 | 1227 | * @return bool |
1228 | 1228 | */ |
1229 | 1229 | private function _billing_form_is_valid() { |
1230 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1230 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1231 | 1231 | return TRUE; |
1232 | 1232 | } |
1233 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1234 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1233 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1234 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1235 | 1235 | $this->checkout->billing_form->receive_form_submission(); |
1236 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1236 | + if ($this->checkout->billing_form->is_valid()) { |
|
1237 | 1237 | return TRUE; |
1238 | 1238 | } |
1239 | 1239 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1240 | 1240 | $error_strings = array(); |
1241 | - foreach( $validation_errors as $validation_error ){ |
|
1242 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1241 | + foreach ($validation_errors as $validation_error) { |
|
1242 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1243 | 1243 | $form_section = $validation_error->get_form_section(); |
1244 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1244 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1245 | 1245 | $label = $form_section->html_label_text(); |
1246 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1246 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1247 | 1247 | $label = $form_section->name(); |
1248 | - }else{ |
|
1249 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1248 | + } else { |
|
1249 | + $label = __('Validation Error', 'event_espresso'); |
|
1250 | 1250 | } |
1251 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1251 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1252 | 1252 | } |
1253 | 1253 | } |
1254 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1254 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1255 | 1255 | } else { |
1256 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1256 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1257 | 1257 | } |
1258 | 1258 | } else { |
1259 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1259 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1260 | 1260 | } |
1261 | 1261 | return FALSE; |
1262 | 1262 | } |
@@ -1274,9 +1274,9 @@ discard block |
||
1274 | 1274 | */ |
1275 | 1275 | private function _setup_primary_registrant_prior_to_payment() { |
1276 | 1276 | // check if transaction has a primary registrant and that it has a related Attendee object |
1277 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1277 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1278 | 1278 | // need to at least gather some primary registrant data before attempting payment |
1279 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1279 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1280 | 1280 | return FALSE; |
1281 | 1281 | } |
1282 | 1282 | } |
@@ -1284,13 +1284,13 @@ discard block |
||
1284 | 1284 | // grab the primary_registration object |
1285 | 1285 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1286 | 1286 | /** @type EE_Transaction_Processor $transaction_processor */ |
1287 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1287 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1288 | 1288 | // at this point we'll consider a TXN to not have been failed |
1289 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1289 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1290 | 1290 | // save the TXN ( which clears cached copy of primary_registration) |
1291 | 1291 | $this->checkout->transaction->save(); |
1292 | 1292 | // grab TXN ID and save it to the primary_registration |
1293 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1293 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1294 | 1294 | // save what we have so far |
1295 | 1295 | $primary_registration->save(); |
1296 | 1296 | return TRUE; |
@@ -1307,41 +1307,41 @@ discard block |
||
1307 | 1307 | private function _capture_primary_registration_data_from_billing_form() { |
1308 | 1308 | // convert billing form data into an attendee |
1309 | 1309 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1310 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1310 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1311 | 1311 | EE_Error::add_error( |
1312 | 1312 | sprintf( |
1313 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1313 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1314 | 1314 | '<br/>', |
1315 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1315 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1316 | 1316 | ), __FILE__, __FUNCTION__, __LINE__ |
1317 | 1317 | ); |
1318 | 1318 | return FALSE; |
1319 | 1319 | } |
1320 | 1320 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1321 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1321 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1322 | 1322 | EE_Error::add_error( |
1323 | 1323 | sprintf( |
1324 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1324 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1325 | 1325 | '<br/>', |
1326 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1326 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1327 | 1327 | ), __FILE__, __FUNCTION__, __LINE__ |
1328 | 1328 | ); |
1329 | 1329 | return FALSE; |
1330 | 1330 | } |
1331 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1331 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1332 | 1332 | EE_Error::add_error( |
1333 | 1333 | sprintf( |
1334 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1334 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1335 | 1335 | '<br/>', |
1336 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1336 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1337 | 1337 | ), __FILE__, __FUNCTION__, __LINE__ |
1338 | 1338 | ); |
1339 | 1339 | return FALSE; |
1340 | 1340 | } |
1341 | 1341 | /** @type EE_Registration_Processor $registration_processor */ |
1342 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1342 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1343 | 1343 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1344 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1344 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1345 | 1345 | |
1346 | 1346 | return TRUE; |
1347 | 1347 | } |
@@ -1357,35 +1357,35 @@ discard block |
||
1357 | 1357 | */ |
1358 | 1358 | private function _get_payment_method_for_selected_method_of_payment() { |
1359 | 1359 | // get EE_Payment_Method object |
1360 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1361 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1360 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1361 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1362 | 1362 | } else { |
1363 | 1363 | // load EEM_Payment_Method |
1364 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1364 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1365 | 1365 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1366 | 1366 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1367 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1367 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1368 | 1368 | } |
1369 | 1369 | // verify $payment_method |
1370 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1370 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1371 | 1371 | // not a payment |
1372 | 1372 | EE_Error::add_error( |
1373 | 1373 | sprintf( |
1374 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1374 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1375 | 1375 | '<br/>', |
1376 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1376 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1377 | 1377 | ), __FILE__, __FUNCTION__, __LINE__ |
1378 | 1378 | ); |
1379 | 1379 | return NULL; |
1380 | 1380 | } |
1381 | 1381 | // and verify it has a valid Payment_Method Type object |
1382 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1382 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1383 | 1383 | // not a payment |
1384 | 1384 | EE_Error::add_error( |
1385 | 1385 | sprintf( |
1386 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1386 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1387 | 1387 | '<br/>', |
1388 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1388 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1389 | 1389 | ), __FILE__, __FUNCTION__, __LINE__ |
1390 | 1390 | ); |
1391 | 1391 | return NULL; |
@@ -1404,30 +1404,30 @@ discard block |
||
1404 | 1404 | * @type EE_Payment_Method $payment_method |
1405 | 1405 | * @return mixed EE_Payment | boolean |
1406 | 1406 | */ |
1407 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1408 | - $payment =NULL; |
|
1407 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1408 | + $payment = NULL; |
|
1409 | 1409 | $this->checkout->transaction->save(); |
1410 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1411 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1410 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1411 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1412 | 1412 | return FALSE; |
1413 | 1413 | } |
1414 | 1414 | try { |
1415 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1415 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1416 | 1416 | // generate payment object |
1417 | 1417 | $payment = $payment_processor->process_payment( |
1418 | 1418 | $payment_method, |
1419 | 1419 | $this->checkout->transaction, |
1420 | 1420 | $this->checkout->amount_owing, |
1421 | 1421 | $this->checkout->billing_form, |
1422 | - $this->_get_return_url( $payment_method ), |
|
1422 | + $this->_get_return_url($payment_method), |
|
1423 | 1423 | 'CART', |
1424 | 1424 | $this->checkout->admin_request, |
1425 | 1425 | TRUE, |
1426 | 1426 | $this->reg_step_url() |
1427 | 1427 | ); |
1428 | 1428 | |
1429 | - } catch( Exception $e ) { |
|
1430 | - $this->_handle_payment_processor_exception( $e ); |
|
1429 | + } catch (Exception $e) { |
|
1430 | + $this->_handle_payment_processor_exception($e); |
|
1431 | 1431 | } |
1432 | 1432 | return $payment; |
1433 | 1433 | } |
@@ -1441,12 +1441,12 @@ discard block |
||
1441 | 1441 | * @param \Exception $e |
1442 | 1442 | * @return void |
1443 | 1443 | */ |
1444 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1444 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1445 | 1445 | EE_Error::add_error( |
1446 | 1446 | sprintf( |
1447 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1447 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1448 | 1448 | '<br/>', |
1449 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1449 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1450 | 1450 | $e->getMessage(), |
1451 | 1451 | $e->getFile(), |
1452 | 1452 | $e->getLine() |
@@ -1463,9 +1463,9 @@ discard block |
||
1463 | 1463 | * @param \EE_Payment_Method $payment_method |
1464 | 1464 | * @return string |
1465 | 1465 | */ |
1466 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1466 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1467 | 1467 | $return_url = ''; |
1468 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1468 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1469 | 1469 | |
1470 | 1470 | case EE_PMT_Base::offsite : |
1471 | 1471 | $return_url = add_query_arg( |
@@ -1496,18 +1496,18 @@ discard block |
||
1496 | 1496 | * @param EE_Payment $payment |
1497 | 1497 | * @return EE_Payment | FALSE |
1498 | 1498 | */ |
1499 | - private function _validate_payment( $payment = NULL ) { |
|
1500 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1499 | + private function _validate_payment($payment = NULL) { |
|
1500 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1501 | 1501 | return TRUE; |
1502 | 1502 | } |
1503 | 1503 | // verify payment object |
1504 | - if ( ! $payment instanceof EE_Payment ) { |
|
1504 | + if ( ! $payment instanceof EE_Payment) { |
|
1505 | 1505 | // not a payment |
1506 | 1506 | EE_Error::add_error( |
1507 | 1507 | sprintf( |
1508 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1508 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1509 | 1509 | '<br/>', |
1510 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1510 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1511 | 1511 | ), __FILE__, __FUNCTION__, __LINE__ |
1512 | 1512 | ); |
1513 | 1513 | return FALSE; |
@@ -1524,23 +1524,23 @@ discard block |
||
1524 | 1524 | * @param EE_Payment $payment |
1525 | 1525 | * @return bool |
1526 | 1526 | */ |
1527 | - private function _post_payment_processing( $payment = NULL ) { |
|
1527 | + private function _post_payment_processing($payment = NULL) { |
|
1528 | 1528 | // On-Site payment? |
1529 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1530 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1529 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1530 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1531 | 1531 | //$this->_setup_redirect_for_next_step(); |
1532 | 1532 | $this->checkout->continue_reg = false; |
1533 | 1533 | } |
1534 | 1534 | // Off-Site payment? |
1535 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1535 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1536 | 1536 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1537 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1538 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1537 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1538 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1539 | 1539 | $this->checkout->redirect = TRUE; |
1540 | 1540 | $this->checkout->redirect_form = $payment->redirect_form(); |
1541 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1541 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1542 | 1542 | // set JSON response |
1543 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1543 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1544 | 1544 | // set cron job for finalizing the TXN |
1545 | 1545 | // in case the user does not return from the off-site gateway |
1546 | 1546 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1548,21 +1548,21 @@ discard block |
||
1548 | 1548 | $this->checkout->transaction->ID() |
1549 | 1549 | ); |
1550 | 1550 | // and lastly, let's bump the payment status to pending |
1551 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1551 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1552 | 1552 | $payment->save(); |
1553 | 1553 | } else { |
1554 | 1554 | // not a payment |
1555 | 1555 | $this->checkout->continue_reg = false; |
1556 | 1556 | EE_Error::add_error( |
1557 | 1557 | sprintf( |
1558 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1558 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1559 | 1559 | '<br/>', |
1560 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1560 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1561 | 1561 | ), __FILE__, __FUNCTION__, __LINE__ |
1562 | 1562 | ); |
1563 | 1563 | } |
1564 | 1564 | // Off-Line payment? |
1565 | - } else if ( $payment === TRUE ) { |
|
1565 | + } else if ($payment === TRUE) { |
|
1566 | 1566 | //$this->_setup_redirect_for_next_step(); |
1567 | 1567 | return TRUE; |
1568 | 1568 | } else { |
@@ -1598,65 +1598,65 @@ discard block |
||
1598 | 1598 | * @return bool |
1599 | 1599 | * @throws \EE_Error |
1600 | 1600 | */ |
1601 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1601 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1602 | 1602 | // off-line payment? carry on |
1603 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1603 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1604 | 1604 | return true; |
1605 | 1605 | } |
1606 | 1606 | // verify payment validity |
1607 | - if ( $payment instanceof EE_Payment ) { |
|
1608 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1607 | + if ($payment instanceof EE_Payment) { |
|
1608 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1609 | 1609 | $msg = $payment->gateway_response(); |
1610 | 1610 | // check results |
1611 | - switch ( $payment->status() ) { |
|
1611 | + switch ($payment->status()) { |
|
1612 | 1612 | |
1613 | 1613 | // good payment |
1614 | 1614 | case EEM_Payment::status_id_approved : |
1615 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1615 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1616 | 1616 | return TRUE; |
1617 | 1617 | break; |
1618 | 1618 | |
1619 | 1619 | // slow payment |
1620 | 1620 | case EEM_Payment::status_id_pending : |
1621 | - if ( empty( $msg )) { |
|
1622 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1621 | + if (empty($msg)) { |
|
1622 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1623 | 1623 | } |
1624 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1624 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1625 | 1625 | return TRUE; |
1626 | 1626 | break; |
1627 | 1627 | |
1628 | 1628 | // don't wanna payment |
1629 | 1629 | case EEM_Payment::status_id_cancelled : |
1630 | - if ( empty( $msg )) { |
|
1630 | + if (empty($msg)) { |
|
1631 | 1631 | $msg = _n( |
1632 | 1632 | 'Payment cancelled. Please try again.', |
1633 | 1633 | 'Payment cancelled. Please try again or select another method of payment.', |
1634 | - count( $this->checkout->available_payment_methods ), |
|
1634 | + count($this->checkout->available_payment_methods), |
|
1635 | 1635 | 'event_espresso' |
1636 | 1636 | ); |
1637 | 1637 | } |
1638 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1638 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1639 | 1639 | return FALSE; |
1640 | 1640 | break; |
1641 | 1641 | |
1642 | 1642 | // not enough payment |
1643 | 1643 | case EEM_Payment::status_id_declined : |
1644 | - if ( empty( $msg )) { |
|
1644 | + if (empty($msg)) { |
|
1645 | 1645 | $msg = _n( |
1646 | 1646 | 'We\'re sorry but your payment was declined. Please try again.', |
1647 | 1647 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1648 | - count( $this->checkout->available_payment_methods ), |
|
1648 | + count($this->checkout->available_payment_methods), |
|
1649 | 1649 | 'event_espresso' |
1650 | 1650 | ); |
1651 | 1651 | } |
1652 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1652 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1653 | 1653 | return FALSE; |
1654 | 1654 | break; |
1655 | 1655 | |
1656 | 1656 | // bad payment |
1657 | 1657 | case EEM_Payment::status_id_failed : |
1658 | - if ( ! empty( $msg ) ) { |
|
1659 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1658 | + if ( ! empty($msg)) { |
|
1659 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1660 | 1660 | return false; |
1661 | 1661 | } |
1662 | 1662 | // default to error below |
@@ -1666,14 +1666,14 @@ discard block |
||
1666 | 1666 | } |
1667 | 1667 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1668 | 1668 | // the payment processing is just running slower than the registrant's request |
1669 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1669 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1670 | 1670 | return true; |
1671 | 1671 | } |
1672 | 1672 | EE_Error::add_error( |
1673 | 1673 | sprintf( |
1674 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1674 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1675 | 1675 | '<br/>', |
1676 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1676 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1677 | 1677 | ), |
1678 | 1678 | __FILE__, __FUNCTION__, __LINE__ |
1679 | 1679 | ); |
@@ -1706,13 +1706,13 @@ discard block |
||
1706 | 1706 | public function process_gateway_response() { |
1707 | 1707 | $payment = null; |
1708 | 1708 | // how have they chosen to pay? |
1709 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1709 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1710 | 1710 | // get EE_Payment_Method object |
1711 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1711 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1712 | 1712 | $this->checkout->continue_reg = false; |
1713 | 1713 | return false; |
1714 | 1714 | } |
1715 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1715 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1716 | 1716 | return false; |
1717 | 1717 | } |
1718 | 1718 | $this->_validate_offsite_return(); |
@@ -1726,23 +1726,23 @@ discard block |
||
1726 | 1726 | // true |
1727 | 1727 | //); |
1728 | 1728 | // verify TXN |
1729 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1729 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1730 | 1730 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1731 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1731 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1732 | 1732 | $this->checkout->continue_reg = false; |
1733 | 1733 | return false; |
1734 | 1734 | } |
1735 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1736 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1737 | - $payment = $this->_validate_payment( $payment ); |
|
1735 | + $payment = $this->_process_off_site_payment($gateway); |
|
1736 | + $payment = $this->_process_cancelled_payments($payment); |
|
1737 | + $payment = $this->_validate_payment($payment); |
|
1738 | 1738 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1739 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1739 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1740 | 1740 | //$this->_setup_redirect_for_next_step(); |
1741 | 1741 | // store that for later |
1742 | 1742 | $this->checkout->payment = $payment; |
1743 | 1743 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1744 | 1744 | // because we will complete this step during the IPN processing then |
1745 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1745 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1746 | 1746 | $this->set_completed(); |
1747 | 1747 | } |
1748 | 1748 | return true; |
@@ -1765,19 +1765,19 @@ discard block |
||
1765 | 1765 | * @return bool |
1766 | 1766 | */ |
1767 | 1767 | private function _validate_offsite_return() { |
1768 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1769 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1768 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1769 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1770 | 1770 | // Houston... we might have a problem |
1771 | 1771 | $invalid_TXN = false; |
1772 | 1772 | // first gather some info |
1773 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1773 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1774 | 1774 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1775 | 1775 | // let's start by retrieving the cart for this TXN |
1776 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1777 | - if ( $cart instanceof EE_Cart ) { |
|
1776 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1777 | + if ($cart instanceof EE_Cart) { |
|
1778 | 1778 | // verify that the current cart has tickets |
1779 | 1779 | $tickets = $cart->get_tickets(); |
1780 | - if ( empty( $tickets ) ) { |
|
1780 | + if (empty($tickets)) { |
|
1781 | 1781 | $invalid_TXN = true; |
1782 | 1782 | } |
1783 | 1783 | } else { |
@@ -1785,39 +1785,39 @@ discard block |
||
1785 | 1785 | } |
1786 | 1786 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1787 | 1787 | // validate current Session ID and compare against valid TXN session ID |
1788 | - if ( EE_Session::instance()->id() === null ) { |
|
1788 | + if (EE_Session::instance()->id() === null) { |
|
1789 | 1789 | $invalid_TXN = true; |
1790 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1790 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1791 | 1791 | // WARNING !!! |
1792 | 1792 | // this could be PayPal sending back duplicate requests (ya they do that) |
1793 | 1793 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1794 | 1794 | // so now we need to determine if this current TXN looks valid or not |
1795 | 1795 | /** @type EE_Transaction_Processor $transaction_processor */ |
1796 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1796 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1797 | 1797 | // has this step even been started ? |
1798 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1798 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1799 | 1799 | ) { |
1800 | 1800 | // really? you're half way through this reg step, but you never started it ? |
1801 | 1801 | $invalid_TXN = true; |
1802 | 1802 | } |
1803 | 1803 | } |
1804 | - if ( $invalid_TXN ) { |
|
1804 | + if ($invalid_TXN) { |
|
1805 | 1805 | // is the valid TXN completed ? |
1806 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1806 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1807 | 1807 | /** @type EE_Transaction_Processor $transaction_processor */ |
1808 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1808 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1809 | 1809 | // has this step even been started ? |
1810 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1811 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1810 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1811 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1812 | 1812 | // so it **looks** like this is a double request from PayPal |
1813 | 1813 | // so let's try to pick up where we left off |
1814 | 1814 | $this->checkout->transaction = $valid_TXN; |
1815 | - $this->checkout->refresh_all_entities( true ); |
|
1815 | + $this->checkout->refresh_all_entities(true); |
|
1816 | 1816 | return; |
1817 | 1817 | } |
1818 | 1818 | } |
1819 | 1819 | // you appear to be lost? |
1820 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1820 | + $this->_redirect_wayward_request($primary_registrant); |
|
1821 | 1821 | } |
1822 | 1822 | } |
1823 | 1823 | } |
@@ -1831,16 +1831,16 @@ discard block |
||
1831 | 1831 | * @param \EE_Registration $primary_registrant |
1832 | 1832 | * @return bool |
1833 | 1833 | */ |
1834 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1835 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1834 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1835 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1836 | 1836 | // try redirecting based on the current TXN |
1837 | 1837 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1838 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1838 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1839 | 1839 | EE_Error::add_error( |
1840 | 1840 | sprintf( |
1841 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1841 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1842 | 1842 | '<br/>', |
1843 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1843 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1844 | 1844 | ), |
1845 | 1845 | __FILE__, __FUNCTION__, __LINE__ |
1846 | 1846 | ); |
@@ -1868,16 +1868,16 @@ discard block |
||
1868 | 1868 | * @param \EE_Offsite_Gateway $gateway |
1869 | 1869 | * @return \EE_Payment |
1870 | 1870 | */ |
1871 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1871 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1872 | 1872 | try { |
1873 | 1873 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1874 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1874 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1875 | 1875 | $payment = $this->checkout->transaction->last_payment(); |
1876 | 1876 | //$payment_source = 'last_payment'; |
1877 | 1877 | } else { |
1878 | 1878 | // get payment details and process results |
1879 | 1879 | /** @type EE_Payment_Processor $payment_processor */ |
1880 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1880 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1881 | 1881 | $payment = $payment_processor->process_ipn( |
1882 | 1882 | $_REQUEST, |
1883 | 1883 | $this->checkout->transaction, |
@@ -1887,14 +1887,14 @@ discard block |
||
1887 | 1887 | ); |
1888 | 1888 | //$payment_source = 'process_ipn'; |
1889 | 1889 | } |
1890 | - } catch ( Exception $e ) { |
|
1890 | + } catch (Exception $e) { |
|
1891 | 1891 | // let's just eat the exception and try to move on using any previously set payment info |
1892 | 1892 | $payment = $this->checkout->transaction->last_payment(); |
1893 | 1893 | //$payment_source = 'last_payment after Exception'; |
1894 | 1894 | // but if we STILL don't have a payment object |
1895 | - if ( ! $payment instanceof EE_Payment ) { |
|
1895 | + if ( ! $payment instanceof EE_Payment) { |
|
1896 | 1896 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1897 | - $this->_handle_payment_processor_exception( $e ); |
|
1897 | + $this->_handle_payment_processor_exception($e); |
|
1898 | 1898 | } |
1899 | 1899 | } |
1900 | 1900 | // DEBUG LOG |
@@ -1918,13 +1918,13 @@ discard block |
||
1918 | 1918 | * @param EE_Payment $payment |
1919 | 1919 | * @return EE_Payment | FALSE |
1920 | 1920 | */ |
1921 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
1921 | + private function _process_cancelled_payments($payment = NULL) { |
|
1922 | 1922 | if ( |
1923 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
1923 | + isset($_REQUEST['ee_cancel_payment']) |
|
1924 | 1924 | && $payment instanceof EE_Payment |
1925 | 1925 | && $payment->status() == EEM_Payment::status_id_failed |
1926 | 1926 | ) { |
1927 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
1927 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
1928 | 1928 | } |
1929 | 1929 | return $payment; |
1930 | 1930 | } |
@@ -1941,23 +1941,23 @@ discard block |
||
1941 | 1941 | public function get_transaction_details_for_gateways() { |
1942 | 1942 | $txn_details = array(); |
1943 | 1943 | // ya gotta make a choice man |
1944 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1944 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1945 | 1945 | $txn_details = array( |
1946 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1946 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1947 | 1947 | ); |
1948 | 1948 | } |
1949 | 1949 | // get EE_Payment_Method object |
1950 | 1950 | if ( |
1951 | - empty( $txn_details ) && |
|
1951 | + empty($txn_details) && |
|
1952 | 1952 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
1953 | 1953 | ) { |
1954 | 1954 | $txn_details = array( |
1955 | 1955 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
1956 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
1956 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
1957 | 1957 | ); |
1958 | 1958 | } |
1959 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
1960 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
1959 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
1960 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
1961 | 1961 | $txn_details = array( |
1962 | 1962 | 'TXN_ID' => $this->checkout->transaction->ID(), |
1963 | 1963 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -1968,7 +1968,7 @@ discard block |
||
1968 | 1968 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
1969 | 1969 | 'payment_amount' => $this->checkout->amount_owing, |
1970 | 1970 | 'return_url' => $return_url, |
1971 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
1971 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
1972 | 1972 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
1973 | 1973 | array( |
1974 | 1974 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | ) |
1978 | 1978 | ); |
1979 | 1979 | } |
1980 | - echo json_encode( $txn_details ); |
|
1980 | + echo json_encode($txn_details); |
|
1981 | 1981 | exit(); |
1982 | 1982 | } |
1983 | 1983 |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,19 +169,19 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | 177 | EE_Registry::instance()->load_helper('Template'); |
178 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
179 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
178 | + $template_args['notices'] = EEH_Template::display_template( |
|
179 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
180 | 180 | array(), |
181 | 181 | true |
182 | 182 | ); |
183 | 183 | EEH_Template::display_template( |
184 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
184 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
185 | 185 | $template_args |
186 | 186 | ); |
187 | 187 | exit; |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return string The new html string for the permalink area. |
202 | 202 | */ |
203 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
203 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
204 | 204 | //make sure this is ONLY when editing and the event id has been set. |
205 | - if ( ! empty( $id ) ) { |
|
206 | - $post = get_post( $id ); |
|
205 | + if ( ! empty($id)) { |
|
206 | + $post = get_post($id); |
|
207 | 207 | |
208 | 208 | //if NOT event then let's get out. |
209 | - if ( $post->post_type !== 'espresso_events' ) { |
|
209 | + if ($post->post_type !== 'espresso_events') { |
|
210 | 210 | return $permalink_string; |
211 | 211 | } |
212 | 212 | |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | |
215 | - $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' . __('Embed', 'event_espresso') . '</a> '; |
|
215 | + $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">'.__('Embed', 'event_espresso').'</a> '; |
|
216 | 216 | $permalink_string .= ' |
217 | 217 | <div id="js-ts-iframe" style="display:none"> |
218 | 218 | <div style="width:100%; height: 500px;"> |
219 | - <iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe> |
|
219 | + <iframe src="' . $ticket_selector_url.'" width="100%" height="100%"></iframe> |
|
220 | 220 | </div> |
221 | 221 | </div>'; |
222 | 222 | } |
@@ -235,22 +235,22 @@ discard block |
||
235 | 235 | * @param mixed $event |
236 | 236 | * @return bool |
237 | 237 | */ |
238 | - protected static function set_event( $event = null ) { |
|
239 | - if( $event === null ) { |
|
238 | + protected static function set_event($event = null) { |
|
239 | + if ($event === null) { |
|
240 | 240 | global $post; |
241 | 241 | $event = $post; |
242 | 242 | } |
243 | - if ( $event instanceof EE_Event ) { |
|
243 | + if ($event instanceof EE_Event) { |
|
244 | 244 | self::$_event = $event; |
245 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
245 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
246 | 246 | self::$_event = $event->EE_Event; |
247 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
248 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
247 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
248 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
249 | 249 | self::$_event = $event->EE_Event; |
250 | 250 | } else { |
251 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
252 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
253 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
251 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
252 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
253 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
254 | 254 | return false; |
255 | 255 | } |
256 | 256 | return true; |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * @param bool $view_details |
270 | 270 | * @return string |
271 | 271 | */ |
272 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
272 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
273 | 273 | // reset filter for displaying submit button |
274 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
274 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
275 | 275 | // poke and prod incoming event till it tells us what it is |
276 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
276 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
277 | 277 | return false; |
278 | 278 | } |
279 | 279 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | && ( |
285 | 285 | ! self::$_event->display_ticket_selector() |
286 | 286 | || $view_details |
287 | - || post_password_required( $event_post ) |
|
287 | + || post_password_required($event_post) |
|
288 | 288 | || ( |
289 | 289 | $_event_active_status != EE_Datetime::active |
290 | 290 | && $_event_active_status != EE_Datetime::upcoming |
@@ -302,70 +302,70 @@ discard block |
||
302 | 302 | $template_args = array(); |
303 | 303 | $template_args['event_status'] = $_event_active_status; |
304 | 304 | |
305 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
306 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
305 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
306 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
307 | 307 | |
308 | 308 | $template_args['EVT_ID'] = self::$_event->ID(); |
309 | 309 | $template_args['event'] = self::$_event; |
310 | 310 | |
311 | 311 | // is the event expired ? |
312 | 312 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
313 | - if ( $template_args['event_is_expired'] ) { |
|
314 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
313 | + if ($template_args['event_is_expired']) { |
|
314 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | $ticket_query_args = array( |
318 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
319 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
318 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
319 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
320 | 320 | ); |
321 | 321 | |
322 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
322 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
323 | 323 | //use the correct applicable time query depending on what version of core is being run. |
324 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
325 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
324 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
325 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | // get all tickets for this event ordered by the datetime |
329 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
329 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
330 | 330 | |
331 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
332 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
331 | + if (count($template_args['tickets']) < 1) { |
|
332 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
336 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
337 | - if ( $template_args['max_atndz'] < 1 ) { |
|
338 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
339 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
340 | - $sales_closed_msg .= sprintf( |
|
341 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
336 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
337 | + if ($template_args['max_atndz'] < 1) { |
|
338 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
339 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
340 | + $sales_closed_msg .= sprintf( |
|
341 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
342 | 342 | '<div class="ee-attention" style="text-align: left;"><b>', |
343 | 343 | '</b><br />', |
344 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
344 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
345 | 345 | '</a></span></div>' |
346 | 346 | ); |
347 | 347 | } |
348 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
348 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
349 | 349 | } |
350 | 350 | |
351 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
352 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
351 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
352 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
353 | 353 | |
354 | 354 | // redirecting to another site for registration ?? |
355 | 355 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
356 | 356 | // set up the form (but not for the admin) |
357 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
357 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
358 | 358 | // if not redirecting to another site for registration |
359 | - if ( ! $external_url ) { |
|
360 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
361 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
359 | + if ( ! $external_url) { |
|
360 | + EE_Registry::instance()->load_helper('Template'); |
|
361 | + EE_Registry::instance()->load_helper('URL'); |
|
362 | 362 | // then display the ticket selector |
363 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
363 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
364 | 364 | } else { |
365 | 365 | // if not we still need to trigger the display of the submit button |
366 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
366 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
367 | 367 | //display notice to admin that registration is external |
368 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
368 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
369 | 369 | } |
370 | 370 | // submit button and form close tag |
371 | 371 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -385,27 +385,27 @@ discard block |
||
385 | 385 | * @param string $external_url |
386 | 386 | * @return string |
387 | 387 | */ |
388 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
388 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
389 | 389 | // if redirecting, we don't need any anything else |
390 | - if ( $external_url ) { |
|
391 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
392 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
393 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
394 | - foreach ( $query_args as $query_arg => $value ) { |
|
395 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
390 | + if ($external_url) { |
|
391 | + EE_Registry::instance()->load_helper('URL'); |
|
392 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
393 | + $query_args = EEH_URL::get_query_string($external_url); |
|
394 | + foreach ($query_args as $query_arg => $value) { |
|
395 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
396 | 396 | } |
397 | 397 | return $html; |
398 | 398 | } |
399 | - EE_Registry::instance()->load_helper( 'Event_View' ); |
|
400 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
401 | - if ( ! $checkout_url ) { |
|
402 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
399 | + EE_Registry::instance()->load_helper('Event_View'); |
|
400 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
401 | + if ( ! $checkout_url) { |
|
402 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
403 | 403 | } |
404 | 404 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
405 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
406 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
405 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
406 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
407 | 407 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
408 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
408 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
409 | 409 | return $html; |
410 | 410 | } |
411 | 411 | |
@@ -420,23 +420,23 @@ discard block |
||
420 | 420 | * @return string |
421 | 421 | */ |
422 | 422 | public static function display_ticket_selector_submit() { |
423 | - if ( ! is_admin() ) { |
|
424 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
423 | + if ( ! is_admin()) { |
|
424 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
425 | 425 | $btn_text = apply_filters( |
426 | 426 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
427 | - __('Register Now', 'event_espresso' ), |
|
427 | + __('Register Now', 'event_espresso'), |
|
428 | 428 | self::$_event |
429 | 429 | ); |
430 | 430 | $external_url = self::$_event->external_url(); |
431 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
431 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
432 | 432 | $html .= ' class="ticket-selector-submit-btn '; |
433 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
434 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
435 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
433 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
434 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
435 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
436 | 436 | $html .= '<div class="clear"><br/></div></form>'; |
437 | 437 | return $html; |
438 | - } else if ( is_archive() ) { |
|
439 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
438 | + } else if (is_archive()) { |
|
439 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | return ''; |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | * @return string |
469 | 469 | */ |
470 | 470 | public static function display_view_details_btn() { |
471 | - if ( ! self::$_event->get_permalink() ) { |
|
472 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
471 | + if ( ! self::$_event->get_permalink()) { |
|
472 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
473 | 473 | } |
474 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
475 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
476 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
477 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
474 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
475 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
476 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
477 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
478 | 478 | $view_details_btn .= '<div class="clear"><br/></div>'; |
479 | 479 | $view_details_btn .= '</form>'; |
480 | 480 | return $view_details_btn; |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @return array or FALSE |
494 | 494 | */ |
495 | 495 | public function process_ticket_selections() { |
496 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
496 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
497 | 497 | // check nonce |
498 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
498 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
499 | 499 | EE_Error::add_error( |
500 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
500 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
501 | 501 | __FILE__, __FUNCTION__, __LINE__ |
502 | 502 | ); |
503 | 503 | return FALSE; |
@@ -511,16 +511,16 @@ discard block |
||
511 | 511 | |
512 | 512 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
513 | 513 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
514 | - EE_Registry::instance()->load_core( 'Session' ); |
|
514 | + EE_Registry::instance()->load_core('Session'); |
|
515 | 515 | // unless otherwise requested, clear the session |
516 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
517 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
516 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
517 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
518 | 518 | } |
519 | 519 | //d( EE_Registry::instance()->SSN ); |
520 | 520 | |
521 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
521 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
522 | 522 | // do we have an event id? |
523 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
523 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
524 | 524 | // validate/sanitize data |
525 | 525 | $valid = self::_validate_post_data(); |
526 | 526 | |
@@ -530,43 +530,43 @@ discard block |
||
530 | 530 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
531 | 531 | |
532 | 532 | //check total tickets ordered vs max number of attendees that can register |
533 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
533 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
534 | 534 | |
535 | 535 | // ordering too many tickets !!! |
536 | 536 | $singular = 'You have attempted to purchase %s ticket.'; |
537 | 537 | $plural = 'You have attempted to purchase %s tickets.'; |
538 | - $limit_error_1 = sprintf( _n( $singular, $plural, $valid['total_tickets'], 'event_espresso' ), $valid['total_tickets'], $valid['total_tickets'] ); |
|
538 | + $limit_error_1 = sprintf(_n($singular, $plural, $valid['total_tickets'], 'event_espresso'), $valid['total_tickets'], $valid['total_tickets']); |
|
539 | 539 | // dev only message |
540 | 540 | $singular = 'The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
541 | 541 | $plural = 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.'; |
542 | - $limit_error_2 = sprintf( _n( $singular, $plural, $valid['max_atndz'], 'event_espresso' ), $valid['max_atndz'], $valid['max_atndz'] ); |
|
543 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
542 | + $limit_error_2 = sprintf(_n($singular, $plural, $valid['max_atndz'], 'event_espresso'), $valid['max_atndz'], $valid['max_atndz']); |
|
543 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
544 | 544 | } else { |
545 | 545 | |
546 | 546 | // all data appears to be valid |
547 | 547 | $tckts_slctd = FALSE; |
548 | 548 | $success = TRUE; |
549 | 549 | // load cart |
550 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
550 | + EE_Registry::instance()->load_core('Cart'); |
|
551 | 551 | |
552 | 552 | // cycle thru the number of data rows sent from the event listing |
553 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
553 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
554 | 554 | // does this row actually contain a ticket quantity? |
555 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
555 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
556 | 556 | // YES we have a ticket quantity |
557 | 557 | $tckts_slctd = TRUE; |
558 | 558 | // d( $valid['ticket_obj'][$x] ); |
559 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
559 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
560 | 560 | // then add ticket to cart |
561 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
561 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
562 | 562 | $success = ! $ticket_added ? FALSE : $success; |
563 | - if ( EE_Error::has_error() ) { |
|
563 | + if (EE_Error::has_error()) { |
|
564 | 564 | break; |
565 | 565 | } |
566 | 566 | } else { |
567 | 567 | // nothing added to cart retrieved |
568 | 568 | EE_Error::add_error( |
569 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
569 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
570 | 570 | __FILE__, __FUNCTION__, __LINE__ |
571 | 571 | ); |
572 | 572 | } |
@@ -575,45 +575,45 @@ discard block |
||
575 | 575 | //d( EE_Registry::instance()->CART ); |
576 | 576 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
577 | 577 | |
578 | - if ( $tckts_slctd ) { |
|
579 | - if ( $success ) { |
|
580 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
578 | + if ($tckts_slctd) { |
|
579 | + if ($success) { |
|
580 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
581 | 581 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
582 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
582 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
583 | 583 | EE_Registry::instance()->SSN->update(); |
584 | 584 | //d( EE_Registry::instance()->CART ); |
585 | 585 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
586 | 586 | // just return TRUE for registrations being made from admin |
587 | - if ( is_admin() ) { |
|
587 | + if (is_admin()) { |
|
588 | 588 | return TRUE; |
589 | 589 | } |
590 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
590 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
591 | 591 | exit(); |
592 | 592 | |
593 | 593 | } else { |
594 | - if ( ! EE_Error::has_error() ) { |
|
594 | + if ( ! EE_Error::has_error()) { |
|
595 | 595 | // nothing added to cart |
596 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
596 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | |
600 | 600 | } else { |
601 | 601 | // no ticket quantities were selected |
602 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
606 | 606 | // at this point, just return if registration is being made from admin |
607 | - if ( is_admin() ) { |
|
607 | + if (is_admin()) { |
|
608 | 608 | return FALSE; |
609 | 609 | } |
610 | - if ( $valid['return_url'] ) { |
|
611 | - EE_Error::get_notices( FALSE, TRUE ); |
|
612 | - wp_safe_redirect( $valid['return_url'] ); |
|
610 | + if ($valid['return_url']) { |
|
611 | + EE_Error::get_notices(FALSE, TRUE); |
|
612 | + wp_safe_redirect($valid['return_url']); |
|
613 | 613 | exit(); |
614 | - } elseif ( isset( $event_to_add['id'] )) { |
|
615 | - EE_Error::get_notices( FALSE, TRUE ); |
|
616 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
614 | + } elseif (isset($event_to_add['id'])) { |
|
615 | + EE_Error::get_notices(FALSE, TRUE); |
|
616 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
617 | 617 | exit(); |
618 | 618 | } else { |
619 | 619 | echo EE_Error::get_notices(); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | } else { |
623 | 623 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
624 | 624 | EE_Error::add_error( |
625 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
625 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
626 | 626 | __FILE__, __FUNCTION__, __LINE__ |
627 | 627 | ); |
628 | 628 | } |
@@ -640,18 +640,18 @@ discard block |
||
640 | 640 | * @return array or FALSE |
641 | 641 | */ |
642 | 642 | private static function _validate_post_data() { |
643 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
643 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
644 | 644 | |
645 | 645 | // start with an empty array() |
646 | 646 | $valid_data = array(); |
647 | 647 | // d( $_POST ); |
648 | 648 | //if event id is valid |
649 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
650 | - if ( $id ) { |
|
649 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
650 | + if ($id) { |
|
651 | 651 | // grab valid id |
652 | 652 | $valid_data['id'] = $id; |
653 | 653 | // grab and sanitize return-url |
654 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
654 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
655 | 655 | // array of other form names |
656 | 656 | $inputs_to_clean = array( |
657 | 657 | 'event_id' => 'tkt-slctr-event-id', |
@@ -664,22 +664,22 @@ discard block |
||
664 | 664 | // let's track the total number of tickets ordered.' |
665 | 665 | $valid_data['total_tickets'] = 0; |
666 | 666 | // cycle through $inputs_to_clean array |
667 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
667 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
668 | 668 | // check for POST data |
669 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
669 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
670 | 670 | // grab value |
671 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
671 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
672 | 672 | switch ($what) { |
673 | 673 | |
674 | 674 | // integers |
675 | 675 | case 'event_id': |
676 | - $valid_data[$what] = absint( $input_value ); |
|
676 | + $valid_data[$what] = absint($input_value); |
|
677 | 677 | // get event via the event id we put in the form |
678 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
678 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
679 | 679 | break; |
680 | 680 | case 'rows': |
681 | 681 | case 'max_atndz': |
682 | - $valid_data[$what] = absint( $input_value ); |
|
682 | + $valid_data[$what] = absint($input_value); |
|
683 | 683 | break; |
684 | 684 | |
685 | 685 | // arrays of integers |
@@ -687,27 +687,27 @@ discard block |
||
687 | 687 | // d( $input_value ); |
688 | 688 | $row_qty = $input_value; |
689 | 689 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
690 | - if( ! is_array( $row_qty )) { |
|
690 | + if ( ! is_array($row_qty)) { |
|
691 | 691 | // get number of rows |
692 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
692 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
693 | 693 | // d( $rows ); |
694 | 694 | // explode ints by the dash |
695 | - $row_qty = explode( '-', $row_qty ); |
|
696 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
697 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
698 | - $row_qty = array( $row => $qty ); |
|
695 | + $row_qty = explode('-', $row_qty); |
|
696 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
697 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
698 | + $row_qty = array($row => $qty); |
|
699 | 699 | // d( $row_qty ); |
700 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
701 | - if ( ! isset( $row_qty[$x] )) { |
|
700 | + for ($x = 1; $x <= $rows; $x++) { |
|
701 | + if ( ! isset($row_qty[$x])) { |
|
702 | 702 | $row_qty[$x] = 0; |
703 | 703 | } |
704 | 704 | } |
705 | 705 | } |
706 | - ksort( $row_qty ); |
|
706 | + ksort($row_qty); |
|
707 | 707 | // d( $row_qty ); |
708 | 708 | // cycle thru values |
709 | - foreach ( $row_qty as $qty ) { |
|
710 | - $qty = absint( $qty ); |
|
709 | + foreach ($row_qty as $qty) { |
|
710 | + $qty = absint($qty); |
|
711 | 711 | // sanitize as integers |
712 | 712 | $valid_data[$what][] = $qty; |
713 | 713 | $valid_data['total_tickets'] += $qty; |
@@ -718,19 +718,19 @@ discard block |
||
718 | 718 | case 'ticket_id': |
719 | 719 | $value_array = array(); |
720 | 720 | // cycle thru values |
721 | - foreach ( $input_value as $key=>$value ) { |
|
721 | + foreach ($input_value as $key=>$value) { |
|
722 | 722 | // allow only numbers, letters, spaces, commas and dashes |
723 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
723 | + $value_array[$key] = wp_strip_all_tags($value); |
|
724 | 724 | // get ticket via the ticket id we put in the form |
725 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
726 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
725 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
726 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
727 | 727 | } |
728 | - $valid_data[ $what ] = $value_array; |
|
728 | + $valid_data[$what] = $value_array; |
|
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'return_url' : |
732 | 732 | // grab and sanitize return-url |
733 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
733 | + $valid_data[$what] = esc_url_raw($input_value); |
|
734 | 734 | break; |
735 | 735 | |
736 | 736 | } // end switch $what |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | } // end foreach $inputs_to_clean |
739 | 739 | |
740 | 740 | } else { |
741 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
741 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
742 | 742 | return FALSE; |
743 | 743 | } |
744 | 744 | |
@@ -756,28 +756,28 @@ discard block |
||
756 | 756 | * @param int $qty |
757 | 757 | * @return TRUE on success, FALSE on fail |
758 | 758 | */ |
759 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
760 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
759 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
760 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
761 | 761 | // get the number of spaces left for this datetime ticket |
762 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
762 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
763 | 763 | // compare available spaces against the number of tickets being purchased |
764 | - if ( $available_spaces >= $qty ) { |
|
764 | + if ($available_spaces >= $qty) { |
|
765 | 765 | // allow addons to prevent a ticket from being added to cart |
766 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
766 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
767 | 767 | return false; |
768 | 768 | } |
769 | 769 | // add event to cart |
770 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
771 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
770 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
771 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
772 | 772 | return true; |
773 | 773 | } else { |
774 | 774 | return false; |
775 | 775 | } |
776 | 776 | } else { |
777 | 777 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
778 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
778 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
779 | 779 | // greedy greedy greedy eh? |
780 | - if ( $available_spaces > 0 ) { |
|
780 | + if ($available_spaces > 0) { |
|
781 | 781 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
782 | 782 | EE_Error::add_error( |
783 | 783 | sprintf( |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | __FILE__, __FUNCTION__, __LINE__ |
794 | 794 | ); |
795 | 795 | } else { |
796 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
796 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
797 | 797 | } |
798 | 798 | return false; |
799 | 799 | } |
@@ -811,22 +811,22 @@ discard block |
||
811 | 811 | * @param bool $get_original_ticket_spaces |
812 | 812 | * @return int |
813 | 813 | */ |
814 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
814 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
815 | 815 | // if the $_available_spaces array has not been set up yet... |
816 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
817 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
816 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
817 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
818 | 818 | } |
819 | 819 | $available_spaces = $ticket->qty() - $ticket->sold(); |
820 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
820 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
821 | 821 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
822 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
822 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
823 | 823 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
824 | - if ( $get_original_ticket_spaces ) { |
|
824 | + if ($get_original_ticket_spaces) { |
|
825 | 825 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
826 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
826 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
827 | 827 | } else { |
828 | 828 | // we want the updated ticket availability as stored in the "datetimes" array |
829 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
829 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
830 | 830 | } |
831 | 831 | } |
832 | 832 | } |
@@ -842,23 +842,23 @@ discard block |
||
842 | 842 | * @param EE_Ticket $ticket |
843 | 843 | * @return int |
844 | 844 | */ |
845 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
845 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
846 | 846 | // first, get all of the datetimes that are available to this ticket |
847 | 847 | $datetimes = $ticket->get_many_related( |
848 | 848 | 'Datetime', |
849 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
849 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
850 | 850 | ); |
851 | - if ( ! empty( $datetimes )) { |
|
851 | + if ( ! empty($datetimes)) { |
|
852 | 852 | // now loop thru all of the datetimes |
853 | - foreach ( $datetimes as $datetime ) { |
|
854 | - if ( $datetime instanceof EE_Datetime ) { |
|
853 | + foreach ($datetimes as $datetime) { |
|
854 | + if ($datetime instanceof EE_Datetime) { |
|
855 | 855 | // the number of spaces available for the datetime without considering individual ticket quantities |
856 | 856 | $spaces_remaining = $datetime->spaces_remaining(); |
857 | 857 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
858 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
858 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
859 | 859 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
860 | 860 | // else just take the datetime spaces remaining, and assign to the datetimes array |
861 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
861 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | } |
@@ -874,12 +874,12 @@ discard block |
||
874 | 874 | * @param int $qty |
875 | 875 | * @return int |
876 | 876 | */ |
877 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
878 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
877 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
878 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
879 | 879 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
880 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
880 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
881 | 881 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
882 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
882 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
883 | 883 | } |
884 | 884 | } |
885 | 885 | } |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | */ |
897 | 897 | public static function load_tckt_slctr_assets() { |
898 | 898 | // add some style |
899 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
900 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
899 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
900 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
901 | 901 | wp_enqueue_style('ticket_selector'); |
902 | 902 | // make it dance |
903 | 903 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -911,9 +911,9 @@ discard block |
||
911 | 911 | |
912 | 912 | public static function load_tckt_slctr_assets_admin() { |
913 | 913 | //iframe button js on admin event editor page |
914 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
915 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
916 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
914 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
915 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
916 | + wp_enqueue_script('ticket_selector_embed'); |
|
917 | 917 | } |
918 | 918 | } |
919 | 919 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="admin-primary-mbox-dv" class="admin-primary-mbox-dv"> |
2 | 2 | |
3 | 3 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
4 | - <span class="dashicons dashicons-cart"></span><?php _e( 'Transaction Items', 'event_espresso' );?> |
|
4 | + <span class="dashicons dashicons-cart"></span><?php _e('Transaction Items', 'event_espresso'); ?> |
|
5 | 5 | </h3> |
6 | 6 | |
7 | 7 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -10,27 +10,27 @@ discard block |
||
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <a id="display-additional-transaction-session-info" class="display-the-hidden smaller-text" rel="additional-transaction-session-info"> |
13 | - <span class="dashicons dashicons-plus-alt"></span><?php _e( 'view additional transaction session details', 'event_espresso' );?> |
|
13 | + <span class="dashicons dashicons-plus-alt"></span><?php _e('view additional transaction session details', 'event_espresso'); ?> |
|
14 | 14 | </a> |
15 | 15 | |
16 | 16 | <div id="additional-transaction-session-info-dv" class="hidden"> |
17 | 17 | |
18 | 18 | <a id="hide-additional-transaction-session-info" class="hide-the-displayed hidden smaller-text" rel="additional-transaction-session-info"> |
19 | - <span class="dashicons dashicons-dismiss"></span><?php _e( 'hide additional transaction session details', 'event_espresso' );?> |
|
19 | + <span class="dashicons dashicons-dismiss"></span><?php _e('hide additional transaction session details', 'event_espresso'); ?> |
|
20 | 20 | </a> |
21 | 21 | <br class="clear"/> |
22 | 22 | |
23 | - <h3 class="admin-primary-mbox-h4"><?php _e( 'Transaction Session Details', 'event_espresso' );?></h3> |
|
23 | + <h3 class="admin-primary-mbox-h4"><?php _e('Transaction Session Details', 'event_espresso'); ?></h3> |
|
24 | 24 | |
25 | 25 | <table id="admin-primary-mbox-txn-extra-session-info-tbl" class="form-table skinny-rows"> |
26 | 26 | <tbody> |
27 | - <?php foreach ( $txn_details as $key => $txn_detail ) : ?> |
|
27 | + <?php foreach ($txn_details as $key => $txn_detail) : ?> |
|
28 | 28 | <tr> |
29 | 29 | <th> |
30 | - <label for="<?php echo $key;?>"><?php echo $txn_detail['label'];?></label> |
|
30 | + <label for="<?php echo $key; ?>"><?php echo $txn_detail['label']; ?></label> |
|
31 | 31 | </th> |
32 | 32 | <td> |
33 | - <?php echo $txn_detail['value'];?> |
|
33 | + <?php echo $txn_detail['value']; ?> |
|
34 | 34 | </td> |
35 | 35 | </tr> |
36 | 36 | <?php endforeach; // $txn_details?> |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <br class="clear"/> |
41 | 41 | |
42 | 42 | |
43 | - <?php if ( $attendee instanceof EE_Attendee && ( $grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty( $payments ) ) ) : ?> |
|
43 | + <?php if ($attendee instanceof EE_Attendee && ($grand_raw_total > 0 || $TXN_status != 'TCM' || ! empty($payments))) : ?> |
|
44 | 44 | |
45 | 45 | <h3 class="admin-primary-mbox-h4 hdr-has-icon"> |
46 | - <span class="ee-icon ee-icon-cash"></span><?php _e( 'Payment Details', 'event_espresso' );?> |
|
46 | + <span class="ee-icon ee-icon-cash"></span><?php _e('Payment Details', 'event_espresso'); ?> |
|
47 | 47 | </h3> |
48 | 48 | |
49 | 49 | <div class="admin-primary-mbox-tbl-wrap"> |
@@ -52,75 +52,75 @@ discard block |
||
52 | 52 | <tr> |
53 | 53 | <th></th> |
54 | 54 | <th class="jst-cntr"></th> |
55 | - <th class="jst-cntr"><?php _e( 'ID', 'event_espresso' );?></th> |
|
56 | - <th class="jst-left"><?php _e( 'Date', 'event_espresso' );?></th> |
|
57 | - <th class="jst-cntr"><?php _e( 'Source', 'event_espresso' );?></th> |
|
58 | - <th class="jst-left"><?php _e( 'Method', 'event_espresso' );?></th> |
|
59 | - <th class="jst-left"><?php _e( 'Gateway Response', 'event_espresso' );?></th> |
|
60 | - <th class="jst-left"><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></th> |
|
61 | - <th class="jst-left"><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></th> |
|
62 | - <th class="jst-left"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></th> |
|
63 | - <!--<th class="jst-left"><?php _e( 'Details', 'event_espresso' );?></th>--> |
|
64 | - <th class="jst-cntr"><?php _e( 'Amount', 'event_espresso' );?></th> |
|
55 | + <th class="jst-cntr"><?php _e('ID', 'event_espresso'); ?></th> |
|
56 | + <th class="jst-left"><?php _e('Date', 'event_espresso'); ?></th> |
|
57 | + <th class="jst-cntr"><?php _e('Source', 'event_espresso'); ?></th> |
|
58 | + <th class="jst-left"><?php _e('Method', 'event_espresso'); ?></th> |
|
59 | + <th class="jst-left"><?php _e('Gateway Response', 'event_espresso'); ?></th> |
|
60 | + <th class="jst-left"><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></th> |
|
61 | + <th class="jst-left"><?php _e('P.O. / S.O. #', 'event_espresso'); ?></th> |
|
62 | + <th class="jst-left"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></th> |
|
63 | + <!--<th class="jst-left"><?php _e('Details', 'event_espresso'); ?></th>--> |
|
64 | + <th class="jst-cntr"><?php _e('Amount', 'event_espresso'); ?></th> |
|
65 | 65 | </tr> |
66 | 66 | </thead> |
67 | 67 | <tbody> |
68 | - <?php if ( $payments ) : ?> |
|
68 | + <?php if ($payments) : ?> |
|
69 | 69 | <?php $payment_total = 0; ?> |
70 | - <?php foreach ( $payments as $PAY_ID => $payment ) : ?> |
|
71 | - <tr id="txn-admin-payment-tr-<?php echo $PAY_ID;?>"> |
|
70 | + <?php foreach ($payments as $PAY_ID => $payment) : ?> |
|
71 | + <tr id="txn-admin-payment-tr-<?php echo $PAY_ID; ?>"> |
|
72 | 72 | <td> |
73 | 73 | <span id="payment-status-<?php echo $PAY_ID; ?>" class="ee-status-strip-td ee-status-strip pymt-status-<?php echo $payment->STS_ID(); ?>"></span> |
74 | - <div id="payment-STS_ID-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->STS_ID();?></div> |
|
75 | - <div id="reg-payments-<?php echo $PAY_ID;?>" class="hidden"><?php echo json_encode( $existing_reg_payments[ $PAY_ID ] );?></div> |
|
74 | + <div id="payment-STS_ID-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->STS_ID(); ?></div> |
|
75 | + <div id="reg-payments-<?php echo $PAY_ID; ?>" class="hidden"><?php echo json_encode($existing_reg_payments[$PAY_ID]); ?></div> |
|
76 | 76 | </td> |
77 | 77 | <td class=" jst-cntr"> |
78 | 78 | <ul class="txn-overview-actions-ul"> |
79 | 79 | <li> |
80 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
80 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
81 | 81 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
82 | 82 | </a> |
83 | 83 | </li> |
84 | 84 | <li> |
85 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="<?php echo $PAY_ID;?>"> |
|
85 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="<?php echo $PAY_ID; ?>"> |
|
86 | 86 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
87 | 87 | </a> |
88 | 88 | </li> |
89 | 89 | </ul> |
90 | 90 | </td> |
91 | 91 | <td class=" jst-rght"> |
92 | - <div id="payment-id-<?php echo $PAY_ID;?>"><?php echo $PAY_ID;?></div> |
|
92 | + <div id="payment-id-<?php echo $PAY_ID; ?>"><?php echo $PAY_ID; ?></div> |
|
93 | 93 | </td> |
94 | 94 | <td class=" jst-left"> |
95 | - <div id="payment-date-<?php echo $PAY_ID;?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a');?></div> |
|
95 | + <div id="payment-date-<?php echo $PAY_ID; ?>" class="payment-date-dv"><?php echo $payment->timestamp('Y-m-d', 'g:i a'); ?></div> |
|
96 | 96 | </td> |
97 | 97 | <td class=" jst-cntr"> |
98 | - <div id="payment-method-<?php echo $PAY_ID;?>"> |
|
99 | - <?php echo $payment->source();?> |
|
98 | + <div id="payment-method-<?php echo $PAY_ID; ?>"> |
|
99 | + <?php echo $payment->source(); ?> |
|
100 | 100 | </div> |
101 | 101 | </td> |
102 | 102 | <td class=" jst-left"> |
103 | - <div id="payment-gateway-<?php echo $PAY_ID;?>"> |
|
104 | - <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso');?> |
|
103 | + <div id="payment-gateway-<?php echo $PAY_ID; ?>"> |
|
104 | + <?php echo $payment->payment_method() ? $payment->payment_method()->admin_name() : __("Unknown", 'event_espresso'); ?> |
|
105 | 105 | </div> |
106 | - <div id="payment-gateway-id-<?php echo $PAY_ID;?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0;?></div> |
|
106 | + <div id="payment-gateway-id-<?php echo $PAY_ID; ?>" class="hidden"><?php echo $payment->payment_method() ? $payment->payment_method()->ID() : 0; ?></div> |
|
107 | 107 | </td> |
108 | 108 | <td class=" jst-left"> |
109 | - <div id="payment-response-<?php echo $PAY_ID;?>"><?php echo $payment->gateway_response();?></div> |
|
109 | + <div id="payment-response-<?php echo $PAY_ID; ?>"><?php echo $payment->gateway_response(); ?></div> |
|
110 | 110 | </td> |
111 | 111 | <td class=" jst-left"> |
112 | - <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->txn_id_chq_nmbr();?></div> |
|
112 | + <div id="payment-txn-id-chq-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->txn_id_chq_nmbr(); ?></div> |
|
113 | 113 | </td> |
114 | 114 | <td class=" jst-left"> |
115 | - <div id="payment-po-nmbr-<?php echo $PAY_ID;?>"><?php echo $payment->po_number();?></div> |
|
115 | + <div id="payment-po-nmbr-<?php echo $PAY_ID; ?>"><?php echo $payment->po_number(); ?></div> |
|
116 | 116 | </td> |
117 | 117 | <td class=" jst-left"> |
118 | - <div id="payment-accntng-<?php echo $PAY_ID;?>"><?php echo $payment->extra_accntng();?></div> |
|
118 | + <div id="payment-accntng-<?php echo $PAY_ID; ?>"><?php echo $payment->extra_accntng(); ?></div> |
|
119 | 119 | </td> |
120 | 120 | <td class=" jst-rght"> |
121 | - <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-' . $payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | - <span class="<?php echo $payment_class;?>"> |
|
123 | - <div id="payment-amount-<?php echo $PAY_ID;?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE ); ?></div> |
|
121 | + <?php $payment_class = $payment->amount() > 0 ? 'txn-admin-payment-status-'.$payment->STS_ID() : 'txn-admin-payment-status-PDC'; ?> |
|
122 | + <span class="<?php echo $payment_class; ?>"> |
|
123 | + <div id="payment-amount-<?php echo $PAY_ID; ?>" style="display:inline;"><?php echo EEH_Template::format_currency($payment->amount(), FALSE, FALSE); ?></div> |
|
124 | 124 | </span> |
125 | 125 | </td> |
126 | 126 | </tr> |
@@ -130,25 +130,25 @@ discard block |
||
130 | 130 | <?php endforeach; // $payment?> |
131 | 131 | <?php |
132 | 132 | $pay_totals_class = $payment_total > $grand_raw_total ? ' important-notice' : ''; |
133 | - $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">' . __( 'This transaction has been overpaid ! ', 'event_espresso' ) . '</span>' : ''; |
|
133 | + $overpaid = $payment_total > $grand_raw_total ? '<span id="overpaid">'.__('This transaction has been overpaid ! ', 'event_espresso').'</span>' : ''; |
|
134 | 134 | ?> |
135 | 135 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr hidden"> |
136 | 136 | <td class=" jst-rght" colspan="11"> |
137 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
137 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
138 | 138 | </td> |
139 | 139 | </tr> |
140 | - <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class;?>"> |
|
141 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid . sprintf( __( 'Payments Total %s', 'event_espresso' ), '(' . EE_Registry::instance()->CFG->currency->code . ')' );?></span></th> |
|
142 | - <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE);?></span></th> |
|
140 | + <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr<?php echo $pay_totals_class; ?>"> |
|
141 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo $overpaid.sprintf(__('Payments Total %s', 'event_espresso'), '('.EE_Registry::instance()->CFG->currency->code.')'); ?></span></th> |
|
142 | + <th class=" jst-rght"><span id="txn-admin-payment-total"><?php echo EEH_Template::format_currency($payment_total, FALSE, FALSE); ?></span></th> |
|
143 | 143 | </tr> |
144 | 144 | <?php else : ?> |
145 | 145 | <tr id="txn-admin-no-payments-tr" class="admin-primary-mbox-total-tr"> |
146 | 146 | <td class=" jst-rght" colspan="11"> |
147 | - <span class="important-notice"><?php _e( 'No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso' ); ?></span> |
|
147 | + <span class="important-notice"><?php _e('No payments have been applied to this transaction yet. Click "Apply Payment" below to make a payment.', 'event_espresso'); ?></span> |
|
148 | 148 | </td> |
149 | 149 | </tr> |
150 | 150 | <tr id="txn-admin-payments-total-tr" class="admin-primary-mbox-total-tr hidden"> |
151 | - <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __( 'Payments Total', 'event_espresso' );?></span></th> |
|
151 | + <th class=" jst-rght" colspan="10"><span id="payments-total-spn"><?php echo __('Payments Total', 'event_espresso'); ?></span></th> |
|
152 | 152 | <th class=" jst-rght"><span id="txn-admin-payment-total"></span></th> |
153 | 153 | </tr> |
154 | 154 | <?php endif; // $payments?> |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | <td class=" jst-cntr"> |
162 | 162 | <ul class="txn-overview-actions-ul"> |
163 | 163 | <li> |
164 | - <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e( 'Edit Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
164 | + <a class="txn-admin-payment-action-edit-lnk" title="<?php esc_attr_e('Edit Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
165 | 165 | <div class="dashicons dashicons-edit" style="margin: 0;"></div> |
166 | 166 | </a> |
167 | 167 | </li> |
168 | 168 | <li> |
169 | - <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e( 'Delete Payment', 'event_espresso' );?>" data-payment-id="PAY_ID"> |
|
169 | + <a class="txn-admin-payment-action-delete-lnk" title="<?php esc_attr_e('Delete Payment', 'event_espresso'); ?>" data-payment-id="PAY_ID"> |
|
170 | 170 | <div class="dashicons dashicons-trash" style="margin: 0;"></div> |
171 | 171 | </a> |
172 | 172 | </li> |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | <ul id="txn-admin-payment-options-ul"> |
214 | 214 | <li> |
215 | 215 | <a id="display-txn-admin-apply-payment" class="button-primary no-icon no-hide" rel="txn-admin-apply-payment" > <!--display-the-hidden --> |
216 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
216 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
217 | 217 | </a> |
218 | 218 | </li> |
219 | 219 | <li> |
220 | 220 | <a id="display-txn-admin-apply-refund" class="button-secondary no-icon no-hide" rel="txn-admin-apply-refund" > <!--display-the-hidden --> |
221 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
221 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
222 | 222 | </a> |
223 | 223 | </li> |
224 | 224 | </ul> |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | |
229 | 229 | <h2 id="admin-modal-dialog-apply-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
230 | 230 | <div class="ee-icon ee-icon-cash-add float-left"></div> |
231 | - <?php echo __( 'Apply a Payment to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
231 | + <?php echo __('Apply a Payment to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
232 | 232 | </h2> |
233 | 233 | |
234 | 234 | <h2 id="admin-modal-dialog-edit-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
235 | 235 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
236 | 236 | <?php |
237 | 237 | echo sprintf( |
238 | - __( 'Edit Payment #%s for Transaction #%s', 'event_espresso' ), |
|
238 | + __('Edit Payment #%s for Transaction #%s', 'event_espresso'), |
|
239 | 239 | '<span></span>', |
240 | 240 | $txn_nmbr['value'] |
241 | 241 | ); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | <div class="ee-icon ee-icon-cash-edit float-left"></div> |
247 | 247 | <?php |
248 | 248 | echo sprintf( |
249 | - __( 'Edit Refund #%s for Transaction #%s', 'event_espresso' ), |
|
249 | + __('Edit Refund #%s for Transaction #%s', 'event_espresso'), |
|
250 | 250 | '<span></span>', |
251 | 251 | $txn_nmbr['value'] |
252 | 252 | ); |
@@ -255,14 +255,14 @@ discard block |
||
255 | 255 | |
256 | 256 | <h2 id="admin-modal-dialog-apply-refund-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
257 | 257 | <div class="ee-icon ee-icon-cash-remove float-left"></div> |
258 | - <?php echo __( 'Apply a Refund to Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
258 | + <?php echo __('Apply a Refund to Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
259 | 259 | </h2> |
260 | 260 | |
261 | 261 | <form name="txn-admin-apply-payment-frm" id="txn-admin-apply-payment-frm" action="<?php echo $apply_payment_form_url; ?>"> |
262 | 262 | <div class="admin-modal-dialog-wrap"> |
263 | 263 | <div class="admin-modal-dialog-inner"> |
264 | 264 | |
265 | - <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_apply_payment_nonce' );?>"/> |
|
265 | + <input type="hidden" name="espresso_apply_payment_nonce" id="espresso_apply_payment_nonce" value="<?php echo wp_create_nonce('espresso_apply_payment_nonce'); ?>"/> |
|
266 | 266 | <input type="hidden" name="espresso_ajax" id="espresso-ajax" value="0"/> |
267 | 267 | <input type="hidden" name="noheader" id="txn-admin-noheader-inp" value="0"/> |
268 | 268 | <input type="hidden" name="txn_admin_payment[PAY_ID]" id="txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
@@ -270,108 +270,108 @@ discard block |
||
270 | 270 | <input type="hidden" name="txn_admin_payment[type]" id="txn-admin-payment-type-inp" value="1"/> |
271 | 271 | <input type="hidden" name="txn_admin_payment[details]" id="txn-admin-payment-details-inp" value=""/> |
272 | 272 | <input type="hidden" name="txn_admin_delete_payment_form_url" id="txn-admin-delete-payment-form-url-inp" value="<?php echo $delete_payment_form_url; ?>"/> |
273 | - <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date( 'Y-m-d h:i a', current_time( 'timestamp' )); ?>"/> |
|
273 | + <input type="hidden" name="txn_admin_todays_date" id="txn-admin-todays-date-inp" value="<?php echo date('Y-m-d h:i a', current_time('timestamp')); ?>"/> |
|
274 | 274 | |
275 | 275 | <div class="txn-admin-apply-payment-date-dv admin-modal-dialog-row"> |
276 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
277 | - <label for="txn-admin-payment-date-inp" class=""><?php _e( 'Payment Date', 'event_espresso' );?></label> |
|
278 | - <input name="[date]txn_admin_payment" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date( 'Y-m-d g:i a', current_time( 'timestamp' )); ?>"/> |
|
279 | - <p class="description"><?php _e( 'The date the payment was actually made on', 'event_espresso' );?></p> |
|
276 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
277 | + <label for="txn-admin-payment-date-inp" class=""><?php _e('Payment Date', 'event_espresso'); ?></label> |
|
278 | + <input name="[date]txn_admin_payment" id="txn-admin-payment-date-inp" class="txn-admin-apply-payment-inp required" type="text" value="<?php echo date('Y-m-d g:i a', current_time('timestamp')); ?>"/> |
|
279 | + <p class="description"><?php _e('The date the payment was actually made on', 'event_espresso'); ?></p> |
|
280 | 280 | </div> |
281 | 281 | |
282 | 282 | <div class="txn-admin-apply-payment-amount-dv admin-modal-dialog-row"> |
283 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
284 | - <label for="txn-admin-payment-amount-inp" class=""><?php _e( 'Amount', 'event_espresso' );?></label> |
|
283 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
284 | + <label for="txn-admin-payment-amount-inp" class=""><?php _e('Amount', 'event_espresso'); ?></label> |
|
285 | 285 | <input name="txn_admin_payment[amount]" id="txn-admin-payment-amount-inp" class="txn-admin-apply-payment-inp required" type="text" value=""/> |
286 | - <p class="description"><?php _e( 'The amount of the payment', 'event_espresso' );?></p> |
|
286 | + <p class="description"><?php _e('The amount of the payment', 'event_espresso'); ?></p> |
|
287 | 287 | </div> |
288 | 288 | |
289 | 289 | <div class="txn-admin-apply-payment-method-dv admin-modal-dialog-row"> |
290 | - <div class="validation-notice-dv"><?php _e( 'The following is a required field', 'event_espresso' );?></div> |
|
291 | - <label for="txn-admin-payment-method-inp" class=""><?php _e( 'Method of Payment', 'event_espresso' );?></label> |
|
290 | + <div class="validation-notice-dv"><?php _e('The following is a required field', 'event_espresso'); ?></div> |
|
291 | + <label for="txn-admin-payment-method-inp" class=""><?php _e('Method of Payment', 'event_espresso'); ?></label> |
|
292 | 292 | <select name="txn_admin_payment[PMD_ID]" id="txn-admin-payment-method-slct" class="txn-admin-apply-payment-slct required" type="text" > |
293 | - <?php foreach ( $payment_methods as $method ) : ?> |
|
293 | + <?php foreach ($payment_methods as $method) : ?> |
|
294 | 294 | <?php $selected = $method->slug() == 'cash' ? ' selected="selected"' : ''; ?> |
295 | - <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key( $method->admin_desc() ) ? substr( $method->admin_desc(), 0, 128) : $method->admin_name() ; ?> </option> |
|
295 | + <option id="payment-method-opt-<?php echo $method->slug(); ?>" value="<?php echo $method->ID(); ?>"<?php echo $selected; ?>><?php echo sanitize_key($method->admin_desc()) ? substr($method->admin_desc(), 0, 128) : $method->admin_name(); ?> </option> |
|
296 | 296 | <?php endforeach; ?> |
297 | 297 | </select> |
298 | - <p class="description"><?php _e( 'Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso' );?></p> |
|
298 | + <p class="description"><?php _e('Whether the payment was made via PayPal, Credit Card, Cheque, or Cash', 'event_espresso'); ?></p> |
|
299 | 299 | </div> |
300 | 300 | |
301 | 301 | <div class="mop-PP mop-CC mop-CHQ mop"> |
302 | 302 | <div class="txn-admin-apply-payment-gw-txn-id-dv admin-modal-dialog-row"> |
303 | - <label for="txn-admin-payment-txn-id-inp" class=""><?php _e( 'TXN ID / CHQ #', 'event_espresso' );?></label> |
|
303 | + <label for="txn-admin-payment-txn-id-inp" class=""><?php _e('TXN ID / CHQ #', 'event_espresso'); ?></label> |
|
304 | 304 | <input name="txn_admin_payment[txn_id_chq_nmbr]" id="txn-admin-payment-txn-id-chq-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
305 | - <p class="description"><?php _e( 'The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso' );?></p> |
|
305 | + <p class="description"><?php _e('The Transaction ID sent back from the payment gateway, or the Cheque #', 'event_espresso'); ?></p> |
|
306 | 306 | </div> |
307 | 307 | </div> |
308 | 308 | |
309 | 309 | <div class="mop-CC mop" style="display:none"> |
310 | 310 | <div class="txn-admin-apply-payment-response-dv admin-modal-dialog-row"> |
311 | - <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e( 'Gateway Response', 'event_espresso' );?></label> |
|
311 | + <label for="txn-admin-payment-gateway-response-inp" class=""><?php _e('Gateway Response', 'event_espresso'); ?></label> |
|
312 | 312 | <input name="txn_admin_payment[gateway_response]" id="txn-admin-payment-gateway-response-inp" class="txn-admin-apply-payment-inp" type="text"/> |
313 | - <p class="description"><?php _e( 'The gateway response string (optional)', 'event_espresso' );?></p> |
|
313 | + <p class="description"><?php _e('The gateway response string (optional)', 'event_espresso'); ?></p> |
|
314 | 314 | </div> |
315 | 315 | </div> |
316 | 316 | |
317 | 317 | <div class="mop-PP mop-CC mop"> |
318 | 318 | <div class="txn-admin-apply-payment-status-dv admin-modal-dialog-row"> |
319 | - <label for="txn-admin-payment-status-inp" class=""><?php _e( 'Payment Status', 'event_espresso' );?></label> |
|
319 | + <label for="txn-admin-payment-status-inp" class=""><?php _e('Payment Status', 'event_espresso'); ?></label> |
|
320 | 320 | <select name="txn_admin_payment[status]" id="txn-admin-payment-status-slct" class="txn-admin-apply-payment-slct" type="text" > |
321 | - <?php foreach ( $payment_status as $STS_ID => $STS_code ) : ?> |
|
321 | + <?php foreach ($payment_status as $STS_ID => $STS_code) : ?> |
|
322 | 322 | <?php $selected = $STS_ID == 'PAP' ? ' selected="selected"' : ''; ?> |
323 | 323 | <option id="payment-status-opt-<?php echo $STS_ID; ?>" value="<?php echo $STS_ID; ?>"<?php echo $selected; ?>><?php echo $STS_code; ?> </option> |
324 | 324 | <?php endforeach; ?> |
325 | 325 | </select> |
326 | - <p class="description"><?php _e( 'Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso' );?></p> |
|
326 | + <p class="description"><?php _e('Whether the payment was approved, cancelled, declined or failed after submission to the gateway', 'event_espresso'); ?></p> |
|
327 | 327 | </div> |
328 | 328 | </div> |
329 | 329 | |
330 | 330 | <div class="txn-admin-apply-payment-po-nmbr-dv admin-modal-dialog-row"> |
331 | - <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e( 'P.O. / S.O. #', 'event_espresso' );?></label> |
|
331 | + <label for="txn-admin-payment-po-nmbr-inp" class=""><?php _e('P.O. / S.O. #', 'event_espresso'); ?></label> |
|
332 | 332 | <input name="txn_admin_payment[po_number]" id="txn-admin-payment-po-nmbr-inp" class="txn-admin-apply-payment-inp" type="text" maxlength="100"/> |
333 | - <p class="description"><?php _e( 'The Purchase or Sales Order Number if any (optional)', 'event_espresso' );?></p> |
|
333 | + <p class="description"><?php _e('The Purchase or Sales Order Number if any (optional)', 'event_espresso'); ?></p> |
|
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
337 | - <label for="txn-admin-payment-accounting-inp" class="last"><?php _e( 'Notes / Extra Accounting', 'event_espresso' );?></label> |
|
337 | + <label for="txn-admin-payment-accounting-inp" class="last"><?php _e('Notes / Extra Accounting', 'event_espresso'); ?></label> |
|
338 | 338 | <input name="txn_admin_payment[accounting]" id="txn-admin-payment-accounting-inp" class="txn-admin-apply-payment-inp" type="text" value="<?php echo $REG_code; ?>" maxlength="100"/> <input type="hidden" id="txn-admin-reg-code-inp" value="<?php echo $REG_code; ?>"/> |
339 | - <p class="description"><?php _e( 'An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso' );?></p> |
|
339 | + <p class="description"><?php _e('An extra field you may use for accounting purposes or simple notes. Defaults to the primary registrant\'s registration code.', 'event_espresso'); ?></p> |
|
340 | 340 | </div> |
341 | 341 | |
342 | 342 | <div class="txn-admin-apply-payment-registrations-dv admin-modal-dialog-row"> |
343 | - <label for="txn-admin-payment-registrations-inp" class="last"><?php _e( 'Registrations to Apply Payment to:', 'event_espresso' ); ?></label> |
|
343 | + <label for="txn-admin-payment-registrations-inp" class="last"><?php _e('Registrations to Apply Payment to:', 'event_espresso'); ?></label> |
|
344 | 344 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
345 | 345 | <input type="radio" value="1" id="txn-admin-apply-payment-to-all-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" checked="checked"/> |
346 | - <?php _e( 'ALL Registrations', 'event_espresso' ); ?> |
|
346 | + <?php _e('ALL Registrations', 'event_espresso'); ?> |
|
347 | 347 | </label> |
348 | 348 | <label class="txn-admin-apply-payment-to-registrations-lbl"> |
349 | 349 | <input type="radio" value="0" id="txn-admin-apply-payment-to-some-registrations-inp" name="txn_admin_payment[apply_to_all_registrations]" /> |
350 | - <?php _e( 'Just the following Registrations', 'event_espresso' ); ?> |
|
350 | + <?php _e('Just the following Registrations', 'event_espresso'); ?> |
|
351 | 351 | </label> |
352 | 352 | <?php echo $registrations_to_apply_payment_to; ?> |
353 | 353 | </div> |
354 | 354 | |
355 | 355 | <div class="txn-admin-payment-reg-status-dv admin-modal-dialog-row"> |
356 | - <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
356 | + <label for="txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
357 | 357 | <?php echo $status_change_select; ?> |
358 | - <p class="description"><?php _e( 'If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso' ); ?></p> |
|
358 | + <p class="description"><?php _e('If you wish to change the status for the registrations selected above, then select which status from this dropdown.', 'event_espresso'); ?></p> |
|
359 | 359 | <br/> |
360 | 360 | </div> |
361 | 361 | |
362 | 362 | <div class="txn-admin-apply-payment-send-notifications-dv admin-modal-dialog-row"> |
363 | 363 | |
364 | - <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
364 | + <label for="txn-admin-payment-send-notifications-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
365 | 365 | <label class="txn-admin-payment-send-notifications-lbl"> |
366 | 366 | <input type="checkbox" value="1" name="txn_payments[send_notifications]" checked="checked" aria-checked="true" style="vertical-align: middle;"> |
367 | - <?php _e( 'Payment Messages?', 'event_espresso' ); ?> |
|
367 | + <?php _e('Payment Messages?', 'event_espresso'); ?> |
|
368 | 368 | </label> |
369 | 369 | <label class="txn-admin-payment-send-notifications-lbl"> |
370 | 370 | <input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" style="vertical-align: middle;"> |
371 | - <?php _e( 'Registration Messages?', 'event_espresso' ); ?> |
|
371 | + <?php _e('Registration Messages?', 'event_espresso'); ?> |
|
372 | 372 | </label> |
373 | 373 | <br class="clear-float"/> |
374 | - <p class="description"><?php printf( __('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />' ); ?></p> |
|
374 | + <p class="description"><?php printf(__('By default %1$sa payment message is sent to the primary registrant%2$s after submitting this form.%3$sHowever, if you check the "Registration Messages" box, the system will also send any related messages matching the status of the registrations to %1$seach registration for this transaction%2$s.', 'event_espresso'), '<strong>', '</strong>', '<br />'); ?></p> |
|
375 | 375 | <label></label> |
376 | 376 | </div> |
377 | 377 | <div class="clear"></div> |
@@ -382,27 +382,27 @@ discard block |
||
382 | 382 | <ul id="admin-modal-dialog-options-ul"> |
383 | 383 | <li> |
384 | 384 | <a id="txn-admin-modal-dialog-apply-payment-lnk" class="button-primary no-icon" style="display:none;" > |
385 | - <?php _e( 'Apply Payment', 'event_espresso' );?> |
|
385 | + <?php _e('Apply Payment', 'event_espresso'); ?> |
|
386 | 386 | </a> |
387 | 387 | </li> |
388 | 388 | <li> |
389 | 389 | <a id="txn-admin-modal-dialog-edit-payment-lnk" class="button-primary no-icon" style="display:none;" > |
390 | - <?php _e( 'Save Payment Details', 'event_espresso' );?> |
|
390 | + <?php _e('Save Payment Details', 'event_espresso'); ?> |
|
391 | 391 | </a> |
392 | 392 | </li> |
393 | 393 | <li> |
394 | 394 | <a id="txn-admin-modal-dialog-edit-refund-lnk" class="button-primary no-icon" style="display:none;" > |
395 | - <?php _e( 'Save Refund Details', 'event_espresso' );?> |
|
395 | + <?php _e('Save Refund Details', 'event_espresso'); ?> |
|
396 | 396 | </a> |
397 | 397 | </li> |
398 | 398 | <li> |
399 | 399 | <a id="txn-admin-modal-dialog-apply-refund-lnk" class="button-primary no-icon" style="display:none;" > |
400 | - <?php _e( 'Apply Refund', 'event_espresso' );?> |
|
400 | + <?php _e('Apply Refund', 'event_espresso'); ?> |
|
401 | 401 | </a> |
402 | 402 | </li> |
403 | 403 | <li> |
404 | 404 | <a id="txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
405 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
405 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
406 | 406 | </a> |
407 | 407 | </li> |
408 | 408 | <li> |
@@ -419,29 +419,29 @@ discard block |
||
419 | 419 | |
420 | 420 | <h2 id="admin-modal-dialog-delete-payment-h2" class="admin-modal-dialog-h2 hdr-has-icon" style="display:none;"> |
421 | 421 | <span class="ee-icon ee-icon-cash-add"></span> |
422 | - <?php echo __( 'Delete Payment/Refund for Transaction #', 'event_espresso' ) . $txn_nmbr['value'];?> |
|
422 | + <?php echo __('Delete Payment/Refund for Transaction #', 'event_espresso').$txn_nmbr['value']; ?> |
|
423 | 423 | </h2> |
424 | 424 | |
425 | 425 | <form name="txn-admin-delete-payment-frm" id="txn-admin-delete-payment-frm" action="<?php echo $delete_payment_url; ?>"> |
426 | 426 | <div class="admin-modal-dialog-wrap"> |
427 | 427 | <div class="admin-modal-dialog-inner"> |
428 | 428 | |
429 | - <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce( 'espresso_delete_payment_nonce' );?>"/> |
|
429 | + <input type="hidden" name="espresso_delete_payment_nonce" id="espresso_delete_payment_nonce" value="<?php echo wp_create_nonce('espresso_delete_payment_nonce'); ?>"/> |
|
430 | 430 | <input type="hidden" name="delete_espresso_ajax" id="delete-espresso-ajax" value="0"/> |
431 | 431 | <input type="hidden" name="delete_noheader" id="delete-txn-admin-noheader-inp" value="0"/> |
432 | 432 | <input type="hidden" name="delete_txn_admin_payment[PAY_ID]" id="delete-txn-admin-payment-payment-id-inp" class="txn-admin-apply-payment-inp" value="0"/> |
433 | 433 | <input type="hidden" name="delete_txn_admin_payment[TXN_ID]" id="delete-txn-admin-payment-txn-id-inp" value="<?php echo $txn_nmbr['value']; ?>"/> |
434 | 434 | |
435 | 435 | <div class="txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
436 | - <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e( 'Change Registration Status?', 'event_espresso' );?></label> |
|
436 | + <label for="delete-txn-admin-payment-reg-status-inp" class="last"><?php _e('Change Registration Status?', 'event_espresso'); ?></label> |
|
437 | 437 | <?php echo $delete_status_change_select; ?> |
438 | - <p class="description"><?php printf( __('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>' ); ?></p> |
|
438 | + <p class="description"><?php printf(__('If you wish to change the status of all the registrations associated with this transaction after deleting this payment/refund, then select which status from this dropdown. %sNote: ALL registrations associated with this transaction will be updated to this new status.%s', 'event_espresso'), '<strong>', '</strong>'); ?></p> |
|
439 | 439 | </div> |
440 | 440 | |
441 | 441 | <div class="ee-attention txn-admin-apply-payment-accounting-dv admin-modal-dialog-row"> |
442 | - <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e( 'Send Related Messages?', 'event_espresso' );?></label> |
|
442 | + <label for="delete-txn-admin-payment-accounting-inp" class="last"><?php _e('Send Related Messages?', 'event_espresso'); ?></label> |
|
443 | 443 | <input type="checkbox" value="1" name="delete_txn_reg_status_change[send_notifications]"> |
444 | - <p class="description"><?php _e( 'If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso' );?></p> |
|
444 | + <p class="description"><?php _e('If you check this box, the system will send any related registration messages matching the status of the registrations to each registration for this transaction. No Payment notifications are sent when deleting a payment.', 'event_espresso'); ?></p> |
|
445 | 445 | </div> |
446 | 446 | <div class="clear"></div> |
447 | 447 | |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | <ul id="del-admin-modal-dialog-options-ul"> |
452 | 452 | <li> |
453 | 453 | <a id="txn-admin-modal-dialog-delete-lnk" class="button-primary no-icon" style="display:none;" > |
454 | - <?php _e( 'Delete', 'event_espresso' );?> |
|
454 | + <?php _e('Delete', 'event_espresso'); ?> |
|
455 | 455 | </a> |
456 | 456 | </li> |
457 | 457 | <li> |
458 | 458 | <a id="del-txn-admin-modal-dialog-cancel-lnk" class="button-secondary no-icon" > |
459 | - <?php _e( 'Cancel', 'event_espresso' );?> |
|
459 | + <?php _e('Cancel', 'event_espresso'); ?> |
|
460 | 460 | </a> |
461 | 461 | </li> |
462 | 462 | <li> |
@@ -472,30 +472,30 @@ discard block |
||
472 | 472 | <?php endif; // $grand_raw_total > 0?> |
473 | 473 | |
474 | 474 | <?php |
475 | - if ( WP_DEBUG ) { |
|
476 | - $delivered_messages = get_option( 'EED_Messages__payment', array() ); |
|
477 | - if ( isset( $delivered_messages[ $TXN_ID ] )) { |
|
475 | + if (WP_DEBUG) { |
|
476 | + $delivered_messages = get_option('EED_Messages__payment', array()); |
|
477 | + if (isset($delivered_messages[$TXN_ID])) { |
|
478 | 478 | ?> |
479 | - <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e( 'Messages Sent to Primary Registrant', 'event_espresso' );?></h4> |
|
479 | + <h4 class="admin-primary-mbox-h4 hdr-has-icon"><span class="dashicons dashicons-email-alt"></span><?php _e('Messages Sent to Primary Registrant', 'event_espresso'); ?></h4> |
|
480 | 480 | |
481 | 481 | <div class="admin-primary-mbox-tbl-wrap"> |
482 | 482 | <table class="admin-primary-mbox-tbl"> |
483 | 483 | <thead> |
484 | 484 | <tr> |
485 | - <th class="jst-left"><?php _e( 'Date & Time', 'event_espresso' );?></th> |
|
486 | - <th class="jst-left"><?php _e( 'Message Type', 'event_espresso' );?></th> |
|
487 | - <th class="jst-left"><?php _e( 'Payment Status Upon Sending', 'event_espresso' );?></th> |
|
488 | - <th class="jst-left"><?php _e( 'TXN Status Upon Sending', 'event_espresso' );?></th> |
|
485 | + <th class="jst-left"><?php _e('Date & Time', 'event_espresso'); ?></th> |
|
486 | + <th class="jst-left"><?php _e('Message Type', 'event_espresso'); ?></th> |
|
487 | + <th class="jst-left"><?php _e('Payment Status Upon Sending', 'event_espresso'); ?></th> |
|
488 | + <th class="jst-left"><?php _e('TXN Status Upon Sending', 'event_espresso'); ?></th> |
|
489 | 489 | </tr> |
490 | 490 | </thead> |
491 | 491 | <tbody> |
492 | - <?php foreach ( $delivered_messages[ $TXN_ID ] as $timestamp => $delivered_message ) : |
|
492 | + <?php foreach ($delivered_messages[$TXN_ID] as $timestamp => $delivered_message) : |
|
493 | 493 | ?> |
494 | 494 | <tr> |
495 | - <td class="jst-left"><?php echo gmdate( get_option('date_format') . ' ' . get_option('time_format'), ( $timestamp + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );?></td> |
|
496 | - <td class="jst-left"><?php echo isset( $delivered_message['message_type'] ) ? $delivered_message['message_type'] : '';?></td> |
|
497 | - <td class="jst-left"><?php echo isset( $delivered_message['pay_status'] ) ? $delivered_message['pay_status'] : '';?></td> |
|
498 | - <td class="jst-left"><?php echo isset( $delivered_message['txn_status'] ) ? $delivered_message['txn_status'] : '';?></td> |
|
495 | + <td class="jst-left"><?php echo gmdate(get_option('date_format').' '.get_option('time_format'), ($timestamp + (get_option('gmt_offset') * HOUR_IN_SECONDS))); ?></td> |
|
496 | + <td class="jst-left"><?php echo isset($delivered_message['message_type']) ? $delivered_message['message_type'] : ''; ?></td> |
|
497 | + <td class="jst-left"><?php echo isset($delivered_message['pay_status']) ? $delivered_message['pay_status'] : ''; ?></td> |
|
498 | + <td class="jst-left"><?php echo isset($delivered_message['txn_status']) ? $delivered_message['txn_status'] : ''; ?></td> |
|
499 | 499 | </tr> |
500 | 500 | <?php endforeach; // $delivered_messages?> |
501 | 501 | </tbody> |
@@ -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 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param bool $preview indicate whether a preview is being generated or not. |
272 | 272 | * @return void |
273 | 273 | */ |
274 | - public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) { |
|
274 | + public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) { |
|
275 | 275 | |
276 | 276 | $this->_active_messenger = $active_messenger; |
277 | 277 | |
@@ -280,10 +280,10 @@ discard block |
||
280 | 280 | |
281 | 281 | //this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send). |
282 | 282 | $exit = $this->_trigger_exit(); |
283 | - if ( $exit && ! $this->_preview ) return FALSE; |
|
283 | + if ($exit && ! $this->_preview) return FALSE; |
|
284 | 284 | |
285 | 285 | //todo: need to move require into registration hook but for now we'll require here. |
286 | - EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ); |
|
286 | + EE_Registry::instance()->load_helper('Parse_Shortcodes'); |
|
287 | 287 | //get shortcode_replace instance- set when _get_messages is called in child... |
288 | 288 | $this->_shortcode_replace = new EEH_Parse_Shortcodes(); |
289 | 289 | |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | $this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview'; |
295 | 295 | |
296 | 296 | //if there is an incoming context then this is a preview so let's ONLY show the given context! |
297 | - if ( !empty( $context ) ) { |
|
298 | - $cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : ''; |
|
299 | - if ( ! empty( $cntxt ) ) { |
|
297 | + if ( ! empty($context)) { |
|
298 | + $cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : ''; |
|
299 | + if ( ! empty($cntxt)) { |
|
300 | 300 | $this->_contexts = array(); |
301 | 301 | $this->_contexts[$context] = $cntxt; |
302 | 302 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $exit = $this->_init_data(); |
306 | 306 | |
307 | 307 | //final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated. |
308 | - if ( $exit ) return FALSE; |
|
308 | + if ($exit) return FALSE; |
|
309 | 309 | |
310 | 310 | $this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database. |
311 | 311 | $this->_assemble_messages(); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | * @param int $id Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object |
342 | 342 | * @return mixed ( EE_Base_Class||EE_Base_Class[] ) |
343 | 343 | */ |
344 | - abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id ); |
|
344 | + abstract protected function _get_data_for_context($context, EE_Registration $registration, $id); |
|
345 | 345 | |
346 | 346 | |
347 | 347 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return int |
375 | 375 | */ |
376 | - protected function _get_id_for_msg_url( $context, EE_Registration $registration ) { |
|
376 | + protected function _get_id_for_msg_url($context, EE_Registration $registration) { |
|
377 | 377 | return 0; |
378 | 378 | } |
379 | 379 | |
@@ -406,28 +406,28 @@ discard block |
||
406 | 406 | * |
407 | 407 | * @return string generated url |
408 | 408 | */ |
409 | - public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) { |
|
409 | + public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) { |
|
410 | 410 | |
411 | 411 | //validate context |
412 | 412 | //valid context? |
413 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
414 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
413 | + if ( ! isset($this->_contexts[$context])) { |
|
414 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | //valid sending_messenger? |
418 | 418 | $not_valid_msgr = FALSE; |
419 | - foreach ( $this->_with_messengers as $generating => $sendings ) { |
|
420 | - if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) { |
|
419 | + foreach ($this->_with_messengers as $generating => $sendings) { |
|
420 | + if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) { |
|
421 | 421 | $not_valid_msgr = TRUE; |
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | - if ( $not_valid_msgr ) { |
|
426 | - throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) ); |
|
425 | + if ($not_valid_msgr) { |
|
426 | + throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s. If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this))); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | EE_Registry::instance()->load_helper('MSG_Template'); |
430 | - return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) ); |
|
430 | + return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration)); |
|
431 | 431 | } |
432 | 432 | |
433 | 433 | |
@@ -448,19 +448,19 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return mixed (EE_Base_Class||EE_Base_Class[]) |
450 | 450 | */ |
451 | - public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) { |
|
451 | + public function get_data_for_context($context, EE_Registration $registration, $id = 0) { |
|
452 | 452 | //valid context? |
453 | - if ( !isset( $this->_contexts[$context] ) ) { |
|
454 | - throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) ); |
|
453 | + if ( ! isset($this->_contexts[$context])) { |
|
454 | + throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this))); |
|
455 | 455 | } |
456 | 456 | |
457 | 457 | //get data and apply global and class specific filters on it. |
458 | - $data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this ); |
|
459 | - $data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this ); |
|
458 | + $data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this); |
|
459 | + $data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this); |
|
460 | 460 | |
461 | 461 | //if empty then something went wrong! |
462 | - if ( empty( $data ) ) { |
|
463 | - throw new EE_Error( sprintf( __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) ); |
|
462 | + if (empty($data)) { |
|
463 | + throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name)); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | return $data; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | */ |
496 | 496 | public function with_messengers() { |
497 | 497 | |
498 | - return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers); |
|
498 | + return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | * @access public |
514 | 514 | * @return void |
515 | 515 | */ |
516 | - public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) { |
|
516 | + public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) { |
|
517 | 517 | //we can also further refine the context by action (if present). |
518 | - return $this->_get_admin_page_content( $page, $action, $extra, $messengers ); |
|
518 | + return $this->_get_admin_page_content($page, $action, $extra, $messengers); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -559,8 +559,8 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function get_master_templates() { |
561 | 561 | //first class specific filter then filter that by the global filter. |
562 | - $master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates ); |
|
563 | - return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this ); |
|
562 | + $master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates); |
|
563 | + return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this); |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | |
@@ -579,31 +579,31 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * first let's make sure that incoming data isn't empty! |
581 | 581 | */ |
582 | - if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) { |
|
583 | - $msg = sprintf( __( '"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] ); |
|
584 | - throw new EE_Error( $msg ); |
|
582 | + if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) { |
|
583 | + $msg = sprintf(__('"%s" message type incoming data is empty. There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']); |
|
584 | + throw new EE_Error($msg); |
|
585 | 585 | } |
586 | 586 | |
587 | - if ( empty( $this->_data_handler) ) { |
|
588 | - $msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ ); |
|
589 | - throw new EE_Error( $msg ); |
|
587 | + if (empty($this->_data_handler)) { |
|
588 | + $msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__); |
|
589 | + throw new EE_Error($msg); |
|
590 | 590 | } |
591 | 591 | |
592 | 592 | |
593 | 593 | //setup class name for the data handler |
594 | - $classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data'; |
|
594 | + $classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data'; |
|
595 | 595 | |
596 | 596 | //check that the class exists |
597 | - if ( !class_exists( $classname ) ) { |
|
597 | + if ( ! class_exists($classname)) { |
|
598 | 598 | |
599 | 599 | $msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso'); |
600 | - $msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname ); |
|
601 | - throw new EE_error( implode('||', $msg) ); |
|
600 | + $msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class"). Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname); |
|
601 | + throw new EE_error(implode('||', $msg)); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | //k lets get the prepared data object and replace existing data property with it. |
605 | - $a = new ReflectionClass( $classname ); |
|
606 | - $this->_data = $a->newInstance( $this->_data ); |
|
605 | + $a = new ReflectionClass($classname); |
|
606 | + $this->_data = $a->newInstance($this->_data); |
|
607 | 607 | |
608 | 608 | $this->_set_default_addressee_data(); |
609 | 609 | return $this->_process_data(); |
@@ -619,15 +619,15 @@ discard block |
||
619 | 619 | protected function _process_data() { |
620 | 620 | //at a minimum, we NEED EE_Attendee objects. |
621 | 621 | |
622 | - if ( empty( $this->_data->attendees ) ) |
|
623 | - return TRUE; //EXIT! |
|
622 | + if (empty($this->_data->attendees)) |
|
623 | + return TRUE; //EXIT! |
|
624 | 624 | |
625 | 625 | //process addressees for each context. Child classes will have to have methods for each context defined to handle the processing of the data object within them |
626 | - foreach ( $this->_contexts as $context => $details ) { |
|
627 | - $xpctd_method = '_' . $context . '_addressees'; |
|
628 | - if ( !method_exists( $this, $xpctd_method ) ) |
|
629 | - throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) ); |
|
630 | - $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) ); |
|
626 | + foreach ($this->_contexts as $context => $details) { |
|
627 | + $xpctd_method = '_'.$context.'_addressees'; |
|
628 | + if ( ! method_exists($this, $xpctd_method)) |
|
629 | + throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so. The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method)); |
|
630 | + $this->_addressees[$context] = call_user_func(array($this, $xpctd_method)); |
|
631 | 631 | } |
632 | 632 | return FALSE; //DON'T EXIT |
633 | 633 | } |
@@ -662,8 +662,8 @@ discard block |
||
662 | 662 | 'total_ticket_count' => $this->_data->total_ticket_count |
663 | 663 | ); |
664 | 664 | |
665 | - if ( is_array( $this->_data->primary_attendee_data ) ) { |
|
666 | - $this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data ); |
|
665 | + if (is_array($this->_data->primary_attendee_data)) { |
|
666 | + $this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data); |
|
667 | 667 | $this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj']; |
668 | 668 | $this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj']; |
669 | 669 | } |
@@ -681,26 +681,26 @@ discard block |
||
681 | 681 | * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default). |
682 | 682 | */ |
683 | 683 | protected function _set_valid_shortcodes() { |
684 | - $all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' ); |
|
684 | + $all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger'); |
|
685 | 685 | $contexts = $this->get_contexts(); |
686 | - foreach ( $contexts as $context => $details ) { |
|
686 | + foreach ($contexts as $context => $details) { |
|
687 | 687 | $this->_valid_shortcodes[$context] = $all_shortcodes; |
688 | 688 | |
689 | 689 | //make sure non admin context does not include the event_author shortcodes |
690 | - if ( $context != 'admin' ) { |
|
691 | - if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) { |
|
690 | + if ($context != 'admin') { |
|
691 | + if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) { |
|
692 | 692 | unset($this->_valid_shortcodes[$context][$key]); |
693 | 693 | } |
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | 697 | //make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context. |
698 | - if ( !empty( $this->_valid_shortcodes['admin'] ) ) { |
|
699 | - if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
698 | + if ( ! empty($this->_valid_shortcodes['admin'])) { |
|
699 | + if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) { |
|
700 | 700 | unset($this->_valid_shortcodes['admin'][$key]); |
701 | 701 | } |
702 | 702 | //make sure admin context does not include the recipient_details shortcodes |
703 | - if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) { |
|
703 | + if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) { |
|
704 | 704 | unset($this->_valid_shortcodes['admin'][$key]); |
705 | 705 | } |
706 | 706 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @param array $new_config array of valid shortcodes (by context) |
714 | 714 | * @return void sets valid_shortcodes property |
715 | 715 | */ |
716 | - public function reset_valid_shortcodes_config( $new_config ) { |
|
717 | - foreach ( $new_config as $context => $shortcodes ) { |
|
716 | + public function reset_valid_shortcodes_config($new_config) { |
|
717 | + foreach ($new_config as $context => $shortcodes) { |
|
718 | 718 | $this->_valid_shortcodes[$context] = $shortcodes; |
719 | 719 | } |
720 | 720 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $addressees = array(); |
735 | 735 | |
736 | 736 | //first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user. |
737 | - foreach ( $this->_data->events as $line_ref => $event ) { |
|
737 | + foreach ($this->_data->events as $line_ref => $event) { |
|
738 | 738 | $admin_id = $this->_get_event_admin_id($event['ID']); |
739 | 739 | //get the user_id for the event |
740 | 740 | $admin_ids[] = $admin_id; |
@@ -746,14 +746,14 @@ discard block |
||
746 | 746 | $admin_ids = array_unique($admin_ids); |
747 | 747 | |
748 | 748 | //k now we can loop through the event_admins and setup the addressee data. |
749 | - foreach ( $admin_ids as $event_admin ) { |
|
749 | + foreach ($admin_ids as $event_admin) { |
|
750 | 750 | $aee = array( |
751 | 751 | 'user_id' => $event_admin, |
752 | 752 | 'events' => $admin_events[$event_admin], |
753 | 753 | 'attendees' => $this->_data->attendees |
754 | 754 | ); |
755 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
756 | - $addressees[] = new EE_Messages_Addressee( $aee ); |
|
755 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
756 | + $addressees[] = new EE_Messages_Addressee($aee); |
|
757 | 757 | } |
758 | 758 | |
759 | 759 | return $addressees; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $aee['attendees'] = $this->_data->attendees; |
774 | 774 | |
775 | 775 | //great now we can instantiate the $addressee object and return (as an array); |
776 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
776 | + $add[] = new EE_Messages_Addressee($aee); |
|
777 | 777 | return $add; |
778 | 778 | } |
779 | 779 | |
@@ -792,34 +792,34 @@ discard block |
||
792 | 792 | //use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we? |
793 | 793 | $already_processed = array(); |
794 | 794 | |
795 | - foreach ( $this->_data->attendees as $att_id => $details ) { |
|
795 | + foreach ($this->_data->attendees as $att_id => $details) { |
|
796 | 796 | //set the attendee array to blank on each loop; |
797 | 797 | $aee = array(); |
798 | 798 | |
799 | - if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue; |
|
799 | + if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue; |
|
800 | 800 | |
801 | 801 | //is $this->_regs_for_sending present? If so, let's make sure we ONLY generate addressee for registrations in that array. |
802 | - if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) { |
|
803 | - $regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] ); |
|
804 | - if ( empty( $regs_allowed ) ) { |
|
802 | + if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) { |
|
803 | + $regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']); |
|
804 | + if (empty($regs_allowed)) { |
|
805 | 805 | continue; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | |
809 | - if ( in_array( $details['attendee_email'], $already_processed ) ) |
|
809 | + if (in_array($details['attendee_email'], $already_processed)) |
|
810 | 810 | continue; |
811 | 811 | |
812 | 812 | $already_processed[] = $details['attendee_email']; |
813 | 813 | |
814 | - foreach ( $details as $item => $value ) { |
|
814 | + foreach ($details as $item => $value) { |
|
815 | 815 | $aee[$item] = $value; |
816 | - if ( $item == 'line_ref' ) { |
|
817 | - foreach ( $value as $event_id ) { |
|
816 | + if ($item == 'line_ref') { |
|
817 | + foreach ($value as $event_id) { |
|
818 | 818 | $aee['events'][$event_id] = $this->_data->events[$event_id]; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | |
822 | - if ( $item == 'attendee_email' ) { |
|
822 | + if ($item == 'attendee_email') { |
|
823 | 823 | $aee['attendee_email'] = $value; |
824 | 824 | } |
825 | 825 | |
@@ -834,8 +834,8 @@ discard block |
||
834 | 834 | $aee['attendees'] = $this->_data->attendees; |
835 | 835 | |
836 | 836 | //merge in the primary attendee data |
837 | - $aee = array_merge( $this->_default_addressee_data, $aee ); |
|
838 | - $add[] = new EE_Messages_Addressee( $aee ); |
|
837 | + $aee = array_merge($this->_default_addressee_data, $aee); |
|
838 | + $add[] = new EE_Messages_Addressee($aee); |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $add; |
@@ -860,46 +860,46 @@ discard block |
||
860 | 860 | ); |
861 | 861 | |
862 | 862 | //in vanilla EE we're assuming there's only one event. However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems). |
863 | - if ( count($this->_data->events) === 1 ) { |
|
864 | - foreach ( $this->_data->events as $event ) { |
|
863 | + if (count($this->_data->events) === 1) { |
|
864 | + foreach ($this->_data->events as $event) { |
|
865 | 865 | $EVT_ID = $event['ID']; |
866 | 866 | } |
867 | 867 | } |
868 | 868 | // is there a Group ID in the incoming request? |
869 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
869 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
870 | 870 | // if not, set a default value of false |
871 | - $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false ); |
|
871 | + $GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false); |
|
872 | 872 | //if this is a preview then we just get whatever message group is for the preview and skip this part! |
873 | - if ( $this->_preview && $GRP_ID ) { |
|
874 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
873 | + if ($this->_preview && $GRP_ID) { |
|
874 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
875 | 875 | } else { |
876 | 876 | //not a preview or test send so lets continue on our way! |
877 | 877 | //is there an evt_id? If so let's get that. template. |
878 | - if ( !empty( $EVT_ID ) ) { |
|
878 | + if ( ! empty($EVT_ID)) { |
|
879 | 879 | $evt_qa = array( |
880 | 880 | 'Event.EVT_ID' => $EVT_ID |
881 | 881 | ); |
882 | - $qa = array_merge( $template_qa, $evt_qa ); |
|
883 | - $mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) ); |
|
882 | + $qa = array_merge($template_qa, $evt_qa); |
|
883 | + $mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa)); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | //is there a 'GRP_ID' ? if so let's get that. |
887 | 887 | |
888 | 888 | //if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested. |
889 | - if ( $GRP_ID ) { |
|
890 | - $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID ); |
|
889 | + if ($GRP_ID) { |
|
890 | + $mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID); |
|
891 | 891 | } |
892 | 892 | |
893 | 893 | |
894 | 894 | $template_qa['MTP_is_global'] = TRUE; |
895 | 895 | |
896 | 896 | //this gets the current global template (message template group) for the active messenger and message type. |
897 | - $global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) ); |
|
897 | + $global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa)); |
|
898 | 898 | |
899 | - $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg; |
|
899 | + $mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg; |
|
900 | 900 | } |
901 | 901 | |
902 | - if ( ! $mtpg instanceof EE_Message_Template_Group ) { |
|
902 | + if ( ! $mtpg instanceof EE_Message_Template_Group) { |
|
903 | 903 | //get out because we can't process anything, there are no message template groups |
904 | 904 | // and thus some sort of bad setup issues. |
905 | 905 | return false; |
@@ -915,8 +915,8 @@ discard block |
||
915 | 915 | |
916 | 916 | |
917 | 917 | |
918 | - foreach ( $templates as $context => $template_fields ) { |
|
919 | - foreach( $template_fields as $template_field=> $template_obj ) { |
|
918 | + foreach ($templates as $context => $template_fields) { |
|
919 | + foreach ($template_fields as $template_field=> $template_obj) { |
|
920 | 920 | $this->_templates[$template_field][$context] = $template_obj->get('MTP_content'); |
921 | 921 | } |
922 | 922 | } |
@@ -931,11 +931,11 @@ discard block |
||
931 | 931 | protected function _assemble_messages() { |
932 | 932 | //make sure any set messages object is cleared |
933 | 933 | $this->messages = array(); |
934 | - foreach ( $this->_addressees as $context => $addressees ) { |
|
935 | - foreach ( $addressees as $addressee ) { |
|
934 | + foreach ($this->_addressees as $context => $addressees) { |
|
935 | + foreach ($addressees as $addressee) { |
|
936 | 936 | $message = $this->_setup_message_object($context, $addressee); |
937 | 937 | //only assign message if everything went okay |
938 | - if ( $message ) { |
|
938 | + if ($message) { |
|
939 | 939 | $message->template_pack = $this->_template_pack; |
940 | 940 | $message->variation = $this->_variation; |
941 | 941 | $this->messages[] = $message; |
@@ -959,22 +959,22 @@ discard block |
||
959 | 959 | $m_shortcodes = $this->_active_messenger->get_valid_shortcodes(); |
960 | 960 | |
961 | 961 | //if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing |
962 | - if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) |
|
962 | + if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview) |
|
963 | 963 | return false; |
964 | 964 | |
965 | - if ( empty( $this->_templates ) ) { |
|
965 | + if (empty($this->_templates)) { |
|
966 | 966 | //unable to setup any messages because there are no templates. Some sort of catastrophic setup |
967 | 967 | //issue exists |
968 | 968 | return false; |
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $this->_templates as $field => $ctxt ) { |
|
971 | + foreach ($this->_templates as $field => $ctxt) { |
|
972 | 972 | //let's setup the valid shortcodes for the incoming context. |
973 | 973 | $valid_shortcodes = $mt_shortcodes[$context]; |
974 | 974 | //merge in valid shortcodes for the field. |
975 | 975 | $shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes; |
976 | - if ( isset( $this->_templates[$field][$context] ) ) { |
|
977 | - $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID ); |
|
976 | + if (isset($this->_templates[$field][$context])) { |
|
977 | + $message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID); |
|
978 | 978 | } |
979 | 979 | } |
980 | 980 | return $message; |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | * @return EED_Single_Page_Checkout |
39 | 39 | */ |
40 | 40 | public static function instance() { |
41 | - add_filter( 'EED_Single_Page_Checkout__SPCO_active', '__return_true' ); |
|
42 | - return parent::get_instance( __CLASS__ ); |
|
41 | + add_filter('EED_Single_Page_Checkout__SPCO_active', '__return_true'); |
|
42 | + return parent::get_instance(__CLASS__); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -84,22 +84,22 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks_admin() { |
86 | 86 | EED_Single_Page_Checkout::set_definitions(); |
87 | - if ( defined( 'DOING_AJAX' )) { |
|
87 | + if (defined('DOING_AJAX')) { |
|
88 | 88 | // going to start an output buffer in case anything gets accidentally output that might disrupt our JSON response |
89 | 89 | ob_start(); |
90 | 90 | EED_Single_Page_Checkout::load_request_handler(); |
91 | 91 | EED_Single_Page_Checkout::load_reg_steps(); |
92 | 92 | } else { |
93 | 93 | // hook into the top of pre_get_posts to set the reg step routing, which gives other modules or plugins a chance to modify the reg steps, but just before the routes get called |
94 | - add_action( 'pre_get_posts', array( 'EED_Single_Page_Checkout', 'load_reg_steps' ), 1 ); |
|
94 | + add_action('pre_get_posts', array('EED_Single_Page_Checkout', 'load_reg_steps'), 1); |
|
95 | 95 | } |
96 | 96 | // set ajax hooks |
97 | - add_action( 'wp_ajax_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
98 | - add_action( 'wp_ajax_nopriv_process_reg_step', array( 'EED_Single_Page_Checkout', 'process_reg_step' )); |
|
99 | - add_action( 'wp_ajax_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
100 | - add_action( 'wp_ajax_nopriv_display_spco_reg_step', array( 'EED_Single_Page_Checkout', 'display_reg_step' )); |
|
101 | - add_action( 'wp_ajax_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
102 | - add_action( 'wp_ajax_nopriv_update_reg_step', array( 'EED_Single_Page_Checkout', 'update_reg_step' )); |
|
97 | + add_action('wp_ajax_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
98 | + add_action('wp_ajax_nopriv_process_reg_step', array('EED_Single_Page_Checkout', 'process_reg_step')); |
|
99 | + add_action('wp_ajax_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
100 | + add_action('wp_ajax_nopriv_display_spco_reg_step', array('EED_Single_Page_Checkout', 'display_reg_step')); |
|
101 | + add_action('wp_ajax_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
102 | + add_action('wp_ajax_nopriv_update_reg_step', array('EED_Single_Page_Checkout', 'update_reg_step')); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -108,8 +108,8 @@ discard block |
||
108 | 108 | * process ajax request |
109 | 109 | * @param string $ajax_action |
110 | 110 | */ |
111 | - public static function process_ajax_request( $ajax_action ) { |
|
112 | - EE_Registry::instance()->REQ->set( 'action', $ajax_action ); |
|
111 | + public static function process_ajax_request($ajax_action) { |
|
112 | + EE_Registry::instance()->REQ->set('action', $ajax_action); |
|
113 | 113 | EED_Single_Page_Checkout::instance()->_initialize(); |
114 | 114 | } |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * ajax display registration step |
120 | 120 | */ |
121 | 121 | public static function display_reg_step() { |
122 | - EED_Single_Page_Checkout::process_ajax_request( 'display_spco_reg_step' ); |
|
122 | + EED_Single_Page_Checkout::process_ajax_request('display_spco_reg_step'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * ajax process registration step |
129 | 129 | */ |
130 | 130 | public static function process_reg_step() { |
131 | - EED_Single_Page_Checkout::process_ajax_request( 'process_reg_step' ); |
|
131 | + EED_Single_Page_Checkout::process_ajax_request('process_reg_step'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * ajax process registration step |
138 | 138 | */ |
139 | 139 | public static function update_reg_step() { |
140 | - EED_Single_Page_Checkout::process_ajax_request( 'update_reg_step' ); |
|
140 | + EED_Single_Page_Checkout::process_ajax_request('update_reg_step'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @return void |
150 | 150 | */ |
151 | 151 | public static function update_checkout() { |
152 | - EED_Single_Page_Checkout::process_ajax_request( 'update_checkout' ); |
|
152 | + EED_Single_Page_Checkout::process_ajax_request('update_checkout'); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public static function load_request_handler() { |
164 | 164 | // load core Request_Handler class |
165 | - if ( ! isset( EE_Registry::instance()->REQ )) { |
|
166 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
165 | + if ( ! isset(EE_Registry::instance()->REQ)) { |
|
166 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | * @return void |
177 | 177 | */ |
178 | 178 | public static function set_definitions() { |
179 | - define( 'SPCO_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
180 | - define( 'SPCO_CSS_URL', plugin_dir_url( __FILE__ ) . 'css' . DS ); |
|
181 | - define( 'SPCO_IMG_URL', plugin_dir_url( __FILE__ ) . 'img' . DS ); |
|
182 | - define( 'SPCO_JS_URL', plugin_dir_url( __FILE__ ) . 'js' . DS ); |
|
183 | - define( 'SPCO_INC_PATH', SPCO_BASE_PATH . 'inc' . DS ); |
|
184 | - define( 'SPCO_REG_STEPS_PATH', SPCO_BASE_PATH . 'reg_steps' . DS ); |
|
185 | - define( 'SPCO_TEMPLATES_PATH', SPCO_BASE_PATH . 'templates' . DS ); |
|
186 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( SPCO_BASE_PATH, TRUE ); |
|
179 | + define('SPCO_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
180 | + define('SPCO_CSS_URL', plugin_dir_url(__FILE__).'css'.DS); |
|
181 | + define('SPCO_IMG_URL', plugin_dir_url(__FILE__).'img'.DS); |
|
182 | + define('SPCO_JS_URL', plugin_dir_url(__FILE__).'js'.DS); |
|
183 | + define('SPCO_INC_PATH', SPCO_BASE_PATH.'inc'.DS); |
|
184 | + define('SPCO_REG_STEPS_PATH', SPCO_BASE_PATH.'reg_steps'.DS); |
|
185 | + define('SPCO_TEMPLATES_PATH', SPCO_BASE_PATH.'templates'.DS); |
|
186 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(SPCO_BASE_PATH, TRUE); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public static function load_reg_steps() { |
200 | 200 | static $reg_steps_loaded = FALSE; |
201 | - if ( $reg_steps_loaded ) { |
|
201 | + if ($reg_steps_loaded) { |
|
202 | 202 | return; |
203 | 203 | } |
204 | 204 | // filter list of reg_steps |
@@ -207,24 +207,24 @@ discard block |
||
207 | 207 | EED_Single_Page_Checkout::get_reg_steps() |
208 | 208 | ); |
209 | 209 | // sort by key (order) |
210 | - ksort( $reg_steps_to_load ); |
|
210 | + ksort($reg_steps_to_load); |
|
211 | 211 | // loop through folders |
212 | - foreach ( $reg_steps_to_load as $order => $reg_step ) { |
|
212 | + foreach ($reg_steps_to_load as $order => $reg_step) { |
|
213 | 213 | // we need a |
214 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
214 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
215 | 215 | // copy over to the reg_steps_array |
216 | - EED_Single_Page_Checkout::$_reg_steps_array[ $order ] = $reg_step; |
|
216 | + EED_Single_Page_Checkout::$_reg_steps_array[$order] = $reg_step; |
|
217 | 217 | // register custom key route for each reg step |
218 | 218 | // ie: step=>"slug" - this is the entire reason we load the reg steps array now |
219 | - EE_Config::register_route( $reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step' ); |
|
219 | + EE_Config::register_route($reg_step['slug'], 'EED_Single_Page_Checkout', 'run', 'step'); |
|
220 | 220 | // add AJAX or other hooks |
221 | - if ( isset( $reg_step['has_hooks'] ) && $reg_step['has_hooks'] ) { |
|
221 | + if (isset($reg_step['has_hooks']) && $reg_step['has_hooks']) { |
|
222 | 222 | // setup autoloaders if necessary |
223 | - if ( ! class_exists( $reg_step['class_name'] )) { |
|
224 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $reg_step['file_path'], TRUE ); |
|
223 | + if ( ! class_exists($reg_step['class_name'])) { |
|
224 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($reg_step['file_path'], TRUE); |
|
225 | 225 | } |
226 | - if ( is_callable( $reg_step['class_name'], 'set_hooks' )) { |
|
227 | - call_user_func( array( $reg_step['class_name'], 'set_hooks' )); |
|
226 | + if (is_callable($reg_step['class_name'], 'set_hooks')) { |
|
227 | + call_user_func(array($reg_step['class_name'], 'set_hooks')); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | } |
@@ -243,28 +243,28 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public static function get_reg_steps() { |
245 | 245 | $reg_steps = EE_Registry::instance()->CFG->registration->reg_steps; |
246 | - if ( empty( $reg_steps )) { |
|
246 | + if (empty($reg_steps)) { |
|
247 | 247 | $reg_steps = array( |
248 | 248 | 10 => array( |
249 | - 'file_path' => SPCO_REG_STEPS_PATH . 'attendee_information', |
|
249 | + 'file_path' => SPCO_REG_STEPS_PATH.'attendee_information', |
|
250 | 250 | 'class_name' => 'EE_SPCO_Reg_Step_Attendee_Information', |
251 | 251 | 'slug' => 'attendee_information', |
252 | 252 | 'has_hooks' => FALSE |
253 | 253 | ), |
254 | 254 | 20 => array( |
255 | - 'file_path' => SPCO_REG_STEPS_PATH . 'registration_confirmation', |
|
255 | + 'file_path' => SPCO_REG_STEPS_PATH.'registration_confirmation', |
|
256 | 256 | 'class_name' => 'EE_SPCO_Reg_Step_Registration_Confirmation', |
257 | 257 | 'slug' => 'registration_confirmation', |
258 | 258 | 'has_hooks' => FALSE |
259 | 259 | ), |
260 | 260 | 30 => array( |
261 | - 'file_path' => SPCO_REG_STEPS_PATH . 'payment_options', |
|
261 | + 'file_path' => SPCO_REG_STEPS_PATH.'payment_options', |
|
262 | 262 | 'class_name' => 'EE_SPCO_Reg_Step_Payment_Options', |
263 | 263 | 'slug' => 'payment_options', |
264 | 264 | 'has_hooks' => TRUE |
265 | 265 | ), |
266 | 266 | 999 => array( |
267 | - 'file_path' => SPCO_REG_STEPS_PATH . 'finalize_registration', |
|
267 | + 'file_path' => SPCO_REG_STEPS_PATH.'finalize_registration', |
|
268 | 268 | 'class_name' => 'EE_SPCO_Reg_Step_Finalize_Registration', |
269 | 269 | 'slug' => 'finalize_registration', |
270 | 270 | 'has_hooks' => FALSE |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public static function registration_checkout_for_admin() { |
286 | 286 | EED_Single_Page_Checkout::load_reg_steps(); |
287 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
288 | - EE_Registry::instance()->REQ->set( 'action', 'display_spco_reg_step' ); |
|
289 | - EE_Registry::instance()->REQ->set( 'process_form_submission', false ); |
|
287 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
288 | + EE_Registry::instance()->REQ->set('action', 'display_spco_reg_step'); |
|
289 | + EE_Registry::instance()->REQ->set('process_form_submission', false); |
|
290 | 290 | EED_Single_Page_Checkout::instance()->_initialize(); |
291 | 291 | EED_Single_Page_Checkout::instance()->_display_spco_reg_form(); |
292 | 292 | return EE_Registry::instance()->REQ->get_output(); |
@@ -302,14 +302,14 @@ discard block |
||
302 | 302 | */ |
303 | 303 | public static function process_registration_from_admin() { |
304 | 304 | EED_Single_Page_Checkout::load_reg_steps(); |
305 | - EE_Registry::instance()->REQ->set( 'step', 'attendee_information' ); |
|
306 | - EE_Registry::instance()->REQ->set( 'action', 'process_reg_step' ); |
|
307 | - EE_Registry::instance()->REQ->set( 'process_form_submission', true ); |
|
305 | + EE_Registry::instance()->REQ->set('step', 'attendee_information'); |
|
306 | + EE_Registry::instance()->REQ->set('action', 'process_reg_step'); |
|
307 | + EE_Registry::instance()->REQ->set('process_form_submission', true); |
|
308 | 308 | EED_Single_Page_Checkout::instance()->_initialize(); |
309 | - if ( EED_Single_Page_Checkout::instance()->checkout->current_step->completed() ) { |
|
310 | - $final_reg_step = end( EED_Single_Page_Checkout::instance()->checkout->reg_steps ); |
|
311 | - if ( $final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration ) { |
|
312 | - if ( $final_reg_step->process_reg_step() ) { |
|
309 | + if (EED_Single_Page_Checkout::instance()->checkout->current_step->completed()) { |
|
310 | + $final_reg_step = end(EED_Single_Page_Checkout::instance()->checkout->reg_steps); |
|
311 | + if ($final_reg_step instanceof EE_SPCO_Reg_Step_Finalize_Registration) { |
|
312 | + if ($final_reg_step->process_reg_step()) { |
|
313 | 313 | return EED_Single_Page_Checkout::instance()->checkout->transaction; |
314 | 314 | } |
315 | 315 | } |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | * @param WP_Query $WP_Query |
327 | 327 | * @return void |
328 | 328 | */ |
329 | - public function run( $WP_Query ) { |
|
329 | + public function run($WP_Query) { |
|
330 | 330 | if ( |
331 | 331 | $WP_Query instanceof WP_Query |
332 | 332 | && $WP_Query->is_main_query() |
333 | - && apply_filters( 'FHEE__EED_Single_Page_Checkout__run', true ) |
|
333 | + && apply_filters('FHEE__EED_Single_Page_Checkout__run', true) |
|
334 | 334 | ) { |
335 | 335 | $this->_initialize(); |
336 | 336 | } |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @param WP_Query $WP_Query |
347 | 347 | * @return void |
348 | 348 | */ |
349 | - public static function init( $WP_Query ) { |
|
350 | - EED_Single_Page_Checkout::instance()->run( $WP_Query ); |
|
349 | + public static function init($WP_Query) { |
|
350 | + EED_Single_Page_Checkout::instance()->run($WP_Query); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | |
@@ -361,35 +361,35 @@ discard block |
||
361 | 361 | */ |
362 | 362 | private function _initialize() { |
363 | 363 | // ensure SPCO doesn't run twice |
364 | - if ( EED_Single_Page_Checkout::$_initialized ) { |
|
364 | + if (EED_Single_Page_Checkout::$_initialized) { |
|
365 | 365 | return; |
366 | 366 | } |
367 | 367 | // setup the EE_Checkout object |
368 | 368 | $this->checkout = $this->_initialize_checkout(); |
369 | 369 | // filter checkout |
370 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout ); |
|
370 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize__checkout', $this->checkout); |
|
371 | 371 | // get the $_GET |
372 | 372 | $this->_get_request_vars(); |
373 | 373 | // filter continue_reg |
374 | - $this->checkout->continue_reg = apply_filters( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout ); |
|
374 | + $this->checkout->continue_reg = apply_filters('FHEE__EED_Single_Page_Checkout__init___continue_reg', TRUE, $this->checkout); |
|
375 | 375 | // load the reg steps array |
376 | - if ( ! $this->_load_and_instantiate_reg_steps() ) { |
|
376 | + if ( ! $this->_load_and_instantiate_reg_steps()) { |
|
377 | 377 | EED_Single_Page_Checkout::$_initialized = true; |
378 | 378 | return; |
379 | 379 | } |
380 | 380 | // set the current step |
381 | - $this->checkout->set_current_step( $this->checkout->step ); |
|
381 | + $this->checkout->set_current_step($this->checkout->step); |
|
382 | 382 | // and the next step |
383 | 383 | $this->checkout->set_next_step(); |
384 | 384 | // was there already a valid transaction in the checkout from the session ? |
385 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
385 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
386 | 386 | // get transaction from db or session |
387 | 387 | $this->checkout->transaction = $this->checkout->reg_url_link && ! is_admin() |
388 | 388 | ? $this->_get_transaction_and_cart_for_previous_visit() |
389 | 389 | : $this->_get_cart_for_current_session_and_setup_new_transaction(); |
390 | - if ( ! $this->checkout->transaction instanceof EE_Transaction ) { |
|
390 | + if ( ! $this->checkout->transaction instanceof EE_Transaction) { |
|
391 | 391 | EE_Error::add_error( |
392 | - __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), |
|
392 | + __('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), |
|
393 | 393 | __FILE__, __FUNCTION__, __LINE__ |
394 | 394 | ); |
395 | 395 | // add some style and make it dance |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | return; |
400 | 400 | } |
401 | 401 | // and the registrations for the transaction |
402 | - $this->_get_registrations( $this->checkout->transaction ); |
|
402 | + $this->_get_registrations($this->checkout->transaction); |
|
403 | 403 | } |
404 | 404 | // verify that everything has been setup correctly |
405 | - if ( ! $this->_final_verifications() ) { |
|
405 | + if ( ! $this->_final_verifications()) { |
|
406 | 406 | EED_Single_Page_Checkout::$_initialized = true; |
407 | 407 | return; |
408 | 408 | } |
@@ -427,9 +427,9 @@ discard block |
||
427 | 427 | // set no cache headers and constants |
428 | 428 | EE_System::do_not_cache(); |
429 | 429 | // add anchor |
430 | - add_action( 'loop_start', array( $this, 'set_checkout_anchor' ), 1 ); |
|
430 | + add_action('loop_start', array($this, 'set_checkout_anchor'), 1); |
|
431 | 431 | // remove transaction lock |
432 | - add_action( 'shutdown', array( $this, 'unlock_transaction' ), 1 ); |
|
432 | + add_action('shutdown', array($this, 'unlock_transaction'), 1); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -446,20 +446,20 @@ discard block |
||
446 | 446 | // look in session for existing checkout |
447 | 447 | $checkout = EE_Registry::instance()->SSN->checkout(); |
448 | 448 | // verify |
449 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
449 | + if ( ! $checkout instanceof EE_Checkout) { |
|
450 | 450 | // instantiate EE_Checkout object for handling the properties of the current checkout process |
451 | - $checkout = EE_Registry::instance()->load_file( SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE ); |
|
451 | + $checkout = EE_Registry::instance()->load_file(SPCO_INC_PATH, 'EE_Checkout', 'class', array(), FALSE); |
|
452 | 452 | // verify again |
453 | - if ( ! $checkout instanceof EE_Checkout ) { |
|
454 | - throw new EE_Error( __( 'The EE_Checkout class could not be loaded.', 'event_espresso' ) ); |
|
453 | + if ( ! $checkout instanceof EE_Checkout) { |
|
454 | + throw new EE_Error(__('The EE_Checkout class could not be loaded.', 'event_espresso')); |
|
455 | 455 | } |
456 | 456 | } else { |
457 | - if ( $checkout->current_step->is_final_step() && $checkout->exit_spco() === true ) { |
|
458 | - wp_safe_redirect( $checkout->redirect_url ); |
|
457 | + if ($checkout->current_step->is_final_step() && $checkout->exit_spco() === true) { |
|
458 | + wp_safe_redirect($checkout->redirect_url); |
|
459 | 459 | exit(); |
460 | 460 | } |
461 | 461 | } |
462 | - $checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout ); |
|
462 | + $checkout = apply_filters('FHEE__EED_Single_Page_Checkout___initialize_checkout__checkout', $checkout); |
|
463 | 463 | // reset anything that needs a clean slate for each request |
464 | 464 | $checkout->reset_for_current_request(); |
465 | 465 | return $checkout; |
@@ -477,24 +477,24 @@ discard block |
||
477 | 477 | // load classes |
478 | 478 | EED_Single_Page_Checkout::load_request_handler(); |
479 | 479 | //make sure this request is marked as belonging to EE |
480 | - EE_Registry::instance()->REQ->set_espresso_page( TRUE ); |
|
480 | + EE_Registry::instance()->REQ->set_espresso_page(TRUE); |
|
481 | 481 | // which step is being requested ? |
482 | - $this->checkout->step = EE_Registry::instance()->REQ->get( 'step', $this->_get_first_step() ); |
|
482 | + $this->checkout->step = EE_Registry::instance()->REQ->get('step', $this->_get_first_step()); |
|
483 | 483 | // which step is being edited ? |
484 | - $this->checkout->edit_step = EE_Registry::instance()->REQ->get( 'edit_step', '' ); |
|
484 | + $this->checkout->edit_step = EE_Registry::instance()->REQ->get('edit_step', ''); |
|
485 | 485 | // and what we're doing on the current step |
486 | - $this->checkout->action = EE_Registry::instance()->REQ->get( 'action', 'display_spco_reg_step' ); |
|
486 | + $this->checkout->action = EE_Registry::instance()->REQ->get('action', 'display_spco_reg_step'); |
|
487 | 487 | // returning to edit ? |
488 | - $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' ); |
|
488 | + $this->checkout->reg_url_link = EE_Registry::instance()->REQ->get('e_reg_url_link', ''); |
|
489 | 489 | // or some other kind of revisit ? |
490 | - $this->checkout->revisit = EE_Registry::instance()->REQ->get( 'revisit', FALSE ); |
|
490 | + $this->checkout->revisit = EE_Registry::instance()->REQ->get('revisit', FALSE); |
|
491 | 491 | // and whether or not to generate a reg form for this request |
492 | - $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get( 'generate_reg_form', TRUE ); // TRUE FALSE |
|
492 | + $this->checkout->generate_reg_form = EE_Registry::instance()->REQ->get('generate_reg_form', TRUE); // TRUE FALSE |
|
493 | 493 | // and whether or not to process a reg form submission for this request |
494 | - $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get( 'process_form_submission', FALSE ); // TRUE FALSE |
|
494 | + $this->checkout->process_form_submission = EE_Registry::instance()->REQ->get('process_form_submission', FALSE); // TRUE FALSE |
|
495 | 495 | $this->checkout->process_form_submission = $this->checkout->action !== 'display_spco_reg_step' |
496 | 496 | ? $this->checkout->process_form_submission |
497 | - : FALSE; // TRUE FALSE |
|
497 | + : FALSE; // TRUE FALSE |
|
498 | 498 | //$this->_display_request_vars(); |
499 | 499 | } |
500 | 500 | |
@@ -507,17 +507,17 @@ discard block |
||
507 | 507 | * @return void |
508 | 508 | */ |
509 | 509 | protected function _display_request_vars() { |
510 | - if ( ! WP_DEBUG ) { |
|
510 | + if ( ! WP_DEBUG) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | - EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ ); |
|
514 | - EEH_Debug_Tools::printr( $this->checkout->step, '$this->checkout->step', __FILE__, __LINE__ ); |
|
515 | - EEH_Debug_Tools::printr( $this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__ ); |
|
516 | - EEH_Debug_Tools::printr( $this->checkout->action, '$this->checkout->action', __FILE__, __LINE__ ); |
|
517 | - EEH_Debug_Tools::printr( $this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__ ); |
|
518 | - EEH_Debug_Tools::printr( $this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__ ); |
|
519 | - EEH_Debug_Tools::printr( $this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__ ); |
|
520 | - EEH_Debug_Tools::printr( $this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__ ); |
|
513 | + EEH_Debug_Tools::printr($_REQUEST, '$_REQUEST', __FILE__, __LINE__); |
|
514 | + EEH_Debug_Tools::printr($this->checkout->step, '$this->checkout->step', __FILE__, __LINE__); |
|
515 | + EEH_Debug_Tools::printr($this->checkout->edit_step, '$this->checkout->edit_step', __FILE__, __LINE__); |
|
516 | + EEH_Debug_Tools::printr($this->checkout->action, '$this->checkout->action', __FILE__, __LINE__); |
|
517 | + EEH_Debug_Tools::printr($this->checkout->reg_url_link, '$this->checkout->reg_url_link', __FILE__, __LINE__); |
|
518 | + EEH_Debug_Tools::printr($this->checkout->revisit, '$this->checkout->revisit', __FILE__, __LINE__); |
|
519 | + EEH_Debug_Tools::printr($this->checkout->generate_reg_form, '$this->checkout->generate_reg_form', __FILE__, __LINE__); |
|
520 | + EEH_Debug_Tools::printr($this->checkout->process_form_submission, '$this->checkout->process_form_submission', __FILE__, __LINE__); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | * @return array |
532 | 532 | */ |
533 | 533 | private function _get_first_step() { |
534 | - $first_step = reset( EED_Single_Page_Checkout::$_reg_steps_array ); |
|
535 | - return isset( $first_step['slug'] ) ? $first_step['slug'] : 'attendee_information'; |
|
534 | + $first_step = reset(EED_Single_Page_Checkout::$_reg_steps_array); |
|
535 | + return isset($first_step['slug']) ? $first_step['slug'] : 'attendee_information'; |
|
536 | 536 | } |
537 | 537 | |
538 | 538 | |
@@ -548,27 +548,27 @@ discard block |
||
548 | 548 | private function _load_and_instantiate_reg_steps() { |
549 | 549 | // have reg_steps already been instantiated ? |
550 | 550 | if ( |
551 | - empty( $this->checkout->reg_steps ) || |
|
552 | - apply_filters( 'FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout ) |
|
551 | + empty($this->checkout->reg_steps) || |
|
552 | + apply_filters('FHEE__Single_Page_Checkout__load_reg_steps__reload_reg_steps', false, $this->checkout) |
|
553 | 553 | ) { |
554 | 554 | // if not, then loop through raw reg steps array |
555 | - foreach ( EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step ) { |
|
556 | - if ( ! $this->_load_and_instantiate_reg_step( $reg_step, $order )) { |
|
555 | + foreach (EED_Single_Page_Checkout::$_reg_steps_array as $order => $reg_step) { |
|
556 | + if ( ! $this->_load_and_instantiate_reg_step($reg_step, $order)) { |
|
557 | 557 | return false; |
558 | 558 | } |
559 | 559 | } |
560 | 560 | EE_Registry::instance()->CFG->registration->skip_reg_confirmation = TRUE; |
561 | 561 | EE_Registry::instance()->CFG->registration->reg_confirmation_last = TRUE; |
562 | 562 | // skip the registration_confirmation page ? |
563 | - if ( EE_Registry::instance()->CFG->registration->skip_reg_confirmation ) { |
|
563 | + if (EE_Registry::instance()->CFG->registration->skip_reg_confirmation) { |
|
564 | 564 | // just remove it from the reg steps array |
565 | - $this->checkout->remove_reg_step( 'registration_confirmation', false ); |
|
565 | + $this->checkout->remove_reg_step('registration_confirmation', false); |
|
566 | 566 | } else if ( |
567 | 567 | EE_Registry::instance()->CFG->registration->reg_confirmation_last |
568 | - && isset( $this->checkout->reg_steps['registration_confirmation'] ) |
|
568 | + && isset($this->checkout->reg_steps['registration_confirmation']) |
|
569 | 569 | ) { |
570 | 570 | // set the order to something big like 100 |
571 | - $this->checkout->set_reg_step_order( 'registration_confirmation', 100 ); |
|
571 | + $this->checkout->set_reg_step_order('registration_confirmation', 100); |
|
572 | 572 | } |
573 | 573 | // filter the array for good luck |
574 | 574 | $this->checkout->reg_steps = apply_filters( |
@@ -578,13 +578,13 @@ discard block |
||
578 | 578 | // finally re-sort based on the reg step class order properties |
579 | 579 | $this->checkout->sort_reg_steps(); |
580 | 580 | } else { |
581 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
581 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
582 | 582 | // set all current step stati to FALSE |
583 | - $reg_step->set_is_current_step( FALSE ); |
|
583 | + $reg_step->set_is_current_step(FALSE); |
|
584 | 584 | } |
585 | 585 | } |
586 | - if ( empty( $this->checkout->reg_steps )) { |
|
587 | - EE_Error::add_error( __( 'No Reg Steps were loaded..', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
586 | + if (empty($this->checkout->reg_steps)) { |
|
587 | + EE_Error::add_error(__('No Reg Steps were loaded..', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
588 | 588 | return false; |
589 | 589 | } |
590 | 590 | // make reg step details available to JS |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | * @param int $order |
603 | 603 | * @return bool |
604 | 604 | */ |
605 | - private function _load_and_instantiate_reg_step( $reg_step = array(), $order = 0 ) { |
|
605 | + private function _load_and_instantiate_reg_step($reg_step = array(), $order = 0) { |
|
606 | 606 | |
607 | 607 | // we need a file_path, class_name, and slug to add a reg step |
608 | - if ( isset( $reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'] )) { |
|
608 | + if (isset($reg_step['file_path'], $reg_step['class_name'], $reg_step['slug'])) { |
|
609 | 609 | // if editing a specific step, but this is NOT that step... (and it's not the 'finalize_registration' step) |
610 | 610 | if ( |
611 | 611 | $this->checkout->reg_url_link |
@@ -623,26 +623,26 @@ discard block |
||
623 | 623 | FALSE |
624 | 624 | ); |
625 | 625 | // did we gets the goods ? |
626 | - if ( $reg_step_obj instanceof EE_SPCO_Reg_Step ) { |
|
626 | + if ($reg_step_obj instanceof EE_SPCO_Reg_Step) { |
|
627 | 627 | // set reg step order based on config |
628 | - $reg_step_obj->set_order( $order ); |
|
628 | + $reg_step_obj->set_order($order); |
|
629 | 629 | // add instantiated reg step object to the master reg steps array |
630 | - $this->checkout->add_reg_step( $reg_step_obj ); |
|
630 | + $this->checkout->add_reg_step($reg_step_obj); |
|
631 | 631 | } else { |
632 | 632 | EE_Error::add_error( |
633 | - __( 'The current step could not be set.', 'event_espresso' ), |
|
633 | + __('The current step could not be set.', 'event_espresso'), |
|
634 | 634 | __FILE__, __FUNCTION__, __LINE__ |
635 | 635 | ); |
636 | 636 | return false; |
637 | 637 | } |
638 | 638 | } else { |
639 | - if ( WP_DEBUG ) { |
|
639 | + if (WP_DEBUG) { |
|
640 | 640 | EE_Error::add_error( |
641 | 641 | sprintf( |
642 | - __( 'A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso' ), |
|
643 | - isset( $reg_step['file_path'] ) ? $reg_step['file_path'] : '', |
|
644 | - isset( $reg_step['class_name'] ) ? $reg_step['class_name'] : '', |
|
645 | - isset( $reg_step['slug'] ) ? $reg_step['slug'] : '', |
|
642 | + __('A registration step could not be loaded. One or more of the following data points is invalid:%4$s%5$sFile Path: %1$s%6$s%5$sClass Name: %2$s%6$s%5$sSlug: %3$s%6$s%7$s', 'event_espresso'), |
|
643 | + isset($reg_step['file_path']) ? $reg_step['file_path'] : '', |
|
644 | + isset($reg_step['class_name']) ? $reg_step['class_name'] : '', |
|
645 | + isset($reg_step['slug']) ? $reg_step['slug'] : '', |
|
646 | 646 | '<ul>', |
647 | 647 | '<li>', |
648 | 648 | '</li>', |
@@ -666,16 +666,16 @@ discard block |
||
666 | 666 | */ |
667 | 667 | private function _get_transaction_and_cart_for_previous_visit() { |
668 | 668 | /** @var $TXN_model EEM_Transaction */ |
669 | - $TXN_model = EE_Registry::instance()->load_model( 'Transaction' ); |
|
669 | + $TXN_model = EE_Registry::instance()->load_model('Transaction'); |
|
670 | 670 | // because the reg_url_link is present in the request, this is a return visit to SPCO, so we'll get the transaction data from the db |
671 | - $transaction = $TXN_model->get_transaction_from_reg_url_link( $this->checkout->reg_url_link ); |
|
671 | + $transaction = $TXN_model->get_transaction_from_reg_url_link($this->checkout->reg_url_link); |
|
672 | 672 | // verify transaction |
673 | - if ( $transaction instanceof EE_Transaction ) { |
|
673 | + if ($transaction instanceof EE_Transaction) { |
|
674 | 674 | // and get the cart that was used for that transaction |
675 | - $this->checkout->cart = $this->_get_cart_for_transaction( $transaction ); |
|
675 | + $this->checkout->cart = $this->_get_cart_for_transaction($transaction); |
|
676 | 676 | return $transaction; |
677 | 677 | } else { |
678 | - EE_Error::add_error( __( 'Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
678 | + EE_Error::add_error(__('Your Registration and Transaction information could not be retrieved from the db.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
679 | 679 | return NULL; |
680 | 680 | } |
681 | 681 | } |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | * @param EE_Transaction $transaction |
690 | 690 | * @return EE_Cart |
691 | 691 | */ |
692 | - private function _get_cart_for_transaction( $transaction ) { |
|
693 | - $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn( $transaction ) : NULL; |
|
692 | + private function _get_cart_for_transaction($transaction) { |
|
693 | + $cart = $transaction instanceof EE_Transaction ? EE_Cart::get_cart_from_txn($transaction) : NULL; |
|
694 | 694 | // verify cart |
695 | - if ( ! $cart instanceof EE_Cart ) { |
|
696 | - $cart = EE_Registry::instance()->load_core( 'Cart' ); |
|
695 | + if ( ! $cart instanceof EE_Cart) { |
|
696 | + $cart = EE_Registry::instance()->load_core('Cart'); |
|
697 | 697 | } |
698 | 698 | return $cart; |
699 | 699 | } |
@@ -708,8 +708,8 @@ discard block |
||
708 | 708 | * @param EE_Transaction $transaction |
709 | 709 | * @return EE_Cart |
710 | 710 | */ |
711 | - public function get_cart_for_transaction( EE_Transaction $transaction ) { |
|
712 | - return EE_Cart::get_cart_from_txn( $transaction ); |
|
711 | + public function get_cart_for_transaction(EE_Transaction $transaction) { |
|
712 | + return EE_Cart::get_cart_from_txn($transaction); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -724,17 +724,17 @@ discard block |
||
724 | 724 | private function _get_cart_for_current_session_and_setup_new_transaction() { |
725 | 725 | // if there's no transaction, then this is the FIRST visit to SPCO |
726 | 726 | // so load up the cart ( passing nothing for the TXN because it doesn't exist yet ) |
727 | - $this->checkout->cart = $this->_get_cart_for_transaction( NULL ); |
|
727 | + $this->checkout->cart = $this->_get_cart_for_transaction(NULL); |
|
728 | 728 | // and then create a new transaction |
729 | 729 | $transaction = $this->_initialize_transaction(); |
730 | 730 | // verify transaction |
731 | - if ( $transaction instanceof EE_Transaction ) { |
|
731 | + if ($transaction instanceof EE_Transaction) { |
|
732 | 732 | // save it so that we have an ID for other objects to use |
733 | 733 | $transaction->save(); |
734 | 734 | // and save TXN data to the cart |
735 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $transaction->ID() ); |
|
735 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($transaction->ID()); |
|
736 | 736 | } else { |
737 | - EE_Error::add_error( __( 'A Valid Transaction could not be initialized.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
737 | + EE_Error::add_error(__('A Valid Transaction could not be initialized.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
738 | 738 | } |
739 | 739 | return $transaction; |
740 | 740 | } |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | // grab the cart grand total |
755 | 755 | $cart_total = $this->checkout->cart->get_cart_grand_total(); |
756 | 756 | // create new TXN |
757 | - return EE_Transaction::new_instance( array( |
|
757 | + return EE_Transaction::new_instance(array( |
|
758 | 758 | 'TXN_timestamp' => time(), |
759 | 759 | 'TXN_reg_steps' => $this->checkout->initialize_txn_reg_steps_array(), |
760 | 760 | 'TXN_total' => $cart_total > 0 ? $cart_total : 0, |
761 | 761 | 'TXN_paid' => 0, |
762 | 762 | 'STS_ID' => EEM_Transaction::failed_status_code, |
763 | 763 | )); |
764 | - } catch( Exception $e ) { |
|
765 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
764 | + } catch (Exception $e) { |
|
765 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
766 | 766 | } |
767 | 767 | return NULL; |
768 | 768 | } |
@@ -776,34 +776,34 @@ discard block |
||
776 | 776 | * @param EE_Transaction $transaction |
777 | 777 | * @return EE_Cart |
778 | 778 | */ |
779 | - private function _get_registrations( EE_Transaction $transaction ) { |
|
779 | + private function _get_registrations(EE_Transaction $transaction) { |
|
780 | 780 | // first step: grab the registrants { : o |
781 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, true ); |
|
781 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true); |
|
782 | 782 | // verify registrations have been set |
783 | - if ( empty( $registrations )) { |
|
783 | + if (empty($registrations)) { |
|
784 | 784 | // if no cached registrations, then check the db |
785 | - $registrations = $transaction->registrations( $this->checkout->reg_cache_where_params, false ); |
|
785 | + $registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false); |
|
786 | 786 | // still nothing ? well as long as this isn't a revisit |
787 | - if ( empty( $registrations ) && ! $this->checkout->revisit ) { |
|
787 | + if (empty($registrations) && ! $this->checkout->revisit) { |
|
788 | 788 | // generate new registrations from scratch |
789 | - $registrations = $this->_initialize_registrations( $transaction ); |
|
789 | + $registrations = $this->_initialize_registrations($transaction); |
|
790 | 790 | } |
791 | 791 | } |
792 | 792 | // sort by their original registration order |
793 | - usort( $registrations, array( 'EED_Single_Page_Checkout', 'sort_registrations_by_REG_count' )); |
|
793 | + usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count')); |
|
794 | 794 | // then loop thru the array |
795 | - foreach ( $registrations as $registration ) { |
|
795 | + foreach ($registrations as $registration) { |
|
796 | 796 | // verify each registration |
797 | - if ( $registration instanceof EE_Registration ) { |
|
797 | + if ($registration instanceof EE_Registration) { |
|
798 | 798 | // we display all attendee info for the primary registrant |
799 | - if ( $this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant() ) { |
|
799 | + if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) { |
|
800 | 800 | $this->checkout->primary_revisit = TRUE; |
801 | 801 | break; |
802 | - } else if ( $this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link() ) { |
|
802 | + } else if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) { |
|
803 | 803 | // but hide info if it doesn't belong to you |
804 | - $transaction->clear_cache( 'Registration', $registration->ID() ); |
|
804 | + $transaction->clear_cache('Registration', $registration->ID()); |
|
805 | 805 | } |
806 | - $this->checkout->set_reg_status_updated( $registration->ID(), false ); |
|
806 | + $this->checkout->set_reg_status_updated($registration->ID(), false); |
|
807 | 807 | } |
808 | 808 | } |
809 | 809 | } |
@@ -817,17 +817,17 @@ discard block |
||
817 | 817 | * @param EE_Transaction $transaction |
818 | 818 | * @return array |
819 | 819 | */ |
820 | - private function _initialize_registrations( EE_Transaction $transaction ) { |
|
820 | + private function _initialize_registrations(EE_Transaction $transaction) { |
|
821 | 821 | $att_nmbr = 0; |
822 | 822 | $registrations = array(); |
823 | - if ( $transaction instanceof EE_Transaction ) { |
|
823 | + if ($transaction instanceof EE_Transaction) { |
|
824 | 824 | /** @type EE_Registration_Processor $registration_processor */ |
825 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
825 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
826 | 826 | $this->checkout->total_ticket_count = $this->checkout->cart->all_ticket_quantity_count(); |
827 | 827 | // now let's add the cart items to the $transaction |
828 | - foreach ( $this->checkout->cart->get_tickets() as $line_item ) { |
|
828 | + foreach ($this->checkout->cart->get_tickets() as $line_item) { |
|
829 | 829 | //do the following for each ticket of this type they selected |
830 | - for ( $x = 1; $x <= $line_item->quantity(); $x++ ) { |
|
830 | + for ($x = 1; $x <= $line_item->quantity(); $x++) { |
|
831 | 831 | $att_nmbr++; |
832 | 832 | $registration = $registration_processor->generate_ONE_registration_from_line_item( |
833 | 833 | $line_item, |
@@ -835,12 +835,12 @@ discard block |
||
835 | 835 | $att_nmbr, |
836 | 836 | $this->checkout->total_ticket_count |
837 | 837 | ); |
838 | - if ( $registration instanceof EE_Registration ) { |
|
839 | - $registrations[ $registration->ID() ] = $registration; |
|
838 | + if ($registration instanceof EE_Registration) { |
|
839 | + $registrations[$registration->ID()] = $registration; |
|
840 | 840 | } |
841 | 841 | } |
842 | 842 | } |
843 | - $registration_processor->fix_reg_final_price_rounding_issue( $transaction ); |
|
843 | + $registration_processor->fix_reg_final_price_rounding_issue($transaction); |
|
844 | 844 | } |
845 | 845 | return $registrations; |
846 | 846 | } |
@@ -855,12 +855,12 @@ discard block |
||
855 | 855 | * @param EE_Registration $reg_B |
856 | 856 | * @return array() |
857 | 857 | */ |
858 | - public static function sort_registrations_by_REG_count( EE_Registration $reg_A, EE_Registration $reg_B ) { |
|
858 | + public static function sort_registrations_by_REG_count(EE_Registration $reg_A, EE_Registration $reg_B) { |
|
859 | 859 | // this shouldn't ever happen within the same TXN, but oh well |
860 | - if ( $reg_A->count() == $reg_B->count() ) { |
|
860 | + if ($reg_A->count() == $reg_B->count()) { |
|
861 | 861 | return 0; |
862 | 862 | } |
863 | - return ( $reg_A->count() > $reg_B->count() ) ? 1 : -1; |
|
863 | + return ($reg_A->count() > $reg_B->count()) ? 1 : -1; |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | |
@@ -875,35 +875,35 @@ discard block |
||
875 | 875 | */ |
876 | 876 | private function _final_verifications() { |
877 | 877 | // filter checkout |
878 | - $this->checkout = apply_filters( 'FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout ); |
|
878 | + $this->checkout = apply_filters('FHEE__EED_Single_Page_Checkout___final_verifications__checkout', $this->checkout); |
|
879 | 879 | //verify that current step is still set correctly |
880 | - if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step ) { |
|
881 | - EE_Error::add_error( __( 'We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
880 | + if ( ! $this->checkout->current_step instanceof EE_SPCO_Reg_Step) { |
|
881 | + EE_Error::add_error(__('We\'re sorry but the registration process can not proceed because one or more registration steps were not setup correctly. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
882 | 882 | return false; |
883 | 883 | } |
884 | 884 | // if returning to SPCO, then verify that primary registrant is set |
885 | - if ( ! empty( $this->checkout->reg_url_link )) { |
|
885 | + if ( ! empty($this->checkout->reg_url_link)) { |
|
886 | 886 | $valid_registrant = $this->checkout->transaction->primary_registration(); |
887 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
888 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
887 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
888 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the primary registrant for this transaction. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
889 | 889 | return false; |
890 | 890 | } |
891 | 891 | $valid_registrant = null; |
892 | - foreach ( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) as $registration ) { |
|
893 | - if ( $registration instanceof EE_Registration ) { |
|
894 | - if ( $registration->reg_url_link() == $this->checkout->reg_url_link ) { |
|
892 | + foreach ($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params) as $registration) { |
|
893 | + if ($registration instanceof EE_Registration) { |
|
894 | + if ($registration->reg_url_link() == $this->checkout->reg_url_link) { |
|
895 | 895 | $valid_registrant = $registration; |
896 | 896 | } |
897 | 897 | } |
898 | 898 | } |
899 | - if ( ! $valid_registrant instanceof EE_Registration ) { |
|
900 | - EE_Error::add_error( __( 'We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
899 | + if ( ! $valid_registrant instanceof EE_Registration) { |
|
900 | + EE_Error::add_error(__('We\'re sorry but there appears to be an error with the "reg_url_link" or the transaction itself. Please refresh the page and try again or contact support.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | } |
904 | 904 | // now that things have been kinda sufficiently verified, |
905 | 905 | // let's add the checkout to the session so that's available other systems |
906 | - EE_Registry::instance()->SSN->set_checkout( $this->checkout ); |
|
906 | + EE_Registry::instance()->SSN->set_checkout($this->checkout); |
|
907 | 907 | return true; |
908 | 908 | } |
909 | 909 | |
@@ -919,28 +919,28 @@ discard block |
||
919 | 919 | * @access private |
920 | 920 | * @param bool $reinitializing |
921 | 921 | */ |
922 | - private function _initialize_reg_steps( $reinitializing = false ) { |
|
923 | - $this->checkout->set_reg_step_initiated( $this->checkout->current_step ); |
|
922 | + private function _initialize_reg_steps($reinitializing = false) { |
|
923 | + $this->checkout->set_reg_step_initiated($this->checkout->current_step); |
|
924 | 924 | // loop thru all steps to call their individual "initialize" methods and set i18n strings for JS |
925 | - foreach ( $this->checkout->reg_steps as $reg_step ) { |
|
926 | - if ( ! $reg_step->initialize_reg_step() ) { |
|
925 | + foreach ($this->checkout->reg_steps as $reg_step) { |
|
926 | + if ( ! $reg_step->initialize_reg_step()) { |
|
927 | 927 | // if not initialized then maybe this step is being removed... |
928 | - if ( $reg_step->is_current_step() && ! $reinitializing ) { |
|
928 | + if ($reg_step->is_current_step() && ! $reinitializing) { |
|
929 | 929 | // if it was the current step, then we need to start over here |
930 | - $this->_initialize_reg_steps( true ); |
|
930 | + $this->_initialize_reg_steps(true); |
|
931 | 931 | return; |
932 | 932 | } |
933 | 933 | continue; |
934 | 934 | } |
935 | 935 | // i18n |
936 | 936 | $reg_step->translate_js_strings(); |
937 | - if ( $reg_step->is_current_step() ) { |
|
937 | + if ($reg_step->is_current_step()) { |
|
938 | 938 | // the text that appears on the reg step form submit button |
939 | 939 | $reg_step->set_submit_button_text(); |
940 | 940 | } |
941 | 941 | } |
942 | 942 | // dynamically creates hook point like: AHEE__Single_Page_Checkout___initialize_reg_step__attendee_information |
943 | - do_action( "AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step ); |
|
943 | + do_action("AHEE__Single_Page_Checkout___initialize_reg_step__{$this->checkout->current_step->slug()}", $this->checkout->current_step); |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | |
@@ -953,39 +953,39 @@ discard block |
||
953 | 953 | */ |
954 | 954 | private function _check_form_submission() { |
955 | 955 | //does this request require the reg form to be generated ? |
956 | - if ( $this->checkout->generate_reg_form ) { |
|
956 | + if ($this->checkout->generate_reg_form) { |
|
957 | 957 | // ever heard that song by Blue Rodeo ? |
958 | 958 | try { |
959 | 959 | $this->checkout->current_step->reg_form = $this->checkout->current_step->generate_reg_form(); |
960 | 960 | // if not displaying a form, then check for form submission |
961 | - if ( $this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted() ) { |
|
961 | + if ($this->checkout->process_form_submission && $this->checkout->current_step->reg_form->was_submitted()) { |
|
962 | 962 | // clear out any old data in case this step is being run again |
963 | - $this->checkout->current_step->set_valid_data( array() ); |
|
963 | + $this->checkout->current_step->set_valid_data(array()); |
|
964 | 964 | // capture submitted form data |
965 | 965 | $this->checkout->current_step->reg_form->receive_form_submission( |
966 | - apply_filters( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout ) |
|
966 | + apply_filters('FHEE__Single_Page_Checkout___check_form_submission__request_params', EE_Registry::instance()->REQ->params(), $this->checkout) |
|
967 | 967 | ); |
968 | 968 | // validate submitted form data |
969 | - if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg ) { |
|
969 | + if ( ! $this->checkout->current_step->reg_form->is_valid() || ! $this->checkout->continue_reg) { |
|
970 | 970 | // thou shall not pass !!! |
971 | 971 | $this->checkout->continue_reg = FALSE; |
972 | 972 | // any form validation errors? |
973 | - if ( $this->checkout->current_step->reg_form->submission_error_message() != '' ) { |
|
973 | + if ($this->checkout->current_step->reg_form->submission_error_message() != '') { |
|
974 | 974 | $submission_error_messages = array(); |
975 | 975 | // bad, bad, bad registrant |
976 | - foreach( $this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error ){ |
|
977 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
978 | - $submission_error_messages[] = sprintf( __( '%s : %s', 'event_espresso' ), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage() ); |
|
976 | + foreach ($this->checkout->current_step->reg_form->get_validation_errors_accumulated() as $validation_error) { |
|
977 | + if ($validation_error instanceof EE_Validation_Error) { |
|
978 | + $submission_error_messages[] = sprintf(__('%s : %s', 'event_espresso'), $validation_error->get_form_section()->html_label_text(), $validation_error->getMessage()); |
|
979 | 979 | } |
980 | 980 | } |
981 | - EE_Error::add_error( join( '<br />', $submission_error_messages ), __FILE__, __FUNCTION__, __LINE__ ); |
|
981 | + EE_Error::add_error(join('<br />', $submission_error_messages), __FILE__, __FUNCTION__, __LINE__); |
|
982 | 982 | } |
983 | 983 | // well not really... what will happen is we'll just get redirected back to redo the current step |
984 | 984 | $this->go_to_next_step(); |
985 | 985 | return; |
986 | 986 | } |
987 | 987 | } |
988 | - } catch( EE_Error $e ) { |
|
988 | + } catch (EE_Error $e) { |
|
989 | 989 | $e->get_error(); |
990 | 990 | } |
991 | 991 | } |
@@ -1001,38 +1001,38 @@ discard block |
||
1001 | 1001 | */ |
1002 | 1002 | private function _process_form_action() { |
1003 | 1003 | // what cha wanna do? |
1004 | - switch( $this->checkout->action ) { |
|
1004 | + switch ($this->checkout->action) { |
|
1005 | 1005 | // AJAX next step reg form |
1006 | 1006 | case 'display_spco_reg_step' : |
1007 | 1007 | $this->checkout->redirect = FALSE; |
1008 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1009 | - $this->checkout->json_response->set_reg_step_html( $this->checkout->current_step->display_reg_form() ); |
|
1008 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1009 | + $this->checkout->json_response->set_reg_step_html($this->checkout->current_step->display_reg_form()); |
|
1010 | 1010 | } |
1011 | 1011 | break; |
1012 | 1012 | |
1013 | 1013 | default : |
1014 | 1014 | // meh... do one of those other steps first |
1015 | - if ( ! empty( $this->checkout->action ) && is_callable( array( $this->checkout->current_step, $this->checkout->action ))) { |
|
1015 | + if ( ! empty($this->checkout->action) && is_callable(array($this->checkout->current_step, $this->checkout->action))) { |
|
1016 | 1016 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__before_attendee_information__process_reg_step |
1017 | - do_action( "AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1017 | + do_action("AHEE__Single_Page_Checkout__before_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1018 | 1018 | // call action on current step |
1019 | - if ( call_user_func( array( $this->checkout->current_step, $this->checkout->action )) ) { |
|
1019 | + if (call_user_func(array($this->checkout->current_step, $this->checkout->action))) { |
|
1020 | 1020 | // good registrant, you get to proceed |
1021 | - if ( $this->checkout->current_step->success_message() != '' ) { |
|
1022 | - if ( apply_filters( 'FHEE__Single_Page_Checkout___process_form_action__display_success', false ) ) { |
|
1023 | - EE_Error::add_success( $this->checkout->current_step->success_message() . '<br />' . $this->checkout->next_step->_instructions() ); |
|
1021 | + if ($this->checkout->current_step->success_message() != '') { |
|
1022 | + if (apply_filters('FHEE__Single_Page_Checkout___process_form_action__display_success', false)) { |
|
1023 | + EE_Error::add_success($this->checkout->current_step->success_message().'<br />'.$this->checkout->next_step->_instructions()); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | // pack it up, pack it in... |
1027 | 1027 | $this->_setup_redirect(); |
1028 | 1028 | } |
1029 | 1029 | // dynamically creates hook point like: AHEE__Single_Page_Checkout__after_payment_options__process_reg_step |
1030 | - do_action( "AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step ); |
|
1030 | + do_action("AHEE__Single_Page_Checkout__after_{$this->checkout->current_step->slug()}__{$this->checkout->action}", $this->checkout->current_step); |
|
1031 | 1031 | |
1032 | 1032 | } else { |
1033 | 1033 | EE_Error::add_error( |
1034 | 1034 | sprintf( |
1035 | - __( 'The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso' ), |
|
1035 | + __('The requested form action "%s" does not exist for the current "%s" registration step.', 'event_espresso'), |
|
1036 | 1036 | $this->checkout->action, |
1037 | 1037 | $this->checkout->current_step->name() |
1038 | 1038 | ), |
@@ -1058,10 +1058,10 @@ discard block |
||
1058 | 1058 | public function add_styles_and_scripts() { |
1059 | 1059 | // i18n |
1060 | 1060 | $this->translate_js_strings(); |
1061 | - if ( $this->checkout->admin_request ) { |
|
1062 | - add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10 ); |
|
1061 | + if ($this->checkout->admin_request) { |
|
1062 | + add_action('admin_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1063 | 1063 | } else { |
1064 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles_and_scripts' ), 10 ); |
|
1064 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles_and_scripts'), 10); |
|
1065 | 1065 | } |
1066 | 1066 | } |
1067 | 1067 | |
@@ -1077,42 +1077,42 @@ discard block |
||
1077 | 1077 | EE_Registry::$i18n_js_strings['revisit'] = $this->checkout->revisit; |
1078 | 1078 | EE_Registry::$i18n_js_strings['e_reg_url_link'] = $this->checkout->reg_url_link; |
1079 | 1079 | EE_Registry::$i18n_js_strings['server_error'] = __('An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
1080 | - EE_Registry::$i18n_js_strings['invalid_json_response'] = __( 'An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1081 | - EE_Registry::$i18n_js_strings['validation_error'] = __( 'There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
1082 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
1080 | + EE_Registry::$i18n_js_strings['invalid_json_response'] = __('An invalid response was returned from the server while attempting to process your request. Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1081 | + EE_Registry::$i18n_js_strings['validation_error'] = __('There appears to be a problem with the form validation configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
1082 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('There appears to be a problem with the payment method configuration! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
1083 | 1083 | EE_Registry::$i18n_js_strings['reg_step_error'] = __('This registration step could not be completed. Please refresh the page and try again.', 'event_espresso'); |
1084 | 1084 | EE_Registry::$i18n_js_strings['invalid_coupon'] = __('We\'re sorry but that coupon code does not appear to be valid. If this is incorrect, please contact the site administrator.', 'event_espresso'); |
1085 | - EE_Registry::$i18n_js_strings['process_registration'] = sprintf( __( 'Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso' ), '<br/>', '<br/>' ); |
|
1086 | - EE_Registry::$i18n_js_strings['language'] = get_bloginfo( 'language' ); |
|
1085 | + EE_Registry::$i18n_js_strings['process_registration'] = sprintf(__('Please wait while we process your registration.%sDo not refresh the page or navigate away while this is happening.%sThank you for your patience.', 'event_espresso'), '<br/>', '<br/>'); |
|
1086 | + EE_Registry::$i18n_js_strings['language'] = get_bloginfo('language'); |
|
1087 | 1087 | EE_Registry::$i18n_js_strings['EESID'] = EE_Registry::instance()->SSN->id(); |
1088 | 1088 | EE_Registry::$i18n_js_strings['currency'] = EE_Registry::instance()->CFG->currency; |
1089 | 1089 | EE_Registry::$i18n_js_strings['datepicker_yearRange'] = '-150:+20'; |
1090 | - EE_Registry::$i18n_js_strings['timer_years'] = __( 'years', 'event_espresso' ); |
|
1091 | - EE_Registry::$i18n_js_strings['timer_months'] = __( 'months', 'event_espresso' ); |
|
1092 | - EE_Registry::$i18n_js_strings['timer_weeks'] = __( 'weeks', 'event_espresso' ); |
|
1093 | - EE_Registry::$i18n_js_strings['timer_days'] = __( 'days', 'event_espresso' ); |
|
1094 | - EE_Registry::$i18n_js_strings['timer_hours'] = __( 'hours', 'event_espresso' ); |
|
1095 | - EE_Registry::$i18n_js_strings['timer_minutes'] = __( 'minutes', 'event_espresso' ); |
|
1096 | - EE_Registry::$i18n_js_strings['timer_seconds'] = __( 'seconds', 'event_espresso' ); |
|
1097 | - EE_Registry::$i18n_js_strings['timer_year'] = __( 'year', 'event_espresso' ); |
|
1098 | - EE_Registry::$i18n_js_strings['timer_month'] = __( 'month', 'event_espresso' ); |
|
1099 | - EE_Registry::$i18n_js_strings['timer_week'] = __( 'week', 'event_espresso' ); |
|
1100 | - EE_Registry::$i18n_js_strings['timer_day'] = __( 'day', 'event_espresso' ); |
|
1101 | - EE_Registry::$i18n_js_strings['timer_hour'] = __( 'hour', 'event_espresso' ); |
|
1102 | - EE_Registry::$i18n_js_strings['timer_minute'] = __( 'minute', 'event_espresso' ); |
|
1103 | - EE_Registry::$i18n_js_strings['timer_second'] = __( 'second', 'event_espresso' ); |
|
1090 | + EE_Registry::$i18n_js_strings['timer_years'] = __('years', 'event_espresso'); |
|
1091 | + EE_Registry::$i18n_js_strings['timer_months'] = __('months', 'event_espresso'); |
|
1092 | + EE_Registry::$i18n_js_strings['timer_weeks'] = __('weeks', 'event_espresso'); |
|
1093 | + EE_Registry::$i18n_js_strings['timer_days'] = __('days', 'event_espresso'); |
|
1094 | + EE_Registry::$i18n_js_strings['timer_hours'] = __('hours', 'event_espresso'); |
|
1095 | + EE_Registry::$i18n_js_strings['timer_minutes'] = __('minutes', 'event_espresso'); |
|
1096 | + EE_Registry::$i18n_js_strings['timer_seconds'] = __('seconds', 'event_espresso'); |
|
1097 | + EE_Registry::$i18n_js_strings['timer_year'] = __('year', 'event_espresso'); |
|
1098 | + EE_Registry::$i18n_js_strings['timer_month'] = __('month', 'event_espresso'); |
|
1099 | + EE_Registry::$i18n_js_strings['timer_week'] = __('week', 'event_espresso'); |
|
1100 | + EE_Registry::$i18n_js_strings['timer_day'] = __('day', 'event_espresso'); |
|
1101 | + EE_Registry::$i18n_js_strings['timer_hour'] = __('hour', 'event_espresso'); |
|
1102 | + EE_Registry::$i18n_js_strings['timer_minute'] = __('minute', 'event_espresso'); |
|
1103 | + EE_Registry::$i18n_js_strings['timer_second'] = __('second', 'event_espresso'); |
|
1104 | 1104 | EE_Registry::$i18n_js_strings['registration_expiration_notice'] = sprintf( |
1105 | - __( '%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso' ), |
|
1105 | + __('%1$sWe\'re sorry, but your registration time has expired.%2$s%3$s%4$sIf you still wish to complete your registration, please return to the %5$sEvent List%6$sEvent List%7$s and reselect your tickets if available. Please except our apologies for any inconvenience this may have caused.%8$s', 'event_espresso'), |
|
1106 | 1106 | '<h4 class="important-notice">', |
1107 | 1107 | '</h4>', |
1108 | 1108 | '<br />', |
1109 | 1109 | '<p>', |
1110 | - '<a href="'. get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1110 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1111 | 1111 | '">', |
1112 | 1112 | '</a>', |
1113 | 1113 | '</p>' |
1114 | 1114 | ); |
1115 | - EE_Registry::$i18n_js_strings[ 'ajax_submit' ] = apply_filters( 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true ); |
|
1115 | + EE_Registry::$i18n_js_strings['ajax_submit'] = apply_filters('FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', true); |
|
1116 | 1116 | } |
1117 | 1117 | |
1118 | 1118 | |
@@ -1125,25 +1125,25 @@ discard block |
||
1125 | 1125 | */ |
1126 | 1126 | public function enqueue_styles_and_scripts() { |
1127 | 1127 | // load css |
1128 | - wp_register_style( 'single_page_checkout', SPCO_CSS_URL . 'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1129 | - wp_enqueue_style( 'single_page_checkout' ); |
|
1128 | + wp_register_style('single_page_checkout', SPCO_CSS_URL.'single_page_checkout.css', array(), EVENT_ESPRESSO_VERSION); |
|
1129 | + wp_enqueue_style('single_page_checkout'); |
|
1130 | 1130 | // load JS |
1131 | - wp_register_script( 'jquery_plugin', EE_THIRD_PARTY_URL . 'jquery .plugin.min.js', array( 'jquery' ), '1.0.1', TRUE ); |
|
1132 | - wp_register_script( 'jquery_countdown', EE_THIRD_PARTY_URL . 'jquery .countdown.min.js', array( 'jquery_plugin' ), '2.0.2', TRUE ); |
|
1133 | - wp_register_script( 'single_page_checkout', SPCO_JS_URL . 'single_page_checkout.js', array( 'espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
1134 | - wp_enqueue_script( 'single_page_checkout' ); |
|
1131 | + wp_register_script('jquery_plugin', EE_THIRD_PARTY_URL.'jquery .plugin.min.js', array('jquery'), '1.0.1', TRUE); |
|
1132 | + wp_register_script('jquery_countdown', EE_THIRD_PARTY_URL.'jquery .countdown.min.js', array('jquery_plugin'), '2.0.2', TRUE); |
|
1133 | + wp_register_script('single_page_checkout', SPCO_JS_URL.'single_page_checkout.js', array('espresso_core', 'underscore', 'ee_form_section_validation', 'jquery_countdown'), EVENT_ESPRESSO_VERSION, TRUE); |
|
1134 | + wp_enqueue_script('single_page_checkout'); |
|
1135 | 1135 | |
1136 | 1136 | /** |
1137 | 1137 | * global action hook for enqueueing styles and scripts with |
1138 | 1138 | * spco calls. |
1139 | 1139 | */ |
1140 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this ); |
|
1140 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts', $this); |
|
1141 | 1141 | |
1142 | 1142 | /** |
1143 | 1143 | * dynamic action hook for enqueueing styles and scripts with spco calls. |
1144 | 1144 | * The hook will end up being something like AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__attendee_information |
1145 | 1145 | */ |
1146 | - do_action( 'AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__' . $this->checkout->current_step->slug(), $this ); |
|
1146 | + do_action('AHEE__EED_Single_Page_Checkout__enqueue_styles_and_scripts__'.$this->checkout->current_step->slug(), $this); |
|
1147 | 1147 | |
1148 | 1148 | // add css and JS for current step |
1149 | 1149 | $this->checkout->current_step->enqueue_styles_and_scripts(); |
@@ -1159,20 +1159,20 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | private function _display_spco_reg_form() { |
1161 | 1161 | // if registering via the admin, just display the reg form for the current step |
1162 | - if ( $this->checkout->admin_request ) { |
|
1163 | - EE_Registry::instance()->REQ->add_output( $this->checkout->current_step->display_reg_form() ); |
|
1162 | + if ($this->checkout->admin_request) { |
|
1163 | + EE_Registry::instance()->REQ->add_output($this->checkout->current_step->display_reg_form()); |
|
1164 | 1164 | } else { |
1165 | 1165 | // add powered by EE msg |
1166 | - add_action( 'AHEE__SPCO__reg_form_footer', array( 'EED_Single_Page_Checkout', 'display_registration_footer' )); |
|
1166 | + add_action('AHEE__SPCO__reg_form_footer', array('EED_Single_Page_Checkout', 'display_registration_footer')); |
|
1167 | 1167 | |
1168 | - $empty_cart = count( $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ) ) < 1 ? true : false; |
|
1168 | + $empty_cart = count($this->checkout->transaction->registrations($this->checkout->reg_cache_where_params)) < 1 ? true : false; |
|
1169 | 1169 | $cookies_not_set_msg = ''; |
1170 | - if ( $empty_cart ) { |
|
1171 | - if ( ! isset( $_COOKIE[ 'ee_cookie_test' ] ) ) { |
|
1170 | + if ($empty_cart) { |
|
1171 | + if ( ! isset($_COOKIE['ee_cookie_test'])) { |
|
1172 | 1172 | $cookies_not_set_msg = apply_filters( |
1173 | 1173 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__cookies_not_set_msg', |
1174 | 1174 | sprintf( |
1175 | - __( '%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso' ), |
|
1175 | + __('%1$s%3$sIt appears your browser is not currently set to accept Cookies%4$s%5$sIn order to register for events, you need to enable cookies.%7$sIf you require assistance, then click the following link to learn how to %8$senable cookies%9$s%6$s%2$s', 'event_espresso'), |
|
1176 | 1176 | '<div class="ee-attention">', |
1177 | 1177 | '</div>', |
1178 | 1178 | '<h6 class="important-notice">', |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | 'layout_strategy' => |
1194 | 1194 | new EE_Template_Layout( |
1195 | 1195 | array( |
1196 | - 'layout_template_file' => SPCO_TEMPLATES_PATH . 'registration_page_wrapper.template.php', |
|
1196 | + 'layout_template_file' => SPCO_TEMPLATES_PATH.'registration_page_wrapper.template.php', |
|
1197 | 1197 | 'template_args' => array( |
1198 | 1198 | 'empty_cart' => $empty_cart, |
1199 | 1199 | 'revisit' => $this->checkout->revisit, |
@@ -1202,8 +1202,8 @@ discard block |
||
1202 | 1202 | 'empty_msg' => apply_filters( |
1203 | 1203 | 'FHEE__Single_Page_Checkout__display_spco_reg_form__empty_msg', |
1204 | 1204 | sprintf( |
1205 | - __( 'You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso' ), |
|
1206 | - '<a href="' . get_post_type_archive_link( 'espresso_events' ) . '" title="', |
|
1205 | + __('You need to %1$sReturn to Events list%2$sselect at least one event%3$s before you can proceed with the registration process.', 'event_espresso'), |
|
1206 | + '<a href="'.get_post_type_archive_link('espresso_events').'" title="', |
|
1207 | 1207 | '">', |
1208 | 1208 | '</a>' |
1209 | 1209 | ) |
@@ -1211,14 +1211,14 @@ discard block |
||
1211 | 1211 | 'cookies_not_set_msg' => $cookies_not_set_msg, |
1212 | 1212 | 'registration_time_limit' => $this->checkout->get_registration_time_limit(), |
1213 | 1213 | 'session_expiration' => |
1214 | - gmdate( 'M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) |
|
1214 | + gmdate('M d, Y H:i:s', EE_Registry::instance()->SSN->expiration() + (get_option('gmt_offset') * HOUR_IN_SECONDS)) |
|
1215 | 1215 | ) |
1216 | 1216 | ) |
1217 | 1217 | ) |
1218 | 1218 | ) |
1219 | 1219 | ); |
1220 | 1220 | // load template and add to output sent that gets filtered into the_content() |
1221 | - EE_Registry::instance()->REQ->add_output( $this->checkout->registration_form->get_html_and_js() ); |
|
1221 | + EE_Registry::instance()->REQ->add_output($this->checkout->registration_form->get_html_and_js()); |
|
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | |
@@ -1232,8 +1232,8 @@ discard block |
||
1232 | 1232 | * @internal param string $label |
1233 | 1233 | * @return string |
1234 | 1234 | */ |
1235 | - public function add_extra_finalize_registration_inputs( $next_step ) { |
|
1236 | - if ( $next_step == 'finalize_registration' ) { |
|
1235 | + public function add_extra_finalize_registration_inputs($next_step) { |
|
1236 | + if ($next_step == 'finalize_registration') { |
|
1237 | 1237 | echo '<div id="spco-extra-finalize_registration-inputs-dv"></div>'; |
1238 | 1238 | } |
1239 | 1239 | } |
@@ -1247,18 +1247,18 @@ discard block |
||
1247 | 1247 | * @return string |
1248 | 1248 | */ |
1249 | 1249 | public static function display_registration_footer() { |
1250 | - if ( apply_filters( 'FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer ) ) { |
|
1251 | - EE_Registry::instance()->CFG->admin->affiliate_id = ! empty( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | - $url = add_query_arg( array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id ), 'https://eventespresso.com/' ); |
|
1253 | - $url = apply_filters( 'FHEE__EE_Front_Controller__registration_footer__url', $url ); |
|
1250 | + if (apply_filters('FHEE__EE_Front__Controller__show_reg_footer', EE_Registry::instance()->CFG->admin->show_reg_footer)) { |
|
1251 | + EE_Registry::instance()->CFG->admin->affiliate_id = ! empty(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->affiliate_id : 'default'; |
|
1252 | + $url = add_query_arg(array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id), 'https://eventespresso.com/'); |
|
1253 | + $url = apply_filters('FHEE__EE_Front_Controller__registration_footer__url', $url); |
|
1254 | 1254 | echo apply_filters( |
1255 | 1255 | 'FHEE__EE_Front_Controller__display_registration_footer', |
1256 | 1256 | sprintf( |
1257 | - __( '%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso' ), |
|
1258 | - '<div id="espresso-registration-footer-dv"><a href="' . $url . '" title="', |
|
1257 | + __('%1$sEvent Registration Powered by Event Espresso%2$sEvent Registration and Ticketing%3$s Powered by %4$sEvent Espresso - Event Registration and Management System for WordPress%5$sEvent Espresso%6$s', 'event_espresso'), |
|
1258 | + '<div id="espresso-registration-footer-dv"><a href="'.$url.'" title="', |
|
1259 | 1259 | '" target="_blank">', |
1260 | 1260 | '</a>', |
1261 | - '<a href="' . $url . '" title="', |
|
1261 | + '<a href="'.$url.'" title="', |
|
1262 | 1262 | '" target="_blank">', |
1263 | 1263 | '</a></div>' |
1264 | 1264 | ) |
@@ -1289,12 +1289,12 @@ discard block |
||
1289 | 1289 | * @return array |
1290 | 1290 | */ |
1291 | 1291 | private function _setup_redirect() { |
1292 | - if ( $this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step ) { |
|
1292 | + if ($this->checkout->continue_reg && $this->checkout->next_step instanceof EE_SPCO_Reg_Step) { |
|
1293 | 1293 | $this->checkout->redirect = TRUE; |
1294 | - if ( empty( $this->checkout->redirect_url )) { |
|
1294 | + if (empty($this->checkout->redirect_url)) { |
|
1295 | 1295 | $this->checkout->redirect_url = $this->checkout->next_step->reg_step_url(); |
1296 | 1296 | } |
1297 | - $this->checkout->redirect_url = apply_filters( 'FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout ); |
|
1297 | + $this->checkout->redirect_url = apply_filters('FHEE__EED_Single_Page_Checkout___setup_redirect__checkout_redirect_url', $this->checkout->redirect_url, $this->checkout); |
|
1298 | 1298 | } |
1299 | 1299 | } |
1300 | 1300 | |
@@ -1307,12 +1307,12 @@ discard block |
||
1307 | 1307 | * @return void |
1308 | 1308 | */ |
1309 | 1309 | public function go_to_next_step() { |
1310 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1310 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1311 | 1311 | // capture contents of output buffer we started earlier in the request, and insert into JSON response |
1312 | - $this->checkout->json_response->set_unexpected_errors( ob_get_clean() ); |
|
1312 | + $this->checkout->json_response->set_unexpected_errors(ob_get_clean()); |
|
1313 | 1313 | } |
1314 | 1314 | // just return for these conditions |
1315 | - if ( $this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout' ) { |
|
1315 | + if ($this->checkout->admin_request || $this->checkout->action == 'redirect_form' || $this->checkout->action == 'update_checkout') { |
|
1316 | 1316 | return; |
1317 | 1317 | } |
1318 | 1318 | // AJAX response |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | */ |
1334 | 1334 | protected function _handle_json_response() { |
1335 | 1335 | // if this is an ajax request |
1336 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
1336 | + if (EE_Registry::instance()->REQ->ajax) { |
|
1337 | 1337 | // DEBUG LOG |
1338 | 1338 | //$this->checkout->log( |
1339 | 1339 | // __CLASS__, __FUNCTION__, __LINE__, |
@@ -1343,10 +1343,10 @@ discard block |
||
1343 | 1343 | // 'continue_reg' => $this->checkout->continue_reg, |
1344 | 1344 | // ) |
1345 | 1345 | //); |
1346 | - $this->checkout->json_response->set_registration_time_limit( $this->checkout->get_registration_time_limit() ); |
|
1347 | - $this->checkout->json_response->set_payment_amount( $this->checkout->amount_owing ); |
|
1346 | + $this->checkout->json_response->set_registration_time_limit($this->checkout->get_registration_time_limit()); |
|
1347 | + $this->checkout->json_response->set_payment_amount($this->checkout->amount_owing); |
|
1348 | 1348 | // just send the ajax ( |
1349 | - $json_response = apply_filters( 'FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response ); |
|
1349 | + $json_response = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $this->checkout->json_response); |
|
1350 | 1350 | $this->unlock_transaction(); |
1351 | 1351 | echo $json_response; |
1352 | 1352 | exit(); |
@@ -1363,9 +1363,9 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | protected function _handle_html_redirects() { |
1365 | 1365 | // going somewhere ? |
1366 | - if ( $this->checkout->redirect && ! empty( $this->checkout->redirect_url ) ) { |
|
1366 | + if ($this->checkout->redirect && ! empty($this->checkout->redirect_url)) { |
|
1367 | 1367 | // store notices in a transient |
1368 | - EE_Error::get_notices( false, true, true ); |
|
1368 | + EE_Error::get_notices(false, true, true); |
|
1369 | 1369 | $this->unlock_transaction(); |
1370 | 1370 | // DEBUG LOG |
1371 | 1371 | //$this->checkout->log( |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | // 'headers_list' => headers_list(), |
1377 | 1377 | // ) |
1378 | 1378 | //); |
1379 | - wp_safe_redirect( $this->checkout->redirect_url ); |
|
1379 | + wp_safe_redirect($this->checkout->redirect_url); |
|
1380 | 1380 | exit(); |
1381 | 1381 | } |
1382 | 1382 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function instance() { |
63 | 63 | // check if class object is instantiated, and instantiated properly |
64 | - if ( self::$_instance === NULL or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Front_Controller )) { |
|
64 | + if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Front_Controller)) { |
|
65 | 65 | self::$_instance = new self(); |
66 | 66 | } |
67 | 67 | return self::$_instance; |
@@ -79,37 +79,37 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function __construct() { |
81 | 81 | // make sure template tags are loaded immediately so that themes don't break |
82 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'load_espresso_template_tags' ), 10 ); |
|
82 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'load_espresso_template_tags'), 10); |
|
83 | 83 | // determine how to integrate WP_Query with the EE models |
84 | - add_action( 'AHEE__EE_System__initialize', array( $this, 'employ_CPT_Strategy' )); |
|
84 | + add_action('AHEE__EE_System__initialize', array($this, 'employ_CPT_Strategy')); |
|
85 | 85 | // load other resources and begin to actually run shortcodes and modules |
86 | - add_action( 'wp_loaded', array( $this, 'wp_loaded' ), 5 ); |
|
86 | + add_action('wp_loaded', array($this, 'wp_loaded'), 5); |
|
87 | 87 | // analyse the incoming WP request |
88 | - add_action( 'parse_request', array( $this, 'get_request' ), 1, 1 ); |
|
88 | + add_action('parse_request', array($this, 'get_request'), 1, 1); |
|
89 | 89 | // process any content shortcodes |
90 | - add_action( 'parse_request', array( $this, '_initialize_shortcodes' ), 5 ); |
|
90 | + add_action('parse_request', array($this, '_initialize_shortcodes'), 5); |
|
91 | 91 | // process request with module factory |
92 | - add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 10, 1 ); |
|
92 | + add_action('pre_get_posts', array($this, 'pre_get_posts'), 10, 1); |
|
93 | 93 | // before headers sent |
94 | - add_action( 'wp', array( $this, 'wp' ), 5 ); |
|
94 | + add_action('wp', array($this, 'wp'), 5); |
|
95 | 95 | // load css and js |
96 | - add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 1 ); |
|
96 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 1); |
|
97 | 97 | // header |
98 | - add_action('wp_head', array( $this, 'header_meta_tag' ), 5 ); |
|
99 | - add_filter( 'template_include', array( $this, 'template_include' ), 1 ); |
|
98 | + add_action('wp_head', array($this, 'header_meta_tag'), 5); |
|
99 | + add_filter('template_include', array($this, 'template_include'), 1); |
|
100 | 100 | // display errors |
101 | - add_action('loop_start', array( $this, 'display_errors' ), 2 ); |
|
101 | + add_action('loop_start', array($this, 'display_errors'), 2); |
|
102 | 102 | // the content |
103 | - add_filter( 'the_content', array( $this, 'the_content' ), 5, 1 ); |
|
103 | + add_filter('the_content', array($this, 'the_content'), 5, 1); |
|
104 | 104 | //exclude our private cpt comments |
105 | - add_filter( 'comments_clauses', array( $this, 'filter_wp_comments'), 10, 1 ); |
|
105 | + add_filter('comments_clauses', array($this, 'filter_wp_comments'), 10, 1); |
|
106 | 106 | //make sure any ajax requests will respect the url schema when requests are made against admin-ajax.php (http:// or https://) |
107 | - add_filter( 'admin_url', array( $this, 'maybe_force_admin_ajax_ssl' ), 200, 1 ); |
|
107 | + add_filter('admin_url', array($this, 'maybe_force_admin_ajax_ssl'), 200, 1); |
|
108 | 108 | // action hook EE |
109 | - do_action( 'AHEE__EE_Front_Controller__construct__done',$this ); |
|
109 | + do_action('AHEE__EE_Front_Controller__construct__done', $this); |
|
110 | 110 | // for checking that browser cookies are enabled |
111 | - if ( apply_filters( 'FHEE__EE_Front_Controller____construct__set_test_cookie', true )) { |
|
112 | - setcookie( 'ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/' ); |
|
111 | + if (apply_filters('FHEE__EE_Front_Controller____construct__set_test_cookie', true)) { |
|
112 | + setcookie('ee_cookie_test', uniqid(), time() + 24 * HOUR_IN_SECONDS, '/'); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | public function load_espresso_template_tags() { |
132 | - if ( is_readable( EE_PUBLIC . 'template_tags.php' )) { |
|
133 | - require_once( EE_PUBLIC . 'template_tags.php' ); |
|
132 | + if (is_readable(EE_PUBLIC.'template_tags.php')) { |
|
133 | + require_once(EE_PUBLIC.'template_tags.php'); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * @param array $clauses array of comment clauses setup by WP_Comment_Query |
146 | 146 | * @return array array of comment clauses with modifications. |
147 | 147 | */ |
148 | - public function filter_wp_comments( $clauses ) { |
|
148 | + public function filter_wp_comments($clauses) { |
|
149 | 149 | global $wpdb; |
150 | - if ( strpos( $clauses['join'], $wpdb->posts ) !== FALSE ) { |
|
150 | + if (strpos($clauses['join'], $wpdb->posts) !== FALSE) { |
|
151 | 151 | $cpts = EE_Register_CPTs::get_private_CPTs(); |
152 | - foreach ( $cpts as $cpt => $details ) { |
|
153 | - $clauses['where'] .= $wpdb->prepare( " AND $wpdb->posts.post_type != %s", $cpt ); |
|
152 | + foreach ($cpts as $cpt => $details) { |
|
153 | + $clauses['where'] .= $wpdb->prepare(" AND $wpdb->posts.post_type != %s", $cpt); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | return $clauses; |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | public function employ_CPT_Strategy() { |
170 | - if ( apply_filters( 'FHEE__EE_Front_Controller__employ_CPT_Strategy',true) ){ |
|
171 | - EE_Registry::instance()->load_core( 'CPT_Strategy' ); |
|
170 | + if (apply_filters('FHEE__EE_Front_Controller__employ_CPT_Strategy', true)) { |
|
171 | + EE_Registry::instance()->load_core('CPT_Strategy'); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | * @param string $url incoming url |
181 | 181 | * @return string final assembled url |
182 | 182 | */ |
183 | - public function maybe_force_admin_ajax_ssl( $url ) { |
|
184 | - if ( is_ssl() && preg_match( '/admin-ajax.php/', $url )) { |
|
185 | - $url = str_replace( 'http://', 'https://', $url ); |
|
183 | + public function maybe_force_admin_ajax_ssl($url) { |
|
184 | + if (is_ssl() && preg_match('/admin-ajax.php/', $url)) { |
|
185 | + $url = str_replace('http://', 'https://', $url); |
|
186 | 186 | } |
187 | 187 | return $url; |
188 | 188 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | * @param WP $WP |
220 | 220 | * @return void |
221 | 221 | */ |
222 | - public function get_request( WP $WP ) { |
|
223 | - do_action( 'AHEE__EE_Front_Controller__get_request__start' ); |
|
224 | - EE_Registry::instance()->load_core( 'Request_Handler', $WP ); |
|
225 | - do_action( 'AHEE__EE_Front_Controller__get_request__complete' ); |
|
222 | + public function get_request(WP $WP) { |
|
223 | + do_action('AHEE__EE_Front_Controller__get_request__start'); |
|
224 | + EE_Registry::instance()->load_core('Request_Handler', $WP); |
|
225 | + do_action('AHEE__EE_Front_Controller__get_request__complete'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -234,22 +234,22 @@ discard block |
||
234 | 234 | * @param WP $WP |
235 | 235 | * @return void |
236 | 236 | */ |
237 | - public function _initialize_shortcodes( WP $WP ) { |
|
238 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this ); |
|
237 | + public function _initialize_shortcodes(WP $WP) { |
|
238 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__begin', $WP, $this); |
|
239 | 239 | // grab post_name from request |
240 | - $current_post = apply_filters( 'FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get( 'post_name' )); |
|
240 | + $current_post = apply_filters('FHEE__EE_Front_Controller__initialize_shortcodes__current_post_name', EE_Registry::instance()->REQ->get('post_name')); |
|
241 | 241 | // if it's not set, then check if frontpage is blog |
242 | - if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'posts' ) { |
|
242 | + if (empty($current_post) && get_option('show_on_front') == 'posts') { |
|
243 | 243 | // yup.. this is the posts page, prepare to load all shortcode modules |
244 | 244 | $current_post = 'posts'; |
245 | - } else if ( empty( $current_post ) && get_option( 'show_on_front' ) == 'page' ) { |
|
245 | + } else if (empty($current_post) && get_option('show_on_front') == 'page') { |
|
246 | 246 | // some other page is set as the homepage |
247 | - $page_on_front = get_option( 'page_on_front' ); |
|
248 | - if ( $page_on_front ) { |
|
247 | + $page_on_front = get_option('page_on_front'); |
|
248 | + if ($page_on_front) { |
|
249 | 249 | // k now we need to find the post_name for this page |
250 | 250 | global $wpdb; |
251 | 251 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='page' AND post_status='publish' AND ID=%d"; |
252 | - $page_on_front = $wpdb->get_var( $wpdb->prepare( $SQL, $page_on_front )); |
|
252 | + $page_on_front = $wpdb->get_var($wpdb->prepare($SQL, $page_on_front)); |
|
253 | 253 | // set the current post slug to what it actually is |
254 | 254 | $current_post = $page_on_front ? $page_on_front : $current_post; |
255 | 255 | } |
@@ -257,58 +257,58 @@ discard block |
||
257 | 257 | // where are posts being displayed ? |
258 | 258 | $page_for_posts = EE_Config::get_page_for_posts(); |
259 | 259 | // in case $current_post is hierarchical like: /parent-page/current-page |
260 | - $current_post = basename( $current_post ); |
|
260 | + $current_post = basename($current_post); |
|
261 | 261 | // are we on a category page? |
262 | - $term_exists = is_array( term_exists( $current_post, 'category' )) || array_key_exists( 'category_name', $WP->query_vars ); |
|
262 | + $term_exists = is_array(term_exists($current_post, 'category')) || array_key_exists('category_name', $WP->query_vars); |
|
263 | 263 | // make sure shortcodes are set |
264 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes )) { |
|
264 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes)) { |
|
265 | 265 | // d( EE_Registry::instance()->CFG->core->post_shortcodes ); |
266 | 266 | // cycle thru all posts with shortcodes set |
267 | - foreach ( EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes ) { |
|
267 | + foreach (EE_Registry::instance()->CFG->core->post_shortcodes as $post_name => $post_shortcodes) { |
|
268 | 268 | // filter shortcodes so |
269 | - $post_shortcodes = apply_filters( 'FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes ); |
|
269 | + $post_shortcodes = apply_filters('FHEE__Front_Controller__initialize_shortcodes__post_shortcodes', $post_shortcodes); |
|
270 | 270 | // now cycle thru shortcodes |
271 | - foreach ( $post_shortcodes as $shortcode_class => $post_id ) { |
|
271 | + foreach ($post_shortcodes as $shortcode_class => $post_id) { |
|
272 | 272 | // are we on this page, or on the blog page, or an EE CPT category page ? |
273 | - if ( $current_post == $post_name || $term_exists ) { |
|
273 | + if ($current_post == $post_name || $term_exists) { |
|
274 | 274 | // verify shortcode is in list of registered shortcodes |
275 | - if ( ! isset( EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
276 | - if ( $current_post != $page_for_posts && current_user_can( 'edit_post', $post_id )) { |
|
277 | - $msg = sprintf( __( 'The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso' ), $shortcode_class ); |
|
278 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
279 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
275 | + if ( ! isset(EE_Registry::instance()->shortcodes->{$shortcode_class} )) { |
|
276 | + if ($current_post != $page_for_posts && current_user_can('edit_post', $post_id)) { |
|
277 | + $msg = sprintf(__('The [%s] shortcode has not been properly registered or the corresponding addon/module is not active for some reason. Either fix/remove the shortcode from the post, or activate the addon/module the shortcode is associated with.', 'event_espresso'), $shortcode_class); |
|
278 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
279 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
280 | 280 | } |
281 | - add_shortcode( $shortcode_class, array( 'EES_Shortcode', 'invalid_shortcode_processor' )); |
|
281 | + add_shortcode($shortcode_class, array('EES_Shortcode', 'invalid_shortcode_processor')); |
|
282 | 282 | continue; |
283 | 283 | } |
284 | 284 | // is this : a shortcodes set exclusively for this post, or for the home page, or a category, or a taxonomy ? |
285 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $current_post ] ) || $term_exists || $current_post == $page_for_posts ) { |
|
285 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$current_post]) || $term_exists || $current_post == $page_for_posts) { |
|
286 | 286 | // let's pause to reflect on this... |
287 | - $sc_reflector = new ReflectionClass( 'EES_' . $shortcode_class ); |
|
287 | + $sc_reflector = new ReflectionClass('EES_'.$shortcode_class); |
|
288 | 288 | // ensure that class is actually a shortcode |
289 | - if ( ! $sc_reflector->isSubclassOf( 'EES_Shortcode' ) && defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE ) { |
|
290 | - $msg = sprintf( __( 'The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso' ), $shortcode_class ); |
|
291 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
292 | - add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
|
289 | + if ( ! $sc_reflector->isSubclassOf('EES_Shortcode') && defined('WP_DEBUG') && WP_DEBUG === TRUE) { |
|
290 | + $msg = sprintf(__('The requested %s shortcode is not of the class "EES_Shortcode". Please check your files.', 'event_espresso'), $shortcode_class); |
|
291 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
292 | + add_filter('FHEE_run_EE_the_content', '__return_true'); |
|
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | // and pass the request object to the run method |
296 | 296 | EE_Registry::instance()->shortcodes->{$shortcode_class} = $sc_reflector->newInstance(); |
297 | 297 | // fire the shortcode class's run method, so that it can activate resources |
298 | - EE_Registry::instance()->shortcodes->{$shortcode_class}->run( $WP ); |
|
298 | + EE_Registry::instance()->shortcodes->{$shortcode_class}->run($WP); |
|
299 | 299 | } |
300 | 300 | // if this is NOT the "Posts page" and we have a valid entry for the "Posts page" in our tracked post_shortcodes array |
301 | - } else if ( $post_name != $page_for_posts && isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ] )) { |
|
301 | + } else if ($post_name != $page_for_posts && isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts])) { |
|
302 | 302 | // and the shortcode is not being tracked for this page |
303 | - if ( ! isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $page_for_posts ][ $shortcode_class ] )) { |
|
303 | + if ( ! isset(EE_Registry::instance()->CFG->core->post_shortcodes[$page_for_posts][$shortcode_class])) { |
|
304 | 304 | // then remove the "fallback" shortcode processor |
305 | - remove_shortcode( $shortcode_class ); |
|
305 | + remove_shortcode($shortcode_class); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
309 | 309 | } |
310 | 310 | } |
311 | - do_action( 'AHEE__EE_Front_Controller__initialize_shortcodes__end', $this ); |
|
311 | + do_action('AHEE__EE_Front_Controller__initialize_shortcodes__end', $this); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | * @param WP_Query $WP_Query |
321 | 321 | * @return void |
322 | 322 | */ |
323 | - public function pre_get_posts( $WP_Query ) { |
|
323 | + public function pre_get_posts($WP_Query) { |
|
324 | 324 | // only load Module_Request_Router if this is the main query |
325 | - if ( $WP_Query->is_main_query() ) { |
|
325 | + if ($WP_Query->is_main_query()) { |
|
326 | 326 | // load module request router |
327 | - $Module_Request_Router = EE_Registry::instance()->load_core( 'Module_Request_Router' ); |
|
327 | + $Module_Request_Router = EE_Registry::instance()->load_core('Module_Request_Router'); |
|
328 | 328 | // verify object |
329 | - if ( $Module_Request_Router instanceof EE_Module_Request_Router ) { |
|
329 | + if ($Module_Request_Router instanceof EE_Module_Request_Router) { |
|
330 | 330 | // cycle thru module routes |
331 | - while ( $route = $Module_Request_Router->get_route( $WP_Query )) { |
|
331 | + while ($route = $Module_Request_Router->get_route($WP_Query)) { |
|
332 | 332 | // determine module and method for route |
333 | - $module = $Module_Request_Router->resolve_route( $route[0], $route[1] ); |
|
334 | - if( $module instanceof EED_Module ) { |
|
333 | + $module = $Module_Request_Router->resolve_route($route[0], $route[1]); |
|
334 | + if ($module instanceof EED_Module) { |
|
335 | 335 | // get registered view for route |
336 | - $this->_template_path = $Module_Request_Router->get_view( $route ); |
|
336 | + $this->_template_path = $Module_Request_Router->get_view($route); |
|
337 | 337 | // grab module name |
338 | 338 | $module_name = $module->module_name(); |
339 | 339 | // map the module to the module objects |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return void |
361 | 361 | */ |
362 | 362 | public function wp() { |
363 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
363 | + EE_Registry::instance()->load_helper('Template'); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -378,30 +378,30 @@ discard block |
||
378 | 378 | public function wp_enqueue_scripts() { |
379 | 379 | |
380 | 380 | // css is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_css', '__return_false' ); |
381 | - if ( apply_filters( 'FHEE_load_css', TRUE ) ) { |
|
381 | + if (apply_filters('FHEE_load_css', TRUE)) { |
|
382 | 382 | |
383 | 383 | EE_Registry::instance()->CFG->template_settings->enable_default_style = TRUE; |
384 | 384 | //Load the ThemeRoller styles if enabled |
385 | - if ( isset( EE_Registry::instance()->CFG->template_settings->enable_default_style ) && EE_Registry::instance()->CFG->template_settings->enable_default_style ) { |
|
385 | + if (isset(EE_Registry::instance()->CFG->template_settings->enable_default_style) && EE_Registry::instance()->CFG->template_settings->enable_default_style) { |
|
386 | 386 | |
387 | 387 | //Load custom style sheet if available |
388 | - if ( isset( EE_Registry::instance()->CFG->template_settings->custom_style_sheet )) { |
|
389 | - wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL . 'css/' . EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION ); |
|
388 | + if (isset(EE_Registry::instance()->CFG->template_settings->custom_style_sheet)) { |
|
389 | + wp_register_style('espresso_custom_css', EVENT_ESPRESSO_UPLOAD_URL.'css/'.EE_Registry::instance()->CFG->template_settings->custom_style_sheet, EVENT_ESPRESSO_VERSION); |
|
390 | 390 | wp_enqueue_style('espresso_custom_css'); |
391 | 391 | } |
392 | 392 | |
393 | - EE_Registry::instance()->load_helper( 'File' ); |
|
394 | - if ( is_readable( EVENT_ESPRESSO_UPLOAD_DIR . 'css/style.css' )) { |
|
395 | - wp_register_style( 'espresso_default', EVENT_ESPRESSO_UPLOAD_DIR . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
393 | + EE_Registry::instance()->load_helper('File'); |
|
394 | + if (is_readable(EVENT_ESPRESSO_UPLOAD_DIR.'css/style.css')) { |
|
395 | + wp_register_style('espresso_default', EVENT_ESPRESSO_UPLOAD_DIR.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
396 | 396 | } else { |
397 | - wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION ); |
|
397 | + wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION); |
|
398 | 398 | } |
399 | 399 | wp_enqueue_style('espresso_default'); |
400 | 400 | |
401 | - if ( is_readable( get_stylesheet_directory() . EE_Config::get_current_theme() . DS . 'style.css' )) { |
|
402 | - wp_register_style( 'espresso_style', get_stylesheet_directory_uri() . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
401 | + if (is_readable(get_stylesheet_directory().EE_Config::get_current_theme().DS.'style.css')) { |
|
402 | + wp_register_style('espresso_style', get_stylesheet_directory_uri().EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
403 | 403 | } else { |
404 | - wp_register_style( 'espresso_style', EE_TEMPLATES_URL . EE_Config::get_current_theme() . DS . 'style.css', array( 'dashicons', 'espresso_default' ) ); |
|
404 | + wp_register_style('espresso_style', EE_TEMPLATES_URL.EE_Config::get_current_theme().DS.'style.css', array('dashicons', 'espresso_default')); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | } |
@@ -409,29 +409,29 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | // js is turned ON by default, but prior to the wp_enqueue_scripts hook, can be turned OFF via: add_filter( 'FHEE_load_js', '__return_false' ); |
412 | - if ( apply_filters( 'FHEE_load_js', TRUE ) ) { |
|
412 | + if (apply_filters('FHEE_load_js', TRUE)) { |
|
413 | 413 | |
414 | - wp_enqueue_script( 'jquery' ); |
|
414 | + wp_enqueue_script('jquery'); |
|
415 | 415 | //let's make sure that all required scripts have been setup |
416 | - if ( function_exists( 'wp_script_is' )) { |
|
417 | - if ( ! wp_script_is( 'jquery' )) { |
|
416 | + if (function_exists('wp_script_is')) { |
|
417 | + if ( ! wp_script_is('jquery')) { |
|
418 | 418 | $msg = sprintf( |
419 | - __( '%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso' ), |
|
419 | + __('%sJquery is not loaded!%sEvent Espresso is unable to load Jquery due to a conflict with your theme or another plugin.', 'event_espresso'), |
|
420 | 420 | '<em><br />', |
421 | 421 | '</em>' |
422 | 422 | ); |
423 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
423 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | // load core js |
427 | - wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
428 | - wp_enqueue_script( 'espresso_core' ); |
|
429 | - wp_localize_script( 'espresso_core', 'eei18n', EE_Registry::$i18n_js_strings ); |
|
427 | + wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
428 | + wp_enqueue_script('espresso_core'); |
|
429 | + wp_localize_script('espresso_core', 'eei18n', EE_Registry::$i18n_js_strings); |
|
430 | 430 | |
431 | 431 | } |
432 | 432 | |
433 | 433 | //qtip is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via: add_filter('FHEE_load_qtip', '__return_true' ); |
434 | - if ( apply_filters( 'FHEE_load_qtip', FALSE ) ) { |
|
434 | + if (apply_filters('FHEE_load_qtip', FALSE)) { |
|
435 | 435 | EE_Registry::instance()->load_helper('Qtip_Loader'); |
436 | 436 | EEH_Qtip_Loader::instance()->register_and_enqueue(); |
437 | 437 | } |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | |
440 | 440 | //accounting.js library |
441 | 441 | // @link http://josscrowcroft.github.io/accounting.js/ |
442 | - if ( apply_filters( 'FHEE_load_accounting_js', FALSE ) ) { |
|
443 | - $acct_js = EE_THIRD_PARTY_URL . 'accounting/accounting.js'; |
|
444 | - wp_register_script( 'ee-accounting', EE_GLOBAL_ASSETS_URL . 'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
445 | - wp_register_script( 'ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE ); |
|
446 | - wp_enqueue_script( 'ee-accounting' ); |
|
442 | + if (apply_filters('FHEE_load_accounting_js', FALSE)) { |
|
443 | + $acct_js = EE_THIRD_PARTY_URL.'accounting/accounting.js'; |
|
444 | + wp_register_script('ee-accounting', EE_GLOBAL_ASSETS_URL.'scripts/ee-accounting-config.js', array('ee-accounting-core'), EVENT_ESPRESSO_VERSION, TRUE); |
|
445 | + wp_register_script('ee-accounting-core', $acct_js, array('underscore'), '0.3.2', TRUE); |
|
446 | + wp_enqueue_script('ee-accounting'); |
|
447 | 447 | |
448 | 448 | $currency_config = array( |
449 | 449 | 'currency' => array( |
@@ -466,21 +466,21 @@ discard block |
||
466 | 466 | wp_localize_script('ee-accounting', 'EE_ACCOUNTING_CFG', $currency_config); |
467 | 467 | } |
468 | 468 | |
469 | - if ( ! function_exists( 'wp_head' )) { |
|
469 | + if ( ! function_exists('wp_head')) { |
|
470 | 470 | $msg = sprintf( |
471 | - __( '%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
471 | + __('%sMissing wp_head() function.%sThe WordPress function wp_head() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
472 | 472 | '<em><br />', |
473 | 473 | '</em>' |
474 | 474 | ); |
475 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
475 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
476 | 476 | } |
477 | - if ( ! function_exists( 'wp_footer' )) { |
|
477 | + if ( ! function_exists('wp_footer')) { |
|
478 | 478 | $msg = sprintf( |
479 | - __( '%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso' ), |
|
479 | + __('%sMissing wp_footer() function.%sThe WordPress function wp_footer() seems to be missing in your theme. Please contact the theme developer to make sure this is fixed before using Event Espresso.', 'event_espresso'), |
|
480 | 480 | '<em><br />', |
481 | 481 | '</em>' |
482 | 482 | ); |
483 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
483 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | * @return void |
495 | 495 | */ |
496 | 496 | public function header_meta_tag() { |
497 | - print( apply_filters("FHEE__EE_Front_Controller__header_meta_tag","<meta name='generator' content='Event Espresso Version " . EVENT_ESPRESSO_VERSION . "' />")); |
|
497 | + print(apply_filters("FHEE__EE_Front_Controller__header_meta_tag", "<meta name='generator' content='Event Espresso Version ".EVENT_ESPRESSO_VERSION."' />")); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | * @param $the_content |
509 | 509 | * @return string |
510 | 510 | */ |
511 | - public function the_content( $the_content ) { |
|
511 | + public function the_content($the_content) { |
|
512 | 512 | // nothing gets loaded at this point unless other systems turn this hookpoint on by using: add_filter( 'FHEE_run_EE_the_content', '__return_true' ); |
513 | - if ( apply_filters( 'FHEE_run_EE_the_content', FALSE ) ) { |
|
513 | + if (apply_filters('FHEE_run_EE_the_content', FALSE)) { |
|
514 | 514 | } |
515 | 515 | return $the_content; |
516 | 516 | } |
@@ -535,9 +535,9 @@ discard block |
||
535 | 535 | */ |
536 | 536 | public function display_errors() { |
537 | 537 | static $shown_already = FALSE; |
538 | - do_action( 'AHEE__EE_Front_Controller__display_errors__begin' ); |
|
538 | + do_action('AHEE__EE_Front_Controller__display_errors__begin'); |
|
539 | 539 | if ( |
540 | - apply_filters( 'FHEE__EE_Front_Controller__display_errors', TRUE ) |
|
540 | + apply_filters('FHEE__EE_Front_Controller__display_errors', TRUE) |
|
541 | 541 | && ! $shown_already |
542 | 542 | && is_main_query() |
543 | 543 | && ! is_feed() |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | ) { |
547 | 547 | echo EE_Error::get_notices(); |
548 | 548 | $shown_already = TRUE; |
549 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
550 | - EEH_Template::display_template( EE_TEMPLATES . 'espresso-ajax-notices.template.php' ); |
|
549 | + EE_Registry::instance()->load_helper('Template'); |
|
550 | + EEH_Template::display_template(EE_TEMPLATES.'espresso-ajax-notices.template.php'); |
|
551 | 551 | } |
552 | - do_action( 'AHEE__EE_Front_Controller__display_errors__end' ); |
|
552 | + do_action('AHEE__EE_Front_Controller__display_errors__end'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | * @param string $template_include_path |
565 | 565 | * @return string |
566 | 566 | */ |
567 | - public function template_include( $template_include_path = NULL ) { |
|
568 | - if ( EE_Registry::instance()->REQ->is_espresso_page() ) { |
|
569 | - $this->_template_path = ! empty( $this->_template_path ) ? basename( $this->_template_path ) : basename( $template_include_path ); |
|
570 | - $template_path = EEH_Template::locate_template( $this->_template_path, array(), false ); |
|
571 | - $this->_template_path = ! empty( $template_path ) ? $template_path : $template_include_path; |
|
572 | - $this->_template = basename( $this->_template_path ); |
|
567 | + public function template_include($template_include_path = NULL) { |
|
568 | + if (EE_Registry::instance()->REQ->is_espresso_page()) { |
|
569 | + $this->_template_path = ! empty($this->_template_path) ? basename($this->_template_path) : basename($template_include_path); |
|
570 | + $template_path = EEH_Template::locate_template($this->_template_path, array(), false); |
|
571 | + $this->_template_path = ! empty($template_path) ? $template_path : $template_include_path; |
|
572 | + $this->_template = basename($this->_template_path); |
|
573 | 573 | return $this->_template_path; |
574 | 574 | } |
575 | 575 | return $template_include_path; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * @param bool $with_path |
585 | 585 | * @return string |
586 | 586 | */ |
587 | - public function get_selected_template( $with_path = FALSE ) { |
|
587 | + public function get_selected_template($with_path = FALSE) { |
|
588 | 588 | return $with_path ? $this->_template_path : $this->_template; |
589 | 589 | } |
590 | 590 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @return EED_Core_Rest_Api |
28 | 28 | */ |
29 | 29 | public static function instance() { |
30 | - return parent::get_instance( __CLASS__ ); |
|
30 | + return parent::get_instance(__CLASS__); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | |
58 | 58 | |
59 | 59 | public static function set_hooks_both() { |
60 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 ); |
|
61 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 ); |
|
62 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 ); |
|
63 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
60 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); |
|
61 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); |
|
62 | + add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); |
|
63 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /** |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | protected static function _set_hooks_for_changes() { |
76 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false ); |
|
77 | - foreach( $folder_contents as $classname_in_namespace => $filepath ) { |
|
76 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false); |
|
77 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
78 | 78 | //ignore the base parent class |
79 | - if( $classname_in_namespace === 'Changes_In_Base' ) { |
|
79 | + if ($classname_in_namespace === 'Changes_In_Base') { |
|
80 | 80 | continue; |
81 | 81 | } |
82 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
83 | - if ( class_exists( $full_classname )) { |
|
82 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
83 | + if (class_exists($full_classname)) { |
|
84 | 84 | $instance_of_class = new $full_classname; |
85 | - if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { |
|
85 | + if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { |
|
86 | 86 | $instance_of_class->set_hooks(); |
87 | 87 | } |
88 | 88 | } |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
96 | 96 | */ |
97 | 97 | public static function register_routes() { |
98 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
99 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
100 | - foreach( $routes as $route ) { |
|
98 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
99 | + foreach ($relative_urls as $endpoint => $routes) { |
|
100 | + foreach ($routes as $route) { |
|
101 | 101 | register_rest_route( |
102 | 102 | $namespace, |
103 | 103 | $endpoint, |
104 | 104 | array( |
105 | - 'callback' => $route[ 'callback' ], |
|
106 | - 'methods' => $route[ 'methods' ], |
|
107 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
105 | + 'callback' => $route['callback'], |
|
106 | + 'methods' => $route['methods'], |
|
107 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
108 | 108 | ) |
109 | 109 | ); |
110 | 110 | } |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * } |
122 | 122 | */ |
123 | 123 | public static function get_ee_route_data() { |
124 | - $ee_routes = get_option( self::saved_routes_option_names, null ); |
|
125 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
124 | + $ee_routes = get_option(self::saved_routes_option_names, null); |
|
125 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
126 | 126 | self::save_ee_routes(); |
127 | - $ee_routes = get_option( self::saved_routes_option_names, array() ); |
|
127 | + $ee_routes = get_option(self::saved_routes_option_names, array()); |
|
128 | 128 | } |
129 | 129 | return $ee_routes; |
130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @return void |
136 | 136 | */ |
137 | 137 | public static function save_ee_routes() { |
138 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
138 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
139 | 139 | $instance = self::instance(); |
140 | 140 | $routes = apply_filters( |
141 | 141 | 'EED_Core_Rest_Api__save_ee_routes__routes', |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $instance->_register_rpc_routes() |
147 | 147 | ) |
148 | 148 | ); |
149 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
149 | + update_option(self::saved_routes_option_names, $routes, true); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return array @see get_ee_route_data |
156 | 156 | */ |
157 | 157 | protected function _register_model_routes() { |
158 | - EE_Registry::instance()->load_helper( 'Inflector' ); |
|
158 | + EE_Registry::instance()->load_helper('Inflector'); |
|
159 | 159 | $models_to_register = apply_filters( |
160 | 160 | 'FHEE__EED_Core_REST_API___register_model_routes', |
161 | 161 | EE_Registry::instance()->non_abstract_db_models |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | unset($models_to_register['Extra_Meta']); |
165 | 165 | unset($models_to_register['Extra_Join']); |
166 | 166 | $model_routes = array( ); |
167 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
167 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
168 | 168 | |
169 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
169 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
170 | 170 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
171 | - $ee_namespace = self::ee_api_namespace . $version; |
|
172 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
173 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
174 | - $model_routes[ $ee_namespace ][ $plural_model_route ] = array( |
|
171 | + $ee_namespace = self::ee_api_namespace.$version; |
|
172 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
173 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
174 | + $model_routes[$ee_namespace][$plural_model_route] = array( |
|
175 | 175 | array( |
176 | 176 | 'callback' => array( |
177 | 177 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
178 | 178 | 'handle_request_get_all' ), |
179 | 179 | 'methods' => WP_REST_Server::READABLE, |
180 | 180 | 'hidden_endpoint' => $hidden_endpoint, |
181 | - 'args' => $this->_get_read_query_params( $model_name ), |
|
181 | + 'args' => $this->_get_read_query_params($model_name), |
|
182 | 182 | '_links' => array( |
183 | - 'self' => rest_url( $ee_namespace . $singular_model_route ), |
|
183 | + 'self' => rest_url($ee_namespace.$singular_model_route), |
|
184 | 184 | ) |
185 | 185 | ), |
186 | 186 | // array( |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // 'hidden_endpoint' => $hidden_endpoint |
192 | 192 | // ) |
193 | 193 | ); |
194 | - $model_routes[ $ee_namespace ][ $singular_model_route ] = array( |
|
194 | + $model_routes[$ee_namespace][$singular_model_route] = array( |
|
195 | 195 | array( |
196 | 196 | 'callback' => array( |
197 | 197 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | 'include' => array( |
203 | 203 | 'required' => false, |
204 | 204 | 'default' => '*', |
205 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
205 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
206 | 206 | ), |
207 | 207 | ) |
208 | 208 | ), |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | // ), |
216 | 216 | ); |
217 | 217 | //@todo: also handle DELETE for a single item |
218 | - $model = EE_Registry::instance()->load_model( $model_classname ); |
|
219 | - foreach ( $model->relation_settings() as $relation_name => $relation_obj ) { |
|
218 | + $model = EE_Registry::instance()->load_model($model_classname); |
|
219 | + foreach ($model->relation_settings() as $relation_name => $relation_obj) { |
|
220 | 220 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
221 | 221 | $relation_name, |
222 | 222 | $relation_obj |
223 | 223 | ); |
224 | - $model_routes[ $ee_namespace ][ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
224 | + $model_routes[$ee_namespace][$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
225 | 225 | array( |
226 | 226 | 'callback' => array( |
227 | 227 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
228 | 228 | 'handle_request_get_related' ), |
229 | 229 | 'methods' => WP_REST_Server::READABLE, |
230 | 230 | 'hidden_endpoint' => $hidden_endpoint, |
231 | - 'args' => $this->_get_read_query_params( $relation_name ), |
|
231 | + 'args' => $this->_get_read_query_params($relation_name), |
|
232 | 232 | ), |
233 | 233 | // array( |
234 | 234 | // 'callback' => array( |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function _register_rpc_routes() { |
254 | 254 | $routes = array(); |
255 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
256 | - $ee_namespace = self::ee_api_namespace . $version; |
|
255 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
256 | + $ee_namespace = self::ee_api_namespace.$version; |
|
257 | 257 | $this_versions_routes = array(); |
258 | 258 | //checkin endpoint |
259 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array( |
|
259 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array( |
|
260 | 260 | array( |
261 | 261 | 'callback' => array( |
262 | 262 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | 'force' => array( |
268 | 268 | 'required' => false, |
269 | 269 | 'default' => false, |
270 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' ) |
|
270 | + 'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') |
|
271 | 271 | ) |
272 | 272 | ) |
273 | 273 | ) |
274 | 274 | ); |
275 | - $routes[ $ee_namespace ] = apply_filters( |
|
275 | + $routes[$ee_namespace] = apply_filters( |
|
276 | 276 | 'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
277 | 277 | $this_versions_routes, |
278 | 278 | $version, |
@@ -287,47 +287,47 @@ discard block |
||
287 | 287 | * @param string $model_name eg 'Event' or 'Venue' |
288 | 288 | * @return array describing the args acceptable when querying this model |
289 | 289 | */ |
290 | - protected function _get_read_query_params( $model_name ) { |
|
291 | - $model = EE_Registry::instance()->load_model( $model_name ); |
|
290 | + protected function _get_read_query_params($model_name) { |
|
291 | + $model = EE_Registry::instance()->load_model($model_name); |
|
292 | 292 | $default_orderby = array(); |
293 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
294 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
293 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
294 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
295 | 295 | } |
296 | 296 | return array( |
297 | 297 | 'where' => array( |
298 | 298 | 'required' => false, |
299 | 299 | 'default' => array(), |
300 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso' ), |
|
300 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#where for documentation', 'event_espresso'), |
|
301 | 301 | ), |
302 | 302 | 'limit' => array( |
303 | 303 | 'required' => false, |
304 | 304 | 'default' => 50, |
305 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso' ) |
|
305 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#limit for documentation', 'event_espresso') |
|
306 | 306 | ), |
307 | 307 | 'order_by' => array( |
308 | 308 | 'required' => false, |
309 | 309 | 'default' => $default_orderby, |
310 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso' ) |
|
310 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#order_by for documentation', 'event_espresso') |
|
311 | 311 | ), |
312 | 312 | 'group_by' => array( |
313 | 313 | 'required' => false, |
314 | 314 | 'default' => null, |
315 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso' ) |
|
315 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#group_by for documentation', 'event_espresso') |
|
316 | 316 | ), |
317 | 317 | 'having' => array( |
318 | 318 | 'required' => false, |
319 | 319 | 'default' => null, |
320 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso' ) |
|
320 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#having for documentation', 'event_espresso') |
|
321 | 321 | ), |
322 | 322 | 'caps' => array( |
323 | 323 | 'required' => false, |
324 | 324 | 'default' => EEM_Base::caps_read, |
325 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso' ) |
|
325 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#caps for documentation', 'event_espresso') |
|
326 | 326 | ), |
327 | 327 | 'include' => array( |
328 | 328 | 'required' => false, |
329 | 329 | 'default' => '*', |
330 | - 'description' => __( 'See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso' ), |
|
330 | + 'description' => __('See http://developer.eventespresso.com/docs/ee4-rest-api-reading/#Including_Specific_Fields_and_Related_Entities_in_Results for documentation', 'event_espresso'), |
|
331 | 331 | ), |
332 | 332 | ); |
333 | 333 | } |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | */ |
339 | 339 | protected function _register_config_routes() { |
340 | 340 | $config_routes = array(); |
341 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
342 | - $config_routes[ self::ee_api_namespace . $version ][ 'config' ] = array( |
|
341 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
342 | + $config_routes[self::ee_api_namespace.$version]['config'] = array( |
|
343 | 343 | array( |
344 | 344 | 'callback' => array( |
345 | 345 | 'EventEspresso\core\libraries\rest_api\controllers\config\Read', |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | */ |
359 | 359 | protected function _register_meta_routes() { |
360 | 360 | $meta_routes = array(); |
361 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
362 | - $meta_routes[ self::ee_api_namespace . $version ][ '/resources' ] = array( |
|
361 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
362 | + $meta_routes[self::ee_api_namespace.$version]['/resources'] = array( |
|
363 | 363 | array( |
364 | 364 | 'callback' => array( |
365 | 365 | 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | * @param array $route_data |
381 | 381 | * @return array |
382 | 382 | */ |
383 | - public static function hide_old_endpoints( $route_data ) { |
|
384 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
385 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
386 | - foreach( $routes as $route ) { |
|
387 | - if( $route[ 'hidden_endpoint' ] ) { |
|
388 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
389 | - unset( $route_data[ $full_route ] ); |
|
383 | + public static function hide_old_endpoints($route_data) { |
|
384 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
385 | + foreach ($relative_urls as $endpoint => $routes) { |
|
386 | + foreach ($routes as $route) { |
|
387 | + if ($route['hidden_endpoint']) { |
|
388 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
389 | + unset($route_data[$full_route]); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public static function latest_rest_api_version() { |
425 | 425 | $versions_served = \EED_Core_Rest_Api::versions_served(); |
426 | - return end( array_keys( $versions_served ) ); |
|
426 | + return end(array_keys($versions_served)); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | public static function versions_served() { |
438 | 438 | $version_compatibilities = EED_Core_Rest_Api::version_compatibilities(); |
439 | 439 | $versions_served = array(); |
440 | - $lowest_compatible_version = $version_compatibilities[ EED_Core_Rest_Api::core_version() ]; |
|
440 | + $lowest_compatible_version = $version_compatibilities[EED_Core_Rest_Api::core_version()]; |
|
441 | 441 | //for each version of core we have ever served: |
442 | - foreach( array_keys( EED_Core_Rest_Api::version_compatibilities() ) as $possibly_served_version ) { |
|
442 | + foreach (array_keys(EED_Core_Rest_Api::version_compatibilities()) as $possibly_served_version) { |
|
443 | 443 | //if it's not above the current core version, and it's compatible with the current version of core |
444 | - if( |
|
444 | + if ( |
|
445 | 445 | $possibly_served_version < EED_Core_Rest_Api::core_version() |
446 | 446 | && $possibly_served_version >= $lowest_compatible_version |
447 | 447 | ) { |
448 | - $versions_served[ $possibly_served_version ] = true; |
|
449 | - }else { |
|
450 | - $versions_served[ $possibly_served_version ] = false; |
|
448 | + $versions_served[$possibly_served_version] = true; |
|
449 | + } else { |
|
450 | + $versions_served[$possibly_served_version] = false; |
|
451 | 451 | } |
452 | 452 | } |
453 | 453 | return $versions_served; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @return string |
461 | 461 | */ |
462 | 462 | public static function core_version() { |
463 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
463 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @param WP $WP |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - public function run( $WP ) { |
|
475 | + public function run($WP) { |
|
476 | 476 | |
477 | 477 | } |
478 | 478 |
@@ -357,7 +357,7 @@ |
||
357 | 357 | && $possibly_served_version >= $lowest_compatible_version |
358 | 358 | ) { |
359 | 359 | $versions_served[ $possibly_served_version ] = true; |
360 | - }else { |
|
360 | + } else { |
|
361 | 361 | $versions_served[ $possibly_served_version ] = false; |
362 | 362 | } |
363 | 363 | } |