<?php /** ** A base module for [count], Twitter-like character count **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_count', 10, 0 ); function wpcf7_add_form_tag_count() { wpcf7_add_form_tag( 'count', 'wpcf7_count_form_tag_handler', array( 'name-attr' => true, 'zero-controls-container' => true, 'not-for-mail' => true, ) ); } function wpcf7_count_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $targets = wpcf7_scan_form_tags( array( 'name' => $tag->name ) ); $maxlength = $minlength = null; while ( $targets ) { $target = array_shift( $targets ); if ( 'count' != $target->type ) { $maxlength = $target->get_maxlength_option(); $minlength = $target->get_minlength_option(); break; } } if ( $maxlength and $minlength and $maxlength < $minlength ) { $maxlength = $minlength = null; } if ( $tag->has_option( 'down' ) ) { $value = (int) $maxlength; $class = 'wpcf7-character-count down'; } else { $value = '0'; $class = 'wpcf7-character-count up'; } $atts = array(); $atts['id'] = $tag->get_id_option(); $atts['class'] = $tag->get_class_option( $class ); $atts['data-target-name'] = $tag->name; $atts['data-starting-value'] = $value; $atts['data-current-value'] = $value; $atts['data-maximum-value'] = $maxlength; $atts['data-minimum-value'] = $minlength; $html = sprintf( '<span %1$s>%2$s</span>', wpcf7_format_atts( $atts ), $value ); return $html; }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
akismet | Folder | 0755 |
|
|
constant-contact | Folder | 0755 |
|
|
recaptcha | Folder | 0755 |
|
|
sendinblue | Folder | 0755 |
|
|
stripe | Folder | 0755 |
|
|
acceptance.php | File | 7.66 KB | 0644 |
|
checkbox.php | File | 11.79 KB | 0644 |
|
count.php | File | 1.45 KB | 0644 |
|
date.php | File | 7.9 KB | 0644 |
|
disallowed-list.php | File | 1.77 KB | 0644 |
|
doi-helper.php | File | 730 B | 0644 |
|
file.php | File | 6.68 KB | 0644 |
|
flamingo.php | File | 8.34 KB | 0644 |
|
hidden.php | File | 776 B | 0644 |
|
listo.php | File | 755 B | 0644 |
|
number.php | File | 8.7 KB | 0644 |
|
quiz.php | File | 6.73 KB | 0644 |
|
really-simple-captcha.php | File | 17.44 KB | 0644 |
|
reflection.php | File | 2.27 KB | 0644 |
|
response.php | File | 460 B | 0644 |
|
select.php | File | 8.48 KB | 0644 |
|
submit.php | File | 2.87 KB | 0644 |
|
text.php | File | 10.01 KB | 0644 |
|
textarea.php | File | 6.54 KB | 0644 |
|