@@ -19,86 +19,86 @@ discard block |
||
19 | 19 | class Stats |
20 | 20 | { |
21 | 21 | |
22 | - const OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS = 'ee_uxip_stats_expiry'; |
|
23 | - |
|
24 | - /** |
|
25 | - * @var Config |
|
26 | - */ |
|
27 | - private $config; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * @var StatsGatherer |
|
32 | - */ |
|
33 | - private $stats_gatherer; |
|
34 | - |
|
35 | - |
|
36 | - /** |
|
37 | - * @var EE_Maintenance_Mode |
|
38 | - */ |
|
39 | - private $maintenance_mode; |
|
40 | - |
|
41 | - public function __construct( |
|
42 | - Config $config, |
|
43 | - EE_Maintenance_Mode $maintenance_mode, |
|
44 | - StatsGatherer $stats_gatherer |
|
45 | - ) { |
|
46 | - $this->config = $config; |
|
47 | - $this->maintenance_mode = $maintenance_mode; |
|
48 | - $this->stats_gatherer = $stats_gatherer; |
|
49 | - $this->setUxipNotices(); |
|
50 | - } |
|
51 | - |
|
52 | - |
|
53 | - /** |
|
54 | - * Displays uxip opt-in notice if necessary. |
|
55 | - */ |
|
56 | - private function setUxipNotices() |
|
57 | - { |
|
58 | - if ($this->canDisplayNotices()) { |
|
59 | - add_action('admin_notices', array($this, 'optinNotice')); |
|
60 | - add_action('admin_enqueue_scripts', array($this, 'enqueueScripts')); |
|
61 | - add_action('wp_ajax_espresso_data_optin', array($this, 'ajaxHandler')); |
|
62 | - } |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * This returns the callback that PluginUpdateEngineChecker will use for getting any extra stats to send. |
|
68 | - * |
|
69 | - * @return Closure |
|
70 | - */ |
|
71 | - public function statsCallback() |
|
72 | - { |
|
73 | - // returns a callback that can is used to retrieve the stats to send along to the pue server. |
|
74 | - return function () { |
|
75 | - // we only send stats one a week, so let's see if our stat timestamp has expired. |
|
76 | - if (! $this->sendStats()) { |
|
77 | - return array(); |
|
78 | - } |
|
79 | - return $this->stats_gatherer->stats(); |
|
80 | - }; |
|
81 | - } |
|
82 | - |
|
83 | - |
|
84 | - /** |
|
85 | - * Return whether notices can be displayed or not |
|
86 | - * |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - private function canDisplayNotices() |
|
90 | - { |
|
91 | - return ! $this->config->hasNotifiedForUxip() |
|
92 | - && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - /** |
|
97 | - * Callback for the admin_notices hook that outputs the UXIP optin-in notice. |
|
98 | - */ |
|
99 | - public function optinNotice() |
|
100 | - { |
|
101 | - ?> |
|
22 | + const OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS = 'ee_uxip_stats_expiry'; |
|
23 | + |
|
24 | + /** |
|
25 | + * @var Config |
|
26 | + */ |
|
27 | + private $config; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * @var StatsGatherer |
|
32 | + */ |
|
33 | + private $stats_gatherer; |
|
34 | + |
|
35 | + |
|
36 | + /** |
|
37 | + * @var EE_Maintenance_Mode |
|
38 | + */ |
|
39 | + private $maintenance_mode; |
|
40 | + |
|
41 | + public function __construct( |
|
42 | + Config $config, |
|
43 | + EE_Maintenance_Mode $maintenance_mode, |
|
44 | + StatsGatherer $stats_gatherer |
|
45 | + ) { |
|
46 | + $this->config = $config; |
|
47 | + $this->maintenance_mode = $maintenance_mode; |
|
48 | + $this->stats_gatherer = $stats_gatherer; |
|
49 | + $this->setUxipNotices(); |
|
50 | + } |
|
51 | + |
|
52 | + |
|
53 | + /** |
|
54 | + * Displays uxip opt-in notice if necessary. |
|
55 | + */ |
|
56 | + private function setUxipNotices() |
|
57 | + { |
|
58 | + if ($this->canDisplayNotices()) { |
|
59 | + add_action('admin_notices', array($this, 'optinNotice')); |
|
60 | + add_action('admin_enqueue_scripts', array($this, 'enqueueScripts')); |
|
61 | + add_action('wp_ajax_espresso_data_optin', array($this, 'ajaxHandler')); |
|
62 | + } |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * This returns the callback that PluginUpdateEngineChecker will use for getting any extra stats to send. |
|
68 | + * |
|
69 | + * @return Closure |
|
70 | + */ |
|
71 | + public function statsCallback() |
|
72 | + { |
|
73 | + // returns a callback that can is used to retrieve the stats to send along to the pue server. |
|
74 | + return function () { |
|
75 | + // we only send stats one a week, so let's see if our stat timestamp has expired. |
|
76 | + if (! $this->sendStats()) { |
|
77 | + return array(); |
|
78 | + } |
|
79 | + return $this->stats_gatherer->stats(); |
|
80 | + }; |
|
81 | + } |
|
82 | + |
|
83 | + |
|
84 | + /** |
|
85 | + * Return whether notices can be displayed or not |
|
86 | + * |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + private function canDisplayNotices() |
|
90 | + { |
|
91 | + return ! $this->config->hasNotifiedForUxip() |
|
92 | + && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance; |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + /** |
|
97 | + * Callback for the admin_notices hook that outputs the UXIP optin-in notice. |
|
98 | + */ |
|
99 | + public function optinNotice() |
|
100 | + { |
|
101 | + ?> |
|
102 | 102 | <div class="updated data-collect-optin" id="espresso-data-collect-optin-container"> |
103 | 103 | <div id="data-collect-optin-options-container"> |
104 | 104 | <span class="dashicons dashicons-admin-site"></span> |
@@ -111,125 +111,125 @@ discard block |
||
111 | 111 | </div> |
112 | 112 | </div> |
113 | 113 | <?php |
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * Retrieves the optin text (static so it can be used in multiple places as necessary). |
|
119 | - * |
|
120 | - * @param bool $extra |
|
121 | - */ |
|
122 | - public static function optinText($extra = true) |
|
123 | - { |
|
124 | - if (! $extra) { |
|
125 | - echo '<h2 class="ee-admin-settings-hdr" ' |
|
126 | - . (! $extra ? 'id="UXIP_settings"' : '') |
|
127 | - . '>' |
|
128 | - . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso') |
|
129 | - . EEH_Template::get_help_tab_link('organization_logo_info') |
|
130 | - . '</h2>'; |
|
131 | - printf( |
|
132 | - esc_html__( |
|
133 | - '%1$sPlease help us make Event Espresso better and vote for your favorite features.%2$s The %3$sUser eXperience Improvement Program (UXIP)%4$s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary and it is disabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %5$sPlease see our %6$sPrivacy Policy%7$s for more information.', |
|
134 | - 'event_espresso' |
|
135 | - ), |
|
136 | - '<p><em>', |
|
137 | - '</em></p>', |
|
138 | - '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', |
|
139 | - '</a>', |
|
140 | - '<br><br>', |
|
141 | - '<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">', |
|
142 | - '</a>' |
|
143 | - ); |
|
144 | - } else { |
|
145 | - $settings_url = EEH_URL::add_query_args_and_nonce( |
|
146 | - array('action' => 'default'), |
|
147 | - admin_url('admin.php?page=espresso_general_settings') |
|
148 | - ); |
|
149 | - $settings_url .= '#UXIP_settings'; |
|
150 | - printf( |
|
151 | - esc_html__( |
|
152 | - 'The Event Espresso UXIP feature is not yet active on your site. For %1$smore info%2$s and to opt-in %3$sclick here%4$s.', |
|
153 | - 'event_espresso' |
|
154 | - ), |
|
155 | - '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', |
|
156 | - '</a>', |
|
157 | - '<a href="' . $settings_url . '" target="_blank">', |
|
158 | - '</a>' |
|
159 | - ); |
|
160 | - } |
|
161 | - } |
|
162 | - |
|
163 | - |
|
164 | - /** |
|
165 | - * Callback for admin_enqueue_scripts that sets up the scripts and styles for the uxip notice |
|
166 | - */ |
|
167 | - public function enqueueScripts() |
|
168 | - { |
|
169 | - wp_register_script( |
|
170 | - 'ee-data-optin-js', |
|
171 | - EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', |
|
172 | - array('jquery'), |
|
173 | - EVENT_ESPRESSO_VERSION, |
|
174 | - true |
|
175 | - ); |
|
176 | - wp_register_style( |
|
177 | - 'ee-data-optin-css', |
|
178 | - EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', |
|
179 | - array(), |
|
180 | - EVENT_ESPRESSO_VERSION |
|
181 | - ); |
|
182 | - |
|
183 | - wp_enqueue_script('ee-data-optin-js'); |
|
184 | - wp_enqueue_style('ee-data-optin-css'); |
|
185 | - } |
|
186 | - |
|
187 | - |
|
188 | - /** |
|
189 | - * Callback for wp_ajax_espresso_data_optin that handles the ajax request |
|
190 | - */ |
|
191 | - public function ajaxHandler() |
|
192 | - { |
|
193 | - // verify nonce |
|
194 | - if (! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) { |
|
195 | - exit(); |
|
196 | - } |
|
197 | - |
|
198 | - // update has notified option |
|
199 | - $this->config->setHasNotifiedAboutUxip(); |
|
200 | - exit(); |
|
201 | - } |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * Used to determine whether additional stats are sent. |
|
206 | - */ |
|
207 | - private function sendStats() |
|
208 | - { |
|
209 | - return $this->config->isOptedInForUxip() |
|
210 | - && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance |
|
211 | - && $this->statSendTimestampExpired(); |
|
212 | - } |
|
213 | - |
|
214 | - |
|
215 | - /** |
|
216 | - * Returns true when the timestamp used to track whether stats get sent (currently a weekly interval) is expired. |
|
217 | - * Returns false otherwise. |
|
218 | - * |
|
219 | - * @return bool |
|
220 | - */ |
|
221 | - private function statSendTimestampExpired() |
|
222 | - { |
|
223 | - $current_expiry = get_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, null); |
|
224 | - if ($current_expiry === null) { |
|
225 | - add_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS, '', 'no'); |
|
226 | - return true; |
|
227 | - } |
|
228 | - |
|
229 | - if (time() > (int) $current_expiry) { |
|
230 | - update_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS); |
|
231 | - return true; |
|
232 | - } |
|
233 | - return false; |
|
234 | - } |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * Retrieves the optin text (static so it can be used in multiple places as necessary). |
|
119 | + * |
|
120 | + * @param bool $extra |
|
121 | + */ |
|
122 | + public static function optinText($extra = true) |
|
123 | + { |
|
124 | + if (! $extra) { |
|
125 | + echo '<h2 class="ee-admin-settings-hdr" ' |
|
126 | + . (! $extra ? 'id="UXIP_settings"' : '') |
|
127 | + . '>' |
|
128 | + . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso') |
|
129 | + . EEH_Template::get_help_tab_link('organization_logo_info') |
|
130 | + . '</h2>'; |
|
131 | + printf( |
|
132 | + esc_html__( |
|
133 | + '%1$sPlease help us make Event Espresso better and vote for your favorite features.%2$s The %3$sUser eXperience Improvement Program (UXIP)%4$s, has been created so when you use Event Espresso you are voting for the features and settings that are important to you. The UXIP helps us understand how you use our products and services, track problems and in what context. If you opt-out of the UXIP you essentially elect for us to disregard how you use Event Espresso as we build new features and make changes. Participation in the program is completely voluntary and it is disabled by default. The end results of the UXIP are software improvements to better meet your needs. The data we collect will never be sold, traded, or misused in any way. %5$sPlease see our %6$sPrivacy Policy%7$s for more information.', |
|
134 | + 'event_espresso' |
|
135 | + ), |
|
136 | + '<p><em>', |
|
137 | + '</em></p>', |
|
138 | + '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', |
|
139 | + '</a>', |
|
140 | + '<br><br>', |
|
141 | + '<a href="https://eventespresso.com/about/privacy-policy/" target="_blank">', |
|
142 | + '</a>' |
|
143 | + ); |
|
144 | + } else { |
|
145 | + $settings_url = EEH_URL::add_query_args_and_nonce( |
|
146 | + array('action' => 'default'), |
|
147 | + admin_url('admin.php?page=espresso_general_settings') |
|
148 | + ); |
|
149 | + $settings_url .= '#UXIP_settings'; |
|
150 | + printf( |
|
151 | + esc_html__( |
|
152 | + 'The Event Espresso UXIP feature is not yet active on your site. For %1$smore info%2$s and to opt-in %3$sclick here%4$s.', |
|
153 | + 'event_espresso' |
|
154 | + ), |
|
155 | + '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', |
|
156 | + '</a>', |
|
157 | + '<a href="' . $settings_url . '" target="_blank">', |
|
158 | + '</a>' |
|
159 | + ); |
|
160 | + } |
|
161 | + } |
|
162 | + |
|
163 | + |
|
164 | + /** |
|
165 | + * Callback for admin_enqueue_scripts that sets up the scripts and styles for the uxip notice |
|
166 | + */ |
|
167 | + public function enqueueScripts() |
|
168 | + { |
|
169 | + wp_register_script( |
|
170 | + 'ee-data-optin-js', |
|
171 | + EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', |
|
172 | + array('jquery'), |
|
173 | + EVENT_ESPRESSO_VERSION, |
|
174 | + true |
|
175 | + ); |
|
176 | + wp_register_style( |
|
177 | + 'ee-data-optin-css', |
|
178 | + EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', |
|
179 | + array(), |
|
180 | + EVENT_ESPRESSO_VERSION |
|
181 | + ); |
|
182 | + |
|
183 | + wp_enqueue_script('ee-data-optin-js'); |
|
184 | + wp_enqueue_style('ee-data-optin-css'); |
|
185 | + } |
|
186 | + |
|
187 | + |
|
188 | + /** |
|
189 | + * Callback for wp_ajax_espresso_data_optin that handles the ajax request |
|
190 | + */ |
|
191 | + public function ajaxHandler() |
|
192 | + { |
|
193 | + // verify nonce |
|
194 | + if (! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) { |
|
195 | + exit(); |
|
196 | + } |
|
197 | + |
|
198 | + // update has notified option |
|
199 | + $this->config->setHasNotifiedAboutUxip(); |
|
200 | + exit(); |
|
201 | + } |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * Used to determine whether additional stats are sent. |
|
206 | + */ |
|
207 | + private function sendStats() |
|
208 | + { |
|
209 | + return $this->config->isOptedInForUxip() |
|
210 | + && $this->maintenance_mode->level() !== EE_Maintenance_Mode::level_2_complete_maintenance |
|
211 | + && $this->statSendTimestampExpired(); |
|
212 | + } |
|
213 | + |
|
214 | + |
|
215 | + /** |
|
216 | + * Returns true when the timestamp used to track whether stats get sent (currently a weekly interval) is expired. |
|
217 | + * Returns false otherwise. |
|
218 | + * |
|
219 | + * @return bool |
|
220 | + */ |
|
221 | + private function statSendTimestampExpired() |
|
222 | + { |
|
223 | + $current_expiry = get_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, null); |
|
224 | + if ($current_expiry === null) { |
|
225 | + add_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS, '', 'no'); |
|
226 | + return true; |
|
227 | + } |
|
228 | + |
|
229 | + if (time() > (int) $current_expiry) { |
|
230 | + update_option(self::OPTIONS_KEY_EXPIRY_TIMESTAMP_FOR_SENDING_STATS, time() + WEEK_IN_SECONDS); |
|
231 | + return true; |
|
232 | + } |
|
233 | + return false; |
|
234 | + } |
|
235 | 235 | } |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | public function statsCallback() |
72 | 72 | { |
73 | 73 | // returns a callback that can is used to retrieve the stats to send along to the pue server. |
74 | - return function () { |
|
74 | + return function() { |
|
75 | 75 | // we only send stats one a week, so let's see if our stat timestamp has expired. |
76 | - if (! $this->sendStats()) { |
|
76 | + if ( ! $this->sendStats()) { |
|
77 | 77 | return array(); |
78 | 78 | } |
79 | 79 | return $this->stats_gatherer->stats(); |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function optinText($extra = true) |
123 | 123 | { |
124 | - if (! $extra) { |
|
124 | + if ( ! $extra) { |
|
125 | 125 | echo '<h2 class="ee-admin-settings-hdr" ' |
126 | - . (! $extra ? 'id="UXIP_settings"' : '') |
|
126 | + . ( ! $extra ? 'id="UXIP_settings"' : '') |
|
127 | 127 | . '>' |
128 | 128 | . esc_html__('User eXperience Improvement Program (UXIP)', 'event_espresso') |
129 | 129 | . EEH_Template::get_help_tab_link('organization_logo_info') |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ), |
155 | 155 | '<a href="https://eventespresso.com/about/user-experience-improvement-program-uxip/" target="_blank">', |
156 | 156 | '</a>', |
157 | - '<a href="' . $settings_url . '" target="_blank">', |
|
157 | + '<a href="'.$settings_url.'" target="_blank">', |
|
158 | 158 | '</a>' |
159 | 159 | ); |
160 | 160 | } |
@@ -168,14 +168,14 @@ discard block |
||
168 | 168 | { |
169 | 169 | wp_register_script( |
170 | 170 | 'ee-data-optin-js', |
171 | - EE_GLOBAL_ASSETS_URL . 'scripts/ee-data-optin.js', |
|
171 | + EE_GLOBAL_ASSETS_URL.'scripts/ee-data-optin.js', |
|
172 | 172 | array('jquery'), |
173 | 173 | EVENT_ESPRESSO_VERSION, |
174 | 174 | true |
175 | 175 | ); |
176 | 176 | wp_register_style( |
177 | 177 | 'ee-data-optin-css', |
178 | - EE_GLOBAL_ASSETS_URL . 'css/ee-data-optin.css', |
|
178 | + EE_GLOBAL_ASSETS_URL.'css/ee-data-optin.css', |
|
179 | 179 | array(), |
180 | 180 | EVENT_ESPRESSO_VERSION |
181 | 181 | ); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | public function ajaxHandler() |
192 | 192 | { |
193 | 193 | // verify nonce |
194 | - if (! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) { |
|
194 | + if ( ! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'], 'ee-data-optin')) { |
|
195 | 195 | exit(); |
196 | 196 | } |
197 | 197 |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - '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.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + '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.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.6.2'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - '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.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + '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.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.12.rc.009'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.12.rc.009'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |