on(
'number_format_i18n',
'number_format_i18n',
['is_safe' => ['all']]
),
new TwigFunction(
'mailpoet_locale',
[$this, 'getTwoLettersLocale'],
['is_safe' => ['all']]
),
new TwigFunction(
'mailpoet_free_domains',
[$this, 'getFreeDomains'],
['is_safe' => ['all']]
),
new TwigFunction(
'is_woocommerce_active',
[$this, 'isWoocommerceActive'],
['is_safe' => ['all']]
),
new TwigFunction(
'get_woocommerce_version',
[$this, 'getWooCommerceVersion'],
['is_safe' => ['all']]
),
new TwigFunction(
'wp_start_of_week',
[$this, 'getWPStartOfWeek'],
['is_safe' => ['all']]
),
new TwigFunction(
'stats_color',
[$this, 'statsColor'],
['is_safe' => ['all']]
),
new TwigFunction(
'clicked_stats_text',
[$this, 'clickedStatsText'],
['is_safe' => ['all']]
),
new TwigFunction(
'stats_number_format_i18n',
[$this, 'statsNumberFormatI18n'],
['is_safe' => ['all']]
),
new TwigFunction(
'add_referral_id',
[$this, 'addReferralId'],
['is_safe' => ['all']]
),
new TwigFunction(
'is_loading_3rd_party_enabled',
[$this, 'libs3rdPartyEnabled'],
['is_safe' => ['all']]
),
new TwigFunction(
'is_dotcom_ecommerce_plan',
[$this, 'isDotcomEcommercePlan'],
['is_safe' => ['all']]
),
new TwigFunction(
'is_dotcom',
[$this, 'isDotcom'],
['is_safe' => ['all']]
),
new TwigFunction(
'pending_approval_message',
[$this, 'pendingApprovalMessage'],
['is_safe' => ['html']]
),
];
}
public function getSendingFrequency() {
/** @var string[] $args */
$args = func_get_args();
$value = (int)array_shift($args);
$label = null;
$labels = [
'minute' => __('every minute', 'mailpoet'),
// translators: %1$d is the amount of minutes.
'minutes' => __('every %1$d minutes', 'mailpoet'),
'hour' => __('every hour', 'mailpoet'),
// translators: %1$d is the amount of hours.
'hours' => __('every %1$d hours', 'mailpoet'),
];
if ($value >= 60) {
// we're dealing with hours
if ($value === 60) {
$label = $labels['hour'];
} else {
$label = $labels['hours'];
}
$value /= 60;
} else {
// we're dealing with minutes
if ($value === 1) {
$label = $labels['minute'];
} else {
$label = $labels['minutes'];
}
}
return sprintf($label, $value);
}
public function getWPDateFormat() {
return $this->getWp()->getOption('date_format') ?: 'F j, Y';
}
public function getWPStartOfWeek() {
return $this->getWp()->getOption('start_of_week') ?: 0;
}
public function getMailPoetVersion() {
return MAILPOET_VERSION;
}
public function getMailPoetPremiumVersion() {
return (defined('MAILPOET_PREMIUM_VERSION')) ? MAILPOET_PREMIUM_VERSION : false;
}
public function getWPTimeFormat() {
return $this->getWp()->getOption('time_format') ?: 'g:i a';
}
public function getWPDateTimeFormat() {
return sprintf('%s %s', $this->getWPDateFormat(), $this->getWPTimeFormat());
}
public function params($key = null) {
$args = $this->getWp()->stripslashesDeep($_GET);
if (array_key_exists($key, $args)) {
return $args[$key];
}
return null;
}
public function installedInLastTwoWeeks() {
$maxNumberOfWeeks = 2;
$installedAt = Carbon::createFromFormat('Y-m-d H:i:s', $this->getSettings()->get('installed_at'));
if ($installedAt === false) {
return false;
}
return $installedAt->diffInWeeks(Carbon::now()) < $maxNumberOfWeeks;
}
public function isRtl() {
return $this->getWp()->isRtl();
}
public function getTwoLettersLocale() {
return explode('_', $this->getWp()->getLocale())[0];
}
public function getFreeDomains() {
return FreeDomains::FREE_DOMAINS;
}
public function isWoocommerceActive() {
return $this->getWooCommerceHelper()->isWooCommerceActive();
}
public function getWooCommerceVersion() {
return $this->getWooCommerceHelper()->getWooCommerceVersion();
}
public function statsColor($percentage) {
if ($percentage > 3) {
return '#7ed321';
} elseif ($percentage > 1) {
return '#ff9f00';
} else {
return '#f559c3';
}
}
public function clickedStatsText($clicked) {
if ($clicked > 3) {
return __('Excellent', 'mailpoet');
} elseif ($clicked > 1) {
return __('Good', 'mailpoet');
} else {
return __('Average', 'mailpoet');
}
}
/**
* Wrapper around number_format_i18n() to return two decimals digits if the number
* is smaller than 0.1 and one decimal digit if the number is equal or greater
* than 0.1.
*
* @param int|float $number
*
* @return string
*/
public function statsNumberFormatI18n($number) {
if ($number < 0.1) {
$decimals = 2;
} else {
$decimals = 1;
}
return number_format_i18n($number, $decimals);
}
public function addReferralId($url) {
return $this->getreferralUrlDecorator()->decorate($url);
}
public function libs3rdPartyEnabled(): bool {
return $this->getSettings()->get('3rd_party_libs.enabled') === '1';
}
public function isDotcomEcommercePlan(): bool {
if (function_exists('wc_calypso_bridge_is_ecommerce_plan')) {
return wc_calypso_bridge_is_ecommerce_plan();
}
return false;
}
public function isDotcom(): bool {
return $this->getDotcomHelperFunctions()->isDotcom();
}
public function pendingApprovalMessage(): string {
return $this->getPendingApprovalNotice()->getPendingApprovalMessage();
}
}
Fatal error: Uncaught Error: Class "MailPoet\Twig\Functions" not found in /htdocs/wp-content/plugins/mailpoet/lib/Config/Renderer.php:59
Stack trace:
#0 /htdocs/wp-content/plugins/mailpoet/lib/Config/Renderer.php(42): MailPoet\Config\Renderer->setupFunctions()
#1 /htdocs/wp-content/plugins/mailpoet/lib/Config/RendererFactory.php(19): MailPoet\Config\Renderer->__construct(false, '/htdocs/wp-cont...', Object(MailPoetVendor\Twig\Loader\FilesystemLoader), false)
#2 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2683): MailPoet\Config\RendererFactory->getRenderer()
#3 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2637): MailPoetGenerated\FreeCachedContainer->getRendererService()
#4 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService()
#5 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1)
#6 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...')
#7 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...')
#8 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...')
#9 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...')
#10 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...')
#11 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...')
#12 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...')
#13 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#14 {main}
thrown in /htdocs/wp-content/plugins/mailpoet/lib/Config/Renderer.php on line 59