<?php
 class C_Utility { public static function add_slashes($str) { if (get_magic_quotes_gpc() == 1) { return $str; } else { return addslashes($str); } } public static function indent_json($json) { $result = ''; $pos = 0; $strLen = strlen($json); $indentStr = "\x20\40"; $newLine = "\xa"; for ($i = 0; $i <= $strLen; $i++) { $char = substr($json, $i, 1); if ($char == "\175" || $char == "\x5d") { $result .= $newLine; $pos--; for ($j = 0; $j < $pos; $j++) { $result .= $indentStr; } } $result .= $char; if ($char == "\173" || $char == "\133") { $result .= $newLine; if ($char == "\173" || $char == "\x5b") { $pos++; } for ($j = 0; $j < $pos; $j++) { $result .= $indentStr; } } } return $result; } public static function literalBool($boolValue) { return $boolValue ? "\x74\x72\x75\145" : "\x66\141\154\x73\x65"; } public static function gen_rowids($arr = array(), $keys = array()) { $rowids = ''; foreach ($keys as $key => $val) { $rowids .= $arr[$val] . PK_DELIMITER; } $rowids = substr($rowids, 0, -3); return $rowids; } public static function is_debug() { return defined("\x44\x45\102\125\107") ? DEBUG : false; } } ?>