mailpoet
Last commit date
assets
7 years ago
generated
7 years ago
lang
7 years ago
lib
7 years ago
vendor
7 years ago
vendor-prefixed
7 years ago
views
7 years ago
index.php
9 years ago
license.txt
9 years ago
mailpoet-cron.php
7 years ago
mailpoet.php
7 years ago
mailpoet_initializer.php
7 years ago
readme.txt
7 years ago
uninstall.php
9 years ago
mailpoet.php
102 lines
| 1 | <?php |
| 2 | |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | |
| 5 | /* |
| 6 | * Plugin Name: MailPoet 3 (New) |
| 7 | * Version: 3.19.3 |
| 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: 5.0 |
| 14 | * |
| 15 | * @package WordPress |
| 16 | * @author MailPoet |
| 17 | * @since 3.0.0-beta.1 |
| 18 | */ |
| 19 | |
| 20 | $mailpoet_plugin = array( |
| 21 | 'version' => '3.19.3', |
| 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'), '4.6', '<')) { |
| 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(), '5.6.0', '<')) { |
| 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="//beta.docs.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 | $notice = str_replace( |
| 65 | '[link]', |
| 66 | '<a href="//beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3#php_version" target="_blank">', |
| 67 | __('MailPoet requires PHP version 5.6 or newer (version 7.2 recommended). Please read our [link]instructions[/link] on how to upgrade your site.', 'mailpoet') |
| 68 | ); |
| 69 | $notice = str_replace('[/link]', '</a>', $notice); |
| 70 | printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 71 | } |
| 72 | |
| 73 | if (isset($_SERVER['SERVER_SOFTWARE']) && strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== false) { |
| 74 | add_action('admin_notices', 'mailpoet_microsoft_iis_notice'); |
| 75 | // deactivate the plugin |
| 76 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | // Display IIS server error notice |
| 81 | function mailpoet_microsoft_iis_notice() { |
| 82 | $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'); |
| 83 | printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 84 | } |
| 85 | |
| 86 | // Check for presence of core dependencies |
| 87 | if (!file_exists($mailpoet_plugin['autoloader']) || !file_exists($mailpoet_plugin['initializer'])) { |
| 88 | add_action('admin_notices', 'mailpoet_core_dependency_notice'); |
| 89 | // deactivate the plugin |
| 90 | add_action('admin_init', 'mailpoet_deactivate_plugin'); |
| 91 | return; |
| 92 | } |
| 93 | |
| 94 | // Display missing core dependencies error notice |
| 95 | function mailpoet_core_dependency_notice() { |
| 96 | $notice = __('MailPoet cannot start because it is missing core files. Please reinstall the plugin.', 'mailpoet'); |
| 97 | printf('<div class="error"><p>%1$s</p></div>', $notice); |
| 98 | } |
| 99 | |
| 100 | // Initialize plugin |
| 101 | require_once($mailpoet_plugin['initializer']); |
| 102 |