Açıklama Yok

PHPMailerLoader.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace MailPoet\Mailer\WordPress;
  3. if (!defined('ABSPATH')) exit;
  4. /**
  5. * This class and its usage should be removed
  6. * in favor of the new loading method when support
  7. * for WordPress below 5.5 is dropped.
  8. */
  9. class PHPMailerLoader {
  10. /**
  11. * Conditionally load PHPMailer the old or the new way
  12. * to not get a deprecated file notice.
  13. */
  14. public static function load() {
  15. if (class_exists('PHPMailer')) {
  16. return false;
  17. }
  18. if (is_readable(ABSPATH . WPINC . '/PHPMailer/PHPMailer.php')) {
  19. // WordPress 5.5+
  20. if (!class_exists('PHPMailer\PHPMailer\PHPMailer')) {
  21. require_once ABSPATH . WPINC . '/PHPMailer/PHPMailer.php';
  22. }
  23. if (!class_exists('PHPMailer\PHPMailer\Exception')) {
  24. require_once ABSPATH . WPINC . '/PHPMailer/Exception.php';
  25. }
  26. class_alias(\PHPMailer\PHPMailer\PHPMailer::class, 'PHPMailer');
  27. class_alias(\PHPMailer\PHPMailer\Exception::class, 'phpmailerException');
  28. } else {
  29. // WordPress < 5.5
  30. require_once ABSPATH . WPINC . '/class-phpmailer.php';
  31. }
  32. }
  33. }