Exemple #1
0
 public function put_entries($data, $entry_id = null)
 {
     $this->log_debug(__METHOD__ . '(): Running.');
     $capability = apply_filters('gform_web_api_capability_put_entries', 'gravityforms_edit_entries');
     $this->authorize($capability);
     $entries = array();
     if (empty($entry_id)) {
         foreach ($data as $entry) {
             $entries[] = $this->maybe_serialize_list_fields($entry);
         }
         $result = GFAPI::update_entries($entries);
     } else {
         $entry = $this->maybe_serialize_list_fields($data);
         $result = GFAPI::update_entry($entry, $entry_id);
     }
     if (is_wp_error($result)) {
         $response = $this->get_error_response($result);
         $status = $this->get_error_status($result);
     } else {
         $status = 200;
         $response = empty($entry_id) ? __('Entries updated successfully', 'gravityforms') : __('Entry updated successfully', 'gravityforms');
     }
     $this->end($status, $response);
 }
Exemple #2
0
 public function put_entries($data, $entry_id = null)
 {
     $this->authorize("gravityforms_edit_entries");
     $result = empty($entry_id) ? GFAPI::update_entries($data) : ($result = GFAPI::update_entry($data, $entry_id));
     if (is_wp_error($result)) {
         $response = $this->get_error_response($result);
         $status = $this->get_error_status($result);
     } else {
         $status = 200;
         $response = empty($entry_id) ? __("Entries updated successfully", "gravityforms") : __("Entry updated successfully", "gravityforms");
     }
     $this->end($status, $response);
 }
Exemple #3
0
 public function put_entries($data, $entry_id = null)
 {
     $capability = apply_filters('gform_web_api_capability_put_entries', 'gravityforms_edit_entries');
     $this->authorize($capability);
     $result = empty($entry_id) ? GFAPI::update_entries($data) : ($result = GFAPI::update_entry($data, $entry_id));
     if (is_wp_error($result)) {
         $response = $this->get_error_response($result);
         $status = $this->get_error_status($result);
     } else {
         $status = 200;
         $response = empty($entry_id) ? __('Entries updated successfully', 'gravityforms') : __('Entry updated successfully', 'gravityforms');
     }
     $this->end($status, $response);
 }