Skip to content

Commit

Permalink
Rename $args to $options
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Jun 16, 2024
1 parent e2a56a2 commit 73ab83c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions includes/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* Validates uploaded files and moves them to the temporary directory.
*
* @param array $file An item of `$_FILES`.
* @param string|array $args Optional. Arguments to control behavior.
* @param string|array $options Optional. Options to control behavior.
* @return array|WP_Error Array of file paths, or WP_Error if validation fails.
*/
function wpcf7_unship_uploaded_file( $file, $args = '' ) {
$args = wp_parse_args( $args, array(
function wpcf7_unship_uploaded_file( $file, $options = '' ) {
$options = wp_parse_args( $options, array(
'required' => false,
'filetypes' => '',
'limit' => MB_IN_BYTES,
Expand All @@ -33,13 +33,13 @@ function wpcf7_unship_uploaded_file( $file, $args = '' ) {
}
}

if ( isset( $args['schema'] ) and isset( $args['name'] ) ) {
if ( isset( $options['schema'] ) and isset( $options['name'] ) ) {
$context = array(
'file' => true,
'field' => $args['name'],
'field' => $options['name'],
);

foreach ( $args['schema']->validate( $context ) as $result ) {
foreach ( $options['schema']->validate( $context ) as $result ) {
if ( is_wp_error( $result ) ) {
return $result;
}
Expand All @@ -64,7 +64,7 @@ function wpcf7_unship_uploaded_file( $file, $args = '' ) {
$filename = wpcf7_antiscript_file_name( $filename );

$filename = apply_filters( 'wpcf7_upload_file_name',
$filename, $name, $args
$filename, $name, $options
);

$filename = wp_unique_filename( $uploads_dir, $filename );
Expand Down

0 comments on commit 73ab83c

Please sign in to comment.