From c7fdac20dfa61b35b86846815a15506d91afb160 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 3 Mar 2010 19:53:39 +0000 Subject: [PATCH] Support for extra POST fields in WP_Filesystem. props dd32. see #12094 git-svn-id: https://develop.svn.wordpress.org/trunk@13577 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/file.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 3cace4551f..0ae950cb8a 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -807,10 +807,11 @@ function get_filesystem_method($args = array(), $context = false) { * @param string $type the chosen Filesystem method in use * @param boolean $error if the current request has failed to connect * @param string $context The directory which is needed access to, The write-test will be performed on this directory by get_filesystem_method() + * @param string $extra_fields Extra POST fields which should be checked for to be included in the post. * @return boolean False on failure. True on success. */ -function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) { - $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context); +function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null) { + $req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields ); if ( '' !== $req_cred ) return $req_cred; @@ -820,6 +821,9 @@ function request_filesystem_credentials($form_post, $type = '', $error = false, if ( 'direct' == $type ) return true; + if ( is_null( $extra_fields ) ) + $extra_fields = array( 'version', 'locale' ); + $credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => '')); // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) @@ -954,12 +958,12 @@ jQuery(function($){ - - - - - - +'; +} +?>