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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / modules / count.php
contact-form-7 / modules Last commit date
akismet 11 months ago constant-contact 9 months ago recaptcha 9 months ago sendinblue 9 months ago stripe 9 months ago turnstile 9 months ago acceptance.php 11 months ago checkbox.php 9 months ago count.php 1 year ago date.php 9 months ago disallowed-list.php 9 months ago doi-helper.php 4 years ago file.php 11 months ago flamingo.php 9 months ago hidden.php 7 years ago listo.php 2 years ago number.php 9 months ago quiz.php 11 months ago really-simple-captcha.php 9 months ago reflection.php 3 years ago response.php 6 years ago select.php 9 months ago submit.php 11 months ago text.php 9 months ago textarea.php 11 months ago
count.php
70 lines
1 <?php
2 /**
3 ** A base module for [count], Twitter-like character count
4 **/
5
6 /* form_tag handler */
7
8 add_action( 'wpcf7_init', 'wpcf7_add_form_tag_count', 10, 0 );
9
10 function wpcf7_add_form_tag_count() {
11 wpcf7_add_form_tag( 'count',
12 'wpcf7_count_form_tag_handler',
13 array(
14 'name-attr' => true,
15 'zero-controls-container' => true,
16 'not-for-mail' => true,
17 )
18 );
19 }
20
21 function wpcf7_count_form_tag_handler( $tag ) {
22 if ( empty( $tag->name ) ) {
23 return '';
24 }
25
26 $targets = wpcf7_scan_form_tags( array( 'name' => $tag->name ) );
27 $maxlength = $minlength = null;
28
29 while ( $targets ) {
30 $target = array_shift( $targets );
31
32 if ( 'count' !== $target->type ) {
33 $maxlength = $target->get_maxlength_option();
34 $minlength = $target->get_minlength_option();
35 break;
36 }
37 }
38
39 if ( $maxlength and $minlength
40 and $maxlength < $minlength ) {
41 $maxlength = $minlength = null;
42 }
43
44 if ( $tag->has_option( 'down' ) ) {
45 $value = (int) $maxlength;
46 $class = 'wpcf7-character-count down';
47 } else {
48 $value = '0';
49 $class = 'wpcf7-character-count up';
50 }
51
52 $atts = array();
53
54 $atts['id'] = $tag->get_id_option();
55 $atts['class'] = $tag->get_class_option( $class );
56 $atts['data-target-name'] = $tag->name;
57 $atts['data-starting-value'] = $value;
58 $atts['data-current-value'] = $value;
59 $atts['data-maximum-value'] = $maxlength;
60 $atts['data-minimum-value'] = $minlength;
61
62 $html = sprintf(
63 '<span %1$s>%2$s</span>',
64 wpcf7_format_atts( $atts ),
65 $value
66 );
67
68 return $html;
69 }
70