@@ -23,187 +23,187 @@ |
||
| 23 | 23 | class RecommendedVersions extends Middleware |
| 24 | 24 | { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * converts a Request to a Response |
|
| 28 | - * |
|
| 29 | - * @param RequestInterface $request |
|
| 30 | - * @param ResponseInterface $response |
|
| 31 | - * @return ResponseInterface |
|
| 32 | - * @throws InvalidDataTypeException |
|
| 33 | - */ |
|
| 34 | - public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
| 35 | - { |
|
| 36 | - $this->request = $request; |
|
| 37 | - $this->response = $response; |
|
| 38 | - // check required WP version |
|
| 39 | - if (! $this->minimumWordPressVersionRequired()) { |
|
| 40 | - $this->request->unSetRequestParam('activate', true); |
|
| 41 | - add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
| 42 | - $this->response->terminateRequest(); |
|
| 43 | - $this->response->deactivatePlugin(); |
|
| 44 | - } |
|
| 45 | - // check recommended PHP version |
|
| 46 | - if (! $this->minimumPhpVersionRecommended()) { |
|
| 47 | - $this->displayMinimumRecommendedPhpVersionNotice(); |
|
| 48 | - } |
|
| 49 | - //upcoming required version |
|
| 50 | - if (! $this->upcomingRequiredPhpVersion()) { |
|
| 51 | - $this->displayUpcomingRequiredVersion(); |
|
| 52 | - } |
|
| 53 | - $this->response = $this->processRequestStack($this->request, $this->response); |
|
| 54 | - return $this->response; |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - |
|
| 58 | - /** |
|
| 59 | - * Helper method to assess installed wp version against given values. |
|
| 60 | - * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
| 61 | - * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
| 62 | - * against) so consider that when sending in your values. |
|
| 63 | - * |
|
| 64 | - * @param string $version_to_check |
|
| 65 | - * @param string $operator |
|
| 66 | - * @return bool |
|
| 67 | - */ |
|
| 68 | - public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
| 69 | - { |
|
| 70 | - global $wp_version; |
|
| 71 | - return version_compare( |
|
| 72 | - // first account for wp_version being pre-release |
|
| 73 | - // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
| 74 | - strpos($wp_version, '-') > 0 |
|
| 75 | - ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
| 76 | - : $wp_version, |
|
| 77 | - $version_to_check, |
|
| 78 | - $operator |
|
| 79 | - ); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - |
|
| 84 | - /** |
|
| 85 | - * @return boolean |
|
| 86 | - */ |
|
| 87 | - private function minimumWordPressVersionRequired() |
|
| 88 | - { |
|
| 89 | - return RecommendedVersions::compareWordPressVersion(); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - /** |
|
| 95 | - * @param string $min_version |
|
| 96 | - * @return boolean |
|
| 97 | - */ |
|
| 98 | - private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
| 99 | - { |
|
| 100 | - return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @return boolean |
|
| 107 | - */ |
|
| 108 | - private function minimumPhpVersionRecommended() |
|
| 109 | - { |
|
| 110 | - return $this->checkPhpVersion(); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * @return void |
|
| 117 | - */ |
|
| 118 | - public function minimumWpVersionError() |
|
| 119 | - { |
|
| 120 | - global $wp_version; |
|
| 121 | - ?> |
|
| 26 | + /** |
|
| 27 | + * converts a Request to a Response |
|
| 28 | + * |
|
| 29 | + * @param RequestInterface $request |
|
| 30 | + * @param ResponseInterface $response |
|
| 31 | + * @return ResponseInterface |
|
| 32 | + * @throws InvalidDataTypeException |
|
| 33 | + */ |
|
| 34 | + public function handleRequest(RequestInterface $request, ResponseInterface $response) |
|
| 35 | + { |
|
| 36 | + $this->request = $request; |
|
| 37 | + $this->response = $response; |
|
| 38 | + // check required WP version |
|
| 39 | + if (! $this->minimumWordPressVersionRequired()) { |
|
| 40 | + $this->request->unSetRequestParam('activate', true); |
|
| 41 | + add_action('admin_notices', array($this, 'minimum_wp_version_error'), 1); |
|
| 42 | + $this->response->terminateRequest(); |
|
| 43 | + $this->response->deactivatePlugin(); |
|
| 44 | + } |
|
| 45 | + // check recommended PHP version |
|
| 46 | + if (! $this->minimumPhpVersionRecommended()) { |
|
| 47 | + $this->displayMinimumRecommendedPhpVersionNotice(); |
|
| 48 | + } |
|
| 49 | + //upcoming required version |
|
| 50 | + if (! $this->upcomingRequiredPhpVersion()) { |
|
| 51 | + $this->displayUpcomingRequiredVersion(); |
|
| 52 | + } |
|
| 53 | + $this->response = $this->processRequestStack($this->request, $this->response); |
|
| 54 | + return $this->response; |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + |
|
| 58 | + /** |
|
| 59 | + * Helper method to assess installed wp version against given values. |
|
| 60 | + * By default this compares the required minimum version of WP for EE against the installed version of WP |
|
| 61 | + * Note, $wp_version is the first parameter sent into the PHP version_compare function (what is being checked |
|
| 62 | + * against) so consider that when sending in your values. |
|
| 63 | + * |
|
| 64 | + * @param string $version_to_check |
|
| 65 | + * @param string $operator |
|
| 66 | + * @return bool |
|
| 67 | + */ |
|
| 68 | + public static function compareWordPressVersion($version_to_check = EE_MIN_WP_VER_REQUIRED, $operator = '>=') |
|
| 69 | + { |
|
| 70 | + global $wp_version; |
|
| 71 | + return version_compare( |
|
| 72 | + // first account for wp_version being pre-release |
|
| 73 | + // (like RC, beta etc) which are usually in the format like 4.7-RC3-39519 |
|
| 74 | + strpos($wp_version, '-') > 0 |
|
| 75 | + ? substr($wp_version, 0, strpos($wp_version, '-')) |
|
| 76 | + : $wp_version, |
|
| 77 | + $version_to_check, |
|
| 78 | + $operator |
|
| 79 | + ); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @return boolean |
|
| 86 | + */ |
|
| 87 | + private function minimumWordPressVersionRequired() |
|
| 88 | + { |
|
| 89 | + return RecommendedVersions::compareWordPressVersion(); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @param string $min_version |
|
| 96 | + * @return boolean |
|
| 97 | + */ |
|
| 98 | + private function checkPhpVersion($min_version = EE_MIN_PHP_VER_RECOMMENDED) |
|
| 99 | + { |
|
| 100 | + return version_compare(PHP_VERSION, $min_version, '>=') ? true : false; |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @return boolean |
|
| 107 | + */ |
|
| 108 | + private function minimumPhpVersionRecommended() |
|
| 109 | + { |
|
| 110 | + return $this->checkPhpVersion(); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * @return void |
|
| 117 | + */ |
|
| 118 | + public function minimumWpVersionError() |
|
| 119 | + { |
|
| 120 | + global $wp_version; |
|
| 121 | + ?> |
|
| 122 | 122 | <div class="error"> |
| 123 | 123 | <p> |
| 124 | 124 | <?php |
| 125 | - printf( |
|
| 126 | - __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
| 127 | - 'event_espresso'), |
|
| 128 | - EE_MIN_WP_VER_REQUIRED, |
|
| 129 | - $wp_version, |
|
| 130 | - '<br/>', |
|
| 131 | - '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
| 132 | - ); |
|
| 133 | - ?> |
|
| 125 | + printf( |
|
| 126 | + __('We\'re sorry, but Event Espresso requires WordPress version %1$s or greater in order to operate. You are currently running version %2$s.%3$sFor information on how to update your version of WordPress, please go to %4$s.', |
|
| 127 | + 'event_espresso'), |
|
| 128 | + EE_MIN_WP_VER_REQUIRED, |
|
| 129 | + $wp_version, |
|
| 130 | + '<br/>', |
|
| 131 | + '<a href="http://codex.wordpress.org/Updating_WordPress">http://codex.wordpress.org/Updating_WordPress</a>' |
|
| 132 | + ); |
|
| 133 | + ?> |
|
| 134 | 134 | </p> |
| 135 | 135 | </div> |
| 136 | 136 | <?php |
| 137 | - } |
|
| 138 | - |
|
| 139 | - |
|
| 140 | - |
|
| 141 | - /** |
|
| 142 | - * _display_minimum_recommended_php_version_notice |
|
| 143 | - * |
|
| 144 | - * @access private |
|
| 145 | - * @return void |
|
| 146 | - * @throws InvalidDataTypeException |
|
| 147 | - */ |
|
| 148 | - private function displayMinimumRecommendedPhpVersionNotice() |
|
| 149 | - { |
|
| 150 | - if ($this->request->isAdmin()) { |
|
| 151 | - new PersistentAdminNotice( |
|
| 152 | - 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
| 153 | - sprintf( |
|
| 154 | - esc_html__( |
|
| 155 | - 'Event Espresso recommends PHP version %1$s or greater for optimal performance. 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.', |
|
| 156 | - 'event_espresso' |
|
| 157 | - ), |
|
| 158 | - EE_MIN_PHP_VER_RECOMMENDED, |
|
| 159 | - PHP_VERSION, |
|
| 160 | - '<br/>', |
|
| 161 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 162 | - ) |
|
| 163 | - ); |
|
| 164 | - } |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * Returns whether the provided php version number is less than the current version of php installed on the server. |
|
| 170 | - * |
|
| 171 | - * @param string $version_required |
|
| 172 | - * @return bool |
|
| 173 | - */ |
|
| 174 | - private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
| 175 | - { |
|
| 176 | - return true; |
|
| 177 | - //return $this->checkPhpVersion($version_required); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
| 183 | - */ |
|
| 184 | - private function displayUpcomingRequiredVersion() |
|
| 185 | - { |
|
| 186 | - if ($this->request->isAdmin() |
|
| 187 | - && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request) |
|
| 188 | - && current_user_can('update_plugins') |
|
| 189 | - ) { |
|
| 190 | - add_action('admin_notices', function () |
|
| 191 | - { |
|
| 192 | - echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
| 193 | - . sprintf( |
|
| 194 | - esc_html__( |
|
| 195 | - 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
| 196 | - 'event_espresso' |
|
| 197 | - ), |
|
| 198 | - '<strong>', |
|
| 199 | - '</strong>', |
|
| 200 | - PHP_VERSION, |
|
| 201 | - '<a href="https://wordpress.org/support/upgrade-php/">', |
|
| 202 | - '</a>' |
|
| 203 | - ) |
|
| 204 | - . '</p></div>'; |
|
| 205 | - }); |
|
| 206 | - } |
|
| 207 | - } |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + |
|
| 140 | + |
|
| 141 | + /** |
|
| 142 | + * _display_minimum_recommended_php_version_notice |
|
| 143 | + * |
|
| 144 | + * @access private |
|
| 145 | + * @return void |
|
| 146 | + * @throws InvalidDataTypeException |
|
| 147 | + */ |
|
| 148 | + private function displayMinimumRecommendedPhpVersionNotice() |
|
| 149 | + { |
|
| 150 | + if ($this->request->isAdmin()) { |
|
| 151 | + new PersistentAdminNotice( |
|
| 152 | + 'php_version_' . str_replace('.', '-', EE_MIN_PHP_VER_RECOMMENDED) . '_recommended', |
|
| 153 | + sprintf( |
|
| 154 | + esc_html__( |
|
| 155 | + 'Event Espresso recommends PHP version %1$s or greater for optimal performance. 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.', |
|
| 156 | + 'event_espresso' |
|
| 157 | + ), |
|
| 158 | + EE_MIN_PHP_VER_RECOMMENDED, |
|
| 159 | + PHP_VERSION, |
|
| 160 | + '<br/>', |
|
| 161 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
| 162 | + ) |
|
| 163 | + ); |
|
| 164 | + } |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * Returns whether the provided php version number is less than the current version of php installed on the server. |
|
| 170 | + * |
|
| 171 | + * @param string $version_required |
|
| 172 | + * @return bool |
|
| 173 | + */ |
|
| 174 | + private function upcomingRequiredPhpVersion($version_required = '5.5') |
|
| 175 | + { |
|
| 176 | + return true; |
|
| 177 | + //return $this->checkPhpVersion($version_required); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Sets a notice for an upcoming required version of PHP in the next update of EE core. |
|
| 183 | + */ |
|
| 184 | + private function displayUpcomingRequiredVersion() |
|
| 185 | + { |
|
| 186 | + if ($this->request->isAdmin() |
|
| 187 | + && apply_filters('FHEE__EE_Recommended_Versions__displayUpcomingRequiredVersion', true, $this->request) |
|
| 188 | + && current_user_can('update_plugins') |
|
| 189 | + ) { |
|
| 190 | + add_action('admin_notices', function () |
|
| 191 | + { |
|
| 192 | + echo '<div class="notice event-espresso-admin-notice notice-warning"><p>' |
|
| 193 | + . sprintf( |
|
| 194 | + esc_html__( |
|
| 195 | + 'Please note: The next update of Event Espresso 4 will %1$srequire%2$s PHP 5.4.45 or greater. Your web server\'s PHP version is %3$s. You can contact your host and ask them to update your PHP version to at least PHP 5.6. Please do not update to the new version of Event Espresso 4 until the PHP update is completed. Read about why keeping your server on the latest version of PHP is a good idea %4$shere%5$s', |
|
| 196 | + 'event_espresso' |
|
| 197 | + ), |
|
| 198 | + '<strong>', |
|
| 199 | + '</strong>', |
|
| 200 | + PHP_VERSION, |
|
| 201 | + '<a href="https://wordpress.org/support/upgrade-php/">', |
|
| 202 | + '</a>' |
|
| 203 | + ) |
|
| 204 | + . '</p></div>'; |
|
| 205 | + }); |
|
| 206 | + } |
|
| 207 | + } |
|
| 208 | 208 | } |
| 209 | 209 | // Location: RecommendedVersions.php |
@@ -22,331 +22,331 @@ |
||
| 22 | 22 | class EE_Request implements LegacyRequestInterface, InterminableInterface |
| 23 | 23 | { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var RequestInterface $request |
|
| 27 | - */ |
|
| 28 | - private $request; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * whether current request is for the admin but NOT via AJAX |
|
| 32 | - * |
|
| 33 | - * @var boolean $admin |
|
| 34 | - */ |
|
| 35 | - public $admin = false; |
|
| 36 | - |
|
| 37 | - /** |
|
| 38 | - * whether current request is via AJAX |
|
| 39 | - * |
|
| 40 | - * @var boolean $ajax |
|
| 41 | - */ |
|
| 42 | - public $ajax = false; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * whether current request is via AJAX from the frontend of the site |
|
| 46 | - * |
|
| 47 | - * @var boolean $front_ajax |
|
| 48 | - */ |
|
| 49 | - public $front_ajax = false; |
|
| 50 | - |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * @deprecated 4.9.53 |
|
| 54 | - * @param array $get |
|
| 55 | - * @param array $post |
|
| 56 | - * @param array $cookie |
|
| 57 | - * @param array $server |
|
| 58 | - */ |
|
| 59 | - public function __construct( |
|
| 60 | - array $get = array(), |
|
| 61 | - array $post = array(), |
|
| 62 | - array $cookie = array(), |
|
| 63 | - array $server = array() |
|
| 64 | - ) { |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @return RequestInterface |
|
| 70 | - * @throws InvalidArgumentException |
|
| 71 | - * @throws InvalidInterfaceException |
|
| 72 | - * @throws InvalidDataTypeException |
|
| 73 | - */ |
|
| 74 | - private function request() |
|
| 75 | - { |
|
| 76 | - if($this->request instanceof RequestInterface){ |
|
| 77 | - return $this->request; |
|
| 78 | - } |
|
| 79 | - $loader = LoaderFactory::getLoader(); |
|
| 80 | - $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
| 81 | - return $this->request; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * @param RequestInterface $request |
|
| 87 | - */ |
|
| 88 | - public function setRequest(RequestInterface $request) |
|
| 89 | - { |
|
| 90 | - $this->request = $request; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * @deprecated 4.9.53 |
|
| 97 | - * @return array |
|
| 98 | - * @throws InvalidArgumentException |
|
| 99 | - * @throws InvalidDataTypeException |
|
| 100 | - * @throws InvalidInterfaceException |
|
| 101 | - */ |
|
| 102 | - public function get_params() |
|
| 103 | - { |
|
| 104 | - return $this->request()->getParams(); |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * @deprecated 4.9.53 |
|
| 111 | - * @return array |
|
| 112 | - * @throws InvalidArgumentException |
|
| 113 | - * @throws InvalidDataTypeException |
|
| 114 | - * @throws InvalidInterfaceException |
|
| 115 | - */ |
|
| 116 | - public function post_params() |
|
| 117 | - { |
|
| 118 | - return $this->request()->postParams(); |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * @deprecated 4.9.53 |
|
| 125 | - * @return array |
|
| 126 | - * @throws InvalidArgumentException |
|
| 127 | - * @throws InvalidDataTypeException |
|
| 128 | - * @throws InvalidInterfaceException |
|
| 129 | - */ |
|
| 130 | - public function cookie_params() |
|
| 131 | - { |
|
| 132 | - return $this->request()->cookieParams(); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * @deprecated 4.9.53 |
|
| 138 | - * @return array |
|
| 139 | - * @throws InvalidArgumentException |
|
| 140 | - * @throws InvalidDataTypeException |
|
| 141 | - * @throws InvalidInterfaceException |
|
| 142 | - */ |
|
| 143 | - public function server_params() |
|
| 144 | - { |
|
| 145 | - return $this->request()->serverParams(); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * returns contents of $_REQUEST |
|
| 152 | - * |
|
| 153 | - * @deprecated 4.9.53 |
|
| 154 | - * @return array |
|
| 155 | - * @throws InvalidArgumentException |
|
| 156 | - * @throws InvalidDataTypeException |
|
| 157 | - * @throws InvalidInterfaceException |
|
| 158 | - */ |
|
| 159 | - public function params() |
|
| 160 | - { |
|
| 161 | - return $this->request()->requestParams(); |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * @deprecated 4.9.53 |
|
| 168 | - * @param $key |
|
| 169 | - * @param $value |
|
| 170 | - * @param bool $override_ee |
|
| 171 | - * @return void |
|
| 172 | - * @throws InvalidArgumentException |
|
| 173 | - * @throws InvalidDataTypeException |
|
| 174 | - * @throws InvalidInterfaceException |
|
| 175 | - */ |
|
| 176 | - public function set($key, $value, $override_ee = false) |
|
| 177 | - { |
|
| 178 | - $this->request()->setRequestParam($key, $value, $override_ee); |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * returns the value for a request param if the given key exists |
|
| 185 | - * |
|
| 186 | - * @deprecated 4.9.53 |
|
| 187 | - * @param $key |
|
| 188 | - * @param null $default |
|
| 189 | - * @return mixed |
|
| 190 | - * @throws InvalidArgumentException |
|
| 191 | - * @throws InvalidDataTypeException |
|
| 192 | - * @throws InvalidInterfaceException |
|
| 193 | - */ |
|
| 194 | - public function get($key, $default = null) |
|
| 195 | - { |
|
| 196 | - return $this->request()->getRequestParam($key, $default); |
|
| 197 | - } |
|
| 198 | - |
|
| 199 | - |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * check if param exists |
|
| 203 | - * |
|
| 204 | - * @deprecated 4.9.53 |
|
| 205 | - * @param $key |
|
| 206 | - * @return bool |
|
| 207 | - * @throws InvalidArgumentException |
|
| 208 | - * @throws InvalidDataTypeException |
|
| 209 | - * @throws InvalidInterfaceException |
|
| 210 | - */ |
|
| 211 | - public function is_set($key) |
|
| 212 | - { |
|
| 213 | - return $this->request()->requestParamIsSet($key); |
|
| 214 | - } |
|
| 215 | - |
|
| 216 | - |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * remove param |
|
| 220 | - * |
|
| 221 | - * @deprecated 4.9.53 |
|
| 222 | - * @param $key |
|
| 223 | - * @param bool $unset_from_global_too |
|
| 224 | - * @throws InvalidArgumentException |
|
| 225 | - * @throws InvalidDataTypeException |
|
| 226 | - * @throws InvalidInterfaceException |
|
| 227 | - */ |
|
| 228 | - public function un_set($key, $unset_from_global_too = false) |
|
| 229 | - { |
|
| 230 | - $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - |
|
| 234 | - |
|
| 235 | - /** |
|
| 236 | - * @deprecated 4.9.53 |
|
| 237 | - * @return string |
|
| 238 | - * @throws InvalidArgumentException |
|
| 239 | - * @throws InvalidDataTypeException |
|
| 240 | - * @throws InvalidInterfaceException |
|
| 241 | - */ |
|
| 242 | - public function ip_address() |
|
| 243 | - { |
|
| 244 | - return $this->request()->ipAddress(); |
|
| 245 | - } |
|
| 246 | - |
|
| 247 | - |
|
| 248 | - /** |
|
| 249 | - * @deprecated 4.9.53 |
|
| 250 | - * @return bool |
|
| 251 | - * @throws InvalidArgumentException |
|
| 252 | - * @throws InvalidDataTypeException |
|
| 253 | - * @throws InvalidInterfaceException |
|
| 254 | - */ |
|
| 255 | - public function isAdmin() |
|
| 256 | - { |
|
| 257 | - return $this->request()->isAdmin(); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * @deprecated 4.9.53 |
|
| 263 | - * @return mixed |
|
| 264 | - * @throws InvalidArgumentException |
|
| 265 | - * @throws InvalidDataTypeException |
|
| 266 | - * @throws InvalidInterfaceException |
|
| 267 | - */ |
|
| 268 | - public function isAjax() |
|
| 269 | - { |
|
| 270 | - return $this->request()->isAjax(); |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * @deprecated 4.9.53 |
|
| 276 | - * @return mixed |
|
| 277 | - * @throws InvalidArgumentException |
|
| 278 | - * @throws InvalidDataTypeException |
|
| 279 | - * @throws InvalidInterfaceException |
|
| 280 | - */ |
|
| 281 | - public function isFrontAjax() |
|
| 282 | - { |
|
| 283 | - return $this->request()->isFrontAjax(); |
|
| 284 | - } |
|
| 285 | - |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * @deprecated 4.9.53 |
|
| 289 | - * @return mixed|string |
|
| 290 | - * @throws InvalidArgumentException |
|
| 291 | - * @throws InvalidDataTypeException |
|
| 292 | - * @throws InvalidInterfaceException |
|
| 293 | - */ |
|
| 294 | - public function requestUri() |
|
| 295 | - { |
|
| 296 | - return $this->request()->requestUri(); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - |
|
| 300 | - /** |
|
| 301 | - * @deprecated 4.9.53 |
|
| 302 | - * @return string |
|
| 303 | - * @throws InvalidArgumentException |
|
| 304 | - * @throws InvalidDataTypeException |
|
| 305 | - * @throws InvalidInterfaceException |
|
| 306 | - */ |
|
| 307 | - public function userAgent() |
|
| 308 | - { |
|
| 309 | - return $this->request()->userAgent(); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * @deprecated 4.9.53 |
|
| 315 | - * @param string $user_agent |
|
| 316 | - * @throws InvalidArgumentException |
|
| 317 | - * @throws InvalidDataTypeException |
|
| 318 | - * @throws InvalidInterfaceException |
|
| 319 | - */ |
|
| 320 | - public function setUserAgent($user_agent = '') |
|
| 321 | - { |
|
| 322 | - $this->request()->setUserAgent($user_agent); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - |
|
| 326 | - /** |
|
| 327 | - * @deprecated 4.9.53 |
|
| 328 | - * @return bool |
|
| 329 | - * @throws InvalidArgumentException |
|
| 330 | - * @throws InvalidDataTypeException |
|
| 331 | - * @throws InvalidInterfaceException |
|
| 332 | - */ |
|
| 333 | - public function isBot() |
|
| 334 | - { |
|
| 335 | - return $this->request()->isBot(); |
|
| 336 | - } |
|
| 337 | - |
|
| 338 | - |
|
| 339 | - /** |
|
| 340 | - * @deprecated 4.9.53 |
|
| 341 | - * @param bool $is_bot |
|
| 342 | - * @throws InvalidArgumentException |
|
| 343 | - * @throws InvalidDataTypeException |
|
| 344 | - * @throws InvalidInterfaceException |
|
| 345 | - */ |
|
| 346 | - public function setIsBot($is_bot) |
|
| 347 | - { |
|
| 348 | - $this->request()->setIsBot($is_bot); |
|
| 349 | - } |
|
| 25 | + /** |
|
| 26 | + * @var RequestInterface $request |
|
| 27 | + */ |
|
| 28 | + private $request; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * whether current request is for the admin but NOT via AJAX |
|
| 32 | + * |
|
| 33 | + * @var boolean $admin |
|
| 34 | + */ |
|
| 35 | + public $admin = false; |
|
| 36 | + |
|
| 37 | + /** |
|
| 38 | + * whether current request is via AJAX |
|
| 39 | + * |
|
| 40 | + * @var boolean $ajax |
|
| 41 | + */ |
|
| 42 | + public $ajax = false; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * whether current request is via AJAX from the frontend of the site |
|
| 46 | + * |
|
| 47 | + * @var boolean $front_ajax |
|
| 48 | + */ |
|
| 49 | + public $front_ajax = false; |
|
| 50 | + |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * @deprecated 4.9.53 |
|
| 54 | + * @param array $get |
|
| 55 | + * @param array $post |
|
| 56 | + * @param array $cookie |
|
| 57 | + * @param array $server |
|
| 58 | + */ |
|
| 59 | + public function __construct( |
|
| 60 | + array $get = array(), |
|
| 61 | + array $post = array(), |
|
| 62 | + array $cookie = array(), |
|
| 63 | + array $server = array() |
|
| 64 | + ) { |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @return RequestInterface |
|
| 70 | + * @throws InvalidArgumentException |
|
| 71 | + * @throws InvalidInterfaceException |
|
| 72 | + * @throws InvalidDataTypeException |
|
| 73 | + */ |
|
| 74 | + private function request() |
|
| 75 | + { |
|
| 76 | + if($this->request instanceof RequestInterface){ |
|
| 77 | + return $this->request; |
|
| 78 | + } |
|
| 79 | + $loader = LoaderFactory::getLoader(); |
|
| 80 | + $this->request = $loader->getShared('EventEspresso\core\services\request\RequestInterface'); |
|
| 81 | + return $this->request; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * @param RequestInterface $request |
|
| 87 | + */ |
|
| 88 | + public function setRequest(RequestInterface $request) |
|
| 89 | + { |
|
| 90 | + $this->request = $request; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * @deprecated 4.9.53 |
|
| 97 | + * @return array |
|
| 98 | + * @throws InvalidArgumentException |
|
| 99 | + * @throws InvalidDataTypeException |
|
| 100 | + * @throws InvalidInterfaceException |
|
| 101 | + */ |
|
| 102 | + public function get_params() |
|
| 103 | + { |
|
| 104 | + return $this->request()->getParams(); |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * @deprecated 4.9.53 |
|
| 111 | + * @return array |
|
| 112 | + * @throws InvalidArgumentException |
|
| 113 | + * @throws InvalidDataTypeException |
|
| 114 | + * @throws InvalidInterfaceException |
|
| 115 | + */ |
|
| 116 | + public function post_params() |
|
| 117 | + { |
|
| 118 | + return $this->request()->postParams(); |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * @deprecated 4.9.53 |
|
| 125 | + * @return array |
|
| 126 | + * @throws InvalidArgumentException |
|
| 127 | + * @throws InvalidDataTypeException |
|
| 128 | + * @throws InvalidInterfaceException |
|
| 129 | + */ |
|
| 130 | + public function cookie_params() |
|
| 131 | + { |
|
| 132 | + return $this->request()->cookieParams(); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * @deprecated 4.9.53 |
|
| 138 | + * @return array |
|
| 139 | + * @throws InvalidArgumentException |
|
| 140 | + * @throws InvalidDataTypeException |
|
| 141 | + * @throws InvalidInterfaceException |
|
| 142 | + */ |
|
| 143 | + public function server_params() |
|
| 144 | + { |
|
| 145 | + return $this->request()->serverParams(); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * returns contents of $_REQUEST |
|
| 152 | + * |
|
| 153 | + * @deprecated 4.9.53 |
|
| 154 | + * @return array |
|
| 155 | + * @throws InvalidArgumentException |
|
| 156 | + * @throws InvalidDataTypeException |
|
| 157 | + * @throws InvalidInterfaceException |
|
| 158 | + */ |
|
| 159 | + public function params() |
|
| 160 | + { |
|
| 161 | + return $this->request()->requestParams(); |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * @deprecated 4.9.53 |
|
| 168 | + * @param $key |
|
| 169 | + * @param $value |
|
| 170 | + * @param bool $override_ee |
|
| 171 | + * @return void |
|
| 172 | + * @throws InvalidArgumentException |
|
| 173 | + * @throws InvalidDataTypeException |
|
| 174 | + * @throws InvalidInterfaceException |
|
| 175 | + */ |
|
| 176 | + public function set($key, $value, $override_ee = false) |
|
| 177 | + { |
|
| 178 | + $this->request()->setRequestParam($key, $value, $override_ee); |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * returns the value for a request param if the given key exists |
|
| 185 | + * |
|
| 186 | + * @deprecated 4.9.53 |
|
| 187 | + * @param $key |
|
| 188 | + * @param null $default |
|
| 189 | + * @return mixed |
|
| 190 | + * @throws InvalidArgumentException |
|
| 191 | + * @throws InvalidDataTypeException |
|
| 192 | + * @throws InvalidInterfaceException |
|
| 193 | + */ |
|
| 194 | + public function get($key, $default = null) |
|
| 195 | + { |
|
| 196 | + return $this->request()->getRequestParam($key, $default); |
|
| 197 | + } |
|
| 198 | + |
|
| 199 | + |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * check if param exists |
|
| 203 | + * |
|
| 204 | + * @deprecated 4.9.53 |
|
| 205 | + * @param $key |
|
| 206 | + * @return bool |
|
| 207 | + * @throws InvalidArgumentException |
|
| 208 | + * @throws InvalidDataTypeException |
|
| 209 | + * @throws InvalidInterfaceException |
|
| 210 | + */ |
|
| 211 | + public function is_set($key) |
|
| 212 | + { |
|
| 213 | + return $this->request()->requestParamIsSet($key); |
|
| 214 | + } |
|
| 215 | + |
|
| 216 | + |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * remove param |
|
| 220 | + * |
|
| 221 | + * @deprecated 4.9.53 |
|
| 222 | + * @param $key |
|
| 223 | + * @param bool $unset_from_global_too |
|
| 224 | + * @throws InvalidArgumentException |
|
| 225 | + * @throws InvalidDataTypeException |
|
| 226 | + * @throws InvalidInterfaceException |
|
| 227 | + */ |
|
| 228 | + public function un_set($key, $unset_from_global_too = false) |
|
| 229 | + { |
|
| 230 | + $this->request()->unSetRequestParam($key, $unset_from_global_too); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + |
|
| 234 | + |
|
| 235 | + /** |
|
| 236 | + * @deprecated 4.9.53 |
|
| 237 | + * @return string |
|
| 238 | + * @throws InvalidArgumentException |
|
| 239 | + * @throws InvalidDataTypeException |
|
| 240 | + * @throws InvalidInterfaceException |
|
| 241 | + */ |
|
| 242 | + public function ip_address() |
|
| 243 | + { |
|
| 244 | + return $this->request()->ipAddress(); |
|
| 245 | + } |
|
| 246 | + |
|
| 247 | + |
|
| 248 | + /** |
|
| 249 | + * @deprecated 4.9.53 |
|
| 250 | + * @return bool |
|
| 251 | + * @throws InvalidArgumentException |
|
| 252 | + * @throws InvalidDataTypeException |
|
| 253 | + * @throws InvalidInterfaceException |
|
| 254 | + */ |
|
| 255 | + public function isAdmin() |
|
| 256 | + { |
|
| 257 | + return $this->request()->isAdmin(); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * @deprecated 4.9.53 |
|
| 263 | + * @return mixed |
|
| 264 | + * @throws InvalidArgumentException |
|
| 265 | + * @throws InvalidDataTypeException |
|
| 266 | + * @throws InvalidInterfaceException |
|
| 267 | + */ |
|
| 268 | + public function isAjax() |
|
| 269 | + { |
|
| 270 | + return $this->request()->isAjax(); |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * @deprecated 4.9.53 |
|
| 276 | + * @return mixed |
|
| 277 | + * @throws InvalidArgumentException |
|
| 278 | + * @throws InvalidDataTypeException |
|
| 279 | + * @throws InvalidInterfaceException |
|
| 280 | + */ |
|
| 281 | + public function isFrontAjax() |
|
| 282 | + { |
|
| 283 | + return $this->request()->isFrontAjax(); |
|
| 284 | + } |
|
| 285 | + |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * @deprecated 4.9.53 |
|
| 289 | + * @return mixed|string |
|
| 290 | + * @throws InvalidArgumentException |
|
| 291 | + * @throws InvalidDataTypeException |
|
| 292 | + * @throws InvalidInterfaceException |
|
| 293 | + */ |
|
| 294 | + public function requestUri() |
|
| 295 | + { |
|
| 296 | + return $this->request()->requestUri(); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + |
|
| 300 | + /** |
|
| 301 | + * @deprecated 4.9.53 |
|
| 302 | + * @return string |
|
| 303 | + * @throws InvalidArgumentException |
|
| 304 | + * @throws InvalidDataTypeException |
|
| 305 | + * @throws InvalidInterfaceException |
|
| 306 | + */ |
|
| 307 | + public function userAgent() |
|
| 308 | + { |
|
| 309 | + return $this->request()->userAgent(); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * @deprecated 4.9.53 |
|
| 315 | + * @param string $user_agent |
|
| 316 | + * @throws InvalidArgumentException |
|
| 317 | + * @throws InvalidDataTypeException |
|
| 318 | + * @throws InvalidInterfaceException |
|
| 319 | + */ |
|
| 320 | + public function setUserAgent($user_agent = '') |
|
| 321 | + { |
|
| 322 | + $this->request()->setUserAgent($user_agent); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + |
|
| 326 | + /** |
|
| 327 | + * @deprecated 4.9.53 |
|
| 328 | + * @return bool |
|
| 329 | + * @throws InvalidArgumentException |
|
| 330 | + * @throws InvalidDataTypeException |
|
| 331 | + * @throws InvalidInterfaceException |
|
| 332 | + */ |
|
| 333 | + public function isBot() |
|
| 334 | + { |
|
| 335 | + return $this->request()->isBot(); |
|
| 336 | + } |
|
| 337 | + |
|
| 338 | + |
|
| 339 | + /** |
|
| 340 | + * @deprecated 4.9.53 |
|
| 341 | + * @param bool $is_bot |
|
| 342 | + * @throws InvalidArgumentException |
|
| 343 | + * @throws InvalidDataTypeException |
|
| 344 | + * @throws InvalidInterfaceException |
|
| 345 | + */ |
|
| 346 | + public function setIsBot($is_bot) |
|
| 347 | + { |
|
| 348 | + $this->request()->setIsBot($is_bot); |
|
| 349 | + } |
|
| 350 | 350 | |
| 351 | 351 | |
| 352 | 352 | |
@@ -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 | |
| 64 | 64 | } else { |
| 65 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
| 66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 67 | - /** |
|
| 68 | - * espresso_minimum_php_version_error |
|
| 69 | - * @return void |
|
| 70 | - */ |
|
| 71 | - function espresso_minimum_php_version_error() |
|
| 72 | - { |
|
| 73 | - ?> |
|
| 65 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
| 66 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 67 | + /** |
|
| 68 | + * espresso_minimum_php_version_error |
|
| 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.59.rc.036'); |
|
| 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.59.rc.036'); |
|
| 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 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * @since 4.0 |
| 39 | 39 | */ |
| 40 | 40 | if (function_exists('espresso_version')) { |
| 41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
| 41 | + if ( ! function_exists('espresso_duplicate_plugin_error')) { |
|
| 42 | 42 | /** |
| 43 | 43 | * espresso_duplicate_plugin_error |
| 44 | 44 | * displays if more than one version of EE is activated at the same time |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | } else { |
| 65 | 65 | define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
| 66 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 66 | + if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
| 67 | 67 | /** |
| 68 | 68 | * espresso_minimum_php_version_error |
| 69 | 69 | * @return void |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
| 118 | 118 | |
| 119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
| 119 | + require_once __DIR__.'/core/bootstrap_espresso.php'; |
|
| 120 | 120 | bootstrap_espresso(); |
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | -if (! function_exists('espresso_deactivate_plugin')) { |
|
| 123 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
| 124 | 124 | /** |
| 125 | 125 | * deactivate_plugin |
| 126 | 126 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -131,8 +131,8 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function espresso_deactivate_plugin($plugin_basename = '') |
| 133 | 133 | { |
| 134 | - if (! function_exists('deactivate_plugins')) { |
|
| 135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
| 134 | + if ( ! function_exists('deactivate_plugins')) { |
|
| 135 | + require_once ABSPATH.'wp-admin/includes/plugin.php'; |
|
| 136 | 136 | } |
| 137 | 137 | unset($_GET['activate'], $_REQUEST['activate']); |
| 138 | 138 | deactivate_plugins($plugin_basename); |