mailpoet
Last commit date
assets
3 years ago
generated
3 years ago
lang
3 years ago
lib
3 years ago
lib-3rd-party
4 years ago
vendor
3 years ago
vendor-prefixed
3 years ago
views
3 years ago
index.php
4 years ago
license.txt
4 years ago
mailpoet-cron.php
3 years ago
mailpoet.php
3 years ago
mailpoet_initializer.php
3 years ago
readme.txt
3 years ago
mailpoet.php
145 lines
| 1 | <?php |
| 2 | |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | |
| 5 | |
| 6 | /* |
| 7 | * Plugin Name: MailPoet |
| 8 | * Version: 3.102.0 |
| 9 | * Plugin URI: http://www.mailpoet.com |
| 10 | * Description: Create and send newsletters, post notifications and welcome emails from your WordPress. |
| 11 | * Author: MailPoet |
| 12 | * Author URI: http://www.mailpoet.com |
| 13 | * Requires at least: 5.3 |
| 14 | * Text Domain: mailpoet |
| 15 | * Domain Path: /lang |
| 16 | * |
| 17 | * @package WordPress |
| 18 | * @author MailPoet |
| 19 | * @since 3.0.0-beta.1 |
| 20 | */ |
| 21 | |
| 22 | $mailpoetPlugin = [ |
| 23 | 'version' => '3.102.0', |
| 24 | 'filename' => __FILE__, |
| 25 | 'path' => dirname(__FILE__), |
| 26 | 'autoloader' => dirname(__FILE__) . '/vendor/autoload.php', |
| 27 | 'initializer' => dirname(__FILE__) . '/mailpoet_initializer.php', |
| 28 | ]; |
| 29 | |
| 30 | function mailpoet_deactivate_plugin() { |
| 31 | deactivate_plugins(plugin_basename(__FILE__)); |
| 32 | if (!empty($_GET['activate'])) { |
| 33 | unset($_GET['activate']); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | // Check for minimum supported WP version |
| 38 | if (version_compare(get_bloginfo('version'), '5.6', '<')) { |
| 39 | add_action('admin_notices', 'mailpoet_wp_version_notice'); |
| 40 | // deactivate the plugin |
| 41 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | // Check for minimum supported PHP version |
| 46 | if (version_compare(phpversion(), '7.2.0', '<')) { |
| 47 | add_action('admin_notices', 'mailpoet_php_version_notice'); |
| 48 | // deactivate the plugin |
| 49 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 50 | return; |
| 51 | } |
| 52 | |
| 53 | // Display WP version error notice |
| 54 | function mailpoet_wp_version_notice() { |
| 55 | $notice = str_replace( |
| 56 | '[link]', |
| 57 | '<a href="https://kb.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#wp_version" target="_blank">', |
| 58 | __('MailPoet plugin requires WordPress version 5.6 or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet') |
| 59 | ); |
| 60 | $notice = str_replace('[/link]', '</a>', $notice); |
| 61 | printf( |
| 62 | '<div class="error"><p>%1$s</p></div>', |
| 63 | wp_kses( |
| 64 | $notice, |
| 65 | [ |
| 66 | 'a' => [ |
| 67 | 'href' => true, |
| 68 | 'target' => true, |
| 69 | ], |
| 70 | ] |
| 71 | ) |
| 72 | ); |
| 73 | } |
| 74 | |
| 75 | // Display PHP version error notice |
| 76 | function mailpoet_php_version_notice() { |
| 77 | $noticeP1 = __('MailPoet requires PHP version 7.2 or newer (8.0 recommended). You are running version [version].', 'mailpoet'); |
| 78 | $noticeP1 = str_replace('[version]', phpversion(), $noticeP1); |
| 79 | |
| 80 | $noticeP2 = __('Please read our [link]instructions[/link] on how to upgrade your site.', 'mailpoet'); |
| 81 | $noticeP2 = str_replace( |
| 82 | '[link]', |
| 83 | '<a href="https://kb.mailpoet.com/article/251-upgrading-the-websites-php-version" target="_blank">', |
| 84 | $noticeP2 |
| 85 | ); |
| 86 | $noticeP2 = str_replace('[/link]', '</a>', $noticeP2); |
| 87 | |
| 88 | $noticeP3 = __('If you can’t upgrade the PHP version, [link]install this version[/link] of MailPoet. Remember to not update MailPoet ever again!', 'mailpoet'); |
| 89 | $noticeP3 = str_replace( |
| 90 | '[link]', |
| 91 | '<a href="https://downloads.wordpress.org/plugin/mailpoet.3.74.3.zip" target="_blank">', |
| 92 | $noticeP3 |
| 93 | ); |
| 94 | $noticeP3 = str_replace('[/link]', '</a>', $noticeP3); |
| 95 | |
| 96 | $allowedTags = [ |
| 97 | 'a' => [ |
| 98 | 'href' => true, |
| 99 | 'target' => true, |
| 100 | ], |
| 101 | ]; |
| 102 | printf( |
| 103 | '<div class="error"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>', |
| 104 | esc_html($noticeP1), |
| 105 | wp_kses( |
| 106 | $noticeP2, |
| 107 | $allowedTags |
| 108 | ), |
| 109 | wp_kses( |
| 110 | $noticeP3, |
| 111 | $allowedTags |
| 112 | ) |
| 113 | ); |
| 114 | } |
| 115 | |
| 116 | if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower(sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE']))), 'microsoft-iis') !== false) { |
| 117 | add_action('admin_notices', 'mailpoet_microsoft_iis_notice'); |
| 118 | // deactivate the plugin |
| 119 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | // Display IIS server error notice |
| 124 | function mailpoet_microsoft_iis_notice() { |
| 125 | $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'); |
| 126 | printf('<div class="error"><p>%1$s</p></div>', esc_html($notice)); |
| 127 | } |
| 128 | |
| 129 | // Check for presence of core dependencies |
| 130 | if (!file_exists($mailpoetPlugin['autoloader']) || !file_exists($mailpoetPlugin['initializer'])) { |
| 131 | add_action('admin_notices', 'mailpoet_core_dependency_notice'); |
| 132 | // deactivate the plugin |
| 133 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | // Display missing core dependencies error notice |
| 138 | function mailpoet_core_dependency_notice() { |
| 139 | $notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet'); |
| 140 | printf('<div class="error"><p>%1$s</p></div>', esc_html($notice)); |
| 141 | } |
| 142 | |
| 143 | // Initialize plugin |
| 144 | require_once($mailpoetPlugin['initializer']); |
| 145 |