| 148 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* This file is part of the Smarty package.
|
|
|
4 |
*
|
|
|
5 |
* For the full copyright and license information, please view the LICENSE
|
|
|
6 |
* file that was distributed with this source code.
|
|
|
7 |
*/
|
|
|
8 |
/**
|
|
|
9 |
* Registers some helper/polyfill functions.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
const SMARTY_HELPER_FUNCTIONS_LOADED = true;
|
|
|
13 |
|
|
|
14 |
/**
|
|
|
15 |
* Converts the first characters in $string to uppercase (A-Z) if it is an ASCII lowercase character (a-z).
|
|
|
16 |
*
|
|
|
17 |
* May not be required when running PHP8.2+: https://wiki.php.net/rfc/strtolower-ascii
|
|
|
18 |
*
|
|
|
19 |
* @param $string
|
|
|
20 |
*
|
|
|
21 |
* @return string
|
|
|
22 |
*/
|
|
|
23 |
function smarty_ucfirst_ascii($string): string {
|
|
|
24 |
return smarty_strtoupper_ascii(substr($string, 0, 1)) . substr($string, 1);
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
/**
|
|
|
28 |
* Converts all uppercase ASCII characters (A-Z) in $string to lowercase (a-z).
|
|
|
29 |
*
|
|
|
30 |
* May not be required when running PHP8.2+: https://wiki.php.net/rfc/strtolower-ascii
|
|
|
31 |
*
|
|
|
32 |
* @param $string
|
|
|
33 |
*
|
|
|
34 |
* @return string
|
|
|
35 |
*/
|
|
|
36 |
function smarty_strtolower_ascii($string): string {
|
|
|
37 |
return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
|
|
|
38 |
}
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Converts all lowercase ASCII characters (a-z) in $string to uppercase (A-Z).
|
|
|
42 |
*
|
|
|
43 |
* May not be required when running PHP8.2+: https://wiki.php.net/rfc/strtolower-ascii
|
|
|
44 |
*
|
|
|
45 |
* @param $string
|
|
|
46 |
*
|
|
|
47 |
* @return string
|
|
|
48 |
*/
|
|
|
49 |
function smarty_strtoupper_ascii($string): string {
|
|
|
50 |
return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|
|
51 |
}
|