1 | <?php |
||
17 | class Strings |
||
18 | { |
||
19 | |||
20 | /** |
||
21 | * Includes missing or unsupported properties in stdClass inputs |
||
22 | * and Replace all unsuported chars |
||
23 | * |
||
24 | * @param \stdClass $std |
||
25 | * @param array $possible |
||
26 | * @return \stdClass |
||
27 | */ |
||
28 | public static function equilizeParameters( |
||
48 | |||
49 | /** |
||
50 | * Replace all specials characters from string and retuns only 128 basics |
||
51 | * NOTE: only for UTF-8 |
||
52 | * @param string $string |
||
53 | * @return string |
||
54 | */ |
||
55 | 1 | public static function replaceSpecialsChars($string) |
|
62 | |||
63 | /** |
||
64 | * Clear inputs for build in XML |
||
65 | * Only UTF-8 characters is acceptable |
||
66 | * & isolated, less than, greater than, quotation marks and apostrophes |
||
67 | * should be replaced by their html equivalent |
||
68 | * Carriage Return, Tab and Line Feed is not acceptable in strings |
||
69 | * Multiple spaces is not acceptable in strings |
||
70 | * And no other control character is acceptable either |
||
71 | * @param string|null $input |
||
72 | * @return string|null |
||
73 | */ |
||
74 | 1 | public static function replaceUnacceptableCharacters($input) |
|
92 | |||
93 | /** |
||
94 | * Converts all UTF-8 remains in ASCII |
||
95 | * @param string $input |
||
96 | * @return string |
||
97 | */ |
||
98 | public static function toASCII($input) |
||
104 | |||
105 | /** |
||
106 | * Replaces all accented characters of their ASCII equivalents |
||
107 | * @param string $input |
||
108 | * @return string |
||
109 | */ |
||
110 | 1 | public static function squashCharacters($input) |
|
119 | |||
120 | /** |
||
121 | * Replace all non-UTF-8 chars to UTF-8 |
||
122 | * Remove all control chars |
||
123 | * Remove all multiple spaces |
||
124 | * @param string $input |
||
125 | * @return string |
||
126 | */ |
||
127 | 1 | public static function normalize($input) |
|
149 | |||
150 | /** |
||
151 | * Remove all non numeric characters from string |
||
152 | * @param string $string |
||
153 | * @return string |
||
154 | */ |
||
155 | 1 | public static function onlyNumbers($string) |
|
159 | |||
160 | /** |
||
161 | * Remove unwanted attributes, prefixes, sulfixes and other control |
||
162 | * characters like \r \n \s \t |
||
163 | * @param string $string |
||
164 | * @param boolean $removeEncodingTag remove encoding tag from a xml |
||
165 | * @return string |
||
166 | */ |
||
167 | 2 | public static function clearXmlString($string, $removeEncodingTag = false) |
|
185 | |||
186 | /** |
||
187 | * Remove all characters between markers |
||
188 | * @param string $string |
||
189 | * @param string $beginning |
||
190 | * @param string $end |
||
191 | * @return string |
||
192 | */ |
||
193 | 2 | public static function deleteAllBetween($string, $beginning, $end) |
|
203 | |||
204 | /** |
||
205 | * Clears the xml after adding the protocol, removing repeated namespaces |
||
206 | * @param string $string |
||
207 | * @return string |
||
208 | */ |
||
209 | 1 | public static function clearProtocoledXML($string) |
|
222 | |||
223 | /** |
||
224 | * Remove some alien chars from txt |
||
225 | * @param string $txt |
||
226 | * @return string |
||
227 | */ |
||
228 | 1 | public static function removeSomeAlienCharsfromTxt($txt) |
|
238 | |||
239 | /** |
||
240 | * Creates a string ramdomically with the specified length |
||
241 | * @param int $length |
||
242 | * @return string |
||
243 | */ |
||
244 | 1 | public static function randomString($length) |
|
255 | } |
||
256 |