Ejemplo n.º 1
0
 /**
  * @return bool
  */
 public function save()
 {
     $search = esc_url_raw(filter_input(INPUT_POST, 'search'));
     $replace = esc_url_raw(filter_input(INPUT_POST, 'replace'));
     $new_db_prefix = esc_attr(filter_input(INPUT_POST, 'new_db_prefix'));
     //search field should not be empty
     if ('' === $replace) {
         $this->add_error(esc_html__('Replace Field should not be empty.', 'search-and-replace'));
         return FALSE;
     }
     $report = $this->dbe->db_backup($search, $replace, array(), TRUE, $new_db_prefix);
     $this->downloader->show_modal($report);
     return TRUE;
 }
Ejemplo n.º 2
0
 /**
  * @return bool
  */
 public function save()
 {
     //check for errors in form
     if (!$this->is_request_valid()) {
         $this->display_errors();
         return FALSE;
     }
     $tables = isset($_POST['select_tables']) ? $_POST['select_tables'] : '';
     $dry_run = isset($_POST['dry_run']) ? TRUE : FALSE;
     //remove wp_magic_quotes
     $search = stripslashes(filter_input(INPUT_POST, 'search'));
     $replace = stripslashes(filter_input(INPUT_POST, 'replace'));
     //if dry run is checked we run the replace function with dry run and return
     if (TRUE === $dry_run) {
         $this->run_replace($search, $replace, $tables, $dry_run);
         return FALSE;
     }
     $export_or_save = filter_input(INPUT_POST, 'export_or_save');
     if ('export' === $export_or_save) {
         //'export'-button was checked
         $report = $this->dbe->db_backup($search, $replace, $tables);
         $this->downloader->show_modal($report);
     } else {
         //"Save changes to database" was checked
         $this->run_replace($search, $replace, $tables, $dry_run);
     }
     return TRUE;
 }
Ejemplo n.º 3
0
 /**
  * event handler for click on export sql button
  */
 public function save()
 {
     $report = $this->dbe->db_backup();
     $this->downloader->show_modal($report);
     return TRUE;
 }