@@ -18,181 +18,181 @@ |
||
| 18 | 18 | class RequestTypeContextDetector |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var RequestTypeContextFactoryInterface $factory |
|
| 23 | - */ |
|
| 24 | - private $factory; |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @var RequestInterface $request |
|
| 28 | - */ |
|
| 29 | - private $request; |
|
| 30 | - |
|
| 31 | - /** |
|
| 32 | - * @var array $globalRouteConditions |
|
| 33 | - */ |
|
| 34 | - private $globalRouteConditions; |
|
| 35 | - |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * RequestTypeContextDetector constructor. |
|
| 39 | - * |
|
| 40 | - * @param RequestInterface $request |
|
| 41 | - * @param RequestTypeContextFactoryInterface $factory |
|
| 42 | - * @param array $globalRouteConditions an array for injecting values that would |
|
| 43 | - * otherwise be defined as global constants |
|
| 44 | - * or other global variables for the current |
|
| 45 | - * request route such as DOING_AJAX |
|
| 46 | - */ |
|
| 47 | - public function __construct( |
|
| 48 | - RequestInterface $request, |
|
| 49 | - RequestTypeContextFactoryInterface $factory, |
|
| 50 | - array $globalRouteConditions = array() |
|
| 51 | - ) { |
|
| 52 | - $this->request = $request; |
|
| 53 | - $this->factory = $factory; |
|
| 54 | - $this->globalRouteConditions = $globalRouteConditions; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * @return mixed |
|
| 60 | - */ |
|
| 61 | - private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
| 62 | - { |
|
| 63 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
| 64 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
| 65 | - : $default; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * @return RequestTypeContext |
|
| 71 | - * @throws InvalidArgumentException |
|
| 72 | - */ |
|
| 73 | - public function detectRequestTypeContext() |
|
| 74 | - { |
|
| 75 | - // Detect error scrapes |
|
| 76 | - if ($this->request->getRequestParam('wp_scrape_key') !== null |
|
| 77 | - && $this->request->getRequestParam('wp_scrape_nonce') !== null |
|
| 78 | - ) { |
|
| 79 | - return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
| 80 | - } |
|
| 81 | - // Detect EE REST API |
|
| 82 | - if ($this->isEspressoRestApiRequest()) { |
|
| 83 | - return $this->factory->create(RequestTypeContext::API); |
|
| 84 | - } |
|
| 85 | - // Detect WP REST API |
|
| 86 | - if ($this->isWordPressRestApiRequest()) { |
|
| 87 | - return $this->factory->create(RequestTypeContext::WP_API); |
|
| 88 | - } |
|
| 89 | - // Detect AJAX |
|
| 90 | - if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
| 91 | - if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
| 92 | - return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
| 93 | - } |
|
| 94 | - if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
| 95 | - return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
| 96 | - } |
|
| 97 | - if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
| 98 | - return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
| 99 | - } |
|
| 100 | - return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
| 101 | - } |
|
| 102 | - // Detect WP_Cron |
|
| 103 | - if ($this->isCronRequest()) { |
|
| 104 | - return $this->factory->create(RequestTypeContext::CRON); |
|
| 105 | - } |
|
| 106 | - // Detect command line requests |
|
| 107 | - if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
| 108 | - return $this->factory->create(RequestTypeContext::CLI); |
|
| 109 | - } |
|
| 110 | - // detect WordPress admin (ie: "Dashboard") |
|
| 111 | - if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
| 112 | - return $this->factory->create(RequestTypeContext::ADMIN); |
|
| 113 | - } |
|
| 114 | - // Detect iFrames |
|
| 115 | - if ($this->isIframeRoute()) { |
|
| 116 | - return $this->factory->create(RequestTypeContext::IFRAME); |
|
| 117 | - } |
|
| 118 | - // Detect Feeds |
|
| 119 | - if ($this->isFeedRequest()) { |
|
| 120 | - return $this->factory->create(RequestTypeContext::FEED); |
|
| 121 | - } |
|
| 122 | - // and by process of elimination... |
|
| 123 | - return $this->factory->create(RequestTypeContext::FRONTEND); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @return bool |
|
| 129 | - */ |
|
| 130 | - private function isEspressoRestApiRequest() |
|
| 131 | - { |
|
| 132 | - // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
| 133 | - return strpos( |
|
| 134 | - $this->request->getRequestParam('rest_route', false), |
|
| 135 | - '/' . Domain::API_NAMESPACE |
|
| 136 | - ) === 0 |
|
| 137 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @return bool |
|
| 144 | - */ |
|
| 145 | - private function isWordPressRestApiRequest() |
|
| 146 | - { |
|
| 147 | - // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
| 148 | - return $this->request->getRequestParam('rest_route', false) |
|
| 149 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * @return bool |
|
| 155 | - */ |
|
| 156 | - private function isCronRequest() |
|
| 157 | - { |
|
| 158 | - return $this->uriPathMatches('wp-cron.php'); |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * @return bool |
|
| 164 | - */ |
|
| 165 | - private function isFeedRequest() |
|
| 166 | - { |
|
| 167 | - return $this->uriPathMatches('feed'); |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - |
|
| 171 | - /** |
|
| 172 | - * @param string $component |
|
| 173 | - * @return bool |
|
| 174 | - */ |
|
| 175 | - private function uriPathMatches($component) |
|
| 176 | - { |
|
| 177 | - $request_uri = $this->request->requestUri(); |
|
| 178 | - $parts = explode('?', $request_uri); |
|
| 179 | - $path = trim(reset($parts), '/'); |
|
| 180 | - return strpos($path, $component) === 0; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @return bool |
|
| 186 | - */ |
|
| 187 | - private function isIframeRoute() |
|
| 188 | - { |
|
| 189 | - $is_iframe_route = apply_filters( |
|
| 190 | - 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
| 191 | - $this->request->getRequestParam('event_list', '') === 'iframe' |
|
| 192 | - || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
| 193 | - || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
| 194 | - $this |
|
| 195 | - ); |
|
| 196 | - return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
| 197 | - } |
|
| 21 | + /** |
|
| 22 | + * @var RequestTypeContextFactoryInterface $factory |
|
| 23 | + */ |
|
| 24 | + private $factory; |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @var RequestInterface $request |
|
| 28 | + */ |
|
| 29 | + private $request; |
|
| 30 | + |
|
| 31 | + /** |
|
| 32 | + * @var array $globalRouteConditions |
|
| 33 | + */ |
|
| 34 | + private $globalRouteConditions; |
|
| 35 | + |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * RequestTypeContextDetector constructor. |
|
| 39 | + * |
|
| 40 | + * @param RequestInterface $request |
|
| 41 | + * @param RequestTypeContextFactoryInterface $factory |
|
| 42 | + * @param array $globalRouteConditions an array for injecting values that would |
|
| 43 | + * otherwise be defined as global constants |
|
| 44 | + * or other global variables for the current |
|
| 45 | + * request route such as DOING_AJAX |
|
| 46 | + */ |
|
| 47 | + public function __construct( |
|
| 48 | + RequestInterface $request, |
|
| 49 | + RequestTypeContextFactoryInterface $factory, |
|
| 50 | + array $globalRouteConditions = array() |
|
| 51 | + ) { |
|
| 52 | + $this->request = $request; |
|
| 53 | + $this->factory = $factory; |
|
| 54 | + $this->globalRouteConditions = $globalRouteConditions; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * @return mixed |
|
| 60 | + */ |
|
| 61 | + private function getGlobalRouteCondition($globalRouteCondition, $default) |
|
| 62 | + { |
|
| 63 | + return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
| 64 | + ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
| 65 | + : $default; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * @return RequestTypeContext |
|
| 71 | + * @throws InvalidArgumentException |
|
| 72 | + */ |
|
| 73 | + public function detectRequestTypeContext() |
|
| 74 | + { |
|
| 75 | + // Detect error scrapes |
|
| 76 | + if ($this->request->getRequestParam('wp_scrape_key') !== null |
|
| 77 | + && $this->request->getRequestParam('wp_scrape_nonce') !== null |
|
| 78 | + ) { |
|
| 79 | + return $this->factory->create(RequestTypeContext::WP_SCRAPE); |
|
| 80 | + } |
|
| 81 | + // Detect EE REST API |
|
| 82 | + if ($this->isEspressoRestApiRequest()) { |
|
| 83 | + return $this->factory->create(RequestTypeContext::API); |
|
| 84 | + } |
|
| 85 | + // Detect WP REST API |
|
| 86 | + if ($this->isWordPressRestApiRequest()) { |
|
| 87 | + return $this->factory->create(RequestTypeContext::WP_API); |
|
| 88 | + } |
|
| 89 | + // Detect AJAX |
|
| 90 | + if ($this->getGlobalRouteCondition('DOING_AJAX', false)) { |
|
| 91 | + if (filter_var($this->request->getRequestParam('ee_front_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
| 92 | + return $this->factory->create(RequestTypeContext::AJAX_FRONT); |
|
| 93 | + } |
|
| 94 | + if (filter_var($this->request->getRequestParam('ee_admin_ajax'), FILTER_VALIDATE_BOOLEAN)) { |
|
| 95 | + return $this->factory->create(RequestTypeContext::AJAX_ADMIN); |
|
| 96 | + } |
|
| 97 | + if ($this->request->getRequestParam('action') === 'heartbeat') { |
|
| 98 | + return $this->factory->create(RequestTypeContext::AJAX_HEARTBEAT); |
|
| 99 | + } |
|
| 100 | + return $this->factory->create(RequestTypeContext::AJAX_OTHER); |
|
| 101 | + } |
|
| 102 | + // Detect WP_Cron |
|
| 103 | + if ($this->isCronRequest()) { |
|
| 104 | + return $this->factory->create(RequestTypeContext::CRON); |
|
| 105 | + } |
|
| 106 | + // Detect command line requests |
|
| 107 | + if ($this->getGlobalRouteCondition('WP_CLI', false)) { |
|
| 108 | + return $this->factory->create(RequestTypeContext::CLI); |
|
| 109 | + } |
|
| 110 | + // detect WordPress admin (ie: "Dashboard") |
|
| 111 | + if ($this->getGlobalRouteCondition('is_admin', false)) { |
|
| 112 | + return $this->factory->create(RequestTypeContext::ADMIN); |
|
| 113 | + } |
|
| 114 | + // Detect iFrames |
|
| 115 | + if ($this->isIframeRoute()) { |
|
| 116 | + return $this->factory->create(RequestTypeContext::IFRAME); |
|
| 117 | + } |
|
| 118 | + // Detect Feeds |
|
| 119 | + if ($this->isFeedRequest()) { |
|
| 120 | + return $this->factory->create(RequestTypeContext::FEED); |
|
| 121 | + } |
|
| 122 | + // and by process of elimination... |
|
| 123 | + return $this->factory->create(RequestTypeContext::FRONTEND); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @return bool |
|
| 129 | + */ |
|
| 130 | + private function isEspressoRestApiRequest() |
|
| 131 | + { |
|
| 132 | + // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
|
| 133 | + return strpos( |
|
| 134 | + $this->request->getRequestParam('rest_route', false), |
|
| 135 | + '/' . Domain::API_NAMESPACE |
|
| 136 | + ) === 0 |
|
| 137 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @return bool |
|
| 144 | + */ |
|
| 145 | + private function isWordPressRestApiRequest() |
|
| 146 | + { |
|
| 147 | + // Check for URLs like http://mysite.com/?rest_route=/.. and http://mysite.com/wp-json/... |
|
| 148 | + return $this->request->getRequestParam('rest_route', false) |
|
| 149 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/')); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * @return bool |
|
| 155 | + */ |
|
| 156 | + private function isCronRequest() |
|
| 157 | + { |
|
| 158 | + return $this->uriPathMatches('wp-cron.php'); |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * @return bool |
|
| 164 | + */ |
|
| 165 | + private function isFeedRequest() |
|
| 166 | + { |
|
| 167 | + return $this->uriPathMatches('feed'); |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + |
|
| 171 | + /** |
|
| 172 | + * @param string $component |
|
| 173 | + * @return bool |
|
| 174 | + */ |
|
| 175 | + private function uriPathMatches($component) |
|
| 176 | + { |
|
| 177 | + $request_uri = $this->request->requestUri(); |
|
| 178 | + $parts = explode('?', $request_uri); |
|
| 179 | + $path = trim(reset($parts), '/'); |
|
| 180 | + return strpos($path, $component) === 0; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @return bool |
|
| 186 | + */ |
|
| 187 | + private function isIframeRoute() |
|
| 188 | + { |
|
| 189 | + $is_iframe_route = apply_filters( |
|
| 190 | + 'FHEE__EventEspresso_core_domain_services_contexts_RequestTypeContextDetector__isIframeRoute', |
|
| 191 | + $this->request->getRequestParam('event_list', '') === 'iframe' |
|
| 192 | + || $this->request->getRequestParam('ticket_selector', '') === 'iframe' |
|
| 193 | + || $this->request->getRequestParam('calendar', '') === 'iframe', |
|
| 194 | + $this |
|
| 195 | + ); |
|
| 196 | + return filter_var($is_iframe_route, FILTER_VALIDATE_BOOLEAN); |
|
| 197 | + } |
|
| 198 | 198 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function getGlobalRouteCondition($globalRouteCondition, $default) |
| 62 | 62 | { |
| 63 | - return isset($this->globalRouteConditions[ $globalRouteCondition ]) |
|
| 64 | - ? $this->globalRouteConditions[ $globalRouteCondition ] |
|
| 63 | + return isset($this->globalRouteConditions[$globalRouteCondition]) |
|
| 64 | + ? $this->globalRouteConditions[$globalRouteCondition] |
|
| 65 | 65 | : $default; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | // Check for URLs like http://mysite.com/?rest_route=/ee... and http://mysite.com/wp-json/ee/... |
| 133 | 133 | return strpos( |
| 134 | 134 | $this->request->getRequestParam('rest_route', false), |
| 135 | - '/' . Domain::API_NAMESPACE |
|
| 135 | + '/'.Domain::API_NAMESPACE |
|
| 136 | 136 | ) === 0 |
| 137 | - || $this->uriPathMatches(trim(rest_get_url_prefix(), '/') . '/' . Domain::API_NAMESPACE); |
|
| 137 | + || $this->uriPathMatches(trim(rest_get_url_prefix(), '/').'/'.Domain::API_NAMESPACE); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | |
@@ -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.4.0'); |
|
| 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.4.0'); |
|
| 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.9.80.rc.038'); |
|
| 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.9.80.rc.038'); |
|
| 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 | } |