From 2f37e84f844ec89bb93ca07ef5cff961d2260c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Borbo=C3=ABn?= Date: Wed, 15 Mar 2023 09:01:37 +0100 Subject: [PATCH] [fix] Set the `FS_METHOD` to `direct` This set the FS_METHOD to `direct` for all the plugins. This is equivalent to setting the `FS_METHOD` constant in `wp-confing.php`. --- CHANGELOG.md | 3 +++ wpforms-epfl-payonline.php | 45 ++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8c6e61..f3432c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## v1.7.1 +* Fix for Force WP_Filesystem autodetection (`FS_METHOD`) + ## v1.7.0 * Force WP_Filesystem autodetection * Set allowed redirect hosts diff --git a/wpforms-epfl-payonline.php b/wpforms-epfl-payonline.php index 36a53a2..67b2dfa 100644 --- a/wpforms-epfl-payonline.php +++ b/wpforms-epfl-payonline.php @@ -6,7 +6,7 @@ * Author: EPFL ISAS-FSD * Author URI: https://go.epfl.ch/idev-fsd * Contributor: Nicolas Borboën - * Version: 1.7.0 + * Version: 1.7.1 * Text Domain: wpforms-epfl-payonline * Domain Path: languages * License: GPL-2.0+ @@ -37,7 +37,7 @@ } // Plugin version. -define( 'WPFORMS_EPFL_PAYONLINE_VERSION', '1.7.0' ); +define( 'WPFORMS_EPFL_PAYONLINE_VERSION', '1.7.1' ); // Plugin name. define( 'WPFORMS_EPFL_PAYONLINE_NAME', 'WPForms EPFL Payonline' ); // Latest WP version tested with this plugin. @@ -74,19 +74,30 @@ function wpforms_epfl_payonline() { add_action( 'wpforms_loaded', 'wpforms_epfl_payonline' ); -add_action( - 'wp_ajax_wpforms_tools_entries_export_step', - function() { - // WPForms requires WP_Filesystem() to be of ->method === "direct". - // For some reason (likely pertaining to our symlink scheme), - // WordPress' autodetection fails. - add_filter( - 'filesystem_method', - function() { - return 'direct'; - }, - 10, - 3 - ); - } +// WPForms requires WP_Filesystem() to be of ->method === "direct". +// For some reason (likely pertaining to our symlink scheme), +// WordPress' autodetection fails. This is equivalent to setting the +// `FS_METHOD` constant in `wp-confing.php`. +add_filter( + 'filesystem_method', + function() { + return 'direct'; + }, + 10, + 3 +); + +// +add_filter( + 'wpforms_save_form_args', + function($arr) { + $decoded_post_content = wpforms_decode(wp_unslash($arr['post_content'])); + + $decode_arr_ori = wpforms_decode(wp_unslash($_POST['data'])); + + $arr['post_content'] = wpforms_encode($decoded_post_content); + return $arr; + }, + 10, + 4 );