Changeset 332168
- Timestamp:
- 01/13/2011 05:17:51 PM (15 years ago)
- File:
-
- 1 edited
-
json-api/trunk/singletons/response.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
json-api/trunk/singletons/response.php
r331917 r332168 6 6 global $json_api; 7 7 $this->include_values = array(); 8 $this->exclude_values = array(); 8 9 if ($json_api->query->include) { 9 10 $this->include_values = explode(',', $json_api->query->include); 10 11 } 12 // Props to ikesyo for submitting a fix! 11 13 if ($json_api->query->exclude) { 12 $ exclude= explode(',', $json_api->query->exclude);13 $this->include_values = array_diff($this->include_values, $ exclude);14 $this->exclude_values = explode(',', $json_api->query->exclude); 15 $this->include_values = array_diff($this->include_values, $this->exclude_values); 14 16 } 15 17 … … 44 46 45 47 function is_value_included($key) { 46 if (empty($this->include_values)) { 48 // Props to ikesyo for submitting a fix! 49 if (empty($this->include_values) && empty($this->exclude_values)) { 47 50 return true; 48 51 } else { 49 return in_array($key, $this->include_values); 52 if (empty($this->exclude_values)) { 53 return in_array($key, $this->include_values); 54 } else { 55 return !in_array($key, $this->exclude_values); 56 } 50 57 } 51 58 }
Note: See TracChangeset
for help on using the changeset viewer.