Contact Form 7 Datepicker - Version 0.7.2

Version Description

  • Bugfix:
    • fixed field value not showing up in email message when field values contain hyphens and other non-alphanumeric chars
Download this release

Release Info

Developer shockware
Plugin Icon wp plugin Contact Form 7 Datepicker
Version 0.7.2
Comparing to
See all releases

Code changes from version 0.7.1 to 0.7.2

Files changed (2) hide show
  1. contact-form-7-datepicker.php +22 -9
  2. readme.txt +7 -2
contact-form-7-datepicker.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7 Datepicker
4
  Plugin URI: https://github.com/relu/contact-form-7-datepicker/
5
  Description: Implements a new [date] tag in Contact Form 7 that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date. Now you can use the [datepicker] shortcode outside of CF7.
6
  Author: Aurel Canciu
7
- Version: 0.7.1
8
  Author URI: https://github.com/relu/
9
  */
10
  ?>
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
  ?>
29
  <?php
30
 
31
- define('CF7_DATE_PICKER_VERSION', '0.7.1');
32
  define('PLUGIN_PATH', '/wp-content/plugins/'.plugin_basename(dirname(__FILE__)));
33
 
34
  if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
@@ -37,6 +37,11 @@ if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
37
 
38
  class CF7DatePicker {
39
 
 
 
 
 
 
40
  static $option_defaults = array(
41
  "useMode" => 2,
42
  "isStripped" => "false",
@@ -52,7 +57,12 @@ class CF7DatePicker {
52
  "selectedDate" => ""
53
  );
54
 
55
- function init() {
 
 
 
 
 
56
  register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
57
  register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
58
 
@@ -542,13 +552,13 @@ You can of course put whatever divider you want between them.<br /></p>',
542
  }
543
 
544
  if (is_array($data) && isset($data['atts']['id'])) {
545
- $data['atts']['id'] = preg_replace('/[^A-Za-z0-9]/', '', $data['atts']['id']);
546
  $id = $data['atts']['id'];
547
  } else {
548
- $name = preg_replace('/[^A-Za-z0-9]/', '', $name);
549
  $id = $name;
550
  }
551
 
 
 
552
  if (is_array($data) && !empty($data['value']) && is_numeric(strtotime($data['value']))) {
553
  $seldate = date('Y-m-d', strtotime($data['value']));
554
 
@@ -571,12 +581,14 @@ You can of course put whatever divider you want between them.<br /></p>',
571
 
572
  $attributes = '';
573
 
574
- if (is_array($data) && !empty($data['atts']['id'])) {
575
  foreach ($data['atts'] as $key => $val) {
576
  if (!empty($val))
577
  $attributes .= $key.'="'.$val.'" ';
578
  }
579
- } else {
 
 
580
  $attributes .= 'id="'.$id.'" ';
581
  }
582
 
@@ -596,7 +608,7 @@ You can of course put whatever divider you want between them.<br /></p>',
596
  $string .= '
597
  <script type="text/javascript">
598
  jQuery(document).ready(function() {
599
- DatePicker_'.$id.' = new JsDatePick({
600
  useMode:'.get_option('useMode').',
601
  isStripped:'.get_option('isStripped').',
602
  target:"'.$id.'",
@@ -647,6 +659,7 @@ You can of course put whatever divider you want between them.<br /></p>',
647
 
648
  $type = $tag['type'];
649
  $name = $tag['name'];
 
650
  $options = (array) $tag['options'];
651
  $values = (array) $tag['values'];
652
 
@@ -902,6 +915,6 @@ You can of course put whatever divider you want between them.<br /></p>',
902
 
903
  }
904
 
905
- CF7DatePicker::init();
906
 
907
  ?>
4
  Plugin URI: https://github.com/relu/contact-form-7-datepicker/
5
  Description: Implements a new [date] tag in Contact Form 7 that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date. Now you can use the [datepicker] shortcode outside of CF7.
6
  Author: Aurel Canciu
7
+ Version: 0.7.2
8
  Author URI: https://github.com/relu/
9
  */
10
  ?>
28
  ?>
29
  <?php
30
 
31
+ define('CF7_DATE_PICKER_VERSION', '0.7.2');
32
  define('PLUGIN_PATH', '/wp-content/plugins/'.plugin_basename(dirname(__FILE__)));
33
 
34
  if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
37
 
38
  class CF7DatePicker {
39
 
40
+ /**
41
+ * static Array $option_defaults
42
+ *
43
+ * Holds the default option values for the plugin
44
+ */
45
  static $option_defaults = array(
46
  "useMode" => 2,
47
  "isStripped" => "false",
57
  "selectedDate" => ""
58
  );
59
 
60
+ /**
61
+ * __construct()
62
+ *
63
+ * This is the class constructor method, it registers actions and initializes the plugin
64
+ */
65
+ function __construct() {
66
  register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
67
  register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
68
 
552
  }
553
 
554
  if (is_array($data) && isset($data['atts']['id'])) {
 
555
  $id = $data['atts']['id'];
556
  } else {
 
557
  $id = $name;
558
  }
559
 
560
+ $jssafeid = preg_replace('/[^A-Za-z0-9]/', '', $id);
561
+
562
  if (is_array($data) && !empty($data['value']) && is_numeric(strtotime($data['value']))) {
563
  $seldate = date('Y-m-d', strtotime($data['value']));
564
 
581
 
582
  $attributes = '';
583
 
584
+ if (is_array($data['atts'])) {
585
  foreach ($data['atts'] as $key => $val) {
586
  if (!empty($val))
587
  $attributes .= $key.'="'.$val.'" ';
588
  }
589
+ }
590
+
591
+ if (!is_array($data) || (is_array($data['atts']) && empty($data['atts']['id']))) {
592
  $attributes .= 'id="'.$id.'" ';
593
  }
594
 
608
  $string .= '
609
  <script type="text/javascript">
610
  jQuery(document).ready(function() {
611
+ DatePicker_'.$jssafeid.' = new JsDatePick({
612
  useMode:'.get_option('useMode').',
613
  isStripped:'.get_option('isStripped').',
614
  target:"'.$id.'",
659
 
660
  $type = $tag['type'];
661
  $name = $tag['name'];
662
+
663
  $options = (array) $tag['options'];
664
  $values = (array) $tag['values'];
665
 
915
 
916
  }
917
 
918
+ new CF7DatePicker;
919
 
920
  ?>
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link:
4
  Tags: wordpress, datepicker, calendar, contact form 7, forms
5
  Requires at least: WordPress 2.9
6
  Tested up to: WordPress 3.2.1
7
- Stable tag: 0.7.1
8
 
9
  Datepicker for Contact Form 7 Wordpress Plugin based on jsDatePick script.
10
 
@@ -59,8 +59,13 @@ You can contact me anywhere and I'll add them to the project :)
59
 
60
  == Changelog ==
61
 
 
 
 
 
62
  = 0.7.1 =
63
- * Bugfix: fixed calendar not popping out when no id attribute specified in CF7 shortcode
 
64
 
65
  = 0.7 =
66
  * New:
4
  Tags: wordpress, datepicker, calendar, contact form 7, forms
5
  Requires at least: WordPress 2.9
6
  Tested up to: WordPress 3.2.1
7
+ Stable tag: 0.7.2
8
 
9
  Datepicker for Contact Form 7 Wordpress Plugin based on jsDatePick script.
10
 
59
 
60
  == Changelog ==
61
 
62
+ = 0.7.2 =
63
+ * Bugfix:
64
+ - fixed field value not showing up in email message when field values contain hyphens and other non-alphanumeric chars
65
+
66
  = 0.7.1 =
67
+ * Bugfix:
68
+ - fixed calendar not popping out when no id attribute specified in CF7 shortcode
69
 
70
  = 0.7 =
71
  * New: