/**
  * Validate and save user input
  *
  * @param  array $data User input
  * @return bool
  */
 public function save(array $data)
 {
     if (!$this->nonce->is_valid()) {
         return FALSE;
     }
     $id = $this->get_current_blog_id($data, get_current_blog_id());
     $value = $this->get_sent_value($data);
     return update_blog_option($id, $this->option_name, $value);
 }
 /**
  * Is this a valid request?
  *
  * @param  int $context Post id
  * @return bool
  */
 public function is_valid($context = NULL)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return FALSE;
     }
     if ($this->is_real_revision($context)) {
         return FALSE;
     }
     if (!current_user_can('edit_post', $context)) {
         return FALSE;
     }
     return $this->nonce->is_valid();
 }
 /**
  * Save user data.
  *
  * @param  int $user_id
  * @return bool
  */
 public function save($user_id)
 {
     if (!$this->nonce->is_valid()) {
         return FALSE;
     }
     if (!current_user_can('edit_user', $user_id)) {
         return FALSE;
     }
     if (empty($_POST[$this->key]) or '' === trim($_POST[$this->key])) {
         return delete_user_meta($user_id, $this->key);
     }
     return update_user_meta($user_id, $this->key, $_POST[$this->key]);
 }
 /**
  * @param string $taxonomy
  *
  * @return bool
  */
 private function is_valid_request($taxonomy)
 {
     if (!$this->nonce->is_valid()) {
         return FALSE;
     }
     if (!in_array($taxonomy, $this->taxonomies)) {
         return FALSE;
     }
     return TRUE;
 }
 /**
  * Is the AJAX request allowed and should be processed?
  *
  * @return bool
  */
 public function is_allowed()
 {
     if (!current_user_can('edit_theme_options')) {
         return false;
     }
     if (!$this->nonce->is_valid()) {
         return false;
     }
     return !empty($_GET['mlp_sites']);
 }