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