| 1 |
<?php |
| 2 |
|
| 3 |
if(!defined('ABSPATH')) exit; |
| 4 |
|
| 5 |
/* |
| 6 |
* Plugin Name: MailPoet 3 (New) |
| 7 |
* Version: 3.7.0 |
| 8 |
* Plugin URI: http://www.mailpoet.com |
| 9 |
* Description: Create and send newsletters, post notifications and welcome emails from your WordPress. |
| 10 |
* Author: MailPoet |
| 11 |
* Author URI: http://www.mailpoet.com |
| 12 |
* Requires at least: 4.7 |
| 13 |
* Tested up to: 4.9 |
| 14 |
* |
| 15 |
* Domain Path: /lang/ |
| 16 |
* |
| 17 |
* @package WordPress |
| 18 |
* @author MailPoet |
| 19 |
* @since 3.0.0-beta.1 |
| 20 |
*/ |
| 21 |
|
| 22 |
$mailpoet_plugin = array( |
| 23 |
'version' => '3.7.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 supporter WP version |
| 38 |
if(version_compare(get_bloginfo('version'), '4.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(), '5.3.3', '<')) { |
| 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="//beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#wp_version" target="_blank">', |
| 58 |
__('MailPoet plugin requires WordPress version 4.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('<div class="error"><p>%1$s</p></div>', $notice); |
| 62 |
} |
| 63 |
|
| 64 |
// Display PHP version error notice |
| 65 |
function mailpoet_php_version_notice() { |
| 66 |
$notice = str_replace( |
| 67 |
'[link]', |
| 68 |
'<a href="//beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#php_version" target="_blank">', |
| 69 |
__('MailPoet plugin requires PHP version 5.3.3 or newer. Please read our [link]instructions[/link] on how to resolve this issue.', 'mailpoet') |
| 70 |
); |
| 71 |
$notice = str_replace('[/link]', '</a>', $notice); |
| 72 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 73 |
} |
| 74 |
|
| 75 |
if(isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== false) { |
| 76 |
add_action('admin_notices', 'mailpoet_microsoft_iis_notice'); |
| 77 |
// deactivate the plugin |
| 78 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 79 |
return; |
| 80 |
} |
| 81 |
|
| 82 |
// Display IIS server error notice |
| 83 |
function mailpoet_microsoft_iis_notice() { |
| 84 |
$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'); |
| 85 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 86 |
} |
| 87 |
|
| 88 |
// Check for presence of core dependencies |
| 89 |
if(!file_exists($mailpoet_plugin['autoloader']) || !file_exists($mailpoet_plugin['initializer'])) { |
| 90 |
add_action('admin_notices', 'mailpoet_core_dependency_notice'); |
| 91 |
// deactivate the plugin |
| 92 |
add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 93 |
return; |
| 94 |
} |
| 95 |
|
| 96 |
// Display missing core dependencies error notice |
| 97 |
function mailpoet_core_dependency_notice() { |
| 98 |
$notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet'); |
| 99 |
printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 100 |
} |
| 101 |
|
| 102 |
// Initialize plugin |
| 103 |
require_once($mailpoet_plugin['initializer']); |
| 104 |
|