/**
  * Check if current request is allowed and complete.
  *
  * @return array
  */
 private function validate_request()
 {
     \Inpsyde\MultilingualPress\check_admin_referer($this->nonce);
     if (empty($_POST['languages'])) {
         \Inpsyde\MultilingualPress\call_exit('invalid request');
     }
     return (array) $_POST['languages'];
 }
 /**
  * Updates the plugin settings according to the data in the request.
  *
  * @since 3.0.0
  *
  * @return void
  */
 public function update_settings()
 {
     \Inpsyde\MultilingualPress\check_admin_referer($this->nonce);
     array_walk(array_keys($this->module_manager->get_modules()), [$this, 'update_module']);
     $this->module_manager->save_modules();
     /**
      * Runs before the redirect.
      *
      * Process your fields in the $_POST superglobal here and then call update_site_option().
      *
      * @param array $_POST
      */
     do_action('mlp_modules_save_fields', $_POST);
     wp_safe_redirect(add_query_arg('message', 'updated', $this->settings_page->url()));
     \Inpsyde\MultilingualPress\call_exit();
 }
 /**
  * Combine all update actions.
  *
  * @return void
  */
 public function update_settings()
 {
     if (!\Inpsyde\MultilingualPress\check_admin_referer($this->nonce)) {
         wp_die('Invalid', 'Invalid', 403);
     }
     $blog_id = $this->get_blog_id();
     $this->update_language($blog_id);
     $this->update_flag($blog_id);
     $this->update_related_blogs($blog_id);
     /**
      * Runs after having saved the site settings.
      *
      * @param array $_POST The $_POST superglobal.
      */
     do_action('mlp_blogs_save_fields', $_POST);
     $url = add_query_arg('msg', 'updated', $_POST['_wp_http_referer']);
     wp_safe_redirect($url);
     \Inpsyde\MultilingualPress\call_exit();
 }
 /**
  * @return void
  */
 public function reset_table()
 {
     \Inpsyde\MultilingualPress\check_admin_referer($this->nonce);
     $table_prefix = $this->wpdb->base_prefix;
     $table = new LanguagesTable($table_prefix);
     $installer = new WPDBTableInstaller($table);
     $installer->uninstall();
     $installer->install();
     /**
      * Runs after having reset the database table.
      *
      * @param Table $table Languages table object.
      */
     do_action('mlp_reset_table_done', $table);
     $url = add_query_arg('msg', 'resettable', $_REQUEST['_wp_http_referer']);
     wp_safe_redirect($url);
     \Inpsyde\MultilingualPress\call_exit();
 }