Contact Form 7 - Version 5.1.5

Version Description

  • Config Validator: New test item for the unavailable_html_elements error.
  • Config Validator: New test item for the attachments_overweight error.
Download this release

Release Info

Developer takayukister
Plugin Icon 128x128 Contact Form 7
Version 5.1.5
Comparing to
See all releases

Code changes from version 5.1.4 to 5.1.5

admin/admin.php CHANGED
@@ -393,7 +393,8 @@ function wpcf7_admin_management_page() {
393
  echo sprintf( '<span class="subtitle">'
394
  /* translators: %s: search keywords */
395
  . __( 'Search results for &#8220;%s&#8221;', 'contact-form-7' )
396
- . '</span>', esc_html( $_REQUEST['s'] ) );
 
397
  }
398
  ?>
399
 
@@ -523,12 +524,14 @@ function wpcf7_admin_updated_message( $page, $action, $object ) {
523
 
524
  if ( $count_invalid ) {
525
  $updated_message = sprintf(
526
- /* translators: %s: number of contact forms */
527
  _n(
 
528
  "Configuration validation completed. %s invalid contact form was found.",
529
  "Configuration validation completed. %s invalid contact forms were found.",
530
- $count_invalid, 'contact-form-7' ),
531
- number_format_i18n( $count_invalid ) );
 
 
532
 
533
  echo sprintf( '<div id="message" class="notice notice-warning is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
534
  } else {
@@ -574,8 +577,13 @@ function wpcf7_old_wp_version_error( $page, $action, $object ) {
574
  ?>
575
  <div class="notice notice-warning">
576
  <p><?php
577
- /* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
578
- echo sprintf( __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) );
 
 
 
 
 
579
  ?></p>
580
  </div>
581
  <?php
393
  echo sprintf( '<span class="subtitle">'
394
  /* translators: %s: search keywords */
395
  . __( 'Search results for &#8220;%s&#8221;', 'contact-form-7' )
396
+ . '</span>', esc_html( $_REQUEST['s'] )
397
+ );
398
  }
399
  ?>
400
 
524
 
525
  if ( $count_invalid ) {
526
  $updated_message = sprintf(
 
527
  _n(
528
+ /* translators: %s: number of contact forms */
529
  "Configuration validation completed. %s invalid contact form was found.",
530
  "Configuration validation completed. %s invalid contact forms were found.",
531
+ $count_invalid, 'contact-form-7'
532
+ ),
533
+ number_format_i18n( $count_invalid )
534
+ );
535
 
536
  echo sprintf( '<div id="message" class="notice notice-warning is-dismissible"><p>%s</p></div>', esc_html( $updated_message ) );
537
  } else {
577
  ?>
578
  <div class="notice notice-warning">
579
  <p><?php
580
+ echo sprintf(
581
+ /* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */
582
+ __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ),
583
+ WPCF7_VERSION,
584
+ WPCF7_REQUIRED_WP_VERSION,
585
+ admin_url( 'update-core.php' )
586
+ );
587
  ?></p>
588
  </div>
589
  <?php
admin/edit-contact-form.php CHANGED
@@ -254,8 +254,8 @@ if ( $post ) :
254
 
255
  $panels['additional-settings-panel'] = array(
256
  'title' => $additional_settings
257
- /* translators: %d: number of additional settings */
258
  ? sprintf(
 
259
  __( 'Additional Settings (%d)', 'contact-form-7' ),
260
  $additional_settings )
261
  : __( 'Additional Settings', 'contact-form-7' ),
254
 
255
  $panels['additional-settings-panel'] = array(
256
  'title' => $additional_settings
 
257
  ? sprintf(
258
+ /* translators: %d: number of additional settings */
259
  __( 'Additional Settings (%d)', 'contact-form-7' ),
260
  $additional_settings )
261
  : __( 'Additional Settings', 'contact-form-7' ),
admin/includes/class-contact-forms-list-table.php CHANGED
@@ -117,9 +117,11 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
117
  $output = sprintf(
118
  '<a class="row-title" href="%1$s" aria-label="%2$s">%3$s</a>',
119
  esc_url( $edit_link ),
120
- /* translators: %s: title of contact form */
121
- esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;', 'contact-form-7' ),
122
- $item->title() ) ),
 
 
123
  esc_html( $item->title() )
124
  );
125
 
@@ -132,8 +134,8 @@ class WPCF7_Contact_Form_List_Table extends WP_List_Table {
132
 
133
  if ( $count_errors = $config_validator->count_errors() ) {
134
  $error_notice = sprintf(
135
- /* translators: %s: number of errors detected */
136
  _n(
 
137
  '%s configuration error detected',
138
  '%s configuration errors detected',
139
  $count_errors, 'contact-form-7' ),
117
  $output = sprintf(
118
  '<a class="row-title" href="%1$s" aria-label="%2$s">%3$s</a>',
119
  esc_url( $edit_link ),
120
+ esc_attr( sprintf(
121
+ /* translators: %s: title of contact form */
122
+ __( 'Edit &#8220;%s&#8221;', 'contact-form-7' ),
123
+ $item->title()
124
+ ) ),
125
  esc_html( $item->title() )
126
  );
127
 
134
 
135
  if ( $count_errors = $config_validator->count_errors() ) {
136
  $error_notice = sprintf(
 
137
  _n(
138
+ /* translators: %s: number of errors detected */
139
  '%s configuration error detected',
140
  '%s configuration errors detected',
141
  $count_errors, 'contact-form-7' ),
admin/includes/config-validator.php CHANGED
@@ -9,7 +9,7 @@ function wpcf7_admin_init_bulk_cv() {
9
  }
10
 
11
  $result = WPCF7::get_option( 'bulk_validate' );
12
- $last_important_update = '5.0.4';
13
 
14
  if ( ! empty( $result['version'] )
15
  and version_compare( $last_important_update, $result['version'], '<=' ) ) {
@@ -105,12 +105,14 @@ function wpcf7_admin_bulk_validate_page() {
105
  $count = WPCF7_ContactForm::count();
106
 
107
  $submit_text = sprintf(
108
- /* translators: %s: number of contact forms */
109
  _n(
 
110
  "Validate %s Contact Form Now",
111
  "Validate %s Contact Forms Now",
112
- $count, 'contact-form-7' ),
113
- number_format_i18n( $count ) );
 
 
114
 
115
  ?>
116
  <div class="wrap">
9
  }
10
 
11
  $result = WPCF7::get_option( 'bulk_validate' );
12
+ $last_important_update = '5.1.5';
13
 
14
  if ( ! empty( $result['version'] )
15
  and version_compare( $last_important_update, $result['version'], '<=' ) ) {
105
  $count = WPCF7_ContactForm::count();
106
 
107
  $submit_text = sprintf(
 
108
  _n(
109
+ /* translators: %s: number of contact forms */
110
  "Validate %s Contact Form Now",
111
  "Validate %s Contact Forms Now",
112
+ $count, 'contact-form-7'
113
+ ),
114
+ number_format_i18n( $count )
115
+ );
116
 
117
  ?>
118
  <div class="wrap">
admin/includes/tag-generator.php CHANGED
@@ -41,8 +41,8 @@ class WPCF7_TagGenerator {
41
  echo sprintf(
42
  '<a href="#TB_inline?width=900&height=500&inlineId=%1$s" class="thickbox button" title="%2$s">%3$s</a>',
43
  esc_attr( $panel['content'] ),
44
- /* translators: %s: title of form-tag like 'email' or 'checkboxes' */
45
  esc_attr( sprintf(
 
46
  __( 'Form-tag Generator: %s', 'contact-form-7' ),
47
  $panel['title'] ) ),
48
  esc_html( $panel['title'] )
41
  echo sprintf(
42
  '<a href="#TB_inline?width=900&height=500&inlineId=%1$s" class="thickbox button" title="%2$s">%3$s</a>',
43
  esc_attr( $panel['content'] ),
 
44
  esc_attr( sprintf(
45
+ /* translators: %s: title of form-tag like 'email' or 'checkboxes' */
46
  __( 'Form-tag Generator: %s', 'contact-form-7' ),
47
  $panel['title'] ) ),
48
  esc_html( $panel['title'] )
admin/includes/welcome-panel.php CHANGED
@@ -23,7 +23,24 @@ function wpcf7_welcome_panel() {
23
 
24
  <p><?php echo esc_html( __( "Spammers target everything; your contact forms aren&#8217;t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p>
25
 
26
- <p><?php /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'comment blacklist' */ echo sprintf( esc_html( __( 'Contact Form 7 supports spam-filtering with %1$s. Intelligent %2$s blocks annoying spambots. Plus, using %3$s, you can block messages containing specified keywords or those sent from specified IP addresses.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ), __( 'Akismet', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ), __( 'comment blacklist', 'contact-form-7' ) ) ); ?></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  </div>
28
 
29
  <?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?>
@@ -32,7 +49,16 @@ function wpcf7_welcome_panel() {
32
 
33
  <p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p>
34
 
35
- <p><?php /* translators: %s: link labeled 'making a donation' */ echo sprintf( esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/donate/', 'contact-form-7' ), __( 'making a donation', 'contact-form-7' ) ) ); ?></p>
 
 
 
 
 
 
 
 
 
36
 
37
  <p><?php echo esc_html( __( "Your donation will help encourage and support the plugin&#8217;s continued development and better user support.", 'contact-form-7' ) ); ?></p>
38
  </div>
@@ -42,7 +68,16 @@ function wpcf7_welcome_panel() {
42
 
43
  <p><?php echo esc_html( __( "Contact Form 7 doesn&#8217;t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p>
44
 
45
- <p><?php /* translators: %s: link labeled 'Flamingo' */ echo sprintf( esc_html( __( 'Install a message storage plugin before this happens to you. %s saves all messages through contact forms into the database. Flamingo is a free WordPress plugin created by the same author as Contact Form 7.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ), __( 'Flamingo', 'contact-form-7' ) ) ); ?></p>
 
 
 
 
 
 
 
 
 
46
  </div>
47
  <?php endif; ?>
48
 
23
 
24
  <p><?php echo esc_html( __( "Spammers target everything; your contact forms aren&#8217;t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p>
25
 
26
+ <p><?php
27
+ echo sprintf(
28
+ /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'comment blacklist' */
29
+ esc_html( __( 'Contact Form 7 supports spam-filtering with %1$s. Intelligent %2$s blocks annoying spambots. Plus, using %3$s, you can block messages containing specified keywords or those sent from specified IP addresses.', 'contact-form-7' ) ),
30
+ wpcf7_link(
31
+ __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ),
32
+ __( 'Akismet', 'contact-form-7' )
33
+ ),
34
+ wpcf7_link(
35
+ __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ),
36
+ __( 'reCAPTCHA', 'contact-form-7' )
37
+ ),
38
+ wpcf7_link(
39
+ __( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ),
40
+ __( 'comment blacklist', 'contact-form-7' )
41
+ )
42
+ );
43
+ ?></p>
44
  </div>
45
 
46
  <?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?>
49
 
50
  <p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p>
51
 
52
+ <p><?php
53
+ echo sprintf(
54
+ /* translators: %s: link labeled 'making a donation' */
55
+ esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ),
56
+ wpcf7_link(
57
+ __( 'https://contactform7.com/donate/', 'contact-form-7' ),
58
+ __( 'making a donation', 'contact-form-7' )
59
+ )
60
+ );
61
+ ?></p>
62
 
63
  <p><?php echo esc_html( __( "Your donation will help encourage and support the plugin&#8217;s continued development and better user support.", 'contact-form-7' ) ); ?></p>
64
  </div>
68
 
69
  <p><?php echo esc_html( __( "Contact Form 7 doesn&#8217;t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p>
70
 
71
+ <p><?php
72
+ echo sprintf(
73
+ /* translators: %s: link labeled 'Flamingo' */
74
+ esc_html( __( 'Install a message storage plugin before this happens to you. %s saves all messages through contact forms into the database. Flamingo is a free WordPress plugin created by the same author as Contact Form 7.', 'contact-form-7' ) ),
75
+ wpcf7_link(
76
+ __( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ),
77
+ __( 'Flamingo', 'contact-form-7' )
78
+ )
79
+ );
80
+ ?></p>
81
  </div>
82
  <?php endif; ?>
83
 
includes/config-validator.php CHANGED
@@ -13,6 +13,8 @@ class WPCF7_ConfigValidator {
13
  const error_invalid_mail_header = 108;
14
  const error_deprecated_settings = 109;
15
  const error_file_not_in_content_dir = 110;
 
 
16
 
17
  public static function get_doc_link( $error_code = '' ) {
18
  $url = __( 'https://contactform7.com/configuration-errors/',
@@ -323,6 +325,7 @@ class WPCF7_ConfigValidator {
323
  $form = $this->contact_form->prop( 'form' );
324
  $this->detect_multiple_controls_in_label( $section, $form );
325
  $this->detect_unavailable_names( $section, $form );
 
326
  }
327
 
328
  public function detect_multiple_controls_in_label( $section, $content ) {
@@ -405,6 +408,22 @@ class WPCF7_ConfigValidator {
405
  return false;
406
  }
407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
408
  public function validate_mail( $template = 'mail' ) {
409
  $components = (array) $this->contact_form->prop( $template );
410
 
@@ -508,6 +527,29 @@ class WPCF7_ConfigValidator {
508
  $this->detect_maybe_empty( sprintf( '%s.body', $template ), $body );
509
 
510
  if ( '' !== $components['attachments'] ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
511
  $has_file_not_found = false;
512
  $has_file_not_in_content_dir = false;
513
 
@@ -529,6 +571,23 @@ class WPCF7_ConfigValidator {
529
  sprintf( '%s.attachments', $template ), $line
530
  );
531
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
532
  }
533
  }
534
  }
13
  const error_invalid_mail_header = 108;
14
  const error_deprecated_settings = 109;
15
  const error_file_not_in_content_dir = 110;
16
+ const error_unavailable_html_elements = 111;
17
+ const error_attachments_overweight = 112;
18
 
19
  public static function get_doc_link( $error_code = '' ) {
20
  $url = __( 'https://contactform7.com/configuration-errors/',
325
  $form = $this->contact_form->prop( 'form' );
326
  $this->detect_multiple_controls_in_label( $section, $form );
327
  $this->detect_unavailable_names( $section, $form );
328
+ $this->detect_unavailable_html_elements( $section, $form );
329
  }
330
 
331
  public function detect_multiple_controls_in_label( $section, $content ) {
408
  return false;
409
  }
410
 
411
+ public function detect_unavailable_html_elements( $section, $content ) {
412
+ $pattern = '%(?:<form[\s\t>]|</form>)%i';
413
+
414
+ if ( preg_match( $pattern, $content ) ) {
415
+ return $this->add_error( $section,
416
+ self::error_unavailable_html_elements,
417
+ array(
418
+ 'message' => __( "Unavailable HTML elements are used in the form template.", 'contact-form-7' ),
419
+ 'link' => self::get_doc_link( 'unavailable_html_elements' ),
420
+ )
421
+ );
422
+ }
423
+
424
+ return false;
425
+ }
426
+
427
  public function validate_mail( $template = 'mail' ) {
428
  $components = (array) $this->contact_form->prop( $template );
429
 
527
  $this->detect_maybe_empty( sprintf( '%s.body', $template ), $body );
528
 
529
  if ( '' !== $components['attachments'] ) {
530
+ $attachables = array();
531
+
532
+ $tags = $this->contact_form->scan_form_tags(
533
+ array( 'type' => array( 'file', 'file*' ) )
534
+ );
535
+
536
+ foreach ( $tags as $tag ) {
537
+ $name = $tag->name;
538
+
539
+ if ( false === strpos( $components['attachments'], "[{$name}]" ) ) {
540
+ continue;
541
+ }
542
+
543
+ $limit = (int) $tag->get_limit_option();
544
+
545
+ if ( empty( $attachables[$name] )
546
+ or $attachables[$name] < $limit ) {
547
+ $attachables[$name] = $limit;
548
+ }
549
+ }
550
+
551
+ $total_size = array_sum( $attachables );
552
+
553
  $has_file_not_found = false;
554
  $has_file_not_in_content_dir = false;
555
 
571
  sprintf( '%s.attachments', $template ), $line
572
  );
573
  }
574
+
575
+ if ( ! $has_file_not_found ) {
576
+ $path = path_join( WP_CONTENT_DIR, $line );
577
+ $total_size += (int) @filesize( $path );
578
+ }
579
+ }
580
+
581
+ $max = 25 * 1024 * 1024; // 25 MB
582
+
583
+ if ( $max < $total_size ) {
584
+ $this->add_error( sprintf( '%s.attachments', $template ),
585
+ self::error_attachments_overweight,
586
+ array(
587
+ 'message' => __( "The total size of attachment files is too large.", 'contact-form-7' ),
588
+ 'link' => self::get_doc_link( 'attachments_overweight' ),
589
+ )
590
+ );
591
  }
592
  }
593
  }
includes/contact-form-functions.php CHANGED
@@ -165,24 +165,30 @@ function wpcf7_save_contact_form( $args = '', $context = 'save' ) {
165
  $contact_form->set_locale( $args['locale'] );
166
  }
167
 
168
- $properties = $contact_form->get_properties();
169
 
170
- $properties['form'] = wpcf7_sanitize_form(
171
- $args['form'], $properties['form'] );
172
-
173
- $properties['mail'] = wpcf7_sanitize_mail(
174
- $args['mail'], $properties['mail'] );
175
 
176
- $properties['mail']['active'] = true;
 
 
 
177
 
178
- $properties['mail_2'] = wpcf7_sanitize_mail(
179
- $args['mail_2'], $properties['mail_2'] );
 
180
 
181
- $properties['messages'] = wpcf7_sanitize_messages(
182
- $args['messages'], $properties['messages'] );
 
183
 
184
- $properties['additional_settings'] = wpcf7_sanitize_additional_settings(
185
- $args['additional_settings'], $properties['additional_settings'] );
 
 
 
186
 
187
  $contact_form->set_properties( $properties );
188
 
165
  $contact_form->set_locale( $args['locale'] );
166
  }
167
 
168
+ $properties = array();
169
 
170
+ if ( null !== $args['form'] ) {
171
+ $properties['form'] = wpcf7_sanitize_form( $args['form'] );
172
+ }
 
 
173
 
174
+ if ( null !== $args['mail'] ) {
175
+ $properties['mail'] = wpcf7_sanitize_mail( $args['mail'] );
176
+ $properties['mail']['active'] = true;
177
+ }
178
 
179
+ if ( null !== $args['mail_2'] ) {
180
+ $properties['mail_2'] = wpcf7_sanitize_mail( $args['mail_2'] );
181
+ }
182
 
183
+ if ( null !== $args['messages'] ) {
184
+ $properties['messages'] = wpcf7_sanitize_messages( $args['messages'] );
185
+ }
186
 
187
+ if ( null !== $args['additional_settings'] ) {
188
+ $properties['additional_settings'] = wpcf7_sanitize_additional_settings(
189
+ $args['additional_settings']
190
+ );
191
+ }
192
 
193
  $contact_form->set_properties( $properties );
194
 
includes/contact-form-template.php CHANGED
@@ -47,10 +47,12 @@ class WPCF7_ContactFormTemplate {
47
  public static function mail() {
48
  $template = array(
49
  'subject' =>
50
- /* translators: 1: blog name, 2: [your-subject] */
51
  sprintf(
 
52
  _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ),
53
- get_bloginfo( 'name' ), '[your-subject]' ),
 
 
54
  'sender' => sprintf( '%s <%s>',
55
  get_bloginfo( 'name' ), self::from_email() ),
56
  'body' =>
@@ -63,11 +65,12 @@ class WPCF7_ContactFormTemplate {
63
  . __( 'Message Body:', 'contact-form-7' )
64
  . "\n" . '[your-message]' . "\n\n"
65
  . '-- ' . "\n"
66
- /* translators: 1: blog name, 2: blog URL */
67
  . sprintf(
 
68
  __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ),
69
  get_bloginfo( 'name' ),
70
- get_bloginfo( 'url' ) ),
 
71
  'recipient' => get_option( 'admin_email' ),
72
  'additional_headers' => 'Reply-To: [your-email]',
73
  'attachments' => '',
@@ -82,21 +85,24 @@ class WPCF7_ContactFormTemplate {
82
  $template = array(
83
  'active' => false,
84
  'subject' =>
85
- /* translators: 1: blog name, 2: [your-subject] */
86
  sprintf(
 
87
  _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ),
88
- get_bloginfo( 'name' ), '[your-subject]' ),
 
 
89
  'sender' => sprintf( '%s <%s>',
90
  get_bloginfo( 'name' ), self::from_email() ),
91
  'body' =>
92
  __( 'Message Body:', 'contact-form-7' )
93
  . "\n" . '[your-message]' . "\n\n"
94
  . '-- ' . "\n"
95
- /* translators: 1: blog name, 2: blog URL */
96
  . sprintf(
 
97
  __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ),
98
  get_bloginfo( 'name' ),
99
- get_bloginfo( 'url' ) ),
 
100
  'recipient' => '[your-email]',
101
  'additional_headers' => sprintf( 'Reply-To: %s',
102
  get_option( 'admin_email' ) ),
47
  public static function mail() {
48
  $template = array(
49
  'subject' =>
 
50
  sprintf(
51
+ /* translators: 1: blog name, 2: [your-subject] */
52
  _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ),
53
+ get_bloginfo( 'name' ),
54
+ '[your-subject]'
55
+ ),
56
  'sender' => sprintf( '%s <%s>',
57
  get_bloginfo( 'name' ), self::from_email() ),
58
  'body' =>
65
  . __( 'Message Body:', 'contact-form-7' )
66
  . "\n" . '[your-message]' . "\n\n"
67
  . '-- ' . "\n"
 
68
  . sprintf(
69
+ /* translators: 1: blog name, 2: blog URL */
70
  __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ),
71
  get_bloginfo( 'name' ),
72
+ get_bloginfo( 'url' )
73
+ ),
74
  'recipient' => get_option( 'admin_email' ),
75
  'additional_headers' => 'Reply-To: [your-email]',
76
  'attachments' => '',
85
  $template = array(
86
  'active' => false,
87
  'subject' =>
 
88
  sprintf(
89
+ /* translators: 1: blog name, 2: [your-subject] */
90
  _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ),
91
+ get_bloginfo( 'name' ),
92
+ '[your-subject]'
93
+ ),
94
  'sender' => sprintf( '%s <%s>',
95
  get_bloginfo( 'name' ), self::from_email() ),
96
  'body' =>
97
  __( 'Message Body:', 'contact-form-7' )
98
  . "\n" . '[your-message]' . "\n\n"
99
  . '-- ' . "\n"
 
100
  . sprintf(
101
+ /* translators: 1: blog name, 2: blog URL */
102
  __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ),
103
  get_bloginfo( 'name' ),
104
+ get_bloginfo( 'url' )
105
+ ),
106
  'recipient' => '[your-email]',
107
  'additional_headers' => sprintf( 'Reply-To: %s',
108
  get_option( 'admin_email' ) ),
includes/form-tag.php CHANGED
@@ -322,6 +322,30 @@ class WPCF7_FormTag implements ArrayAccess {
322
  return apply_filters( 'wpcf7_form_tag_data_option', null, $options, $args );
323
  }
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  public function get_first_match_option( $pattern ) {
326
  foreach( (array) $this->options as $option ) {
327
  if ( preg_match( $pattern, $option, $matches ) ) {
322
  return apply_filters( 'wpcf7_form_tag_data_option', null, $options, $args );
323
  }
324
 
325
+ public function get_limit_option( $default = 1048576 ) { // 1048576 = 1 MB
326
+ $pattern = '/^limit:([1-9][0-9]*)([kKmM]?[bB])?$/';
327
+
328
+ $matches = $this->get_first_match_option( $pattern );
329
+
330
+ if ( $matches ) {
331
+ $size = (int) $matches[1];
332
+
333
+ if ( ! empty( $matches[2] ) ) {
334
+ $kbmb = strtolower( $matches[2] );
335
+
336
+ if ( 'kb' == $kbmb ) {
337
+ $size *= 1024;
338
+ } elseif ( 'mb' == $kbmb ) {
339
+ $size *= 1024 * 1024;
340
+ }
341
+ }
342
+
343
+ return $size;
344
+ }
345
+
346
+ return (int) $default;
347
+ }
348
+
349
  public function get_first_match_option( $pattern ) {
350
  foreach( (array) $this->options as $option ) {
351
  if ( preg_match( $pattern, $option, $matches ) ) {
includes/form-tags-manager.php CHANGED
@@ -257,7 +257,7 @@ class WPCF7_FormTagsManager {
257
 
258
  private function tag_regex() {
259
  $tagnames = array_keys( $this->tag_types );
260
- $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
261
 
262
  return '(\[?)'
263
  . '\[(' . $tagregexp . ')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]'
257
 
258
  private function tag_regex() {
259
  $tagnames = array_keys( $this->tag_types );
260
+ $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) );
261
 
262
  return '(\[?)'
263
  . '\[(' . $tagregexp . ')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]'
modules/acceptance.php CHANGED
@@ -211,12 +211,13 @@ function wpcf7_acceptance_mail_tag( $replaced, $submitted, $html, $mail_tag ) {
211
  $content = trim( $content );
212
 
213
  if ( $content ) {
214
- /* translators: 1: 'Consented' or 'Not consented', 2: conditions */
215
  $replaced = sprintf(
 
216
  _x( '%1$s: %2$s', 'mail output for acceptance checkboxes',
217
  'contact-form-7' ),
218
  $replaced,
219
- $content );
 
220
  }
221
 
222
  return $replaced;
211
  $content = trim( $content );
212
 
213
  if ( $content ) {
 
214
  $replaced = sprintf(
215
+ /* translators: 1: 'Consented' or 'Not consented', 2: conditions */
216
  _x( '%1$s: %2$s', 'mail output for acceptance checkboxes',
217
  'contact-form-7' ),
218
  $replaced,
219
+ $content
220
+ );
221
  }
222
 
223
  return $replaced;
modules/file.php CHANGED
@@ -110,31 +110,9 @@ function wpcf7_file_validation_filter( $result, $tag ) {
110
 
111
  /* File size validation */
112
 
113
- $allowed_size = 1048576; // default size 1 MB
114
 
115
- if ( $file_size_a = $tag->get_option( 'limit' ) ) {
116
- $limit_pattern = '/^([1-9][0-9]*)([kKmM]?[bB])?$/';
117
-
118
- foreach ( $file_size_a as $file_size ) {
119
- if ( preg_match( $limit_pattern, $file_size, $matches ) ) {
120
- $allowed_size = (int) $matches[1];
121
-
122
- if ( ! empty( $matches[2] ) ) {
123
- $kbmb = strtolower( $matches[2] );
124
-
125
- if ( 'kb' == $kbmb ) {
126
- $allowed_size *= 1024;
127
- } elseif ( 'mb' == $kbmb ) {
128
- $allowed_size *= 1024 * 1024;
129
- }
130
- }
131
-
132
- break;
133
- }
134
- }
135
- }
136
-
137
- if ( $file['size'] > $allowed_size ) {
138
  $result->invalidate( $tag, wpcf7_get_message( 'upload_file_too_large' ) );
139
  return $result;
140
  }
110
 
111
  /* File size validation */
112
 
113
+ $allowed_size = $tag->get_limit_option();
114
 
115
+ if ( $allowed_size < $file['size'] ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  $result->invalidate( $tag, wpcf7_get_message( 'upload_file_too_large' ) );
117
  return $result;
118
  }
modules/really-simple-captcha.php CHANGED
@@ -34,7 +34,8 @@ function wpcf7_captchac_form_tag_handler( $tag ) {
34
  $error = sprintf(
35
  /* translators: %s: link labeled 'Really Simple CAPTCHA' */
36
  esc_html( __( "To use CAPTCHA, you need %s plugin installed.", 'contact-form-7' ) ),
37
- wpcf7_link( 'https://wordpress.org/plugins/really-simple-captcha/', 'Really Simple CAPTCHA' ) );
 
38
 
39
  return sprintf( '<em>%s</em>', $error );
40
  }
34
  $error = sprintf(
35
  /* translators: %s: link labeled 'Really Simple CAPTCHA' */
36
  esc_html( __( "To use CAPTCHA, you need %s plugin installed.", 'contact-form-7' ) ),
37
+ wpcf7_link( 'https://wordpress.org/plugins/really-simple-captcha/', 'Really Simple CAPTCHA' )
38
+ );
39
 
40
  return sprintf( '<em>%s</em>', $error );
41
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: takayukister
3
  Donate link: https://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 4.9
6
- Tested up to: 5.2
7
- Stable tag: 5.1.4
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,11 @@ Do you have questions or issues with Contact Form 7? Use these support channels
75
 
76
  For more information, see [Releases](https://contactform7.com/category/releases/).
77
 
 
 
 
 
 
78
  = 5.1.4 =
79
 
80
  * reCAPTCHA: introduces the WPCF7_RECAPTCHA_SITEKEY and WPCF7_RECAPTCHA_SECRET constants.
3
  Donate link: https://contactform7.com/donate/
4
  Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
5
  Requires at least: 4.9
6
+ Tested up to: 5.3
7
+ Stable tag: 5.1.5
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  For more information, see [Releases](https://contactform7.com/category/releases/).
77
 
78
+ = 5.1.5 =
79
+
80
+ * Config Validator: New test item for the unavailable_html_elements error.
81
+ * Config Validator: New test item for the attachments_overweight error.
82
+
83
  = 5.1.4 =
84
 
85
  * reCAPTCHA: introduces the WPCF7_RECAPTCHA_SITEKEY and WPCF7_RECAPTCHA_SECRET constants.
wp-contact-form-7.php CHANGED
@@ -7,10 +7,10 @@ Author: Takayuki Miyoshi
7
  Author URI: https://ideasilo.wordpress.com/
8
  Text Domain: contact-form-7
9
  Domain Path: /languages/
10
- Version: 5.1.4
11
  */
12
 
13
- define( 'WPCF7_VERSION', '5.1.4' );
14
 
15
  define( 'WPCF7_REQUIRED_WP_VERSION', '4.9' );
16
 
7
  Author URI: https://ideasilo.wordpress.com/
8
  Text Domain: contact-form-7
9
  Domain Path: /languages/
10
+ Version: 5.1.5
11
  */
12
 
13
+ define( 'WPCF7_VERSION', '5.1.5' );
14
 
15
  define( 'WPCF7_REQUIRED_WP_VERSION', '4.9' );
16