if (!extension_loaded('json')) {
require_once(dirname(__FILE__) . '/json.php');
- function dsq_json_decode($data, $assoc = false) {
+ function dsq_json_decode($data) {
$json = new JSON;
- return $json->unserialize($data, $assoc);
+ return $json->unserialize($data);
}
} else {
- function dsq_json_decode($data, $assoc = false) {
- return json_decode($data, $assoc);
+ function dsq_json_decode($data) {
+ return json_decode($data);
}
}
@@ -61,7 +61,6 @@ class DisqusAPI {
var $forum_api_key;
var $api_url = 'http://www.disqus.com/api/';
var $api_version = '1.1';
- var $json_assoc = false;
/**
* Creates a new interface to the Disqus API.
@@ -121,11 +120,10 @@ class DisqusAPI {
return false;
}
- $data = dsq_json_decode($response['data'], $this->json_assoc);
- $data_arr = (array) $data;
+ $data = dsq_json_decode($response['data']);
- if(!$data_arr || !$data_arr['succeeded']) {
- $this->last_error = $data_arr['message'];
+ if(!$data || !$data->succeeded) {
+ $this->last_error = $data->message;
return false;
}
@@ -134,7 +132,7 @@ class DisqusAPI {
return false;
}
- return !$this->json_assoc ? $data->message : $data['message'];
+ return $data->message;
}
/**