Unify detecting free domain in JS and PHP from one source

[MAILPOET-1882]
This commit is contained in:
Ján Mikláš
2019-03-19 13:35:17 +01:00
committed by M. Shull
parent 9b16a403e8
commit e2cde798df
3 changed files with 12 additions and 50 deletions

View File

@@ -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;
}
}