- if(!is_null($callback)) {
- $prefix = ereg_replace("[^_A-Za-z0-9]", "", $callback ) . "(";
- $suffix = ")";
- }
-
- if (!function_exists('json_encode') || $this->getIsHtml()) {
- $json = new Services_JSON();
- $this->printText($prefix . $json->encode($this->getResultData(), $this->getIsHtml()) . $suffix);
- } else {
- $this->printText($prefix . json_encode($this->getResultData()) . $suffix);
+ if ( !is_null( $callback ) ) {
+ $prefix = preg_replace( "/[^][.\\'\\\"_A-Za-z0-9]/", '', $callback ) . '(';
+ $suffix = ')';