@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\libraries\rest_api\Calculated_Model_Fields; |
3 | 3 | |
4 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function instance() { |
37 | 37 | self::$_field_calculator = new Calculated_Model_Fields(); |
38 | - return parent::get_instance( __CLASS__ ); |
|
38 | + return parent::get_instance(__CLASS__); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | |
67 | 67 | public static function set_hooks_both() { |
68 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'register_routes' ), 10 ); |
|
69 | - add_action( 'rest_api_init', array( 'EED_Core_Rest_Api', 'set_hooks_rest_api' ), 5 ); |
|
70 | - add_filter( 'rest_route_data', array( 'EED_Core_Rest_Api', 'hide_old_endpoints' ), 10, 2 ); |
|
71 | - add_filter( 'rest_index', array( 'EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index' ) ); |
|
68 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'register_routes'), 10); |
|
69 | + add_action('rest_api_init', array('EED_Core_Rest_Api', 'set_hooks_rest_api'), 5); |
|
70 | + add_filter('rest_route_data', array('EED_Core_Rest_Api', 'hide_old_endpoints'), 10, 2); |
|
71 | + add_filter('rest_index', array('EventEspresso\core\libraries\rest_api\controllers\model\Meta', 'filter_ee_metadata_into_index')); |
|
72 | 72 | EED_Core_Rest_Api::invalidate_cached_route_data_on_version_change(); |
73 | 73 | } |
74 | 74 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * Loads all the hooks which make requests to old versions of the API |
88 | 88 | * appear the same as they always did |
89 | 89 | */ |
90 | - public static function set_hooks_for_changes(){ |
|
90 | + public static function set_hooks_for_changes() { |
|
91 | 91 | self::_set_hooks_for_changes(); |
92 | 92 | } |
93 | 93 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | * replace it with application passwords. |
98 | 98 | */ |
99 | 99 | public static function maybe_notify_of_basic_auth_removal() { |
100 | - if( |
|
100 | + if ( |
|
101 | 101 | apply_filters( |
102 | 102 | 'FHEE__EED_Core_Rest_Api__maybe_notify_of_basic_auth_removal__override', |
103 | - ! isset( $_SERVER['PHP_AUTH_USER'] ) |
|
104 | - && ! isset( $_SERVER['HTTP_AUTHORIZATION'] ) |
|
103 | + ! isset($_SERVER['PHP_AUTH_USER']) |
|
104 | + && ! isset($_SERVER['HTTP_AUTHORIZATION']) |
|
105 | 105 | ) |
106 | 106 | ) { |
107 | 107 | //sure it's a WP API request, but they aren't using basic auth, so don't bother them |
@@ -109,20 +109,20 @@ discard block |
||
109 | 109 | } |
110 | 110 | //ok they're using the WP API with Basic Auth |
111 | 111 | $message = sprintf( |
112 | - __( 'We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso' ), |
|
112 | + __('We noticed you\'re using the WP API, which is used by the Event Espresso 4 mobile apps. Because of security and compatibility concerns, we will soon be removing our default authentication mechanism, WP API Basic Auth, from Event Espresso. It is recommended you instead install the %1$sWP Application Passwords plugin%2$s and use it with the EE4 Mobile apps. See %3$sour mobile app documentation%2$s for more information. %4$sIf you have installed the WP API Basic Auth plugin separately, or are not using the Event Espresso 4 mobile apps, you can disregard this message.%4$sThe Event Espresso Team', 'event_espresso'), |
|
113 | 113 | '<a href="https://wordpress.org/plugins/application-passwords/">', |
114 | 114 | '</a>', |
115 | 115 | '<a href="https://eventespresso.com/wiki/ee4-event-apps/#authentication">', |
116 | 116 | '<br/>' |
117 | 117 | ); |
118 | - EE_Error::add_persistent_admin_notice( 'using_basic_auth', $message ); |
|
119 | - if( ! get_option( 'ee_notified_admin_on_basic_auth_removal', false ) ) { |
|
120 | - add_option( 'ee_notified_admin_on_basic_auth_removal', true ); |
|
118 | + EE_Error::add_persistent_admin_notice('using_basic_auth', $message); |
|
119 | + if ( ! get_option('ee_notified_admin_on_basic_auth_removal', false)) { |
|
120 | + add_option('ee_notified_admin_on_basic_auth_removal', true); |
|
121 | 121 | //piggy back off EE_Error::set_content_type, which sets the content type to HTML |
122 | - add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
122 | + add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
123 | 123 | //and send the message to the site admin too |
124 | - wp_mail( get_option( 'admin_email' ), __( 'Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso' ), $message ); |
|
125 | - remove_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' )); |
|
124 | + wp_mail(get_option('admin_email'), __('Notice of Removal of WP API Basic Auth From Event Espresso 4', 'event_espresso'), $message); |
|
125 | + remove_filter('wp_mail_content_type', array('EE_Error', 'set_content_type')); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | /** |
@@ -130,16 +130,16 @@ discard block |
||
130 | 130 | * appear the same as they always did |
131 | 131 | */ |
132 | 132 | protected static function _set_hooks_for_changes() { |
133 | - $folder_contents = EEH_File::get_contents_of_folders( array( EE_LIBRARIES . 'rest_api' . DS . 'changes' ), false ); |
|
134 | - foreach( $folder_contents as $classname_in_namespace => $filepath ) { |
|
133 | + $folder_contents = EEH_File::get_contents_of_folders(array(EE_LIBRARIES.'rest_api'.DS.'changes'), false); |
|
134 | + foreach ($folder_contents as $classname_in_namespace => $filepath) { |
|
135 | 135 | //ignore the base parent class |
136 | - if( $classname_in_namespace === 'Changes_In_Base' ) { |
|
136 | + if ($classname_in_namespace === 'Changes_In_Base') { |
|
137 | 137 | continue; |
138 | 138 | } |
139 | - $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\' . $classname_in_namespace; |
|
140 | - if ( class_exists( $full_classname )) { |
|
139 | + $full_classname = 'EventEspresso\core\libraries\rest_api\changes\\'.$classname_in_namespace; |
|
140 | + if (class_exists($full_classname)) { |
|
141 | 141 | $instance_of_class = new $full_classname; |
142 | - if ( $instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base ) { |
|
142 | + if ($instance_of_class instanceof EventEspresso\core\libraries\rest_api\changes\Changes_In_Base) { |
|
143 | 143 | $instance_of_class->set_hooks(); |
144 | 144 | } |
145 | 145 | } |
@@ -152,16 +152,16 @@ discard block |
||
152 | 152 | * so we actually prefer to only do it when an EE plugin is activated or upgraded |
153 | 153 | */ |
154 | 154 | public static function register_routes() { |
155 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
156 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
157 | - foreach( $routes as $route ) { |
|
155 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
156 | + foreach ($relative_urls as $endpoint => $routes) { |
|
157 | + foreach ($routes as $route) { |
|
158 | 158 | register_rest_route( |
159 | 159 | $namespace, |
160 | 160 | $endpoint, |
161 | 161 | array( |
162 | - 'callback' => $route[ 'callback' ], |
|
163 | - 'methods' => $route[ 'methods' ], |
|
164 | - 'args' => isset( $route[ 'args' ] ) ? $route[ 'args' ] : array(), |
|
162 | + 'callback' => $route['callback'], |
|
163 | + 'methods' => $route['methods'], |
|
164 | + 'args' => isset($route['args']) ? $route['args'] : array(), |
|
165 | 165 | ) |
166 | 166 | ); |
167 | 167 | } |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | * next time the WP API is used |
176 | 176 | */ |
177 | 177 | public static function invalidate_cached_route_data_on_version_change() { |
178 | - if( EE_System::instance()->detect_req_type() != EE_System::req_type_normal ) { |
|
178 | + if (EE_System::instance()->detect_req_type() != EE_System::req_type_normal) { |
|
179 | 179 | EED_Core_Rest_Api::invalidate_cached_route_data(); |
180 | 180 | } |
181 | - foreach( EE_Registry::instance()->addons as $addon ){ |
|
182 | - if( $addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal ) { |
|
181 | + foreach (EE_Registry::instance()->addons as $addon) { |
|
182 | + if ($addon instanceof EE_Addon && $addon->detect_req_type() != EE_System::req_type_normal) { |
|
183 | 183 | EED_Core_Rest_Api::invalidate_cached_route_data(); |
184 | 184 | } |
185 | 185 | } |
@@ -190,8 +190,8 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public static function invalidate_cached_route_data() { |
192 | 192 | //delete the saved EE REST API routes |
193 | - foreach( EED_Core_Rest_Api::versions_served() as $version => $hidden ){ |
|
194 | - delete_option( EED_Core_Rest_Api::saved_routes_option_names . $version ); |
|
193 | + foreach (EED_Core_Rest_Api::versions_served() as $version => $hidden) { |
|
194 | + delete_option(EED_Core_Rest_Api::saved_routes_option_names.$version); |
|
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public static function get_ee_route_data() { |
207 | 207 | $ee_routes = array(); |
208 | - foreach( self::versions_served() as $version => $hidden_endpoints ) { |
|
209 | - $ee_routes[ self::ee_api_namespace . $version ] = self::_get_ee_route_data_for_version( $version, $hidden_endpoints ); |
|
208 | + foreach (self::versions_served() as $version => $hidden_endpoints) { |
|
209 | + $ee_routes[self::ee_api_namespace.$version] = self::_get_ee_route_data_for_version($version, $hidden_endpoints); |
|
210 | 210 | } |
211 | 211 | return $ee_routes; |
212 | 212 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | * @param boolean $hidden_endpoints |
219 | 219 | * @return array |
220 | 220 | */ |
221 | - protected static function _get_ee_route_data_for_version( $version, $hidden_endpoints = false ) { |
|
222 | - $ee_routes = get_option( self::saved_routes_option_names . $version , null ); |
|
223 | - if( ! $ee_routes || ( defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE )){ |
|
224 | - $ee_routes = self::_save_ee_route_data_for_version( $version, $hidden_endpoints ); |
|
221 | + protected static function _get_ee_route_data_for_version($version, $hidden_endpoints = false) { |
|
222 | + $ee_routes = get_option(self::saved_routes_option_names.$version, null); |
|
223 | + if ( ! $ee_routes || (defined('EE_REST_API_DEBUG_MODE') && EE_REST_API_DEBUG_MODE)) { |
|
224 | + $ee_routes = self::_save_ee_route_data_for_version($version, $hidden_endpoints); |
|
225 | 225 | } |
226 | 226 | return $ee_routes; |
227 | 227 | } |
@@ -235,18 +235,18 @@ discard block |
||
235 | 235 | * @param boolean $hidden_endpoints |
236 | 236 | * @return mixed|null|void |
237 | 237 | */ |
238 | - protected static function _save_ee_route_data_for_version( $version, $hidden_endpoints = false ) { |
|
238 | + protected static function _save_ee_route_data_for_version($version, $hidden_endpoints = false) { |
|
239 | 239 | $instance = self::instance(); |
240 | 240 | $routes = apply_filters( |
241 | 241 | 'EED_Core_Rest_Api__save_ee_route_data_for_version__routes', |
242 | 242 | array_replace_recursive( |
243 | - $instance->_get_config_route_data_for_version( $version, $hidden_endpoints ), |
|
244 | - $instance->_get_meta_route_data_for_version( $version, $hidden_endpoints ), |
|
245 | - $instance->_get_model_route_data_for_version( $version, $hidden_endpoints ), |
|
246 | - $instance->_get_rpc_route_data_for_version( $version, $hidden_endpoints ) |
|
243 | + $instance->_get_config_route_data_for_version($version, $hidden_endpoints), |
|
244 | + $instance->_get_meta_route_data_for_version($version, $hidden_endpoints), |
|
245 | + $instance->_get_model_route_data_for_version($version, $hidden_endpoints), |
|
246 | + $instance->_get_rpc_route_data_for_version($version, $hidden_endpoints) |
|
247 | 247 | ) |
248 | 248 | ); |
249 | - update_option( self::saved_routes_option_names . $version, $routes, true ); |
|
249 | + update_option(self::saved_routes_option_names.$version, $routes, true); |
|
250 | 250 | return $routes; |
251 | 251 | } |
252 | 252 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return void |
258 | 258 | */ |
259 | 259 | public static function save_ee_routes() { |
260 | - if( EE_Maintenance_Mode::instance()->models_can_query() ){ |
|
260 | + if (EE_Maintenance_Mode::instance()->models_can_query()) { |
|
261 | 261 | $instance = self::instance(); |
262 | 262 | $routes = apply_filters( |
263 | 263 | 'EED_Core_Rest_Api__save_ee_routes__routes', |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $instance->_register_rpc_routes() |
269 | 269 | ) |
270 | 270 | ); |
271 | - update_option( self::saved_routes_option_names, $routes, true ); |
|
271 | + update_option(self::saved_routes_option_names, $routes, true); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | */ |
280 | 280 | protected function _register_model_routes() { |
281 | 281 | $model_routes = array( ); |
282 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
283 | - $model_routes[ EED_Core_Rest_Api::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint ); |
|
282 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
283 | + $model_routes[EED_Core_Rest_Api::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
284 | 284 | } |
285 | 285 | return $model_routes; |
286 | 286 | } |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * @param boolean $hidden_endpoint |
292 | 292 | * @return array |
293 | 293 | */ |
294 | - protected function _get_model_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
295 | - $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info( $version ); |
|
294 | + protected function _get_model_route_data_for_version($version, $hidden_endpoint = false) { |
|
295 | + $model_version_info = new \EventEspresso\core\libraries\rest_api\Model_Version_Info($version); |
|
296 | 296 | $models_to_register = apply_filters( |
297 | 297 | 'FHEE__EED_Core_REST_API___register_model_routes', |
298 | 298 | $model_version_info->models_for_requested_version() |
@@ -301,21 +301,21 @@ discard block |
||
301 | 301 | unset($models_to_register['Extra_Meta']); |
302 | 302 | unset($models_to_register['Extra_Join']); |
303 | 303 | $model_routes = array(); |
304 | - foreach ( $models_to_register as $model_name => $model_classname ) { |
|
305 | - $model = \EE_Registry::instance()->load_model( $model_name ); |
|
304 | + foreach ($models_to_register as $model_name => $model_classname) { |
|
305 | + $model = \EE_Registry::instance()->load_model($model_name); |
|
306 | 306 | //yes we could just register one route for ALL models, but then they wouldn't show up in the index |
307 | - $plural_model_route = EEH_Inflector::pluralize_and_lower( $model_name ); |
|
308 | - $singular_model_route = $plural_model_route . '/(?P<id>\d+)' ; |
|
309 | - $model_routes[ $plural_model_route ] = array( |
|
307 | + $plural_model_route = EEH_Inflector::pluralize_and_lower($model_name); |
|
308 | + $singular_model_route = $plural_model_route.'/(?P<id>\d+)'; |
|
309 | + $model_routes[$plural_model_route] = array( |
|
310 | 310 | array( |
311 | 311 | 'callback' => array( |
312 | 312 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
313 | 313 | 'handle_request_get_all' ), |
314 | 314 | 'methods' => WP_REST_Server::READABLE, |
315 | 315 | 'hidden_endpoint' => $hidden_endpoint, |
316 | - 'args' => $this->_get_read_query_params( $model, $version ), |
|
316 | + 'args' => $this->_get_read_query_params($model, $version), |
|
317 | 317 | '_links' => array( |
318 | - 'self' => rest_url( EED_Core_Rest_Api::ee_api_namespace . $version . $singular_model_route ), |
|
318 | + 'self' => rest_url(EED_Core_Rest_Api::ee_api_namespace.$version.$singular_model_route), |
|
319 | 319 | ) |
320 | 320 | ), |
321 | 321 | // array( |
@@ -326,14 +326,14 @@ discard block |
||
326 | 326 | // 'hidden_endpoint' => $hidden_endpoint |
327 | 327 | // ) |
328 | 328 | ); |
329 | - $model_routes[ $singular_model_route ] = array( |
|
329 | + $model_routes[$singular_model_route] = array( |
|
330 | 330 | array( |
331 | 331 | 'callback' => array( |
332 | 332 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
333 | 333 | 'handle_request_get_one' ), |
334 | 334 | 'methods' => WP_REST_Server::READABLE, |
335 | 335 | 'hidden_endpoint' => $hidden_endpoint, |
336 | - 'args' => $this->_get_response_selection_query_params( $model, $version) |
|
336 | + 'args' => $this->_get_response_selection_query_params($model, $version) |
|
337 | 337 | ), |
338 | 338 | // array( |
339 | 339 | // 'callback' => array( |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | // ), |
345 | 345 | ); |
346 | 346 | //@todo: also handle DELETE for a single item |
347 | - foreach ( $model_version_info->relation_settings( $model ) as $relation_name => $relation_obj ) { |
|
347 | + foreach ($model_version_info->relation_settings($model) as $relation_name => $relation_obj) { |
|
348 | 348 | $related_model_name_endpoint_part = EventEspresso\core\libraries\rest_api\controllers\model\Read::get_related_entity_name( |
349 | 349 | $relation_name, |
350 | 350 | $relation_obj |
351 | 351 | ); |
352 | - $model_routes[ $singular_model_route . '/' . $related_model_name_endpoint_part ] = array( |
|
352 | + $model_routes[$singular_model_route.'/'.$related_model_name_endpoint_part] = array( |
|
353 | 353 | array( |
354 | 354 | 'callback' => array( |
355 | 355 | 'EventEspresso\core\libraries\rest_api\controllers\model\Read', |
356 | 356 | 'handle_request_get_related' ), |
357 | 357 | 'methods' => WP_REST_Server::READABLE, |
358 | 358 | 'hidden_endpoint' => $hidden_endpoint, |
359 | - 'args' => $this->_get_read_query_params( $relation_obj->get_other_model(), $version ), |
|
359 | + 'args' => $this->_get_read_query_params($relation_obj->get_other_model(), $version), |
|
360 | 360 | ), |
361 | 361 | // array( |
362 | 362 | // 'callback' => array( |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | */ |
380 | 380 | protected function _register_rpc_routes() { |
381 | 381 | $routes = array(); |
382 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
383 | - $routes[ self::ee_api_namespace . $version ] = $this->_get_rpc_route_data_for_version( $version, $hidden_endpoint ); |
|
382 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
383 | + $routes[self::ee_api_namespace.$version] = $this->_get_rpc_route_data_for_version($version, $hidden_endpoint); |
|
384 | 384 | } |
385 | 385 | return $routes; |
386 | 386 | } |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | * @param boolean $hidden_endpoint |
392 | 392 | * @return array |
393 | 393 | */ |
394 | - protected function _get_rpc_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
394 | + protected function _get_rpc_route_data_for_version($version, $hidden_endpoint = false) { |
|
395 | 395 | $this_versions_routes = array(); |
396 | 396 | //checkin endpoint |
397 | - $this_versions_routes[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] = array( |
|
397 | + $this_versions_routes['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)'] = array( |
|
398 | 398 | array( |
399 | 399 | 'callback' => array( |
400 | 400 | 'EventEspresso\core\libraries\rest_api\controllers\rpc\Checkin', |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | 'force' => array( |
406 | 406 | 'required' => false, |
407 | 407 | 'default' => false, |
408 | - 'description' => __( 'Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso' ) |
|
408 | + 'description' => __('Whether to force toggle checkin, or to verify the registration status and allowed ticket uses', 'event_espresso') |
|
409 | 409 | ) |
410 | 410 | ) |
411 | 411 | ) |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param string $version |
425 | 425 | * @return array |
426 | 426 | */ |
427 | - protected function _get_response_selection_query_params( \EEM_Base $model, $version ) { |
|
427 | + protected function _get_response_selection_query_params(\EEM_Base $model, $version) { |
|
428 | 428 | return apply_filters( |
429 | 429 | 'FHEE__EED_Core_Rest_Api___get_response_selection_query_params', |
430 | 430 | array( |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | 'calculate' => array( |
436 | 436 | 'required' => false, |
437 | 437 | 'default' => '', |
438 | - 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model( $model ) |
|
438 | + 'enum' => self::$_field_calculator->retrieve_calculated_fields_for_model($model) |
|
439 | 439 | ) |
440 | 440 | ), |
441 | 441 | $model, |
@@ -453,13 +453,13 @@ discard block |
||
453 | 453 | * @return array describing the args acceptable when querying this model |
454 | 454 | * @throws \EE_Error |
455 | 455 | */ |
456 | - protected function _get_read_query_params( \EEM_Base $model, $version ) { |
|
456 | + protected function _get_read_query_params(\EEM_Base $model, $version) { |
|
457 | 457 | $default_orderby = array(); |
458 | - foreach( $model->get_combined_primary_key_fields() as $key_field ) { |
|
459 | - $default_orderby[ $key_field->get_name() ] = 'ASC'; |
|
458 | + foreach ($model->get_combined_primary_key_fields() as $key_field) { |
|
459 | + $default_orderby[$key_field->get_name()] = 'ASC'; |
|
460 | 460 | } |
461 | 461 | return array_merge( |
462 | - $this->_get_response_selection_query_params( $model, $version ), |
|
462 | + $this->_get_response_selection_query_params($model, $version), |
|
463 | 463 | array( |
464 | 464 | 'where' => array( |
465 | 465 | 'required' => false, |
@@ -496,8 +496,8 @@ discard block |
||
496 | 496 | */ |
497 | 497 | protected function _register_config_routes() { |
498 | 498 | $config_routes = array(); |
499 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
500 | - $config_routes[ self::ee_api_namespace . $version ] = $this->_get_config_route_data_for_version( $version, $hidden_endpoint ); |
|
499 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
500 | + $config_routes[self::ee_api_namespace.$version] = $this->_get_config_route_data_for_version($version, $hidden_endpoint); |
|
501 | 501 | } |
502 | 502 | return $config_routes; |
503 | 503 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @param boolean $hidden_endpoint |
509 | 509 | * @return array |
510 | 510 | */ |
511 | - protected function _get_config_route_data_for_version( $version, $hidden_endpoint ) { |
|
511 | + protected function _get_config_route_data_for_version($version, $hidden_endpoint) { |
|
512 | 512 | return array( |
513 | 513 | 'config' => array( |
514 | 514 | array( |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | */ |
539 | 539 | protected function _register_meta_routes() { |
540 | 540 | $meta_routes = array(); |
541 | - foreach( self::versions_served() as $version => $hidden_endpoint ) { |
|
542 | - $meta_routes[ self::ee_api_namespace . $version ] = $this->_get_meta_route_data_for_version( $version, $hidden_endpoint ); |
|
541 | + foreach (self::versions_served() as $version => $hidden_endpoint) { |
|
542 | + $meta_routes[self::ee_api_namespace.$version] = $this->_get_meta_route_data_for_version($version, $hidden_endpoint); |
|
543 | 543 | } |
544 | 544 | return $meta_routes; |
545 | 545 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @param boolean $hidden_endpoint |
551 | 551 | * @return array |
552 | 552 | */ |
553 | - protected function _get_meta_route_data_for_version( $version, $hidden_endpoint = false ) { |
|
553 | + protected function _get_meta_route_data_for_version($version, $hidden_endpoint = false) { |
|
554 | 554 | return array( |
555 | 555 | 'resources' => array( |
556 | 556 | array( |
@@ -572,25 +572,25 @@ discard block |
||
572 | 572 | * @param array $route_data |
573 | 573 | * @return array |
574 | 574 | */ |
575 | - public static function hide_old_endpoints( $route_data ) { |
|
575 | + public static function hide_old_endpoints($route_data) { |
|
576 | 576 | //allow API clients to override which endpoints get hidden, in case |
577 | 577 | //they want to discover particular endpoints |
578 | 578 | //also, we don't have access to the request so we have to just grab it from the superglobal |
579 | 579 | $force_show_ee_namespace = ltrim( |
580 | - EEH_Array::is_set( $_REQUEST, 'force_show_ee_namespace', '' ), |
|
580 | + EEH_Array::is_set($_REQUEST, 'force_show_ee_namespace', ''), |
|
581 | 581 | '/' |
582 | 582 | ); |
583 | 583 | |
584 | - foreach( EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls ) { |
|
585 | - foreach( $relative_urls as $endpoint => $routes ) { |
|
586 | - foreach( $routes as $route ) { |
|
584 | + foreach (EED_Core_Rest_Api::get_ee_route_data() as $namespace => $relative_urls) { |
|
585 | + foreach ($relative_urls as $endpoint => $routes) { |
|
586 | + foreach ($routes as $route) { |
|
587 | 587 | //by default, hide "hidden_endpoint"s, unless the request indicates |
588 | 588 | //to $force_show_ee_namespace, in which case only show that one |
589 | 589 | //namespace's endpoints (and hide all others) |
590 | - if( ( $route[ 'hidden_endpoint' ] && $force_show_ee_namespace === '' ) |
|
591 | - || ( $force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace ) ) { |
|
592 | - $full_route = '/' . ltrim( $namespace, '/' ) . '/' . ltrim( $endpoint, '/' ); |
|
593 | - unset( $route_data[ $full_route ] ); |
|
590 | + if (($route['hidden_endpoint'] && $force_show_ee_namespace === '') |
|
591 | + || ($force_show_ee_namespace !== '' && $force_show_ee_namespace !== $namespace)) { |
|
592 | + $full_route = '/'.ltrim($namespace, '/').'/'.ltrim($endpoint, '/'); |
|
593 | + unset($route_data[$full_route]); |
|
594 | 594 | } |
595 | 595 | } |
596 | 596 | } |
@@ -629,8 +629,8 @@ discard block |
||
629 | 629 | */ |
630 | 630 | public static function latest_rest_api_version() { |
631 | 631 | $versions_served = \EED_Core_Rest_Api::versions_served(); |
632 | - $versions_served_keys = array_keys( $versions_served ); |
|
633 | - return end( $versions_served_keys ); |
|
632 | + $versions_served_keys = array_keys($versions_served); |
|
633 | + return end($versions_served_keys); |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | /** |
@@ -644,32 +644,32 @@ discard block |
||
644 | 644 | public static function versions_served() { |
645 | 645 | $versions_served = array(); |
646 | 646 | $possibly_served_versions = EED_Core_Rest_Api::version_compatibilities(); |
647 | - $lowest_compatible_version = end( $possibly_served_versions); |
|
648 | - reset( $possibly_served_versions ); |
|
649 | - $versions_served_historically = array_keys( $possibly_served_versions ); |
|
650 | - $latest_version = end( $versions_served_historically ); |
|
651 | - reset( $versions_served_historically ); |
|
647 | + $lowest_compatible_version = end($possibly_served_versions); |
|
648 | + reset($possibly_served_versions); |
|
649 | + $versions_served_historically = array_keys($possibly_served_versions); |
|
650 | + $latest_version = end($versions_served_historically); |
|
651 | + reset($versions_served_historically); |
|
652 | 652 | //for each version of core we have ever served: |
653 | - foreach ( $versions_served_historically as $key_versioned_endpoint ) { |
|
653 | + foreach ($versions_served_historically as $key_versioned_endpoint) { |
|
654 | 654 | //if it's not above the current core version, and it's compatible with the current version of core |
655 | - if( $key_versioned_endpoint == $latest_version ) { |
|
655 | + if ($key_versioned_endpoint == $latest_version) { |
|
656 | 656 | //don't hide the latest version in the index |
657 | - $versions_served[ $key_versioned_endpoint ] = false; |
|
658 | - } else if( |
|
657 | + $versions_served[$key_versioned_endpoint] = false; |
|
658 | + } else if ( |
|
659 | 659 | $key_versioned_endpoint < EED_Core_Rest_Api::core_version() |
660 | 660 | && $key_versioned_endpoint >= $lowest_compatible_version |
661 | 661 | ) { |
662 | 662 | //include, but hide, previous versions which are still supported |
663 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
664 | - } elseif( |
|
663 | + $versions_served[$key_versioned_endpoint] = true; |
|
664 | + } elseif ( |
|
665 | 665 | apply_filters( |
666 | 666 | 'FHEE__EED_Core_Rest_Api__versions_served__include_incompatible_versions', |
667 | 667 | false, |
668 | 668 | $possibly_served_versions |
669 | 669 | ) |
670 | - ){ |
|
670 | + ) { |
|
671 | 671 | //if a version is no longer supported, don't include it in index or list of versions served |
672 | - $versions_served[ $key_versioned_endpoint ] = true; |
|
672 | + $versions_served[$key_versioned_endpoint] = true; |
|
673 | 673 | } |
674 | 674 | } |
675 | 675 | return $versions_served; |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | * @return string |
683 | 683 | */ |
684 | 684 | public static function core_version() { |
685 | - return apply_filters( 'FHEE__EED_Core_REST_API__core_version', implode('.', array_slice( explode( '.', espresso_version() ), 0, 3 ) ) ); |
|
685 | + return apply_filters('FHEE__EED_Core_REST_API__core_version', implode('.', array_slice(explode('.', espresso_version()), 0, 3))); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * @param WP $WP |
708 | 708 | * @return void |
709 | 709 | */ |
710 | - public function run( $WP ) { |
|
710 | + public function run($WP) { |
|
711 | 711 | |
712 | 712 | } |
713 | 713 |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | |
12 | 12 | $row = 1; |
13 | 13 | $max = 1; |
14 | -$ticket_count = count( $tickets ); |
|
14 | +$ticket_count = count($tickets); |
|
15 | 15 | $ticket_status_display = ''; |
16 | -if ( ! $ticket_count ) { |
|
16 | +if ( ! $ticket_count) { |
|
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $required_ticket_sold_out = FALSE; |
21 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
21 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
22 | 22 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
23 | 23 | : new EE_Ticket_Selector_Config(); |
24 | 24 | |
25 | -$tax_settings = isset ( EE_Registry::instance()->CFG->tax_settings ) |
|
25 | +$tax_settings = isset (EE_Registry::instance()->CFG->tax_settings) |
|
26 | 26 | ? EE_Registry::instance()->CFG->tax_settings |
27 | 27 | : new EE_Tax_Config(); |
28 | 28 | |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | |
32 | 32 | ob_start(); |
33 | 33 | |
34 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
35 | - if ( $ticket instanceof EE_Ticket ) { |
|
34 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
35 | + if ($ticket instanceof EE_Ticket) { |
|
36 | 36 | $cols = 2; |
37 | 37 | $max = $ticket->max(); |
38 | 38 | $min = 0; |
39 | 39 | $remaining = $ticket->remaining(); |
40 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
40 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
41 | 41 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
42 | - $max = min( $remaining, $max_atndz ); |
|
42 | + $max = min($remaining, $max_atndz); |
|
43 | 43 | // but... we also want to restrict the number of tickets by the ticket max setting, |
44 | 44 | // however, the max still can't be higher than what was just set above |
45 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
45 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
46 | 46 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
47 | 47 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
48 | 48 | // and if the ticket is required, then make sure that min qty is at least 1 |
49 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
49 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
50 | 50 | } else { |
51 | 51 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
52 | 52 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -58,41 +58,41 @@ discard block |
||
58 | 58 | $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
59 | 59 | $ticket_bundle = FALSE; |
60 | 60 | // for ticket bundles, set min and max qty the same |
61 | - if ( $ticket->min() !== 0 && $ticket->min() === $ticket->max() ) { |
|
61 | + if ($ticket->min() !== 0 && $ticket->min() === $ticket->max()) { |
|
62 | 62 | $ticket_price *= $ticket->min(); |
63 | 63 | $ticket_bundle = TRUE; |
64 | 64 | } |
65 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
65 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
66 | 66 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
67 | 67 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
68 | 68 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
69 | 69 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
70 | 70 | // check ticket status |
71 | - switch ( $tkt_status ) { |
|
71 | + switch ($tkt_status) { |
|
72 | 72 | // sold_out |
73 | 73 | case EE_Ticket::sold_out : |
74 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
74 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
75 | 75 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
76 | 76 | break; |
77 | 77 | // expired |
78 | 78 | case EE_Ticket::expired : |
79 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
79 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
80 | 80 | $status_class = 'ticket-sales-expired lt-grey-text'; |
81 | 81 | break; |
82 | 82 | // archived |
83 | 83 | case EE_Ticket::archived : |
84 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
84 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
85 | 85 | $status_class = 'archived-ticket hidden'; |
86 | 86 | break; |
87 | 87 | // pending |
88 | 88 | case EE_Ticket::pending : |
89 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
89 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
90 | 90 | $status_class = 'ticket-pending'; |
91 | 91 | break; |
92 | 92 | // onsale |
93 | 93 | case EE_Ticket::onsale : |
94 | 94 | default : |
95 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
95 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
96 | 96 | $status_class = 'ticket-on-sale'; |
97 | 97 | break; |
98 | 98 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
133 | 133 | ); |
134 | 134 | ?> |
135 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
135 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
136 | 136 | <?php |
137 | 137 | /** |
138 | 138 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -144,24 +144,24 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @var string|bool |
146 | 146 | */ |
147 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
147 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
148 | 148 | echo $new_row_cells_content; |
149 | 149 | echo '</tr>'; |
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | ?> |
153 | 153 | <td class="tckt-slctr-tbl-td-name"> |
154 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
155 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
156 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
157 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
154 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
155 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
156 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
157 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
158 | 158 | </a> |
159 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
160 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
159 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
160 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
161 | 161 | </a> |
162 | 162 | <?php endif; //end show details check ?> |
163 | - <?php if ( $ticket->required() ) { ?> |
|
164 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
163 | + <?php if ($ticket->required()) { ?> |
|
164 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
165 | 165 | <?php } ?> |
166 | 166 | <?php |
167 | 167 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | </td> |
178 | 178 | <?php |
179 | 179 | if ( |
180 | - apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) |
|
180 | + apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE) |
|
181 | 181 | ) { ?> |
182 | 182 | <td class="tckt-slctr-tbl-td-price jst-rght"><?php |
183 | - echo EEH_Template::format_currency( $ticket_price ); |
|
183 | + echo EEH_Template::format_currency($ticket_price); |
|
184 | 184 | echo $ticket->taxable() ? '<span class="taxable-tickets-asterisk grey-text">*</span>' : ''; |
185 | 185 | ?> <span class="smaller-text no-bold"><?php |
186 | - if ( $ticket_bundle ) { |
|
187 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
186 | + if ($ticket_bundle) { |
|
187 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
188 | 188 | } else { |
189 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
189 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
190 | 190 | }?></span> </td> |
191 | 191 | <?php $cols++; ?> |
192 | 192 | <?php } ?> |
@@ -194,28 +194,28 @@ discard block |
||
194 | 194 | <?php |
195 | 195 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
196 | 196 | $ticket_status_display = ''; |
197 | - if ( $max_atndz === 0 ) { |
|
197 | + if ($max_atndz === 0) { |
|
198 | 198 | // registration is CLOSED because admin set max attendees to ZERO |
199 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
199 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
200 | 200 | 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
201 | - __( 'Closed', 'event_espresso' ) |
|
202 | - ) . '</span>'; |
|
203 | - } else if ( $tkt_status === EE_Ticket::sold_out || $remaining === 0 ) { |
|
201 | + __('Closed', 'event_espresso') |
|
202 | + ).'</span>'; |
|
203 | + } else if ($tkt_status === EE_Ticket::sold_out || $remaining === 0) { |
|
204 | 204 | // SOLD OUT - no tickets remaining |
205 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
205 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
206 | 206 | 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
207 | - __( 'Sold Out', 'event_espresso' ) |
|
208 | - ) . '</span>'; |
|
209 | - } else if ( $tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived ) { |
|
207 | + __('Sold Out', 'event_espresso') |
|
208 | + ).'</span>'; |
|
209 | + } else if ($tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived) { |
|
210 | 210 | // expired or archived ticket |
211 | 211 | $ticket_status_display = $ticket_status; |
212 | - } else if ( $tkt_status === EE_Ticket::pending ) { |
|
212 | + } else if ($tkt_status === EE_Ticket::pending) { |
|
213 | 213 | // ticket not on sale yet |
214 | 214 | $ticket_status_display = '<span class="ticket-pending-pg"> |
215 | 215 | <span class="ticket-pending">' |
216 | 216 | . apply_filters( |
217 | 217 | 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
218 | - __( 'Goes On Sale', 'event_espresso' ) |
|
218 | + __('Goes On Sale', 'event_espresso') |
|
219 | 219 | ) |
220 | 220 | . '</span><br/> |
221 | 221 | <span class="small-text">' |
@@ -228,36 +228,36 @@ discard block |
||
228 | 228 | ) |
229 | 229 | . '</span> |
230 | 230 | </span>'; |
231 | - } else if ( $ticket->min() > $remaining ) { |
|
231 | + } else if ($ticket->min() > $remaining) { |
|
232 | 232 | // min qty purchasable is less than tickets available |
233 | 233 | $ticket_status_display = ' |
234 | 234 | <div class="archived-ticket-pg"> |
235 | 235 | <span class="archived-ticket small-text">' |
236 | - . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )) |
|
236 | + . apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')) |
|
237 | 237 | . '</span><br/> |
238 | 238 | </div>'; |
239 | - } else if ( $max_atndz === 1 ) { |
|
239 | + } else if ($max_atndz === 1) { |
|
240 | 240 | // only ONE attendee is allowed to register at a time |
241 | 241 | // display submit button since we have tickets available |
242 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
242 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
243 | 243 | ?> |
244 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
244 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
245 | 245 | <?php |
246 | 246 | $hidden_input_qty = FALSE; |
247 | 247 | |
248 | - } else if ( $max > 0 ) { |
|
248 | + } else if ($max > 0) { |
|
249 | 249 | // display submit button since we have tickets available |
250 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
250 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
251 | 251 | ?> |
252 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
252 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
253 | 253 | <?php |
254 | 254 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
255 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
255 | + if ( ! $ticket->required() && $min !== 0) { |
|
256 | 256 | ?> |
257 | 257 | <option value="0"> 0 </option> |
258 | 258 | <?php } |
259 | 259 | // offer ticket quantities from the min to the max |
260 | - for ( $i = $min; $i <= $max; $i++) { |
|
260 | + for ($i = $min; $i <= $max; $i++) { |
|
261 | 261 | ?> |
262 | 262 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
263 | 263 | <?php } ?> |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | echo $ticket_status_display; |
270 | 270 | // depending on group reg we need to change the format for qty |
271 | - if ( $hidden_input_qty ) { |
|
271 | + if ($hidden_input_qty) { |
|
272 | 272 | ?> |
273 | 273 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
274 | 274 | <?php |
@@ -278,33 +278,33 @@ discard block |
||
278 | 278 | |
279 | 279 | </td> |
280 | 280 | </tr> |
281 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
282 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
281 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
282 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
283 | 283 | <td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>" > |
284 | 284 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
285 | 285 | |
286 | 286 | <section class="tckt-slctr-tkt-details-sctn"> |
287 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
287 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
288 | 288 | <p><?php echo $ticket->description(); ?></p> |
289 | 289 | |
290 | - <?php if ( $ticket_price !== 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
290 | + <?php if ($ticket_price !== 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
291 | 291 | <section class="tckt-slctr-tkt-price-sctn"> |
292 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
292 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
293 | 293 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
294 | 294 | <table class="tckt-slctr-tkt-details-tbl"> |
295 | 295 | <thead> |
296 | 296 | <tr> |
297 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
298 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
299 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
297 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
298 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
299 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
300 | 300 | </tr> |
301 | 301 | </thead> |
302 | 302 | <tbody> |
303 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
303 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
304 | 304 | <tr> |
305 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
306 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
307 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
305 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
306 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
307 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
308 | 308 | </tr> |
309 | 309 | <?php |
310 | 310 | $running_total = $ticket->base_price()->amount(); |
@@ -312,44 +312,44 @@ discard block |
||
312 | 312 | $running_total = 0; |
313 | 313 | } |
314 | 314 | // now add price modifiers |
315 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
315 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
316 | 316 | <tr> |
317 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
318 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
319 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
317 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
318 | + <?php if ($price_mod->is_percent()) { ?> |
|
319 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
320 | 320 | <?php |
321 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
321 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
322 | 322 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
323 | 323 | ?> |
324 | 324 | <?php } else { ?> |
325 | 325 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
326 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
326 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
327 | 327 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
328 | 328 | <?php } ?> |
329 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
329 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
330 | 330 | <?php $running_total += $new_sub_total; ?> |
331 | 331 | </tr> |
332 | 332 | <?php } ?> |
333 | - <?php if ( $ticket->taxable() ) { ?> |
|
333 | + <?php if ($ticket->taxable()) { ?> |
|
334 | 334 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
335 | 335 | <tr> |
336 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
337 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
336 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
337 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
338 | 338 | </tr> |
339 | 339 | |
340 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
340 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
341 | 341 | <tr> |
342 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
343 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
344 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
345 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
342 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
343 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
344 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
345 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
346 | 346 | <?php $running_total += $tax_amount; ?> |
347 | 347 | </tr> |
348 | 348 | <?php } ?> |
349 | 349 | <?php } ?> |
350 | 350 | <tr> |
351 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
352 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
351 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
352 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
353 | 353 | </tr> |
354 | 354 | </tbody> |
355 | 355 | </table> |
@@ -359,106 +359,106 @@ discard block |
||
359 | 359 | <?php } ?> |
360 | 360 | |
361 | 361 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
362 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
363 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
364 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
365 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
362 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
363 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
364 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
365 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
366 | 366 | </section> |
367 | 367 | <br/> |
368 | 368 | |
369 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
369 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
370 | 370 | |
371 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
371 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
372 | 372 | <section class="tckt-slctr-tkt-quantities-sctn"> |
373 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
374 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
375 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
376 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
373 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
374 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
375 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
376 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
377 | 377 | <?php //$max = min( $max, $max_atndz );?> |
378 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
378 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
379 | 379 | </section> |
380 | 380 | <br/> |
381 | 381 | <?php } ?> |
382 | 382 | |
383 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
383 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
384 | 384 | <section class="tckt-slctr-tkt-uses-sctn"> |
385 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
385 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
386 | 386 | <span class="drk-grey-text small-text no-bold"> - <?php |
387 | 387 | echo apply_filters( |
388 | 388 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
389 | 389 | sprintf( |
390 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
390 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
391 | 391 | '<br/>', |
392 | 392 | '<strong>', |
393 | 393 | '</strong>' |
394 | 394 | ) |
395 | 395 | ); |
396 | 396 | ?></span><br/> |
397 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
397 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
398 | 398 | </section> |
399 | 399 | <?php } ?> |
400 | 400 | |
401 | 401 | <?php |
402 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
402 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
403 | 403 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
404 | - if ( ! empty( $datetimes )) { ?> |
|
404 | + if ( ! empty($datetimes)) { ?> |
|
405 | 405 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
406 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
407 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
406 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
407 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
408 | 408 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
409 | 409 | <table class="tckt-slctr-tkt-details-tbl"> |
410 | 410 | <thead> |
411 | 411 | <tr> |
412 | 412 | <th class="tckt-slctr-tkt-details-date-th"> |
413 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
413 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
414 | 414 | </th> |
415 | 415 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
416 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
416 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
417 | 417 | </th> |
418 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
418 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
419 | 419 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
420 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
420 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
421 | 421 | </th> |
422 | 422 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
423 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
423 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
424 | 424 | </th> |
425 | 425 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
426 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
426 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
427 | 427 | </th> |
428 | 428 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
429 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
429 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
430 | 430 | </th> |
431 | 431 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
432 | 432 | </tr> |
433 | 433 | </thead> |
434 | 434 | <tbody> |
435 | 435 | <?php |
436 | - foreach ( $datetimes as $datetime ) { |
|
437 | - if ( $datetime instanceof EE_Datetime ) { |
|
436 | + foreach ($datetimes as $datetime) { |
|
437 | + if ($datetime instanceof EE_Datetime) { |
|
438 | 438 | ?> |
439 | 439 | |
440 | 440 | <tr> |
441 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
441 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
442 | 442 | <?php $datetime_name = $datetime->name(); ?> |
443 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
444 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
443 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
444 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
445 | 445 | </td> |
446 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
447 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
446 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
447 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
448 | 448 | </td> |
449 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
450 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
449 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
450 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
451 | 451 | <?php echo $ticket->sold(); ?> |
452 | 452 | </td> |
453 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
454 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
453 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
454 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
455 | 455 | </td> |
456 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
456 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
457 | 457 | <?php echo $datetime->sold(); ?> |
458 | 458 | </td> |
459 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
460 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
461 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
459 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
460 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
461 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
462 | 462 | </td> |
463 | 463 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
464 | 464 | </tr> |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | </div> |
477 | 477 | </td> |
478 | 478 | </tr> |
479 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
479 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
480 | 480 | <?php |
481 | 481 | $row++; |
482 | 482 | } |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | $ticket_row_html = ob_get_clean(); |
486 | 486 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
487 | 487 | $hide_ticket_selector = $ticket_count === 1 && $max_atndz === 1 && $ticket->is_free() ? true : false; |
488 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
489 | -remove_all_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector' ); |
|
488 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
489 | +remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
490 | 490 | // EEH_Debug_Tools::printr( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ), 'display submit', __FILE__, __LINE__ ); |
491 | 491 | // EEH_Debug_Tools::printr( (string) $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
492 | 492 | // EEH_Debug_Tools::printr( (string) $max, '$max', __FILE__, __LINE__ ); |
@@ -500,20 +500,20 @@ discard block |
||
500 | 500 | * @param string '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to |
501 | 501 | * @param int $EVT_ID The Event ID |
502 | 502 | */ |
503 | -$anchor_id = apply_filters( 'FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-' . $EVT_ID, $EVT_ID ); |
|
504 | -if ( ! $hide_ticket_selector ) { |
|
503 | +$anchor_id = apply_filters('FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-'.$EVT_ID, $EVT_ID); |
|
504 | +if ( ! $hide_ticket_selector) { |
|
505 | 505 | ?> |
506 | 506 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
507 | 507 | |
508 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
508 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
509 | 509 | |
510 | 510 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
511 | 511 | <thead> |
512 | 512 | <tr> |
513 | 513 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
514 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
514 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
515 | 515 | </th> |
516 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
516 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
517 | 517 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
518 | 518 | <?php |
519 | 519 | /** |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * @param string 'Price' The translatable text to display in the table header for price |
525 | 525 | * @param int $EVT_ID The Event ID |
526 | 526 | */ |
527 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
527 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
528 | 528 | ?> |
529 | 529 | </th> |
530 | 530 | <?php } ?> |
@@ -538,77 +538,77 @@ discard block |
||
538 | 538 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
539 | 539 | * @param int $EVT_ID The Event ID |
540 | 540 | */ |
541 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
541 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
542 | 542 | ?> |
543 | 543 | </th> |
544 | 544 | </tr> |
545 | 545 | </thead> |
546 | 546 | <tbody> |
547 | - <?php echo $ticket_row_html;?> |
|
547 | + <?php echo $ticket_row_html; ?> |
|
548 | 548 | </tbody> |
549 | 549 | </table> |
550 | 550 | <?php |
551 | - if ( $taxable_tickets && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', true ) ) { |
|
552 | - if ( $tax_settings->prices_displayed_including_taxes ) { |
|
553 | - $ticket_price_includes_taxes = __( '* price includes taxes', 'event_espresso' ); |
|
551 | + if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
552 | + if ($tax_settings->prices_displayed_including_taxes) { |
|
553 | + $ticket_price_includes_taxes = __('* price includes taxes', 'event_espresso'); |
|
554 | 554 | } else { |
555 | - $ticket_price_includes_taxes = __( '* price does not include taxes', 'event_espresso' ); |
|
555 | + $ticket_price_includes_taxes = __('* price does not include taxes', 'event_espresso'); |
|
556 | 556 | } |
557 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
557 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>'; |
|
558 | 558 | } |
559 | 559 | ?> |
560 | 560 | |
561 | 561 | <input type="hidden" name="noheader" value="true" /> |
562 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>" /> |
|
562 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>" /> |
|
563 | 563 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
564 | 564 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
565 | 565 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
566 | 566 | |
567 | 567 | <?php |
568 | -if ( $max_atndz > 0 ) { |
|
568 | +if ($max_atndz > 0) { |
|
569 | 569 | echo apply_filters( |
570 | 570 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
571 | 571 | '' |
572 | 572 | ); |
573 | 573 | } |
574 | -if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
575 | - add_filter( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true' ); |
|
574 | +if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
575 | + add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
|
576 | 576 | } |
577 | -do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
577 | +do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
578 | 578 | ?> |
579 | 579 | |
580 | 580 | <?php |
581 | -} else if ( isset( $TKT_ID ) ) { |
|
582 | - add_filter( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true' ); |
|
581 | +} else if (isset($TKT_ID)) { |
|
582 | + add_filter('FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true'); |
|
583 | 583 | ?> |
584 | 584 | |
585 | 585 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
586 | 586 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
587 | 587 | <input type="hidden" name="noheader" value="true"/> |
588 | -<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>"/> |
|
588 | +<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>"/> |
|
589 | 589 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>"/> |
590 | 590 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
591 | 591 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
592 | 592 | <?php |
593 | - if ( $ticket instanceof EE_Ticket ) { |
|
594 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
593 | + if ($ticket instanceof EE_Ticket) { |
|
594 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
595 | 595 | $ticket_description = $ticket->description(); |
596 | - $ticket_description .= ! empty( $ticket_description ) |
|
597 | - ? '<br />' . $ticket_status_display |
|
596 | + $ticket_description .= ! empty($ticket_description) |
|
597 | + ? '<br />'.$ticket_status_display |
|
598 | 598 | : $ticket_status_display; |
599 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
599 | + if ( ! strpos($ticket_description, '<div')) { |
|
600 | 600 | $ticket_description = "<p>{$ticket_description}</p>"; |
601 | 601 | } |
602 | 602 | ?> |
603 | 603 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
604 | 604 | <div class="no-tkt-slctr-ticket-content-dv"> |
605 | 605 | <h5><?php echo $ticket->name(); ?></h5> |
606 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
606 | + <?php if ( ! empty($ticket_description)) { ?> |
|
607 | 607 | <?php echo $ticket_description; ?> |
608 | 608 | <?php } ?> |
609 | 609 | </div> |
610 | 610 | <?php |
611 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
611 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | ?> |
@@ -466,38 +466,38 @@ discard block |
||
466 | 466 | * @throws \EE_Error |
467 | 467 | */ |
468 | 468 | public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) { |
469 | - // registrations per event |
|
469 | + // registrations per event |
|
470 | 470 | $event_reg_count = array(); |
471 | 471 | // spaces left per event |
472 | 472 | $event_spaces_remaining = array(); |
473 | - // tickets left sorted by ID |
|
474 | - $tickets_remaining = array(); |
|
475 | - // registrations that have lost their space |
|
473 | + // tickets left sorted by ID |
|
474 | + $tickets_remaining = array(); |
|
475 | + // registrations that have lost their space |
|
476 | 476 | $ejected_registrations = array(); |
477 | 477 | foreach ( $registrations as $REG_ID => $registration ) { |
478 | 478 | if ( $registration->status_ID() === EEM_Registration::status_id_approved ) { |
479 | 479 | continue; |
480 | 480 | } |
481 | 481 | $EVT_ID = $registration->event_ID(); |
482 | - $ticket = $registration->ticket(); |
|
483 | - if ( ! isset($tickets_remaining[$ticket->ID()])) { |
|
484 | - $tickets_remaining[$ticket->ID()] = $ticket->remaining(); |
|
485 | - } |
|
486 | - if ($tickets_remaining[$ticket->ID()] > 0) { |
|
487 | - if ( ! isset($event_reg_count[$EVT_ID])) { |
|
488 | - $event_reg_count[$EVT_ID] = 0; |
|
489 | - } |
|
490 | - $event_reg_count[$EVT_ID]++; |
|
491 | - if ( ! isset($event_spaces_remaining[$EVT_ID])) { |
|
492 | - $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale(); |
|
493 | - } |
|
494 | - } |
|
482 | + $ticket = $registration->ticket(); |
|
483 | + if ( ! isset($tickets_remaining[$ticket->ID()])) { |
|
484 | + $tickets_remaining[$ticket->ID()] = $ticket->remaining(); |
|
485 | + } |
|
486 | + if ($tickets_remaining[$ticket->ID()] > 0) { |
|
487 | + if ( ! isset($event_reg_count[$EVT_ID])) { |
|
488 | + $event_reg_count[$EVT_ID] = 0; |
|
489 | + } |
|
490 | + $event_reg_count[$EVT_ID]++; |
|
491 | + if ( ! isset($event_spaces_remaining[$EVT_ID])) { |
|
492 | + $event_spaces_remaining[$EVT_ID] = $registration->event()->spaces_remaining_for_sale(); |
|
493 | + } |
|
494 | + } |
|
495 | 495 | if ( |
496 | 496 | $revisit |
497 | 497 | && ( |
498 | - $tickets_remaining[$ticket->ID()] === 0 |
|
499 | - || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
500 | - ) |
|
498 | + $tickets_remaining[$ticket->ID()] === 0 |
|
499 | + || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
500 | + ) |
|
501 | 501 | ) { |
502 | 502 | $ejected_registrations[ $REG_ID ] = $registration->event(); |
503 | 503 | if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) { |
@@ -572,9 +572,9 @@ discard block |
||
572 | 572 | 'layout_strategy' => new EE_Template_Layout( |
573 | 573 | array( |
574 | 574 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
575 | - . $this->_slug |
|
576 | - . DS |
|
577 | - . 'sold_out_events.template.php', |
|
575 | + . $this->_slug |
|
576 | + . DS |
|
577 | + . 'sold_out_events.template.php', |
|
578 | 578 | 'template_args' => apply_filters( |
579 | 579 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
580 | 580 | array( |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | 'layout_strategy' => new EE_Template_Layout( |
626 | 626 | array( |
627 | 627 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
628 | - . $this->_slug |
|
629 | - . DS |
|
630 | - . 'sold_out_events.template.php', |
|
628 | + . $this->_slug |
|
629 | + . DS |
|
630 | + . 'sold_out_events.template.php', |
|
631 | 631 | 'template_args' => apply_filters( |
632 | 632 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___insufficient_spaces_available__template_args', |
633 | 633 | array( |
@@ -679,9 +679,9 @@ discard block |
||
679 | 679 | 'layout_strategy' => new EE_Template_Layout( |
680 | 680 | array( |
681 | 681 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
682 | - . $this->_slug |
|
683 | - . DS |
|
684 | - . 'events_requiring_pre_approval.template.php', // layout_template |
|
682 | + . $this->_slug |
|
683 | + . DS |
|
684 | + . 'events_requiring_pre_approval.template.php', // layout_template |
|
685 | 685 | 'template_args' => apply_filters( |
686 | 686 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
687 | 687 | array( |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | 'layout_strategy' => new EE_Template_Layout( |
724 | 724 | array( |
725 | 725 | 'layout_template_file' => SPCO_REG_STEPS_PATH |
726 | - . $this->_slug |
|
727 | - . DS |
|
728 | - . 'no_payment_required.template.php', // layout_template |
|
726 | + . $this->_slug |
|
727 | + . DS |
|
728 | + . 'no_payment_required.template.php', // layout_template |
|
729 | 729 | 'template_args' => apply_filters( |
730 | 730 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
731 | 731 | array( |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
956 | 956 | } |
957 | 957 | $payment_methods_billing_info[ $payment_method->slug() |
958 | - . '-info' ] = $this->_payment_method_billing_info( |
|
958 | + . '-info' ] = $this->_payment_method_billing_info( |
|
959 | 959 | $payment_method |
960 | 960 | ); |
961 | 961 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | // fill form with attendee info if applicable |
1144 | 1144 | if ( |
1145 | 1145 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
1146 | - && $this->checkout->transaction_has_primary_registrant() |
|
1146 | + && $this->checkout->transaction_has_primary_registrant() |
|
1147 | 1147 | ) { |
1148 | 1148 | $payment_method_billing_form->populate_from_attendee( |
1149 | 1149 | $this->checkout->transaction->primary_registration()->attendee() |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | // and debug content |
1153 | 1153 | if ( |
1154 | 1154 | $payment_method_billing_form instanceof EE_Billing_Info_Form |
1155 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1155 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1156 | 1156 | ) { |
1157 | 1157 | $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
1158 | 1158 | $payment_method_billing_form |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | } |
1328 | 1328 | // and debug content |
1329 | 1329 | if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
1330 | - && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1330 | + && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
|
1331 | 1331 | ) { |
1332 | 1332 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
1333 | 1333 | $this->checkout->billing_form |
@@ -1461,8 +1461,8 @@ discard block |
||
1461 | 1461 | } |
1462 | 1462 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1463 | 1463 | if ( ! empty( $attendee_data['ATT_fname'] ) |
1464 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1465 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1464 | + && ! empty( $attendee_data['ATT_lname'] ) |
|
1465 | + && ! empty( $attendee_data['ATT_email'] ) |
|
1466 | 1466 | ) { |
1467 | 1467 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1468 | 1468 | array( |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | $payment_status = $payment->status(); |
1703 | 1703 | if ( |
1704 | 1704 | $payment_status === EEM_Payment::status_id_approved |
1705 | - || $payment_status === EEM_Payment::status_id_pending |
|
1705 | + || $payment_status === EEM_Payment::status_id_pending |
|
1706 | 1706 | ) { |
1707 | 1707 | return true; |
1708 | 1708 | } else { |
@@ -1888,8 +1888,8 @@ discard block |
||
1888 | 1888 | return false; |
1889 | 1889 | } |
1890 | 1890 | if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
1891 | - instanceof |
|
1892 | - EE_Attendee |
|
1891 | + instanceof |
|
1892 | + EE_Attendee |
|
1893 | 1893 | ) { |
1894 | 1894 | EE_Error::add_error( |
1895 | 1895 | sprintf( |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -38,32 +38,32 @@ discard block |
||
38 | 38 | public static function set_hooks() { |
39 | 39 | add_filter( |
40 | 40 | 'FHEE__SPCO__EE_Line_Item_Filter_Collection', |
41 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) |
|
41 | + array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters') |
|
42 | 42 | ); |
43 | 43 | add_action( |
44 | 44 | 'wp_ajax_switch_spco_billing_form', |
45 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
45 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
46 | 46 | ); |
47 | 47 | add_action( |
48 | 48 | 'wp_ajax_nopriv_switch_spco_billing_form', |
49 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' ) |
|
49 | + array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form') |
|
50 | 50 | ); |
51 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) ); |
|
51 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
52 | 52 | add_action( |
53 | 53 | 'wp_ajax_nopriv_save_payer_details', |
54 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' ) |
|
54 | + array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details') |
|
55 | 55 | ); |
56 | 56 | add_action( |
57 | 57 | 'wp_ajax_get_transaction_details_for_gateways', |
58 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
58 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
59 | 59 | ); |
60 | 60 | add_action( |
61 | 61 | 'wp_ajax_nopriv_get_transaction_details_for_gateways', |
62 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
62 | + array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
63 | 63 | ); |
64 | 64 | add_filter( |
65 | 65 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
66 | - array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), |
|
66 | + array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), |
|
67 | 67 | 10, |
68 | 68 | 1 |
69 | 69 | ); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @throws \EE_Error |
78 | 78 | */ |
79 | 79 | public static function switch_spco_billing_form() { |
80 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
80 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @throws \EE_Error |
89 | 89 | */ |
90 | 90 | public static function save_payer_details() { |
91 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
91 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @throws \EE_Error |
100 | 100 | */ |
101 | 101 | public static function get_transaction_details() { |
102 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
102 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @param EE_Checkout $checkout |
128 | 128 | */ |
129 | - public function __construct( EE_Checkout $checkout ) { |
|
129 | + public function __construct(EE_Checkout $checkout) { |
|
130 | 130 | $this->_slug = 'payment_options'; |
131 | - $this->_name = __( 'Payment Options', 'event_espresso' ); |
|
132 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
131 | + $this->_name = __('Payment Options', 'event_espresso'); |
|
132 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
133 | 133 | $this->checkout = $checkout; |
134 | 134 | $this->_reset_success_message(); |
135 | 135 | $this->set_instructions( |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * @param null $line_item_display |
156 | 156 | */ |
157 | - public function set_line_item_display( $line_item_display ) { |
|
157 | + public function set_line_item_display($line_item_display) { |
|
158 | 158 | $this->line_item_display = $line_item_display; |
159 | 159 | } |
160 | 160 | |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * @param boolean $handle_IPN_in_this_request |
174 | 174 | */ |
175 | - public function set_handle_IPN_in_this_request( $handle_IPN_in_this_request ) { |
|
176 | - $this->handle_IPN_in_this_request = filter_var( $handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN ); |
|
175 | + public function set_handle_IPN_in_this_request($handle_IPN_in_this_request) { |
|
176 | + $this->handle_IPN_in_this_request = filter_var($handle_IPN_in_this_request, FILTER_VALIDATE_BOOLEAN); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | public function enqueue_styles_and_scripts() { |
209 | 209 | $transaction = $this->checkout->transaction; |
210 | 210 | //if the transaction isn't set or nothing is owed on it, don't enqueue any JS |
211 | - if( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats( $transaction->remaining(), 0 ) ) { |
|
211 | + if ( ! $transaction instanceof EE_Transaction || EEH_Money::compare_floats($transaction->remaining(), 0)) { |
|
212 | 212 | return; |
213 | 213 | } |
214 | - foreach( EEM_Payment_Method::instance()->get_all_for_transaction( $transaction, EEM_Payment_Method::scope_cart ) as $payment_method ) { |
|
214 | + foreach (EEM_Payment_Method::instance()->get_all_for_transaction($transaction, EEM_Payment_Method::scope_cart) as $payment_method) { |
|
215 | 215 | $type_obj = $payment_method->type_obj(); |
216 | - if( $type_obj instanceof EE_PMT_Base ) { |
|
217 | - $billing_form = $type_obj->generate_new_billing_form( $transaction ); |
|
218 | - if( $billing_form instanceof EE_Form_Section_Proper ) { |
|
216 | + if ($type_obj instanceof EE_PMT_Base) { |
|
217 | + $billing_form = $type_obj->generate_new_billing_form($transaction); |
|
218 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
219 | 219 | $billing_form->enqueue_js(); |
220 | 220 | } |
221 | 221 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | // $ 0.00 transactions (no payment required) |
241 | 241 | ! $this->checkout->payment_required() |
242 | 242 | // but do NOT remove if current action being called belongs to this reg step |
243 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
243 | + && ! is_callable(array($this, $this->checkout->action)) |
|
244 | 244 | && ! $this->completed() |
245 | 245 | ) { |
246 | 246 | // and if so, then we no longer need the Payment Options step |
247 | - if ( $this->is_current_step() ) { |
|
247 | + if ($this->is_current_step()) { |
|
248 | 248 | $this->checkout->generate_reg_form = false; |
249 | 249 | } |
250 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
250 | + $this->checkout->remove_reg_step($this->_slug); |
|
251 | 251 | // DEBUG LOG |
252 | 252 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
253 | 253 | return false; |
254 | 254 | } |
255 | 255 | // load EEM_Payment_Method |
256 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
256 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
257 | 257 | // get all active payment methods |
258 | 258 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
259 | 259 | $this->checkout->transaction, |
@@ -280,15 +280,15 @@ discard block |
||
280 | 280 | $insufficient_spaces_available = array(); |
281 | 281 | $reg_count = 0; |
282 | 282 | // loop thru registrations to gather info |
283 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
283 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
284 | 284 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
285 | 285 | $registrations, |
286 | 286 | $this->checkout->revisit |
287 | 287 | ); |
288 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
288 | + foreach ($registrations as $REG_ID => $registration) { |
|
289 | 289 | // has this registration lost it's space ? |
290 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
291 | - $insufficient_spaces_available[ $registration->event()->ID() ] = $registration->event(); |
|
290 | + if (isset($ejected_registrations[$REG_ID])) { |
|
291 | + $insufficient_spaces_available[$registration->event()->ID()] = $registration->event(); |
|
292 | 292 | continue; |
293 | 293 | } |
294 | 294 | /** @var $registration EE_Registration */ |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | && $registration->status_ID() === EEM_Registration::status_id_approved |
301 | 301 | ) |
302 | 302 | ) { |
303 | - if ( $registration->event()->is_sold_out() || $registration->event()->is_sold_out( true ) ) { |
|
303 | + if ($registration->event()->is_sold_out() || $registration->event()->is_sold_out(true)) { |
|
304 | 304 | // add event to list of events that are sold out |
305 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
305 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
306 | 306 | do_action( |
307 | 307 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
308 | 308 | $registration->event(), |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | continue; |
312 | 312 | } |
313 | 313 | // event requires admin approval |
314 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
314 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
315 | 315 | // add event to list of events with pre-approval reg status |
316 | - $registrations_requiring_pre_approval[ $REG_ID ] = $registration; |
|
316 | + $registrations_requiring_pre_approval[$REG_ID] = $registration; |
|
317 | 317 | do_action( |
318 | 318 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
319 | 319 | $registration->event(), |
@@ -322,8 +322,8 @@ discard block |
||
322 | 322 | } |
323 | 323 | } |
324 | 324 | // are they allowed to pay now and is there monies owing? |
325 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
326 | - $registrations_requiring_payment[ $REG_ID ] = $registration; |
|
325 | + if ($registration->owes_monies_and_can_pay()) { |
|
326 | + $registrations_requiring_payment[$REG_ID] = $registration; |
|
327 | 327 | do_action( |
328 | 328 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
329 | 329 | $registration->event(), |
@@ -334,29 +334,29 @@ discard block |
||
334 | 334 | && $registration->status_ID() !== EEM_Registration::status_id_not_approved |
335 | 335 | && $registration->ticket()->is_free() |
336 | 336 | ) { |
337 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
337 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | $subsections = array(); |
341 | 341 | // now decide which template to load |
342 | - if ( ! empty( $sold_out_events ) ) { |
|
343 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
342 | + if ( ! empty($sold_out_events)) { |
|
343 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
344 | 344 | } |
345 | - if ( ! empty( $insufficient_spaces_available ) ) { |
|
345 | + if ( ! empty($insufficient_spaces_available)) { |
|
346 | 346 | $subsections['insufficient_space'] = $this->_insufficient_spaces_available( |
347 | 347 | $insufficient_spaces_available |
348 | 348 | ); |
349 | 349 | } |
350 | - if ( ! empty( $registrations_requiring_pre_approval ) ) { |
|
350 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
351 | 351 | $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( |
352 | 352 | $registrations_requiring_pre_approval |
353 | 353 | ); |
354 | 354 | } |
355 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
356 | - $subsections['no_payment_required'] = $this->_no_payment_required( $registrations_for_free_events ); |
|
355 | + if ( ! empty($registrations_for_free_events)) { |
|
356 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
357 | 357 | } |
358 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
359 | - if ( $this->checkout->amount_owing > 0 ) { |
|
358 | + if ( ! empty($registrations_requiring_payment)) { |
|
359 | + if ($this->checkout->amount_owing > 0) { |
|
360 | 360 | // autoload Line_Item_Display classes |
361 | 361 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
362 | 362 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -369,15 +369,15 @@ discard block |
||
369 | 369 | /** @var EE_Line_Item $filtered_line_item_tree */ |
370 | 370 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
371 | 371 | EEH_Autoloader::register_line_item_display_autoloaders(); |
372 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
372 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
373 | 373 | $subsections['payment_options'] = $this->_display_payment_options( |
374 | 374 | $this->line_item_display->display_line_item( |
375 | 375 | $filtered_line_item_tree, |
376 | - array( 'registrations' => $registrations ) |
|
376 | + array('registrations' => $registrations) |
|
377 | 377 | ) |
378 | 378 | ); |
379 | 379 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
380 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
380 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
381 | 381 | } |
382 | 382 | } else { |
383 | 383 | $this->_hide_reg_step_submit_button_if_revisit(); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @return \EE_Line_Item_Filter_Collection |
409 | 409 | * @throws \EE_Error |
410 | 410 | */ |
411 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
411 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
412 | 412 | $line_item_filter_collection->add( |
413 | 413 | new EE_Billable_Line_Item_Filter( |
414 | 414 | EE_SPCO_Reg_Step_Payment_Options::remove_ejected_registrations( |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | ) |
419 | 419 | ) |
420 | 420 | ); |
421 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
421 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
422 | 422 | return $line_item_filter_collection; |
423 | 423 | } |
424 | 424 | |
@@ -434,15 +434,15 @@ discard block |
||
434 | 434 | * @return \EE_Registration[] |
435 | 435 | * @throws \EE_Error |
436 | 436 | */ |
437 | - public static function remove_ejected_registrations( array $registrations ) { |
|
437 | + public static function remove_ejected_registrations(array $registrations) { |
|
438 | 438 | $ejected_registrations = EE_SPCO_Reg_Step_Payment_Options::find_registrations_that_lost_their_space( |
439 | 439 | $registrations, |
440 | 440 | EE_Registry::instance()->SSN->checkout()->revisit |
441 | 441 | ); |
442 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
442 | + foreach ($registrations as $REG_ID => $registration) { |
|
443 | 443 | // has this registration lost it's space ? |
444 | - if ( isset( $ejected_registrations[ $REG_ID ] ) ) { |
|
445 | - unset( $registrations[ $REG_ID ] ); |
|
444 | + if (isset($ejected_registrations[$REG_ID])) { |
|
445 | + unset($registrations[$REG_ID]); |
|
446 | 446 | continue; |
447 | 447 | } |
448 | 448 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * @return array |
466 | 466 | * @throws \EE_Error |
467 | 467 | */ |
468 | - public static function find_registrations_that_lost_their_space( array $registrations, $revisit = false ) { |
|
468 | + public static function find_registrations_that_lost_their_space(array $registrations, $revisit = false) { |
|
469 | 469 | // registrations per event |
470 | 470 | $event_reg_count = array(); |
471 | 471 | // spaces left per event |
@@ -474,8 +474,8 @@ discard block |
||
474 | 474 | $tickets_remaining = array(); |
475 | 475 | // registrations that have lost their space |
476 | 476 | $ejected_registrations = array(); |
477 | - foreach ( $registrations as $REG_ID => $registration ) { |
|
478 | - if ( $registration->status_ID() === EEM_Registration::status_id_approved ) { |
|
477 | + foreach ($registrations as $REG_ID => $registration) { |
|
478 | + if ($registration->status_ID() === EEM_Registration::status_id_approved) { |
|
479 | 479 | continue; |
480 | 480 | } |
481 | 481 | $EVT_ID = $registration->event_ID(); |
@@ -496,13 +496,13 @@ discard block |
||
496 | 496 | $revisit |
497 | 497 | && ( |
498 | 498 | $tickets_remaining[$ticket->ID()] === 0 |
499 | - || $event_reg_count[ $EVT_ID ] > $event_spaces_remaining[ $EVT_ID ] |
|
499 | + || $event_reg_count[$EVT_ID] > $event_spaces_remaining[$EVT_ID] |
|
500 | 500 | ) |
501 | 501 | ) { |
502 | - $ejected_registrations[ $REG_ID ] = $registration->event(); |
|
503 | - if ( $registration->status_ID() !== EEM_Registration::status_id_wait_list ) { |
|
502 | + $ejected_registrations[$REG_ID] = $registration->event(); |
|
503 | + if ($registration->status_ID() !== EEM_Registration::status_id_wait_list) { |
|
504 | 504 | /** @type EE_Registration_Processor $registration_processor */ |
505 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
505 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
506 | 506 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
507 | 507 | $registration_processor->manually_update_registration_status( |
508 | 508 | $registration, |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * @return void |
538 | 538 | */ |
539 | 539 | protected function _hide_reg_step_submit_button_if_revisit() { |
540 | - if ( $this->checkout->revisit ) { |
|
541 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
540 | + if ($this->checkout->revisit) { |
|
541 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | * @return \EE_Form_Section_Proper |
553 | 553 | * @throws \EE_Error |
554 | 554 | */ |
555 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
555 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
556 | 556 | // set some defaults |
557 | 557 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
558 | 558 | $sold_out_events = ''; |
559 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
559 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
560 | 560 | $sold_out_events .= EEH_HTML::li( |
561 | - EEH_HTML::span( ' ' .$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
561 | + EEH_HTML::span(' '.$sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
562 | 562 | ); |
563 | 563 | } |
564 | 564 | return new EE_Form_Section_Proper( |
@@ -605,14 +605,14 @@ discard block |
||
605 | 605 | * @return \EE_Form_Section_Proper |
606 | 606 | * @throws \EE_Error |
607 | 607 | */ |
608 | - private function _insufficient_spaces_available( $insufficient_spaces_events_array = array() ) { |
|
608 | + private function _insufficient_spaces_available($insufficient_spaces_events_array = array()) { |
|
609 | 609 | // set some defaults |
610 | 610 | $this->checkout->selected_method_of_payment = 'invoice'; |
611 | 611 | $insufficient_space_events = ''; |
612 | - foreach ( $insufficient_spaces_events_array as $event ) { |
|
613 | - if ( $event instanceof EE_Event ) { |
|
612 | + foreach ($insufficient_spaces_events_array as $event) { |
|
613 | + if ($event instanceof EE_Event) { |
|
614 | 614 | $insufficient_space_events .= EEH_HTML::li( |
615 | - EEH_HTML::span( ' ' . $event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' ) |
|
615 | + EEH_HTML::span(' '.$event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text') |
|
616 | 616 | ); |
617 | 617 | } |
618 | 618 | } |
@@ -656,17 +656,17 @@ discard block |
||
656 | 656 | * @return \EE_Form_Section_Proper |
657 | 657 | * @throws \EE_Error |
658 | 658 | */ |
659 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array() ) { |
|
659 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
660 | 660 | $events_requiring_pre_approval = ''; |
661 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
662 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
663 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
661 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
662 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
663 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
664 | 664 | EEH_HTML::span( |
665 | 665 | '', |
666 | 666 | '', |
667 | 667 | 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
668 | 668 | ) |
669 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
669 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
670 | 670 | ); |
671 | 671 | } |
672 | 672 | } |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | 'template_args' => apply_filters( |
686 | 686 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
687 | 687 | array( |
688 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
688 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
689 | 689 | 'events_requiring_pre_approval_msg' => apply_filters( |
690 | 690 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
691 | 691 | __( |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | * @return \EE_Form_Section_Proper |
711 | 711 | * @throws \EE_Error |
712 | 712 | */ |
713 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
713 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
714 | 714 | // set some defaults |
715 | 715 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
716 | 716 | // generate no_payment_required form |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | 'ticket_count' => array(), |
735 | 735 | 'registrations_for_free_events' => $registrations_for_free_events, |
736 | 736 | 'no_payment_required_msg' => EEH_HTML::p( |
737 | - __( 'This is a free event, so no billing will occur.', 'event_espresso' ) |
|
737 | + __('This is a free event, so no billing will occur.', 'event_espresso') |
|
738 | 738 | ) |
739 | 739 | ) |
740 | 740 | ), |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | * @return \EE_Form_Section_Proper |
754 | 754 | * @throws \EE_Error |
755 | 755 | */ |
756 | - private function _display_payment_options( $transaction_details = '' ) { |
|
756 | + private function _display_payment_options($transaction_details = '') { |
|
757 | 757 | // has method_of_payment been set by no-js user? |
758 | 758 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
759 | 759 | // build payment options form |
@@ -765,18 +765,18 @@ discard block |
||
765 | 765 | 'before_payment_options' => apply_filters( |
766 | 766 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
767 | 767 | new EE_Form_Section_Proper( |
768 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
768 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
769 | 769 | ) |
770 | 770 | ), |
771 | 771 | 'payment_options' => $this->_setup_payment_options(), |
772 | 772 | 'after_payment_options' => apply_filters( |
773 | 773 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
774 | 774 | new EE_Form_Section_Proper( |
775 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
775 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
776 | 776 | ) |
777 | 777 | ), |
778 | 778 | 'default_hidden_inputs' => $this->reg_step_hidden_inputs(), |
779 | - 'extra_hidden_inputs' => $this->_extra_hidden_inputs( false ) |
|
779 | + 'extra_hidden_inputs' => $this->_extra_hidden_inputs(false) |
|
780 | 780 | ), |
781 | 781 | 'layout_strategy' => new EE_Template_Layout( |
782 | 782 | array( |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | * @return \EE_Form_Section_Proper |
806 | 806 | * @throws \EE_Error |
807 | 807 | */ |
808 | - private function _extra_hidden_inputs( $no_payment_required = true ) { |
|
808 | + private function _extra_hidden_inputs($no_payment_required = true) { |
|
809 | 809 | return new EE_Form_Section_Proper( |
810 | 810 | array( |
811 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
811 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
812 | 812 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
813 | 813 | 'subsections' => array( |
814 | 814 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -840,16 +840,16 @@ discard block |
||
840 | 840 | * @access protected |
841 | 841 | * @param array $registrations |
842 | 842 | */ |
843 | - protected function _apply_registration_payments_to_amount_owing( array $registrations ) { |
|
843 | + protected function _apply_registration_payments_to_amount_owing(array $registrations) { |
|
844 | 844 | $payments = array(); |
845 | - foreach ( $registrations as $registration ) { |
|
846 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
845 | + foreach ($registrations as $registration) { |
|
846 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
847 | 847 | $payments += $registration->registration_payments(); |
848 | 848 | } |
849 | 849 | } |
850 | - if ( ! empty( $payments ) ) { |
|
851 | - foreach ( $payments as $payment ) { |
|
852 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
850 | + if ( ! empty($payments)) { |
|
851 | + foreach ($payments as $payment) { |
|
852 | + if ($payment instanceof EE_Registration_Payment) { |
|
853 | 853 | $this->checkout->amount_owing -= $payment->amount(); |
854 | 854 | } |
855 | 855 | } |
@@ -865,11 +865,11 @@ discard block |
||
865 | 865 | * @param bool $force_reset |
866 | 866 | * @return void |
867 | 867 | */ |
868 | - private function _reset_selected_method_of_payment( $force_reset = false ) { |
|
868 | + private function _reset_selected_method_of_payment($force_reset = false) { |
|
869 | 869 | $reset_payment_method = $force_reset |
870 | 870 | ? true |
871 | - : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', false ) ); |
|
872 | - if ( $reset_payment_method ) { |
|
871 | + : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', false)); |
|
872 | + if ($reset_payment_method) { |
|
873 | 873 | $this->checkout->selected_method_of_payment = null; |
874 | 874 | $this->checkout->payment_method = null; |
875 | 875 | $this->checkout->billing_form = null; |
@@ -888,12 +888,12 @@ discard block |
||
888 | 888 | * @param string $selected_method_of_payment |
889 | 889 | * @return void |
890 | 890 | */ |
891 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
892 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) |
|
891 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
892 | + $selected_method_of_payment = ! empty($selected_method_of_payment) |
|
893 | 893 | ? $selected_method_of_payment |
894 | 894 | : $this->checkout->selected_method_of_payment; |
895 | 895 | EE_Registry::instance()->SSN->set_session_data( |
896 | - array( 'selected_method_of_payment' => $selected_method_of_payment ) |
|
896 | + array('selected_method_of_payment' => $selected_method_of_payment) |
|
897 | 897 | ); |
898 | 898 | } |
899 | 899 | |
@@ -909,19 +909,19 @@ discard block |
||
909 | 909 | // load payment method classes |
910 | 910 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
911 | 911 | // switch up header depending on number of available payment methods |
912 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
912 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
913 | 913 | ? apply_filters( |
914 | 914 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
915 | - __( 'Please Select Your Method of Payment', 'event_espresso' ) |
|
915 | + __('Please Select Your Method of Payment', 'event_espresso') |
|
916 | 916 | ) |
917 | 917 | : apply_filters( |
918 | 918 | 'FHEE__registration_page_payment_options__method_of_payment_hdr', |
919 | - __( 'Method of Payment', 'event_espresso' ) |
|
919 | + __('Method of Payment', 'event_espresso') |
|
920 | 920 | ); |
921 | 921 | $available_payment_methods = array( |
922 | 922 | // display the "Payment Method" header |
923 | 923 | 'payment_method_header' => new EE_Form_Section_HTML( |
924 | - EEH_HTML::h4( $payment_method_header, 'method-of-payment-hdr' ) |
|
924 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
925 | 925 | ) |
926 | 926 | ); |
927 | 927 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
@@ -930,32 +930,32 @@ discard block |
||
930 | 930 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
931 | 931 | $payment_methods_billing_info = array( |
932 | 932 | new EE_Form_Section_HTML( |
933 | - EEH_HTML::div( '<br />', '', '', 'clear:both;' ) |
|
933 | + EEH_HTML::div('<br />', '', '', 'clear:both;') |
|
934 | 934 | ) |
935 | 935 | ); |
936 | 936 | // loop through payment methods |
937 | - foreach ( $this->checkout->available_payment_methods as $payment_method ) { |
|
938 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
937 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
938 | + if ($payment_method instanceof EE_Payment_Method) { |
|
939 | 939 | $payment_method_button = EEH_HTML::img( |
940 | 940 | $payment_method->button_url(), |
941 | 941 | $payment_method->name(), |
942 | - 'spco-payment-method-' . $payment_method->slug() . '-btn-img', |
|
942 | + 'spco-payment-method-'.$payment_method->slug().'-btn-img', |
|
943 | 943 | 'spco-payment-method-btn-img' |
944 | 944 | ); |
945 | 945 | // check if any payment methods are set as default |
946 | 946 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
947 | 947 | if ( |
948 | - ( $this->checkout->selected_method_of_payment === $payment_method->slug() ) |
|
949 | - || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() ) |
|
948 | + ($this->checkout->selected_method_of_payment === $payment_method->slug()) |
|
949 | + || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default()) |
|
950 | 950 | ) { |
951 | 951 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
952 | 952 | $this->_save_selected_method_of_payment(); |
953 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
953 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
954 | 954 | } else { |
955 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
955 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
956 | 956 | } |
957 | - $payment_methods_billing_info[ $payment_method->slug() |
|
958 | - . '-info' ] = $this->_payment_method_billing_info( |
|
957 | + $payment_methods_billing_info[$payment_method->slug() |
|
958 | + . '-info'] = $this->_payment_method_billing_info( |
|
959 | 959 | $payment_method |
960 | 960 | ); |
961 | 961 | } |
@@ -985,12 +985,12 @@ discard block |
||
985 | 985 | * @return EE_Payment_Method[] |
986 | 986 | */ |
987 | 987 | protected function _get_available_payment_methods() { |
988 | - if ( ! empty( $this->checkout->available_payment_methods ) ) { |
|
988 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
989 | 989 | return $this->checkout->available_payment_methods; |
990 | 990 | } |
991 | 991 | $available_payment_methods = array(); |
992 | 992 | // load EEM_Payment_Method |
993 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
993 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
994 | 994 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
995 | 995 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
996 | 996 | // get all active payment methods |
@@ -998,9 +998,9 @@ discard block |
||
998 | 998 | $this->checkout->transaction, |
999 | 999 | EEM_Payment_Method::scope_cart |
1000 | 1000 | ); |
1001 | - foreach ( $payment_methods as $payment_method ) { |
|
1002 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
1003 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
1001 | + foreach ($payment_methods as $payment_method) { |
|
1002 | + if ($payment_method instanceof EE_Payment_Method) { |
|
1003 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | return $available_payment_methods; |
@@ -1015,14 +1015,14 @@ discard block |
||
1015 | 1015 | * @param array $available_payment_method_options |
1016 | 1016 | * @return \EE_Form_Section_Proper |
1017 | 1017 | */ |
1018 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
1018 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
1019 | 1019 | // generate inputs |
1020 | 1020 | return new EE_Form_Section_Proper( |
1021 | 1021 | array( |
1022 | 1022 | 'html_id' => 'ee-available-payment-method-inputs', |
1023 | 1023 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1024 | 1024 | 'subsections' => array( |
1025 | - '' => new EE_Radio_Button_Input ( |
|
1025 | + '' => new EE_Radio_Button_Input( |
|
1026 | 1026 | $available_payment_method_options, |
1027 | 1027 | array( |
1028 | 1028 | 'html_name' => 'selected_method_of_payment', |
@@ -1047,28 +1047,28 @@ discard block |
||
1047 | 1047 | * @return \EE_Form_Section_Proper |
1048 | 1048 | * @throws \EE_Error |
1049 | 1049 | */ |
1050 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
1050 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
1051 | 1051 | $currently_selected = $this->checkout->selected_method_of_payment === $payment_method->slug() |
1052 | 1052 | ? true |
1053 | 1053 | : false; |
1054 | 1054 | // generate the billing form for payment method |
1055 | 1055 | $billing_form = $currently_selected |
1056 | - ? $this->_get_billing_form_for_payment_method( $payment_method ) |
|
1056 | + ? $this->_get_billing_form_for_payment_method($payment_method) |
|
1057 | 1057 | : new EE_Form_Section_HTML(); |
1058 | 1058 | $this->checkout->billing_form = $currently_selected |
1059 | 1059 | ? $billing_form |
1060 | 1060 | : $this->checkout->billing_form; |
1061 | 1061 | // it's all in the details |
1062 | 1062 | $info_html = EEH_HTML::h3( |
1063 | - __( 'Important information regarding your payment', 'event_espresso' ), |
|
1063 | + __('Important information regarding your payment', 'event_espresso'), |
|
1064 | 1064 | '', |
1065 | 1065 | 'spco-payment-method-hdr' |
1066 | 1066 | ); |
1067 | 1067 | // add some info regarding the step, either from what's saved in the admin, |
1068 | 1068 | // or a default string depending on whether the PM has a billing form or not |
1069 | - if ( $payment_method->description() ) { |
|
1069 | + if ($payment_method->description()) { |
|
1070 | 1070 | $payment_method_info = $payment_method->description(); |
1071 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1071 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
1072 | 1072 | $payment_method_info = sprintf( |
1073 | 1073 | __( |
1074 | 1074 | 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | ); |
1079 | 1079 | } else { |
1080 | 1080 | $payment_method_info = sprintf( |
1081 | - __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), |
|
1081 | + __('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), |
|
1082 | 1082 | $this->submit_button_text() |
1083 | 1083 | ); |
1084 | 1084 | } |
@@ -1092,13 +1092,13 @@ discard block |
||
1092 | 1092 | ); |
1093 | 1093 | return new EE_Form_Section_Proper( |
1094 | 1094 | array( |
1095 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
1095 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
1096 | 1096 | 'html_class' => 'spco-payment-method-info-dv', |
1097 | 1097 | // only display the selected or default PM |
1098 | 1098 | 'html_style' => $currently_selected ? '' : 'display:none;', |
1099 | 1099 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
1100 | 1100 | 'subsections' => array( |
1101 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
1101 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
1102 | 1102 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
1103 | 1103 | ) |
1104 | 1104 | ) |
@@ -1116,15 +1116,15 @@ discard block |
||
1116 | 1116 | */ |
1117 | 1117 | public function get_billing_form_html_for_payment_method() { |
1118 | 1118 | // how have they chosen to pay? |
1119 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1119 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1120 | 1120 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1121 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1121 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1122 | 1122 | return false; |
1123 | 1123 | } |
1124 | - if ( apply_filters( |
|
1124 | + if (apply_filters( |
|
1125 | 1125 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1126 | 1126 | false |
1127 | - ) ) { |
|
1127 | + )) { |
|
1128 | 1128 | EE_Error::add_success( |
1129 | 1129 | apply_filters( |
1130 | 1130 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | ); |
1140 | 1140 | } |
1141 | 1141 | // now generate billing form for selected method of payment |
1142 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1142 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1143 | 1143 | // fill form with attendee info if applicable |
1144 | 1144 | if ( |
1145 | 1145 | $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form |
@@ -1161,10 +1161,10 @@ discard block |
||
1161 | 1161 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper |
1162 | 1162 | ? $payment_method_billing_form->get_html() |
1163 | 1163 | : ''; |
1164 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info ) ); |
|
1164 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
1165 | 1165 | // localize validation rules for main form |
1166 | 1166 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
1167 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1167 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1168 | 1168 | return true; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1178,18 +1178,18 @@ discard block |
||
1178 | 1178 | * @return \EE_Billing_Info_Form|\EE_Form_Section_HTML |
1179 | 1179 | * @throws \EE_Error |
1180 | 1180 | */ |
1181 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
1181 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
1182 | 1182 | $billing_form = $payment_method->type_obj()->billing_form( |
1183 | 1183 | $this->checkout->transaction, |
1184 | - array( 'amount_owing' => $this->checkout->amount_owing ) |
|
1184 | + array('amount_owing' => $this->checkout->amount_owing) |
|
1185 | 1185 | ); |
1186 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
1186 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
1187 | 1187 | if ( |
1188 | 1188 | apply_filters( |
1189 | 1189 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1190 | 1190 | false |
1191 | 1191 | ) |
1192 | - && EE_Registry::instance()->REQ->is_set( 'payment_method' ) |
|
1192 | + && EE_Registry::instance()->REQ->is_set('payment_method') |
|
1193 | 1193 | ) { |
1194 | 1194 | EE_Error::add_success( |
1195 | 1195 | apply_filters( |
@@ -1231,15 +1231,15 @@ discard block |
||
1231 | 1231 | $request_param = 'selected_method_of_payment' |
1232 | 1232 | ) { |
1233 | 1233 | // is selected_method_of_payment set in the request ? |
1234 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, false ); |
|
1235 | - if ( $selected_method_of_payment ) { |
|
1234 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, false); |
|
1235 | + if ($selected_method_of_payment) { |
|
1236 | 1236 | // sanitize it |
1237 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) |
|
1238 | - ? array_shift( $selected_method_of_payment ) |
|
1237 | + $selected_method_of_payment = is_array($selected_method_of_payment) |
|
1238 | + ? array_shift($selected_method_of_payment) |
|
1239 | 1239 | : $selected_method_of_payment; |
1240 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
1240 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
1241 | 1241 | // store it in the session so that it's available for all subsequent requests including AJAX |
1242 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
1242 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
1243 | 1243 | } else { |
1244 | 1244 | // or is is set in the session ? |
1245 | 1245 | $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | ); |
1248 | 1248 | } |
1249 | 1249 | // do ya really really gotta have it? |
1250 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
1250 | + if (empty($selected_method_of_payment) && $required) { |
|
1251 | 1251 | EE_Error::add_error( |
1252 | 1252 | sprintf( |
1253 | 1253 | __( |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | ), |
1257 | 1257 | '<br/>', |
1258 | 1258 | '<br/>', |
1259 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1259 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1260 | 1260 | ), |
1261 | 1261 | __FILE__, |
1262 | 1262 | __FUNCTION__, |
@@ -1283,13 +1283,13 @@ discard block |
||
1283 | 1283 | * @throws \EE_Error |
1284 | 1284 | */ |
1285 | 1285 | public function switch_payment_method() { |
1286 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1286 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1287 | 1287 | return false; |
1288 | 1288 | } |
1289 | - if ( apply_filters( |
|
1289 | + if (apply_filters( |
|
1290 | 1290 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', |
1291 | 1291 | false |
1292 | - ) ) { |
|
1292 | + )) { |
|
1293 | 1293 | EE_Error::add_success( |
1294 | 1294 | apply_filters( |
1295 | 1295 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | ); |
1305 | 1305 | } |
1306 | 1306 | // generate billing form for selected method of payment if it hasn't been done already |
1307 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1307 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1308 | 1308 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1309 | 1309 | $this->checkout->payment_method |
1310 | 1310 | ); |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | ); |
1327 | 1327 | } |
1328 | 1328 | // and debug content |
1329 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1329 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form |
|
1330 | 1330 | && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base |
1331 | 1331 | ) { |
1332 | 1332 | $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( |
@@ -1334,15 +1334,15 @@ discard block |
||
1334 | 1334 | ); |
1335 | 1335 | } |
1336 | 1336 | // get html and validation rules for form |
1337 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
1337 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
1338 | 1338 | $this->checkout->json_response->set_return_data( |
1339 | - array( 'payment_method_info' => $this->checkout->billing_form->get_html() ) |
|
1339 | + array('payment_method_info' => $this->checkout->billing_form->get_html()) |
|
1340 | 1340 | ); |
1341 | 1341 | // localize validation rules for main form |
1342 | - $this->checkout->billing_form->localize_validation_rules( true ); |
|
1343 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
1342 | + $this->checkout->billing_form->localize_validation_rules(true); |
|
1343 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
1344 | 1344 | } else { |
1345 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' ) ); |
|
1345 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
1346 | 1346 | } |
1347 | 1347 | //prevents advancement to next step |
1348 | 1348 | $this->checkout->continue_reg = false; |
@@ -1359,12 +1359,12 @@ discard block |
||
1359 | 1359 | */ |
1360 | 1360 | protected function _verify_payment_method_is_set() { |
1361 | 1361 | // generate billing form for selected method of payment if it hasn't been done already |
1362 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1362 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1363 | 1363 | // how have they chosen to pay? |
1364 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1364 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1365 | 1365 | } |
1366 | 1366 | // verify payment method |
1367 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
1367 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
1368 | 1368 | // get payment method for selected method of payment |
1369 | 1369 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
1370 | 1370 | } |
@@ -1383,25 +1383,25 @@ discard block |
||
1383 | 1383 | * @throws \EE_Error |
1384 | 1384 | */ |
1385 | 1385 | public function save_payer_details_via_ajax() { |
1386 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
1386 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
1387 | 1387 | return; |
1388 | 1388 | } |
1389 | 1389 | // generate billing form for selected method of payment if it hasn't been done already |
1390 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1390 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1391 | 1391 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1392 | 1392 | $this->checkout->payment_method |
1393 | 1393 | ); |
1394 | 1394 | } |
1395 | 1395 | // generate primary attendee from payer info if applicable |
1396 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1396 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1397 | 1397 | $attendee = $this->_create_attendee_from_request_data(); |
1398 | - if ( $attendee instanceof EE_Attendee ) { |
|
1399 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1400 | - if ( $registration->is_primary_registrant() ) { |
|
1398 | + if ($attendee instanceof EE_Attendee) { |
|
1399 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1400 | + if ($registration->is_primary_registrant()) { |
|
1401 | 1401 | $this->checkout->primary_attendee_obj = $attendee; |
1402 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1403 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1404 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1402 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1403 | + $registration->set_attendee_id($attendee->ID()); |
|
1404 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1405 | 1405 | } |
1406 | 1406 | } |
1407 | 1407 | } |
@@ -1419,50 +1419,50 @@ discard block |
||
1419 | 1419 | */ |
1420 | 1420 | protected function _create_attendee_from_request_data() { |
1421 | 1421 | // get State ID |
1422 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1423 | - if ( ! empty( $STA_ID ) ) { |
|
1422 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1423 | + if ( ! empty($STA_ID)) { |
|
1424 | 1424 | // can we get state object from name ? |
1425 | - EE_Registry::instance()->load_model( 'State' ); |
|
1426 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1 ), 'STA_ID' ); |
|
1427 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1425 | + EE_Registry::instance()->load_model('State'); |
|
1426 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1427 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1428 | 1428 | } |
1429 | 1429 | // get Country ISO |
1430 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1431 | - if ( ! empty( $CNT_ISO ) ) { |
|
1430 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1431 | + if ( ! empty($CNT_ISO)) { |
|
1432 | 1432 | // can we get country object from name ? |
1433 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1433 | + EE_Registry::instance()->load_model('Country'); |
|
1434 | 1434 | $country = EEM_Country::instance()->get_col( |
1435 | - array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1 ), |
|
1435 | + array(array('CNT_name' => $CNT_ISO), 'limit' => 1), |
|
1436 | 1436 | 'CNT_ISO' |
1437 | 1437 | ); |
1438 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1438 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1439 | 1439 | } |
1440 | 1440 | // grab attendee data |
1441 | 1441 | $attendee_data = array( |
1442 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1443 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1444 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1445 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1446 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1447 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1442 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1443 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1444 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1445 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1446 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1447 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1448 | 1448 | 'STA_ID' => $STA_ID, |
1449 | 1449 | 'CNT_ISO' => $CNT_ISO, |
1450 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1451 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1450 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1451 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1452 | 1452 | ); |
1453 | 1453 | // validate the email address since it is the most important piece of info |
1454 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] !== $_REQUEST['email'] ) { |
|
1454 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] !== $_REQUEST['email']) { |
|
1455 | 1455 | EE_Error::add_error( |
1456 | - __( 'An invalid email address was submitted.', 'event_espresso' ), |
|
1456 | + __('An invalid email address was submitted.', 'event_espresso'), |
|
1457 | 1457 | __FILE__, |
1458 | 1458 | __FUNCTION__, |
1459 | 1459 | __LINE__ |
1460 | 1460 | ); |
1461 | 1461 | } |
1462 | 1462 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1463 | - if ( ! empty( $attendee_data['ATT_fname'] ) |
|
1464 | - && ! empty( $attendee_data['ATT_lname'] ) |
|
1465 | - && ! empty( $attendee_data['ATT_email'] ) |
|
1463 | + if ( ! empty($attendee_data['ATT_fname']) |
|
1464 | + && ! empty($attendee_data['ATT_lname']) |
|
1465 | + && ! empty($attendee_data['ATT_email']) |
|
1466 | 1466 | ) { |
1467 | 1467 | $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( |
1468 | 1468 | array( |
@@ -1471,19 +1471,19 @@ discard block |
||
1471 | 1471 | 'ATT_email' => $attendee_data['ATT_email'] |
1472 | 1472 | ) |
1473 | 1473 | ); |
1474 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1474 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1475 | 1475 | return $existing_attendee; |
1476 | 1476 | } |
1477 | 1477 | } |
1478 | 1478 | // no existing attendee? kk let's create a new one |
1479 | 1479 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1480 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) |
|
1480 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) |
|
1481 | 1481 | ? $attendee_data['ATT_fname'] |
1482 | 1482 | : $attendee_data['ATT_email']; |
1483 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) |
|
1483 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) |
|
1484 | 1484 | ? $attendee_data['ATT_lname'] |
1485 | 1485 | : $attendee_data['ATT_email']; |
1486 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1486 | + return EE_Attendee::new_instance($attendee_data); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | |
@@ -1501,26 +1501,26 @@ discard block |
||
1501 | 1501 | // how have they chosen to pay? |
1502 | 1502 | $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() |
1503 | 1503 | ? 'no_payment_required' |
1504 | - : $this->_get_selected_method_of_payment( true ); |
|
1504 | + : $this->_get_selected_method_of_payment(true); |
|
1505 | 1505 | // choose your own adventure based on method_of_payment |
1506 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
1506 | + switch ($this->checkout->selected_method_of_payment) { |
|
1507 | 1507 | |
1508 | 1508 | case 'events_sold_out' : |
1509 | 1509 | $this->checkout->redirect = true; |
1510 | 1510 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1511 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1511 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1512 | 1512 | // mark this reg step as completed |
1513 | 1513 | $this->set_completed(); |
1514 | 1514 | return false; |
1515 | 1515 | break; |
1516 | 1516 | |
1517 | 1517 | case 'payments_closed' : |
1518 | - if ( apply_filters( |
|
1518 | + if (apply_filters( |
|
1519 | 1519 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', |
1520 | 1520 | false |
1521 | - ) ) { |
|
1521 | + )) { |
|
1522 | 1522 | EE_Error::add_success( |
1523 | - __( 'no payment required at this time.', 'event_espresso' ), |
|
1523 | + __('no payment required at this time.', 'event_espresso'), |
|
1524 | 1524 | __FILE__, |
1525 | 1525 | __FUNCTION__, |
1526 | 1526 | __LINE__ |
@@ -1532,12 +1532,12 @@ discard block |
||
1532 | 1532 | break; |
1533 | 1533 | |
1534 | 1534 | case 'no_payment_required' : |
1535 | - if ( apply_filters( |
|
1535 | + if (apply_filters( |
|
1536 | 1536 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', |
1537 | 1537 | false |
1538 | - ) ) { |
|
1538 | + )) { |
|
1539 | 1539 | EE_Error::add_success( |
1540 | - __( 'no payment required.', 'event_espresso' ), |
|
1540 | + __('no payment required.', 'event_espresso'), |
|
1541 | 1541 | __FILE__, |
1542 | 1542 | __FUNCTION__, |
1543 | 1543 | __LINE__ |
@@ -1557,15 +1557,15 @@ discard block |
||
1557 | 1557 | EE_Registry::instance()->SSN->checkout()->revisit |
1558 | 1558 | ); |
1559 | 1559 | // calculate difference between the two arrays |
1560 | - $registrations = array_diff( $registrations, $ejected_registrations ); |
|
1561 | - if ( empty( $registrations ) ) { |
|
1560 | + $registrations = array_diff($registrations, $ejected_registrations); |
|
1561 | + if (empty($registrations)) { |
|
1562 | 1562 | $this->_redirect_because_event_sold_out(); |
1563 | 1563 | return false; |
1564 | 1564 | } |
1565 | 1565 | $payment_successful = $this->_process_payment(); |
1566 | - if ( $payment_successful ) { |
|
1566 | + if ($payment_successful) { |
|
1567 | 1567 | $this->checkout->continue_reg = true; |
1568 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1568 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1569 | 1569 | } else { |
1570 | 1570 | $this->checkout->continue_reg = false; |
1571 | 1571 | } |
@@ -1586,10 +1586,10 @@ discard block |
||
1586 | 1586 | $this->checkout->continue_reg = false; |
1587 | 1587 | // set redirect URL |
1588 | 1588 | $this->checkout->redirect_url = add_query_arg( |
1589 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1589 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1590 | 1590 | $this->checkout->current_step->reg_step_url() |
1591 | 1591 | ); |
1592 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1592 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1593 | 1593 | } |
1594 | 1594 | |
1595 | 1595 | |
@@ -1602,8 +1602,8 @@ discard block |
||
1602 | 1602 | * @return void |
1603 | 1603 | * @throws \EE_Error |
1604 | 1604 | */ |
1605 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1606 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1605 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1606 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1607 | 1607 | case EE_PMT_Base::offsite : |
1608 | 1608 | break; |
1609 | 1609 | case EE_PMT_Base::onsite : |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | public function update_reg_step() { |
1627 | 1627 | $success = true; |
1628 | 1628 | // if payment required |
1629 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1629 | + if ($this->checkout->transaction->total() > 0) { |
|
1630 | 1630 | do_action( |
1631 | 1631 | 'AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', |
1632 | 1632 | $this->checkout->transaction |
@@ -1634,13 +1634,13 @@ discard block |
||
1634 | 1634 | // attempt payment via payment method |
1635 | 1635 | $success = $this->process_reg_step(); |
1636 | 1636 | } |
1637 | - if ( $success && ! $this->checkout->redirect ) { |
|
1637 | + if ($success && ! $this->checkout->redirect) { |
|
1638 | 1638 | $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( |
1639 | 1639 | $this->checkout->transaction->ID() |
1640 | 1640 | ); |
1641 | 1641 | // set return URL |
1642 | 1642 | $this->checkout->redirect_url = add_query_arg( |
1643 | - array( 'e_reg_url_link' => $this->checkout->reg_url_link ), |
|
1643 | + array('e_reg_url_link' => $this->checkout->reg_url_link), |
|
1644 | 1644 | $this->checkout->thank_you_page_url |
1645 | 1645 | ); |
1646 | 1646 | } |
@@ -1660,28 +1660,28 @@ discard block |
||
1660 | 1660 | // clear any previous errors related to not selecting a payment method |
1661 | 1661 | // EE_Error::overwrite_errors(); |
1662 | 1662 | // ya gotta make a choice man |
1663 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
1663 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1664 | 1664 | $this->checkout->json_response->set_plz_select_method_of_payment( |
1665 | - __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
1665 | + __('Please select a method of payment before proceeding.', 'event_espresso') |
|
1666 | 1666 | ); |
1667 | 1667 | return false; |
1668 | 1668 | } |
1669 | 1669 | // get EE_Payment_Method object |
1670 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1670 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1671 | 1671 | return false; |
1672 | 1672 | } |
1673 | 1673 | // setup billing form |
1674 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1674 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1675 | 1675 | $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( |
1676 | 1676 | $this->checkout->payment_method |
1677 | 1677 | ); |
1678 | 1678 | // bad billing form ? |
1679 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1679 | + if ( ! $this->_billing_form_is_valid()) { |
|
1680 | 1680 | return false; |
1681 | 1681 | } |
1682 | 1682 | } |
1683 | 1683 | // ensure primary registrant has been fully processed |
1684 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1684 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1685 | 1685 | return false; |
1686 | 1686 | } |
1687 | 1687 | /** @type EE_Transaction_Processor $transaction_processor */ |
@@ -1689,12 +1689,12 @@ discard block |
||
1689 | 1689 | // 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 |
1690 | 1690 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1691 | 1691 | // attempt payment |
1692 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1692 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1693 | 1693 | // process results |
1694 | - $payment = $this->_validate_payment( $payment ); |
|
1695 | - $payment = $this->_post_payment_processing( $payment ); |
|
1694 | + $payment = $this->_validate_payment($payment); |
|
1695 | + $payment = $this->_post_payment_processing($payment); |
|
1696 | 1696 | // verify payment |
1697 | - if ( $payment instanceof EE_Payment ) { |
|
1697 | + if ($payment instanceof EE_Payment) { |
|
1698 | 1698 | // store that for later |
1699 | 1699 | $this->checkout->payment = $payment; |
1700 | 1700 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | } else { |
1709 | 1709 | return false; |
1710 | 1710 | } |
1711 | - } else if ( $payment === true ) { |
|
1711 | + } else if ($payment === true) { |
|
1712 | 1712 | // please note that offline payment methods will NOT make a payment, |
1713 | 1713 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1714 | 1714 | $this->checkout->payment = $payment; |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | ); |
1734 | 1734 | $html = $payment_method_billing_info->get_html(); |
1735 | 1735 | $html .= $this->checkout->redirect_form; |
1736 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1736 | + EE_Registry::instance()->REQ->add_output($html); |
|
1737 | 1737 | return true; |
1738 | 1738 | } |
1739 | 1739 | |
@@ -1747,28 +1747,28 @@ discard block |
||
1747 | 1747 | * @throws \EE_Error |
1748 | 1748 | */ |
1749 | 1749 | private function _billing_form_is_valid() { |
1750 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1750 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1751 | 1751 | return true; |
1752 | 1752 | } |
1753 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1754 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1753 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1754 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1755 | 1755 | $this->checkout->billing_form->receive_form_submission(); |
1756 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1756 | + if ($this->checkout->billing_form->is_valid()) { |
|
1757 | 1757 | return true; |
1758 | 1758 | } |
1759 | 1759 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1760 | 1760 | $error_strings = array(); |
1761 | - foreach ( $validation_errors as $validation_error ) { |
|
1762 | - if ( $validation_error instanceof EE_Validation_Error ) { |
|
1761 | + foreach ($validation_errors as $validation_error) { |
|
1762 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1763 | 1763 | $form_section = $validation_error->get_form_section(); |
1764 | - if ( $form_section instanceof EE_Form_Input_Base ) { |
|
1764 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1765 | 1765 | $label = $form_section->html_label_text(); |
1766 | - } elseif ( $form_section instanceof EE_Form_Section_Base ) { |
|
1766 | + } elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1767 | 1767 | $label = $form_section->name(); |
1768 | 1768 | } else { |
1769 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1769 | + $label = __('Validation Error', 'event_espresso'); |
|
1770 | 1770 | } |
1771 | - $error_strings[] = sprintf( '%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1771 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1772 | 1772 | } |
1773 | 1773 | } |
1774 | 1774 | EE_Error::add_error( |
@@ -1778,7 +1778,7 @@ discard block |
||
1778 | 1778 | 'event_espresso' |
1779 | 1779 | ), |
1780 | 1780 | '<br/>', |
1781 | - implode( '<br/>', $error_strings ) |
|
1781 | + implode('<br/>', $error_strings) |
|
1782 | 1782 | ), |
1783 | 1783 | __FILE__, |
1784 | 1784 | __FUNCTION__, |
@@ -1797,7 +1797,7 @@ discard block |
||
1797 | 1797 | } |
1798 | 1798 | } else { |
1799 | 1799 | EE_Error::add_error( |
1800 | - __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), |
|
1800 | + __('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), |
|
1801 | 1801 | __FILE__, |
1802 | 1802 | __FUNCTION__, |
1803 | 1803 | __LINE__ |
@@ -1836,7 +1836,7 @@ discard block |
||
1836 | 1836 | // save the TXN ( which clears cached copy of primary_registration) |
1837 | 1837 | $this->checkout->transaction->save(); |
1838 | 1838 | // grab TXN ID and save it to the primary_registration |
1839 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1839 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1840 | 1840 | // save what we have so far |
1841 | 1841 | $primary_registration->save(); |
1842 | 1842 | return true; |
@@ -1854,7 +1854,7 @@ discard block |
||
1854 | 1854 | private function _capture_primary_registration_data_from_billing_form() { |
1855 | 1855 | // convert billing form data into an attendee |
1856 | 1856 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1857 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1857 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1858 | 1858 | EE_Error::add_error( |
1859 | 1859 | sprintf( |
1860 | 1860 | __( |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | 'event_espresso' |
1863 | 1863 | ), |
1864 | 1864 | '<br/>', |
1865 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1865 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1866 | 1866 | ), |
1867 | 1867 | __FILE__, |
1868 | 1868 | __FUNCTION__, |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | return false; |
1872 | 1872 | } |
1873 | 1873 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1874 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1874 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1875 | 1875 | EE_Error::add_error( |
1876 | 1876 | sprintf( |
1877 | 1877 | __( |
@@ -1879,7 +1879,7 @@ discard block |
||
1879 | 1879 | 'event_espresso' |
1880 | 1880 | ), |
1881 | 1881 | '<br/>', |
1882 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1882 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1883 | 1883 | ), |
1884 | 1884 | __FILE__, |
1885 | 1885 | __FUNCTION__, |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | ); |
1888 | 1888 | return false; |
1889 | 1889 | } |
1890 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) |
|
1890 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') |
|
1891 | 1891 | instanceof |
1892 | 1892 | EE_Attendee |
1893 | 1893 | ) { |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | 'event_espresso' |
1899 | 1899 | ), |
1900 | 1900 | '<br/>', |
1901 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1901 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1902 | 1902 | ), |
1903 | 1903 | __FILE__, |
1904 | 1904 | __FUNCTION__, |
@@ -1907,9 +1907,9 @@ discard block |
||
1907 | 1907 | return false; |
1908 | 1908 | } |
1909 | 1909 | /** @type EE_Registration_Processor $registration_processor */ |
1910 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1910 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1911 | 1911 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1912 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1912 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1913 | 1913 | return true; |
1914 | 1914 | } |
1915 | 1915 | |
@@ -1924,22 +1924,22 @@ discard block |
||
1924 | 1924 | * @throws \EE_Error |
1925 | 1925 | */ |
1926 | 1926 | private function _get_payment_method_for_selected_method_of_payment() { |
1927 | - if ( $this->checkout->selected_method_of_payment === 'events_sold_out' ) { |
|
1927 | + if ($this->checkout->selected_method_of_payment === 'events_sold_out') { |
|
1928 | 1928 | $this->_redirect_because_event_sold_out(); |
1929 | 1929 | return null; |
1930 | 1930 | } |
1931 | 1931 | // get EE_Payment_Method object |
1932 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] ) ) { |
|
1933 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1932 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1933 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1934 | 1934 | } else { |
1935 | 1935 | // load EEM_Payment_Method |
1936 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1936 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1937 | 1937 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1938 | 1938 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1939 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1939 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1940 | 1940 | } |
1941 | 1941 | // verify $payment_method |
1942 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1942 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1943 | 1943 | // not a payment |
1944 | 1944 | EE_Error::add_error( |
1945 | 1945 | sprintf( |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | 'event_espresso' |
1949 | 1949 | ), |
1950 | 1950 | '<br/>', |
1951 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1951 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1952 | 1952 | ), |
1953 | 1953 | __FILE__, |
1954 | 1954 | __FUNCTION__, |
@@ -1957,7 +1957,7 @@ discard block |
||
1957 | 1957 | return null; |
1958 | 1958 | } |
1959 | 1959 | // and verify it has a valid Payment_Method Type object |
1960 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1960 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1961 | 1961 | // not a payment |
1962 | 1962 | EE_Error::add_error( |
1963 | 1963 | sprintf( |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | 'event_espresso' |
1967 | 1967 | ), |
1968 | 1968 | '<br/>', |
1969 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1969 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1970 | 1970 | ), |
1971 | 1971 | __FILE__, |
1972 | 1972 | __FUNCTION__, |
@@ -1987,29 +1987,29 @@ discard block |
||
1987 | 1987 | * @return mixed EE_Payment | boolean |
1988 | 1988 | * @throws \EE_Error |
1989 | 1989 | */ |
1990 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1990 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1991 | 1991 | $payment = null; |
1992 | 1992 | $this->checkout->transaction->save(); |
1993 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1994 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1993 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1994 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1995 | 1995 | return false; |
1996 | 1996 | } |
1997 | 1997 | try { |
1998 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1998 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1999 | 1999 | // generate payment object |
2000 | 2000 | $payment = $payment_processor->process_payment( |
2001 | 2001 | $payment_method, |
2002 | 2002 | $this->checkout->transaction, |
2003 | 2003 | $this->checkout->amount_owing, |
2004 | 2004 | $this->checkout->billing_form, |
2005 | - $this->_get_return_url( $payment_method ), |
|
2005 | + $this->_get_return_url($payment_method), |
|
2006 | 2006 | 'CART', |
2007 | 2007 | $this->checkout->admin_request, |
2008 | 2008 | true, |
2009 | 2009 | $this->reg_step_url() |
2010 | 2010 | ); |
2011 | - } catch ( Exception $e ) { |
|
2012 | - $this->_handle_payment_processor_exception( $e ); |
|
2011 | + } catch (Exception $e) { |
|
2012 | + $this->_handle_payment_processor_exception($e); |
|
2013 | 2013 | } |
2014 | 2014 | return $payment; |
2015 | 2015 | } |
@@ -2024,7 +2024,7 @@ discard block |
||
2024 | 2024 | * @return void |
2025 | 2025 | * @throws \EE_Error |
2026 | 2026 | */ |
2027 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
2027 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
2028 | 2028 | EE_Error::add_error( |
2029 | 2029 | sprintf( |
2030 | 2030 | __( |
@@ -2032,7 +2032,7 @@ discard block |
||
2032 | 2032 | 'event_espresso' |
2033 | 2033 | ), |
2034 | 2034 | '<br/>', |
2035 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
2035 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
2036 | 2036 | $e->getMessage(), |
2037 | 2037 | $e->getFile(), |
2038 | 2038 | $e->getLine() |
@@ -2053,9 +2053,9 @@ discard block |
||
2053 | 2053 | * @return string |
2054 | 2054 | * @throws \EE_Error |
2055 | 2055 | */ |
2056 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
2056 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
2057 | 2057 | $return_url = ''; |
2058 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
2058 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
2059 | 2059 | case EE_PMT_Base::offsite : |
2060 | 2060 | $return_url = add_query_arg( |
2061 | 2061 | array( |
@@ -2084,12 +2084,12 @@ discard block |
||
2084 | 2084 | * @return EE_Payment | FALSE |
2085 | 2085 | * @throws \EE_Error |
2086 | 2086 | */ |
2087 | - private function _validate_payment( $payment = null ) { |
|
2088 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
2087 | + private function _validate_payment($payment = null) { |
|
2088 | + if ($this->checkout->payment_method->is_off_line()) { |
|
2089 | 2089 | return true; |
2090 | 2090 | } |
2091 | 2091 | // verify payment object |
2092 | - if ( ! $payment instanceof EE_Payment ) { |
|
2092 | + if ( ! $payment instanceof EE_Payment) { |
|
2093 | 2093 | // not a payment |
2094 | 2094 | EE_Error::add_error( |
2095 | 2095 | sprintf( |
@@ -2098,7 +2098,7 @@ discard block |
||
2098 | 2098 | 'event_espresso' |
2099 | 2099 | ), |
2100 | 2100 | '<br/>', |
2101 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2101 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2102 | 2102 | ), |
2103 | 2103 | __FILE__, |
2104 | 2104 | __FUNCTION__, |
@@ -2119,27 +2119,27 @@ discard block |
||
2119 | 2119 | * @return bool |
2120 | 2120 | * @throws \EE_Error |
2121 | 2121 | */ |
2122 | - private function _post_payment_processing( $payment = null ) { |
|
2122 | + private function _post_payment_processing($payment = null) { |
|
2123 | 2123 | // Off-Line payment? |
2124 | - if ( $payment === true ) { |
|
2124 | + if ($payment === true) { |
|
2125 | 2125 | //$this->_setup_redirect_for_next_step(); |
2126 | 2126 | return true; |
2127 | 2127 | // On-Site payment? |
2128 | - } else if ( $this->checkout->payment_method->is_on_site() ) { |
|
2129 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite ) ) { |
|
2128 | + } else if ($this->checkout->payment_method->is_on_site()) { |
|
2129 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
2130 | 2130 | //$this->_setup_redirect_for_next_step(); |
2131 | 2131 | $this->checkout->continue_reg = false; |
2132 | 2132 | } |
2133 | 2133 | // Off-Site payment? |
2134 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
2134 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
2135 | 2135 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
2136 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ) { |
|
2137 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
2136 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
2137 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
2138 | 2138 | $this->checkout->redirect = true; |
2139 | 2139 | $this->checkout->redirect_form = $payment->redirect_form(); |
2140 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
2140 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
2141 | 2141 | // set JSON response |
2142 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
2142 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
2143 | 2143 | // set cron job for finalizing the TXN |
2144 | 2144 | // in case the user does not return from the off-site gateway |
2145 | 2145 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -2147,7 +2147,7 @@ discard block |
||
2147 | 2147 | $this->checkout->transaction->ID() |
2148 | 2148 | ); |
2149 | 2149 | // and lastly, let's bump the payment status to pending |
2150 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
2150 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
2151 | 2151 | $payment->save(); |
2152 | 2152 | } else { |
2153 | 2153 | // not a payment |
@@ -2159,7 +2159,7 @@ discard block |
||
2159 | 2159 | 'event_espresso' |
2160 | 2160 | ), |
2161 | 2161 | '<br/>', |
2162 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2162 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2163 | 2163 | ), |
2164 | 2164 | __FILE__, |
2165 | 2165 | __FUNCTION__, |
@@ -2197,21 +2197,21 @@ discard block |
||
2197 | 2197 | * @return bool |
2198 | 2198 | * @throws \EE_Error |
2199 | 2199 | */ |
2200 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
2200 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
2201 | 2201 | // off-line payment? carry on |
2202 | - if ( $payment_occurs === EE_PMT_Base::offline ) { |
|
2202 | + if ($payment_occurs === EE_PMT_Base::offline) { |
|
2203 | 2203 | return true; |
2204 | 2204 | } |
2205 | 2205 | // verify payment validity |
2206 | - if ( $payment instanceof EE_Payment ) { |
|
2207 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
2206 | + if ($payment instanceof EE_Payment) { |
|
2207 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
2208 | 2208 | $msg = $payment->gateway_response(); |
2209 | 2209 | // check results |
2210 | - switch ( $payment->status() ) { |
|
2210 | + switch ($payment->status()) { |
|
2211 | 2211 | // good payment |
2212 | 2212 | case EEM_Payment::status_id_approved : |
2213 | 2213 | EE_Error::add_success( |
2214 | - __( 'Your payment was processed successfully.', 'event_espresso' ), |
|
2214 | + __('Your payment was processed successfully.', 'event_espresso'), |
|
2215 | 2215 | __FILE__, |
2216 | 2216 | __FUNCTION__, |
2217 | 2217 | __LINE__ |
@@ -2220,45 +2220,45 @@ discard block |
||
2220 | 2220 | break; |
2221 | 2221 | // slow payment |
2222 | 2222 | case EEM_Payment::status_id_pending : |
2223 | - if ( empty( $msg ) ) { |
|
2223 | + if (empty($msg)) { |
|
2224 | 2224 | $msg = __( |
2225 | 2225 | 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', |
2226 | 2226 | 'event_espresso' |
2227 | 2227 | ); |
2228 | 2228 | } |
2229 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2229 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2230 | 2230 | return true; |
2231 | 2231 | break; |
2232 | 2232 | // don't wanna payment |
2233 | 2233 | case EEM_Payment::status_id_cancelled : |
2234 | - if ( empty( $msg ) ) { |
|
2234 | + if (empty($msg)) { |
|
2235 | 2235 | $msg = _n( |
2236 | 2236 | 'Payment cancelled. Please try again.', |
2237 | 2237 | 'Payment cancelled. Please try again or select another method of payment.', |
2238 | - count( $this->checkout->available_payment_methods ), |
|
2238 | + count($this->checkout->available_payment_methods), |
|
2239 | 2239 | 'event_espresso' |
2240 | 2240 | ); |
2241 | 2241 | } |
2242 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2242 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2243 | 2243 | return false; |
2244 | 2244 | break; |
2245 | 2245 | // not enough payment |
2246 | 2246 | case EEM_Payment::status_id_declined : |
2247 | - if ( empty( $msg ) ) { |
|
2247 | + if (empty($msg)) { |
|
2248 | 2248 | $msg = _n( |
2249 | 2249 | 'We\'re sorry but your payment was declined. Please try again.', |
2250 | 2250 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
2251 | - count( $this->checkout->available_payment_methods ), |
|
2251 | + count($this->checkout->available_payment_methods), |
|
2252 | 2252 | 'event_espresso' |
2253 | 2253 | ); |
2254 | 2254 | } |
2255 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2255 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2256 | 2256 | return false; |
2257 | 2257 | break; |
2258 | 2258 | // bad payment |
2259 | 2259 | case EEM_Payment::status_id_failed : |
2260 | - if ( ! empty( $msg ) ) { |
|
2261 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
2260 | + if ( ! empty($msg)) { |
|
2261 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
2262 | 2262 | return false; |
2263 | 2263 | } |
2264 | 2264 | // default to error below |
@@ -2267,7 +2267,7 @@ discard block |
||
2267 | 2267 | } |
2268 | 2268 | // off-site payment gateway responses are too unreliable, so let's just assume that |
2269 | 2269 | // the payment processing is just running slower than the registrant's request |
2270 | - if ( $payment_occurs === EE_PMT_Base::offsite ) { |
|
2270 | + if ($payment_occurs === EE_PMT_Base::offsite) { |
|
2271 | 2271 | return true; |
2272 | 2272 | } |
2273 | 2273 | EE_Error::add_error( |
@@ -2277,7 +2277,7 @@ discard block |
||
2277 | 2277 | 'event_espresso' |
2278 | 2278 | ), |
2279 | 2279 | '<br/>', |
2280 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2280 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2281 | 2281 | ), |
2282 | 2282 | __FILE__, |
2283 | 2283 | __FUNCTION__, |
@@ -2310,13 +2310,13 @@ discard block |
||
2310 | 2310 | public function process_gateway_response() { |
2311 | 2311 | $payment = null; |
2312 | 2312 | // how have they chosen to pay? |
2313 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
2313 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
2314 | 2314 | // get EE_Payment_Method object |
2315 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
2315 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
2316 | 2316 | $this->checkout->continue_reg = false; |
2317 | 2317 | return false; |
2318 | 2318 | } |
2319 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
2319 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
2320 | 2320 | return false; |
2321 | 2321 | } |
2322 | 2322 | $this->_validate_offsite_return(); |
@@ -2330,23 +2330,23 @@ discard block |
||
2330 | 2330 | // true |
2331 | 2331 | //); |
2332 | 2332 | // verify TXN |
2333 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
2333 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
2334 | 2334 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
2335 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
2335 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
2336 | 2336 | $this->checkout->continue_reg = false; |
2337 | 2337 | return false; |
2338 | 2338 | } |
2339 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
2340 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
2341 | - $payment = $this->_validate_payment( $payment ); |
|
2339 | + $payment = $this->_process_off_site_payment($gateway); |
|
2340 | + $payment = $this->_process_cancelled_payments($payment); |
|
2341 | + $payment = $this->_validate_payment($payment); |
|
2342 | 2342 | // if payment was not declined by the payment gateway or cancelled by the registrant |
2343 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
2343 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
2344 | 2344 | //$this->_setup_redirect_for_next_step(); |
2345 | 2345 | // store that for later |
2346 | 2346 | $this->checkout->payment = $payment; |
2347 | 2347 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
2348 | 2348 | // because we will complete this step during the IPN processing then |
2349 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request() ) { |
|
2349 | + if ($gateway instanceof EE_Offsite_Gateway && ! $this->handle_IPN_in_this_request()) { |
|
2350 | 2350 | $this->set_completed(); |
2351 | 2351 | } |
2352 | 2352 | return true; |
@@ -2370,21 +2370,21 @@ discard block |
||
2370 | 2370 | * @throws \EE_Error |
2371 | 2371 | */ |
2372 | 2372 | private function _validate_offsite_return() { |
2373 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
2374 | - if ( $TXN_ID !== $this->checkout->transaction->ID() ) { |
|
2373 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
2374 | + if ($TXN_ID !== $this->checkout->transaction->ID()) { |
|
2375 | 2375 | // Houston... we might have a problem |
2376 | 2376 | $invalid_TXN = false; |
2377 | 2377 | // first gather some info |
2378 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
2378 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
2379 | 2379 | $primary_registrant = $valid_TXN instanceof EE_Transaction |
2380 | 2380 | ? $valid_TXN->primary_registration() |
2381 | 2381 | : null; |
2382 | 2382 | // let's start by retrieving the cart for this TXN |
2383 | - $cart = $this->checkout->get_cart_for_transaction( $this->checkout->transaction ); |
|
2384 | - if ( $cart instanceof EE_Cart ) { |
|
2383 | + $cart = $this->checkout->get_cart_for_transaction($this->checkout->transaction); |
|
2384 | + if ($cart instanceof EE_Cart) { |
|
2385 | 2385 | // verify that the current cart has tickets |
2386 | 2386 | $tickets = $cart->get_tickets(); |
2387 | - if ( empty( $tickets ) ) { |
|
2387 | + if (empty($tickets)) { |
|
2388 | 2388 | $invalid_TXN = true; |
2389 | 2389 | } |
2390 | 2390 | } else { |
@@ -2394,35 +2394,35 @@ discard block |
||
2394 | 2394 | ? $primary_registrant->session_ID() |
2395 | 2395 | : null; |
2396 | 2396 | // validate current Session ID and compare against valid TXN session ID |
2397 | - if ( EE_Session::instance()->id() === null ) { |
|
2397 | + if (EE_Session::instance()->id() === null) { |
|
2398 | 2398 | $invalid_TXN = true; |
2399 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
2399 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
2400 | 2400 | // WARNING !!! |
2401 | 2401 | // this could be PayPal sending back duplicate requests (ya they do that) |
2402 | 2402 | // or it **could** mean someone is simply registering AGAIN after having just done so |
2403 | 2403 | // so now we need to determine if this current TXN looks valid or not |
2404 | 2404 | // has this step even been started ? |
2405 | - if ( $this->checkout->transaction->reg_step_completed( $this->slug() === false ) |
|
2405 | + if ($this->checkout->transaction->reg_step_completed($this->slug() === false) |
|
2406 | 2406 | ) { |
2407 | 2407 | // really? you're half way through this reg step, but you never started it ? |
2408 | 2408 | $invalid_TXN = true; |
2409 | 2409 | } |
2410 | 2410 | } |
2411 | - if ( $invalid_TXN ) { |
|
2411 | + if ($invalid_TXN) { |
|
2412 | 2412 | // is the valid TXN completed ? |
2413 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
2413 | + if ($valid_TXN instanceof EE_Transaction) { |
|
2414 | 2414 | // has this step even been started ? |
2415 | - $reg_step_completed = $valid_TXN->reg_step_completed( $this->slug() ); |
|
2416 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
2415 | + $reg_step_completed = $valid_TXN->reg_step_completed($this->slug()); |
|
2416 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
2417 | 2417 | // so it **looks** like this is a double request from PayPal |
2418 | 2418 | // so let's try to pick up where we left off |
2419 | 2419 | $this->checkout->transaction = $valid_TXN; |
2420 | - $this->checkout->refresh_all_entities( true ); |
|
2420 | + $this->checkout->refresh_all_entities(true); |
|
2421 | 2421 | return; |
2422 | 2422 | } |
2423 | 2423 | } |
2424 | 2424 | // you appear to be lost? |
2425 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
2425 | + $this->_redirect_wayward_request($primary_registrant); |
|
2426 | 2426 | } |
2427 | 2427 | } |
2428 | 2428 | } |
@@ -2437,14 +2437,14 @@ discard block |
||
2437 | 2437 | * @return bool |
2438 | 2438 | * @throws \EE_Error |
2439 | 2439 | */ |
2440 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
2441 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2440 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
2441 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2442 | 2442 | // try redirecting based on the current TXN |
2443 | 2443 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction |
2444 | 2444 | ? $this->checkout->transaction->primary_registration() |
2445 | 2445 | : null; |
2446 | 2446 | } |
2447 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
2447 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
2448 | 2448 | EE_Error::add_error( |
2449 | 2449 | sprintf( |
2450 | 2450 | __( |
@@ -2452,7 +2452,7 @@ discard block |
||
2452 | 2452 | 'event_espresso' |
2453 | 2453 | ), |
2454 | 2454 | '<br/>', |
2455 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
2455 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
2456 | 2456 | ), |
2457 | 2457 | __FILE__, |
2458 | 2458 | __FUNCTION__, |
@@ -2483,17 +2483,17 @@ discard block |
||
2483 | 2483 | * @return \EE_Payment |
2484 | 2484 | * @throws \EE_Error |
2485 | 2485 | */ |
2486 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
2486 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
2487 | 2487 | try { |
2488 | 2488 | $request_data = \EE_Registry::instance()->REQ->params(); |
2489 | 2489 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
2490 | 2490 | $this->set_handle_IPN_in_this_request( |
2491 | - $gateway->handle_IPN_in_this_request( $request_data, false ) |
|
2491 | + $gateway->handle_IPN_in_this_request($request_data, false) |
|
2492 | 2492 | ); |
2493 | - if ( $this->handle_IPN_in_this_request() ) { |
|
2493 | + if ($this->handle_IPN_in_this_request()) { |
|
2494 | 2494 | // get payment details and process results |
2495 | 2495 | /** @type EE_Payment_Processor $payment_processor */ |
2496 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
2496 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
2497 | 2497 | $payment = $payment_processor->process_ipn( |
2498 | 2498 | $request_data, |
2499 | 2499 | $this->checkout->transaction, |
@@ -2506,14 +2506,14 @@ discard block |
||
2506 | 2506 | $payment = $this->checkout->transaction->last_payment(); |
2507 | 2507 | //$payment_source = 'last_payment'; |
2508 | 2508 | } |
2509 | - } catch ( Exception $e ) { |
|
2509 | + } catch (Exception $e) { |
|
2510 | 2510 | // let's just eat the exception and try to move on using any previously set payment info |
2511 | 2511 | $payment = $this->checkout->transaction->last_payment(); |
2512 | 2512 | //$payment_source = 'last_payment after Exception'; |
2513 | 2513 | // but if we STILL don't have a payment object |
2514 | - if ( ! $payment instanceof EE_Payment ) { |
|
2514 | + if ( ! $payment instanceof EE_Payment) { |
|
2515 | 2515 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
2516 | - $this->_handle_payment_processor_exception( $e ); |
|
2516 | + $this->_handle_payment_processor_exception($e); |
|
2517 | 2517 | } |
2518 | 2518 | } |
2519 | 2519 | // DEBUG LOG |
@@ -2538,13 +2538,13 @@ discard block |
||
2538 | 2538 | * @return EE_Payment | FALSE |
2539 | 2539 | * @throws \EE_Error |
2540 | 2540 | */ |
2541 | - private function _process_cancelled_payments( $payment = null ) { |
|
2541 | + private function _process_cancelled_payments($payment = null) { |
|
2542 | 2542 | if ( |
2543 | 2543 | $payment instanceof EE_Payment |
2544 | - && isset( $_REQUEST['ee_cancel_payment'] ) |
|
2544 | + && isset($_REQUEST['ee_cancel_payment']) |
|
2545 | 2545 | && $payment->status() === EEM_Payment::status_id_failed |
2546 | 2546 | ) { |
2547 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2547 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2548 | 2548 | } |
2549 | 2549 | return $payment; |
2550 | 2550 | } |
@@ -2561,14 +2561,14 @@ discard block |
||
2561 | 2561 | public function get_transaction_details_for_gateways() { |
2562 | 2562 | $txn_details = array(); |
2563 | 2563 | // ya gotta make a choice man |
2564 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2564 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2565 | 2565 | $txn_details = array( |
2566 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2566 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2567 | 2567 | ); |
2568 | 2568 | } |
2569 | 2569 | // get EE_Payment_Method object |
2570 | 2570 | if ( |
2571 | - empty( $txn_details ) |
|
2571 | + empty($txn_details) |
|
2572 | 2572 | && |
2573 | 2573 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2574 | 2574 | ) { |
@@ -2580,8 +2580,8 @@ discard block |
||
2580 | 2580 | ) |
2581 | 2581 | ); |
2582 | 2582 | } |
2583 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2584 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2583 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2584 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2585 | 2585 | $txn_details = array( |
2586 | 2586 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2587 | 2587 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2592,7 +2592,7 @@ discard block |
||
2592 | 2592 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2593 | 2593 | 'payment_amount' => $this->checkout->amount_owing, |
2594 | 2594 | 'return_url' => $return_url, |
2595 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2595 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2596 | 2596 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2597 | 2597 | array( |
2598 | 2598 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2601,7 +2601,7 @@ discard block |
||
2601 | 2601 | ) |
2602 | 2602 | ); |
2603 | 2603 | } |
2604 | - echo json_encode( $txn_details ); |
|
2604 | + echo json_encode($txn_details); |
|
2605 | 2605 | exit(); |
2606 | 2606 | } |
2607 | 2607 |
@@ -277,17 +277,17 @@ |
||
277 | 277 | //if we know who the attendee is, and this is a billing form |
278 | 278 | //that uses attendee info, populate it |
279 | 279 | if ( |
280 | - apply_filters( |
|
281 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | - ( |
|
283 | - $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | - && $transaction instanceof EE_Transaction |
|
285 | - && $transaction->primary_registration() instanceof EE_Registration |
|
286 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | - ), |
|
288 | - $this->_billing_form, |
|
289 | - $transaction |
|
290 | - ) |
|
280 | + apply_filters( |
|
281 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | + ( |
|
283 | + $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | + && $transaction instanceof EE_Transaction |
|
285 | + && $transaction->primary_registration() instanceof EE_Registration |
|
286 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | + ), |
|
288 | + $this->_billing_form, |
|
289 | + $transaction |
|
290 | + ) |
|
291 | 291 | ){ |
292 | 292 | $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
293 | 293 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | |
17 | 17 | |
18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
19 | 19 | /** |
20 | 20 | * espresso_get_template_part |
21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @param string $name The name of the specialised template. |
26 | 26 | * @return string the html output for the formatted money value |
27 | 27 | */ |
28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
29 | - EEH_Template::get_template_part( $slug, $name ); |
|
28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
29 | + EEH_Template::get_template_part($slug, $name); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | 33 | |
34 | 34 | |
35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
36 | 36 | /** |
37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param string $suffix added to the end of the generated class |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | 72 | public static function is_espresso_theme() { |
73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | public static function load_espresso_theme_functions() { |
82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
93 | 93 | * @return array |
94 | 94 | */ |
95 | 95 | public static function get_espresso_themes() { |
96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
98 | - if ( empty( $espresso_themes ) ) { |
|
96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
98 | + if (empty($espresso_themes)) { |
|
99 | 99 | return array(); |
100 | 100 | } |
101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
102 | - unset( $espresso_themes[ $key ] ); |
|
101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
102 | + unset($espresso_themes[$key]); |
|
103 | 103 | } |
104 | 104 | EEH_Template::$_espresso_themes = array(); |
105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
105 | + foreach ($espresso_themes as $espresso_theme) { |
|
106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
122 | 122 | * @param bool $return_string |
123 | 123 | * @return string the html output for the formatted money value |
124 | 124 | */ |
125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
127 | 127 | $templates = array(); |
128 | 128 | $name = (string) $name; |
129 | - if ( $name != '' ) { |
|
129 | + if ($name != '') { |
|
130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
131 | 131 | } |
132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -182,26 +182,26 @@ discard block |
||
182 | 182 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
183 | 183 | * @return mixed |
184 | 184 | */ |
185 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
185 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
186 | 186 | // first use WP locate_template to check for template in the current theme folder |
187 | - $template_path = locate_template( $templates ); |
|
187 | + $template_path = locate_template($templates); |
|
188 | 188 | |
189 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
189 | + if ($check_if_custom && ! empty($template_path)) |
|
190 | 190 | return TRUE; |
191 | 191 | |
192 | 192 | // not in the theme |
193 | - if ( empty( $template_path )) { |
|
193 | + if (empty($template_path)) { |
|
194 | 194 | // not even a template to look for ? |
195 | - if ( empty( $templates )) { |
|
195 | + if (empty($templates)) { |
|
196 | 196 | // get post_type |
197 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
197 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
198 | 198 | // get array of EE Custom Post Types |
199 | 199 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
200 | 200 | // build template name based on request |
201 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
202 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
201 | + if (isset($EE_CPTs[$post_type])) { |
|
202 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
203 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
204 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | // currently active EE template theme |
@@ -210,81 +210,81 @@ discard block |
||
210 | 210 | // array of paths to folders that may contain templates |
211 | 211 | $template_folder_paths = array( |
212 | 212 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
213 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
213 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
214 | 214 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
215 | 215 | EVENT_ESPRESSO_TEMPLATE_DIR |
216 | 216 | ); |
217 | 217 | |
218 | 218 | //add core plugin folders for checking only if we're not $check_if_custom |
219 | - if ( ! $check_if_custom ) { |
|
219 | + if ( ! $check_if_custom) { |
|
220 | 220 | $core_paths = array( |
221 | 221 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
222 | - EE_PUBLIC . $current_theme, |
|
222 | + EE_PUBLIC.$current_theme, |
|
223 | 223 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
224 | - EE_TEMPLATES . $current_theme, |
|
224 | + EE_TEMPLATES.$current_theme, |
|
225 | 225 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
226 | 226 | EE_PLUGIN_DIR_PATH |
227 | 227 | ); |
228 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
228 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // now filter that array |
232 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
233 | - $templates = is_array( $templates ) ? $templates : array( $templates ); |
|
234 | - $template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths ); |
|
232 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
233 | + $templates = is_array($templates) ? $templates : array($templates); |
|
234 | + $template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths); |
|
235 | 235 | // array to hold all possible template paths |
236 | 236 | $full_template_paths = array(); |
237 | 237 | |
238 | 238 | // loop through $templates |
239 | - foreach ( $templates as $template ) { |
|
239 | + foreach ($templates as $template) { |
|
240 | 240 | // normalize directory separators |
241 | - $template = EEH_File::standardise_directory_separators( $template ); |
|
242 | - $file_name = basename( $template ); |
|
243 | - $template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) ); |
|
241 | + $template = EEH_File::standardise_directory_separators($template); |
|
242 | + $file_name = basename($template); |
|
243 | + $template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1)); |
|
244 | 244 | // while looping through all template folder paths |
245 | - foreach ( $template_folder_paths as $template_folder_path ) { |
|
245 | + foreach ($template_folder_paths as $template_folder_path) { |
|
246 | 246 | // normalize directory separators |
247 | - $template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path ); |
|
247 | + $template_folder_path = EEH_File::standardise_directory_separators($template_folder_path); |
|
248 | 248 | // determine if any common base path exists between the two paths |
249 | 249 | $common_base_path = EEH_Template::_find_common_base_path( |
250 | - array( $template_folder_path, $template_path_minus_file_name ) |
|
250 | + array($template_folder_path, $template_path_minus_file_name) |
|
251 | 251 | ); |
252 | - if ( $common_base_path !== '' ) { |
|
252 | + if ($common_base_path !== '') { |
|
253 | 253 | // both paths have a common base, so just tack the filename onto our search path |
254 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name; |
|
254 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name; |
|
255 | 255 | } else { |
256 | 256 | // no common base path, so let's just concatenate |
257 | - $resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template; |
|
257 | + $resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template; |
|
258 | 258 | } |
259 | 259 | // build up our template locations array by adding our resolved paths |
260 | 260 | $full_template_paths[] = $resolved_path; |
261 | 261 | } |
262 | 262 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
263 | - array_unshift( $full_template_paths, $template ); |
|
263 | + array_unshift($full_template_paths, $template); |
|
264 | 264 | // path to the directory of the current theme: /wp-content/themes/(current WP theme)/ |
265 | - array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name ); |
|
265 | + array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name); |
|
266 | 266 | } |
267 | 267 | // filter final array of full template paths |
268 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name ); |
|
268 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name); |
|
269 | 269 | // now loop through our final array of template location paths and check each location |
270 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
271 | - if ( is_readable( $full_template_path )) { |
|
272 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
270 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
271 | + if (is_readable($full_template_path)) { |
|
272 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
273 | 273 | // hook that can be used to display the full template path that will be used |
274 | - do_action( 'AHEE__EEH_Template__locate_template__full_template_path', $template_path ); |
|
274 | + do_action('AHEE__EEH_Template__locate_template__full_template_path', $template_path); |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | } |
279 | 279 | // if we got it and you want to see it... |
280 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
281 | - if ( $return_string ) { |
|
282 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
280 | + if ($template_path && $load && ! $check_if_custom) { |
|
281 | + if ($return_string) { |
|
282 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
283 | 283 | } else { |
284 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
284 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
285 | 285 | } |
286 | 286 | } |
287 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
287 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | |
@@ -297,21 +297,21 @@ discard block |
||
297 | 297 | * @param array $paths |
298 | 298 | * @return string |
299 | 299 | */ |
300 | - protected static function _find_common_base_path( $paths ) { |
|
300 | + protected static function _find_common_base_path($paths) { |
|
301 | 301 | $last_offset = 0; |
302 | 302 | $common_base_path = ''; |
303 | - while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) { |
|
303 | + while (($index = strpos($paths[0], DS, $last_offset)) !== false) { |
|
304 | 304 | $dir_length = $index - $last_offset + 1; |
305 | - $directory = substr( $paths[ 0 ], $last_offset, $dir_length ); |
|
306 | - foreach ( $paths as $path ) { |
|
307 | - if ( substr( $path, $last_offset, $dir_length ) != $directory ) { |
|
305 | + $directory = substr($paths[0], $last_offset, $dir_length); |
|
306 | + foreach ($paths as $path) { |
|
307 | + if (substr($path, $last_offset, $dir_length) != $directory) { |
|
308 | 308 | return $common_base_path; |
309 | 309 | } |
310 | 310 | } |
311 | 311 | $common_base_path .= $directory; |
312 | 312 | $last_offset = $index + 1; |
313 | 313 | } |
314 | - return substr( $common_base_path, 0, -1 ); |
|
314 | + return substr($common_base_path, 0, -1); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
324 | 324 | * @return mixed string |
325 | 325 | */ |
326 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
326 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
327 | 327 | |
328 | 328 | /** |
329 | 329 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -334,26 +334,26 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @since 4.6.0 |
336 | 336 | */ |
337 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
338 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
337 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
338 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
339 | 339 | |
340 | 340 | // you gimme nuttin - YOU GET NUTTIN !! |
341 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
341 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
342 | 342 | return ''; |
343 | 343 | } |
344 | 344 | // if $template_args are not in an array, then make it so |
345 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
346 | - $template_args = array( $template_args ); |
|
345 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
346 | + $template_args = array($template_args); |
|
347 | 347 | } |
348 | - extract( (array) $template_args); |
|
348 | + extract((array) $template_args); |
|
349 | 349 | |
350 | - if ( $return_string ) { |
|
350 | + if ($return_string) { |
|
351 | 351 | // because we want to return a string, we are going to capture the output |
352 | 352 | ob_start(); |
353 | - include( $template_path ); |
|
353 | + include($template_path); |
|
354 | 354 | return ob_get_clean(); |
355 | 355 | } else { |
356 | - include( $template_path ); |
|
356 | + include($template_path); |
|
357 | 357 | } |
358 | 358 | return ''; |
359 | 359 | } |
@@ -371,27 +371,27 @@ discard block |
||
371 | 371 | * @param string $suffix added to the end of the generated class |
372 | 372 | * @return string |
373 | 373 | */ |
374 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
374 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
375 | 375 | // in the beginning... |
376 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
376 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
377 | 377 | // da muddle |
378 | 378 | $class = ''; |
379 | 379 | // the end |
380 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
380 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
381 | 381 | // is the passed object an EE object ? |
382 | - if ( $object instanceof EE_Base_Class ) { |
|
382 | + if ($object instanceof EE_Base_Class) { |
|
383 | 383 | // grab the exact type of object |
384 | - $obj_class = get_class( $object ); |
|
384 | + $obj_class = get_class($object); |
|
385 | 385 | // depending on the type of object... |
386 | - switch ( $obj_class ) { |
|
386 | + switch ($obj_class) { |
|
387 | 387 | // no specifics just yet... |
388 | 388 | default : |
389 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
390 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
389 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
390 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
391 | 391 | |
392 | 392 | } |
393 | 393 | } |
394 | - return $prefix . $class . $suffix; |
|
394 | + return $prefix.$class.$suffix; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -407,54 +407,54 @@ discard block |
||
407 | 407 | * @param string $cur_code_span_class |
408 | 408 | * @return string the html output for the formatted money value |
409 | 409 | */ |
410 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
410 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
411 | 411 | // ensure amount was received |
412 | - if ( is_null( $amount ) ) { |
|
413 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
414 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
412 | + if (is_null($amount)) { |
|
413 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
414 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
415 | 415 | return ''; |
416 | 416 | } |
417 | 417 | //ensure amount is float |
418 | - $amount = apply_filters( 'FHEE__EEH_Template__format_currency__raw_amount', (float) $amount ); |
|
419 | - $CNT_ISO = apply_filters( 'FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount ); |
|
418 | + $amount = apply_filters('FHEE__EEH_Template__format_currency__raw_amount', (float) $amount); |
|
419 | + $CNT_ISO = apply_filters('FHEE__EEH_Template__format_currency__CNT_ISO', $CNT_ISO, $amount); |
|
420 | 420 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
421 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
421 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
422 | 422 | // still a number or was amount converted to a string like "free" ? |
423 | - if ( is_float( $amount_formatted )) { |
|
423 | + if (is_float($amount_formatted)) { |
|
424 | 424 | // was a country ISO code passed ? if so generate currency config object for that country |
425 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
425 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
426 | 426 | // verify results |
427 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
427 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
428 | 428 | // set default config country currency settings |
429 | 429 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
430 | 430 | } |
431 | 431 | // format float |
432 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
432 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
433 | 433 | // add formatting ? |
434 | - if ( ! $return_raw ) { |
|
434 | + if ( ! $return_raw) { |
|
435 | 435 | // add currency sign |
436 | - if( $mny->sign_b4 ){ |
|
437 | - if( $amount >= 0 ){ |
|
438 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
439 | - }else{ |
|
440 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
436 | + if ($mny->sign_b4) { |
|
437 | + if ($amount >= 0) { |
|
438 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
439 | + } else { |
|
440 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
441 | 441 | } |
442 | 442 | |
443 | - }else{ |
|
444 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
443 | + } else { |
|
444 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | // filter to allow global setting of display_code |
448 | - $display_code = apply_filters( 'FHEE__EEH_Template__format_currency__display_code', $display_code ); |
|
448 | + $display_code = apply_filters('FHEE__EEH_Template__format_currency__display_code', $display_code); |
|
449 | 449 | |
450 | 450 | // add currency code ? |
451 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
451 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
452 | 452 | } |
453 | 453 | // filter results |
454 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
454 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
455 | 455 | } |
456 | 456 | // clean up vars |
457 | - unset( $mny ); |
|
457 | + unset($mny); |
|
458 | 458 | // return formatted currency amount |
459 | 459 | return $amount_formatted; |
460 | 460 | } |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
470 | 470 | * @return string The localized label for the status id. |
471 | 471 | */ |
472 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
472 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
473 | 473 | /** @type EEM_Status $EEM_Status */ |
474 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
475 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
476 | - return $status[ $status_id ]; |
|
474 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
475 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
476 | + return $status[$status_id]; |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -488,21 +488,21 @@ discard block |
||
488 | 488 | * @param string $title |
489 | 489 | * @return string the html output for the button |
490 | 490 | */ |
491 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '', $title = '' ) { |
|
491 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '', $title = '') { |
|
492 | 492 | $icon_html = ''; |
493 | - if ( ! empty( $icon ) ) { |
|
494 | - $dashicons = preg_split( "(ee-icon |dashicons )", $icon ); |
|
495 | - $dashicons = array_filter( $dashicons ); |
|
496 | - $count = count( $dashicons ); |
|
493 | + if ( ! empty($icon)) { |
|
494 | + $dashicons = preg_split("(ee-icon |dashicons )", $icon); |
|
495 | + $dashicons = array_filter($dashicons); |
|
496 | + $count = count($dashicons); |
|
497 | 497 | $icon_html .= $count > 1 ? '<span class="ee-composite-dashicon">' : ''; |
498 | - foreach ( $dashicons as $dashicon ) { |
|
499 | - $type = strpos( $dashicon, 'ee-icon' ) !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | - $icon_html .= '<span class="' . $type . $dashicon . '"></span>'; |
|
498 | + foreach ($dashicons as $dashicon) { |
|
499 | + $type = strpos($dashicon, 'ee-icon') !== false ? 'ee-icon ' : 'dashicons '; |
|
500 | + $icon_html .= '<span class="'.$type.$dashicon.'"></span>'; |
|
501 | 501 | } |
502 | 502 | $icon_html .= $count > 1 ? '</span>' : ''; |
503 | 503 | } |
504 | - $label = ! empty( $icon ) ? $icon_html . $label : $label; |
|
505 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '" title="' . $title . '">' . $label . '</a>'; |
|
504 | + $label = ! empty($icon) ? $icon_html.$label : $label; |
|
505 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'" title="'.$title.'">'.$label.'</a>'; |
|
506 | 506 | return $button; |
507 | 507 | } |
508 | 508 | |
@@ -519,21 +519,21 @@ discard block |
||
519 | 519 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
520 | 520 | * @return string generated link |
521 | 521 | */ |
522 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
522 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
523 | 523 | |
524 | - if ( ! $page ) |
|
525 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
524 | + if ( ! $page) |
|
525 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
526 | 526 | |
527 | - if ( ! $action ) |
|
528 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
527 | + if ( ! $action) |
|
528 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
529 | 529 | |
530 | 530 | $action = empty($action) ? 'default' : $action; |
531 | 531 | |
532 | 532 | |
533 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
534 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | - $help_text = !$help_text ? '' : $help_text; |
|
536 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
533 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
534 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
535 | + $help_text = ! $help_text ? '' : $help_text; |
|
536 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -545,31 +545,31 @@ discard block |
||
545 | 545 | * @param EE_Help_Tour |
546 | 546 | * @return string html |
547 | 547 | */ |
548 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
548 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
549 | 549 | $id = $tour->get_slug(); |
550 | 550 | $stops = $tour->get_stops(); |
551 | 551 | |
552 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
552 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
553 | 553 | |
554 | - foreach ( $stops as $stop ) { |
|
555 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
556 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
554 | + foreach ($stops as $stop) { |
|
555 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
556 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
557 | 557 | |
558 | 558 | //if container is set to modal then let's make sure we set the options accordingly |
559 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
559 | + if (empty($data_id) && empty($data_class)) { |
|
560 | 560 | $stop['options']['modal'] = true; |
561 | 561 | $stop['options']['expose'] = true; |
562 | 562 | } |
563 | 563 | |
564 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
565 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
564 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
565 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
566 | 566 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
567 | 567 | |
568 | 568 | //options |
569 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
569 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
570 | 570 | $options = ' data-options="'; |
571 | - foreach ( $stop['options'] as $option => $value ) { |
|
572 | - $options .= $option . ':' . $value . ';'; |
|
571 | + foreach ($stop['options'] as $option => $value) { |
|
572 | + $options .= $option.':'.$value.';'; |
|
573 | 573 | } |
574 | 574 | $options .= '"'; |
575 | 575 | } else { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | //let's put all together |
580 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
580 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
581 | 581 | } |
582 | 582 | |
583 | 583 | $content .= '</ol>'; |
@@ -598,31 +598,31 @@ discard block |
||
598 | 598 | * @throws EE_Error |
599 | 599 | * @return string html structure for status. |
600 | 600 | */ |
601 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
602 | - if ( !is_array( $status_array ) ) |
|
603 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
601 | + public static function status_legend($status_array, $active_status = '') { |
|
602 | + if ( ! is_array($status_array)) |
|
603 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
604 | 604 | |
605 | 605 | $setup_array = array(); |
606 | - foreach ( $status_array as $item => $status ) { |
|
606 | + foreach ($status_array as $item => $status) { |
|
607 | 607 | $setup_array[$item] = array( |
608 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
609 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
608 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
609 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
610 | 610 | 'status' => $status |
611 | 611 | ); |
612 | 612 | } |
613 | 613 | |
614 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
615 | - $content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n"; |
|
616 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
617 | - foreach ( $setup_array as $item => $details ) { |
|
614 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
615 | + $content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n"; |
|
616 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
617 | + foreach ($setup_array as $item => $details) { |
|
618 | 618 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
619 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
620 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
621 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
622 | - $content .= '</dt>' . "\n"; |
|
619 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
620 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
621 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
622 | + $content .= '</dt>'."\n"; |
|
623 | 623 | } |
624 | - $content .= '</dl>' . "\n"; |
|
625 | - $content .= '</div>' . "\n"; |
|
624 | + $content .= '</dl>'."\n"; |
|
625 | + $content .= '</div>'."\n"; |
|
626 | 626 | return $content; |
627 | 627 | } |
628 | 628 | |
@@ -635,8 +635,8 @@ discard block |
||
635 | 635 | * @return string |
636 | 636 | */ |
637 | 637 | public static function layout_array_as_table($data) { |
638 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
639 | - $data = (array)$data; |
|
638 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
639 | + $data = (array) $data; |
|
640 | 640 | } |
641 | 641 | ob_start(); |
642 | 642 | if (is_array($data)) { |
@@ -649,10 +649,10 @@ discard block |
||
649 | 649 | ?> |
650 | 650 | <tr> |
651 | 651 | <td> |
652 | - <?php echo $data_key;?> |
|
652 | + <?php echo $data_key; ?> |
|
653 | 653 | </td> |
654 | 654 | <td> |
655 | - <?php echo self::layout_array_as_table($data_values);?> |
|
655 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
656 | 656 | </td> |
657 | 657 | </tr> |
658 | 658 | <?php |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | <ul> |
667 | 667 | <?php |
668 | 668 | foreach ($data as $datum) { |
669 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
669 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
670 | 670 | }?> |
671 | 671 | </ul> |
672 | 672 | <?php |
@@ -696,8 +696,8 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return string |
698 | 698 | */ |
699 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
700 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label ); |
|
699 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
700 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label); |
|
701 | 701 | } |
702 | 702 | |
703 | 703 | |
@@ -721,13 +721,13 @@ discard block |
||
721 | 721 | * ) |
722 | 722 | * @return string |
723 | 723 | */ |
724 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) { |
|
724 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) { |
|
725 | 725 | $page_links = array(); |
726 | 726 | $disable_first = $disable_last = ''; |
727 | 727 | $total_items = (int) $total_items; |
728 | 728 | $per_page = (int) $per_page; |
729 | 729 | $current = (int) $current; |
730 | - $paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name ); |
|
730 | + $paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name); |
|
731 | 731 | |
732 | 732 | //filter items_label |
733 | 733 | $items_label = apply_filters( |
@@ -735,68 +735,68 @@ discard block |
||
735 | 735 | $items_label |
736 | 736 | ); |
737 | 737 | |
738 | - if ( empty( $items_label ) |
|
739 | - || ! is_array( $items_label ) |
|
740 | - || ! isset( $items_label['single'] ) |
|
741 | - || ! isset( $items_label['plural'] ) ) { |
|
738 | + if (empty($items_label) |
|
739 | + || ! is_array($items_label) |
|
740 | + || ! isset($items_label['single']) |
|
741 | + || ! isset($items_label['plural'])) { |
|
742 | 742 | $items_label = array( |
743 | - 'single' => __( '1 item', 'event_espresso' ), |
|
744 | - 'plural' => __( '%s items', 'event_espresso' ) |
|
743 | + 'single' => __('1 item', 'event_espresso'), |
|
744 | + 'plural' => __('%s items', 'event_espresso') |
|
745 | 745 | ); |
746 | 746 | } else { |
747 | 747 | $items_label = array( |
748 | - 'single' => '1 ' . esc_html( $items_label['single'] ), |
|
749 | - 'plural' => '%s ' . esc_html( $items_label['plural'] ) |
|
748 | + 'single' => '1 '.esc_html($items_label['single']), |
|
749 | + 'plural' => '%s '.esc_html($items_label['plural']) |
|
750 | 750 | ); |
751 | 751 | } |
752 | 752 | |
753 | - $total_pages = ceil( $total_items / $per_page ); |
|
753 | + $total_pages = ceil($total_items / $per_page); |
|
754 | 754 | |
755 | - if ( $total_pages <= 1 ) |
|
755 | + if ($total_pages <= 1) |
|
756 | 756 | return ''; |
757 | 757 | |
758 | - $item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single']; |
|
758 | + $item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single']; |
|
759 | 759 | |
760 | - $output = '<span class="displaying-num">' . $item_label . '</span>'; |
|
760 | + $output = '<span class="displaying-num">'.$item_label.'</span>'; |
|
761 | 761 | |
762 | - if ( $current === 1 ) { |
|
762 | + if ($current === 1) { |
|
763 | 763 | $disable_first = ' disabled'; |
764 | 764 | } |
765 | - if ( $current == $total_pages ) { |
|
765 | + if ($current == $total_pages) { |
|
766 | 766 | $disable_last = ' disabled'; |
767 | 767 | } |
768 | 768 | |
769 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | - 'first-page' . $disable_first, |
|
771 | - esc_attr__( 'Go to the first page' ), |
|
772 | - esc_url( remove_query_arg( $paged_arg_name, $url ) ), |
|
769 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
770 | + 'first-page'.$disable_first, |
|
771 | + esc_attr__('Go to the first page'), |
|
772 | + esc_url(remove_query_arg($paged_arg_name, $url)), |
|
773 | 773 | '«' |
774 | 774 | ); |
775 | 775 | |
776 | 776 | $page_links[] = sprintf( |
777 | 777 | '<a class="%s" title="%s" href="%s">%s</a>', |
778 | - 'prev-page' . $disable_first, |
|
779 | - esc_attr__( 'Go to the previous page' ), |
|
780 | - esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ), |
|
778 | + 'prev-page'.$disable_first, |
|
779 | + esc_attr__('Go to the previous page'), |
|
780 | + esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)), |
|
781 | 781 | '‹' |
782 | 782 | ); |
783 | 783 | |
784 | - if ( ! $show_num_field ) { |
|
784 | + if ( ! $show_num_field) { |
|
785 | 785 | $html_current_page = $current; |
786 | 786 | } else { |
787 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | - esc_attr__( 'Current page' ), |
|
787 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />", |
|
788 | + esc_attr__('Current page'), |
|
789 | 789 | $current, |
790 | - strlen( $total_pages ) |
|
790 | + strlen($total_pages) |
|
791 | 791 | ); |
792 | 792 | } |
793 | 793 | |
794 | 794 | $html_total_pages = sprintf( |
795 | 795 | '<span class="total-pages">%s</span>', |
796 | - number_format_i18n( $total_pages ) |
|
796 | + number_format_i18n($total_pages) |
|
797 | 797 | ); |
798 | 798 | $page_links[] = sprintf( |
799 | - _x( '%3$s%1$s of %2$s%4$s', 'paging' ), |
|
799 | + _x('%3$s%1$s of %2$s%4$s', 'paging'), |
|
800 | 800 | $html_current_page, |
801 | 801 | $html_total_pages, |
802 | 802 | '<span class="paging-input">', |
@@ -805,29 +805,29 @@ discard block |
||
805 | 805 | |
806 | 806 | $page_links[] = sprintf( |
807 | 807 | '<a class="%s" title="%s" href="%s">%s</a>', |
808 | - 'next-page' . $disable_last, |
|
809 | - esc_attr__( 'Go to the next page' ), |
|
810 | - esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ), |
|
808 | + 'next-page'.$disable_last, |
|
809 | + esc_attr__('Go to the next page'), |
|
810 | + esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)), |
|
811 | 811 | '›' |
812 | 812 | ); |
813 | 813 | |
814 | 814 | $page_links[] = sprintf( |
815 | 815 | '<a class="%s" title="%s" href="%s">%s</a>', |
816 | - 'last-page' . $disable_last, |
|
817 | - esc_attr__( 'Go to the last page' ), |
|
818 | - esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ), |
|
816 | + 'last-page'.$disable_last, |
|
817 | + esc_attr__('Go to the last page'), |
|
818 | + esc_url(add_query_arg($paged_arg_name, $total_pages, $url)), |
|
819 | 819 | '»' |
820 | 820 | ); |
821 | 821 | |
822 | - $output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>'; |
|
822 | + $output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>'; |
|
823 | 823 | // set page class |
824 | - if ( $total_pages ) { |
|
824 | + if ($total_pages) { |
|
825 | 825 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
826 | 826 | } else { |
827 | 827 | $page_class = ' no-pages'; |
828 | 828 | } |
829 | 829 | |
830 | - return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>'; |
|
830 | + return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>'; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * @param string $wrap_id |
838 | 838 | * @return string |
839 | 839 | */ |
840 | - public static function powered_by_event_espresso( $wrap_class = '', $wrap_id = '' ) { |
|
841 | - $admin = is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ); |
|
840 | + public static function powered_by_event_espresso($wrap_class = '', $wrap_id = '') { |
|
841 | + $admin = is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX); |
|
842 | 842 | if ( |
843 | 843 | ! $admin && |
844 | 844 | ! apply_filters( |
@@ -849,17 +849,17 @@ discard block |
||
849 | 849 | return ''; |
850 | 850 | } |
851 | 851 | $tag = $admin ? 'span' : 'div'; |
852 | - $attributes = ! empty( $wrap_id ) ? " id=\"{$wrap_id}\"" : ''; |
|
852 | + $attributes = ! empty($wrap_id) ? " id=\"{$wrap_id}\"" : ''; |
|
853 | 853 | $wrap_class = $admin ? "{$wrap_class} float-left" : $wrap_class; |
854 | - $attributes .= ! empty( $wrap_class ) |
|
854 | + $attributes .= ! empty($wrap_class) |
|
855 | 855 | ? " class=\"{$wrap_class} powered-by-event-espresso-credit\"" |
856 | 856 | : ' class="powered-by-event-espresso-credit"'; |
857 | - $powered_by = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - ' . EVENT_ESPRESSO_VERSION : 'Event Espresso' ); |
|
857 | + $powered_by = apply_filters('FHEE__EEH_Template__powered_by_event_espresso_text', $admin ? 'Event Espresso - '.EVENT_ESPRESSO_VERSION : 'Event Espresso'); |
|
858 | 858 | $url = add_query_arg( |
859 | - array( 'ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id() ), |
|
859 | + array('ap_id' => EE_Registry::instance()->CFG->admin->affiliate_id()), |
|
860 | 860 | 'https://eventespresso.com/' |
861 | 861 | ); |
862 | - $url = apply_filters( 'FHEE__EEH_Template__powered_by_event_espresso__url', $url ); |
|
862 | + $url = apply_filters('FHEE__EEH_Template__powered_by_event_espresso__url', $url); |
|
863 | 863 | return (string) apply_filters( |
864 | 864 | 'FHEE__EEH_Template__powered_by_event_espresso__html', |
865 | 865 | sprintf( |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 ); |
892 | 892 | |
893 | 893 | |
894 | -if ( ! function_exists( 'espresso_pagination' ) ) { |
|
894 | +if ( ! function_exists('espresso_pagination')) { |
|
895 | 895 | /** |
896 | 896 | * espresso_pagination |
897 | 897 | * |
@@ -903,21 +903,21 @@ discard block |
||
903 | 903 | $big = 999999999; // need an unlikely integer |
904 | 904 | $pagination = paginate_links( |
905 | 905 | array( |
906 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
906 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
907 | 907 | 'format' => '?paged=%#%', |
908 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
908 | + 'current' => max(1, get_query_var('paged')), |
|
909 | 909 | 'total' => $wp_query->max_num_pages, |
910 | 910 | 'show_all' => true, |
911 | 911 | 'end_size' => 10, |
912 | 912 | 'mid_size' => 6, |
913 | 913 | 'prev_next' => true, |
914 | - 'prev_text' => __( '‹ PREV', 'event_espresso' ), |
|
915 | - 'next_text' => __( 'NEXT ›', 'event_espresso' ), |
|
914 | + 'prev_text' => __('‹ PREV', 'event_espresso'), |
|
915 | + 'next_text' => __('NEXT ›', 'event_espresso'), |
|
916 | 916 | 'type' => 'plain', |
917 | 917 | 'add_args' => false, |
918 | 918 | 'add_fragment' => '' |
919 | 919 | ) |
920 | 920 | ); |
921 | - echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : ''; |
|
921 | + echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : ''; |
|
922 | 922 | } |
923 | 923 | } |
924 | 924 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * This sets up the email messenger for the EE_messages (notifications) subsystem in EE. |
31 | 31 | */ |
32 | -class EE_Email_messenger extends EE_messenger { |
|
32 | +class EE_Email_messenger extends EE_messenger { |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * The following are the properties that email requires for the message going out. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected function _set_valid_shortcodes() { |
78 | 78 | //remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the message type. |
79 | 79 | $this->_valid_shortcodes = array( |
80 | - 'to' => array('email','event_author', 'primary_registration_details', 'recipient_details'), |
|
80 | + 'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
81 | 81 | 'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details') |
82 | 82 | ); |
83 | 83 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'shortcodes' => array('organization', 'primary_registration_details', 'event_author', 'primary_registration_details', 'recipient_details') |
112 | 112 | ), |
113 | 113 | 'content' => array( |
114 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
114 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
115 | 115 | ), |
116 | 116 | 'attendee_list' => array( |
117 | 117 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'required' => array('[EVENT_LIST]') |
123 | 123 | ), |
124 | 124 | 'ticket_list' => array( |
125 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'), |
|
125 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
126 | 126 | 'required' => array('[TICKET_LIST]') |
127 | 127 | ), |
128 | 128 | 'datetime_list' => array( |
@@ -141,21 +141,21 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @since 4.5.0 |
143 | 143 | */ |
144 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
145 | - if ( $sending_messenger_name = 'html' ) { |
|
146 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
144 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
145 | + if ($sending_messenger_name = 'html') { |
|
146 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - public function add_email_css( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
153 | + public function add_email_css($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
154 | 154 | //prevent recursion on this callback. |
155 | - remove_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10 ); |
|
156 | - $variation = $this->get_variation( $template_pack, $message_type, $url, 'main', $variation, FALSE ); |
|
155 | + remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10); |
|
156 | + $variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, FALSE); |
|
157 | 157 | |
158 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
158 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
159 | 159 | return $variation; |
160 | 160 | } |
161 | 161 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'required' => FALSE, |
188 | 188 | 'validation' => FALSE, |
189 | 189 | 'format' => '%s', |
190 | - 'value' => sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ), |
|
190 | + 'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')), |
|
191 | 191 | 'default'=> '', |
192 | 192 | 'css_class' => '' |
193 | 193 | ) |
@@ -349,16 +349,16 @@ discard block |
||
349 | 349 | * @return bool | WP_Error true if message delivered, false if it didn't deliver OR bubble up any error object if present. |
350 | 350 | */ |
351 | 351 | protected function _send_message() { |
352 | - $success = wp_mail( |
|
353 | - html_entity_decode( $this->_to, ENT_QUOTES, "UTF-8" ), |
|
354 | - stripslashes( html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8" )), |
|
352 | + $success = wp_mail( |
|
353 | + html_entity_decode($this->_to, ENT_QUOTES, "UTF-8"), |
|
354 | + stripslashes(html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8")), |
|
355 | 355 | $this->_body(), |
356 | 356 | $this->_headers() |
357 | 357 | ); |
358 | - if ( ! $success ) { |
|
358 | + if ( ! $success) { |
|
359 | 359 | EE_Error::add_error( |
360 | 360 | sprintf( |
361 | - __( 'The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
361 | + __('The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
362 | 362 | $this->_to, |
363 | 363 | $this->_from, |
364 | 364 | '<br />' |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return string html body of the message content and the related css. |
378 | 378 | */ |
379 | 379 | protected function _preview() { |
380 | - return $this->_body( true ); |
|
380 | + return $this->_body(true); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -392,18 +392,18 @@ discard block |
||
392 | 392 | */ |
393 | 393 | protected function _headers() { |
394 | 394 | $this->_ensure_has_from_email_address(); |
395 | - $from = stripslashes_deep( html_entity_decode($this->_from, ENT_QUOTES,"UTF-8" ) ); |
|
395 | + $from = stripslashes_deep(html_entity_decode($this->_from, ENT_QUOTES, "UTF-8")); |
|
396 | 396 | $headers = array( |
397 | 397 | 'MIME-Version: 1.0', |
398 | - 'From:' . $from, |
|
399 | - 'Reply-To:' . $from, |
|
398 | + 'From:'.$from, |
|
399 | + 'Reply-To:'.$from, |
|
400 | 400 | 'Content-Type:text/html; charset=utf-8' |
401 | 401 | ); |
402 | 402 | |
403 | 403 | //but wait! Header's for the from is NOT reliable because some plugins don't respect From: as set in the header. |
404 | - add_filter( 'wp_mail_from', array( $this, 'set_from_address' ), 100 ); |
|
405 | - add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 ); |
|
406 | - return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this ); |
|
404 | + add_filter('wp_mail_from', array($this, 'set_from_address'), 100); |
|
405 | + add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100); |
|
406 | + return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * address for the from address to avoid problems with sending emails. |
413 | 413 | */ |
414 | 414 | protected function _ensure_has_from_email_address() { |
415 | - if ( empty( $this->_from ) ) { |
|
415 | + if (empty($this->_from)) { |
|
416 | 416 | $this->_from = get_bloginfo('admin_email'); |
417 | 417 | } |
418 | 418 | } |
@@ -429,21 +429,21 @@ discard block |
||
429 | 429 | * @return array |
430 | 430 | */ |
431 | 431 | private function _parse_from() { |
432 | - if ( strpos( $this->_from, '<' ) !== false ) { |
|
433 | - $from_name = substr( $this->_from, 0, strpos( $this->_from, '<' ) - 1 ); |
|
434 | - $from_name = str_replace( '"', '', $from_name ); |
|
435 | - $from_name = trim( $from_name ); |
|
436 | - |
|
437 | - $from_email = substr( $this->_from, strpos( $this->_from, '<' ) + 1 ); |
|
438 | - $from_email = str_replace( '>', '', $from_email ); |
|
439 | - $from_email = trim( $from_email ); |
|
440 | - } elseif ( trim( $this->_from ) !== '' ) { |
|
432 | + if (strpos($this->_from, '<') !== false) { |
|
433 | + $from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1); |
|
434 | + $from_name = str_replace('"', '', $from_name); |
|
435 | + $from_name = trim($from_name); |
|
436 | + |
|
437 | + $from_email = substr($this->_from, strpos($this->_from, '<') + 1); |
|
438 | + $from_email = str_replace('>', '', $from_email); |
|
439 | + $from_email = trim($from_email); |
|
440 | + } elseif (trim($this->_from) !== '') { |
|
441 | 441 | $from_name = ''; |
442 | - $from_email = trim( $this->_from ); |
|
442 | + $from_email = trim($this->_from); |
|
443 | 443 | } else { |
444 | 444 | $from_name = $from_email = ''; |
445 | 445 | } |
446 | - return array( $from_name, $from_email ); |
|
446 | + return array($from_name, $from_email); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @param string $from_email What the original from_email is. |
458 | 458 | */ |
459 | - public function set_from_address( $from_email ) { |
|
459 | + public function set_from_address($from_email) { |
|
460 | 460 | $parsed_from = $this->_parse_from(); |
461 | 461 | //includes fallback if the parsing failed. |
462 | - $from_email = is_array( $parsed_from ) && ! empty( $parsed_from[1] ) ? $parsed_from[1] : get_bloginfo( 'admin_email' ); |
|
462 | + $from_email = is_array($parsed_from) && ! empty($parsed_from[1]) ? $parsed_from[1] : get_bloginfo('admin_email'); |
|
463 | 463 | return $from_email; |
464 | 464 | } |
465 | 465 | |
@@ -473,16 +473,16 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @param string $from_name The original from_name. |
475 | 475 | */ |
476 | - public function set_from_name( $from_name ) { |
|
476 | + public function set_from_name($from_name) { |
|
477 | 477 | $parsed_from = $this->_parse_from(); |
478 | - if ( is_array( $parsed_from) && ! empty( $parsed_from[0] ) ) { |
|
479 | - $from_name = $parsed_from[0]; |
|
478 | + if (is_array($parsed_from) && ! empty($parsed_from[0])) { |
|
479 | + $from_name = $parsed_from[0]; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | //if from name is "WordPress" let's sub in the site name instead (more friendly!) |
483 | 483 | $from_name = $from_name == 'WordPress' ? get_bloginfo() : $from_name; |
484 | 484 | |
485 | - return stripslashes_deep( html_entity_decode($from_name, ENT_QUOTES,"UTF-8" ) ); |
|
485 | + return stripslashes_deep(html_entity_decode($from_name, ENT_QUOTES, "UTF-8")); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | * @param bool $preview will determine whether this is preview template or not. |
494 | 494 | * @return string formatted body for email. |
495 | 495 | */ |
496 | - protected function _body( $preview = false ) { |
|
496 | + protected function _body($preview = false) { |
|
497 | 497 | //setup template args! |
498 | 498 | $this->_template_args = array( |
499 | 499 | 'subject' => $this->_subject, |
500 | 500 | 'from' => $this->_from, |
501 | - 'main_body' => wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )) |
|
501 | + 'main_body' => wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))) |
|
502 | 502 | ); |
503 | - $body = $this->_get_main_template( $preview ); |
|
503 | + $body = $this->_get_main_template($preview); |
|
504 | 504 | |
505 | 505 | /** |
506 | 506 | * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched. |
@@ -508,17 +508,17 @@ discard block |
||
508 | 508 | * @type bool $preview Indicates whether a preview is being generated or not. |
509 | 509 | * @return bool true indicates to use the inliner, false bypasses it. |
510 | 510 | */ |
511 | - if ( apply_filters( 'FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview ) ) { |
|
511 | + if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) { |
|
512 | 512 | |
513 | 513 | //require CssToInlineStyles library and its dependencies via composer autoloader |
514 | - require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php'; |
|
514 | + require_once EE_THIRD_PARTY.'cssinliner/vendor/autoload.php'; |
|
515 | 515 | |
516 | 516 | //now if this isn't a preview, let's setup the body so it has inline styles |
517 | - if ( ! $preview || ( $preview && defined( 'DOING_AJAX' ) ) ) { |
|
518 | - $style = file_get_contents( $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation ), TRUE ); |
|
519 | - $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles( $body, $style ); |
|
520 | - $body = ltrim( $CSS->convert( true ), ">\n" ); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
521 | - $body = ltrim( $body, "<?" ); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
517 | + if ( ! $preview || ($preview && defined('DOING_AJAX'))) { |
|
518 | + $style = file_get_contents($this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation), TRUE); |
|
519 | + $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style); |
|
520 | + $body = ltrim($CSS->convert(true), ">\n"); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
521 | + $body = ltrim($body, "<?"); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | public function get_existing_test_settings() { |
538 | 538 | $settings = parent::get_existing_test_settings(); |
539 | 539 | //override subject if present because we always want it to be fresh. |
540 | - if ( is_array( $settings ) && ! empty( $settings['subject'] ) ) { |
|
541 | - $settings['subject'] = sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ); |
|
540 | + if (is_array($settings) && ! empty($settings['subject'])) { |
|
541 | + $settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')); |
|
542 | 542 | } |
543 | 543 | return $settings; |
544 | 544 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,102 +67,102 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.006' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.006'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |