PluginProbe
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.4.3
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.4.3
1.8.0 1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 All 59 releases
hostinger-reach / hostinger-reach.php
hostinger-reach.php
103 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Hostinger Reach
4 * Plugin URI: https://hostinger.com
5 * Description: Integrate your WordPress site with Hostinger Reach.
6 * Version: 1.4.3
7 * Author: Hostinger
8 * Requires PHP: 8.1
9 * Requires at least: 6.0
10 * Tested up to: 6.9
11 * Author URI: https://www.hostinger.com/email-marketing
12 * License: GPL-2.0+
13 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
14 * Text Domain: hostinger-reach
15 * Domain Path: /languages
16 *
17 * @package HostingerReach
18 */
19
20 use Hostinger\Reach\Setup\Activator;
21 use Hostinger\WpMenuManager\Manager;
22 use Hostinger\Surveys\Loader;
23
24 if ( ! defined( 'ABSPATH' ) ) {
25 die;
26 }
27
28 define( 'HOSTINGER_REACH_PLUGIN_VERSION', '1.3.9' );
29 define( 'HOSTINGER_REACH_DB_VERSION', '1.2.1' );
30 define( 'HOSTINGER_REACH_MINIMUM_PHP_VERSION', '8.0' );
31 define( 'HOSTINGER_REACH_PLUGIN_FILE', __FILE__ );
32 define( 'HOSTINGER_REACH_PLUGIN_SLUG', basename( __FILE__, '.php' ) );
33 define( 'HOSTINGER_REACH_PLUGIN_URL', plugin_dir_url( HOSTINGER_REACH_PLUGIN_FILE ) );
34 define( 'HOSTINGER_REACH_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
35 define( 'HOSTINGER_REACH_PLUGIN_REST_API_BASE', 'hostinger-reach/v1' );
36 define( 'HOSTINGER_REACH_REST_URI', 'https://reach.hostinger.com' );
37 define( 'HOSTINGER_REACH_DEFAULT_CONTACT_LIST', 'WordPress' );
38 define( 'HOSTINGER_INTEGRATIONS_SUPPORTED', true );
39 define( 'HOSTINGER_REACH_DEFAULT_ABANDONED_CART_THRESHOLD', 4 * HOUR_IN_SECONDS );
40
41 $hostinger_dir_parts = explode( '/', __DIR__ );
42 $hostinger_server_root_path = '/' . $hostinger_dir_parts[1] . '/' . $hostinger_dir_parts[2];
43 define( 'HOSTINGER_REACH_WP_TOKEN', $hostinger_server_root_path . '/.api_token' );
44
45 if ( ! version_compare( phpversion(), HOSTINGER_REACH_MINIMUM_PHP_VERSION, '>=' ) ) {
46 add_action(
47 'admin_notices',
48 function (): void {
49 ?>
50 <div class="notice notice-error is-dismissible hts-theme-settings">
51 <p>
52 <strong><?php echo esc_html( __( 'Attention:', 'hostinger-reach' ) ); ?></strong>
53 <?php /* translators: %s: PHP version */ ?>
54 <?php echo esc_html( sprintf( __( 'Hostinger Reach requires minimum PHP version of <b>%s</b>. ', 'hostinger-reach' ), HOSTINGER_REACH_MINIMUM_PHP_VERSION ) ); ?>
55 </p>
56 <p>
57 <?php /* translators: %s: PHP version */ ?>
58 <?php echo esc_html( sprintf( __( 'You are running <b>%s</b> PHP version.', 'hostinger-reach' ), phpversion() ) ); ?>
59 </p>
60 </div>
61 <?php
62 }
63 );
64
65 return;
66 }
67
68 $vendor_file = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload_packages.php';
69 $composer_autoload = __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
70
71 if ( file_exists( $vendor_file ) ) {
72 require_once $vendor_file;
73 }
74
75 if ( file_exists( $composer_autoload ) ) {
76 require_once $composer_autoload;
77 }
78
79 if ( class_exists( 'Hostinger\Reach\Setup\Activator' ) ) {
80 new Activator( __FILE__ );
81 }
82
83 if ( ! function_exists( 'hostinger_load_menus' ) ) {
84 function hostinger_load_menus(): void {
85 $manager = Manager::getInstance();
86 $manager->boot();
87 }
88 }
89
90 if ( ! has_action( 'plugins_loaded', 'hostinger_load_menus' ) ) {
91 add_action( 'plugins_loaded', 'hostinger_load_menus' );
92 }
93
94 if ( ! function_exists( 'hostinger_add_surveys' ) ) {
95 function hostinger_add_surveys(): void {
96 $surveys = Loader::getInstance();
97 $surveys->boot();
98 }
99 }
100
101 if ( ! empty( $_SERVER['H_PLATFORM'] ) && ! has_action( 'plugins_loaded', 'hostinger_add_surveys' ) ) {
102 add_action( 'plugins_loaded', 'hostinger_add_surveys' );
103 }