Mirovinger
Администрация
- Сообщения
- 23,573
- Решения
- 84
- Реакции
- 58,835
- Баллы
- 50,975

PHP:
protected function getMessagePreparer($format = true)
{
$options = $this->app->options();
// If we have both a max image and update length, then scale the image/media limit based on that.
// Otherwise, place very high limits on each that are unlikely to ever legitimately be hit.
if ($options->messageMaxLength && $options->xfrmUpdateMaxLength)
{
$ratio = ceil($options->xfrmUpdateMaxLength / $options->messageMaxLength);
$maxImages = $options->messageMaxImages * $ratio;
$maxMedia = $options->messageMaxMedia * $ratio;
}
else
{
$maxImages = 100;
$maxMedia = 30;
}
/** @var \XF\Service\Message\Preparer $preparer */
$preparer = $this->service('XF:Message\Preparer', 'resource_update', $this->update);
$preparer->setConstraint('maxLength', $options->xfrmUpdateMaxLength);
$preparer->setConstraint('maxImages', $maxImages);
$preparer->setConstraint('maxMedia', $maxMedia);
if (!$format)
{
$preparer->disableAllFilters();
}
return $preparer;
}