PluginProbe
Hostinger Tools / 3.0.3
Hostinger Tools v3.0.3
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
← All changes | hostinger.php +81 -18 1.8.33.0.3 View file →
@@ -1,13 +1,12 @@
1 1 <?php
2 -
3 2 /**
4 - * Plugin Name: Hostinger
3 + * Plugin Name: Hostinger Tools
5 4 * Plugin URI: https://hostinger.com
6 5 * Description: Hostinger WordPress plugin.
7 - * Version: 1.8.3
8 - * Requires at least: 5.6
9 - * Requires PHP: 7.4
6 + * Version: 3.0.3
7 + * Requires at least: 5.5
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
@@ -13,14 +12,20 @@
13 12 * Author URI: https://www.hostinger.com
14 13 * Text Domain: hostinger
15 14 * Domain Path: /languages
16 15 *
16 + * @package Hostinger
17 17 */
18 18
19 +use Hostinger\Hostinger;
20 +use Hostinger\Activator;
21 +use Hostinger\Deactivator;
22 +use Hostinger\WpMenuManager\Manager;
23 +
19 24 defined( 'ABSPATH' ) || exit;
20 25
21 26 if ( ! defined( 'HOSTINGER_VERSION' ) ) {
22 - define( 'HOSTINGER_VERSION', '1.8.3' );
27 + define( 'HOSTINGER_VERSION', '3.0.3' );
23 28 }
24 29
25 30 if ( ! defined( 'HOSTINGER_ABSPATH' ) ) {
26 31 define( 'HOSTINGER_ABSPATH', plugin_dir_path( __FILE__ ) );
@@ -34,19 +39,23 @@
34 39 define( 'HOSTINGER_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
35 40 }
36 41
37 42 if ( ! defined( 'HOSTINGER_ASSETS_URL' ) ) {
38 - define( 'HOSTINGER_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' );
43 + define( 'HOSTINGER_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets/' );
39 44 }
40 45
46 +if ( ! defined( 'HOSTINGER_VUE_ASSETS_URL' ) ) {
47 + define( 'HOSTINGER_VUE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'vue-frontend/dist' );
48 +}
49 +
41 50 if ( ! defined( 'HOSTINGER_WP_CONFIG_PATH' ) ) {
42 - define( 'HOSTINGER_WP_CONFIG_PATH', ABSPATH . '/.private/config.json' );
51 + define( 'HOSTINGER_WP_CONFIG_PATH', ABSPATH . '.private/config.json' );
43 52 }
44 53
45 54 if ( ! defined( 'HOSTINGER_WP_TOKEN' ) ) {
46 - $path = explode('/', __DIR__);
47 - $serverRootPath = '/' . $path[1] . '/' . $path[2];
48 - define( 'HOSTINGER_WP_TOKEN', $serverRootPath . '/.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' );
49 58 }
50 59
51 60 if ( ! defined( 'HOSTINGER_REST_URI' ) ) {
52 61 define( 'HOSTINGER_REST_URI', 'https://rest-hosting.hostinger.com' );
@@ -51,20 +60,74 @@
51 60 if ( ! defined( 'HOSTINGER_REST_URI' ) ) {
52 61 define( 'HOSTINGER_REST_URI', 'https://rest-hosting.hostinger.com' );
53 62 }
54 63
64 +if ( ! defined( 'HOSTINGER_PLUGIN_SETTINGS_OPTION' ) ) {
65 + define( 'HOSTINGER_PLUGIN_SETTINGS_OPTION', 'hostinger_tools' );
66 +}
67 +
68 +if ( ! defined( 'HOSTINGER_PLUGIN_REST_API_BASE' ) ) {
69 + define( 'HOSTINGER_PLUGIN_REST_API_BASE', 'hostinger-tools-plugin/v1' );
70 +}
71 +
72 +if ( ! defined( 'HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION' ) ) {
73 + define( 'HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION', '8.0' );
74 +}
75 +
76 +if ( ! version_compare( phpversion(), HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION, '>=' ) ) {
77 + add_action(
78 + 'admin_notices',
79 + function () {
80 + ?>
81 + <div class="notice notice-error is-dismissible hts-theme-settings">
82 + <p>
83 + <?php /* translators: %s: PHP version */ ?>
84 + <strong><?php echo esc_html__( 'Attention:', 'hostinger' ); ?></strong> <?php printf( esc_html__( 'The Hostinger plugin requires minimum PHP version of <b>%s</b>.', 'hostinger' ), esc_html( HOSTINGER_PLUGIN_MINIMUM_PHP_VERSION ) ); ?>
85 + </p>
86 + <p>
87 + <?php /* translators: %s: PHP version */ ?>
88 + <?php printf( esc_html__( 'You are running <b>%s</b> PHP version.', 'hostinger' ), esc_html( phpversion() ) ); ?>
89 + </p>
90 + </div>
91 + <?php
92 + }
93 + );
94 +
95 + return;
96 +}
97 +
98 +$vendor_file = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
99 +
100 +if ( file_exists( $vendor_file ) ) {
101 + require_once $vendor_file;
102 +}
103 +
104 +/**
105 + * Plugin activation hook.
106 + */
55 107 function hostinger_activate(): void {
56 - require_once HOSTINGER_ABSPATH . 'includes/class-hostinger-activator.php';
57 - Hostinger_Activator::activate();
108 + Activator::activate();
58 109 }
59 110
111 +/**
112 + * Plugin deactivation hook.
113 + */
60 114 function hostinger_deactivate(): void {
61 - require_once HOSTINGER_ABSPATH . 'includes/class-hostinger-deactivator.php';
62 - Hostinger_Deactivator::deactivate();
115 + Deactivator::deactivate();
63 116 }
64 117
65 118 register_activation_hook( __FILE__, 'hostinger_activate' );
66 119 register_deactivation_hook( __FILE__, 'hostinger_deactivate' );
67 -require_once HOSTINGER_ABSPATH . 'includes/class-hostinger.php';
68 120
69 -$plugin = new Hostinger();
70 -$plugin->run();
121 +if ( ! function_exists( 'hostinger_load_menus' ) ) {
122 + function hostinger_load_menus(): void {
123 + $manager = Manager::getInstance();
124 + $manager->boot();
125 + }
126 +}
127 +
128 +if ( ! has_action( 'plugins_loaded', 'hostinger_load_menus' ) ) {
129 + add_action( 'plugins_loaded', 'hostinger_load_menus' );
130 +}
131 +
132 +$hostinger = new Hostinger();
133 +$hostinger->run();