Changeset 645880
- Timestamp:
- 12/29/2012 06:49:27 PM (13 years ago)
- Location:
- contact-form-7-datepicker/trunk
- Files:
-
- 4 edited
-
contact-form-7-datepicker.php (modified) (3 diffs)
-
date-module.php (modified) (6 diffs)
-
datepicker.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contact-form-7-datepicker/trunk/contact-form-7-datepicker.php
r636357 r645880 5 5 Description: Easily add a date field using jQuery UI's datepicker to your CF7 forms. This plugin depends on Contact Form 7. 6 6 Author: Aurel Canciu 7 Version: 2. 17 Version: 2.2 8 8 Author URI: https://github.com/relu/ 9 9 */ … … 54 54 55 55 public static function enqueue_js() { 56 wp_enqueue_script('jquery-ui-datepicker' );56 wp_enqueue_script('jquery-ui-datepicker', null, null, null, true); 57 57 58 58 $regional = CF7_DatePicker::get_regional_match(); … … 65 65 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-' . $regional . '.min.js', 66 66 array('jquery-ui-datepicker'), 67 '',68 false67 null, 68 true 69 69 ); 70 70 } -
contact-form-7-datepicker/trunk/date-module.php
r636357 r645880 16 16 // Tag generator 17 17 add_action('load-toplevel_page_wpcf7', array(__CLASS__, 'tag_generator')); 18 19 // Messages 20 add_filter('wpcf7_messages', array(__CLASS__, 'messages')); 18 21 } 19 22 … … 69 72 $dpOptions['changeYear'] = true; 70 73 } elseif (preg_match('%^year-range:(\d+)-?(\d+)?$%', $option, $matches)) { 71 $dpOptions['yearRange'] = "{$matches[1]}:{$matches[2]}";74 $dpOptions['yearRange'] = $matches[1] . ':' . @$matches[2]; 72 75 } elseif (preg_match('%^months:(\d+)$%', $option, $matches)) { 73 76 $dpOptions['numberOfMonths'] = (int) $matches[1]; … … 84 87 $value = reset($values); 85 88 86 if (wpcf7_script_is() && preg_grep('%^wa remark$%', $options)) {89 if (wpcf7_script_is() && preg_grep('%^watermark$%', $options)) { 87 90 $class_att .= ' wpcf7-use-title-as-watermark'; 88 91 $title_att .= " $value"; … … 144 147 $value = trim($_POST[$name]); 145 148 146 if ('date*' == $type && '' == $value) {149 if ('date*' == $type && empty($value)) { 147 150 $result['valid'] = false; 148 151 $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'); 149 158 } 150 159 … … 171 180 } 172 181 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 } 173 190 174 191 private static function animate_dropdown() { … … 197 214 echo $html; 198 215 } 216 217 private static function is_valid_date($value) { 218 return strtotime($value) ? true : false; 219 } 199 220 } -
contact-form-7-datepicker/trunk/datepicker.php
r636357 r645880 10 10 'firstDay' => '', 11 11 'defaultDate' => '', 12 'showAnim' => ' show',12 'showAnim' => '', 13 13 'changeMonth' => '', 14 14 'changeYear' => '', 15 15 'yearRange' => '', 16 'numberOfMonths' => 1,16 'numberOfMonths' => '', 17 17 'showButtonPanel' => '', 18 18 ); -
contact-form-7-datepicker/trunk/readme.txt
r636357 r645880 4 4 Requires at least: 2.9 5 5 Tested up to: 3.5 6 Stable tag: 2. 16 Stable tag: 2.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 34 34 35 35 == Changelog == 36 37 = 2.2 = 38 * Added basic date validation 39 * Fixed watermark 36 40 37 41 = 2.1 =
Note: See TracChangeset
for help on using the changeset viewer.