Plugin Directory

Changeset 645880


Ignore:
Timestamp:
12/29/2012 06:49:27 PM (13 years ago)
Author:
shockware
Message:

Merge branch 'master' into HEAD

Location:
contact-form-7-datepicker/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • contact-form-7-datepicker/trunk/contact-form-7-datepicker.php

    r636357 r645880  
    55Description: Easily add a date field using jQuery UI's datepicker to your CF7 forms. This plugin depends on Contact Form 7.
    66Author: Aurel Canciu
    7 Version: 2.1
     7Version: 2.2
    88Author URI: https://github.com/relu/
    99*/
     
    5454
    5555    public static function enqueue_js() {
    56         wp_enqueue_script('jquery-ui-datepicker');
     56        wp_enqueue_script('jquery-ui-datepicker', null, null, null, true);
    5757
    5858        $regional = CF7_DatePicker::get_regional_match();
     
    6565            'http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-' . $regional . '.min.js',
    6666            array('jquery-ui-datepicker'),
    67             '',
    68             false
     67            null,
     68            true
    6969        );
    7070    }
  • contact-form-7-datepicker/trunk/date-module.php

    r636357 r645880  
    1616        // Tag generator
    1717        add_action('load-toplevel_page_wpcf7', array(__CLASS__, 'tag_generator'));
     18
     19        // Messages
     20        add_filter('wpcf7_messages', array(__CLASS__, 'messages'));
    1821    }
    1922
     
    6972                $dpOptions['changeYear'] = true;
    7073            } elseif (preg_match('%^year-range:(\d+)-?(\d+)?$%', $option, $matches)) {
    71                 $dpOptions['yearRange'] = "{$matches[1]}:{$matches[2]}";
     74                $dpOptions['yearRange'] = $matches[1] . ':' . @$matches[2];
    7275            } elseif (preg_match('%^months:(\d+)$%', $option, $matches)) {
    7376                $dpOptions['numberOfMonths'] = (int) $matches[1];
     
    8487        $value = reset($values);
    8588
    86         if (wpcf7_script_is() && preg_grep('%^waremark$%', $options)) {
     89        if (wpcf7_script_is() && preg_grep('%^watermark$%', $options)) {
    8790            $class_att .= ' wpcf7-use-title-as-watermark';
    8891            $title_att .= " $value";
     
    144147        $value = trim($_POST[$name]);
    145148
    146         if ('date*' == $type && '' == $value) {
     149        if ('date*' == $type && empty($value)) {
    147150            $result['valid'] = false;
    148151            $result['reason'][$name] = wpcf7_get_message('invalid_required');
     152        }
     153
     154        // TODO: Implement date format verification
     155        if (! empty($value) && ! self::is_valid_date($value)) {
     156            $result['valid'] = false;
     157            $result['reason'][$name] = wpcf7_get_message('invalid_date');
    149158        }
    150159
     
    171180    }
    172181
     182    public static function messages($messages) {
     183        $messages['invalid_date'] = array(
     184            'description' => __('The date that the sender entered is invalid'),
     185            'default' => __('Invalid date supplied.'),
     186        );
     187
     188        return $messages;
     189    }
    173190
    174191    private static function animate_dropdown() {
     
    197214        echo $html;
    198215    }
     216
     217    private static function is_valid_date($value) {
     218        return strtotime($value) ? true : false;
     219    }
    199220}
  • contact-form-7-datepicker/trunk/datepicker.php

    r636357 r645880  
    1010        'firstDay' => '',
    1111        'defaultDate' => '',
    12         'showAnim' => 'show',
     12        'showAnim' => '',
    1313        'changeMonth' => '',
    1414        'changeYear' => '',
    1515        'yearRange' => '',
    16         'numberOfMonths' => 1,
     16        'numberOfMonths' => '',
    1717        'showButtonPanel' => '',
    1818    );
  • contact-form-7-datepicker/trunk/readme.txt

    r636357 r645880  
    44Requires at least: 2.9
    55Tested up to: 3.5
    6 Stable tag: 2.1
     6Stable tag: 2.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3434
    3535== Changelog ==
     36
     37= 2.2 =
     38* Added basic date validation
     39* Fixed watermark
    3640
    3741= 2.1 =
Note: See TracChangeset for help on using the changeset viewer.