| @@ -2,12 +2,11 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Hostinger Tools |
| 4 | 4 | * Plugin URI: https://hostinger.com |
| 5 | 5 | * Description: Hostinger WordPress plugin. |
| 6 | - * Version: 3.0.75 | |
| 6 | + * Version: 3.0.2 | |
| 7 | 7 | * Requires at least: 5.5 |
| 8 | - * Tested up to: 7.0 | |
| 9 | - * Requires PHP: 8.1 | |
| 8 | + * Requires PHP: 8.0 | |
| 10 | 9 | * Author: Hostinger |
| 11 | 10 | * License: GPL v3 |
| 12 | 11 | * License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 13 | 12 | * Author URI: https://www.hostinger.com |
| @@ -23,20 +22,22 @@ | ||
| 23 | 22 | use Hostinger\WpMenuManager\Manager; |
| 24 | 23 | |
| 25 | 24 | defined( 'ABSPATH' ) || exit; |
| 26 | 25 | |
| 27 | -define( 'HOSTINGER_WORDPRESS_PLUGIN_VERSION', '3.0.75' ); | |
| 26 | +if ( ! defined( 'HOSTINGER_VERSION' ) ) { | |
| 27 | + define( 'HOSTINGER_VERSION', '3.0.2' ); | |
| 28 | +} | |
| 28 | 29 | |
| 29 | 30 | if ( ! defined( 'HOSTINGER_ABSPATH' ) ) { |
| 30 | - define( 'HOSTINGER_ABSPATH', plugin_dir_path( __FILE__ ) ); | |
| 31 | + define( 'HOSTINGER_ABSPATH', plugin_dir_path( __FILE__ ) ); | |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | if ( ! defined( 'HOSTINGER_PLUGIN_FILE' ) ) { |
| 34 | - define( 'HOSTINGER_PLUGIN_FILE', __FILE__ ); | |
| 35 | + define( 'HOSTINGER_PLUGIN_FILE', __FILE__ ); | |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | 38 | if ( ! defined( 'HOSTINGER_PLUGIN_URL' ) ) { |
| 38 | - define( 'HOSTINGER_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); | |
| 39 | + define( 'HOSTINGER_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); | |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | if ( ! defined( 'HOSTINGER_ASSETS_URL' ) ) { |
| 42 | 43 | define( 'HOSTINGER_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' ); |
| @@ -42,27 +43,27 @@ | ||
| 42 | 43 | define( 'HOSTINGER_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' ); |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | if ( ! defined( 'HOSTINGER_VUE_ASSETS_URL' ) ) { |
| 46 | - define( 'HOSTINGER_VUE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'vue-frontend/dist' ); | |
| 47 | + define( 'HOSTINGER_VUE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'vue-frontend/dist' ); | |
| 47 | 48 | } |
| 48 | 49 | |
| 49 | 50 | if ( ! defined( 'HOSTINGER_WP_CONFIG_PATH' ) ) { |
| 50 | - define( 'HOSTINGER_WP_CONFIG_PATH', ABSPATH . '.private/config.json' ); | |
| 51 | + define( 'HOSTINGER_WP_CONFIG_PATH', ABSPATH . '.private/config.json' ); | |
| 51 | 52 | } |
| 52 | 53 | |
| 53 | 54 | if ( ! defined( 'HOSTINGER_WP_TOKEN' ) ) { |
| 54 | - $hostinger_dir_parts = explode( '/', __DIR__ ); | |
| 55 | - $hostinger_server_root_path = '/' . $hostinger_dir_parts[1] . '/' . $hostinger_dir_parts[2]; | |
| 56 | - define( 'HOSTINGER_WP_TOKEN', $hostinger_server_root_path . '/.api_token' ); | |
| 55 | + $hostinger_dir_parts = explode( '/', __DIR__ ); | |
| 56 | + $hostinger_server_root_path = '/' . $hostinger_dir_parts[1] . '/' . $hostinger_dir_parts[2]; | |
| 57 | + define( 'HOSTINGER_WP_TOKEN', $hostinger_server_root_path . '/.api_token' ); | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | if ( ! defined( 'HOSTINGER_REST_URI' ) ) { |
| 60 | - define( 'HOSTINGER_REST_URI', 'https://rest-hosting.hostinger.com' ); | |
| 61 | + define( 'HOSTINGER_REST_URI', 'https://rest-hosting.hostinger.com' ); | |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | if ( ! defined( 'HOSTINGER_PLUGIN_SETTINGS_OPTION' ) ) { |
| 64 | - define( 'HOSTINGER_PLUGIN_SETTINGS_OPTION', 'hostinger_tools' ); | |
| 65 | + define( 'HOSTINGER_PLUGIN_SETTINGS_OPTION', 'hostinger_tools' ); | |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | 68 | if ( ! defined( 'HOSTINGER_PLUGIN_REST_API_BASE' ) ) { |
| 68 | 69 | define( 'HOSTINGER_PLUGIN_REST_API_BASE', 'hostinger-tools-plugin/v1' ); |
| @@ -68,27 +69,26 @@ | ||
| 68 | 69 | define( 'HOSTINGER_PLUGIN_REST_API_BASE', 'hostinger-tools-plugin/v1' ); |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | if ( ! defined( 'HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION' ) ) { |
| 72 | - define( 'HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION', '8.1' ); | |
| 73 | + define( 'HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION', '8.0' ); | |
| 73 | 74 | } |
| 74 | 75 | |
| 75 | 76 | if ( ! version_compare( phpversion(), HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION, '>=' ) ) { |
| 76 | - add_action( | |
| 77 | - 'admin_notices', | |
| 78 | - function () { | |
| 79 | - ?> | |
| 80 | - <div class="notice notice-error is-dismissible hts-theme-settings"> | |
| 81 | - <p> | |
| 82 | - <?php /* translators: %s: PHP version */ ?> | |
| 83 | - <strong><?php echo esc_html__( 'Attention:', 'hostinger' ); ?></strong> <?php printf( wp_kses( 'The Hostinger plugin requires minimum PHP version of <b>%s</b>.', 'hostinger' ), esc_html( HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION ) ); ?> | |
| 84 | - </p> | |
| 85 | - <p> | |
| 86 | - <?php /* translators: %s: PHP version */ ?> | |
| 87 | - <?php printf( wp_kses( 'You are running <b>%s</b> PHP version.', 'hostinger' ), esc_html( phpversion() ) ); ?> | |
| 88 | - </p> | |
| 89 | - </div> | |
| 90 | - <?php | |
| 77 | + | |
| 78 | + add_action( 'admin_notices', function() { | |
| 79 | + ?> | |
| 80 | + <div class="notice notice-error is-dismissible hts-theme-settings"> | |
| 81 | + <p> | |
| 82 | + <?php /* translators: %s: PHP version */ ?> | |
| 83 | + <strong><?php echo __( 'Attention:', 'hostinger' ); ?></strong> <?php echo sprintf( __( 'The Hostinger plugin requires minimum PHP version of <b>%s</b>. ', 'hostinger' ), HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION ); ?> | |
| 84 | + </p> | |
| 85 | + <p> | |
| 86 | + <?php /* translators: %s: PHP version */ ?> | |
| 87 | + <?php echo sprintf( __( 'You are running <b>%s</b> PHP version.', 'hostinger' ), phpversion() ); ?> | |
| 88 | + </p> | |
| 89 | + </div> | |
| 90 | + <?php | |
| 91 | 91 | } |
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | 94 | return; |
| @@ -93,27 +93,19 @@ | ||
| 93 | 93 | |
| 94 | 94 | return; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -$vendor_file = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload_packages.php'; | |
| 97 | +$vendor_file = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; | |
| 98 | 98 | |
| 99 | 99 | if ( file_exists( $vendor_file ) ) { |
| 100 | - require_once $vendor_file; | |
| 101 | -} else { | |
| 102 | - return; | |
| 100 | + require_once $vendor_file; | |
| 103 | 101 | } |
| 104 | 102 | |
| 105 | -// Action Scheduler should be loaded before plugins_loaded hook. | |
| 106 | -$action_scheduler = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'woocommerce' . DIRECTORY_SEPARATOR . 'action-scheduler' . DIRECTORY_SEPARATOR . 'action-scheduler.php'; | |
| 107 | -if ( file_exists( $action_scheduler ) ) { | |
| 108 | - require_once $action_scheduler; | |
| 109 | -} | |
| 110 | - | |
| 111 | 103 | /** |
| 112 | 104 | * Plugin activation hook. |
| 113 | 105 | */ |
| 114 | 106 | function hostinger_activate(): void { |
| 115 | - Activator::activate(); | |
| 107 | + Activator::activate(); | |
| 116 | 108 | } |
| 117 | 109 | |
| 118 | 110 | /** |
| 119 | 111 | * Plugin deactivation hook. |
| @@ -118,16 +110,17 @@ | ||
| 118 | 110 | /** |
| 119 | 111 | * Plugin deactivation hook. |
| 120 | 112 | */ |
| 121 | 113 | function hostinger_deactivate(): void { |
| 122 | - Deactivator::deactivate(); | |
| 114 | + Deactivator::deactivate(); | |
| 123 | 115 | } |
| 124 | 116 | |
| 125 | 117 | register_activation_hook( __FILE__, 'hostinger_activate' ); |
| 126 | 118 | register_deactivation_hook( __FILE__, 'hostinger_deactivate' ); |
| 127 | 119 | |
| 128 | -if ( ! function_exists( 'hostinger_load_menus' ) ) { | |
| 129 | - function hostinger_load_menus(): void { | |
| 120 | +if( !function_exists('hostinger_load_menus') ) { | |
| 121 | + function hostinger_load_menus(): void | |
| 122 | + { | |
| 130 | 123 | $manager = Manager::getInstance(); |
| 131 | 124 | $manager->boot(); |
| 132 | 125 | } |
| 133 | 126 | } |
| @@ -132,18 +125,9 @@ | ||
| 132 | 125 | } |
| 133 | 126 | } |
| 134 | 127 | |
| 135 | 128 | if ( ! has_action( 'plugins_loaded', 'hostinger_load_menus' ) ) { |
| 136 | - add_action( 'plugins_loaded', 'hostinger_load_menus' ); | |
| 129 | + add_action('plugins_loaded', 'hostinger_load_menus'); | |
| 137 | 130 | } |
| 138 | 131 | |
| 139 | - | |
| 140 | -function load_plugin() { | |
| 141 | - if ( class_exists( 'Hostinger\Hostinger' ) ) { | |
| 142 | - $hostinger = new Hostinger(); | |
| 143 | - $hostinger->run(); | |
| 144 | - } | |
| 145 | -} | |
| 146 | -add_action( 'plugins_loaded', 'load_plugin' ); | |
| 147 | - | |
| 148 | - | |
| 149 | - | |
| 132 | +$hostinger = new Hostinger(); | |
| 133 | +$hostinger->run(); | |