@@ -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', '7.2.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', '7.2.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.10.44.rc.000'); |
|
| 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.44.rc.000'); |
|
| 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 | } |
| 141 | 141 | \ No newline at end of file |
@@ -12,98 +12,98 @@ |
||
| 12 | 12 | |
| 13 | 13 | class RegisterAddonPUE |
| 14 | 14 | { |
| 15 | - /** |
|
| 16 | - * @var array |
|
| 17 | - */ |
|
| 18 | - private static $addon_api_settings; |
|
| 15 | + /** |
|
| 16 | + * @var array |
|
| 17 | + */ |
|
| 18 | + private static $addon_api_settings; |
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | - public static function registerPUE( |
|
| 22 | - array $addon_api_settings, |
|
| 23 | - string $addon_name, |
|
| 24 | - string $class_name, |
|
| 25 | - array $addon_args |
|
| 26 | - ): array { |
|
| 27 | - if (! empty($addon_args['pue_options'])) { |
|
| 28 | - $addon_api_settings[ $addon_name ]['pue_options'] = [ |
|
| 29 | - 'pue_plugin_slug' => isset($addon_args['pue_options']['pue_plugin_slug']) |
|
| 30 | - ? (string) $addon_args['pue_options']['pue_plugin_slug'] |
|
| 31 | - : 'espresso_' . strtolower($class_name), |
|
| 32 | - 'plugin_basename' => isset($addon_args['pue_options']['plugin_basename']) |
|
| 33 | - ? (string) $addon_args['pue_options']['plugin_basename'] |
|
| 34 | - : plugin_basename($addon_args['main_file_path']), |
|
| 35 | - 'checkPeriod' => isset($addon_args['pue_options']['checkPeriod']) |
|
| 36 | - ? (string) $addon_args['pue_options']['checkPeriod'] |
|
| 37 | - : '24', |
|
| 38 | - 'use_wp_update' => isset($addon_args['pue_options']['use_wp_update']) |
|
| 39 | - ? (string) $addon_args['pue_options']['use_wp_update'] |
|
| 40 | - : false, |
|
| 41 | - ]; |
|
| 42 | - add_action( |
|
| 43 | - 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
| 44 | - [RegisterAddonPUE::class, 'loadPueUpdate'] |
|
| 45 | - ); |
|
| 46 | - } |
|
| 47 | - RegisterAddonPUE::$addon_api_settings = $addon_api_settings; |
|
| 48 | - return $addon_api_settings; |
|
| 49 | - } |
|
| 21 | + public static function registerPUE( |
|
| 22 | + array $addon_api_settings, |
|
| 23 | + string $addon_name, |
|
| 24 | + string $class_name, |
|
| 25 | + array $addon_args |
|
| 26 | + ): array { |
|
| 27 | + if (! empty($addon_args['pue_options'])) { |
|
| 28 | + $addon_api_settings[ $addon_name ]['pue_options'] = [ |
|
| 29 | + 'pue_plugin_slug' => isset($addon_args['pue_options']['pue_plugin_slug']) |
|
| 30 | + ? (string) $addon_args['pue_options']['pue_plugin_slug'] |
|
| 31 | + : 'espresso_' . strtolower($class_name), |
|
| 32 | + 'plugin_basename' => isset($addon_args['pue_options']['plugin_basename']) |
|
| 33 | + ? (string) $addon_args['pue_options']['plugin_basename'] |
|
| 34 | + : plugin_basename($addon_args['main_file_path']), |
|
| 35 | + 'checkPeriod' => isset($addon_args['pue_options']['checkPeriod']) |
|
| 36 | + ? (string) $addon_args['pue_options']['checkPeriod'] |
|
| 37 | + : '24', |
|
| 38 | + 'use_wp_update' => isset($addon_args['pue_options']['use_wp_update']) |
|
| 39 | + ? (string) $addon_args['pue_options']['use_wp_update'] |
|
| 40 | + : false, |
|
| 41 | + ]; |
|
| 42 | + add_action( |
|
| 43 | + 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
| 44 | + [RegisterAddonPUE::class, 'loadPueUpdate'] |
|
| 45 | + ); |
|
| 46 | + } |
|
| 47 | + RegisterAddonPUE::$addon_api_settings = $addon_api_settings; |
|
| 48 | + return $addon_api_settings; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - public static function setAddonPueSlug(EE_Addon $addon, string $addon_name) |
|
| 53 | - { |
|
| 54 | - // setup the add-on's pue_slug if we have one. |
|
| 55 | - if (! empty(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug'])) { |
|
| 56 | - $addon->setPueSlug(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug']); |
|
| 57 | - } |
|
| 58 | - } |
|
| 52 | + public static function setAddonPueSlug(EE_Addon $addon, string $addon_name) |
|
| 53 | + { |
|
| 54 | + // setup the add-on's pue_slug if we have one. |
|
| 55 | + if (! empty(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug'])) { |
|
| 56 | + $addon->setPueSlug(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug']); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * load_pue_update - Update notifications |
|
| 63 | - * |
|
| 64 | - * @return void |
|
| 65 | - * @throws InvalidArgumentException |
|
| 66 | - * @throws InvalidDataTypeException |
|
| 67 | - * @throws InvalidInterfaceException |
|
| 68 | - */ |
|
| 69 | - public static function loadPueUpdate() |
|
| 70 | - { |
|
| 71 | - // PUE client existence |
|
| 72 | - if (! is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { |
|
| 73 | - return; |
|
| 74 | - } |
|
| 61 | + /** |
|
| 62 | + * load_pue_update - Update notifications |
|
| 63 | + * |
|
| 64 | + * @return void |
|
| 65 | + * @throws InvalidArgumentException |
|
| 66 | + * @throws InvalidDataTypeException |
|
| 67 | + * @throws InvalidInterfaceException |
|
| 68 | + */ |
|
| 69 | + public static function loadPueUpdate() |
|
| 70 | + { |
|
| 71 | + // PUE client existence |
|
| 72 | + if (! is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { |
|
| 73 | + return; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** @var EE_Network_Config $network_config */ |
|
| 77 | - $network_config = LoaderFactory::getLoader()->getShared('EE_Network_Config'); |
|
| 78 | - // load PUE client |
|
| 79 | - require_once EE_THIRD_PARTY . 'pue/pue-client.php'; |
|
| 80 | - $license_server = defined('PUE_UPDATES_ENDPOINT') ? PUE_UPDATES_ENDPOINT : 'https://eventespresso.com'; |
|
| 81 | - // cycle thru settings |
|
| 82 | - foreach (RegisterAddonPUE::$addon_api_settings as $settings) { |
|
| 83 | - if (empty($settings['pue_options'])) { |
|
| 84 | - continue; |
|
| 85 | - } |
|
| 86 | - // initiate the class and start the plugin update engine! |
|
| 87 | - new PluginUpdateEngineChecker( |
|
| 88 | - // host file URL |
|
| 89 | - $license_server, |
|
| 90 | - // plugin slug(s) |
|
| 91 | - [ |
|
| 92 | - 'premium' => ['p' => $settings['pue_options']['pue_plugin_slug']], |
|
| 93 | - 'prerelease' => ['beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'], |
|
| 94 | - ], |
|
| 95 | - // options |
|
| 96 | - [ |
|
| 97 | - 'apikey' => $network_config->core->site_license_key, |
|
| 98 | - 'lang_domain' => 'event_espresso', |
|
| 99 | - 'checkPeriod' => $settings['pue_options']['checkPeriod'], |
|
| 100 | - 'option_key' => 'ee_site_license_key', |
|
| 101 | - 'options_page_slug' => 'event_espresso', |
|
| 102 | - 'plugin_basename' => $settings['pue_options']['plugin_basename'], |
|
| 103 | - // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP |
|
| 104 | - 'use_wp_update' => $settings['pue_options']['use_wp_update'], |
|
| 105 | - ] |
|
| 106 | - ); |
|
| 107 | - } |
|
| 108 | - } |
|
| 76 | + /** @var EE_Network_Config $network_config */ |
|
| 77 | + $network_config = LoaderFactory::getLoader()->getShared('EE_Network_Config'); |
|
| 78 | + // load PUE client |
|
| 79 | + require_once EE_THIRD_PARTY . 'pue/pue-client.php'; |
|
| 80 | + $license_server = defined('PUE_UPDATES_ENDPOINT') ? PUE_UPDATES_ENDPOINT : 'https://eventespresso.com'; |
|
| 81 | + // cycle thru settings |
|
| 82 | + foreach (RegisterAddonPUE::$addon_api_settings as $settings) { |
|
| 83 | + if (empty($settings['pue_options'])) { |
|
| 84 | + continue; |
|
| 85 | + } |
|
| 86 | + // initiate the class and start the plugin update engine! |
|
| 87 | + new PluginUpdateEngineChecker( |
|
| 88 | + // host file URL |
|
| 89 | + $license_server, |
|
| 90 | + // plugin slug(s) |
|
| 91 | + [ |
|
| 92 | + 'premium' => ['p' => $settings['pue_options']['pue_plugin_slug']], |
|
| 93 | + 'prerelease' => ['beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'], |
|
| 94 | + ], |
|
| 95 | + // options |
|
| 96 | + [ |
|
| 97 | + 'apikey' => $network_config->core->site_license_key, |
|
| 98 | + 'lang_domain' => 'event_espresso', |
|
| 99 | + 'checkPeriod' => $settings['pue_options']['checkPeriod'], |
|
| 100 | + 'option_key' => 'ee_site_license_key', |
|
| 101 | + 'options_page_slug' => 'event_espresso', |
|
| 102 | + 'plugin_basename' => $settings['pue_options']['plugin_basename'], |
|
| 103 | + // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP |
|
| 104 | + 'use_wp_update' => $settings['pue_options']['use_wp_update'], |
|
| 105 | + ] |
|
| 106 | + ); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | 109 | } |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | string $class_name, |
| 25 | 25 | array $addon_args |
| 26 | 26 | ): array { |
| 27 | - if (! empty($addon_args['pue_options'])) { |
|
| 28 | - $addon_api_settings[ $addon_name ]['pue_options'] = [ |
|
| 27 | + if ( ! empty($addon_args['pue_options'])) { |
|
| 28 | + $addon_api_settings[$addon_name]['pue_options'] = [ |
|
| 29 | 29 | 'pue_plugin_slug' => isset($addon_args['pue_options']['pue_plugin_slug']) |
| 30 | 30 | ? (string) $addon_args['pue_options']['pue_plugin_slug'] |
| 31 | - : 'espresso_' . strtolower($class_name), |
|
| 31 | + : 'espresso_'.strtolower($class_name), |
|
| 32 | 32 | 'plugin_basename' => isset($addon_args['pue_options']['plugin_basename']) |
| 33 | 33 | ? (string) $addon_args['pue_options']['plugin_basename'] |
| 34 | 34 | : plugin_basename($addon_args['main_file_path']), |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | public static function setAddonPueSlug(EE_Addon $addon, string $addon_name) |
| 53 | 53 | { |
| 54 | 54 | // setup the add-on's pue_slug if we have one. |
| 55 | - if (! empty(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug'])) { |
|
| 56 | - $addon->setPueSlug(RegisterAddonPUE::$addon_api_settings[ $addon_name ]['pue_options']['pue_plugin_slug']); |
|
| 55 | + if ( ! empty(RegisterAddonPUE::$addon_api_settings[$addon_name]['pue_options']['pue_plugin_slug'])) { |
|
| 56 | + $addon->setPueSlug(RegisterAddonPUE::$addon_api_settings[$addon_name]['pue_options']['pue_plugin_slug']); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -69,14 +69,14 @@ discard block |
||
| 69 | 69 | public static function loadPueUpdate() |
| 70 | 70 | { |
| 71 | 71 | // PUE client existence |
| 72 | - if (! is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { |
|
| 72 | + if ( ! is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { |
|
| 73 | 73 | return; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** @var EE_Network_Config $network_config */ |
| 77 | 77 | $network_config = LoaderFactory::getLoader()->getShared('EE_Network_Config'); |
| 78 | 78 | // load PUE client |
| 79 | - require_once EE_THIRD_PARTY . 'pue/pue-client.php'; |
|
| 79 | + require_once EE_THIRD_PARTY.'pue/pue-client.php'; |
|
| 80 | 80 | $license_server = defined('PUE_UPDATES_ENDPOINT') ? PUE_UPDATES_ENDPOINT : 'https://eventespresso.com'; |
| 81 | 81 | // cycle thru settings |
| 82 | 82 | foreach (RegisterAddonPUE::$addon_api_settings as $settings) { |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // plugin slug(s) |
| 91 | 91 | [ |
| 92 | 92 | 'premium' => ['p' => $settings['pue_options']['pue_plugin_slug']], |
| 93 | - 'prerelease' => ['beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'], |
|
| 93 | + 'prerelease' => ['beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'], |
|
| 94 | 94 | ], |
| 95 | 95 | // options |
| 96 | 96 | [ |