PluginProbe
MailPoet – Newsletters, Email Marketing, and Automation / 4.7.1
MailPoet – Newsletters, Email Marketing, and Automation v4.7.1
5.38.0 5.37.0 5.36.1 5.36.0 5.35.1 5.35.0 5.34.3 5.34.2 5.34.1 5.34.0 5.33.1 5.33.0 5.32.0 5.31.0 5.30.0 5.29.0 5.28.1 5.28.0 5.27.0 5.26.0 5.26.1 5.25.0 5.24.0 4.43.0 4.43.1 All 542 releases
mailpoet / mailpoet.php
mailpoet.php
154 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
2
3 if (!defined('ABSPATH')) exit;
4
5
6 /*
7 * Plugin Name: MailPoet
8 * Version: 4.7.1
9 * Plugin URI: https://www.mailpoet.com
10 * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
11 * Author: MailPoet
12 * Author URI: https://www.mailpoet.com
13 * Requires at least: 5.9
14 * Text Domain: mailpoet
15 * Domain Path: /lang
16 *
17 * WC requires at least: 7.2.0
18 * WC tested up to: 7.4.0
19 *
20 * @package WordPress
21 * @author MailPoet
22 * @since 3.0.0-beta.1
23 */
24
25 $mailpoetPlugin = [
26 'version' => '4.7.1',
27 'filename' => __FILE__,
28 'path' => dirname(__FILE__),
29 'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
30 'initializer' => dirname(__FILE__) . '/mailpoet_initializer.php',
31 ];
32
33 const MAILPOET_MINIMUM_REQUIRED_WP_VERSION = '5.9';
34
35 function mailpoet_deactivate_plugin() {
36 deactivate_plugins(plugin_basename(__FILE__));
37 if (!empty($_GET['activate'])) {
38 unset($_GET['activate']);
39 }
40 }
41
42 // Check for minimum supported WP version
43 if (version_compare(get_bloginfo('version'), MAILPOET_MINIMUM_REQUIRED_WP_VERSION, '<')) {
44 add_action('admin_notices', 'mailpoet_wp_version_notice');
45 // deactivate the plugin
46 add_action('admin_init', 'mailpoet_deactivate_plugin');
47 return;
48 }
49
50 // Check for minimum supported PHP version
51 if (version_compare(phpversion(), '7.2.0', '<')) {
52 add_action('admin_notices', 'mailpoet_php_version_notice');
53 // deactivate the plugin
54 add_action('admin_init', 'mailpoet_deactivate_plugin');
55 return;
56 }
57
58 // Display WP version error notice
59 function mailpoet_wp_version_notice() {
60 $notice = str_replace(
61 '[link]',
62 '<a href="https://kb.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#wp_version" target="_blank">',
63 sprintf(
64 // translators: %s is the number of minimum WordPress version that MailPoet requires
65 __('MailPoet plugin requires WordPress version %s or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet'),
66 MAILPOET_MINIMUM_REQUIRED_WP_VERSION
67 )
68 );
69 $notice = str_replace('[/link]', '</a>', $notice);
70 printf(
71 '<div class="error"><p>%1$s</p></div>',
72 wp_kses(
73 $notice,
74 [
75 'a' => [
76 'href' => true,
77 'target' => true,
78 ],
79 ]
80 )
81 );
82 }
83
84 // Display PHP version error notice
85 function mailpoet_php_version_notice() {
86 $noticeP1 = __('MailPoet requires PHP version 7.2 or newer (8.0 recommended). You are running version [version].', 'mailpoet');
87 $noticeP1 = str_replace('[version]', phpversion(), $noticeP1);
88
89 $noticeP2 = __('Please read our [link]instructions[/link] on how to upgrade your site.', 'mailpoet');
90 $noticeP2 = str_replace(
91 '[link]',
92 '<a href="https://kb.mailpoet.com/article/251-upgrading-the-websites-php-version" target="_blank">',
93 $noticeP2
94 );
95 $noticeP2 = str_replace('[/link]', '</a>', $noticeP2);
96
97 $noticeP3 = __('If you can’t upgrade the PHP version, [link]install this version[/link] of MailPoet. Remember to not update MailPoet ever again!', 'mailpoet');
98 $noticeP3 = str_replace(
99 '[link]',
100 '<a href="https://downloads.wordpress.org/plugin/mailpoet.3.74.3.zip" target="_blank">',
101 $noticeP3
102 );
103 $noticeP3 = str_replace('[/link]', '</a>', $noticeP3);
104
105 $allowedTags = [
106 'a' => [
107 'href' => true,
108 'target' => true,
109 ],
110 ];
111 printf(
112 '<div class="error"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>',
113 esc_html($noticeP1),
114 wp_kses(
115 $noticeP2,
116 $allowedTags
117 ),
118 wp_kses(
119 $noticeP3,
120 $allowedTags
121 )
122 );
123 }
124
125 if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower(sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE']))), 'microsoft-iis') !== false) {
126 add_action('admin_notices', 'mailpoet_microsoft_iis_notice');
127 // deactivate the plugin
128 add_action('admin_init', 'mailpoet_deactivate_plugin');
129 return;
130 }
131
132 // Display IIS server error notice
133 function mailpoet_microsoft_iis_notice() {
134 $notice = __("MailPoet plugin cannot run under Microsoft's Internet Information Services (IIS) web server. We recommend that you use a web server powered by Apache or NGINX.", 'mailpoet');
135 printf('<div class="error"><p>%1$s</p></div>', esc_html($notice));
136 }
137
138 // Check for presence of core dependencies
139 if (!file_exists($mailpoetPlugin['autoloader']) || !file_exists($mailpoetPlugin['initializer'])) {
140 add_action('admin_notices', 'mailpoet_core_dependency_notice');
141 // deactivate the plugin
142 add_action('admin_init', 'mailpoet_deactivate_plugin');
143 return;
144 }
145
146 // Display missing core dependencies error notice
147 function mailpoet_core_dependency_notice() {
148 $notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet');
149 printf('<div class="error"><p>%1$s</p></div>', esc_html($notice));
150 }
151
152 // Initialize plugin
153 require_once($mailpoetPlugin['initializer']);
154