@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * This sets up the email messenger for the EE_messages (notifications) subsystem in EE. |
31 | 31 | */ |
32 | -class EE_Email_messenger extends EE_messenger { |
|
32 | +class EE_Email_messenger extends EE_messenger { |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * The following are the properties that email requires for the message going out. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected function _set_valid_shortcodes() { |
78 | 78 | //remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the message type. |
79 | 79 | $this->_valid_shortcodes = array( |
80 | - 'to' => array('email','event_author', 'primary_registration_details', 'recipient_details'), |
|
80 | + 'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
81 | 81 | 'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details') |
82 | 82 | ); |
83 | 83 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'shortcodes' => array('organization', 'primary_registration_details', 'event_author', 'primary_registration_details', 'recipient_details') |
112 | 112 | ), |
113 | 113 | 'content' => array( |
114 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
114 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
115 | 115 | ), |
116 | 116 | 'attendee_list' => array( |
117 | 117 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'required' => array('[EVENT_LIST]') |
123 | 123 | ), |
124 | 124 | 'ticket_list' => array( |
125 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'), |
|
125 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
126 | 126 | 'required' => array('[TICKET_LIST]') |
127 | 127 | ), |
128 | 128 | 'datetime_list' => array( |
@@ -141,21 +141,21 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @since 4.5.0 |
143 | 143 | */ |
144 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
145 | - if ( $sending_messenger_name = 'html' ) { |
|
146 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
144 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
145 | + if ($sending_messenger_name = 'html') { |
|
146 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - public function add_email_css( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
153 | + public function add_email_css($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
154 | 154 | //prevent recursion on this callback. |
155 | - remove_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10 ); |
|
156 | - $variation = $this->get_variation( $template_pack, $message_type, $url, 'main', $variation, FALSE ); |
|
155 | + remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10); |
|
156 | + $variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, FALSE); |
|
157 | 157 | |
158 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
158 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
159 | 159 | return $variation; |
160 | 160 | } |
161 | 161 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'required' => FALSE, |
188 | 188 | 'validation' => FALSE, |
189 | 189 | 'format' => '%s', |
190 | - 'value' => sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ), |
|
190 | + 'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')), |
|
191 | 191 | 'default'=> '', |
192 | 192 | 'css_class' => '' |
193 | 193 | ) |
@@ -349,16 +349,16 @@ discard block |
||
349 | 349 | * @return bool | WP_Error true if message delivered, false if it didn't deliver OR bubble up any error object if present. |
350 | 350 | */ |
351 | 351 | protected function _send_message() { |
352 | - $success = wp_mail( |
|
353 | - html_entity_decode( $this->_to, ENT_QUOTES, "UTF-8" ), |
|
354 | - stripslashes( html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8" )), |
|
352 | + $success = wp_mail( |
|
353 | + html_entity_decode($this->_to, ENT_QUOTES, "UTF-8"), |
|
354 | + stripslashes(html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8")), |
|
355 | 355 | $this->_body(), |
356 | 356 | $this->_headers() |
357 | 357 | ); |
358 | - if ( ! $success ) { |
|
358 | + if ( ! $success) { |
|
359 | 359 | EE_Error::add_error( |
360 | 360 | sprintf( |
361 | - __( 'The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
361 | + __('The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
362 | 362 | $this->_to, |
363 | 363 | $this->_from, |
364 | 364 | '<br />' |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return string html body of the message content and the related css. |
378 | 378 | */ |
379 | 379 | protected function _preview() { |
380 | - return $this->_body( true ); |
|
380 | + return $this->_body(true); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -392,18 +392,18 @@ discard block |
||
392 | 392 | */ |
393 | 393 | protected function _headers() { |
394 | 394 | $this->_ensure_has_from_email_address(); |
395 | - $from = stripslashes_deep( html_entity_decode($this->_from, ENT_QUOTES,"UTF-8" ) ); |
|
395 | + $from = stripslashes_deep(html_entity_decode($this->_from, ENT_QUOTES, "UTF-8")); |
|
396 | 396 | $headers = array( |
397 | 397 | 'MIME-Version: 1.0', |
398 | - 'From:' . $from, |
|
399 | - 'Reply-To:' . $from, |
|
398 | + 'From:'.$from, |
|
399 | + 'Reply-To:'.$from, |
|
400 | 400 | 'Content-Type:text/html; charset=utf-8' |
401 | 401 | ); |
402 | 402 | |
403 | 403 | //but wait! Header's for the from is NOT reliable because some plugins don't respect From: as set in the header. |
404 | - add_filter( 'wp_mail_from', array( $this, 'set_from_address' ), 100 ); |
|
405 | - add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 ); |
|
406 | - return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this ); |
|
404 | + add_filter('wp_mail_from', array($this, 'set_from_address'), 100); |
|
405 | + add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100); |
|
406 | + return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * address for the from address to avoid problems with sending emails. |
413 | 413 | */ |
414 | 414 | protected function _ensure_has_from_email_address() { |
415 | - if ( empty( $this->_from ) ) { |
|
415 | + if (empty($this->_from)) { |
|
416 | 416 | $this->_from = get_bloginfo('admin_email'); |
417 | 417 | } |
418 | 418 | } |
@@ -429,21 +429,21 @@ discard block |
||
429 | 429 | * @return array |
430 | 430 | */ |
431 | 431 | private function _parse_from() { |
432 | - if ( strpos( $this->_from, '<' ) !== false ) { |
|
433 | - $from_name = substr( $this->_from, 0, strpos( $this->_from, '<' ) - 1 ); |
|
434 | - $from_name = str_replace( '"', '', $from_name ); |
|
435 | - $from_name = trim( $from_name ); |
|
436 | - |
|
437 | - $from_email = substr( $this->_from, strpos( $this->_from, '<' ) + 1 ); |
|
438 | - $from_email = str_replace( '>', '', $from_email ); |
|
439 | - $from_email = trim( $from_email ); |
|
440 | - } elseif ( trim( $this->_from ) !== '' ) { |
|
432 | + if (strpos($this->_from, '<') !== false) { |
|
433 | + $from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1); |
|
434 | + $from_name = str_replace('"', '', $from_name); |
|
435 | + $from_name = trim($from_name); |
|
436 | + |
|
437 | + $from_email = substr($this->_from, strpos($this->_from, '<') + 1); |
|
438 | + $from_email = str_replace('>', '', $from_email); |
|
439 | + $from_email = trim($from_email); |
|
440 | + } elseif (trim($this->_from) !== '') { |
|
441 | 441 | $from_name = ''; |
442 | - $from_email = trim( $this->_from ); |
|
442 | + $from_email = trim($this->_from); |
|
443 | 443 | } else { |
444 | 444 | $from_name = $from_email = ''; |
445 | 445 | } |
446 | - return array( $from_name, $from_email ); |
|
446 | + return array($from_name, $from_email); |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @param string $from_email What the original from_email is. |
458 | 458 | */ |
459 | - public function set_from_address( $from_email ) { |
|
459 | + public function set_from_address($from_email) { |
|
460 | 460 | $parsed_from = $this->_parse_from(); |
461 | 461 | //includes fallback if the parsing failed. |
462 | - $from_email = is_array( $parsed_from ) && ! empty( $parsed_from[1] ) ? $parsed_from[1] : get_bloginfo( 'admin_email' ); |
|
462 | + $from_email = is_array($parsed_from) && ! empty($parsed_from[1]) ? $parsed_from[1] : get_bloginfo('admin_email'); |
|
463 | 463 | return $from_email; |
464 | 464 | } |
465 | 465 | |
@@ -473,16 +473,16 @@ discard block |
||
473 | 473 | * |
474 | 474 | * @param string $from_name The original from_name. |
475 | 475 | */ |
476 | - public function set_from_name( $from_name ) { |
|
476 | + public function set_from_name($from_name) { |
|
477 | 477 | $parsed_from = $this->_parse_from(); |
478 | - if ( is_array( $parsed_from) && ! empty( $parsed_from[0] ) ) { |
|
479 | - $from_name = $parsed_from[0]; |
|
478 | + if (is_array($parsed_from) && ! empty($parsed_from[0])) { |
|
479 | + $from_name = $parsed_from[0]; |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | //if from name is "WordPress" let's sub in the site name instead (more friendly!) |
483 | 483 | $from_name = $from_name == 'WordPress' ? get_bloginfo() : $from_name; |
484 | 484 | |
485 | - return stripslashes_deep( html_entity_decode($from_name, ENT_QUOTES,"UTF-8" ) ); |
|
485 | + return stripslashes_deep(html_entity_decode($from_name, ENT_QUOTES, "UTF-8")); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | |
@@ -493,14 +493,14 @@ discard block |
||
493 | 493 | * @param bool $preview will determine whether this is preview template or not. |
494 | 494 | * @return string formatted body for email. |
495 | 495 | */ |
496 | - protected function _body( $preview = false ) { |
|
496 | + protected function _body($preview = false) { |
|
497 | 497 | //setup template args! |
498 | 498 | $this->_template_args = array( |
499 | 499 | 'subject' => $this->_subject, |
500 | 500 | 'from' => $this->_from, |
501 | - 'main_body' => wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )) |
|
501 | + 'main_body' => wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))) |
|
502 | 502 | ); |
503 | - $body = $this->_get_main_template( $preview ); |
|
503 | + $body = $this->_get_main_template($preview); |
|
504 | 504 | |
505 | 505 | /** |
506 | 506 | * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched. |
@@ -508,17 +508,17 @@ discard block |
||
508 | 508 | * @type bool $preview Indicates whether a preview is being generated or not. |
509 | 509 | * @return bool true indicates to use the inliner, false bypasses it. |
510 | 510 | */ |
511 | - if ( apply_filters( 'FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview ) ) { |
|
511 | + if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) { |
|
512 | 512 | |
513 | 513 | //require CssToInlineStyles library and its dependencies via composer autoloader |
514 | - require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php'; |
|
514 | + require_once EE_THIRD_PARTY.'cssinliner/vendor/autoload.php'; |
|
515 | 515 | |
516 | 516 | //now if this isn't a preview, let's setup the body so it has inline styles |
517 | - if ( ! $preview || ( $preview && defined( 'DOING_AJAX' ) ) ) { |
|
518 | - $style = file_get_contents( $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation ), TRUE ); |
|
519 | - $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles( $body, $style ); |
|
520 | - $body = ltrim( $CSS->convert( true ), ">\n" ); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
521 | - $body = ltrim( $body, "<?" ); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
517 | + if ( ! $preview || ($preview && defined('DOING_AJAX'))) { |
|
518 | + $style = file_get_contents($this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation), TRUE); |
|
519 | + $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style); |
|
520 | + $body = ltrim($CSS->convert(true), ">\n"); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
521 | + $body = ltrim($body, "<?"); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | } |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | public function get_existing_test_settings() { |
538 | 538 | $settings = parent::get_existing_test_settings(); |
539 | 539 | //override subject if present because we always want it to be fresh. |
540 | - if ( is_array( $settings ) && ! empty( $settings['subject'] ) ) { |
|
541 | - $settings['subject'] = sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ); |
|
540 | + if (is_array($settings) && ! empty($settings['subject'])) { |
|
541 | + $settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')); |
|
542 | 542 | } |
543 | 543 | return $settings; |
544 | 544 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * |
43 | 43 | */ |
44 | 44 | |
45 | -if ( function_exists( 'espresso_version' ) ) { |
|
45 | +if (function_exists('espresso_version')) { |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * espresso_duplicate_plugin_error |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | function espresso_duplicate_plugin_error() { |
52 | 52 | ?> |
53 | 53 | <div class="error"> |
54 | - <p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p> |
|
54 | + <p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p> |
|
55 | 55 | </div> |
56 | 56 | <?php |
57 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
57 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
58 | 58 | } |
59 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
59 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
60 | 60 | |
61 | 61 | } else { |
62 | 62 | |
@@ -67,102 +67,102 @@ discard block |
||
67 | 67 | * @return string |
68 | 68 | */ |
69 | 69 | function espresso_version() { |
70 | - return apply_filters( 'FHEE__espresso__espresso_version', '4.9.17.rc.006' ); |
|
70 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.17.rc.006'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // define versions |
74 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
75 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
76 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
77 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
78 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
74 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
75 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
76 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
77 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
78 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
156 | - define( 'EE_DEBUG', false ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | + define('EE_DEBUG', false); |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * espresso_plugin_activation |
160 | 160 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
161 | 161 | */ |
162 | 162 | function espresso_plugin_activation() { |
163 | - update_option( 'ee_espresso_activation', true ); |
|
163 | + update_option('ee_espresso_activation', true); |
|
164 | 164 | } |
165 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
165 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
166 | 166 | |
167 | 167 | |
168 | 168 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // } |
177 | 177 | // |
178 | 178 | } |
179 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
179 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
180 | 180 | |
181 | 181 | |
182 | 182 | |
@@ -186,15 +186,15 @@ discard block |
||
186 | 186 | */ |
187 | 187 | function espresso_load_error_handling() { |
188 | 188 | // load debugging tools |
189 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
190 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
189 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
190 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
191 | 191 | EEH_Debug_Tools::instance(); |
192 | 192 | } |
193 | 193 | // load error handling |
194 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
195 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
194 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
195 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
196 | 196 | } else { |
197 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
197 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | |
@@ -208,25 +208,25 @@ discard block |
||
208 | 208 | * @param string $full_path_to_file |
209 | 209 | * @throws EE_Error |
210 | 210 | */ |
211 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
211 | + function espresso_load_required($classname, $full_path_to_file) { |
|
212 | 212 | static $error_handling_loaded = false; |
213 | - if ( ! $error_handling_loaded ) { |
|
213 | + if ( ! $error_handling_loaded) { |
|
214 | 214 | espresso_load_error_handling(); |
215 | 215 | $error_handling_loaded = true; |
216 | 216 | } |
217 | - if ( is_readable( $full_path_to_file ) ) { |
|
218 | - require_once( $full_path_to_file ); |
|
217 | + if (is_readable($full_path_to_file)) { |
|
218 | + require_once($full_path_to_file); |
|
219 | 219 | } else { |
220 | - throw new EE_Error ( sprintf( |
|
221 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
220 | + throw new EE_Error(sprintf( |
|
221 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
222 | 222 | $classname |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | } |
225 | 225 | } |
226 | 226 | |
227 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
228 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
229 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
227 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
228 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
229 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
230 | 230 | new EE_Bootstrap(); |
231 | 231 | |
232 | 232 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | |
237 | 237 | |
238 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
238 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
239 | 239 | /** |
240 | 240 | * deactivate_plugin |
241 | 241 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -244,11 +244,11 @@ discard block |
||
244 | 244 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
245 | 245 | * @return void |
246 | 246 | */ |
247 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
248 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
249 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
247 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
248 | + if ( ! function_exists('deactivate_plugins')) { |
|
249 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
250 | 250 | } |
251 | - unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
251 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |