'Year', 'mailpoet'),
];
}
public function getDateFormats(): array {
return [
'year_month_day' => ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'],
'year_month' => ['MM/YYYY', 'YYYY/MM'],
'year' => ['YYYY'],
'month' => ['MM'],
];
}
public function getMonthNames(): array {
return [__('January', 'mailpoet'), __('February', 'mailpoet'), __('March', 'mailpoet'), __('April', 'mailpoet'),
__('May', 'mailpoet'), __('June', 'mailpoet'), __('July', 'mailpoet'), __('August', 'mailpoet'), __('September', 'mailpoet'),
__('October', 'mailpoet'), __('November', 'mailpoet'), __('December', 'mailpoet'),
];
}
private function getMonths(array $block = []): string {
$defaults = [
'selected' => null,
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('m', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('m');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$monthNames = $this->getMonthNames();
$html = '';
// empty value label
$html .= '';
for ($i = 1; $i < 13; $i++) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '';
}
return $html;
}
private function getYears(array $block = []): string {
$defaults = [
'selected' => null,
'from' => (int)date('Y') - 100,
'to' => (int)date('Y'),
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('Y', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('Y');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$html = '';
// empty value label
$html .= '';
// return years as an array
for ($i = (int)$block['to']; $i > (int)($block['from'] - 1); $i--) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '';
}
return $html;
}
private function getDays(array $block = []): string {
$defaults = [
'selected' => null,
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('d', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('d');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$html = '';
// empty value label
$html .= '';
// return days as an array
for ($i = 1; $i < 32; $i++) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '';
}
return $html;
}
}
Fatal error: Uncaught Error: Class "MailPoet\Form\Block\Date" not found in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php:3576
Stack trace:
#0 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(3641): MailPoetGenerated\FreeCachedContainer->getDateService()
#1 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2612): MailPoetGenerated\FreeCachedContainer->getRenderer3Service()
#2 /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php(2640): MailPoetGenerated\FreeCachedContainer->getHooks2Service()
#3 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(122): MailPoetGenerated\FreeCachedContainer->getInitializerService()
#4 /htdocs/wp-content/plugins/mailpoet/vendor-prefixed/symfony/dependency-injection/Container.php(110): MailPoetVendor\Symfony\Component\DependencyInjection\Container->make('MailPoet\\Config...', 1)
#5 /htdocs/wp-content/plugins/mailpoet/lib/DI/ContainerWrapper.php(39): MailPoetVendor\Symfony\Component\DependencyInjection\Container->get('MailPoet\\Config...')
#6 /htdocs/wp-content/plugins/mailpoet/mailpoet_initializer.php(89): MailPoet\DI\ContainerWrapper->get('MailPoet\\Config...')
#7 /htdocs/wp-content/plugins/mailpoet/mailpoet.php(194): require_once('/htdocs/wp-cont...')
#8 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...')
#9 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...')
#10 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...')
#11 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...')
#12 /htdocs/index.php(17): require('/htdocs/wp-blog...')
#13 {main}
thrown in /htdocs/wp-content/plugins/mailpoet/generated/FreeCachedContainer.php on line 3576