| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) exit; |
| 4 |
|
| 5 |
|
| 6 |
/* |
| 7 |
* Plugin Name: MailPoet 3 (New) |
| 8 |
* Version: 3.60.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 |
* |
| 15 |
* @package WordPress |
| 16 |
* @author MailPoet |
| 17 |
* @since 3.0.0-beta.1 |
| 18 |
*/ |
| 19 |
|
| 20 |
$mailpoetPlugin = [ |
| 21 |
'version' => '3.60.0', |
| 22 |
'filename' => __FILE__, |
| 23 |
'path' => dirname(__FILE__), |
| 24 |
'autoloader' => dirname(__FILE__) . '/vendor/autoload.php', |
| 25 |
'initializer' => dirname(__FILE__) . '/mailpoet_initializer.php', |
| 26 |
]; |
| 27 |
|
| 28 |
function mailpoet_deactivate_plugin() { |
| 29 |
deactivate_plugins(plugin_basename(__FILE__)); |
| 30 |
if (!empty($_GET['activate'])) { |
| 31 |
unset($_GET['activate']); |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
// Check for minimum supported WP version |
| 36 |
if (version_compare(get_bloginfo('version'), '5.0', '<')) { |
| 37 |
add_action('admin_notices', 'mailpoet_wp_version_notice'); |
| 38 |
// deactivate the plugin |
| 39 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 40 |
return; |
| 41 |
} |
| 42 |
|
| 43 |
// Check for minimum supported PHP version |
| 44 |
if (version_compare(phpversion(), '7.1.8', '<')) { |
| 45 |
add_action('admin_notices', 'mailpoet_php_version_notice'); |
| 46 |
// deactivate the plugin |
| 47 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 48 |
return; |
| 49 |
} |
| 50 |
|
| 51 |
// Display WP version error notice |
| 52 |
function mailpoet_wp_version_notice() { |
| 53 |
$notice = str_replace( |
| 54 |
'[link]', |
| 55 |
'<a href="https://kb.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#wp_version" target="_blank">', |
| 56 |
__('MailPoet plugin requires WordPress version 4.6 or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet') |
| 57 |
); |
| 58 |
$notice = str_replace('[/link]', '</a>', $notice); |
| 59 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 60 |
} |
| 61 |
|
| 62 |
// Display PHP version error notice |
| 63 |
function mailpoet_php_version_notice() { |
| 64 |
$noticeP1 = __('MailPoet requires PHP version 7.1.8 or newer (7.4 recommended). You are running version [version].', 'mailpoet'); |
| 65 |
$noticeP1 = str_replace('[version]', phpversion(), $noticeP1); |
| 66 |
|
| 67 |
$noticeP2 = __('Please read our [link]instructions[/link] on how to upgrade your site.', 'mailpoet'); |
| 68 |
$noticeP2 = str_replace( |
| 69 |
'[link]', |
| 70 |
'<a href="https://kb.mailpoet.com/article/251-upgrading-the-websites-php-version" target="_blank">', |
| 71 |
$noticeP2 |
| 72 |
); |
| 73 |
$noticeP2 = str_replace('[/link]', '</a>', $noticeP2); |
| 74 |
|
| 75 |
$noticeP3 = __('If you can’t upgrade the PHP version, [link]install this version[/link] of MailPoet. Remember to not update MailPoet ever again!', 'mailpoet'); |
| 76 |
$noticeP3 = str_replace( |
| 77 |
'[link]', |
| 78 |
'<a href="https://downloads.wordpress.org/plugin/mailpoet.3.51.0.zip" target="_blank">', |
| 79 |
$noticeP3 |
| 80 |
); |
| 81 |
$noticeP3 = str_replace('[/link]', '</a>', $noticeP3); |
| 82 |
|
| 83 |
printf('<div class="error"><p><strong>%s</strong></p><p>%s</p><p>%s</p></div>', $noticeP1, $noticeP2, $noticeP3); |
| 84 |
} |
| 85 |
|
| 86 |
if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== false) { |
| 87 |
add_action('admin_notices', 'mailpoet_microsoft_iis_notice'); |
| 88 |
// deactivate the plugin |
| 89 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 90 |
return; |
| 91 |
} |
| 92 |
|
| 93 |
// Display IIS server error notice |
| 94 |
function mailpoet_microsoft_iis_notice() { |
| 95 |
$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'); |
| 96 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 97 |
} |
| 98 |
|
| 99 |
// Check for presence of core dependencies |
| 100 |
if (!file_exists($mailpoetPlugin['autoloader']) || !file_exists($mailpoetPlugin['initializer'])) { |
| 101 |
add_action('admin_notices', 'mailpoet_core_dependency_notice'); |
| 102 |
// deactivate the plugin |
| 103 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 104 |
return; |
| 105 |
} |
| 106 |
|
| 107 |
// Display missing core dependencies error notice |
| 108 |
function mailpoet_core_dependency_notice() { |
| 109 |
$notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet'); |
| 110 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 111 |
} |
| 112 |
|
| 113 |
// Initialize plugin |
| 114 |
require_once($mailpoetPlugin['initializer']); |
| 115 |
|