File modules/template_engine/Output.class.php
Last commit: Tue Nov 9 23:53:41 2021 +0100 Jan Dankert Very crazy bug in Alpine (like the iconv bug yesterday): htmlentities() must be called with the default flags.
1 <?php 2 3 4 namespace template_engine; 5 6 7 use cms\base\Configuration; 8 use cms\base\Language; 9 use util\Text; 10 11 /** 12 * A collection of methods, used by the templates. 13 */ 14 class Output 15 { 16 /** 17 * Ersetzt alle Zeichen mit dem Ordinalwert > 127 mit einer HTML-Maskierung. 18 * 19 * @return String 20 */ 21 public static function encodeHtml($text) 22 { 23 return Text::translateutf8tohtml($text); 24 } 25 26 public static function escapeHtml($text) 27 { 28 return Text::translateutf8tohtml(htmlentities($text, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 )); 29 } 30 31 /** 32 * Gets a localized message 33 * @param $key string message key 34 * @return string 35 */ 36 public static function lang($key) { 37 return Language::lang($key); 38 } 39 40 41 /** 42 * Gets a configuraton value. 43 * 44 * Delegating to the Configuration. 45 * 46 * @param $keys array 47 * @return mixed 48 */ 49 public static function config( $keys ) { 50 return Configuration::get( $keys ); 51 } 52 }
Downloadmodules/template_engine/Output.class.php
History Tue, 9 Nov 2021 23:53:41 +0100 Jan Dankert Very crazy bug in Alpine (like the iconv bug yesterday): htmlentities() must be called with the default flags. Mon, 9 Nov 2020 22:58:36 +0100 Jan Dankert Code-Cleanup Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Sun, 25 Oct 2020 02:11:58 +0200 Jan Dankert Fix: The config was not read in the templates :-O. Sat, 26 Sep 2020 21:05:03 +0200 Jan Dankert Refactoring: An alias for the Output class, this results in a cleaner template. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Sat, 26 Sep 2020 04:03:53 +0200 Jan Dankert Refactoring: read language keys with a class.