public function __call($method, $args) { if (!$this->is_fetched) { call_user_func($this); } return parent::__call($method, $args); }
public function normalize(array $data, $type = null) { $data = parent::normalize($data); switch ($type) { case 'create': $this->required_keys = array('post_name', 'post_title', 'post_content', 'post_excerpt', 'post_type'); $data = array_merge(array('post_name' => isset($data['post_title']) ? $this->string_to_slug($data['post_title']) : false, 'post_excerpt' => '', 'post_status' => 'publish'), $data); break; case 'update': $this->required_keys = array('ID'); break; } return $data; }