diff --git a/app/funcs/functions.php b/app/funcs/functions.php index 8c5172a..92eb06e 100644 --- a/app/funcs/functions.php +++ b/app/funcs/functions.php @@ -53,6 +53,10 @@ function json_format_html($json) $new_json = ""; $indent_level = 0; $in_string = false; + $worthItLimit = 4 * 1024; + + // If we have to wait forever, it's not worth it. + $worthIt = (strlen($json) > $worthItLimit) ? false : true; /* commented out by monk.e.boy 22nd May '08 @@ -66,7 +70,8 @@ function json_format_html($json) $json = json_encode($json_obj); */ - $len = strlen($json); + $len = ($worthIt) ? strlen($json) : $worthItLimit; + // Alternatively, we could show the monochrome version we see when we click on "text" (in the browser) for($c = 0; $c < $len; $c++) { @@ -144,6 +149,9 @@ function json_format_html($json) break; } } + + if (!$worthIt) $new_json.= "

---- Trimmed ----"; + $new_json = preg_replace_callback("{(([\da-zA-Z_\.]+))+}", create_function('$match',' $string = str_replace("", "", $match[0]); $string = str_replace("", "", $string); @@ -237,4 +245,4 @@ function json_format($json) return $new_json; } -?> \ No newline at end of file +?>