2015-01-19 14:20:57 +01:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
|
|
|
|
|
2015-01-19 14:20:57 +01:00
|
|
|
namespace Icinga\Web\View;
|
|
|
|
|
2016-01-27 15:56:27 +01:00
|
|
|
use Icinga\Util\StringHelper;
|
2019-06-04 15:21:20 +02:00
|
|
|
use Icinga\Web\Helper\Markdown;
|
2015-01-19 14:20:57 +01:00
|
|
|
|
|
|
|
$this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') {
|
2016-01-27 15:56:27 +01:00
|
|
|
return StringHelper::ellipsis($string, $maxLength, $ellipsis);
|
2015-01-19 14:20:57 +01:00
|
|
|
});
|
2015-11-20 15:17:38 +01:00
|
|
|
|
|
|
|
$this->addHelperFunction('nl2br', function ($string) {
|
2017-01-27 14:48:59 +01:00
|
|
|
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
|
2015-11-20 15:17:38 +01:00
|
|
|
});
|
2019-06-04 15:21:20 +02:00
|
|
|
|
|
|
|
$this->addHelperFunction('markdown', function ($content) {
|
|
|
|
return Markdown::text($content);
|
|
|
|
});
|