/** * Set data from the form into the object * * If errors detected in the object it's returned into an array * * @access private * @return boolean */ private function check_post_data() { $results = array(); $errors = array(); array_push($results, $this->_post->__set('_title', VPost::title())); array_push($results, $this->_post->__set('_content', VPost::content())); array_push($results, $this->_post->__set('_allow_comment', VPost::allow_comment('closed'))); if (VPost::publish(false)) { array_push($results, $this->_post->__set('_status', 'publish')); } else { array_push($results, $this->_post->__set('_status', 'draft')); } array_push($results, $this->_post->__set('_category', implode(',', VPost::categories(array())))); //insertion of an empty aarray to return error message defined in the object array_push($results, $this->_post->__set('_tags', VPost::tags('divers'))); if ($this->_action == 'to_insert') { array_push($results, $this->_post->__set('_permalink', Helper::slug($this->_post->__get('_title')))); } //we should make it in create method, but we need to handle the error foreach ($results as $result) { if ($result !== true) { array_push($errors, '<li>- ' . $result . '</li>'); } } if (!empty($errors)) { $error_msg = 'Check your informations:<br/><ul>' . implode('', $errors) . '</ul>'; $this->_action_msg = ActionMessages::custom_wrong($error_msg); return false; } else { return true; } }