1 | <?php |
||
10 | trait Strings |
||
11 | { |
||
12 | /** |
||
13 | * Obfuscate string (url-safe and somewhat hard to guess). |
||
14 | * |
||
15 | * @param string $input The text that should be obfuscated |
||
16 | * @return string Obfuscated string |
||
17 | */ |
||
18 | public static function obfuscateString($input) |
||
22 | |||
23 | /** |
||
24 | * Deobfuscate string |
||
25 | * |
||
26 | * @param string $input Obfuscated string |
||
27 | * @return string Deobfuscated string |
||
28 | */ |
||
29 | public static function deobfuscateString($input) |
||
33 | |||
34 | /** |
||
35 | * Convert <textarea> to [textarea]. |
||
36 | * |
||
37 | * @param string $html |
||
38 | * @return string |
||
39 | */ |
||
40 | public static function textareaEncode($html) |
||
44 | |||
45 | /** |
||
46 | * Convert [textarea] to <textarea>. |
||
47 | * |
||
48 | * @param string $html |
||
49 | * @return string |
||
50 | */ |
||
51 | public static function textareaDecode($html) |
||
55 | |||
56 | /** |
||
57 | * To replace "Hallo [@var] world" with $value. |
||
58 | * |
||
59 | * Example: |
||
60 | * ```php |
||
61 | * replace_string($string, array("val1" => "foo", "val2" => "bar")) |
||
62 | * ``` |
||
63 | * |
||
64 | * @param string $langString String containing placeholder. |
||
65 | * @param array $dynamicContent key->value array. |
||
66 | * @return string String with placeholder replaced. |
||
67 | */ |
||
68 | public static function replaceString($langString, $dynamicContent = array()) |
||
75 | |||
76 | /** |
||
77 | * Creates rainbow-colored text. |
||
78 | * |
||
79 | * @uses Holt45::colorBlend() |
||
80 | * @uses Holt45::rgbhex() |
||
81 | * |
||
82 | * @param string $text Text wanted coloured. |
||
83 | * @return string String with span-tags with color. |
||
84 | */ |
||
85 | public static function rainbowText($text) |
||
134 | |||
135 | /** |
||
136 | * Get the symbol from a list of keyboard-keys... |
||
137 | * |
||
138 | * @used-by Holt45::kbdShortcut() |
||
139 | * |
||
140 | * @param string $inputKey Text |
||
141 | * @param string $inputOperatingSystem default|auto|win|mac|linux |
||
142 | * @return null|string HTML Entity (decimal) |
||
143 | */ |
||
144 | public static function kbdSymbol($inputKey, $inputOperatingSystem = "default") |
||
212 | |||
213 | /** |
||
214 | * Show fancy buttons for keyboard-shortcuts. |
||
215 | * |
||
216 | * @uses Holt45::kbdSymbol() |
||
217 | * |
||
218 | * @param array $inputArrayKeys |
||
219 | * @param string $inputOperatingSystem |
||
220 | * @param string $inputKbdClass |
||
221 | * @param string $inputKbdSymbolClass |
||
222 | * @param string $inputJoinHtml Glue |
||
223 | * @return string String of html |
||
224 | */ |
||
225 | public static function kbdShortcut($inputArrayKeys, $inputOperatingSystem = "default", $inputKbdClass = "holt45-kbd", $inputKbdSymbolClass = "holt45-kbd__symbol", $inputJoinGlue = " + ") |
||
245 | } |
||
246 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.