ikesyo
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [JSON API] [Plugin: JSON API] exclude doesn't work while include doesSorry, 2nd part of the cord is berrow.
function is_value_included($key) { if (empty($this->include_values) && empty($this->exclude_values)) { return true; } else { if (!empty($this->include_values)) { return in_array($key, $this->include_values); } else { return !in_array($key, $this->exclude_values); } } }Forum: Plugins
In reply to: [JSON API] [Plugin: JSON API] exclude doesn't work while include doesHi,
I worked around the problem.
response.php:
function setup() { global $json_api; $this->include_values = array(); $this->exclude_values = array(); if ($json_api->query->include) { $this->include_values = explode(',', $json_api->query->include); } if ($json_api->query->exclude) { $this->exclude_values = explode(',', $json_api->query->exclude); $this->include_values = array_diff($this->include_values, $this->exclude_values); } }function is_value_included($key) { if (empty($this->include_values) && empty($this->exclude_values)) { return true; } else { if (empty($this->exclude_values)) { return in_array($key, $this->include_values); } else { return !in_array($key, $this->exclude_values); } } }It seems to work properly.
Viewing 2 replies - 1 through 2 (of 2 total)