Unify detecting free domain in JS and PHP from one source
[MAILPOET-1882]
This commit is contained in:
@@ -5,6 +5,7 @@ namespace MailPoet\Twig;
|
||||
use Carbon\Carbon;
|
||||
use MailPoet\Config\ServicesChecker;
|
||||
use MailPoet\Settings\SettingsController;
|
||||
use MailPoet\Util\FreeDomains;
|
||||
use MailPoet\WP\Functions as WPFunctions;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
@@ -110,6 +111,11 @@ class Functions extends \Twig_Extension {
|
||||
array($this, 'getTwoLettersLocale'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
new \Twig_SimpleFunction(
|
||||
'mailpoet_free_domains',
|
||||
array($this, 'getFreeDomains'),
|
||||
array('is_safe' => array('all'))
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -199,4 +205,8 @@ class Functions extends \Twig_Extension {
|
||||
function getTwoLettersLocale() {
|
||||
return explode('_', WPFunctions::get()->getLocale())[0];
|
||||
}
|
||||
|
||||
function getFreeDomains() {
|
||||
return FreeDomains::FREE_DOMAINS;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user