File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -210,31 +210,23 @@ public function to_csv()
210
210
// Encode as JSON
211
211
public function to_json ()
212
212
{
213
- $ _numeric = strnatcmp (PHP_VERSION , '5.3.3 ' ) >= 0 ;
214
213
$ callback = isset ($ _GET ['callback ' ]) ? $ _GET ['callback ' ] : '' ;
215
-
216
- // we only honour jsonp callback which are valid javascript identifiers
217
214
if ($ callback === '' )
218
215
{
219
- return $ _numeric
220
- ? json_encode ($ this ->_data , JSON_NUMERIC_CHECK );
221
- : json_encode ($ this ->_data );
216
+ return json_encode ($ this ->_data );
222
217
}
218
+ // we only honour jsonp callback which are valid javascript identifiers
223
219
else if (preg_match ('/^[a-z_\$][a-z0-9\$_]*(\.[a-z_\$][a-z0-9\$_]*)*$/i ' , $ callback ))
224
220
{
225
221
// this is a jsonp request, the content-type must be updated to be text/javascript
226
222
header ("Content-Type: application/javascript " );
227
- return $ _numeric
228
- ? $ callback . "( " . json_encode ($ this ->_data , JSON_NUMERIC_CHECK ) . "); " ;
229
- : $ callback . "( " . json_encode ($ this ->_data ) . "); " ;
223
+ return $ callback . "( " . json_encode ($ this ->_data ) . "); " ;
230
224
}
231
225
else
232
226
{
233
227
// we have an invalid jsonp callback identifier, we'll return plain json with a warning field
234
228
$ this ->_data ['warning ' ] = "invalid jsonp callback provided: " .$ callback ;
235
- return $ _numeric
236
- ? json_encode ($ this ->_data , JSON_NUMERIC_CHECK );
237
- : json_encode ($ this ->_data );
229
+ return json_encode ($ this ->_data );
238
230
}
239
231
}
240
232
You can’t perform that action at this time.
0 commit comments