/** * Decodes JSON data for a column */ public function decodeJson($row = array(), $column = '', $default = array()) { if (!empty($column) && array_key_exists($column, $row)) { $row[$column] = Json::decode($row[$column], $default); } return $row; }
/** * Adds authenticated user data to the session */ public function login($data = array()) { $this->reset(); $this->session->set($this->key . '.info.last_active', time()); $this->session->set($this->key . '.info.login_time', time()); $this->session->set($this->key . '.info.login_hash', $this->unique); if (!empty($data) && is_array($data)) { if (empty($data['image']) && !empty($data['email'])) { $data['image'] = Gravatar::getUrl($data['email']); } if (!empty($data['options']) && is_string($data['options'])) { $data['options'] = Json::decode($data['options']); } $this->session->set($this->key . '.user', $data); } return true; }
/** * Get an array from parsed JSON string input data */ public function getJson() { return Json::decode($this->_input); }
/** * Renders a JSON view */ private function _renderJson() { $this->body = Json::encode($this->data); }