ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Utilities.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24use ILIAS\MetaData\Presentation\UtilitiesInterface as PresentationUtilities;
25
27{
28 protected PresentationUtilities $utilities;
29
30 public function __construct(
31 PresentationUtilities $utilities,
32 ) {
33 $this->utilities = $utilities;
34 }
35
36 public function shortenString(
37 string $string,
38 int $max_length
39 ): string {
40 if (function_exists('mb_substr')) {
41 return mb_substr($string, 0, $max_length, 'UTF-8');
42 } else {
43 return substr($string, 0, $max_length);
44 }
45 }
46
47 public function getUserDateFormat(): DateFormat
48 {
49 return $this->utilities->getUserDateFormat();
50 }
51
52 public function txt(string $key): string
53 {
54 return $this->utilities->txt($key);
55 }
56
57 public function txtFill(string $key, string ...$values): string
58 {
59 return $this->utilities->txtFill($key, ...$values);
60 }
61
62 public function sanitizeForHTML(string $string): string
63 {
64 return $this->utilities->sanitizeForHTML($string);
65 }
66}
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:27
shortenString(string $string, int $max_length)
Definition: Utilities.php:36
txtFill(string $key, string ... $values)
Definition: Utilities.php:57
__construct(PresentationUtilities $utilities,)
Definition: Utilities.php:30
if(!file_exists('../ilias.ini.php'))