PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.4.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.4.4
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | vendor/neitanod/forceutf8/src/ForceUTF8/Encoding.php +21 -17 3.0.83.4.4 View file →
@@ -182,23 +182,23 @@
182 182 {
183 183 $text[$k] = self::toUTF8($v);
184 184 }
185 185 return $text;
186 - }
187 -
186 + }
187 +
188 188 if(!is_string($text)) {
189 189 return $text;
190 190 }
191 -
191 +
192 192 $max = self::strlen($text);
193 -
193 +
194 194 $buf = "";
195 195 for($i = 0; $i < $max; $i++){
196 - $c1 = $text{$i};
196 + $c1 = $text[$i];
197 197 if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already
198 - $c2 = $i+1 >= $max? "\x00" : $text{$i+1};
199 - $c3 = $i+2 >= $max? "\x00" : $text{$i+2};
200 - $c4 = $i+3 >= $max? "\x00" : $text{$i+3};
198 + $c2 = $i+1 >= $max? "\x00" : $text[$i+1];
199 + $c3 = $i+2 >= $max? "\x00" : $text[$i+2];
200 + $c4 = $i+3 >= $max? "\x00" : $text[$i+3];
201 201 if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8
202 202 if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already
203 203 $buf .= $c1 . $c2;
204 204 $i++;
@@ -229,9 +229,9 @@
229 229 $cc1 = (chr(ord($c1) / 64) | "\xc0");
230 230 $cc2 = (($c1 & "\x3f") | "\x80");
231 231 $buf .= $cc1 . $cc2;
232 232 }
233 - } elseif(($c1 & "\xc0") == "\x80"){ // needs conversion
233 + } elseif(($c1 & "\xc0") === "\x80"){ // needs conversion
234 234 if(isset(self::$win1252ToUtf8[ord($c1)])) { //found in Windows-1252 special cases
235 235 $buf .= self::$win1252ToUtf8[ord($c1)];
236 236 } else {
237 237 $cc1 = (chr(ord($c1) / 64) | "\xc0");
@@ -257,14 +257,14 @@
257 257 return $text;
258 258 }
259 259 }
260 260
261 - static function toISO8859($text) {
262 - return self::toWin1252($text);
261 + static function toISO8859($text, $option = self::WITHOUT_ICONV) {
262 + return self::toWin1252($text, $option);
263 263 }
264 264
265 - static function toLatin1($text) {
266 - return self::toWin1252($text);
265 + static function toLatin1($text, $option = self::WITHOUT_ICONV) {
266 + return self::toWin1252($text, $option);
267 267 }
268 268
269 269 static function fixUTF8($text, $option = self::WITHOUT_ICONV){
270 270 if(is_array($text)) {
@@ -273,8 +273,12 @@
273 273 }
274 274 return $text;
275 275 }
276 276
277 + if(!is_string($text)) {
278 + return $text;
279 + }
280 +
277 281 $last = "";
278 282 while($last <> $text){
279 283 $last = $text;
280 284 $text = self::toUTF8(static::utf8_decode($text, $option));
@@ -291,9 +295,9 @@
291 295 return str_replace(array_keys(self::$brokenUtf8ToUtf8), array_values(self::$brokenUtf8ToUtf8), $text);
292 296 }
293 297
294 298 static function removeBOM($str=""){
295 - if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
299 + if(substr($str, 0,3) === pack("CCC",0xef,0xbb,0xbf)) {
296 300 $str=substr($str, 3);
297 301 }
298 302 return $str;
299 303 }
@@ -328,13 +332,13 @@
328 332
329 333 public static function encode($encodingLabel, $text)
330 334 {
331 335 $encodingLabel = self::normalizeEncoding($encodingLabel);
332 - if($encodingLabel == 'ISO-8859-1') return self::toLatin1($text);
336 + if($encodingLabel === 'ISO-8859-1') return self::toLatin1($text);
333 337 return self::toUTF8($text);
334 338 }
335 339
336 - protected static function utf8_decode($text, $option)
340 + protected static function utf8_decode($text, $option = self::WITHOUT_ICONV)
337 341 {
338 342 if ($option == self::WITHOUT_ICONV || !function_exists('iconv')) {
339 343 $o = utf8_decode(
340 344 str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
@@ -339,9 +343,9 @@
339 343 $o = utf8_decode(
340 344 str_replace(array_keys(self::$utf8ToWin1252), array_values(self::$utf8ToWin1252), self::toUTF8($text))
341 345 );
342 346 } else {
343 - $o = iconv("UTF-8", "Windows-1252" . ($option == self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option == self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
347 + $o = iconv("UTF-8", "Windows-1252" . ($option === self::ICONV_TRANSLIT ? '//TRANSLIT' : ($option === self::ICONV_IGNORE ? '//IGNORE' : '')), $text);
344 348 }
345 349 return $o;
346 350 }
347 351 }