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 0026126 commit e2a56a2
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions includes/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,17 @@ function ( $attachment ) {
/**
* Replaces mail-tags within the given text.
*/
public function replace_tags( $content, $args = '' ) {
if ( true === $args ) {
$args = array( 'html' => true );
public function replace_tags( $content, $options = '' ) {
if ( true === $options ) {
$options = array( 'html' => true );
}

$args = wp_parse_args( $args, array(
$options = wp_parse_args( $options, array(
'html' => false,
'exclude_blank' => false,
) );

return wpcf7_mail_replace_tags( $content, $args );
return wpcf7_mail_replace_tags( $content, $options );
}


Expand Down Expand Up @@ -391,18 +391,18 @@ private function attachments( $template = null ) {
* Replaces all mail-tags within the given text content.
*
* @param string $content Text including mail-tags.
* @param string|array $args Optional. Output options.
* @param string|array $options Optional. Output options.
* @return string Result of replacement.
*/
function wpcf7_mail_replace_tags( $content, $args = '' ) {
$args = wp_parse_args( $args, array(
function wpcf7_mail_replace_tags( $content, $options = '' ) {
$options = wp_parse_args( $options, array(
'html' => false,
'exclude_blank' => false,
) );

if ( is_array( $content ) ) {
foreach ( $content as $key => $value ) {
$content[$key] = wpcf7_mail_replace_tags( $value, $args );
$content[$key] = wpcf7_mail_replace_tags( $value, $options );
}

return $content;
Expand All @@ -411,10 +411,10 @@ function wpcf7_mail_replace_tags( $content, $args = '' ) {
$content = explode( "\n", $content );

foreach ( $content as $num => $line ) {
$line = new WPCF7_MailTaggedText( $line, $args );
$line = new WPCF7_MailTaggedText( $line, $options );
$replaced = $line->replace_tags();

if ( $args['exclude_blank'] ) {
if ( $options['exclude_blank'] ) {
$replaced_tags = $line->get_replaced_tags();

if ( empty( $replaced_tags )
Expand Down Expand Up @@ -477,17 +477,17 @@ class WPCF7_MailTaggedText {
/**
* The constructor method.
*/
public function __construct( $content, $args = '' ) {
$args = wp_parse_args( $args, array(
public function __construct( $content, $options = '' ) {
$options = wp_parse_args( $options, array(
'html' => false,
'callback' => null,
) );

$this->html = (bool) $args['html'];
$this->html = (bool) $options['html'];

if ( null !== $args['callback']
and is_callable( $args['callback'] ) ) {
$this->callback = $args['callback'];
if ( null !== $options['callback']
and is_callable( $options['callback'] ) ) {
$this->callback = $options['callback'];
} elseif ( $this->html ) {
$this->callback = array( $this, 'replace_tags_callback_html' );
} else {
Expand Down

0 comments on commit e2a56a2

Please sign in to comment.