@@ -37,138 +37,138 @@ |
||
37 | 37 | * @since 4.0 |
38 | 38 | */ |
39 | 39 | if (function_exists('espresso_version')) { |
40 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | - /** |
|
42 | - * espresso_duplicate_plugin_error |
|
43 | - * displays if more than one version of EE is activated at the same time. |
|
44 | - */ |
|
45 | - function espresso_duplicate_plugin_error() |
|
46 | - { |
|
47 | - ?> |
|
40 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
41 | + /** |
|
42 | + * espresso_duplicate_plugin_error |
|
43 | + * displays if more than one version of EE is activated at the same time. |
|
44 | + */ |
|
45 | + function espresso_duplicate_plugin_error() |
|
46 | + { |
|
47 | + ?> |
|
48 | 48 | <div class="error"> |
49 | 49 | <p> |
50 | 50 | <?php |
51 | - echo esc_html__( |
|
52 | - '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.', |
|
53 | - 'event_espresso' |
|
54 | - ); ?> |
|
51 | + echo esc_html__( |
|
52 | + '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.', |
|
53 | + 'event_espresso' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | </div> |
57 | 57 | <?php |
58 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | - } |
|
60 | - } |
|
61 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
58 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
59 | + } |
|
60 | + } |
|
61 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
62 | 62 | } else { |
63 | - define('EE_MIN_PHP_VER_REQUIRED', '7.4.0'); |
|
64 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | - /** |
|
66 | - * espresso_minimum_php_version_error |
|
67 | - * |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - function espresso_minimum_php_version_error() |
|
71 | - { |
|
72 | - ?> |
|
63 | + define('EE_MIN_PHP_VER_REQUIRED', '7.4.0'); |
|
64 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
65 | + /** |
|
66 | + * espresso_minimum_php_version_error |
|
67 | + * |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + function espresso_minimum_php_version_error() |
|
71 | + { |
|
72 | + ?> |
|
73 | 73 | <div class="error"> |
74 | 74 | <p> |
75 | 75 | <?php |
76 | - printf( |
|
77 | - esc_html__( |
|
78 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | - 'event_espresso' |
|
80 | - ), |
|
81 | - EE_MIN_PHP_VER_REQUIRED, |
|
82 | - PHP_VERSION, |
|
83 | - '<br/>', |
|
84 | - '<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>' |
|
85 | - ); |
|
86 | - ?> |
|
76 | + printf( |
|
77 | + esc_html__( |
|
78 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
79 | + 'event_espresso' |
|
80 | + ), |
|
81 | + EE_MIN_PHP_VER_REQUIRED, |
|
82 | + PHP_VERSION, |
|
83 | + '<br/>', |
|
84 | + '<a href="https://www.php.net/downloads.php">https://php.net/downloads.php</a>' |
|
85 | + ); |
|
86 | + ?> |
|
87 | 87 | </p> |
88 | 88 | </div> |
89 | 89 | <?php |
90 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | - } |
|
90 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
91 | + } |
|
92 | 92 | |
93 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | - } else { |
|
95 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
93 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
94 | + } else { |
|
95 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
96 | 96 | |
97 | - require_once __DIR__ . '/vendor/autoload.php'; |
|
97 | + require_once __DIR__ . '/vendor/autoload.php'; |
|
98 | 98 | |
99 | - /** |
|
100 | - * espresso_version |
|
101 | - * Returns the plugin version |
|
102 | - * |
|
103 | - * @return string |
|
104 | - */ |
|
105 | - function espresso_version(): string |
|
106 | - { |
|
107 | - return apply_filters('FHEE__espresso__espresso_version', '5.0.24.rc.000'); |
|
108 | - } |
|
99 | + /** |
|
100 | + * espresso_version |
|
101 | + * Returns the plugin version |
|
102 | + * |
|
103 | + * @return string |
|
104 | + */ |
|
105 | + function espresso_version(): string |
|
106 | + { |
|
107 | + return apply_filters('FHEE__espresso__espresso_version', '5.0.24.rc.000'); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * espresso_plugin_activation |
|
112 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
113 | - */ |
|
114 | - function espresso_plugin_activation() |
|
115 | - { |
|
116 | - update_option('ee_espresso_activation', true); |
|
117 | - update_option('event-espresso-core_allow_tracking', 'no'); |
|
118 | - update_option('event-espresso-core_tracking_notice', 'hide'); |
|
119 | - // Run WP GraphQL activation callback |
|
120 | - espressoLoadWpGraphQL(); |
|
121 | - graphql_activation_callback(); |
|
122 | - } |
|
110 | + /** |
|
111 | + * espresso_plugin_activation |
|
112 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
113 | + */ |
|
114 | + function espresso_plugin_activation() |
|
115 | + { |
|
116 | + update_option('ee_espresso_activation', true); |
|
117 | + update_option('event-espresso-core_allow_tracking', 'no'); |
|
118 | + update_option('event-espresso-core_tracking_notice', 'hide'); |
|
119 | + // Run WP GraphQL activation callback |
|
120 | + espressoLoadWpGraphQL(); |
|
121 | + graphql_activation_callback(); |
|
122 | + } |
|
123 | 123 | |
124 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
124 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
125 | 125 | |
126 | - /** |
|
127 | - * espresso_plugin_deactivation |
|
128 | - */ |
|
129 | - function espresso_plugin_deactivation() |
|
130 | - { |
|
131 | - // Run WP GraphQL deactivation callback |
|
132 | - espressoLoadWpGraphQL(); |
|
133 | - graphql_deactivation_callback(); |
|
134 | - delete_option('event-espresso-core_allow_tracking'); |
|
135 | - delete_option('event-espresso-core_tracking_notice'); |
|
136 | - } |
|
137 | - register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
126 | + /** |
|
127 | + * espresso_plugin_deactivation |
|
128 | + */ |
|
129 | + function espresso_plugin_deactivation() |
|
130 | + { |
|
131 | + // Run WP GraphQL deactivation callback |
|
132 | + espressoLoadWpGraphQL(); |
|
133 | + graphql_deactivation_callback(); |
|
134 | + delete_option('event-espresso-core_allow_tracking'); |
|
135 | + delete_option('event-espresso-core_tracking_notice'); |
|
136 | + } |
|
137 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
138 | 138 | |
139 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
140 | - bootstrap_espresso(); |
|
141 | - } |
|
139 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
140 | + bootstrap_espresso(); |
|
141 | + } |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (! function_exists('espresso_deactivate_plugin')) { |
145 | - /** |
|
146 | - * deactivate_plugin |
|
147 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
148 | - * |
|
149 | - * @access public |
|
150 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
151 | - * @return void |
|
152 | - */ |
|
153 | - function espresso_deactivate_plugin(string $plugin_basename = '') |
|
154 | - { |
|
155 | - if (! function_exists('deactivate_plugins')) { |
|
156 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
157 | - } |
|
158 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
159 | - deactivate_plugins($plugin_basename); |
|
160 | - } |
|
145 | + /** |
|
146 | + * deactivate_plugin |
|
147 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
148 | + * |
|
149 | + * @access public |
|
150 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
151 | + * @return void |
|
152 | + */ |
|
153 | + function espresso_deactivate_plugin(string $plugin_basename = '') |
|
154 | + { |
|
155 | + if (! function_exists('deactivate_plugins')) { |
|
156 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
157 | + } |
|
158 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
159 | + deactivate_plugins($plugin_basename); |
|
160 | + } |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
164 | 164 | if (! function_exists('espressoLoadWpGraphQL')) { |
165 | - function espressoLoadWpGraphQL() |
|
166 | - { |
|
167 | - if ( |
|
168 | - ! class_exists('WPGraphQL') |
|
169 | - && is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php') |
|
170 | - ) { |
|
171 | - require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php'; |
|
172 | - } |
|
173 | - } |
|
165 | + function espressoLoadWpGraphQL() |
|
166 | + { |
|
167 | + if ( |
|
168 | + ! class_exists('WPGraphQL') |
|
169 | + && is_readable(__DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php') |
|
170 | + ) { |
|
171 | + require_once __DIR__ . '/vendor/wp-graphql/wp-graphql/wp-graphql.php'; |
|
172 | + } |
|
173 | + } |
|
174 | 174 | } |
@@ -7,141 +7,141 @@ |
||
7 | 7 | */ |
8 | 8 | class EE_Admin_Config extends EE_Config_Base |
9 | 9 | { |
10 | - protected ?bool $useAdvancedEditor = true; |
|
11 | - |
|
12 | - public $use_remote_logging = false; |
|
13 | - |
|
14 | - public $show_reg_footer = false; |
|
15 | - |
|
16 | - protected ?bool $is_caffeinated = false; |
|
17 | - |
|
18 | - public $use_dashboard_widget = false; |
|
19 | - |
|
20 | - public $use_personnel_manager = false; |
|
21 | - |
|
22 | - public $use_event_timezones = false; |
|
23 | - |
|
24 | - /** |
|
25 | - * adds extra layer of encoding to session data to prevent serialization errors |
|
26 | - * but is incompatible with some server configuration errors |
|
27 | - * if you get "500 internal server errors" during registration, try turning this on |
|
28 | - * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
29 | - * |
|
30 | - * @var boolean $encode_session_data |
|
31 | - */ |
|
32 | - protected bool $encode_session_data = false; |
|
33 | - |
|
34 | - public ?string $log_file_name = ''; |
|
35 | - |
|
36 | - public ?string $debug_file_name = ''; |
|
37 | - |
|
38 | - public ?string $remote_logging_url = ''; |
|
39 | - |
|
40 | - public ?string $affiliate_id = 'default'; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var int|null $events_in_dashboard |
|
44 | - * @deprecated |
|
45 | - */ |
|
46 | - public ?int $events_in_dashboard = 30; |
|
47 | - |
|
48 | - |
|
49 | - public function __construct() |
|
50 | - { |
|
51 | - $this->setIsCaffeinated(); |
|
52 | - // set default general admin settings |
|
53 | - $this->show_reg_footer = (bool) apply_filters( |
|
54 | - 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
55 | - false |
|
56 | - ); |
|
57 | - } |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * @param bool $reset |
|
62 | - * @return string |
|
63 | - * @throws EE_Error |
|
64 | - * @throws ReflectionException |
|
65 | - */ |
|
66 | - public function log_file_name(bool $reset = false): string |
|
67 | - { |
|
68 | - if (empty($this->log_file_name) || $reset) { |
|
69 | - $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt'; |
|
70 | - EE_Config::instance()->update_espresso_config(false, false); |
|
71 | - } |
|
72 | - return (string) $this->log_file_name; |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * @param bool $reset |
|
78 | - * @return string |
|
79 | - * @throws EE_Error |
|
80 | - * @throws ReflectionException |
|
81 | - */ |
|
82 | - public function debug_file_name(bool $reset = false): string |
|
83 | - { |
|
84 | - if (empty($this->debug_file_name) || $reset) { |
|
85 | - $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt'; |
|
86 | - EE_Config::instance()->update_espresso_config(false, false); |
|
87 | - } |
|
88 | - return (string) $this->debug_file_name; |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - /** |
|
93 | - * @return string |
|
94 | - */ |
|
95 | - public function affiliate_id(): string |
|
96 | - { |
|
97 | - return ! empty($this->affiliate_id) ? (string) $this->affiliate_id : 'default'; |
|
98 | - } |
|
99 | - |
|
100 | - |
|
101 | - /** |
|
102 | - * @return boolean |
|
103 | - */ |
|
104 | - public function encode_session_data(): bool |
|
105 | - { |
|
106 | - return $this->encode_session_data; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * @param bool|int|string $encode_session_data |
|
112 | - */ |
|
113 | - public function set_encode_session_data($encode_session_data) |
|
114 | - { |
|
115 | - $this->encode_session_data = (bool) filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @return boolean |
|
120 | - */ |
|
121 | - public function useAdvancedEditor(): bool |
|
122 | - { |
|
123 | - return (bool) $this->useAdvancedEditor; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * @param bool|int|string $use_advanced_editor |
|
128 | - */ |
|
129 | - public function setUseAdvancedEditor($use_advanced_editor = true) |
|
130 | - { |
|
131 | - $this->useAdvancedEditor = (bool) filter_var( |
|
132 | - apply_filters( |
|
133 | - 'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor', |
|
134 | - $use_advanced_editor |
|
135 | - ), |
|
136 | - FILTER_VALIDATE_BOOLEAN |
|
137 | - ); |
|
138 | - } |
|
139 | - |
|
140 | - |
|
141 | - protected function setIsCaffeinated(): void |
|
142 | - { |
|
143 | - /** @var EventEspresso\core\domain\Domain $domain */ |
|
144 | - $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
145 | - $this->is_caffeinated = (bool) filter_var($domain->isCaffeinated(), FILTER_VALIDATE_BOOLEAN); |
|
146 | - } |
|
10 | + protected ?bool $useAdvancedEditor = true; |
|
11 | + |
|
12 | + public $use_remote_logging = false; |
|
13 | + |
|
14 | + public $show_reg_footer = false; |
|
15 | + |
|
16 | + protected ?bool $is_caffeinated = false; |
|
17 | + |
|
18 | + public $use_dashboard_widget = false; |
|
19 | + |
|
20 | + public $use_personnel_manager = false; |
|
21 | + |
|
22 | + public $use_event_timezones = false; |
|
23 | + |
|
24 | + /** |
|
25 | + * adds extra layer of encoding to session data to prevent serialization errors |
|
26 | + * but is incompatible with some server configuration errors |
|
27 | + * if you get "500 internal server errors" during registration, try turning this on |
|
28 | + * if you get PHP fatal errors regarding base 64 methods not defined, then turn this off |
|
29 | + * |
|
30 | + * @var boolean $encode_session_data |
|
31 | + */ |
|
32 | + protected bool $encode_session_data = false; |
|
33 | + |
|
34 | + public ?string $log_file_name = ''; |
|
35 | + |
|
36 | + public ?string $debug_file_name = ''; |
|
37 | + |
|
38 | + public ?string $remote_logging_url = ''; |
|
39 | + |
|
40 | + public ?string $affiliate_id = 'default'; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var int|null $events_in_dashboard |
|
44 | + * @deprecated |
|
45 | + */ |
|
46 | + public ?int $events_in_dashboard = 30; |
|
47 | + |
|
48 | + |
|
49 | + public function __construct() |
|
50 | + { |
|
51 | + $this->setIsCaffeinated(); |
|
52 | + // set default general admin settings |
|
53 | + $this->show_reg_footer = (bool) apply_filters( |
|
54 | + 'FHEE__EE_Admin_Config__show_reg_footer__default', |
|
55 | + false |
|
56 | + ); |
|
57 | + } |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * @param bool $reset |
|
62 | + * @return string |
|
63 | + * @throws EE_Error |
|
64 | + * @throws ReflectionException |
|
65 | + */ |
|
66 | + public function log_file_name(bool $reset = false): string |
|
67 | + { |
|
68 | + if (empty($this->log_file_name) || $reset) { |
|
69 | + $this->log_file_name = sanitize_key('espresso_log_' . md5(uniqid('', true))) . '.txt'; |
|
70 | + EE_Config::instance()->update_espresso_config(false, false); |
|
71 | + } |
|
72 | + return (string) $this->log_file_name; |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * @param bool $reset |
|
78 | + * @return string |
|
79 | + * @throws EE_Error |
|
80 | + * @throws ReflectionException |
|
81 | + */ |
|
82 | + public function debug_file_name(bool $reset = false): string |
|
83 | + { |
|
84 | + if (empty($this->debug_file_name) || $reset) { |
|
85 | + $this->debug_file_name = sanitize_key('espresso_debug_' . md5(uniqid('', true))) . '.txt'; |
|
86 | + EE_Config::instance()->update_espresso_config(false, false); |
|
87 | + } |
|
88 | + return (string) $this->debug_file_name; |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + /** |
|
93 | + * @return string |
|
94 | + */ |
|
95 | + public function affiliate_id(): string |
|
96 | + { |
|
97 | + return ! empty($this->affiliate_id) ? (string) $this->affiliate_id : 'default'; |
|
98 | + } |
|
99 | + |
|
100 | + |
|
101 | + /** |
|
102 | + * @return boolean |
|
103 | + */ |
|
104 | + public function encode_session_data(): bool |
|
105 | + { |
|
106 | + return $this->encode_session_data; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * @param bool|int|string $encode_session_data |
|
112 | + */ |
|
113 | + public function set_encode_session_data($encode_session_data) |
|
114 | + { |
|
115 | + $this->encode_session_data = (bool) filter_var($encode_session_data, FILTER_VALIDATE_BOOLEAN); |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @return boolean |
|
120 | + */ |
|
121 | + public function useAdvancedEditor(): bool |
|
122 | + { |
|
123 | + return (bool) $this->useAdvancedEditor; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * @param bool|int|string $use_advanced_editor |
|
128 | + */ |
|
129 | + public function setUseAdvancedEditor($use_advanced_editor = true) |
|
130 | + { |
|
131 | + $this->useAdvancedEditor = (bool) filter_var( |
|
132 | + apply_filters( |
|
133 | + 'FHEE__EE_Admin_Config__setUseAdvancedEditor__use_advanced_editor', |
|
134 | + $use_advanced_editor |
|
135 | + ), |
|
136 | + FILTER_VALIDATE_BOOLEAN |
|
137 | + ); |
|
138 | + } |
|
139 | + |
|
140 | + |
|
141 | + protected function setIsCaffeinated(): void |
|
142 | + { |
|
143 | + /** @var EventEspresso\core\domain\Domain $domain */ |
|
144 | + $domain = LoaderFactory::getLoader()->getShared('EventEspresso\core\domain\Domain'); |
|
145 | + $this->is_caffeinated = (bool) filter_var($domain->isCaffeinated(), FILTER_VALIDATE_BOOLEAN); |
|
146 | + } |
|
147 | 147 | } |