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

15 lines
431 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;
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
});