Skip to content

Commit 4495ca3

Browse files
authored
Update Textlocal.php
1 parent 00fb886 commit 4495ca3

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

src/Textlocal.php

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -827,57 +827,3 @@ public function __construct($number, $firstname = '', $lastname = '', $custom1 =
827827
$this->custom3 = $custom3;
828828
}
829829
}
830-
831-
/*
832-
* If the json_encode function does not exist, then create it..
833-
*/
834-
835-
if (! function_exists('json_encode')) {
836-
function json_encode($a = false)
837-
{
838-
if (is_null($a)) {
839-
return 'null';
840-
}
841-
if ($a === false) {
842-
return 'false';
843-
}
844-
if ($a === true) {
845-
return 'true';
846-
}
847-
if (is_scalar($a)) {
848-
if (is_float($a)) {
849-
// Always use "." for floats.
850-
return floatval(str_replace(',', '.', strval($a)));
851-
}
852-
853-
if (is_string($a)) {
854-
static $jsonReplaces = [['\\', '/', "\n", "\t", "\r", "\b", "\f", '"'], ['\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"']];
855-
856-
return '"'.str_replace($jsonReplaces[0], $jsonReplaces[1], $a).'"';
857-
} else {
858-
return $a;
859-
}
860-
}
861-
$isList = true;
862-
for ($i = 0, reset($a); $i < count($a); $i++, next($a)) {
863-
if (key($a) !== $i) {
864-
$isList = false;
865-
break;
866-
}
867-
}
868-
$result = [];
869-
if ($isList) {
870-
foreach ($a as $v) {
871-
$result[] = json_encode($v);
872-
}
873-
874-
return '['.implode(',', $result).']';
875-
} else {
876-
foreach ($a as $k => $v) {
877-
$result[] = json_encode($k).':'.json_encode($v);
878-
}
879-
880-
return '{'.implode(',', $result).'}';
881-
}
882-
}
883-
}

0 commit comments

Comments
 (0)