Plugin Directory

Changeset 1995375


Ignore:
Timestamp:
12/15/2018 10:46:25 AM (7 years ago)
Author:
heorhiiev
Message:

Added a placeholder field for the mask tag form genarator

Location:
cf7-phone-mask-field/trunk
Files:
4 added
2 edited

Legend:

Unmodified
Added
Removed
  • cf7-phone-mask-field/trunk/cf7-phone-mask-field.php

    r1988214 r1995375  
    33Plugin Name: Contact Form 7 - Phone mask field
    44Description: This plugin adds a new field in which you can set the phone number entry mask or other to Contact Form 7.
    5 Version: 1.1
     5Version: 1.3
    66Author: Ruslan Heorhiiev
    7 Text Domain: cf7-phone-mask-field
     7Text Domain: cf7-mask-field
    88Domain Path: /assets/languages/
    99
     
    1313if ( ! ABSPATH ) exit;
    1414
     15define( 'CF7MF_TEXT_DOMAIN', 'cf7-mask-field' );
     16
    1517/**
    1618 * Функция инициализации плагина
     
    1921function wpcf7mf_init(){
    2022    add_action( 'wpcf7_init', 'wpcf7mf_add_shortcode_mask' );
    21     add_action( 'wp_enqueue_scripts', 'wpcf7mf_do_enqueue_scripts' );
    22     add_filter( 'wpcf7_validate_mask*', 'wpcf7mf_mask_validation_filter', 10, 2 );
    23    
    24     // загрузка language файла & load language file.
    25     load_plugin_textdomain( 'contact-form-7-mask-field', false, dirname( plugin_dir_path( __FILE__ ) ) . '/assets/languages/' );
     23    add_action( 'wp_enqueue_scripts', 'wpcf7mf_enqueue_scripts' );
     24    add_action( 'admin_enqueue_scripts', 'wpcf7mf_admin_enqueue_scripts' );
     25    add_filter( 'wpcf7_validate_mask*', 'wpcf7mf_mask_validation_filter', 10, 2 );
    2626}
    2727add_action( 'plugins_loaded', 'wpcf7mf_init' , 20 );
     
    3232 * @version 1.0
    3333**/
    34 function wpcf7mf_do_enqueue_scripts() {
     34function wpcf7mf_enqueue_scripts() {
    3535    wp_enqueue_script( 'wpcf7mf-mask', plugin_dir_url( __FILE__ ) . 'assets/js/jquery.maskedinput.min.js', array('jquery'), '1.4', true );   
    3636}
    37 add_action( 'wp_enqueue_scripts', 'wpcf7mf_do_enqueue_scripts' );
     37
     38/**
     39 * Функция подключения JS для админки
     40 * Function enqueu script for admin panel
     41 * @version 1.0
     42**/
     43function wpcf7mf_admin_enqueue_scripts( $hook_suffix ) {
     44    if ( false === strpos( $hook_suffix, 'wpcf7' ) ) {
     45        return;
     46    }
     47   
     48    wp_enqueue_script( 'wpcf7mf-admin', plugin_dir_url( __FILE__ ) . 'assets/js/jquery.admin.main.js?v=' . rand(), array('jquery'), null, false );
     49}
    3850
    3951/**
     
    7082    if ( $validation_error ) {
    7183       $class .= ' wpcf7-not-valid';   
    72     }       
     84    }
    7385
    7486    $atts = array();
     
    95107
    96108    $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
     109       
    97110   
    98111    foreach ( $tag->values as $val ) {         
     
    181194    $tag_generator->add(
    182195        'mask',
    183         __( 'mask field', 'contact-form-7-mask-field' ),
     196        __( 'mask field', CF7MF_TEXT_DOMAIN ),
    184197        'wpcf7mf_tag_generator_field'
    185198    );
     
    200213    <fieldset>
    201214   
    202         <legend><?php echo esc_html( __( 'Generate a form-tag for a single-line plain text input field in which you can set the input mask.', 'contact-form-7-mask-field' ) ); ?></legend>
     215        <legend>
     216            <?php
     217                _e( 'Generate a form-tag for a single-line plain text input field in which you can set the input mask.', CF7MF_TEXT_DOMAIN );
     218            ?>
     219        </legend>
    203220       
    204221        <table class="form-table">
    205222        <tbody>
    206223            <tr>
    207                <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
     224               <th scope="row"><?php _e( 'Field type', 'contact-form-7' ); ?></th>
    208225                <td>
    209226                    <fieldset>
    210                     <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
    211                     <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
     227                    <legend class="screen-reader-text"><?php _e( 'Field type', 'contact-form-7' ); ?></legend>
     228                    <label><input type="checkbox" name="required" /> <?php _e( 'Required field', 'contact-form-7' ); ?></label>
    212229                    </fieldset>
    213230                </td>
     
    215232       
    216233            <tr>
    217                 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
     234                <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php _e( 'Name', 'contact-form-7' ); ?></label></th>
    218235                <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
    219236            </tr>
     
    221238            <!-- msk field -->
    222239            <tr>
    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>
     240                <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php _e( 'Mask', CF7MF_TEXT_DOMAIN ); ?></label></th>
    224241                <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>
     242                <?php _e( 'Enter the mask for this field. <br /><code>Example: +_ (___) ___-__-__</code>', CF7MF_TEXT_DOMAIN ); ?></td>
    226243            </tr>             
    227244       
    228             <tr>
    229                 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
     245            <!-- placeholder field -->
     246            <tr>
     247                <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-placeholder' ); ?>"><?php _e( 'Placeholder', CF7MF_TEXT_DOMAIN ); ?></label></th>
     248                <td><input type="text" name="values" class="placeholdervalue oneline" id="<?php echo esc_attr( $args['content'] . '-placeholder' ); ?>" /><br />               
     249            </tr>               
     250       
     251            <tr>
     252                <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php _e( 'Id attribute', 'contact-form-7' ); ?></label></th>
    230253                <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
    231254            </tr>
    232255       
    233256            <tr>
    234                 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
     257                <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php _e( 'Class attribute', 'contact-form-7' ); ?></label></th>
    235258                <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
    236259            </tr>                       
  • cf7-phone-mask-field/trunk/readme.txt

    r1988214 r1995375  
    44Requires at least: 4.0
    55Tested up to: 5.0
    6 Stable tag: 1.1
     6Stable tag: 1.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4242= 1.1 =
    4343* Added support for the placeholder field.
     44
     45= 1.2 =
     46* Tested up to 5.0
     47
     48= 1.3 =
     49* Added a placeholder field for the mask tag form genarator
Note: See TracChangeset for help on using the changeset viewer.