Skip to content

Commit

Permalink
[fix] Set the FS_METHOD to direct
Browse files Browse the repository at this point in the history
This set the FS_METHOD to `direct` for all the plugins. This is 
equivalent to setting the `FS_METHOD` constant in `wp-confing.php`.
  • Loading branch information
ponsfrilus committed Mar 15, 2023
1 parent 40148ae commit 2f37e84
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 28 additions & 17 deletions wpforms-epfl-payonline.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: EPFL ISAS-FSD
* Author URI: https://go.epfl.ch/idev-fsd
* Contributor: Nicolas Borboën <[email protected]>
* Version: 1.7.0
* Version: 1.7.1
* Text Domain: wpforms-epfl-payonline
* Domain Path: languages
* License: GPL-2.0+
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
);

0 comments on commit 2f37e84

Please sign in to comment.