29 private static $list = [
33 'halloween' => [31, 10],
35 'christmas' => [25, 12],
43 private static $defaultYear = 2049;
51 public static function getList($languageId = LANGUAGE_ID)
56 $listLocal = [
'feb14',
'feb23',
'mar8',
'halloween',
'new_year'];
60 $listLocal = [
'feb14',
'day_mar8',
'halloween',
'new_year'];
64 $listLocal = [
'feb14',
'halloween',
'thanks',
'christmas'];
68 foreach ($listLocal as $code)
70 if (!isset(self::$list[$code]))
75 $period = self::$list[$code];
76 if (is_array($period[0]))
79 $dateFrom = self::createDate($period[0][0], $period[0][1]);
80 $dateTo = self::createDate($period[1][0], $period[1][1]);
84 $date = self::createDate($period[0], $period[1]);
85 $dateFrom = self::createDate($period[0], $period[1])->add(
'-5 days');
86 $dateTo = self::createDate($period[0], $period[1])->add(
'+3 days');
89 $list[] =
new self($code, $date, $dateFrom, $dateTo);
107 $this->dateFrom = $dateFrom;
108 $this->dateTo = $dateTo;
128 return mb_strtoupper($this->code);
138 public function getName($template =
null, $placeholder =
'%name%')
143 return str_replace($placeholder, $name, $template);
156 return $this->date ? PrettyDate::formatDate($this->date) : $this->
getName();
176 return $this->dateFrom->format(
'j');
186 return $this->dateFrom->format(
'n');
196 return $this->dateFrom;
206 return $this->dateTo;
209 private static function createDate($day, $month, $year =
null)
211 return Date::createFromTimestamp(mktime(0, 0, 0, $month, $day, $year ?: date(
'Y')));
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)