- if(!is_null($callback)) {
- $prefix = preg_replace("/[^][.\\'\\\"_A-Za-z0-9]/", "", $callback ) . "(";
- $suffix = ")";
- }
-
- // Some versions of PHP have a broken json_encode, see PHP bug
- // 46944. Test encoding an affected character (U+20000) to
- // avoid this.
- $this->printText( $prefix . $this->getJsonEncode($this->getResultData(), $this->getIsHtml() ) . $suffix);
- }
- /*
- * static to support static calls to json output (instead of json_encode function)
- * @param array $results the results array to output as a json string
- * @parm isHTML if the output is html
- */
- public static function getJsonEncode($value, $isHtml=false){
- if (!function_exists('json_encode') || $isHtml || strtolower(json_encode("\xf0\xa0\x80\x80")) != '\ud840\udc00') {
- $json = new Services_JSON();
- return $json->encode($value, $isHtml) ;
- } else {
- return json_encode($value);
+ if ( !is_null( $callback ) ) {
+ $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ) . '(';
+ $suffix = ')';