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) |
|
91 | |||
92 | /** |
||
93 | * Converts all UTF-8 remains in ASCII |
||
94 | * @param string $input |
||
95 | * @return string |
||
96 | */ |
||
97 | public static function toASCII($input) |
||
103 | |||
104 | /** |
||
105 | * Replaces all accented characters of their ASCII equivalents |
||
106 | * @param string $input |
||
107 | * @return string |
||
108 | */ |
||
109 | 1 | public static function squashCharacters($input) |
|
118 | |||
119 | /** |
||
120 | * Replace all non-UTF-8 chars to UTF-8 |
||
121 | * Remove all control chars |
||
122 | * Remove all multiple spaces |
||
123 | * @param string $input |
||
124 | * @return string |
||
125 | */ |
||
126 | 1 | public static function normalize($input) |
|
148 | |||
149 | /** |
||
150 | * Remove all non numeric characters from string |
||
151 | * @param string $string |
||
152 | * @return string |
||
153 | */ |
||
154 | 1 | public static function onlyNumbers($string) |
|
158 | |||
159 | /** |
||
160 | * Remove unwanted attributes, prefixes, sulfixes and other control |
||
161 | * characters like \r \n \s \t |
||
162 | * @param string $string |
||
163 | * @param boolean $removeEncodingTag remove encoding tag from a xml |
||
164 | * @return string |
||
165 | */ |
||
166 | 2 | public static function clearXmlString($string, $removeEncodingTag = false) |
|
184 | |||
185 | /** |
||
186 | * Remove all characters between markers |
||
187 | * @param string $string |
||
188 | * @param string $beginning |
||
189 | * @param string $end |
||
190 | * @return string |
||
191 | */ |
||
192 | 2 | public static function deleteAllBetween($string, $beginning, $end) |
|
202 | |||
203 | /** |
||
204 | * Clears the xml after adding the protocol, removing repeated namespaces |
||
205 | * @param string $string |
||
206 | * @return string |
||
207 | */ |
||
208 | 1 | public static function clearProtocoledXML($string) |
|
221 | |||
222 | /** |
||
223 | * Remove some alien chars from txt |
||
224 | * @param string $txt |
||
225 | * @return string |
||
226 | */ |
||
227 | 1 | public static function removeSomeAlienCharsfromTxt($txt) |
|
237 | |||
238 | /** |
||
239 | * Creates a string ramdomically with the specified length |
||
240 | * @param int $length |
||
241 | * @return string |
||
242 | */ |
||
243 | 1 | public static function randomString($length) |
|
254 | } |
||
255 |