ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Utilities.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
25 
26 class Utilities implements UtilitiesInterface
27 {
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 }
txtFill(string $key, string ... $values)
Definition: Utilities.php:57
__construct(PresentationUtilities $utilities,)
Definition: Utilities.php:30
A Date Format provides a format definition akin to PHP&#39;s date formatting options, but stores the sing...
Definition: DateFormat.php:26
shortenString(string $string, int $max_length)
Definition: Utilities.php:36