icingaweb2/library/Icinga/Web/View/helpers/string.php

20 lines
564 B
PHP
Raw Normal View History

2015-01-19 14:20:57 +01:00
<?php
/* Icinga Web 2 | (c) 2015 Icinga Development Team | GPLv2+ */
2015-01-19 14:20:57 +01:00
namespace Icinga\Web\View;
use Icinga\Util\StringHelper;
use Icinga\Web\Helper\Markdown;
2015-01-19 14:20:57 +01:00
$this->addHelperFunction('ellipsis', function ($string, $maxLength, $ellipsis = '...') {
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) {
return nl2br(str_replace(array('\r\n', '\r', '\n'), '<br>', $string), false);
2015-11-20 15:17:38 +01:00
});
$this->addHelperFunction('markdown', function ($content) {
return Markdown::text($content);
});