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 e9dcfcf commit edf8fa2
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions includes/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,21 +517,21 @@ public function is_posted() {
/**
* Generates HTML that represents a form.
*
* @param string|array $args Optional. Form options.
* @param string|array $options Optional. Form options.
* @return string HTML output.
*/
public function form_html( $args = '' ) {
$args = wp_parse_args( $args, array(
public function form_html( $options = '' ) {
$options = wp_parse_args( $options, array(
'html_id' => '',
'html_name' => '',
'html_title' => '',
'html_class' => '',
'output' => 'form',
) );

$this->shortcode_atts = $args;
$this->shortcode_atts = $options;

if ( 'raw_form' == $args['output'] ) {
if ( 'raw_form' == $options['output'] ) {
return sprintf(
'<pre class="wpcf7-raw-form"><code>%s</code></pre>',
esc_html( $this->prop( 'form' ) )
Expand Down Expand Up @@ -596,14 +596,14 @@ public function form_html( $args = '' ) {
$html .= "\n" . $this->screen_reader_response() . "\n";

$id_attr = apply_filters( 'wpcf7_form_id_attr',
preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_id'] )
preg_replace( '/[^A-Za-z0-9:._-]/', '', $options['html_id'] )
);

$name_attr = apply_filters( 'wpcf7_form_name_attr',
preg_replace( '/[^A-Za-z0-9:._-]/', '', $args['html_name'] )
preg_replace( '/[^A-Za-z0-9:._-]/', '', $options['html_name'] )
);

$title_attr = apply_filters( 'wpcf7_form_title_attr', $args['html_title'] );
$title_attr = apply_filters( 'wpcf7_form_title_attr', $options['html_title'] );

$class = 'wpcf7-form';

Expand All @@ -620,8 +620,8 @@ public function form_html( $args = '' ) {
$class .= ' init';
}

if ( $args['html_class'] ) {
$class .= ' ' . $args['html_class'];
if ( $options['html_class'] ) {
$class .= ' ' . $options['html_class'];
}

if ( $this->in_demo_mode() ) {
Expand Down Expand Up @@ -964,13 +964,13 @@ public function form_elements() {
/**
* Collects mail-tags available for this contact form.
*
* @param string|array $args Optional. Search options.
* @param string|array $options Optional. Search options.
* @return array Mail-tag names.
*/
public function collect_mail_tags( $args = '' ) {
public function collect_mail_tags( $options = '' ) {
$manager = WPCF7_FormTagsManager::get_instance();

$args = wp_parse_args( $args, array(
$options = wp_parse_args( $options, array(
'include' => array(),
'exclude' => $manager->collect_tag_types( 'not-for-mail' ),
) );
Expand All @@ -983,12 +983,12 @@ public function collect_mail_tags( $args = '' ) {

if ( empty( $type ) ) {
continue;
} elseif ( ! empty( $args['include'] ) ) {
if ( ! in_array( $type, $args['include'] ) ) {
} elseif ( ! empty( $options['include'] ) ) {
if ( ! in_array( $type, $options['include'] ) ) {
continue;
}
} elseif ( ! empty( $args['exclude'] ) ) {
if ( in_array( $type, $args['exclude'] ) ) {
} elseif ( ! empty( $options['exclude'] ) ) {
if ( in_array( $type, $options['exclude'] ) ) {
continue;
}
}
Expand All @@ -1000,7 +1000,7 @@ public function collect_mail_tags( $args = '' ) {
$mailtags = array_filter( $mailtags );
$mailtags = array_values( $mailtags );

return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $args, $this );
return apply_filters( 'wpcf7_collect_mail_tags', $mailtags, $options, $this );
}


Expand Down Expand Up @@ -1046,11 +1046,11 @@ public function suggest_mail_tags( $template_name = 'mail' ) {
/**
* Submits this contact form.
*
* @param string|array $args Optional. Submission options. Default empty.
* @param string|array $options Optional. Submission options. Default empty.
* @return array Result of submission.
*/
public function submit( $args = '' ) {
$args = wp_parse_args( $args, array(
public function submit( $options = '' ) {
$options = wp_parse_args( $options, array(
'skip_mail' =>
( $this->in_demo_mode()
|| $this->is_true( 'skip_mail' )
Expand All @@ -1072,7 +1072,7 @@ public function submit( $args = '' ) {
}

$submission = WPCF7_Submission::get_instance( $this, array(
'skip_mail' => $args['skip_mail'],
'skip_mail' => $options['skip_mail'],
) );

$result = array(
Expand Down Expand Up @@ -1343,14 +1343,14 @@ public function delete() {
/**
* Returns a WordPress shortcode for this contact form.
*/
public function shortcode( $args = '' ) {
$args = wp_parse_args( $args, array(
public function shortcode( $options = '' ) {
$options = wp_parse_args( $options, array(
'use_old_format' => false
) );

$title = str_replace( array( '"', '[', ']' ), '', $this->title );

if ( $args['use_old_format'] ) {
if ( $options['use_old_format'] ) {
$old_unit_id = (int) get_post_meta( $this->id, '_old_cf7_unit_id', true );

if ( $old_unit_id ) {
Expand All @@ -1371,7 +1371,7 @@ public function shortcode( $args = '' ) {
}

return apply_filters( 'wpcf7_contact_form_shortcode',
$shortcode, $args, $this
$shortcode, $options, $this
);
}
}

0 comments on commit edf8fa2

Please sign in to comment.