- Модуль: sender
- Путь к файлу: ~/bitrix/modules/sender/lib/dispatch/methodschedule.php
- Класс: BitrixSenderDispatchMethodSchedule
- Вызов: MethodSchedule::parseDaysOfMonth
static function parseDaysOfMonth($daysOfMonth)
{
$result = [];
if ($daysOfMonth <> '')
{
$days = explode(",", $daysOfMonth);
$found = [];
foreach ($days as $day)
{
$day = trim($day);
if (preg_match("/^(d{1,2})$/", $day, $found))
{
if (intval($found[1]) < 1 || intval($found[1]) > 31)
{
return [];
}
else
{
$result[] = intval($found[1]);
}
}
elseif (preg_match("/^(d{1,2})-(d{1,2})$/", $day, $found))
{
if (intval($found[1]) < 1 || intval($found[1]) > 31 || intval($found[2]) < 1 || intval($found[2]) > 31 || intval($found[1]) >= intval($found[2]))
{
return [];
}
else
{
for ($i = intval($found[1]); $i <= intval($found[2]); $i++)
{
$result[] = intval($i);
}
}
}
else
{
return [];
}
}
}
else
{
return [];
}
return $result;
}