/**
  * 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;
     }
 }
 /**
  * Add a website to the timeline
  *
  * @access	private
  */
 private function create()
 {
     if (VPost::add(false)) {
         try {
             foreach ($this->_prefs->_data['timeline'] as $website) {
                 if ($website['url'] == VPost::url()) {
                     throw new Exception('Website already in your timeline with the name "' . $website['title'] . '"');
                 }
             }
             $curl = new Curl(VPost::url() . 'admin/index.php?ns=rpc&ctl=timeline&action=check');
             if ($curl->_content != '{"lynxpress":"true"}') {
                 throw new Exception('Wished website is not running Lynxpress! Or not a compatible version!');
             }
             $data = $this->_prefs->_data;
             $data['timeline'][] = array('title' => VPost::title(), 'url' => VPost::url());
             $this->_prefs->_data = $data;
             $this->_prefs->_data = json_encode($this->_prefs->_data);
             $this->_prefs->update('_data', 'str');
             $this->_prefs->_data = json_decode($this->_prefs->_data, true);
             $result = true;
         } catch (Exception $e) {
             $result = $e->getMessage();
         }
         $this->_action_msg = ActionMessages::pref_updated($result);
     }
 }