| 1055 | |
| 1056 | /** |
| 1057 | * Callback function for outputting any extra fields passed through request_filesystem_credentials(). |
| 1058 | * |
| 1059 | * This function will parse strings, arrays or multi-dimensional arrays passed within the $extra_fields |
| 1060 | * parameter so that no data is lost. |
| 1061 | * |
| 1062 | * @since 3.4.0 |
| 1063 | * |
| 1064 | * @uses build_query |
| 1065 | * @param array $fields Extra fields passed through request_filesystem_credentials(). |
| 1066 | */ |
| 1067 | function output_filesystem_extra_fields( $fields ) { |
| 1068 | |
| 1069 | // Sanitize and store all passed data into one array |
| 1070 | $qs = array(); |
| 1071 | foreach ( (array) $fields as $field ) { |
| 1072 | if ( isset( $_POST[ $field ] ) ) |
| 1073 | $qs[esc_attr( $field )] = is_array( $_POST[$field] ) ? $_POST[esc_attr( stripslashes_deep( $field ) )] : $_POST[esc_attr( stripslashes( $field ) )]; |
| 1074 | } |
| 1075 | |
| 1076 | // Build a query string out of the data and then parse the string into input fields |
| 1077 | $query_string = build_query( $qs ); |
| 1078 | foreach ( explode( '&', $query_string ) as $kv_pair ) { |
| 1079 | list( $name, $value ) = explode( '=', $kv_pair, 2 ); |
| 1080 | echo '<input type="hidden" name="' . urldecode( $name ) . '" value="' . urldecode( $value ) . '">' . "\r\n"; |
| 1081 | } |
| 1082 | |
| 1083 | } |
| 1084 | No newline at end of file |