Hide feature behind feature flag
[MAILPOET-2307]
This commit is contained in:
committed by
Jack Kitterhing
parent
aa1b9157a4
commit
72c62ba937
@ -7,11 +7,13 @@ class FeaturesController {
|
||||
// Define features below in the following form:
|
||||
// const FEATURE_NAME_OF_FEATURE = 'name-of-feature';
|
||||
const NEW_DEFAULT_LIST_NAME = 'new-default-list-name';
|
||||
const SEND_WORDPRESS_MAILS_WITH_MP3 = 'send-wordpress-mails-with-mp3';
|
||||
|
||||
// Define feature defaults in the array below in the following form:
|
||||
// self::FEATURE_NAME_OF_FEATURE => true,
|
||||
private $defaults = [
|
||||
self::NEW_DEFAULT_LIST_NAME => false,
|
||||
self::SEND_WORDPRESS_MAILS_WITH_MP3 => false,
|
||||
];
|
||||
|
||||
/** @var array */
|
||||
|
@ -2,12 +2,24 @@
|
||||
|
||||
namespace MailPoet\Mailer\WordPress;
|
||||
|
||||
use MailPoet\Features\FeaturesController;
|
||||
|
||||
class WordpressMailerReplacer {
|
||||
|
||||
/** @var FeaturesController */
|
||||
private $features_controller;
|
||||
|
||||
function __construct(FeaturesController $features_controller) {
|
||||
$this->features_controller = $features_controller;
|
||||
}
|
||||
|
||||
public function replaceWordPressMailer() {
|
||||
global $phpmailer;
|
||||
|
||||
return $this->replaceWithCustomPhpMailer($phpmailer);
|
||||
if ($this->features_controller->isSupported(FeaturesController::SEND_WORDPRESS_MAILS_WITH_MP3)) {
|
||||
return $this->replaceWithCustomPhpMailer($phpmailer);
|
||||
}
|
||||
return $phpmailer;
|
||||
}
|
||||
|
||||
private function replaceWithCustomPhpMailer(&$obj = null) {
|
||||
|
Reference in New Issue
Block a user