Changeset 1988214
- Timestamp:
- 12/07/2018 06:42:24 PM (7 years ago)
- Location:
- cf7-phone-mask-field/trunk
- Files:
-
- 2 edited
-
cf7-phone-mask-field.php (modified) (5 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cf7-phone-mask-field/trunk/cf7-phone-mask-field.php
r1921749 r1988214 8 8 Domain Path: /assets/languages/ 9 9 10 Copyright © 201 7Ruslan Heorhiiev10 Copyright © 2018 Ruslan Heorhiiev 11 11 */ 12 12 … … 53 53 * Функция добавления шорткодов с участием маски 54 54 * Function add shortcodes with mask 55 * @version 1. 055 * @version 1.1 56 56 **/ 57 57 function wpcf7mf_mask_shortcode_handler( $tag ) { … … 68 68 69 69 70 if ( $validation_error ) 71 $class .= ' wpcf7-not-valid'; 70 if ( $validation_error ) { 71 $class .= ' wpcf7-not-valid'; 72 } 72 73 73 74 $atts = array(); … … 85 86 $atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true ); 86 87 87 if ( $tag->has_option( 'readonly' ) ) 88 $atts['readonly'] = 'readonly'; 89 90 if ( $tag->is_required() ) 91 $atts['aria-required'] = 'true'; 88 if ( $tag->has_option( 'readonly' ) ) { 89 $atts['readonly'] = 'readonly'; 90 } 91 92 if ( $tag->is_required() ) { 93 $atts['aria-required'] = 'true'; 94 } 92 95 93 96 $atts['aria-invalid'] = $validation_error ? 'true' : 'false'; 94 97 95 /** @var array $tag->values $values */ 96 $values = $tag->values; 97 98 $mask = $values[0]; 99 $value = $mask; 100 101 if (1 < count($values)) { 102 // если value значений больше одного предпологается, что необходимо разделать маску и placeholder поле 103 foreach ($values as $val) { 104 if (!strrpos($val, '_' )) { 105 continue; 106 } 98 foreach ( $tag->values as $val ) { 99 if ( strrpos( $val, '_', 1 ) ) { // $val is mask ? 100 $mask = $val; 101 } 107 102 108 $mask = $val; 109 $value = end($values) !== $mask ? end($values) : $values[0]; 110 111 break; 112 } 103 $placeholder = $val; 113 104 } 114 105 115 $atts['placeholder'] = $ value;106 $atts['placeholder'] = $placeholder; 116 107 $atts['data-mask'] = $mask; 117 108 $atts['name'] = $tag->name; … … 227 218 <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td> 228 219 </tr> 220 229 221 <!-- msk field --> 230 222 <tr> 231 223 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Mask', 'contact-form-7-mask-field' ) ); ?></label></th> 232 <td><input type="text" name="values" class=" oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br />233 <?php _e( 'Enter the mask for this field. <br /><code>Example: + 1(___) ___-__-__</code>', 'contact-form-7-mask-field' ); ?></td>234 </tr> 224 <td><input type="text" name="values" class="maskvalue oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br /> 225 <?php _e( 'Enter the mask for this field. <br /><code>Example: +_ (___) ___-__-__</code>', 'contact-form-7-mask-field' ); ?></td> 226 </tr> 235 227 236 228 <tr> -
cf7-phone-mask-field/trunk/readme.txt
r1921757 r1988214 3 3 Tags: Contact Form 7, Contact Form 7 phone, mask, mask field, phone field, telephone field, telephone, custom mask, custom mask field, cf7, contact form 7 mask field, contact form 7 phone mask, contact form 7 phone field, маска ввода, маска телефонного номера 4 4 Requires at least: 4.0 5 Tested up to: 4.95 Tested up to: 5.0 6 6 Stable tag: 1.1 7 7 License: GPLv2 or later
Note: See TracChangeset
for help on using the changeset viewer.