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 18ff5b6 commit 0026126
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ function wpcf7_strip_newline( $text ) {
* Canonicalizes text.
*
* @param string $text Input text.
* @param string|array|object $args Options.
* @param string|array|object $options Options.
* @return string Canonicalized text.
*/
function wpcf7_canonicalize( $text, $args = '' ) {
function wpcf7_canonicalize( $text, $options = '' ) {
// for back-compat
if ( is_string( $args ) and '' !== $args
and false === strpos( $args, '=' ) ) {
$args = array(
'strto' => $args,
if ( is_string( $options ) and '' !== $options
and false === strpos( $options, '=' ) ) {
$options = array(
'strto' => $options,
);
}

$args = wp_parse_args( $args, array(
$options = wp_parse_args( $options, array(
'strto' => 'lower',
'strip_separators' => false,
) );
Expand All @@ -229,19 +229,19 @@ function wpcf7_canonicalize( $text, $args = '' ) {
$text = mb_convert_kana( $text, 'asKV', $charset );
}

if ( $args['strip_separators'] ) {
if ( $options['strip_separators'] ) {
$text = preg_replace( '/[\r\n\t ]+/', '', $text );
} else {
$text = preg_replace( '/[\r\n\t ]+/', ' ', $text );
}

if ( 'lower' == $args['strto'] ) {
if ( 'lower' == $options['strto'] ) {
if ( function_exists( 'mb_strtolower' ) ) {
$text = mb_strtolower( $text, $charset );
} else {
$text = strtolower( $text );
}
} elseif ( 'upper' == $args['strto'] ) {
} elseif ( 'upper' == $options['strto'] ) {
if ( function_exists( 'mb_strtoupper' ) ) {
$text = mb_strtoupper( $text, $charset );
} else {
Expand Down

0 comments on commit 0026126

Please sign in to comment.