@@ -558,7 +558,7 @@ |
||
558 | 558 | * |
559 | 559 | * @param string $payment_status The payment status being matched. |
560 | 560 | * |
561 | - * @return string|bool The payment message type slug matching the status or false if no match. |
|
561 | + * @return string|false The payment message type slug matching the status or false if no match. |
|
562 | 562 | */ |
563 | 563 | protected static function _get_payment_message_type( $payment_status ) { |
564 | 564 | $matches = array( |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @return EED_Messages |
70 | 70 | */ |
71 | 71 | public static function instance() { |
72 | - return parent::get_instance( __CLASS__ ); |
|
72 | + return parent::get_instance(__CLASS__); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function set_hooks() { |
86 | 86 | //actions |
87 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
88 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 2 ); |
|
87 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
88 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 2); |
|
89 | 89 | //filters |
90 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
91 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
90 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
91 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
92 | 92 | //register routes |
93 | 93 | self::_register_routes(); |
94 | 94 | } |
@@ -101,16 +101,16 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public static function set_hooks_admin() { |
103 | 103 | //actions |
104 | - add_action( 'AHEE__EE_Payment_Processor__update_txn_based_on_payment', array( 'EED_Messages', 'payment' ), 10, 2 ); |
|
105 | - add_action( 'AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array( 'EED_Messages', 'payment_reminder' ), 10 ); |
|
106 | - add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array( 'EED_Messages', 'maybe_registration' ), 10, 3 ); |
|
107 | - add_action( 'AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array( 'EED_Messages', 'send_newsletter_message' ), 10, 2 ); |
|
108 | - add_action( 'AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array( 'EED_Messages', 'cancelled_registration' ), 10 ); |
|
109 | - add_action( 'AHEE__EE_Admin_Page___process_admin_payment_notification', array( 'EED_Messages', 'process_admin_payment' ), 10, 1 ); |
|
104 | + add_action('AHEE__EE_Payment_Processor__update_txn_based_on_payment', array('EED_Messages', 'payment'), 10, 2); |
|
105 | + add_action('AHEE__Transactions_Admin_Page___send_payment_reminder__process_admin_payment_reminder', array('EED_Messages', 'payment_reminder'), 10); |
|
106 | + add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', array('EED_Messages', 'maybe_registration'), 10, 3); |
|
107 | + add_action('AHEE__Extend_Registrations_Admin_Page___newsletter_selected_send__with_registrations', array('EED_Messages', 'send_newsletter_message'), 10, 2); |
|
108 | + add_action('AHEE__EES_Espresso_Cancelled__process_shortcode__transaction', array('EED_Messages', 'cancelled_registration'), 10); |
|
109 | + add_action('AHEE__EE_Admin_Page___process_admin_payment_notification', array('EED_Messages', 'process_admin_payment'), 10, 1); |
|
110 | 110 | //filters |
111 | - add_filter( 'FHEE__EE_Admin_Page___process_resend_registration__success', array( 'EED_Messages', 'process_resend' ), 10, 2 ); |
|
112 | - add_filter( 'FHEE__EE_Registration__receipt_url__receipt_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
113 | - add_filter( 'FHEE__EE_Registration__invoice_url__invoice_url', array( 'EED_Messages', 'registration_message_trigger_url' ), 10, 4 ); |
|
111 | + add_filter('FHEE__EE_Admin_Page___process_resend_registration__success', array('EED_Messages', 'process_resend'), 10, 2); |
|
112 | + add_filter('FHEE__EE_Registration__receipt_url__receipt_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
113 | + add_filter('FHEE__EE_Registration__invoice_url__invoice_url', array('EED_Messages', 'registration_message_trigger_url'), 10, 4); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | * @return void |
125 | 125 | */ |
126 | 126 | protected static function _register_routes() { |
127 | - EE_Config::register_route( 'msg_url_trigger', 'Messages', 'run' ); |
|
128 | - EE_Config::register_route( 'msg_cron_trigger', 'Messages', 'execute_batch_request' ); |
|
129 | - EE_Config::register_route( 'msg_browser_trigger', 'Messages', 'browser_trigger' ); |
|
130 | - EE_Config::register_route( 'msg_browser_error_trigger', 'Messages', 'browser_error_trigger' ); |
|
131 | - do_action( 'AHEE__EED_Messages___register_routes' ); |
|
127 | + EE_Config::register_route('msg_url_trigger', 'Messages', 'run'); |
|
128 | + EE_Config::register_route('msg_cron_trigger', 'Messages', 'execute_batch_request'); |
|
129 | + EE_Config::register_route('msg_browser_trigger', 'Messages', 'browser_trigger'); |
|
130 | + EE_Config::register_route('msg_browser_error_trigger', 'Messages', 'browser_error_trigger'); |
|
131 | + do_action('AHEE__EED_Messages___register_routes'); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | * @since 4.9.0 |
140 | 140 | * @param WP $WP |
141 | 141 | */ |
142 | - public function browser_trigger( $WP ) { |
|
142 | + public function browser_trigger($WP) { |
|
143 | 143 | //ensure controller is loaded |
144 | 144 | self::_load_controller(); |
145 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
145 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
146 | 146 | try { |
147 | - $mtg = new EE_Message_Generated_From_Token( $token, 'html', self::$_message_resource_manager ); |
|
148 | - self::$_MSG_PROCESSOR->generate_and_send_now( $mtg ); |
|
149 | - } catch( EE_Error $e ) { |
|
150 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
147 | + $mtg = new EE_Message_Generated_From_Token($token, 'html', self::$_message_resource_manager); |
|
148 | + self::$_MSG_PROCESSOR->generate_and_send_now($mtg); |
|
149 | + } catch (EE_Error $e) { |
|
150 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
151 | 151 | // add specific message for developers if WP_DEBUG in on |
152 | - $error_msg .= '||' . $e->getMessage(); |
|
153 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
152 | + $error_msg .= '||'.$e->getMessage(); |
|
153 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -166,20 +166,20 @@ discard block |
||
166 | 166 | * @since 4.9.0 |
167 | 167 | * @param $WP |
168 | 168 | */ |
169 | - public function browser_error_trigger( $WP ) { |
|
170 | - $token = EE_Registry::instance()->REQ->get( 'token' ); |
|
171 | - if ( $token ) { |
|
172 | - $message = EEM_Message::instance()->get_one_by_token( $token ); |
|
173 | - if ( $message instanceof EE_Message ) { |
|
174 | - header( 'HTTP/1.1 200 OK' ); |
|
175 | - $error_msg = nl2br( $message->error_message() ); |
|
169 | + public function browser_error_trigger($WP) { |
|
170 | + $token = EE_Registry::instance()->REQ->get('token'); |
|
171 | + if ($token) { |
|
172 | + $message = EEM_Message::instance()->get_one_by_token($token); |
|
173 | + if ($message instanceof EE_Message) { |
|
174 | + header('HTTP/1.1 200 OK'); |
|
175 | + $error_msg = nl2br($message->error_message()); |
|
176 | 176 | ?> |
177 | 177 | <!DOCTYPE html> |
178 | 178 | <html> |
179 | 179 | <head></head> |
180 | 180 | <body> |
181 | - <?php echo empty( $error_msg ) |
|
182 | - ? esc_html__( 'Unfortunately, we were unable to capture the error message for this message.', 'event_espresso' ) |
|
181 | + <?php echo empty($error_msg) |
|
182 | + ? esc_html__('Unfortunately, we were unable to capture the error message for this message.', 'event_espresso') |
|
183 | 183 | : wp_kses( |
184 | 184 | $error_msg, |
185 | 185 | array( |
@@ -214,19 +214,19 @@ discard block |
||
214 | 214 | * @throws EE_Error |
215 | 215 | * @return void |
216 | 216 | */ |
217 | - public function run( $WP ) { |
|
217 | + public function run($WP) { |
|
218 | 218 | //ensure controller is loaded |
219 | 219 | self::_load_controller(); |
220 | 220 | // attempt to process message |
221 | 221 | try { |
222 | 222 | /** @type EE_Message_To_Generate_From_Request $message_to_generate */ |
223 | - $message_to_generate = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' ); |
|
224 | - self::$_MSG_PROCESSOR->generate_and_send_now( $message_to_generate ); |
|
225 | - } catch ( EE_Error $e ) { |
|
226 | - $error_msg = __( 'Please note that a system message failed to send due to a technical issue.', 'event_espresso' ); |
|
223 | + $message_to_generate = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request'); |
|
224 | + self::$_MSG_PROCESSOR->generate_and_send_now($message_to_generate); |
|
225 | + } catch (EE_Error $e) { |
|
226 | + $error_msg = __('Please note that a system message failed to send due to a technical issue.', 'event_espresso'); |
|
227 | 227 | // add specific message for developers if WP_DEBUG in on |
228 | - $error_msg .= '||' . $e->getMessage(); |
|
229 | - EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
228 | + $error_msg .= '||'.$e->getMessage(); |
|
229 | + EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | * This is triggered by the 'msg_cron_trigger' route. |
236 | 236 | * @param WP $WP |
237 | 237 | */ |
238 | - public function execute_batch_request( $WP ) { |
|
238 | + public function execute_batch_request($WP) { |
|
239 | 239 | $this->run_cron(); |
240 | - header( 'HTTP/1.1 200 OK' ); |
|
240 | + header('HTTP/1.1 200 OK'); |
|
241 | 241 | exit(); |
242 | 242 | } |
243 | 243 | |
@@ -251,35 +251,35 @@ discard block |
||
251 | 251 | public function run_cron() { |
252 | 252 | self::_load_controller(); |
253 | 253 | //get required vars |
254 | - $cron_type = EE_Registry::instance()->REQ->get( 'type' ); |
|
255 | - $transient_key = EE_Registry::instance()->REQ->get( 'key' ); |
|
254 | + $cron_type = EE_Registry::instance()->REQ->get('type'); |
|
255 | + $transient_key = EE_Registry::instance()->REQ->get('key'); |
|
256 | 256 | |
257 | 257 | //now let's verify transient, if not valid exit immediately |
258 | - if ( ! get_transient( $transient_key ) ) { |
|
258 | + if ( ! get_transient($transient_key)) { |
|
259 | 259 | /** |
260 | 260 | * trigger error so this gets in the error logs. This is important because it happens on a non-user request. |
261 | 261 | */ |
262 | - trigger_error( esc_attr__( 'Invalid Request (Transient does not exist)', 'event_espresso' ) ); |
|
262 | + trigger_error(esc_attr__('Invalid Request (Transient does not exist)', 'event_espresso')); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | //if made it here, lets' delete the transient to keep the db clean |
266 | - delete_transient( $transient_key ); |
|
266 | + delete_transient($transient_key); |
|
267 | 267 | |
268 | - if ( apply_filters( 'FHEE__EED_Messages__run_cron__use_wp_cron', true ) ) { |
|
268 | + if (apply_filters('FHEE__EED_Messages__run_cron__use_wp_cron', true)) { |
|
269 | 269 | |
270 | - $method = 'batch_' . $cron_type . '_from_queue'; |
|
271 | - if ( method_exists( self::$_MSG_PROCESSOR, $method ) ) { |
|
270 | + $method = 'batch_'.$cron_type.'_from_queue'; |
|
271 | + if (method_exists(self::$_MSG_PROCESSOR, $method)) { |
|
272 | 272 | self::$_MSG_PROCESSOR->$method(); |
273 | 273 | } else { |
274 | 274 | //no matching task |
275 | 275 | /** |
276 | 276 | * trigger error so this gets in the error logs. This is important because it happens on a non user request. |
277 | 277 | */ |
278 | - trigger_error( esc_attr( sprintf( __( 'There is no task corresponding to this route %s', 'event_espresso' ), $cron_type ) ) ); |
|
278 | + trigger_error(esc_attr(sprintf(__('There is no task corresponding to this route %s', 'event_espresso'), $cron_type))); |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | - do_action( 'FHEE__EED_Messages__run_cron__end' ); |
|
282 | + do_action('FHEE__EED_Messages__run_cron__end'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @return EE_Messages_Template_Pack |
297 | 297 | */ |
298 | - public static function get_template_pack( $template_pack_name ) { |
|
299 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
300 | - return EEH_MSG_Template::get_template_pack( $template_pack_name ); |
|
298 | + public static function get_template_pack($template_pack_name) { |
|
299 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
300 | + return EEH_MSG_Template::get_template_pack($template_pack_name); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | * @return EE_Messages_Template_Pack[] |
312 | 312 | */ |
313 | 313 | public static function get_template_packs() { |
314 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
314 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
315 | 315 | |
316 | 316 | //for backward compat, let's make sure this returns in the same format as originally. |
317 | 317 | $template_pack_collection = EEH_MSG_Template::get_template_pack_collection(); |
318 | 318 | $template_pack_collection->rewind(); |
319 | 319 | $template_packs = array(); |
320 | - while ( $template_pack_collection->valid() ) { |
|
321 | - $template_packs[ $template_pack_collection->current()->dbref ] = $template_pack_collection->current(); |
|
320 | + while ($template_pack_collection->valid()) { |
|
321 | + $template_packs[$template_pack_collection->current()->dbref] = $template_pack_collection->current(); |
|
322 | 322 | $template_pack_collection->next(); |
323 | 323 | } |
324 | 324 | return $template_packs; |
@@ -334,14 +334,14 @@ discard block |
||
334 | 334 | * @return void |
335 | 335 | */ |
336 | 336 | public static function set_autoloaders() { |
337 | - if ( empty( self::$_MSG_PATHS ) ) { |
|
337 | + if (empty(self::$_MSG_PATHS)) { |
|
338 | 338 | self::_set_messages_paths(); |
339 | - foreach ( self::$_MSG_PATHS as $path ) { |
|
340 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $path ); |
|
339 | + foreach (self::$_MSG_PATHS as $path) { |
|
340 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($path); |
|
341 | 341 | } |
342 | 342 | // add aliases |
343 | - EEH_Autoloader::add_alias( 'EE_messages', 'EE_messages' ); |
|
344 | - EEH_Autoloader::add_alias( 'EE_messenger', 'EE_messenger' ); |
|
343 | + EEH_Autoloader::add_alias('EE_messages', 'EE_messages'); |
|
344 | + EEH_Autoloader::add_alias('EE_messenger', 'EE_messenger'); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -369,10 +369,10 @@ discard block |
||
369 | 369 | 'shortcodes', |
370 | 370 | ); |
371 | 371 | $paths = array(); |
372 | - foreach ( $dir_ref as $index => $dir ) { |
|
373 | - $paths[ $index ] = EE_LIBRARIES . $dir; |
|
372 | + foreach ($dir_ref as $index => $dir) { |
|
373 | + $paths[$index] = EE_LIBRARIES.$dir; |
|
374 | 374 | } |
375 | - self::$_MSG_PATHS = apply_filters( 'FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths ); |
|
375 | + self::$_MSG_PATHS = apply_filters('FHEE__EED_Messages___set_messages_paths___MSG_PATHS', $paths); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -383,12 +383,12 @@ discard block |
||
383 | 383 | * @return void |
384 | 384 | */ |
385 | 385 | protected static function _load_controller() { |
386 | - if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor ) { |
|
387 | - EE_Registry::instance()->load_core( 'Request_Handler' ); |
|
386 | + if ( ! self::$_MSG_PROCESSOR instanceof EE_Messages_Processor) { |
|
387 | + EE_Registry::instance()->load_core('Request_Handler'); |
|
388 | 388 | self::set_autoloaders(); |
389 | - self::$_EEMSG = EE_Registry::instance()->load_lib( 'messages' ); |
|
390 | - self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib( 'Messages_Processor' ); |
|
391 | - self::$_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
389 | + self::$_EEMSG = EE_Registry::instance()->load_lib('messages'); |
|
390 | + self::$_MSG_PROCESSOR = EE_Registry::instance()->load_lib('Messages_Processor'); |
|
391 | + self::$_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
@@ -397,10 +397,10 @@ discard block |
||
397 | 397 | /** |
398 | 398 | * @param EE_Transaction $transaction |
399 | 399 | */ |
400 | - public static function payment_reminder( EE_Transaction $transaction ) { |
|
400 | + public static function payment_reminder(EE_Transaction $transaction) { |
|
401 | 401 | self::_load_controller(); |
402 | - $data = array( $transaction, null ); |
|
403 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'payment_reminder', $data ); |
|
402 | + $data = array($transaction, null); |
|
403 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('payment_reminder', $data); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,14 +411,14 @@ discard block |
||
411 | 411 | * @param EE_Payment object |
412 | 412 | * @return void |
413 | 413 | */ |
414 | - public static function payment( EE_Transaction $transaction, EE_Payment $payment ) { |
|
414 | + public static function payment(EE_Transaction $transaction, EE_Payment $payment) { |
|
415 | 415 | self::_load_controller(); |
416 | - $data = array( $transaction, $payment ); |
|
417 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
418 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
416 | + $data = array($transaction, $payment); |
|
417 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
418 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
419 | 419 | //if payment amount is less than 0 then switch to payment_refund message type. |
420 | 420 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
421 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
421 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | /** |
427 | 427 | * @param EE_Transaction $transaction |
428 | 428 | */ |
429 | - public static function cancelled_registration( EE_Transaction $transaction ) { |
|
429 | + public static function cancelled_registration(EE_Transaction $transaction) { |
|
430 | 430 | self::_load_controller(); |
431 | - $data = array( $transaction, null ); |
|
432 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'cancelled_registration', $data ); |
|
431 | + $data = array($transaction, null); |
|
432 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('cancelled_registration', $data); |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | |
@@ -442,9 +442,9 @@ discard block |
||
442 | 442 | * @param array $extra_details |
443 | 443 | * @return void |
444 | 444 | */ |
445 | - public static function maybe_registration( EE_Registration $registration, $extra_details = array() ) { |
|
445 | + public static function maybe_registration(EE_Registration $registration, $extra_details = array()) { |
|
446 | 446 | |
447 | - if ( ! self::_verify_registration_notification_send( $registration, $extra_details ) ) { |
|
447 | + if ( ! self::_verify_registration_notification_send($registration, $extra_details)) { |
|
448 | 448 | //no messages please |
449 | 449 | return; |
450 | 450 | } |
@@ -459,22 +459,22 @@ discard block |
||
459 | 459 | $mtgs = array(); |
460 | 460 | |
461 | 461 | //loop through registrations and trigger messages once per status. |
462 | - foreach ( $all_registrations as $reg ) { |
|
462 | + foreach ($all_registrations as $reg) { |
|
463 | 463 | |
464 | 464 | //already triggered? |
465 | - if ( in_array( $reg->status_ID(), $statuses_sent ) ) { |
|
465 | + if (in_array($reg->status_ID(), $statuses_sent)) { |
|
466 | 466 | continue; |
467 | 467 | } |
468 | 468 | |
469 | - $message_type = EEH_MSG_Template::convert_reg_status_to_message_type( $reg->status_ID() ); |
|
470 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( $message_type, array( $registration->transaction(), null, $reg->status_ID() ) ); |
|
469 | + $message_type = EEH_MSG_Template::convert_reg_status_to_message_type($reg->status_ID()); |
|
470 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers($message_type, array($registration->transaction(), null, $reg->status_ID())); |
|
471 | 471 | $statuses_sent[] = $reg->status_ID(); |
472 | 472 | } |
473 | 473 | |
474 | - $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers( 'registration_summary', array( $registration->transaction(), null ) ); |
|
474 | + $mtgs = $mtgs + self::$_MSG_PROCESSOR->setup_mtgs_for_all_active_messengers('registration_summary', array($registration->transaction(), null)); |
|
475 | 475 | |
476 | 476 | //batch queue and initiate request |
477 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $mtgs ); |
|
477 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($mtgs); |
|
478 | 478 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
479 | 479 | } |
480 | 480 | |
@@ -489,39 +489,39 @@ discard block |
||
489 | 489 | * |
490 | 490 | * @return bool true = send away, false = nope halt the presses. |
491 | 491 | */ |
492 | - protected static function _verify_registration_notification_send( EE_Registration $registration, $extra_details = array() ) { |
|
492 | + protected static function _verify_registration_notification_send(EE_Registration $registration, $extra_details = array()) { |
|
493 | 493 | //self::log( |
494 | 494 | // __CLASS__, __FUNCTION__, __LINE__, |
495 | 495 | // $registration->transaction(), |
496 | 496 | // array( '$extra_details' => $extra_details ) |
497 | 497 | //); |
498 | 498 | // currently only using this to send messages for the primary registrant |
499 | - if ( ! $registration->is_primary_registrant() ) { |
|
499 | + if ( ! $registration->is_primary_registrant()) { |
|
500 | 500 | return false; |
501 | 501 | } |
502 | 502 | // first we check if we're in admin and not doing front ajax |
503 | - if ( is_admin() && ! EE_FRONT_AJAX ) { |
|
503 | + if (is_admin() && ! EE_FRONT_AJAX) { |
|
504 | 504 | //make sure appropriate admin params are set for sending messages |
505 | - if ( empty( $_REQUEST['txn_reg_status_change']['send_notifications'] ) || ! absint( $_REQUEST['txn_reg_status_change']['send_notifications'] ) ) { |
|
505 | + if (empty($_REQUEST['txn_reg_status_change']['send_notifications']) || ! absint($_REQUEST['txn_reg_status_change']['send_notifications'])) { |
|
506 | 506 | //no messages sent please. |
507 | 507 | return false; |
508 | 508 | } |
509 | 509 | } else { |
510 | 510 | // frontend request (either regular or via AJAX) |
511 | 511 | // TXN is NOT finalized ? |
512 | - if ( ! isset( $extra_details['finalized'] ) || $extra_details['finalized'] === false ) { |
|
512 | + if ( ! isset($extra_details['finalized']) || $extra_details['finalized'] === false) { |
|
513 | 513 | return false; |
514 | 514 | } |
515 | 515 | // return visit but nothing changed ??? |
516 | 516 | if ( |
517 | - isset( $extra_details['revisit'], $extra_details['status_updates'] ) && |
|
517 | + isset($extra_details['revisit'], $extra_details['status_updates']) && |
|
518 | 518 | $extra_details['revisit'] && ! $extra_details['status_updates'] |
519 | 519 | ) { |
520 | 520 | return false; |
521 | 521 | } |
522 | 522 | // NOT sending messages && reg status is something other than "Not-Approved" |
523 | 523 | if ( |
524 | - ! apply_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', false ) && |
|
524 | + ! apply_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications', false) && |
|
525 | 525 | $registration->status_ID() !== EEM_Registration::status_id_not_approved |
526 | 526 | ) { |
527 | 527 | return false; |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | * |
544 | 544 | * @return array |
545 | 545 | */ |
546 | - protected static function _get_reg_status_array( $reg_status = '' ) { |
|
547 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
548 | - return EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
549 | - ? EEH_MSG_Template::convert_reg_status_to_message_type( $reg_status ) |
|
546 | + protected static function _get_reg_status_array($reg_status = '') { |
|
547 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
548 | + return EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
549 | + ? EEH_MSG_Template::convert_reg_status_to_message_type($reg_status) |
|
550 | 550 | : EEH_MSG_Template::reg_status_to_message_type_array(); |
551 | 551 | } |
552 | 552 | |
@@ -562,10 +562,10 @@ discard block |
||
562 | 562 | * |
563 | 563 | * @return string|bool The payment message type slug matching the status or false if no match. |
564 | 564 | */ |
565 | - protected static function _get_payment_message_type( $payment_status ) { |
|
566 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
567 | - return EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
568 | - ? EEH_MSG_Template::convert_payment_status_to_message_type( $payment_status ) |
|
565 | + protected static function _get_payment_message_type($payment_status) { |
|
566 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
567 | + return EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
568 | + ? EEH_MSG_Template::convert_payment_status_to_message_type($payment_status) |
|
569 | 569 | : false; |
570 | 570 | } |
571 | 571 | |
@@ -579,33 +579,33 @@ discard block |
||
579 | 579 | * @param array $req_data This is the $_POST & $_GET data sent from EE_Admin Pages |
580 | 580 | * @return bool success/fail |
581 | 581 | */ |
582 | - public static function process_resend( $req_data ) { |
|
582 | + public static function process_resend($req_data) { |
|
583 | 583 | self::_load_controller(); |
584 | 584 | |
585 | 585 | //if $msgID in this request then skip to the new resend_message |
586 | - if ( EE_Registry::instance()->REQ->get( 'MSG_ID' ) ) { |
|
586 | + if (EE_Registry::instance()->REQ->get('MSG_ID')) { |
|
587 | 587 | return self::resend_message(); |
588 | 588 | } |
589 | 589 | |
590 | 590 | //make sure any incoming request data is set on the REQ so that it gets picked up later. |
591 | 591 | $req_data = (array) $req_data; |
592 | - foreach( $req_data as $request_key => $request_value ) { |
|
593 | - EE_Registry::instance()->REQ->set( $request_key, $request_value ); |
|
592 | + foreach ($req_data as $request_key => $request_value) { |
|
593 | + EE_Registry::instance()->REQ->set($request_key, $request_value); |
|
594 | 594 | } |
595 | 595 | |
596 | - if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request() ) { |
|
596 | + if ( ! $messages_to_send = self::$_MSG_PROCESSOR->setup_messages_to_generate_from_registration_ids_in_request()) { |
|
597 | 597 | return false; |
598 | 598 | } |
599 | 599 | |
600 | 600 | try { |
601 | - self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist( $messages_to_send ); |
|
601 | + self::$_MSG_PROCESSOR->batch_queue_for_generation_and_persist($messages_to_send); |
|
602 | 602 | self::$_MSG_PROCESSOR->get_queue()->initiate_request_by_priority(); |
603 | - } catch( EE_Error $e ) { |
|
604 | - EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ ); |
|
603 | + } catch (EE_Error $e) { |
|
604 | + EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__); |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | EE_Error::add_success( |
608 | - __( 'Messages have been successfully queued for generation and sending.', 'event_espresso' ) |
|
608 | + __('Messages have been successfully queued for generation and sending.', 'event_espresso') |
|
609 | 609 | ); |
610 | 610 | return true; //everything got queued. |
611 | 611 | } |
@@ -618,17 +618,17 @@ discard block |
||
618 | 618 | public static function resend_message() { |
619 | 619 | self::_load_controller(); |
620 | 620 | |
621 | - $msgID = EE_Registry::instance()->REQ->get( 'MSG_ID' ); |
|
622 | - if ( ! $msgID ) { |
|
623 | - EE_Error::add_error( __( 'Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
621 | + $msgID = EE_Registry::instance()->REQ->get('MSG_ID'); |
|
622 | + if ( ! $msgID) { |
|
623 | + EE_Error::add_error(__('Something went wrong because there is no "MSG_ID" value in the request', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
624 | 624 | return false; |
625 | 625 | } |
626 | 626 | |
627 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( (array) $msgID ); |
|
627 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send((array) $msgID); |
|
628 | 628 | |
629 | 629 | //setup success message. |
630 | - $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
631 | - EE_Error::add_success( sprintf( |
|
630 | + $count_ready_for_resend = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
631 | + EE_Error::add_success(sprintf( |
|
632 | 632 | _n( |
633 | 633 | 'There was %d message queued for resending.', |
634 | 634 | 'There were %d messages queued for resending.', |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | 'event_espresso' |
637 | 637 | ), |
638 | 638 | $count_ready_for_resend |
639 | - ) ); |
|
639 | + )); |
|
640 | 640 | return true; |
641 | 641 | } |
642 | 642 | |
@@ -649,13 +649,13 @@ discard block |
||
649 | 649 | * @param EE_Payment $payment EE_payment object |
650 | 650 | * @return bool success/fail |
651 | 651 | */ |
652 | - public static function process_admin_payment( EE_Payment $payment ) { |
|
653 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
652 | + public static function process_admin_payment(EE_Payment $payment) { |
|
653 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
654 | 654 | //we need to get the transaction object |
655 | 655 | $transaction = $payment->transaction(); |
656 | - if ( $transaction instanceof EE_Transaction ) { |
|
657 | - $data = array( $transaction, $payment ); |
|
658 | - $message_type = EEH_MSG_Template::convert_payment_status_to_message_type( $payment->STS_ID() ); |
|
656 | + if ($transaction instanceof EE_Transaction) { |
|
657 | + $data = array($transaction, $payment); |
|
658 | + $message_type = EEH_MSG_Template::convert_payment_status_to_message_type($payment->STS_ID()); |
|
659 | 659 | |
660 | 660 | //if payment amount is less than 0 then switch to payment_refund message type. |
661 | 661 | $message_type = $payment->amount() < 0 ? 'payment_refund' : $message_type; |
@@ -665,22 +665,22 @@ discard block |
||
665 | 665 | |
666 | 666 | self::_load_controller(); |
667 | 667 | |
668 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( $message_type, $data ); |
|
668 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers($message_type, $data); |
|
669 | 669 | |
670 | 670 | //get count of queued for generation |
671 | - $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( array( EEM_Message::status_incomplete, EEM_Message::status_idle ) ); |
|
671 | + $count_to_generate = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(array(EEM_Message::status_incomplete, EEM_Message::status_idle)); |
|
672 | 672 | |
673 | - if ( $count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0 ) { |
|
674 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
673 | + if ($count_to_generate > 0 && self::$_MSG_PROCESSOR->get_queue()->get_message_repository()->count() !== 0) { |
|
674 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
675 | 675 | return true; |
676 | 676 | } else { |
677 | - $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::instance()->stati_indicating_failed_sending() ); |
|
677 | + $count_failed = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::instance()->stati_indicating_failed_sending()); |
|
678 | 678 | /** |
679 | 679 | * Verify that there are actually errors. If not then we return a success message because the queue might have been emptied due to successful |
680 | 680 | * IMMEDIATE generation. |
681 | 681 | */ |
682 | - if ( $count_failed > 0 ) { |
|
683 | - EE_Error::add_error( sprintf( |
|
682 | + if ($count_failed > 0) { |
|
683 | + EE_Error::add_error(sprintf( |
|
684 | 684 | _n( |
685 | 685 | 'The payment notification generation failed.', |
686 | 686 | '%d payment notifications failed being sent.', |
@@ -688,11 +688,11 @@ discard block |
||
688 | 688 | 'event_espresso' |
689 | 689 | ), |
690 | 690 | $count_failed |
691 | - ), __FILE__, __FUNCTION__, __LINE__ ); |
|
691 | + ), __FILE__, __FUNCTION__, __LINE__); |
|
692 | 692 | |
693 | 693 | return false; |
694 | 694 | } else { |
695 | - add_filter( 'FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true' ); |
|
695 | + add_filter('FHEE__EE_Admin_Page___process_admin_payment_notification__success', '__return_true'); |
|
696 | 696 | return true; |
697 | 697 | } |
698 | 698 | } |
@@ -716,11 +716,11 @@ discard block |
||
716 | 716 | * @param int $grp_id a specific message template group id. |
717 | 717 | * @return void |
718 | 718 | */ |
719 | - public static function send_newsletter_message( $registrations, $grp_id ) { |
|
719 | + public static function send_newsletter_message($registrations, $grp_id) { |
|
720 | 720 | //make sure mtp is id and set it in the EE_Request Handler later messages setup. |
721 | - EE_Registry::instance()->REQ->set( 'GRP_ID', (int) $grp_id ); |
|
721 | + EE_Registry::instance()->REQ->set('GRP_ID', (int) $grp_id); |
|
722 | 722 | self::_load_controller(); |
723 | - self::$_MSG_PROCESSOR->generate_for_all_active_messengers( 'newsletter', $registrations ); |
|
723 | + self::$_MSG_PROCESSOR->generate_for_all_active_messengers('newsletter', $registrations); |
|
724 | 724 | } |
725 | 725 | |
726 | 726 | |
@@ -735,9 +735,9 @@ discard block |
||
735 | 735 | * @param string $message_type |
736 | 736 | * @return string |
737 | 737 | */ |
738 | - public static function registration_message_trigger_url( $registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice' ) { |
|
738 | + public static function registration_message_trigger_url($registration_message_trigger_url, EE_Registration $registration, $messenger = 'html', $message_type = 'invoice') { |
|
739 | 739 | // whitelist $messenger |
740 | - switch ( $messenger ) { |
|
740 | + switch ($messenger) { |
|
741 | 741 | case 'pdf' : |
742 | 742 | $sending_messenger = 'pdf'; |
743 | 743 | $generating_messenger = 'html'; |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | break; |
750 | 750 | } |
751 | 751 | // whitelist $message_type |
752 | - switch ( $message_type ) { |
|
752 | + switch ($message_type) { |
|
753 | 753 | case 'receipt' : |
754 | 754 | $message_type = 'receipt'; |
755 | 755 | break; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | break; |
760 | 760 | } |
761 | 761 | // verify that both the messenger AND the message type are active |
762 | - if ( EEH_MSG_Template::is_messenger_active( $sending_messenger ) && EEH_MSG_Template::is_mt_active( $message_type ) ) { |
|
762 | + if (EEH_MSG_Template::is_messenger_active($sending_messenger) && EEH_MSG_Template::is_mt_active($message_type)) { |
|
763 | 763 | //need to get the correct message template group for this (i.e. is there a custom invoice for the event this registration is registered for?) |
764 | 764 | $template_query_params = array( |
765 | 765 | 'MTP_is_active' => true, |
@@ -768,16 +768,16 @@ discard block |
||
768 | 768 | 'Event.EVT_ID' => $registration->event_ID() |
769 | 769 | ); |
770 | 770 | //get the message template group. |
771 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
771 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
772 | 772 | //if we don't have an EE_Message_Template_Group then return |
773 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
773 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
774 | 774 | // remove EVT_ID from query params so that global templates get picked up |
775 | - unset( $template_query_params['Event.EVT_ID'] ); |
|
775 | + unset($template_query_params['Event.EVT_ID']); |
|
776 | 776 | //get global template as the fallback |
777 | - $msg_template_group = EEM_Message_Template_Group::instance()->get_one( array( $template_query_params ) ); |
|
777 | + $msg_template_group = EEM_Message_Template_Group::instance()->get_one(array($template_query_params)); |
|
778 | 778 | } |
779 | 779 | //if we don't have an EE_Message_Template_Group then return |
780 | - if ( ! $msg_template_group instanceof EE_Message_Template_Group ) { |
|
780 | + if ( ! $msg_template_group instanceof EE_Message_Template_Group) { |
|
781 | 781 | return ''; |
782 | 782 | } |
783 | 783 | // generate the URL |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @param bool $send true we will do a test send using the messenger delivery, false we just do a regular preview |
807 | 807 | * @return string|bool The body of the message or if send is requested, sends. |
808 | 808 | */ |
809 | - public static function preview_message( $type, $context, $messenger, $send = false ) { |
|
809 | + public static function preview_message($type, $context, $messenger, $send = false) { |
|
810 | 810 | self::_load_controller(); |
811 | 811 | $mtg = new EE_Message_To_Generate( |
812 | 812 | $messenger, |
@@ -815,8 +815,8 @@ discard block |
||
815 | 815 | $context, |
816 | 816 | true |
817 | 817 | ); |
818 | - $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview( $mtg, $send ); |
|
819 | - if ( $generated_preview_queue instanceof EE_Messages_Queue ) { |
|
818 | + $generated_preview_queue = self::$_MSG_PROCESSOR->generate_for_preview($mtg, $send); |
|
819 | + if ($generated_preview_queue instanceof EE_Messages_Queue) { |
|
820 | 820 | return $generated_preview_queue->get_message_repository()->current()->content(); |
821 | 821 | } else { |
822 | 822 | return $generated_preview_queue; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | * |
844 | 844 | * @return bool success or fail. |
845 | 845 | */ |
846 | - public static function send_message_with_messenger_only( $messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '' ) { |
|
846 | + public static function send_message_with_messenger_only($messenger, $message_type, EE_Messages_Queue $queue, $custom_subject = '') { |
|
847 | 847 | self::_load_controller(); |
848 | 848 | /** @type EE_Message_To_Generate_From_Queue $message_to_generate */ |
849 | 849 | $message_to_generate = EE_Registry::instance()->load_lib( |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $custom_subject, |
856 | 856 | ) |
857 | 857 | ); |
858 | - return self::$_MSG_PROCESSOR->queue_for_sending( $message_to_generate ); |
|
858 | + return self::$_MSG_PROCESSOR->queue_for_sending($message_to_generate); |
|
859 | 859 | } |
860 | 860 | |
861 | 861 | |
@@ -868,24 +868,24 @@ discard block |
||
868 | 868 | * @param array $message_ids An array of message ids |
869 | 869 | * @return bool | EE_Messages_Queue false if nothing was generated, EE_Messages_Queue containing generated messages. |
870 | 870 | */ |
871 | - public static function generate_now( $message_ids ) { |
|
871 | + public static function generate_now($message_ids) { |
|
872 | 872 | self::_load_controller(); |
873 | 873 | $messages = EEM_Message::instance()->get_all( |
874 | 874 | array( |
875 | 875 | 0 => array( |
876 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
876 | + 'MSG_ID' => array('IN', $message_ids), |
|
877 | 877 | 'STS_ID' => EEM_Message::status_incomplete, |
878 | 878 | ) |
879 | 879 | ) |
880 | 880 | ); |
881 | 881 | $generated_queue = false; |
882 | - if ( $messages ) { |
|
883 | - $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue( $messages ); |
|
882 | + if ($messages) { |
|
883 | + $generated_queue = self::$_MSG_PROCESSOR->batch_generate_from_queue($messages); |
|
884 | 884 | } |
885 | 885 | |
886 | - if ( ! $generated_queue instanceof EE_Messages_Queue ) { |
|
886 | + if ( ! $generated_queue instanceof EE_Messages_Queue) { |
|
887 | 887 | EE_Error::add_error( |
888 | - __( 'The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso' ), |
|
888 | + __('The messages were not generated. This could mean there is already a batch being generated on a separate request, or because the selected messages are not ready for generation. Please wait a minute or two and try again.', 'event_espresso'), |
|
889 | 889 | __FILE__, __FUNCTION__, __LINE__ |
890 | 890 | ); |
891 | 891 | } |
@@ -904,30 +904,30 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return bool | EE_Messages_Queue false if no messages sent. |
906 | 906 | */ |
907 | - public static function send_now( $message_ids ) { |
|
907 | + public static function send_now($message_ids) { |
|
908 | 908 | self::_load_controller(); |
909 | 909 | $messages = EEM_Message::instance()->get_all( |
910 | 910 | array( |
911 | 911 | 0 => array( |
912 | - 'MSG_ID' => array( 'IN', $message_ids ), |
|
913 | - 'STS_ID' => array( 'IN', array( EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry ) ) |
|
912 | + 'MSG_ID' => array('IN', $message_ids), |
|
913 | + 'STS_ID' => array('IN', array(EEM_Message::status_idle, EEM_Message::status_resend, EEM_Message::status_retry)) |
|
914 | 914 | ) |
915 | 915 | ) |
916 | 916 | ); |
917 | 917 | $sent_queue = false; |
918 | - if ( $messages ) { |
|
919 | - $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue( $messages ); |
|
918 | + if ($messages) { |
|
919 | + $sent_queue = self::$_MSG_PROCESSOR->batch_send_from_queue($messages); |
|
920 | 920 | } |
921 | 921 | |
922 | - if ( ! $sent_queue instanceof EE_Messages_Queue ) { |
|
922 | + if ( ! $sent_queue instanceof EE_Messages_Queue) { |
|
923 | 923 | EE_Error::add_error( |
924 | - __( 'The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso' ), |
|
924 | + __('The messages were not sent. This could mean there is already a batch being sent on a separate request, or because the selected messages are not sendable. Please wait a minute or two and try again.', 'event_espresso'), |
|
925 | 925 | __FILE__, __FUNCTION__, __LINE__ |
926 | 926 | ); |
927 | 927 | } else { |
928 | 928 | //can count how many sent by using the messages in the queue |
929 | - $sent_count = $sent_queue->count_STS_in_queue( EEM_Message::instance()->stati_indicating_sent() ); |
|
930 | - if ( $sent_count > 0 ) { |
|
929 | + $sent_count = $sent_queue->count_STS_in_queue(EEM_Message::instance()->stati_indicating_sent()); |
|
930 | + if ($sent_count > 0) { |
|
931 | 931 | EE_Error::add_success( |
932 | 932 | sprintf( |
933 | 933 | _n( |
@@ -942,8 +942,8 @@ discard block |
||
942 | 942 | } else { |
943 | 943 | EE_Error::overwrite_errors(); |
944 | 944 | EE_Error::add_error( |
945 | - __( 'No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
946 | - If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso' ), |
|
945 | + __('No message was sent because of problems with sending. Either all the messages you selected were not a sendable message, they were ALREADY sent on a different scheduled task, or there was an error. |
|
946 | + If there was an error, you can look at the messages in the message activity list table for any error messages.', 'event_espresso'), |
|
947 | 947 | __FILE__, __FUNCTION__, __LINE__ |
948 | 948 | ); |
949 | 949 | } |
@@ -964,12 +964,12 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return bool true means messages were successfully queued for resending, false means none were queued for resending. |
966 | 966 | */ |
967 | - public static function queue_for_resending( $message_ids ) { |
|
967 | + public static function queue_for_resending($message_ids) { |
|
968 | 968 | self::_load_controller(); |
969 | - self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send( $message_ids ); |
|
969 | + self::$_MSG_PROCESSOR->setup_messages_from_ids_and_send($message_ids); |
|
970 | 970 | |
971 | 971 | //get queue and count |
972 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_resend ); |
|
972 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_resend); |
|
973 | 973 | |
974 | 974 | if ( |
975 | 975 | $queue_count > 0 |
@@ -989,11 +989,11 @@ discard block |
||
989 | 989 | * @see filter usage in EE_Messages_Queue::initiate_request_by_priority |
990 | 990 | */ |
991 | 991 | } elseif ( |
992 | - apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true ) |
|
992 | + apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', true) |
|
993 | 993 | || EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request |
994 | 994 | ) { |
995 | - $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue( EEM_Message::status_sent ); |
|
996 | - if ( $queue_count > 0 ) { |
|
995 | + $queue_count = self::$_MSG_PROCESSOR->get_queue()->count_STS_in_queue(EEM_Message::status_sent); |
|
996 | + if ($queue_count > 0) { |
|
997 | 997 | EE_Error::add_success( |
998 | 998 | sprintf( |
999 | 999 | _n( |
@@ -1007,13 +1007,13 @@ discard block |
||
1007 | 1007 | ); |
1008 | 1008 | } else { |
1009 | 1009 | EE_Error::add_error( |
1010 | - __( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ), |
|
1010 | + __('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'), |
|
1011 | 1011 | __FILE__, __FUNCTION__, __LINE__ |
1012 | 1012 | ); |
1013 | 1013 | } |
1014 | 1014 | } else { |
1015 | 1015 | EE_Error::add_error( |
1016 | - __( 'No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso' ), |
|
1016 | + __('No messages were queued for resending. This usually only happens when all the messages flagged for resending are not a status that can be resent.', 'event_espresso'), |
|
1017 | 1017 | __FILE__, __FUNCTION__, __LINE__ |
1018 | 1018 | ); |
1019 | 1019 | } |
@@ -1035,16 +1035,16 @@ discard block |
||
1035 | 1035 | * @param array $info |
1036 | 1036 | * @param bool $display_request |
1037 | 1037 | */ |
1038 | - protected static function log( $class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false ) { |
|
1039 | - if ( WP_DEBUG && false ) { |
|
1040 | - if ( $transaction instanceof EE_Transaction ) { |
|
1038 | + protected static function log($class = '', $func = '', $line = '', EE_Transaction $transaction, $info = array(), $display_request = false) { |
|
1039 | + if (WP_DEBUG && false) { |
|
1040 | + if ($transaction instanceof EE_Transaction) { |
|
1041 | 1041 | // don't serialize objects |
1042 | - $info = EEH_Debug_Tools::strip_objects( $info ); |
|
1042 | + $info = EEH_Debug_Tools::strip_objects($info); |
|
1043 | 1043 | $info['TXN_status'] = $transaction->status_ID(); |
1044 | 1044 | $info['TXN_reg_steps'] = $transaction->reg_steps(); |
1045 | - if ( $transaction->ID() ) { |
|
1046 | - $index = 'EE_Transaction: ' . $transaction->ID(); |
|
1047 | - EEH_Debug_Tools::log( $class, $func, $line, $info, $display_request, $index ); |
|
1045 | + if ($transaction->ID()) { |
|
1046 | + $index = 'EE_Transaction: '.$transaction->ID(); |
|
1047 | + EEH_Debug_Tools::log($class, $func, $line, $info, $display_request, $index); |
|
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -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 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @subpackage /core/db_models/fields/EE_Model_Field_Base.php |
19 | 19 | * @author Michael Nelson |
20 | 20 | */ |
21 | -abstract class EE_Model_Field_Base{ |
|
21 | +abstract class EE_Model_Field_Base { |
|
22 | 22 | var $_table_alias; |
23 | 23 | var $_table_column; |
24 | 24 | var $_name; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param $nullable |
35 | 35 | * @param null $default_value |
36 | 36 | */ |
37 | - function __construct($table_column, $nicename, $nullable, $default_value = null){ |
|
37 | + function __construct($table_column, $nicename, $nullable, $default_value = null) { |
|
38 | 38 | $this->_table_column = $table_column; |
39 | 39 | $this->_nicename = $nicename; |
40 | 40 | $this->_nullable = $nullable; |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | * @param $name |
49 | 49 | * @param $model_name |
50 | 50 | */ |
51 | - function _construct_finalize($table_alias, $name, $model_name){ |
|
51 | + function _construct_finalize($table_alias, $name, $model_name) { |
|
52 | 52 | $this->_table_alias = $table_alias; |
53 | 53 | $this->_name = $name; |
54 | 54 | $this->_model_name = $model_name; |
55 | 55 | /** |
56 | 56 | * allow for changing the defaults |
57 | 57 | */ |
58 | - $this->_nicename = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this ); |
|
59 | - $this->_default_value = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this ); |
|
58 | + $this->_nicename = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this); |
|
59 | + $this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this); |
|
60 | 60 | } |
61 | - function get_table_alias(){ |
|
61 | + function get_table_alias() { |
|
62 | 62 | return $this->_table_alias; |
63 | 63 | } |
64 | - function get_table_column(){ |
|
64 | + function get_table_column() { |
|
65 | 65 | return $this->_table_column; |
66 | 66 | } |
67 | 67 | /** |
68 | 68 | * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime' |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - function get_model_name(){ |
|
71 | + function get_model_name() { |
|
72 | 72 | return $this->_model_name; |
73 | 73 | } |
74 | 74 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | * @throws \EE_Error |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - function get_name(){ |
|
80 | - if($this->_name){ |
|
79 | + function get_name() { |
|
80 | + if ($this->_name) { |
|
81 | 81 | return $this->_name; |
82 | - }else{ |
|
83 | - throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"),get_class($this))); |
|
82 | + } else { |
|
83 | + throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"), get_class($this))); |
|
84 | 84 | } |
85 | 85 | } |
86 | - function get_nicename(){ |
|
86 | + function get_nicename() { |
|
87 | 87 | return $this->_nicename; |
88 | 88 | } |
89 | - function is_nullable(){ |
|
89 | + function is_nullable() { |
|
90 | 90 | return $this->_nullable; |
91 | 91 | } |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * on insertion it can be null. However, on updates it must be present. |
95 | 95 | * @return boolean |
96 | 96 | */ |
97 | - function is_auto_increment(){ |
|
97 | + function is_auto_increment() { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * value domains at the top of EEM_Base |
103 | 103 | * @return mixed |
104 | 104 | */ |
105 | - function get_default_value(){ |
|
105 | + function get_default_value() { |
|
106 | 106 | return $this->_default_value; |
107 | 107 | } |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * in the current query |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - function get_qualified_column(){ |
|
116 | + function get_qualified_column() { |
|
117 | 117 | return $this->get_table_alias().".".$this->get_table_column(); |
118 | 118 | } |
119 | 119 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param mixed $value_of_field_on_model_object |
125 | 125 | * @return mixed |
126 | 126 | */ |
127 | - function prepare_for_get($value_of_field_on_model_object){ |
|
127 | + function prepare_for_get($value_of_field_on_model_object) { |
|
128 | 128 | return $value_of_field_on_model_object; |
129 | 129 | } |
130 | 130 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param mixed $value_of_field_on_model_object |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - function prepare_for_use_in_db($value_of_field_on_model_object){ |
|
137 | + function prepare_for_use_in_db($value_of_field_on_model_object) { |
|
138 | 138 | return $value_of_field_on_model_object; |
139 | 139 | } |
140 | 140 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param mixed $value_inputted_for_field_on_model_object |
146 | 146 | * @return mixed |
147 | 147 | */ |
148 | - function prepare_for_set($value_inputted_for_field_on_model_object){ |
|
148 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
149 | 149 | return $value_inputted_for_field_on_model_object; |
150 | 150 | } |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param mixed $value_found_in_db_for_model_object |
157 | 157 | * @return mixed |
158 | 158 | */ |
159 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
159 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
160 | 160 | return $this->prepare_for_set($value_found_in_db_for_model_object); |
161 | 161 | } |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param mixed $value_on_field_to_be_outputted |
168 | 168 | * @return mixed |
169 | 169 | */ |
170 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){ |
|
170 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted) { |
|
171 | 171 | return $value_on_field_to_be_outputted; |
172 | 172 | } |
173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * By default, all fields aren't db-only. |
183 | 183 | * @return boolean |
184 | 184 | */ |
185 | - function is_db_only_field(){ |
|
185 | + function is_db_only_field() { |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -15,18 +15,18 @@ discard block |
||
15 | 15 | * @author Mike Nelson |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_Phone_Input extends EE_Text_Input{ |
|
18 | +class EE_Phone_Input extends EE_Text_Input { |
|
19 | 19 | /** |
20 | 20 | * @param array $options |
21 | 21 | */ |
22 | - function __construct($options = array()){ |
|
22 | + function __construct($options = array()) { |
|
23 | 23 | $this->_add_validation_strategy( |
24 | 24 | new EE_Text_Validation_Strategy( |
25 | - __( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ), |
|
25 | + __('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
26 | 26 | '~^([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4})$~' |
27 | 27 | ) |
28 | 28 | ); |
29 | - parent::__construct( $options ); |
|
29 | + parent::__construct($options); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 |
@@ -11,48 +11,48 @@ discard block |
||
11 | 11 | * @since $VID:$ |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Display_Strategy extends EE_Display_Strategy_Base{ |
|
14 | +class EE_Select_Display_Strategy extends EE_Display_Strategy_Base { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * |
18 | 18 | * @throws EE_Error |
19 | 19 | * @return string of html to display the field |
20 | 20 | */ |
21 | - function display(){ |
|
22 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
23 | - throw new EE_Error( sprintf( __( 'Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso' ))); |
|
21 | + function display() { |
|
22 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
23 | + throw new EE_Error(sprintf(__('Cannot use Select Display Strategy with an input that doesn\'t have options', 'event_espresso'))); |
|
24 | 24 | } |
25 | 25 | EE_Registry::instance()->load_helper('Array'); |
26 | 26 | |
27 | - $html = EEH_HTML::nl( 0, 'select' ); |
|
27 | + $html = EEH_HTML::nl(0, 'select'); |
|
28 | 28 | $html .= '<select'; |
29 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
30 | - $html .= ' name="' . $this->_input->html_name() . '"'; |
|
31 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
32 | - $html .= ' class="' . $class . '"'; |
|
29 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
30 | + $html .= ' name="'.$this->_input->html_name().'"'; |
|
31 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
32 | + $html .= ' class="'.$class.'"'; |
|
33 | 33 | // add html5 required |
34 | 34 | |
35 | 35 | $html .= $this->_input->required() ? ' required' : ''; |
36 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
37 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
36 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
37 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
38 | 38 | $html .= '>'; |
39 | 39 | |
40 | 40 | // EEH_HTML::indent( 1, 'select' ); |
41 | - if ( EEH_Array::is_multi_dimensional_array( $this->_input->options() )) { |
|
42 | - EEH_HTML::indent( 1, 'optgroup' ); |
|
43 | - foreach( $this->_input->options() as $opt_group_label => $opt_group ){ |
|
44 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '<optgroup label="' . esc_attr( $opt_group_label ) . '">'; |
|
45 | - EEH_HTML::indent( 1, 'option' ); |
|
46 | - $html .= $this->_display_options( $opt_group ); |
|
41 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
42 | + EEH_HTML::indent(1, 'optgroup'); |
|
43 | + foreach ($this->_input->options() as $opt_group_label => $opt_group) { |
|
44 | + $html .= EEH_HTML::nl(0, 'optgroup').'<optgroup label="'.esc_attr($opt_group_label).'">'; |
|
45 | + EEH_HTML::indent(1, 'option'); |
|
46 | + $html .= $this->_display_options($opt_group); |
|
47 | 47 | $html .= EEH_HTML::indent( -1, 'option' ); |
48 | - $html .= EEH_HTML::nl( 0, 'optgroup' ) . '</optgroup>'; |
|
48 | + $html .= EEH_HTML::nl(0, 'optgroup').'</optgroup>'; |
|
49 | 49 | } |
50 | 50 | EEH_HTML::indent( -1, 'optgroup' ); |
51 | 51 | } else { |
52 | - $html.=$this->_display_options( $this->_input->options() ); |
|
52 | + $html .= $this->_display_options($this->_input->options()); |
|
53 | 53 | } |
54 | 54 | |
55 | - $html.= EEH_HTML::nl( 0, 'select' ) . '</select>'; |
|
55 | + $html .= EEH_HTML::nl(0, 'select').'</select>'; |
|
56 | 56 | // $html.= EEH_HTML::nl( -1, 'select' ) . '</select>'; |
57 | 57 | return $html; |
58 | 58 | } |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | * @param array $options |
65 | 65 | * @return string |
66 | 66 | */ |
67 | - protected function _display_options($options){ |
|
67 | + protected function _display_options($options) { |
|
68 | 68 | $html = ''; |
69 | - EEH_HTML::indent( 1, 'option' ); |
|
70 | - foreach( $options as $value => $display_text ){ |
|
71 | - $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one( $value ); |
|
72 | - $selected = $this->_check_if_option_selected( $unnormalized_value ) ? ' selected="selected"' : ''; |
|
73 | - $html.= EEH_HTML::nl( 0, 'option' ) . '<option value="' . esc_attr( $unnormalized_value ) . '"' . $selected . '>' . $display_text . '</option>'; |
|
69 | + EEH_HTML::indent(1, 'option'); |
|
70 | + foreach ($options as $value => $display_text) { |
|
71 | + $unnormalized_value = $this->_input->get_normalization_strategy()->unnormalize_one($value); |
|
72 | + $selected = $this->_check_if_option_selected($unnormalized_value) ? ' selected="selected"' : ''; |
|
73 | + $html .= EEH_HTML::nl(0, 'option').'<option value="'.esc_attr($unnormalized_value).'"'.$selected.'>'.$display_text.'</option>'; |
|
74 | 74 | } |
75 | 75 | EEH_HTML::indent( -1, 'option' ); |
76 | 76 | return $html; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @param string|int $value unnormalized value option (string) |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - protected function _check_if_option_selected( $value ){ |
|
86 | + protected function _check_if_option_selected($value) { |
|
87 | 87 | return $this->_input->raw_value() == $value ? TRUE : FALSE; |
88 | 88 | } |
89 | 89 |
@@ -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 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy{ |
|
28 | +class EE_Select_Multiple_Display_Strategy extends EE_Select_Display_Strategy { |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * |
@@ -34,31 +34,31 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function display() { |
36 | 36 | |
37 | - if( ! $this->_input instanceof EE_Form_Input_With_Options_Base){ |
|
37 | + if ( ! $this->_input instanceof EE_Form_Input_With_Options_Base) { |
|
38 | 38 | throw new EE_Error(sprintf(__('Cannot use Select Multiple Display Strategy with an input that doesn\'t have options', "event_espresso"))); |
39 | 39 | } |
40 | 40 | |
41 | - $html = EEH_HTML::nl( 0, 'select' ); |
|
41 | + $html = EEH_HTML::nl(0, 'select'); |
|
42 | 42 | $html .= '<select multiple'; |
43 | - $html .= ' id="' . $this->_input->html_id() . '"'; |
|
44 | - $html .= ' name="' . $this->_input->html_name() . '[]"'; |
|
45 | - $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); |
|
46 | - $html .= ' class="' . $class . '"'; |
|
43 | + $html .= ' id="'.$this->_input->html_id().'"'; |
|
44 | + $html .= ' name="'.$this->_input->html_name().'[]"'; |
|
45 | + $class = $this->_input->required() ? $this->_input->required_css_class().' '.$this->_input->html_class() : $this->_input->html_class(); |
|
46 | + $html .= ' class="'.$class.'"'; |
|
47 | 47 | // add html5 required |
48 | 48 | $html .= $this->_input->required() ? ' required' : ''; |
49 | - $html .= ' style="' . $this->_input->html_style() . '"'; |
|
50 | - $html .= ' ' . $this->_input->other_html_attributes(); |
|
49 | + $html .= ' style="'.$this->_input->html_style().'"'; |
|
50 | + $html .= ' '.$this->_input->other_html_attributes(); |
|
51 | 51 | $html .= '>'; |
52 | 52 | |
53 | 53 | EE_Registry::instance()->load_helper('Array'); |
54 | - EEH_HTML::indent( 1, 'select' ); |
|
55 | - if( EEH_Array::is_multi_dimensional_array( $this->_input->options() )){ |
|
54 | + EEH_HTML::indent(1, 'select'); |
|
55 | + if (EEH_Array::is_multi_dimensional_array($this->_input->options())) { |
|
56 | 56 | throw new EE_Error(sprintf(__("Select multiple display strategy does not allow for nested arrays of options.", "event_espresso"))); |
57 | - }else{ |
|
58 | - $html.=$this->_display_options( $this->_input->options() ); |
|
57 | + } else { |
|
58 | + $html .= $this->_display_options($this->_input->options()); |
|
59 | 59 | } |
60 | 60 | |
61 | - $html.= EEH_HTML::nl( -1, 'select' ) . "</select>"; |
|
61 | + $html .= EEH_HTML::nl( -1, 'select' )."</select>"; |
|
62 | 62 | return $html; |
63 | 63 | } |
64 | 64 | |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | * @param string|int $value unnormalized value option (string) |
70 | 70 | * @return boolean |
71 | 71 | */ |
72 | - protected function _check_if_option_selected( $value ){ |
|
72 | + protected function _check_if_option_selected($value) { |
|
73 | 73 | $selected_options = $this->_input->raw_value(); |
74 | - if ( empty( $selected_options )){ |
|
74 | + if (empty($selected_options)) { |
|
75 | 75 | return FALSE; |
76 | 76 | } |
77 | - return in_array( $value, $selected_options ) ? TRUE : FALSE; |
|
77 | + return in_array($value, $selected_options) ? TRUE : FALSE; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | * update_espresso_config |
374 | 374 | * |
375 | 375 | * @access public |
376 | - * @return bool |
|
376 | + * @return boolean|null |
|
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | * @param string $name |
460 | 460 | * @param string $config_class |
461 | 461 | * @param EE_Config_Base $config_obj |
462 | - * @param array $tests_to_run |
|
462 | + * @param integer[] $tests_to_run |
|
463 | 463 | * @param bool $display_errors |
464 | 464 | * @return bool TRUE on success, FALSE on fail |
465 | 465 | */ |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | |
1738 | 1738 | /** |
1739 | - * @return array |
|
1739 | + * @return integer[] |
|
1740 | 1740 | */ |
1741 | 1741 | public function get_critical_pages_array() { |
1742 | 1742 | return array( |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | |
1751 | 1751 | |
1752 | 1752 | /** |
1753 | - * @return array |
|
1753 | + * @return string[] |
|
1754 | 1754 | */ |
1755 | 1755 | public function get_critical_pages_shortcodes_array() { |
1756 | 1756 | return array( |
@@ -2785,7 +2785,7 @@ discard block |
||
2785 | 2785 | * according to max_input_vars |
2786 | 2786 | * |
2787 | 2787 | * @param int $input_count the count of input vars. |
2788 | - * @return array { |
|
2788 | + * @return string { |
|
2789 | 2789 | * An array that represents whether available space and if no available space the error |
2790 | 2790 | * message. |
2791 | 2791 | * @type bool $has_space whether more inputs can be added. |
@@ -2105,7 +2105,7 @@ discard block |
||
2105 | 2105 | public function __construct( $CNT_ISO = '' ) { |
2106 | 2106 | // get country code from organization settings or use default |
2107 | 2107 | $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
2108 | - && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2108 | + && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
|
2109 | 2109 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2110 | 2110 | : ''; |
2111 | 2111 | // but override if requested |
@@ -2794,8 +2794,8 @@ discard block |
||
2794 | 2794 | */ |
2795 | 2795 | public function max_input_vars_limit_check( $input_count = 0 ) { |
2796 | 2796 | if ( ! empty( $this->php->max_input_vars ) |
2797 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2797 | + && ( $input_count >= $this->php->max_input_vars ) |
|
2798 | + && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2799 | 2799 | ) { |
2800 | 2800 | return sprintf( |
2801 | 2801 | __( |
@@ -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 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function instance() { |
123 | 123 | // check if class object is instantiated, and instantiated properly |
124 | - if ( ! self::$_instance instanceof EE_Config ) { |
|
124 | + if ( ! self::$_instance instanceof EE_Config) { |
|
125 | 125 | self::$_instance = new self(); |
126 | 126 | } |
127 | 127 | return self::$_instance; |
@@ -141,20 +141,20 @@ discard block |
||
141 | 141 | * site was put into maintenance mode) |
142 | 142 | * @return EE_Config |
143 | 143 | */ |
144 | - public static function reset( $hard_reset = false, $reinstantiate = true ) { |
|
145 | - if ( $hard_reset ) { |
|
144 | + public static function reset($hard_reset = false, $reinstantiate = true) { |
|
145 | + if ($hard_reset) { |
|
146 | 146 | self::$_instance->_addon_option_names = array(); |
147 | 147 | self::$_instance->_initialize_config(); |
148 | 148 | self::$_instance->update_espresso_config(); |
149 | 149 | } |
150 | - if ( self::$_instance instanceof EE_Config ) { |
|
150 | + if (self::$_instance instanceof EE_Config) { |
|
151 | 151 | self::$_instance->update_addon_option_names(); |
152 | 152 | } |
153 | 153 | self::$_instance = null; |
154 | 154 | //we don't need to reset the static properties imo because those should |
155 | 155 | //only change when a module is added or removed. Currently we don't |
156 | 156 | //support removing a module during a request when it previously existed |
157 | - if ( $reinstantiate ) { |
|
157 | + if ($reinstantiate) { |
|
158 | 158 | return self::instance(); |
159 | 159 | } else { |
160 | 160 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @return \EE_Config |
171 | 171 | */ |
172 | 172 | private function __construct() { |
173 | - do_action( 'AHEE__EE_Config__construct__begin', $this ); |
|
173 | + do_action('AHEE__EE_Config__construct__begin', $this); |
|
174 | 174 | // setup empty config classes |
175 | 175 | $this->_initialize_config(); |
176 | 176 | // load existing EE site settings |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | // register shortcodes and modules |
181 | 181 | add_action( |
182 | 182 | 'AHEE__EE_System__register_shortcodes_modules_and_widgets', |
183 | - array( $this, 'register_shortcodes_and_modules' ), |
|
183 | + array($this, 'register_shortcodes_and_modules'), |
|
184 | 184 | 999 |
185 | 185 | ); |
186 | 186 | // initialize shortcodes and modules |
187 | - add_action( 'AHEE__EE_System__core_loaded_and_ready', array( $this, 'initialize_shortcodes_and_modules' ) ); |
|
187 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'initialize_shortcodes_and_modules')); |
|
188 | 188 | // register widgets |
189 | - add_action( 'widgets_init', array( $this, 'widgets_init' ), 10 ); |
|
189 | + add_action('widgets_init', array($this, 'widgets_init'), 10); |
|
190 | 190 | // shutdown |
191 | - add_action( 'shutdown', array( $this, 'shutdown' ), 10 ); |
|
191 | + add_action('shutdown', array($this, 'shutdown'), 10); |
|
192 | 192 | // construct__end hook |
193 | - do_action( 'AHEE__EE_Config__construct__end', $this ); |
|
193 | + do_action('AHEE__EE_Config__construct__end', $this); |
|
194 | 194 | // hardcoded hack |
195 | 195 | $this->template_settings->current_espresso_theme = 'Espresso_Arabica_2014'; |
196 | 196 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return string current theme set. |
204 | 204 | */ |
205 | 205 | public static function get_current_theme() { |
206 | - return isset( self::$_instance->template_settings->current_espresso_theme ) |
|
206 | + return isset(self::$_instance->template_settings->current_espresso_theme) |
|
207 | 207 | ? self::$_instance->template_settings->current_espresso_theme : 'Espresso_Arabica_2014'; |
208 | 208 | } |
209 | 209 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | private function _initialize_config() { |
219 | 219 | EE_Config::trim_log(); |
220 | 220 | //set defaults |
221 | - $this->_addon_option_names = get_option( EE_Config::ADDON_OPTION_NAMES, array() ); |
|
221 | + $this->_addon_option_names = get_option(EE_Config::ADDON_OPTION_NAMES, array()); |
|
222 | 222 | $this->addons = new stdClass(); |
223 | 223 | // set _module_route_map |
224 | 224 | EE_Config::$_module_route_map = array(); |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | */ |
239 | 239 | private function _load_core_config() { |
240 | 240 | // load_core_config__start hook |
241 | - do_action( 'AHEE__EE_Config___load_core_config__start', $this ); |
|
241 | + do_action('AHEE__EE_Config___load_core_config__start', $this); |
|
242 | 242 | $espresso_config = $this->get_espresso_config(); |
243 | - foreach ( $espresso_config as $config => $settings ) { |
|
243 | + foreach ($espresso_config as $config => $settings) { |
|
244 | 244 | // load_core_config__start hook |
245 | 245 | $settings = apply_filters( |
246 | 246 | 'FHEE__EE_Config___load_core_config__config_settings', |
@@ -248,22 +248,22 @@ discard block |
||
248 | 248 | $config, |
249 | 249 | $this |
250 | 250 | ); |
251 | - if ( is_object( $settings ) && property_exists( $this, $config ) ) { |
|
252 | - $this->{$config} = apply_filters( 'FHEE__EE_Config___load_core_config__' . $config, $settings ); |
|
251 | + if (is_object($settings) && property_exists($this, $config)) { |
|
252 | + $this->{$config} = apply_filters('FHEE__EE_Config___load_core_config__'.$config, $settings); |
|
253 | 253 | //call configs populate method to ensure any defaults are set for empty values. |
254 | - if ( method_exists( $settings, 'populate' ) ) { |
|
254 | + if (method_exists($settings, 'populate')) { |
|
255 | 255 | $this->{$config}->populate(); |
256 | 256 | } |
257 | - if ( method_exists( $settings, 'do_hooks' ) ) { |
|
257 | + if (method_exists($settings, 'do_hooks')) { |
|
258 | 258 | $this->{$config}->do_hooks(); |
259 | 259 | } |
260 | 260 | } |
261 | 261 | } |
262 | - if ( apply_filters( 'FHEE__EE_Config___load_core_config__update_espresso_config', false ) ) { |
|
262 | + if (apply_filters('FHEE__EE_Config___load_core_config__update_espresso_config', false)) { |
|
263 | 263 | $this->update_espresso_config(); |
264 | 264 | } |
265 | 265 | // load_core_config__end hook |
266 | - do_action( 'AHEE__EE_Config___load_core_config__end', $this ); |
|
266 | + do_action('AHEE__EE_Config___load_core_config__end', $this); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | $this->core = $this->core instanceof EE_Core_Config |
279 | 279 | ? $this->core |
280 | 280 | : new EE_Core_Config(); |
281 | - $this->core = apply_filters( 'FHEE__EE_Config___initialize_config__core', $this->core ); |
|
281 | + $this->core = apply_filters('FHEE__EE_Config___initialize_config__core', $this->core); |
|
282 | 282 | $this->organization = $this->organization instanceof EE_Organization_Config |
283 | 283 | ? $this->organization |
284 | 284 | : new EE_Organization_Config(); |
285 | - $this->organization = apply_filters( 'FHEE__EE_Config___initialize_config__organization', $this->organization ); |
|
285 | + $this->organization = apply_filters('FHEE__EE_Config___initialize_config__organization', $this->organization); |
|
286 | 286 | $this->currency = $this->currency instanceof EE_Currency_Config |
287 | 287 | ? $this->currency |
288 | 288 | : new EE_Currency_Config(); |
289 | - $this->currency = apply_filters( 'FHEE__EE_Config___initialize_config__currency', $this->currency ); |
|
289 | + $this->currency = apply_filters('FHEE__EE_Config___initialize_config__currency', $this->currency); |
|
290 | 290 | $this->registration = $this->registration instanceof EE_Registration_Config |
291 | 291 | ? $this->registration |
292 | 292 | : new EE_Registration_Config(); |
293 | - $this->registration = apply_filters( 'FHEE__EE_Config___initialize_config__registration', $this->registration ); |
|
293 | + $this->registration = apply_filters('FHEE__EE_Config___initialize_config__registration', $this->registration); |
|
294 | 294 | $this->admin = $this->admin instanceof EE_Admin_Config |
295 | 295 | ? $this->admin |
296 | 296 | : new EE_Admin_Config(); |
297 | - $this->admin = apply_filters( 'FHEE__EE_Config___initialize_config__admin', $this->admin ); |
|
297 | + $this->admin = apply_filters('FHEE__EE_Config___initialize_config__admin', $this->admin); |
|
298 | 298 | $this->template_settings = $this->template_settings instanceof EE_Template_Config |
299 | 299 | ? $this->template_settings |
300 | 300 | : new EE_Template_Config(); |
@@ -305,15 +305,15 @@ discard block |
||
305 | 305 | $this->map_settings = $this->map_settings instanceof EE_Map_Config |
306 | 306 | ? $this->map_settings |
307 | 307 | : new EE_Map_Config(); |
308 | - $this->map_settings = apply_filters( 'FHEE__EE_Config___initialize_config__map_settings', $this->map_settings ); |
|
308 | + $this->map_settings = apply_filters('FHEE__EE_Config___initialize_config__map_settings', $this->map_settings); |
|
309 | 309 | $this->environment = $this->environment instanceof EE_Environment_Config |
310 | 310 | ? $this->environment |
311 | 311 | : new EE_Environment_Config(); |
312 | - $this->environment = apply_filters( 'FHEE__EE_Config___initialize_config__environment', $this->environment ); |
|
312 | + $this->environment = apply_filters('FHEE__EE_Config___initialize_config__environment', $this->environment); |
|
313 | 313 | $this->gateway = $this->gateway instanceof EE_Gateway_Config |
314 | 314 | ? $this->gateway |
315 | 315 | : new EE_Gateway_Config(); |
316 | - $this->gateway = apply_filters( 'FHEE__EE_Config___initialize_config__gateway', $this->gateway ); |
|
316 | + $this->gateway = apply_filters('FHEE__EE_Config___initialize_config__gateway', $this->gateway); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | // grab espresso configuration |
329 | 329 | return apply_filters( |
330 | 330 | 'FHEE__EE_Config__get_espresso_config__CFG', |
331 | - get_option( EE_Config::OPTION_NAME, array() ) |
|
331 | + get_option(EE_Config::OPTION_NAME, array()) |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | * @param $old_value |
343 | 343 | * @param $value |
344 | 344 | */ |
345 | - public function double_check_config_comparison( $option = '', $old_value, $value ) { |
|
345 | + public function double_check_config_comparison($option = '', $old_value, $value) { |
|
346 | 346 | // make sure we're checking the ee config |
347 | - if ( $option === EE_Config::OPTION_NAME ) { |
|
347 | + if ($option === EE_Config::OPTION_NAME) { |
|
348 | 348 | // run a loose comparison of the old value against the new value for type and properties, |
349 | 349 | // but NOT exact instance like WP update_option does (ie: NOT type safe comparison) |
350 | - if ( $value != $old_value ) { |
|
350 | + if ($value != $old_value) { |
|
351 | 351 | // if they are NOT the same, then remove the hook, |
352 | 352 | // which means the subsequent update results will be based solely on the update query results |
353 | 353 | // the reason we do this is because, as stated above, |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | // the string it sees in the db looks the same as the new one it has been passed!!! |
363 | 363 | // This results in the query returning an "affected rows" value of ZERO, |
364 | 364 | // which gets returned immediately by WP update_option and looks like an error. |
365 | - remove_action( 'update_option', array( $this, 'check_config_updated' ) ); |
|
365 | + remove_action('update_option', array($this, 'check_config_updated')); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | */ |
378 | 378 | protected function _reset_espresso_addon_config() { |
379 | 379 | $this->_addon_option_names = array(); |
380 | - foreach ( $this->addons as $addon_name => $addon_config_obj ) { |
|
381 | - $addon_config_obj = maybe_unserialize( $addon_config_obj ); |
|
382 | - $config_class = get_class( $addon_config_obj ); |
|
383 | - if ( $addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class ) { |
|
384 | - $this->update_config( 'addons', $addon_name, $addon_config_obj, false ); |
|
380 | + foreach ($this->addons as $addon_name => $addon_config_obj) { |
|
381 | + $addon_config_obj = maybe_unserialize($addon_config_obj); |
|
382 | + $config_class = get_class($addon_config_obj); |
|
383 | + if ($addon_config_obj instanceof $config_class && ! $addon_config_obj instanceof __PHP_Incomplete_Class) { |
|
384 | + $this->update_config('addons', $addon_name, $addon_config_obj, false); |
|
385 | 385 | } |
386 | 386 | $this->addons->{$addon_name} = null; |
387 | 387 | } |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @param bool $add_error |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public function update_espresso_config( $add_success = false, $add_error = true ) { |
|
400 | + public function update_espresso_config($add_success = false, $add_error = true) { |
|
401 | 401 | // don't allow config updates during WP heartbeats |
402 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
402 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
403 | 403 | return false; |
404 | 404 | } |
405 | 405 | // commented out the following re: https://events.codebasehq.com/projects/event-espresso/tickets/8197 |
406 | 406 | //$clone = clone( self::$_instance ); |
407 | 407 | //self::$_instance = NULL; |
408 | - do_action( 'AHEE__EE_Config__update_espresso_config__begin', $this ); |
|
408 | + do_action('AHEE__EE_Config__update_espresso_config__begin', $this); |
|
409 | 409 | $this->_reset_espresso_addon_config(); |
410 | 410 | // hook into update_option because that happens AFTER the ( $value === $old_value ) conditional |
411 | 411 | // but BEFORE the actual update occurs |
412 | - add_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1, 3 ); |
|
412 | + add_action('update_option', array($this, 'double_check_config_comparison'), 1, 3); |
|
413 | 413 | // now update "ee_config" |
414 | - $saved = update_option( EE_Config::OPTION_NAME, $this ); |
|
415 | - EE_Config::log( EE_Config::OPTION_NAME ); |
|
414 | + $saved = update_option(EE_Config::OPTION_NAME, $this); |
|
415 | + EE_Config::log(EE_Config::OPTION_NAME); |
|
416 | 416 | // if not saved... check if the hook we just added still exists; |
417 | 417 | // if it does, it means one of two things: |
418 | 418 | // that update_option bailed at the ( $value === $old_value ) conditional, |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | // but just means no update occurred, so don't display an error to the user. |
424 | 424 | // BUT... if update_option returns FALSE, AND the hook is missing, |
425 | 425 | // then it means that something truly went wrong |
426 | - $saved = ! $saved ? has_action( 'update_option', array( $this, 'double_check_config_comparison' ) ) : $saved; |
|
426 | + $saved = ! $saved ? has_action('update_option', array($this, 'double_check_config_comparison')) : $saved; |
|
427 | 427 | // remove our action since we don't want it in the system anymore |
428 | - remove_action( 'update_option', array( $this, 'double_check_config_comparison' ), 1 ); |
|
429 | - do_action( 'AHEE__EE_Config__update_espresso_config__end', $this, $saved ); |
|
428 | + remove_action('update_option', array($this, 'double_check_config_comparison'), 1); |
|
429 | + do_action('AHEE__EE_Config__update_espresso_config__end', $this, $saved); |
|
430 | 430 | //self::$_instance = $clone; |
431 | 431 | //unset( $clone ); |
432 | 432 | // if config remains the same or was updated successfully |
433 | - if ( $saved ) { |
|
434 | - if ( $add_success ) { |
|
433 | + if ($saved) { |
|
434 | + if ($add_success) { |
|
435 | 435 | EE_Error::add_success( |
436 | - __( 'The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso' ), |
|
436 | + __('The Event Espresso Configuration Settings have been successfully updated.', 'event_espresso'), |
|
437 | 437 | __FILE__, |
438 | 438 | __FUNCTION__, |
439 | 439 | __LINE__ |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | } |
442 | 442 | return true; |
443 | 443 | } else { |
444 | - if ( $add_error ) { |
|
444 | + if ($add_error) { |
|
445 | 445 | EE_Error::add_error( |
446 | - __( 'The Event Espresso Configuration Settings were not updated.', 'event_espresso' ), |
|
446 | + __('The Event Espresso Configuration Settings were not updated.', 'event_espresso'), |
|
447 | 447 | __FILE__, |
448 | 448 | __FUNCTION__, |
449 | 449 | __LINE__ |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | $name = '', |
473 | 473 | $config_class = '', |
474 | 474 | $config_obj = null, |
475 | - $tests_to_run = array( 1, 2, 3, 4, 5, 6, 7, 8 ), |
|
475 | + $tests_to_run = array(1, 2, 3, 4, 5, 6, 7, 8), |
|
476 | 476 | $display_errors = true |
477 | 477 | ) { |
478 | 478 | try { |
479 | - foreach ( $tests_to_run as $test ) { |
|
480 | - switch ( $test ) { |
|
479 | + foreach ($tests_to_run as $test) { |
|
480 | + switch ($test) { |
|
481 | 481 | // TEST #1 : check that section was set |
482 | 482 | case 1 : |
483 | - if ( empty( $section ) ) { |
|
484 | - if ( $display_errors ) { |
|
483 | + if (empty($section)) { |
|
484 | + if ($display_errors) { |
|
485 | 485 | throw new EE_Error( |
486 | 486 | sprintf( |
487 | 487 | __( |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | break; |
498 | 498 | // TEST #2 : check that settings section exists |
499 | 499 | case 2 : |
500 | - if ( ! isset( $this->{$section} ) ) { |
|
501 | - if ( $display_errors ) { |
|
500 | + if ( ! isset($this->{$section} )) { |
|
501 | + if ($display_errors) { |
|
502 | 502 | throw new EE_Error( |
503 | 503 | sprintf( |
504 | - __( 'The "%s" configuration section does not exist.', 'event_espresso' ), |
|
504 | + __('The "%s" configuration section does not exist.', 'event_espresso'), |
|
505 | 505 | $section |
506 | 506 | ) |
507 | 507 | ); |
@@ -512,9 +512,9 @@ discard block |
||
512 | 512 | // TEST #3 : check that section is the proper format |
513 | 513 | case 3 : |
514 | 514 | if ( |
515 | - ! ( $this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass ) |
|
515 | + ! ($this->{$section} instanceof EE_Config_Base || $this->{$section} instanceof stdClass) |
|
516 | 516 | ) { |
517 | - if ( $display_errors ) { |
|
517 | + if ($display_errors) { |
|
518 | 518 | throw new EE_Error( |
519 | 519 | sprintf( |
520 | 520 | __( |
@@ -530,8 +530,8 @@ discard block |
||
530 | 530 | break; |
531 | 531 | // TEST #4 : check that config section name has been set |
532 | 532 | case 4 : |
533 | - if ( empty( $name ) ) { |
|
534 | - if ( $display_errors ) { |
|
533 | + if (empty($name)) { |
|
534 | + if ($display_errors) { |
|
535 | 535 | throw new EE_Error( |
536 | 536 | __( |
537 | 537 | 'No name has been provided for the specific configuration section.', |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | break; |
545 | 545 | // TEST #5 : check that a config class name has been set |
546 | 546 | case 5 : |
547 | - if ( empty( $config_class ) ) { |
|
548 | - if ( $display_errors ) { |
|
547 | + if (empty($config_class)) { |
|
548 | + if ($display_errors) { |
|
549 | 549 | throw new EE_Error( |
550 | 550 | __( |
551 | 551 | 'No class name has been provided for the specific configuration section.', |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | break; |
559 | 559 | // TEST #6 : verify config class is accessible |
560 | 560 | case 6 : |
561 | - if ( ! class_exists( $config_class ) ) { |
|
562 | - if ( $display_errors ) { |
|
561 | + if ( ! class_exists($config_class)) { |
|
562 | + if ($display_errors) { |
|
563 | 563 | throw new EE_Error( |
564 | 564 | sprintf( |
565 | 565 | __( |
@@ -575,11 +575,11 @@ discard block |
||
575 | 575 | break; |
576 | 576 | // TEST #7 : check that config has even been set |
577 | 577 | case 7 : |
578 | - if ( ! isset( $this->{$section}->{$name} ) ) { |
|
579 | - if ( $display_errors ) { |
|
578 | + if ( ! isset($this->{$section}->{$name} )) { |
|
579 | + if ($display_errors) { |
|
580 | 580 | throw new EE_Error( |
581 | 581 | sprintf( |
582 | - __( 'No configuration has been set for "%1$s->%2$s".', 'event_espresso' ), |
|
582 | + __('No configuration has been set for "%1$s->%2$s".', 'event_espresso'), |
|
583 | 583 | $section, |
584 | 584 | $name |
585 | 585 | ) |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | return false; |
589 | 589 | } else { |
590 | 590 | // and make sure it's not serialized |
591 | - $this->{$section}->{$name} = maybe_unserialize( $this->{$section}->{$name} ); |
|
591 | + $this->{$section}->{$name} = maybe_unserialize($this->{$section}->{$name} ); |
|
592 | 592 | } |
593 | 593 | break; |
594 | 594 | // TEST #8 : check that config is the requested type |
595 | 595 | case 8 : |
596 | - if ( ! $this->{$section}->{$name} instanceof $config_class ) { |
|
597 | - if ( $display_errors ) { |
|
596 | + if ( ! $this->{$section}->{$name} instanceof $config_class) { |
|
597 | + if ($display_errors) { |
|
598 | 598 | throw new EE_Error( |
599 | 599 | sprintf( |
600 | 600 | __( |
@@ -612,12 +612,12 @@ discard block |
||
612 | 612 | break; |
613 | 613 | // TEST #9 : verify config object |
614 | 614 | case 9 : |
615 | - if ( ! $config_obj instanceof EE_Config_Base ) { |
|
616 | - if ( $display_errors ) { |
|
615 | + if ( ! $config_obj instanceof EE_Config_Base) { |
|
616 | + if ($display_errors) { |
|
617 | 617 | throw new EE_Error( |
618 | 618 | sprintf( |
619 | - __( 'The "%s" class is not an instance of EE_Config_Base.', 'event_espresso' ), |
|
620 | - print_r( $config_obj, true ) |
|
619 | + __('The "%s" class is not an instance of EE_Config_Base.', 'event_espresso'), |
|
620 | + print_r($config_obj, true) |
|
621 | 621 | ) |
622 | 622 | ); |
623 | 623 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | break; |
627 | 627 | } |
628 | 628 | } |
629 | - } catch ( EE_Error $e ) { |
|
629 | + } catch (EE_Error $e) { |
|
630 | 630 | $e->get_error(); |
631 | 631 | } |
632 | 632 | // you have successfully run the gauntlet |
@@ -643,8 +643,8 @@ discard block |
||
643 | 643 | * @param string $name |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - private function _generate_config_option_name( $section = '', $name = '' ) { |
|
647 | - return 'ee_config-' . strtolower( $section . '-' . str_replace( array( 'EE_', 'EED_' ), '', $name ) ); |
|
646 | + private function _generate_config_option_name($section = '', $name = '') { |
|
647 | + return 'ee_config-'.strtolower($section.'-'.str_replace(array('EE_', 'EED_'), '', $name)); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | |
@@ -658,10 +658,10 @@ discard block |
||
658 | 658 | * @param string $name |
659 | 659 | * @return string |
660 | 660 | */ |
661 | - private function _set_config_class( $config_class = '', $name = '' ) { |
|
662 | - return ! empty( $config_class ) |
|
661 | + private function _set_config_class($config_class = '', $name = '') { |
|
662 | + return ! empty($config_class) |
|
663 | 663 | ? $config_class |
664 | - : str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $name ) ) ) . '_Config'; |
|
664 | + : str_replace(' ', '_', ucwords(str_replace('_', ' ', $name))).'_Config'; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | |
@@ -676,36 +676,36 @@ discard block |
||
676 | 676 | * @param EE_Config_Base $config_obj |
677 | 677 | * @return EE_Config_Base |
678 | 678 | */ |
679 | - public function set_config( $section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null ) { |
|
679 | + public function set_config($section = '', $name = '', $config_class = '', EE_Config_Base $config_obj = null) { |
|
680 | 680 | // ensure config class is set to something |
681 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
681 | + $config_class = $this->_set_config_class($config_class, $name); |
|
682 | 682 | // run tests 1-4, 6, and 7 to verify all config params are set and valid |
683 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
683 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
684 | 684 | return null; |
685 | 685 | } |
686 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
686 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
687 | 687 | // if the config option name hasn't been added yet to the list of option names we're tracking, then do so now |
688 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
689 | - $this->_addon_option_names[ $config_option_name ] = $config_class; |
|
688 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
689 | + $this->_addon_option_names[$config_option_name] = $config_class; |
|
690 | 690 | $this->update_addon_option_names(); |
691 | 691 | } |
692 | 692 | // verify the incoming config object but suppress errors |
693 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
693 | + if ( ! $this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
694 | 694 | $config_obj = new $config_class(); |
695 | 695 | } |
696 | - if ( get_option( $config_option_name ) ) { |
|
697 | - EE_Config::log( $config_option_name ); |
|
698 | - update_option( $config_option_name, $config_obj ); |
|
696 | + if (get_option($config_option_name)) { |
|
697 | + EE_Config::log($config_option_name); |
|
698 | + update_option($config_option_name, $config_obj); |
|
699 | 699 | $this->{$section}->{$name} = $config_obj; |
700 | 700 | return $this->{$section}->{$name}; |
701 | 701 | } else { |
702 | 702 | // create a wp-option for this config |
703 | - if ( add_option( $config_option_name, $config_obj, '', 'no' ) ) { |
|
704 | - $this->{$section}->{$name} = maybe_unserialize( $config_obj ); |
|
703 | + if (add_option($config_option_name, $config_obj, '', 'no')) { |
|
704 | + $this->{$section}->{$name} = maybe_unserialize($config_obj); |
|
705 | 705 | return $this->{$section}->{$name}; |
706 | 706 | } else { |
707 | 707 | EE_Error::add_error( |
708 | - sprintf( __( 'The "%s" could not be saved to the database.', 'event_espresso' ), $config_class ), |
|
708 | + sprintf(__('The "%s" could not be saved to the database.', 'event_espresso'), $config_class), |
|
709 | 709 | __FILE__, |
710 | 710 | __FUNCTION__, |
711 | 711 | __LINE__ |
@@ -728,44 +728,44 @@ discard block |
||
728 | 728 | * @param bool $throw_errors |
729 | 729 | * @return bool |
730 | 730 | */ |
731 | - public function update_config( $section = '', $name = '', $config_obj = '', $throw_errors = true ) { |
|
731 | + public function update_config($section = '', $name = '', $config_obj = '', $throw_errors = true) { |
|
732 | 732 | // don't allow config updates during WP heartbeats |
733 | - if ( \EE_Registry::instance()->REQ->get( 'action', '' ) === 'heartbeat' ) { |
|
733 | + if (\EE_Registry::instance()->REQ->get('action', '') === 'heartbeat') { |
|
734 | 734 | return false; |
735 | 735 | } |
736 | - $config_obj = maybe_unserialize( $config_obj ); |
|
736 | + $config_obj = maybe_unserialize($config_obj); |
|
737 | 737 | // get class name of the incoming object |
738 | - $config_class = get_class( $config_obj ); |
|
738 | + $config_class = get_class($config_obj); |
|
739 | 739 | // run tests 1-5 and 9 to verify config |
740 | 740 | if ( ! $this->_verify_config_params( |
741 | 741 | $section, |
742 | 742 | $name, |
743 | 743 | $config_class, |
744 | 744 | $config_obj, |
745 | - array( 1, 2, 3, 4, 7, 9 ) |
|
745 | + array(1, 2, 3, 4, 7, 9) |
|
746 | 746 | ) |
747 | 747 | ) { |
748 | 748 | return false; |
749 | 749 | } |
750 | - $config_option_name = $this->_generate_config_option_name( $section, $name ); |
|
750 | + $config_option_name = $this->_generate_config_option_name($section, $name); |
|
751 | 751 | // check if config object has been added to db by seeing if config option name is in $this->_addon_option_names array |
752 | - if ( ! isset( $this->_addon_option_names[ $config_option_name ] ) ) { |
|
752 | + if ( ! isset($this->_addon_option_names[$config_option_name])) { |
|
753 | 753 | // save new config to db |
754 | - return $this->set_config( $section, $name, $config_class, $config_obj ); |
|
754 | + return $this->set_config($section, $name, $config_class, $config_obj); |
|
755 | 755 | } else { |
756 | 756 | // first check if the record already exists |
757 | - $existing_config = get_option( $config_option_name ); |
|
758 | - $config_obj = serialize( $config_obj ); |
|
757 | + $existing_config = get_option($config_option_name); |
|
758 | + $config_obj = serialize($config_obj); |
|
759 | 759 | // just return if db record is already up to date (NOT type safe comparison) |
760 | - if ( $existing_config == $config_obj ) { |
|
760 | + if ($existing_config == $config_obj) { |
|
761 | 761 | $this->{$section}->{$name} = $config_obj; |
762 | 762 | return true; |
763 | - } else if ( update_option( $config_option_name, $config_obj ) ) { |
|
764 | - EE_Config::log( $config_option_name ); |
|
763 | + } else if (update_option($config_option_name, $config_obj)) { |
|
764 | + EE_Config::log($config_option_name); |
|
765 | 765 | // update wp-option for this config class |
766 | 766 | $this->{$section}->{$name} = $config_obj; |
767 | 767 | return true; |
768 | - } elseif ( $throw_errors ) { |
|
768 | + } elseif ($throw_errors) { |
|
769 | 769 | EE_Error::add_error( |
770 | 770 | sprintf( |
771 | 771 | __( |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | 'event_espresso' |
774 | 774 | ), |
775 | 775 | $config_class, |
776 | - 'EE_Config->' . $section . '->' . $name |
|
776 | + 'EE_Config->'.$section.'->'.$name |
|
777 | 777 | ), |
778 | 778 | __FILE__, |
779 | 779 | __FUNCTION__, |
@@ -795,34 +795,34 @@ discard block |
||
795 | 795 | * @param string $config_class |
796 | 796 | * @return mixed EE_Config_Base | NULL |
797 | 797 | */ |
798 | - public function get_config( $section = '', $name = '', $config_class = '' ) { |
|
798 | + public function get_config($section = '', $name = '', $config_class = '') { |
|
799 | 799 | // ensure config class is set to something |
800 | - $config_class = $this->_set_config_class( $config_class, $name ); |
|
800 | + $config_class = $this->_set_config_class($config_class, $name); |
|
801 | 801 | // run tests 1-4, 6 and 7 to verify that all params have been set |
802 | - if ( ! $this->_verify_config_params( $section, $name, $config_class, null, array( 1, 2, 3, 4, 5, 6 ) ) ) { |
|
802 | + if ( ! $this->_verify_config_params($section, $name, $config_class, null, array(1, 2, 3, 4, 5, 6))) { |
|
803 | 803 | return null; |
804 | 804 | } |
805 | 805 | // now test if the requested config object exists, but suppress errors |
806 | - if ( $this->_verify_config_params( $section, $name, $config_class, null, array( 7, 8 ), false ) ) { |
|
806 | + if ($this->_verify_config_params($section, $name, $config_class, null, array(7, 8), false)) { |
|
807 | 807 | // config already exists, so pass it back |
808 | 808 | return $this->{$section}->{$name}; |
809 | 809 | } |
810 | 810 | // load config option from db if it exists |
811 | - $config_obj = $this->get_config_option( $this->_generate_config_option_name( $section, $name ) ); |
|
811 | + $config_obj = $this->get_config_option($this->_generate_config_option_name($section, $name)); |
|
812 | 812 | // verify the newly retrieved config object, but suppress errors |
813 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ), false ) ) { |
|
813 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9), false)) { |
|
814 | 814 | // config is good, so set it and pass it back |
815 | 815 | $this->{$section}->{$name} = $config_obj; |
816 | 816 | return $this->{$section}->{$name}; |
817 | 817 | } |
818 | 818 | // oops! $config_obj is not already set and does not exist in the db, so create a new one |
819 | - $config_obj = $this->set_config( $section, $name, $config_class ); |
|
819 | + $config_obj = $this->set_config($section, $name, $config_class); |
|
820 | 820 | // verify the newly created config object |
821 | - if ( $this->_verify_config_params( $section, $name, $config_class, $config_obj, array( 9 ) ) ) { |
|
821 | + if ($this->_verify_config_params($section, $name, $config_class, $config_obj, array(9))) { |
|
822 | 822 | return $this->{$section}->{$name}; |
823 | 823 | } else { |
824 | 824 | EE_Error::add_error( |
825 | - sprintf( __( 'The "%s" could not be retrieved from the database.', 'event_espresso' ), $config_class ), |
|
825 | + sprintf(__('The "%s" could not be retrieved from the database.', 'event_espresso'), $config_class), |
|
826 | 826 | __FILE__, |
827 | 827 | __FUNCTION__, |
828 | 828 | __LINE__ |
@@ -840,11 +840,11 @@ discard block |
||
840 | 840 | * @param string $config_option_name |
841 | 841 | * @return mixed EE_Config_Base | FALSE |
842 | 842 | */ |
843 | - public function get_config_option( $config_option_name = '' ) { |
|
843 | + public function get_config_option($config_option_name = '') { |
|
844 | 844 | // retrieve the wp-option for this config class. |
845 | - $config_option = maybe_unserialize( get_option( $config_option_name, array() ) ); |
|
846 | - if ( empty( $config_option ) ) { |
|
847 | - EE_Config::log( $config_option_name . '-NOT-FOUND' ); |
|
845 | + $config_option = maybe_unserialize(get_option($config_option_name, array())); |
|
846 | + if (empty($config_option)) { |
|
847 | + EE_Config::log($config_option_name.'-NOT-FOUND'); |
|
848 | 848 | } |
849 | 849 | return $config_option; |
850 | 850 | } |
@@ -856,17 +856,17 @@ discard block |
||
856 | 856 | * |
857 | 857 | * @param string $config_option_name |
858 | 858 | */ |
859 | - public static function log( $config_option_name = '' ) { |
|
860 | - if ( ! empty( $config_option_name ) ) { |
|
861 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
859 | + public static function log($config_option_name = '') { |
|
860 | + if ( ! empty($config_option_name)) { |
|
861 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
862 | 862 | //copy incoming $_REQUEST and sanitize it so we can save it |
863 | 863 | $_request = $_REQUEST; |
864 | - array_walk_recursive( $_request, 'sanitize_text_field' ); |
|
865 | - $config_log[ (string) microtime( true ) ] = array( |
|
864 | + array_walk_recursive($_request, 'sanitize_text_field'); |
|
865 | + $config_log[(string) microtime(true)] = array( |
|
866 | 866 | 'config_name' => $config_option_name, |
867 | 867 | 'request' => $_request, |
868 | 868 | ); |
869 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
869 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
870 | 870 | } |
871 | 871 | } |
872 | 872 | |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | * reduces the size of the config log to the length specified by EE_Config::LOG_LENGTH |
878 | 878 | */ |
879 | 879 | public static function trim_log() { |
880 | - $config_log = get_option( EE_Config::LOG_NAME, array() ); |
|
881 | - $log_length = count( $config_log ); |
|
882 | - if ( $log_length > EE_Config::LOG_LENGTH ) { |
|
883 | - ksort( $config_log ); |
|
884 | - $config_log = array_slice( $config_log, $log_length - EE_Config::LOG_LENGTH, null, true ); |
|
885 | - update_option( EE_Config::LOG_NAME, $config_log ); |
|
880 | + $config_log = get_option(EE_Config::LOG_NAME, array()); |
|
881 | + $log_length = count($config_log); |
|
882 | + if ($log_length > EE_Config::LOG_LENGTH) { |
|
883 | + ksort($config_log); |
|
884 | + $config_log = array_slice($config_log, $log_length - EE_Config::LOG_LENGTH, null, true); |
|
885 | + update_option(EE_Config::LOG_NAME, $config_log); |
|
886 | 886 | } |
887 | 887 | } |
888 | 888 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | * @return string |
898 | 898 | */ |
899 | 899 | public static function get_page_for_posts() { |
900 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
901 | - if ( ! $page_for_posts ) { |
|
900 | + $page_for_posts = get_option('page_for_posts'); |
|
901 | + if ( ! $page_for_posts) { |
|
902 | 902 | return 'posts'; |
903 | 903 | } |
904 | 904 | /** @type WPDB $wpdb */ |
905 | 905 | global $wpdb; |
906 | 906 | $SQL = "SELECT post_name from $wpdb->posts WHERE post_type='posts' OR post_type='page' AND post_status='publish' AND ID=%d"; |
907 | - return $wpdb->get_var( $wpdb->prepare( $SQL, $page_for_posts ) ); |
|
907 | + return $wpdb->get_var($wpdb->prepare($SQL, $page_for_posts)); |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -960,17 +960,17 @@ discard block |
||
960 | 960 | ) |
961 | 961 | ) { |
962 | 962 | // grab list of installed widgets |
963 | - $widgets_to_register = glob( EE_WIDGETS . '*', GLOB_ONLYDIR ); |
|
963 | + $widgets_to_register = glob(EE_WIDGETS.'*', GLOB_ONLYDIR); |
|
964 | 964 | // filter list of modules to register |
965 | 965 | $widgets_to_register = apply_filters( |
966 | 966 | 'FHEE__EE_Config__register_widgets__widgets_to_register', |
967 | 967 | $widgets_to_register |
968 | 968 | ); |
969 | - if ( ! empty( $widgets_to_register ) ) { |
|
969 | + if ( ! empty($widgets_to_register)) { |
|
970 | 970 | // cycle thru widget folders |
971 | - foreach ( $widgets_to_register as $widget_path ) { |
|
971 | + foreach ($widgets_to_register as $widget_path) { |
|
972 | 972 | // add to list of installed widget modules |
973 | - EE_Config::register_ee_widget( $widget_path ); |
|
973 | + EE_Config::register_ee_widget($widget_path); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | // filter list of installed modules |
@@ -990,57 +990,57 @@ discard block |
||
990 | 990 | * @param string $widget_path - full path up to and including widget folder |
991 | 991 | * @return void |
992 | 992 | */ |
993 | - public static function register_ee_widget( $widget_path = null ) { |
|
994 | - do_action( 'AHEE__EE_Config__register_widget__begin', $widget_path ); |
|
993 | + public static function register_ee_widget($widget_path = null) { |
|
994 | + do_action('AHEE__EE_Config__register_widget__begin', $widget_path); |
|
995 | 995 | $widget_ext = '.widget.php'; |
996 | 996 | // make all separators match |
997 | - $widget_path = rtrim( str_replace( '/\\', DS, $widget_path ), DS ); |
|
997 | + $widget_path = rtrim(str_replace('/\\', DS, $widget_path), DS); |
|
998 | 998 | // does the file path INCLUDE the actual file name as part of the path ? |
999 | - if ( strpos( $widget_path, $widget_ext ) !== false ) { |
|
999 | + if (strpos($widget_path, $widget_ext) !== false) { |
|
1000 | 1000 | // grab and shortcode file name from directory name and break apart at dots |
1001 | - $file_name = explode( '.', basename( $widget_path ) ); |
|
1001 | + $file_name = explode('.', basename($widget_path)); |
|
1002 | 1002 | // take first segment from file name pieces and remove class prefix if it exists |
1003 | - $widget = strpos( $file_name[0], 'EEW_' ) === 0 ? substr( $file_name[0], 4 ) : $file_name[0]; |
|
1003 | + $widget = strpos($file_name[0], 'EEW_') === 0 ? substr($file_name[0], 4) : $file_name[0]; |
|
1004 | 1004 | // sanitize shortcode directory name |
1005 | - $widget = sanitize_key( $widget ); |
|
1005 | + $widget = sanitize_key($widget); |
|
1006 | 1006 | // now we need to rebuild the shortcode path |
1007 | - $widget_path = explode( DS, $widget_path ); |
|
1007 | + $widget_path = explode(DS, $widget_path); |
|
1008 | 1008 | // remove last segment |
1009 | - array_pop( $widget_path ); |
|
1009 | + array_pop($widget_path); |
|
1010 | 1010 | // glue it back together |
1011 | - $widget_path = implode( DS, $widget_path ); |
|
1011 | + $widget_path = implode(DS, $widget_path); |
|
1012 | 1012 | } else { |
1013 | 1013 | // grab and sanitize widget directory name |
1014 | - $widget = sanitize_key( basename( $widget_path ) ); |
|
1014 | + $widget = sanitize_key(basename($widget_path)); |
|
1015 | 1015 | } |
1016 | 1016 | // create classname from widget directory name |
1017 | - $widget = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $widget ) ) ); |
|
1017 | + $widget = str_replace(' ', '_', ucwords(str_replace('_', ' ', $widget))); |
|
1018 | 1018 | // add class prefix |
1019 | - $widget_class = 'EEW_' . $widget; |
|
1019 | + $widget_class = 'EEW_'.$widget; |
|
1020 | 1020 | // does the widget exist ? |
1021 | - if ( ! is_readable( $widget_path . DS . $widget_class . $widget_ext ) ) { |
|
1021 | + if ( ! is_readable($widget_path.DS.$widget_class.$widget_ext)) { |
|
1022 | 1022 | $msg = sprintf( |
1023 | 1023 | __( |
1024 | 1024 | 'The requested %s widget file could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', |
1025 | 1025 | 'event_espresso' |
1026 | 1026 | ), |
1027 | 1027 | $widget_class, |
1028 | - $widget_path . DS . $widget_class . $widget_ext |
|
1028 | + $widget_path.DS.$widget_class.$widget_ext |
|
1029 | 1029 | ); |
1030 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1030 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1031 | 1031 | return; |
1032 | 1032 | } |
1033 | 1033 | // load the widget class file |
1034 | - require_once( $widget_path . DS . $widget_class . $widget_ext ); |
|
1034 | + require_once($widget_path.DS.$widget_class.$widget_ext); |
|
1035 | 1035 | // verify that class exists |
1036 | - if ( ! class_exists( $widget_class ) ) { |
|
1037 | - $msg = sprintf( __( 'The requested %s widget class does not exist.', 'event_espresso' ), $widget_class ); |
|
1038 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1036 | + if ( ! class_exists($widget_class)) { |
|
1037 | + $msg = sprintf(__('The requested %s widget class does not exist.', 'event_espresso'), $widget_class); |
|
1038 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1039 | 1039 | return; |
1040 | 1040 | } |
1041 | - register_widget( $widget_class ); |
|
1041 | + register_widget($widget_class); |
|
1042 | 1042 | // add to array of registered widgets |
1043 | - EE_Registry::instance()->widgets->{$widget_class} = $widget_path . DS . $widget_class . $widget_ext; |
|
1043 | + EE_Registry::instance()->widgets->{$widget_class} = $widget_path.DS.$widget_class.$widget_ext; |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | |
@@ -1053,17 +1053,17 @@ discard block |
||
1053 | 1053 | */ |
1054 | 1054 | private function _register_shortcodes() { |
1055 | 1055 | // grab list of installed shortcodes |
1056 | - $shortcodes_to_register = glob( EE_SHORTCODES . '*', GLOB_ONLYDIR ); |
|
1056 | + $shortcodes_to_register = glob(EE_SHORTCODES.'*', GLOB_ONLYDIR); |
|
1057 | 1057 | // filter list of modules to register |
1058 | 1058 | $shortcodes_to_register = apply_filters( |
1059 | 1059 | 'FHEE__EE_Config__register_shortcodes__shortcodes_to_register', |
1060 | 1060 | $shortcodes_to_register |
1061 | 1061 | ); |
1062 | - if ( ! empty( $shortcodes_to_register ) ) { |
|
1062 | + if ( ! empty($shortcodes_to_register)) { |
|
1063 | 1063 | // cycle thru shortcode folders |
1064 | - foreach ( $shortcodes_to_register as $shortcode_path ) { |
|
1064 | + foreach ($shortcodes_to_register as $shortcode_path) { |
|
1065 | 1065 | // add to list of installed shortcode modules |
1066 | - EE_Config::register_shortcode( $shortcode_path ); |
|
1066 | + EE_Config::register_shortcode($shortcode_path); |
|
1067 | 1067 | } |
1068 | 1068 | } |
1069 | 1069 | // filter list of installed modules |
@@ -1082,64 +1082,64 @@ discard block |
||
1082 | 1082 | * @param string $shortcode_path - full path up to and including shortcode folder |
1083 | 1083 | * @return bool |
1084 | 1084 | */ |
1085 | - public static function register_shortcode( $shortcode_path = null ) { |
|
1086 | - do_action( 'AHEE__EE_Config__register_shortcode__begin', $shortcode_path ); |
|
1085 | + public static function register_shortcode($shortcode_path = null) { |
|
1086 | + do_action('AHEE__EE_Config__register_shortcode__begin', $shortcode_path); |
|
1087 | 1087 | $shortcode_ext = '.shortcode.php'; |
1088 | 1088 | // make all separators match |
1089 | - $shortcode_path = str_replace( array( '\\', '/' ), DS, $shortcode_path ); |
|
1089 | + $shortcode_path = str_replace(array('\\', '/'), DS, $shortcode_path); |
|
1090 | 1090 | // does the file path INCLUDE the actual file name as part of the path ? |
1091 | - if ( strpos( $shortcode_path, $shortcode_ext ) !== false ) { |
|
1091 | + if (strpos($shortcode_path, $shortcode_ext) !== false) { |
|
1092 | 1092 | // grab shortcode file name from directory name and break apart at dots |
1093 | - $shortcode_file = explode( '.', basename( $shortcode_path ) ); |
|
1093 | + $shortcode_file = explode('.', basename($shortcode_path)); |
|
1094 | 1094 | // take first segment from file name pieces and remove class prefix if it exists |
1095 | - $shortcode = strpos( $shortcode_file[0], 'EES_' ) === 0 |
|
1096 | - ? substr( $shortcode_file[0], 4 ) |
|
1095 | + $shortcode = strpos($shortcode_file[0], 'EES_') === 0 |
|
1096 | + ? substr($shortcode_file[0], 4) |
|
1097 | 1097 | : $shortcode_file[0]; |
1098 | 1098 | // sanitize shortcode directory name |
1099 | - $shortcode = sanitize_key( $shortcode ); |
|
1099 | + $shortcode = sanitize_key($shortcode); |
|
1100 | 1100 | // now we need to rebuild the shortcode path |
1101 | - $shortcode_path = explode( DS, $shortcode_path ); |
|
1101 | + $shortcode_path = explode(DS, $shortcode_path); |
|
1102 | 1102 | // remove last segment |
1103 | - array_pop( $shortcode_path ); |
|
1103 | + array_pop($shortcode_path); |
|
1104 | 1104 | // glue it back together |
1105 | - $shortcode_path = implode( DS, $shortcode_path ) . DS; |
|
1105 | + $shortcode_path = implode(DS, $shortcode_path).DS; |
|
1106 | 1106 | } else { |
1107 | 1107 | // we need to generate the filename based off of the folder name |
1108 | 1108 | // grab and sanitize shortcode directory name |
1109 | - $shortcode = sanitize_key( basename( $shortcode_path ) ); |
|
1110 | - $shortcode_path = rtrim( $shortcode_path, DS ) . DS; |
|
1109 | + $shortcode = sanitize_key(basename($shortcode_path)); |
|
1110 | + $shortcode_path = rtrim($shortcode_path, DS).DS; |
|
1111 | 1111 | } |
1112 | 1112 | // create classname from shortcode directory or file name |
1113 | - $shortcode = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $shortcode ) ) ); |
|
1113 | + $shortcode = str_replace(' ', '_', ucwords(str_replace('_', ' ', $shortcode))); |
|
1114 | 1114 | // add class prefix |
1115 | - $shortcode_class = 'EES_' . $shortcode; |
|
1115 | + $shortcode_class = 'EES_'.$shortcode; |
|
1116 | 1116 | // does the shortcode exist ? |
1117 | - if ( ! is_readable( $shortcode_path . DS . $shortcode_class . $shortcode_ext ) ) { |
|
1117 | + if ( ! is_readable($shortcode_path.DS.$shortcode_class.$shortcode_ext)) { |
|
1118 | 1118 | $msg = sprintf( |
1119 | 1119 | __( |
1120 | 1120 | 'The requested %s shortcode file could not be found or is not readable due to file permissions. It should be in %s', |
1121 | 1121 | 'event_espresso' |
1122 | 1122 | ), |
1123 | 1123 | $shortcode_class, |
1124 | - $shortcode_path . DS . $shortcode_class . $shortcode_ext |
|
1124 | + $shortcode_path.DS.$shortcode_class.$shortcode_ext |
|
1125 | 1125 | ); |
1126 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1126 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1127 | 1127 | return false; |
1128 | 1128 | } |
1129 | 1129 | // load the shortcode class file |
1130 | - require_once( $shortcode_path . $shortcode_class . $shortcode_ext ); |
|
1130 | + require_once($shortcode_path.$shortcode_class.$shortcode_ext); |
|
1131 | 1131 | // verify that class exists |
1132 | - if ( ! class_exists( $shortcode_class ) ) { |
|
1132 | + if ( ! class_exists($shortcode_class)) { |
|
1133 | 1133 | $msg = sprintf( |
1134 | - __( 'The requested %s shortcode class does not exist.', 'event_espresso' ), |
|
1134 | + __('The requested %s shortcode class does not exist.', 'event_espresso'), |
|
1135 | 1135 | $shortcode_class |
1136 | 1136 | ); |
1137 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1137 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1138 | 1138 | return false; |
1139 | 1139 | } |
1140 | - $shortcode = strtoupper( $shortcode ); |
|
1140 | + $shortcode = strtoupper($shortcode); |
|
1141 | 1141 | // add to array of registered shortcodes |
1142 | - EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path . $shortcode_class . $shortcode_ext; |
|
1142 | + EE_Registry::instance()->shortcodes->{$shortcode} = $shortcode_path.$shortcode_class.$shortcode_ext; |
|
1143 | 1143 | return true; |
1144 | 1144 | } |
1145 | 1145 | |
@@ -1153,22 +1153,22 @@ discard block |
||
1153 | 1153 | */ |
1154 | 1154 | private function _register_modules() { |
1155 | 1155 | // grab list of installed modules |
1156 | - $modules_to_register = glob( EE_MODULES . '*', GLOB_ONLYDIR ); |
|
1156 | + $modules_to_register = glob(EE_MODULES.'*', GLOB_ONLYDIR); |
|
1157 | 1157 | // filter list of modules to register |
1158 | 1158 | $modules_to_register = apply_filters( |
1159 | 1159 | 'FHEE__EE_Config__register_modules__modules_to_register', |
1160 | 1160 | $modules_to_register |
1161 | 1161 | ); |
1162 | - if ( ! empty( $modules_to_register ) ) { |
|
1162 | + if ( ! empty($modules_to_register)) { |
|
1163 | 1163 | // loop through folders |
1164 | - foreach ( $modules_to_register as $module_path ) { |
|
1164 | + foreach ($modules_to_register as $module_path) { |
|
1165 | 1165 | /**TEMPORARILY EXCLUDE gateways from modules for time being**/ |
1166 | 1166 | if ( |
1167 | - $module_path !== EE_MODULES . 'zzz-copy-this-module-template' |
|
1168 | - && $module_path !== EE_MODULES . 'gateways' |
|
1167 | + $module_path !== EE_MODULES.'zzz-copy-this-module-template' |
|
1168 | + && $module_path !== EE_MODULES.'gateways' |
|
1169 | 1169 | ) { |
1170 | 1170 | // add to list of installed modules |
1171 | - EE_Config::register_module( $module_path ); |
|
1171 | + EE_Config::register_module($module_path); |
|
1172 | 1172 | } |
1173 | 1173 | } |
1174 | 1174 | } |
@@ -1188,39 +1188,39 @@ discard block |
||
1188 | 1188 | * @param string $module_path - full path up to and including module folder |
1189 | 1189 | * @return bool |
1190 | 1190 | */ |
1191 | - public static function register_module( $module_path = null ) { |
|
1192 | - do_action( 'AHEE__EE_Config__register_module__begin', $module_path ); |
|
1191 | + public static function register_module($module_path = null) { |
|
1192 | + do_action('AHEE__EE_Config__register_module__begin', $module_path); |
|
1193 | 1193 | $module_ext = '.module.php'; |
1194 | 1194 | // make all separators match |
1195 | - $module_path = str_replace( array( '\\', '/' ), DS, $module_path ); |
|
1195 | + $module_path = str_replace(array('\\', '/'), DS, $module_path); |
|
1196 | 1196 | // does the file path INCLUDE the actual file name as part of the path ? |
1197 | - if ( strpos( $module_path, $module_ext ) !== false ) { |
|
1197 | + if (strpos($module_path, $module_ext) !== false) { |
|
1198 | 1198 | // grab and shortcode file name from directory name and break apart at dots |
1199 | - $module_file = explode( '.', basename( $module_path ) ); |
|
1199 | + $module_file = explode('.', basename($module_path)); |
|
1200 | 1200 | // now we need to rebuild the shortcode path |
1201 | - $module_path = explode( DS, $module_path ); |
|
1201 | + $module_path = explode(DS, $module_path); |
|
1202 | 1202 | // remove last segment |
1203 | - array_pop( $module_path ); |
|
1203 | + array_pop($module_path); |
|
1204 | 1204 | // glue it back together |
1205 | - $module_path = implode( DS, $module_path ) . DS; |
|
1205 | + $module_path = implode(DS, $module_path).DS; |
|
1206 | 1206 | // take first segment from file name pieces and sanitize it |
1207 | - $module = preg_replace( '/[^a-zA-Z0-9_\-]/', '', $module_file[0] ); |
|
1207 | + $module = preg_replace('/[^a-zA-Z0-9_\-]/', '', $module_file[0]); |
|
1208 | 1208 | // ensure class prefix is added |
1209 | - $module_class = strpos( $module, 'EED_' ) !== 0 ? 'EED_' . $module : $module; |
|
1209 | + $module_class = strpos($module, 'EED_') !== 0 ? 'EED_'.$module : $module; |
|
1210 | 1210 | } else { |
1211 | 1211 | // we need to generate the filename based off of the folder name |
1212 | 1212 | // grab and sanitize module name |
1213 | - $module = strtolower( basename( $module_path ) ); |
|
1214 | - $module = preg_replace( '/[^a-z0-9_\-]/', '', $module ); |
|
1213 | + $module = strtolower(basename($module_path)); |
|
1214 | + $module = preg_replace('/[^a-z0-9_\-]/', '', $module); |
|
1215 | 1215 | // like trailingslashit() |
1216 | - $module_path = rtrim( $module_path, DS ) . DS; |
|
1216 | + $module_path = rtrim($module_path, DS).DS; |
|
1217 | 1217 | // create classname from module directory name |
1218 | - $module = str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $module ) ) ); |
|
1218 | + $module = str_replace(' ', '_', ucwords(str_replace('_', ' ', $module))); |
|
1219 | 1219 | // add class prefix |
1220 | - $module_class = 'EED_' . $module; |
|
1220 | + $module_class = 'EED_'.$module; |
|
1221 | 1221 | } |
1222 | 1222 | // does the module exist ? |
1223 | - if ( ! is_readable( $module_path . DS . $module_class . $module_ext ) ) { |
|
1223 | + if ( ! is_readable($module_path.DS.$module_class.$module_ext)) { |
|
1224 | 1224 | $msg = sprintf( |
1225 | 1225 | __( |
1226 | 1226 | 'The requested %s module file could not be found or is not readable due to file permissions.', |
@@ -1228,19 +1228,19 @@ discard block |
||
1228 | 1228 | ), |
1229 | 1229 | $module |
1230 | 1230 | ); |
1231 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1231 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1232 | 1232 | return false; |
1233 | 1233 | } |
1234 | 1234 | // load the module class file |
1235 | - require_once( $module_path . $module_class . $module_ext ); |
|
1235 | + require_once($module_path.$module_class.$module_ext); |
|
1236 | 1236 | // verify that class exists |
1237 | - if ( ! class_exists( $module_class ) ) { |
|
1238 | - $msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class ); |
|
1239 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1237 | + if ( ! class_exists($module_class)) { |
|
1238 | + $msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class); |
|
1239 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1240 | 1240 | return false; |
1241 | 1241 | } |
1242 | 1242 | // add to array of registered modules |
1243 | - EE_Registry::instance()->modules->{$module_class} = $module_path . $module_class . $module_ext; |
|
1243 | + EE_Registry::instance()->modules->{$module_class} = $module_path.$module_class.$module_ext; |
|
1244 | 1244 | do_action( |
1245 | 1245 | 'AHEE__EE_Config__register_module__complete', |
1246 | 1246 | $module_class, |
@@ -1260,26 +1260,26 @@ discard block |
||
1260 | 1260 | */ |
1261 | 1261 | private function _initialize_shortcodes() { |
1262 | 1262 | // cycle thru shortcode folders |
1263 | - foreach ( EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path ) { |
|
1263 | + foreach (EE_Registry::instance()->shortcodes as $shortcode => $shortcode_path) { |
|
1264 | 1264 | // add class prefix |
1265 | - $shortcode_class = 'EES_' . $shortcode; |
|
1265 | + $shortcode_class = 'EES_'.$shortcode; |
|
1266 | 1266 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1267 | 1267 | // which set hooks ? |
1268 | - if ( is_admin() ) { |
|
1268 | + if (is_admin()) { |
|
1269 | 1269 | // fire immediately |
1270 | - call_user_func( array( $shortcode_class, 'set_hooks_admin' ) ); |
|
1270 | + call_user_func(array($shortcode_class, 'set_hooks_admin')); |
|
1271 | 1271 | } else { |
1272 | 1272 | // delay until other systems are online |
1273 | 1273 | add_action( |
1274 | 1274 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1275 | - array( $shortcode_class, 'set_hooks' ) |
|
1275 | + array($shortcode_class, 'set_hooks') |
|
1276 | 1276 | ); |
1277 | 1277 | // convert classname to UPPERCASE and create WP shortcode. |
1278 | - $shortcode_tag = strtoupper( $shortcode ); |
|
1278 | + $shortcode_tag = strtoupper($shortcode); |
|
1279 | 1279 | // but first check if the shortcode has already been added before assigning 'fallback_shortcode_processor' |
1280 | - if ( ! shortcode_exists( $shortcode_tag ) ) { |
|
1280 | + if ( ! shortcode_exists($shortcode_tag)) { |
|
1281 | 1281 | // NOTE: this shortcode declaration will get overridden if the shortcode is successfully detected in the post content in EE_Front_Controller->_initialize_shortcodes() |
1282 | - add_shortcode( $shortcode_tag, array( $shortcode_class, 'fallback_shortcode_processor' ) ); |
|
1282 | + add_shortcode($shortcode_tag, array($shortcode_class, 'fallback_shortcode_processor')); |
|
1283 | 1283 | } |
1284 | 1284 | } |
1285 | 1285 | } |
@@ -1296,17 +1296,17 @@ discard block |
||
1296 | 1296 | */ |
1297 | 1297 | private function _initialize_modules() { |
1298 | 1298 | // cycle thru shortcode folders |
1299 | - foreach ( EE_Registry::instance()->modules as $module_class => $module_path ) { |
|
1299 | + foreach (EE_Registry::instance()->modules as $module_class => $module_path) { |
|
1300 | 1300 | // fire the shortcode class's set_hooks methods in case it needs to hook into other parts of the system |
1301 | 1301 | // which set hooks ? |
1302 | - if ( is_admin() ) { |
|
1302 | + if (is_admin()) { |
|
1303 | 1303 | // fire immediately |
1304 | - call_user_func( array( $module_class, 'set_hooks_admin' ) ); |
|
1304 | + call_user_func(array($module_class, 'set_hooks_admin')); |
|
1305 | 1305 | } else { |
1306 | 1306 | // delay until other systems are online |
1307 | 1307 | add_action( |
1308 | 1308 | 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', |
1309 | - array( $module_class, 'set_hooks' ) |
|
1309 | + array($module_class, 'set_hooks') |
|
1310 | 1310 | ); |
1311 | 1311 | } |
1312 | 1312 | } |
@@ -1324,29 +1324,29 @@ discard block |
||
1324 | 1324 | * @param string $key - url param key indicating a route is being called |
1325 | 1325 | * @return bool |
1326 | 1326 | */ |
1327 | - public static function register_route( $route = null, $module = null, $method_name = null, $key = 'ee' ) { |
|
1328 | - do_action( 'AHEE__EE_Config__register_route__begin', $route, $module, $method_name ); |
|
1329 | - $module = str_replace( 'EED_', '', $module ); |
|
1330 | - $module_class = 'EED_' . $module; |
|
1331 | - if ( ! isset( EE_Registry::instance()->modules->{$module_class} ) ) { |
|
1332 | - $msg = sprintf( __( 'The module %s has not been registered.', 'event_espresso' ), $module ); |
|
1333 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1327 | + public static function register_route($route = null, $module = null, $method_name = null, $key = 'ee') { |
|
1328 | + do_action('AHEE__EE_Config__register_route__begin', $route, $module, $method_name); |
|
1329 | + $module = str_replace('EED_', '', $module); |
|
1330 | + $module_class = 'EED_'.$module; |
|
1331 | + if ( ! isset(EE_Registry::instance()->modules->{$module_class} )) { |
|
1332 | + $msg = sprintf(__('The module %s has not been registered.', 'event_espresso'), $module); |
|
1333 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1334 | 1334 | return false; |
1335 | 1335 | } |
1336 | - if ( empty( $route ) ) { |
|
1337 | - $msg = sprintf( __( 'No route has been supplied.', 'event_espresso' ), $route ); |
|
1338 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1336 | + if (empty($route)) { |
|
1337 | + $msg = sprintf(__('No route has been supplied.', 'event_espresso'), $route); |
|
1338 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1339 | 1339 | return false; |
1340 | 1340 | } |
1341 | - if ( ! method_exists( 'EED_' . $module, $method_name ) ) { |
|
1341 | + if ( ! method_exists('EED_'.$module, $method_name)) { |
|
1342 | 1342 | $msg = sprintf( |
1343 | - __( 'A valid class method for the %s route has not been supplied.', 'event_espresso' ), |
|
1343 | + __('A valid class method for the %s route has not been supplied.', 'event_espresso'), |
|
1344 | 1344 | $route |
1345 | 1345 | ); |
1346 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1346 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1347 | 1347 | return false; |
1348 | 1348 | } |
1349 | - EE_Config::$_module_route_map[ $key ][ $route ] = array( 'EED_' . $module, $method_name ); |
|
1349 | + EE_Config::$_module_route_map[$key][$route] = array('EED_'.$module, $method_name); |
|
1350 | 1350 | return true; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1360,11 +1360,11 @@ discard block |
||
1360 | 1360 | * @param string $key - url param key indicating a route is being called |
1361 | 1361 | * @return string |
1362 | 1362 | */ |
1363 | - public static function get_route( $route = null, $key = 'ee' ) { |
|
1364 | - do_action( 'AHEE__EE_Config__get_route__begin', $route ); |
|
1365 | - $route = (string) apply_filters( 'FHEE__EE_Config__get_route', $route ); |
|
1366 | - if ( isset( EE_Config::$_module_route_map[ $key ][ $route ] ) ) { |
|
1367 | - return EE_Config::$_module_route_map[ $key ][ $route ]; |
|
1363 | + public static function get_route($route = null, $key = 'ee') { |
|
1364 | + do_action('AHEE__EE_Config__get_route__begin', $route); |
|
1365 | + $route = (string) apply_filters('FHEE__EE_Config__get_route', $route); |
|
1366 | + if (isset(EE_Config::$_module_route_map[$key][$route])) { |
|
1367 | + return EE_Config::$_module_route_map[$key][$route]; |
|
1368 | 1368 | } |
1369 | 1369 | return null; |
1370 | 1370 | } |
@@ -1394,49 +1394,49 @@ discard block |
||
1394 | 1394 | * @param string $key - url param key indicating a route is being called |
1395 | 1395 | * @return bool |
1396 | 1396 | */ |
1397 | - public static function register_forward( $route = null, $status = 0, $forward = null, $key = 'ee' ) { |
|
1398 | - do_action( 'AHEE__EE_Config__register_forward', $route, $status, $forward ); |
|
1399 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1397 | + public static function register_forward($route = null, $status = 0, $forward = null, $key = 'ee') { |
|
1398 | + do_action('AHEE__EE_Config__register_forward', $route, $status, $forward); |
|
1399 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1400 | 1400 | $msg = sprintf( |
1401 | - __( 'The module route %s for this forward has not been registered.', 'event_espresso' ), |
|
1401 | + __('The module route %s for this forward has not been registered.', 'event_espresso'), |
|
1402 | 1402 | $route |
1403 | 1403 | ); |
1404 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1404 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1405 | 1405 | return false; |
1406 | 1406 | } |
1407 | - if ( empty( $forward ) ) { |
|
1408 | - $msg = sprintf( __( 'No forwarding route has been supplied.', 'event_espresso' ), $route ); |
|
1409 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1407 | + if (empty($forward)) { |
|
1408 | + $msg = sprintf(__('No forwarding route has been supplied.', 'event_espresso'), $route); |
|
1409 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1410 | 1410 | return false; |
1411 | 1411 | } |
1412 | - if ( is_array( $forward ) ) { |
|
1413 | - if ( ! isset( $forward[1] ) ) { |
|
1412 | + if (is_array($forward)) { |
|
1413 | + if ( ! isset($forward[1])) { |
|
1414 | 1414 | $msg = sprintf( |
1415 | - __( 'A class method for the %s forwarding route has not been supplied.', 'event_espresso' ), |
|
1415 | + __('A class method for the %s forwarding route has not been supplied.', 'event_espresso'), |
|
1416 | 1416 | $route |
1417 | 1417 | ); |
1418 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1418 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1419 | 1419 | return false; |
1420 | 1420 | } |
1421 | - if ( ! method_exists( $forward[0], $forward[1] ) ) { |
|
1421 | + if ( ! method_exists($forward[0], $forward[1])) { |
|
1422 | 1422 | $msg = sprintf( |
1423 | - __( 'The class method %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1423 | + __('The class method %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1424 | 1424 | $forward[1], |
1425 | 1425 | $route |
1426 | 1426 | ); |
1427 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1427 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1428 | 1428 | return false; |
1429 | 1429 | } |
1430 | - } else if ( ! function_exists( $forward ) ) { |
|
1430 | + } else if ( ! function_exists($forward)) { |
|
1431 | 1431 | $msg = sprintf( |
1432 | - __( 'The function %s for the %s forwarding route is in invalid.', 'event_espresso' ), |
|
1432 | + __('The function %s for the %s forwarding route is in invalid.', 'event_espresso'), |
|
1433 | 1433 | $forward, |
1434 | 1434 | $route |
1435 | 1435 | ); |
1436 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1436 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1437 | 1437 | return false; |
1438 | 1438 | } |
1439 | - EE_Config::$_module_forward_map[ $key ][ $route ][ absint( $status ) ] = $forward; |
|
1439 | + EE_Config::$_module_forward_map[$key][$route][absint($status)] = $forward; |
|
1440 | 1440 | return true; |
1441 | 1441 | } |
1442 | 1442 | |
@@ -1452,12 +1452,12 @@ discard block |
||
1452 | 1452 | * @param string $key - url param key indicating a route is being called |
1453 | 1453 | * @return string |
1454 | 1454 | */ |
1455 | - public static function get_forward( $route = null, $status = 0, $key = 'ee' ) { |
|
1456 | - do_action( 'AHEE__EE_Config__get_forward__begin', $route, $status ); |
|
1457 | - if ( isset( EE_Config::$_module_forward_map[ $key ][ $route ][ $status ] ) ) { |
|
1455 | + public static function get_forward($route = null, $status = 0, $key = 'ee') { |
|
1456 | + do_action('AHEE__EE_Config__get_forward__begin', $route, $status); |
|
1457 | + if (isset(EE_Config::$_module_forward_map[$key][$route][$status])) { |
|
1458 | 1458 | return apply_filters( |
1459 | 1459 | 'FHEE__EE_Config__get_forward', |
1460 | - EE_Config::$_module_forward_map[ $key ][ $route ][ $status ], |
|
1460 | + EE_Config::$_module_forward_map[$key][$route][$status], |
|
1461 | 1461 | $route, |
1462 | 1462 | $status |
1463 | 1463 | ); |
@@ -1479,17 +1479,17 @@ discard block |
||
1479 | 1479 | * @param string $key - url param key indicating a route is being called |
1480 | 1480 | * @return bool |
1481 | 1481 | */ |
1482 | - public static function register_view( $route = null, $status = 0, $view = null, $key = 'ee' ) { |
|
1483 | - do_action( 'AHEE__EE_Config__register_view__begin', $route, $status, $view ); |
|
1484 | - if ( ! isset( EE_Config::$_module_route_map[ $key ][ $route ] ) || empty( $route ) ) { |
|
1482 | + public static function register_view($route = null, $status = 0, $view = null, $key = 'ee') { |
|
1483 | + do_action('AHEE__EE_Config__register_view__begin', $route, $status, $view); |
|
1484 | + if ( ! isset(EE_Config::$_module_route_map[$key][$route]) || empty($route)) { |
|
1485 | 1485 | $msg = sprintf( |
1486 | - __( 'The module route %s for this view has not been registered.', 'event_espresso' ), |
|
1486 | + __('The module route %s for this view has not been registered.', 'event_espresso'), |
|
1487 | 1487 | $route |
1488 | 1488 | ); |
1489 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1489 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1490 | 1490 | return false; |
1491 | 1491 | } |
1492 | - if ( ! is_readable( $view ) ) { |
|
1492 | + if ( ! is_readable($view)) { |
|
1493 | 1493 | $msg = sprintf( |
1494 | 1494 | __( |
1495 | 1495 | 'The %s view file could not be found or is not readable due to file permissions.', |
@@ -1497,10 +1497,10 @@ discard block |
||
1497 | 1497 | ), |
1498 | 1498 | $view |
1499 | 1499 | ); |
1500 | - EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1500 | + EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__); |
|
1501 | 1501 | return false; |
1502 | 1502 | } |
1503 | - EE_Config::$_module_view_map[ $key ][ $route ][ absint( $status ) ] = $view; |
|
1503 | + EE_Config::$_module_view_map[$key][$route][absint($status)] = $view; |
|
1504 | 1504 | return true; |
1505 | 1505 | } |
1506 | 1506 | |
@@ -1516,12 +1516,12 @@ discard block |
||
1516 | 1516 | * @param string $key - url param key indicating a route is being called |
1517 | 1517 | * @return string |
1518 | 1518 | */ |
1519 | - public static function get_view( $route = null, $status = 0, $key = 'ee' ) { |
|
1520 | - do_action( 'AHEE__EE_Config__get_view__begin', $route, $status ); |
|
1521 | - if ( isset( EE_Config::$_module_view_map[ $key ][ $route ][ $status ] ) ) { |
|
1519 | + public static function get_view($route = null, $status = 0, $key = 'ee') { |
|
1520 | + do_action('AHEE__EE_Config__get_view__begin', $route, $status); |
|
1521 | + if (isset(EE_Config::$_module_view_map[$key][$route][$status])) { |
|
1522 | 1522 | return apply_filters( |
1523 | 1523 | 'FHEE__EE_Config__get_view', |
1524 | - EE_Config::$_module_view_map[ $key ][ $route ][ $status ], |
|
1524 | + EE_Config::$_module_view_map[$key][$route][$status], |
|
1525 | 1525 | $route, |
1526 | 1526 | $status |
1527 | 1527 | ); |
@@ -1532,7 +1532,7 @@ discard block |
||
1532 | 1532 | |
1533 | 1533 | |
1534 | 1534 | public function update_addon_option_names() { |
1535 | - update_option( EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names ); |
|
1535 | + update_option(EE_Config::ADDON_OPTION_NAMES, $this->_addon_option_names); |
|
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | |
@@ -1560,22 +1560,22 @@ discard block |
||
1560 | 1560 | * @return mixed if a detected type found return the escaped value, otherwise just the raw value is returned. |
1561 | 1561 | * @throws \EE_Error |
1562 | 1562 | */ |
1563 | - public function get_pretty( $property ) { |
|
1564 | - if ( ! property_exists( $this, $property ) ) { |
|
1563 | + public function get_pretty($property) { |
|
1564 | + if ( ! property_exists($this, $property)) { |
|
1565 | 1565 | throw new EE_Error( |
1566 | 1566 | sprintf( |
1567 | 1567 | __( |
1568 | 1568 | '%1$s::get_pretty() has been called with the property %2$s which does not exist on the %1$s config class.', |
1569 | 1569 | 'event_espresso' |
1570 | 1570 | ), |
1571 | - get_class( $this ), |
|
1571 | + get_class($this), |
|
1572 | 1572 | $property |
1573 | 1573 | ) |
1574 | 1574 | ); |
1575 | 1575 | } |
1576 | 1576 | //just handling escaping of strings for now. |
1577 | - if ( is_string( $this->{$property} ) ) { |
|
1578 | - return stripslashes( $this->{$property} ); |
|
1577 | + if (is_string($this->{$property} )) { |
|
1578 | + return stripslashes($this->{$property} ); |
|
1579 | 1579 | } |
1580 | 1580 | return $this->{$property}; |
1581 | 1581 | } |
@@ -1584,17 +1584,17 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | public function populate() { |
1586 | 1586 | //grab defaults via a new instance of this class. |
1587 | - $class_name = get_class( $this ); |
|
1587 | + $class_name = get_class($this); |
|
1588 | 1588 | $defaults = new $class_name; |
1589 | 1589 | //loop through the properties for this class and see if they are set. If they are NOT, then grab the |
1590 | 1590 | //default from our $defaults object. |
1591 | - foreach ( get_object_vars( $defaults ) as $property => $value ) { |
|
1592 | - if ( $this->{$property} === null ) { |
|
1591 | + foreach (get_object_vars($defaults) as $property => $value) { |
|
1592 | + if ($this->{$property} === null) { |
|
1593 | 1593 | $this->{$property} = $value; |
1594 | 1594 | } |
1595 | 1595 | } |
1596 | 1596 | //cleanup |
1597 | - unset( $defaults ); |
|
1597 | + unset($defaults); |
|
1598 | 1598 | } |
1599 | 1599 | |
1600 | 1600 | |
@@ -1610,7 +1610,7 @@ discard block |
||
1610 | 1610 | * @param $a |
1611 | 1611 | * @return bool |
1612 | 1612 | */ |
1613 | - public function __isset( $a ) { |
|
1613 | + public function __isset($a) { |
|
1614 | 1614 | return false; |
1615 | 1615 | } |
1616 | 1616 | |
@@ -1622,7 +1622,7 @@ discard block |
||
1622 | 1622 | * @param $a |
1623 | 1623 | * @return bool |
1624 | 1624 | */ |
1625 | - public function __unset( $a ) { |
|
1625 | + public function __unset($a) { |
|
1626 | 1626 | return false; |
1627 | 1627 | } |
1628 | 1628 | |
@@ -1733,7 +1733,7 @@ discard block |
||
1733 | 1733 | $this->current_blog_id = get_current_blog_id(); |
1734 | 1734 | $this->current_blog_id = $this->current_blog_id === NULL ? 1 : $this->current_blog_id; |
1735 | 1735 | $this->ee_ueip_optin = $this->_get_main_ee_ueip_optin(); |
1736 | - $this->ee_ueip_has_notified = is_main_site() ? get_option( 'ee_ueip_has_notified', false ) : true; |
|
1736 | + $this->ee_ueip_has_notified = is_main_site() ? get_option('ee_ueip_has_notified', false) : true; |
|
1737 | 1737 | $this->post_shortcodes = array(); |
1738 | 1738 | $this->module_route_map = array(); |
1739 | 1739 | $this->module_forward_map = array(); |
@@ -1749,9 +1749,9 @@ discard block |
||
1749 | 1749 | $this->thank_you_page_url = ''; |
1750 | 1750 | $this->cancel_page_url = ''; |
1751 | 1751 | //cpt slugs |
1752 | - $this->event_cpt_slug = __( 'events', 'event_espresso' ); |
|
1752 | + $this->event_cpt_slug = __('events', 'event_espresso'); |
|
1753 | 1753 | //ueip constant check |
1754 | - if ( defined( 'EE_DISABLE_UXIP' ) && EE_DISABLE_UXIP ) { |
|
1754 | + if (defined('EE_DISABLE_UXIP') && EE_DISABLE_UXIP) { |
|
1755 | 1755 | $this->ee_ueip_optin = false; |
1756 | 1756 | $this->ee_ueip_has_notified = true; |
1757 | 1757 | } |
@@ -1794,8 +1794,8 @@ discard block |
||
1794 | 1794 | * @return string |
1795 | 1795 | */ |
1796 | 1796 | public function reg_page_url() { |
1797 | - if ( ! $this->reg_page_url ) { |
|
1798 | - $this->reg_page_url = get_permalink( $this->reg_page_id ) . '#checkout'; |
|
1797 | + if ( ! $this->reg_page_url) { |
|
1798 | + $this->reg_page_url = get_permalink($this->reg_page_id).'#checkout'; |
|
1799 | 1799 | } |
1800 | 1800 | return $this->reg_page_url; |
1801 | 1801 | } |
@@ -1810,12 +1810,12 @@ discard block |
||
1810 | 1810 | * @access public |
1811 | 1811 | * @return string |
1812 | 1812 | */ |
1813 | - public function txn_page_url( $query_args = array() ) { |
|
1814 | - if ( ! $this->txn_page_url ) { |
|
1815 | - $this->txn_page_url = get_permalink( $this->txn_page_id ); |
|
1813 | + public function txn_page_url($query_args = array()) { |
|
1814 | + if ( ! $this->txn_page_url) { |
|
1815 | + $this->txn_page_url = get_permalink($this->txn_page_id); |
|
1816 | 1816 | } |
1817 | - if ( $query_args ) { |
|
1818 | - return add_query_arg( $query_args, $this->txn_page_url ); |
|
1817 | + if ($query_args) { |
|
1818 | + return add_query_arg($query_args, $this->txn_page_url); |
|
1819 | 1819 | } else { |
1820 | 1820 | return $this->txn_page_url; |
1821 | 1821 | } |
@@ -1831,12 +1831,12 @@ discard block |
||
1831 | 1831 | * @access public |
1832 | 1832 | * @return string |
1833 | 1833 | */ |
1834 | - public function thank_you_page_url( $query_args = array() ) { |
|
1835 | - if ( ! $this->thank_you_page_url ) { |
|
1836 | - $this->thank_you_page_url = get_permalink( $this->thank_you_page_id ); |
|
1834 | + public function thank_you_page_url($query_args = array()) { |
|
1835 | + if ( ! $this->thank_you_page_url) { |
|
1836 | + $this->thank_you_page_url = get_permalink($this->thank_you_page_id); |
|
1837 | 1837 | } |
1838 | - if ( $query_args ) { |
|
1839 | - return add_query_arg( $query_args, $this->thank_you_page_url ); |
|
1838 | + if ($query_args) { |
|
1839 | + return add_query_arg($query_args, $this->thank_you_page_url); |
|
1840 | 1840 | } else { |
1841 | 1841 | return $this->thank_you_page_url; |
1842 | 1842 | } |
@@ -1851,8 +1851,8 @@ discard block |
||
1851 | 1851 | * @return string |
1852 | 1852 | */ |
1853 | 1853 | public function cancel_page_url() { |
1854 | - if ( ! $this->cancel_page_url ) { |
|
1855 | - $this->cancel_page_url = get_permalink( $this->cancel_page_id ); |
|
1854 | + if ( ! $this->cancel_page_url) { |
|
1855 | + $this->cancel_page_url = get_permalink($this->cancel_page_id); |
|
1856 | 1856 | } |
1857 | 1857 | return $this->cancel_page_url; |
1858 | 1858 | } |
@@ -1881,22 +1881,22 @@ discard block |
||
1881 | 1881 | */ |
1882 | 1882 | protected function _get_main_ee_ueip_optin() { |
1883 | 1883 | //if this is the main site then we can just bypass our direct query. |
1884 | - if ( is_main_site() ) { |
|
1885 | - return get_option( 'ee_ueip_optin', false ); |
|
1884 | + if (is_main_site()) { |
|
1885 | + return get_option('ee_ueip_optin', false); |
|
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | //is this already cached for this request? If so use it. |
1889 | - if ( ! empty( EE_Core_Config::$ee_ueip_option ) ) { |
|
1889 | + if ( ! empty(EE_Core_Config::$ee_ueip_option)) { |
|
1890 | 1890 | return EE_Core_Config::$ee_ueip_option; |
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | global $wpdb; |
1894 | 1894 | $current_network_main_site = is_multisite() ? get_current_site() : null; |
1895 | - $current_main_site_id = ! empty( $current_network_main_site ) ? $current_network_main_site->blog_id : 1; |
|
1895 | + $current_main_site_id = ! empty($current_network_main_site) ? $current_network_main_site->blog_id : 1; |
|
1896 | 1896 | $option = 'ee_ueip_optin'; |
1897 | 1897 | |
1898 | 1898 | //set correct table for query |
1899 | - $table_name = $wpdb->get_blog_prefix( $current_main_site_id ) . 'options'; |
|
1899 | + $table_name = $wpdb->get_blog_prefix($current_main_site_id).'options'; |
|
1900 | 1900 | |
1901 | 1901 | |
1902 | 1902 | //rather than getting blog option for the $current_main_site_id, we do a direct $wpdb query because |
@@ -1904,20 +1904,20 @@ discard block |
||
1904 | 1904 | //re-constructed on the blog switch. Note, we are still executing any core wp filters on this option retrieval. |
1905 | 1905 | //this bit of code is basically a direct copy of get_option without any caching because we are NOT switched to the blog |
1906 | 1906 | //for the purpose of caching. |
1907 | - $pre = apply_filters( 'pre_option_' . $option, false, $option ); |
|
1908 | - if ( false !== $pre ) { |
|
1907 | + $pre = apply_filters('pre_option_'.$option, false, $option); |
|
1908 | + if (false !== $pre) { |
|
1909 | 1909 | EE_Core_Config::$ee_ueip_option = $pre; |
1910 | 1910 | return EE_Core_Config::$ee_ueip_option; |
1911 | 1911 | } |
1912 | 1912 | |
1913 | - $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option ) ); |
|
1914 | - if ( is_object( $row ) ) { |
|
1913 | + $row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $table_name WHERE option_name = %s LIMIT 1", $option)); |
|
1914 | + if (is_object($row)) { |
|
1915 | 1915 | $value = $row->option_value; |
1916 | 1916 | } else { //option does not exist so use default. |
1917 | - return apply_filters( 'default_option_' . $option, false, $option ); |
|
1917 | + return apply_filters('default_option_'.$option, false, $option); |
|
1918 | 1918 | } |
1919 | 1919 | |
1920 | - EE_Core_Config::$ee_ueip_option = apply_filters( 'option_' . $option, maybe_unserialize( $value ), $option ); |
|
1920 | + EE_Core_Config::$ee_ueip_option = apply_filters('option_'.$option, maybe_unserialize($value), $option); |
|
1921 | 1921 | return EE_Core_Config::$ee_ueip_option; |
1922 | 1922 | } |
1923 | 1923 | |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | //reset all url properties |
1934 | 1934 | $this->_reset_urls(); |
1935 | 1935 | //return what to save to db |
1936 | - return array_keys( get_object_vars( $this ) ); |
|
1936 | + return array_keys(get_object_vars($this)); |
|
1937 | 1937 | } |
1938 | 1938 | |
1939 | 1939 | } |
@@ -2081,14 +2081,14 @@ discard block |
||
2081 | 2081 | */ |
2082 | 2082 | public function __construct() { |
2083 | 2083 | // set default organization settings |
2084 | - $this->name = get_bloginfo( 'name' ); |
|
2084 | + $this->name = get_bloginfo('name'); |
|
2085 | 2085 | $this->address_1 = '123 Onna Road'; |
2086 | 2086 | $this->address_2 = 'PO Box 123'; |
2087 | 2087 | $this->city = 'Inna City'; |
2088 | 2088 | $this->STA_ID = 4; |
2089 | 2089 | $this->CNT_ISO = 'US'; |
2090 | 2090 | $this->zip = '12345'; |
2091 | - $this->email = get_bloginfo( 'admin_email' ); |
|
2091 | + $this->email = get_bloginfo('admin_email'); |
|
2092 | 2092 | $this->phone = ''; |
2093 | 2093 | $this->vat = '123456789'; |
2094 | 2094 | $this->logo_url = ''; |
@@ -2176,44 +2176,44 @@ discard block |
||
2176 | 2176 | * @param string $CNT_ISO |
2177 | 2177 | * @return \EE_Currency_Config |
2178 | 2178 | */ |
2179 | - public function __construct( $CNT_ISO = '' ) { |
|
2179 | + public function __construct($CNT_ISO = '') { |
|
2180 | 2180 | // get country code from organization settings or use default |
2181 | - $ORG_CNT = isset( EE_Registry::instance()->CFG->organization ) |
|
2181 | + $ORG_CNT = isset(EE_Registry::instance()->CFG->organization) |
|
2182 | 2182 | && EE_Registry::instance()->CFG->organization instanceof EE_Organization_Config |
2183 | 2183 | ? EE_Registry::instance()->CFG->organization->CNT_ISO |
2184 | 2184 | : ''; |
2185 | 2185 | // but override if requested |
2186 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : $ORG_CNT; |
|
2186 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : $ORG_CNT; |
|
2187 | 2187 | // so if that all went well, and we are not in M-Mode (cuz you can't query the db in M-Mode) and double-check the countries table exists |
2188 | 2188 | if ( |
2189 | - ! empty( $CNT_ISO ) |
|
2189 | + ! empty($CNT_ISO) |
|
2190 | 2190 | && EE_Maintenance_Mode::instance()->models_can_query() |
2191 | - && EEH_Activation::table_exists( EE_Registry::instance()->load_model( 'Country' )->table() ) |
|
2191 | + && EEH_Activation::table_exists(EE_Registry::instance()->load_model('Country')->table()) |
|
2192 | 2192 | ) { |
2193 | 2193 | // retrieve the country settings from the db, just in case they have been customized |
2194 | - $country = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $CNT_ISO ); |
|
2195 | - if ( $country instanceof EE_Country ) { |
|
2196 | - $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | - $this->name = $country->currency_name_single(); // Dollar |
|
2198 | - $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | - $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | - $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | - $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | - $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | - $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2194 | + $country = EE_Registry::instance()->load_model('Country')->get_one_by_ID($CNT_ISO); |
|
2195 | + if ($country instanceof EE_Country) { |
|
2196 | + $this->code = $country->currency_code(); // currency code: USD, CAD, EUR |
|
2197 | + $this->name = $country->currency_name_single(); // Dollar |
|
2198 | + $this->plural = $country->currency_name_plural(); // Dollars |
|
2199 | + $this->sign = $country->currency_sign(); // currency sign: $ |
|
2200 | + $this->sign_b4 = $country->currency_sign_before(); // currency sign before or after: $TRUE or FALSE$ |
|
2201 | + $this->dec_plc = $country->currency_decimal_places(); // decimal places: 2 = 0.00 3 = 0.000 |
|
2202 | + $this->dec_mrk = $country->currency_decimal_mark(); // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2203 | + $this->thsnds = $country->currency_thousands_separator(); // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2204 | 2204 | } |
2205 | 2205 | } |
2206 | 2206 | // fallback to hardcoded defaults, in case the above failed |
2207 | - if ( empty( $this->code ) ) { |
|
2207 | + if (empty($this->code)) { |
|
2208 | 2208 | // set default currency settings |
2209 | - $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | - $this->name = __( 'Dollar', 'event_espresso' ); // Dollar |
|
2211 | - $this->plural = __( 'Dollars', 'event_espresso' ); // Dollars |
|
2212 | - $this->sign = '$'; // currency sign: $ |
|
2213 | - $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | - $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | - $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | - $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2209 | + $this->code = 'USD'; // currency code: USD, CAD, EUR |
|
2210 | + $this->name = __('Dollar', 'event_espresso'); // Dollar |
|
2211 | + $this->plural = __('Dollars', 'event_espresso'); // Dollars |
|
2212 | + $this->sign = '$'; // currency sign: $ |
|
2213 | + $this->sign_b4 = true; // currency sign before or after: $TRUE or FALSE$ |
|
2214 | + $this->dec_plc = 2; // decimal places: 2 = 0.00 3 = 0.000 |
|
2215 | + $this->dec_mrk = '.'; // decimal mark: (comma) ',' = 0,01 or (decimal) '.' = 0.01 |
|
2216 | + $this->thsnds = ','; // thousands separator: (comma) ',' = 1,000 or (decimal) '.' = 1.000 |
|
2217 | 2217 | } |
2218 | 2218 | } |
2219 | 2219 | } |
@@ -2376,7 +2376,7 @@ discard block |
||
2376 | 2376 | * @since 4.8.8.rc.019 |
2377 | 2377 | */ |
2378 | 2378 | public function do_hooks() { |
2379 | - add_action( 'AHEE__EE_Config___load_core_config__end', array( $this, 'set_default_reg_status_on_EEM_Event' ) ); |
|
2379 | + add_action('AHEE__EE_Config___load_core_config__end', array($this, 'set_default_reg_status_on_EEM_Event')); |
|
2380 | 2380 | } |
2381 | 2381 | |
2382 | 2382 | |
@@ -2385,7 +2385,7 @@ discard block |
||
2385 | 2385 | * @return void |
2386 | 2386 | */ |
2387 | 2387 | public function set_default_reg_status_on_EEM_Event() { |
2388 | - EEM_Event::set_default_reg_status( $this->default_STS_ID ); |
|
2388 | + EEM_Event::set_default_reg_status($this->default_STS_ID); |
|
2389 | 2389 | } |
2390 | 2390 | |
2391 | 2391 | |
@@ -2490,10 +2490,10 @@ discard block |
||
2490 | 2490 | * @param bool $reset |
2491 | 2491 | * @return string |
2492 | 2492 | */ |
2493 | - public function log_file_name( $reset = false ) { |
|
2494 | - if ( empty( $this->log_file_name ) || $reset ) { |
|
2495 | - $this->log_file_name = sanitize_key( 'espresso_log_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2496 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2493 | + public function log_file_name($reset = false) { |
|
2494 | + if (empty($this->log_file_name) || $reset) { |
|
2495 | + $this->log_file_name = sanitize_key('espresso_log_'.md5(uniqid('', true))).'.txt'; |
|
2496 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2497 | 2497 | } |
2498 | 2498 | return $this->log_file_name; |
2499 | 2499 | } |
@@ -2504,10 +2504,10 @@ discard block |
||
2504 | 2504 | * @param bool $reset |
2505 | 2505 | * @return string |
2506 | 2506 | */ |
2507 | - public function debug_file_name( $reset = false ) { |
|
2508 | - if ( empty( $this->debug_file_name ) || $reset ) { |
|
2509 | - $this->debug_file_name = sanitize_key( 'espresso_debug_' . md5( uniqid( '', true ) ) ) . '.txt'; |
|
2510 | - EE_Config::instance()->update_espresso_config( false, false ); |
|
2507 | + public function debug_file_name($reset = false) { |
|
2508 | + if (empty($this->debug_file_name) || $reset) { |
|
2509 | + $this->debug_file_name = sanitize_key('espresso_debug_'.md5(uniqid('', true))).'.txt'; |
|
2510 | + EE_Config::instance()->update_espresso_config(false, false); |
|
2511 | 2511 | } |
2512 | 2512 | return $this->debug_file_name; |
2513 | 2513 | } |
@@ -2679,21 +2679,21 @@ discard block |
||
2679 | 2679 | // set default map settings |
2680 | 2680 | $this->use_google_maps = true; |
2681 | 2681 | // for event details pages (reg page) |
2682 | - $this->event_details_map_width = 585; // ee_map_width_single |
|
2683 | - $this->event_details_map_height = 362; // ee_map_height_single |
|
2684 | - $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2685 | - $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2686 | - $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2687 | - $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2688 | - $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2682 | + $this->event_details_map_width = 585; // ee_map_width_single |
|
2683 | + $this->event_details_map_height = 362; // ee_map_height_single |
|
2684 | + $this->event_details_map_zoom = 14; // ee_map_zoom_single |
|
2685 | + $this->event_details_display_nav = true; // ee_map_nav_display_single |
|
2686 | + $this->event_details_nav_size = false; // ee_map_nav_size_single |
|
2687 | + $this->event_details_control_type = 'default'; // ee_map_type_control_single |
|
2688 | + $this->event_details_map_align = 'center'; // ee_map_align_single |
|
2689 | 2689 | // for event list pages |
2690 | - $this->event_list_map_width = 300; // ee_map_width |
|
2691 | - $this->event_list_map_height = 185; // ee_map_height |
|
2692 | - $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2693 | - $this->event_list_display_nav = false; // ee_map_nav_display |
|
2694 | - $this->event_list_nav_size = true; // ee_map_nav_size |
|
2695 | - $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2696 | - $this->event_list_map_align = 'center'; // ee_map_align |
|
2690 | + $this->event_list_map_width = 300; // ee_map_width |
|
2691 | + $this->event_list_map_height = 185; // ee_map_height |
|
2692 | + $this->event_list_map_zoom = 12; // ee_map_zoom |
|
2693 | + $this->event_list_display_nav = false; // ee_map_nav_display |
|
2694 | + $this->event_list_nav_size = true; // ee_map_nav_size |
|
2695 | + $this->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
2696 | + $this->event_list_map_align = 'center'; // ee_map_align |
|
2697 | 2697 | } |
2698 | 2698 | |
2699 | 2699 | } |
@@ -2846,7 +2846,7 @@ discard block |
||
2846 | 2846 | * @return void |
2847 | 2847 | */ |
2848 | 2848 | protected function _set_php_values() { |
2849 | - $this->php->max_input_vars = ini_get( 'max_input_vars' ); |
|
2849 | + $this->php->max_input_vars = ini_get('max_input_vars'); |
|
2850 | 2850 | $this->php->version = phpversion(); |
2851 | 2851 | } |
2852 | 2852 | |
@@ -2865,10 +2865,10 @@ discard block |
||
2865 | 2865 | * @type string $msg Any message to be displayed. |
2866 | 2866 | * } |
2867 | 2867 | */ |
2868 | - public function max_input_vars_limit_check( $input_count = 0 ) { |
|
2869 | - if ( ! empty( $this->php->max_input_vars ) |
|
2870 | - && ( $input_count >= $this->php->max_input_vars ) |
|
2871 | - && ( PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9 ) |
|
2868 | + public function max_input_vars_limit_check($input_count = 0) { |
|
2869 | + if ( ! empty($this->php->max_input_vars) |
|
2870 | + && ($input_count >= $this->php->max_input_vars) |
|
2871 | + && (PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3 && PHP_RELEASE_VERSION >= 9) |
|
2872 | 2872 | ) { |
2873 | 2873 | return sprintf( |
2874 | 2874 | __( |
@@ -2934,7 +2934,7 @@ discard block |
||
2934 | 2934 | */ |
2935 | 2935 | public function __construct() { |
2936 | 2936 | $this->payment_settings = array(); |
2937 | - $this->active_gateways = array( 'Invoice' => false ); |
|
2937 | + $this->active_gateways = array('Invoice' => false); |
|
2938 | 2938 | } |
2939 | 2939 | } |
2940 | 2940 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,31 +14,31 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{ |
|
17 | +class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
21 | 21 | * @param EE_Payment_Method $payment_method |
22 | 22 | * @param array $options_array @see EE_Form_Section_Proper::__construct() |
23 | 23 | */ |
24 | - public function __construct( EE_Payment_Method $payment_method, $options_array= array()){ |
|
24 | + public function __construct(EE_Payment_Method $payment_method, $options_array = array()) { |
|
25 | 25 | $options_array['subsections'] = array_merge( |
26 | 26 | array( |
27 | - 'first_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ), |
|
28 | - 'last_name' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ), |
|
29 | - 'email' => new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ), |
|
30 | - 'address' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )), |
|
31 | - 'address2' => new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )), |
|
32 | - 'city' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ), |
|
33 | - 'state' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ), |
|
34 | - 'country' => apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ), |
|
35 | - 'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ), |
|
36 | - 'phone' => new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )), |
|
27 | + 'first_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))), |
|
28 | + 'last_name' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))), |
|
29 | + 'email' => new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))), |
|
30 | + 'address' => new EE_Text_Input(array('html_label_text'=> __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')), |
|
31 | + 'address2' => new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')), |
|
32 | + 'city' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))), |
|
33 | + 'state' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))), |
|
34 | + 'country' => apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))), |
|
35 | + 'zip' => new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))), |
|
36 | + 'phone' => new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))), |
|
37 | 37 | ), |
38 | - isset( $options_array['subsections'] ) ? $options_array['subsections'] : array() |
|
38 | + isset($options_array['subsections']) ? $options_array['subsections'] : array() |
|
39 | 39 | ); |
40 | 40 | |
41 | - parent::__construct( $payment_method, $options_array ); |
|
41 | + parent::__construct($payment_method, $options_array); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * Sets the defaults for the billing form according to the attendee's details |
47 | 47 | * @param EE_Attendee $attendee |
48 | 48 | */ |
49 | - public function populate_from_attendee( $attendee ){ |
|
49 | + public function populate_from_attendee($attendee) { |
|
50 | 50 | $attendee = EEM_Attendee::instance()->ensure_is_obj($attendee); |
51 | 51 | /** @var $attendee EE_Attendee */ |
52 | 52 | $this->populate_defaults( |
53 | - apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
53 | + apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee', |
|
54 | 54 | array( |
55 | 55 | 'first_name'=>$attendee->fname(), |
56 | 56 | 'last_name'=>$attendee->lname(), |
@@ -78,48 +78,48 @@ discard block |
||
78 | 78 | * @param \EE_Attendee $attendee - the attendee object to copy details to |
79 | 79 | * @return \EE_Attendee |
80 | 80 | */ |
81 | - public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){ |
|
81 | + public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) { |
|
82 | 82 | // grab billing form data |
83 | 83 | $data = $this->valid_data(); |
84 | 84 | // copy first_name |
85 | - if ( ! empty( $data['first_name'] )) { |
|
86 | - $attendee->set_fname( $data['first_name'] ); |
|
85 | + if ( ! empty($data['first_name'])) { |
|
86 | + $attendee->set_fname($data['first_name']); |
|
87 | 87 | } |
88 | 88 | // copy last_name |
89 | - if ( ! empty( $data['last_name'] )) { |
|
90 | - $attendee->set_lname( $data['last_name'] ); |
|
89 | + if ( ! empty($data['last_name'])) { |
|
90 | + $attendee->set_lname($data['last_name']); |
|
91 | 91 | } |
92 | 92 | // copy email |
93 | - if ( ! empty( $data['email'] )) { |
|
94 | - $attendee->set_email( $data['email'] ); |
|
93 | + if ( ! empty($data['email'])) { |
|
94 | + $attendee->set_email($data['email']); |
|
95 | 95 | } |
96 | 96 | // copy address |
97 | - if ( ! empty( $data['address'] )) { |
|
98 | - $attendee->set_address( $data['address'] ); |
|
97 | + if ( ! empty($data['address'])) { |
|
98 | + $attendee->set_address($data['address']); |
|
99 | 99 | } |
100 | 100 | // copy address2 |
101 | - if ( ! empty( $data['address2'] )) { |
|
102 | - $attendee->set_address2( $data['address2'] ); |
|
101 | + if ( ! empty($data['address2'])) { |
|
102 | + $attendee->set_address2($data['address2']); |
|
103 | 103 | } |
104 | 104 | // copy city |
105 | - if ( ! empty( $data['city'] )) { |
|
106 | - $attendee->set_city( $data['city'] ); |
|
105 | + if ( ! empty($data['city'])) { |
|
106 | + $attendee->set_city($data['city']); |
|
107 | 107 | } |
108 | 108 | // copy state |
109 | - if ( ! empty( $data['state'] )) { |
|
110 | - $attendee->set_state( $data['state'] ); |
|
109 | + if ( ! empty($data['state'])) { |
|
110 | + $attendee->set_state($data['state']); |
|
111 | 111 | } |
112 | 112 | // copy country |
113 | - if ( ! empty( $data['country'] )) { |
|
114 | - $attendee->set_country( $data['country'] ); |
|
113 | + if ( ! empty($data['country'])) { |
|
114 | + $attendee->set_country($data['country']); |
|
115 | 115 | } |
116 | 116 | // copy zip |
117 | - if ( ! empty( $data['zip'] )) { |
|
118 | - $attendee->set_zip( $data['zip'] ); |
|
117 | + if ( ! empty($data['zip'])) { |
|
118 | + $attendee->set_zip($data['zip']); |
|
119 | 119 | } |
120 | 120 | // copy phone |
121 | - if ( ! empty( $data['phone'] )) { |
|
122 | - $attendee->set_phone( $data['phone'] ); |
|
121 | + if ( ! empty($data['phone'])) { |
|
122 | + $attendee->set_phone($data['phone']); |
|
123 | 123 | } |
124 | 124 | return $attendee; |
125 | 125 | } |
@@ -130,20 +130,20 @@ discard block |
||
130 | 130 | * uses info from the billing form to create a new attendee |
131 | 131 | * @return \EE_Attendee |
132 | 132 | */ |
133 | - public function create_attendee_from_billing_form_data(){ |
|
133 | + public function create_attendee_from_billing_form_data() { |
|
134 | 134 | // grab billing form data |
135 | 135 | $data = $this->valid_data(); |
136 | - return EE_Attendee::new_instance( array( |
|
137 | - 'ATT_fname' => ! empty( $data['first_name'] ) ? $data['first_name'] : '', |
|
138 | - 'ATT_lname' => ! empty( $data['last_name'] ) ? $data['last_name'] : '', |
|
139 | - 'ATT_email' => ! empty( $data['email'] ) ? $data['email'] : '', |
|
140 | - 'ATT_address' => ! empty( $data['address'] ) ? $data['address'] : '', |
|
141 | - 'ATT_address2' => ! empty( $data['address2'] ) ? $data['address2'] : '', |
|
142 | - 'ATT_city' => ! empty( $data['city'] ) ? $data['city'] : '', |
|
143 | - 'STA_ID' => ! empty( $data['state'] ) ? $data['state'] : '', |
|
144 | - 'CNT_ISO' => ! empty( $data['country'] ) ? $data['country'] : '', |
|
145 | - 'ATT_zip' => ! empty( $data['zip'] ) ? $data['zip'] : '', |
|
146 | - 'ATT_phone' => ! empty( $data['phone'] ) ? $data['phone'] : '', |
|
136 | + return EE_Attendee::new_instance(array( |
|
137 | + 'ATT_fname' => ! empty($data['first_name']) ? $data['first_name'] : '', |
|
138 | + 'ATT_lname' => ! empty($data['last_name']) ? $data['last_name'] : '', |
|
139 | + 'ATT_email' => ! empty($data['email']) ? $data['email'] : '', |
|
140 | + 'ATT_address' => ! empty($data['address']) ? $data['address'] : '', |
|
141 | + 'ATT_address2' => ! empty($data['address2']) ? $data['address2'] : '', |
|
142 | + 'ATT_city' => ! empty($data['city']) ? $data['city'] : '', |
|
143 | + 'STA_ID' => ! empty($data['state']) ? $data['state'] : '', |
|
144 | + 'CNT_ISO' => ! empty($data['country']) ? $data['country'] : '', |
|
145 | + 'ATT_zip' => ! empty($data['zip']) ? $data['zip'] : '', |
|
146 | + 'ATT_phone' => ! empty($data['phone']) ? $data['phone'] : '', |
|
147 | 147 | )); |
148 | 148 | } |
149 | 149 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit( 'No direct script access allowed' ); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
2 | 2 | /** |
3 | 3 | * Class EE_Select_Reveal_Input |
4 | 4 | * |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 4.6 |
12 | 12 | * |
13 | 13 | */ |
14 | -class EE_Select_Reveal_Input extends EE_Select_Input{ |
|
14 | +class EE_Select_Reveal_Input extends EE_Select_Input { |
|
15 | 15 | |
16 | 16 | /** |
17 | 17 | * @param array $answer_options Array keys which match a sibling section's name |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param array $input_settings |
28 | 28 | */ |
29 | - public function __construct( $answer_options, $input_settings = array() ){ |
|
30 | - parent::__construct( $answer_options, $input_settings ); |
|
29 | + public function __construct($answer_options, $input_settings = array()) { |
|
30 | + parent::__construct($answer_options, $input_settings); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function sibling_sections_controlled() { |
38 | 38 | $sibling_sections = array(); |
39 | - foreach( $this->options() as $sibling_section_name => $sibling_section ) { |
|
39 | + foreach ($this->options() as $sibling_section_name => $sibling_section) { |
|
40 | 40 | //if it's an empty string just leave it alone |
41 | - if( empty( $sibling_section_name ) ) { |
|
41 | + if (empty($sibling_section_name)) { |
|
42 | 42 | continue; |
43 | 43 | } |
44 | - $sibling_section = $this->find_section_from_path( '../' . $sibling_section_name ); |
|
45 | - if( |
|
44 | + $sibling_section = $this->find_section_from_path('../'.$sibling_section_name); |
|
45 | + if ( |
|
46 | 46 | $sibling_section instanceof EE_Form_Section_Base |
47 | - && ! empty( $sibling_section_name ) |
|
47 | + && ! empty($sibling_section_name) |
|
48 | 48 | ) { |
49 | - $sibling_sections[ $sibling_section_name ] = $sibling_section; |
|
49 | + $sibling_sections[$sibling_section_name] = $sibling_section; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | return $sibling_sections; |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param array $form_other_js_data |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
63 | - $form_other_js_data = parent::get_other_js_data( $form_other_js_data ); |
|
64 | - if( ! isset($form_other_js_data[ 'select_reveal_inputs' ] ) ) { |
|
65 | - $form_other_js_data[ 'select_reveal_inputs' ] = array(); |
|
62 | + public function get_other_js_data($form_other_js_data = array()) { |
|
63 | + $form_other_js_data = parent::get_other_js_data($form_other_js_data); |
|
64 | + if ( ! isset($form_other_js_data['select_reveal_inputs'])) { |
|
65 | + $form_other_js_data['select_reveal_inputs'] = array(); |
|
66 | 66 | } |
67 | 67 | $sibling_input_to_html_id_map = array(); |
68 | - foreach( $this->sibling_sections_controlled() as $sibling_section_path => $sibling_section ) { |
|
69 | - $sibling_input_to_html_id_map[ $sibling_section_path ] = $sibling_section->html_id(); |
|
68 | + foreach ($this->sibling_sections_controlled() as $sibling_section_path => $sibling_section) { |
|
69 | + $sibling_input_to_html_id_map[$sibling_section_path] = $sibling_section->html_id(); |
|
70 | 70 | } |
71 | - $form_other_js_data[ 'select_reveal_inputs' ][ $this->html_id() ] = $sibling_input_to_html_id_map; |
|
71 | + $form_other_js_data['select_reveal_inputs'][$this->html_id()] = $sibling_input_to_html_id_map; |
|
72 | 72 | return $form_other_js_data; |
73 | 73 | } |
74 | 74 |
@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - public function layout_form_begin( $additional_args = array() ) { |
|
16 | + public function layout_form_begin($additional_args = array()) { |
|
17 | 17 | $this->_form_section->set_html_class('form-table'); |
18 | - return parent::layout_form_begin( $additional_args ); |
|
18 | + return parent::layout_form_begin($additional_args); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | * @param EE_Form_Section_Proper $form_section |
26 | 26 | * @return string |
27 | 27 | */ |
28 | - public function layout_subsection( $form_section ){ |
|
29 | - if ( $form_section instanceof EE_Form_Section_Proper ) { |
|
30 | - return EEH_HTML::no_row( $form_section->get_html(), 2 ); |
|
31 | - } else if ( $form_section instanceof EE_Form_Section_HTML ) { |
|
28 | + public function layout_subsection($form_section) { |
|
29 | + if ($form_section instanceof EE_Form_Section_Proper) { |
|
30 | + return EEH_HTML::no_row($form_section->get_html(), 2); |
|
31 | + } else if ($form_section instanceof EE_Form_Section_HTML) { |
|
32 | 32 | return $form_section->get_html(); |
33 | 33 | } |
34 | 34 | return ''; |
@@ -41,30 +41,30 @@ discard block |
||
41 | 41 | * @param EE_Form_Input_Base $input |
42 | 42 | * @return string |
43 | 43 | */ |
44 | - public function layout_input( $input ) { |
|
44 | + public function layout_input($input) { |
|
45 | 45 | |
46 | 46 | if ( |
47 | 47 | $input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy || |
48 | 48 | $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy || |
49 | 49 | $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy |
50 | 50 | ) { |
51 | - $input->set_html_class( $input->html_class() . ' large-text' ); |
|
51 | + $input->set_html_class($input->html_class().' large-text'); |
|
52 | 52 | } |
53 | - if ( $input instanceof EE_Text_Area_Input ) { |
|
54 | - $input->set_rows( 4 ); |
|
55 | - $input->set_cols( 60 ); |
|
53 | + if ($input instanceof EE_Text_Area_Input) { |
|
54 | + $input->set_rows(4); |
|
55 | + $input->set_cols(60); |
|
56 | 56 | } |
57 | 57 | $input_html = $input->get_html_for_input(); |
58 | 58 | // maybe add errors and help text ? |
59 | - $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl() . $input->get_html_for_errors() : ''; |
|
60 | - $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl() . $input->get_html_for_help() : ''; |
|
59 | + $input_html .= $input->get_html_for_errors() != '' ? EEH_HTML::nl().$input->get_html_for_errors() : ''; |
|
60 | + $input_html .= $input->get_html_for_help() != '' ? EEH_HTML::nl().$input->get_html_for_help() : ''; |
|
61 | 61 | //overriding parent to add wp admin specific things. |
62 | 62 | $html = ''; |
63 | - if ( $input instanceof EE_Hidden_Input ) { |
|
64 | - $html .= EEH_HTML::no_row( $input->get_html_for_input(), 2 ); |
|
63 | + if ($input instanceof EE_Hidden_Input) { |
|
64 | + $html .= EEH_HTML::no_row($input->get_html_for_input(), 2); |
|
65 | 65 | } else { |
66 | 66 | $html .= EEH_HTML::tr( |
67 | - EEH_HTML::th( $input->get_html_for_label(), '', '', '', 'scope="row"' ) . EEH_HTML::td( $input_html ) |
|
67 | + EEH_HTML::th($input->get_html_for_label(), '', '', '', 'scope="row"').EEH_HTML::td($input_html) |
|
68 | 68 | ); |
69 | 69 | } |
70 | 70 | return $html; |