Keine Beschreibung

mailpoet.php 4.1KB

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