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