Contact Form 7 Datepicker - Version 2.0

Version Description

  • Complete rewrite, using jquery-ui's datepicker
Download this release

Release Info

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

Code changes from version 0.7.4 to 2.0

Files changed (88) hide show
  1. .gitignore +0 -1
  2. admin.php +182 -0
  3. contact-form-7-datepicker.php +48 -887
  4. css/jsDatePick_ltr.css +0 -68
  5. css/jsDatePick_ltr.min.css +0 -1
  6. css/jsDatePick_rtl.css +0 -68
  7. css/jsDatePick_rtl.min.css +0 -1
  8. css/schemes/red.css +0 -12
  9. date-module.php +185 -0
  10. date-tag-generator.php +156 -0
  11. datepicker.php +159 -0
  12. img/aqua/aqua_dayDown.gif +0 -0
  13. img/aqua/aqua_dayNormal.gif +0 -0
  14. img/aqua/aqua_dayOver.gif +0 -0
  15. img/armygreen/armygreen_dayDown.gif +0 -0
  16. img/armygreen/armygreen_dayNormal.gif +0 -0
  17. img/armygreen/armygreen_dayOver.gif +0 -0
  18. img/bananasplit/bananasplit_dayDown.gif +0 -0
  19. img/bananasplit/bananasplit_dayNormal.gif +0 -0
  20. img/bananasplit/bananasplit_dayOver.gif +0 -0
  21. img/beige/beige_dayDown.gif +0 -0
  22. img/beige/beige_dayNormal.gif +0 -0
  23. img/beige/beige_dayOver.gif +0 -0
  24. img/boxBottomLeftCorner.png +0 -0
  25. img/boxBottomRightCorner.png +0 -0
  26. img/boxSideWallPx.gif +0 -0
  27. img/boxSideWallPx.png +0 -0
  28. img/boxTopLeftCorner.png +0 -0
  29. img/boxTopPx.gif +0 -0
  30. img/boxTopPx.png +0 -0
  31. img/boxTopRightCorner.png +0 -0
  32. img/closeButton_down.gif +0 -0
  33. img/closeButton_normal.gif +0 -0
  34. img/closeButton_over.gif +0 -0
  35. img/deepblue/deepblue_dayDown.gif +0 -0
  36. img/deepblue/deepblue_dayNormal.gif +0 -0
  37. img/deepblue/deepblue_dayOver.gif +0 -0
  38. img/greenish/greenish_dayDown.gif +0 -0
  39. img/greenish/greenish_dayNormal.gif +0 -0
  40. img/greenish/greenish_dayOver.gif +0 -0
  41. img/lightgreen/lightgreen_dayDown.gif +0 -0
  42. img/lightgreen/lightgreen_dayNormal.gif +0 -0
  43. img/lightgreen/lightgreen_dayOver.gif +0 -0
  44. img/monthBackward_down.gif +0 -0
  45. img/monthBackward_normal.gif +0 -0
  46. img/monthBackward_over.gif +0 -0
  47. img/monthForward_down.gif +0 -0
  48. img/monthForward_normal.gif +0 -0
  49. img/monthForward_over.gif +0 -0
  50. img/oceanblue/oceanblue_dayDown.gif +0 -0
  51. img/oceanblue/oceanblue_dayNormal.gif +0 -0
  52. img/oceanblue/oceanblue_dayOver.gif +0 -0
  53. img/orange/orange_dayDown.gif +0 -0
  54. img/orange/orange_dayNormal.gif +0 -0
  55. img/orange/orange_dayOver.gif +0 -0
  56. img/peppermint/peppermint_dayDown.gif +0 -0
  57. img/peppermint/peppermint_dayNormal.gif +0 -0
  58. img/peppermint/peppermint_dayOver.gif +0 -0
  59. img/pink/pink_dayDown.gif +0 -0
  60. img/pink/pink_dayNormal.gif +0 -0
  61. img/pink/pink_dayOver.gif +0 -0
  62. img/purple/purple_dayDown.gif +0 -0
  63. img/purple/purple_dayNormal.gif +0 -0
  64. img/purple/purple_dayOver.gif +0 -0
  65. img/red/red_dayDown.gif +0 -0
  66. img/red/red_dayNormal.gif +0 -0
  67. img/red/red_dayOver.gif +0 -0
  68. img/torqoise/torqoise_dayDown.gif +0 -0
  69. img/torqoise/torqoise_dayNormal.gif +0 -0
  70. img/torqoise/torqoise_dayOver.gif +0 -0
  71. img/yearBackward_down.gif +0 -0
  72. img/yearBackward_normal.gif +0 -0
  73. img/yearBackward_over.gif +0 -0
  74. img/yearForward_down.gif +0 -0
  75. img/yearForward_normal.gif +0 -0
  76. img/yearForward_over.gif +0 -0
  77. js/jsDatePick.jquery.full.js +0 -1288
  78. js/jsDatePick.jquery.min.js +0 -1
  79. languages/contact-form-7-datepicker-it_IT.mo +0 -0
  80. languages/contact-form-7-datepicker-it_IT.po +0 -314
  81. languages/contact-form-7-datepicker-nl_NL.mo +0 -0
  82. languages/contact-form-7-datepicker-ro_RO.mo +0 -0
  83. languages/contact-form-7-datepicker-ro_RO.po +0 -323
  84. languages/contact-form-7-datepicker.pot +0 -304
  85. readme.txt +18 -35
  86. screenshot-1.png +0 -0
  87. screenshot-2.png +0 -0
  88. screenshot-3.png +0 -0
.gitignore DELETED
@@ -1 +0,0 @@
1
- geany_run_script.sh
admin.php ADDED
@@ -0,0 +1,182 @@
1
+ <?php
2
+
3
+ class ContactForm7Datepicker_Admin {
4
+
5
+ public static function init() {
6
+ add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_assets'));
7
+ add_action('wpcf7_admin_after_general_settings', array(__CLASS__, 'add_meta_box'));
8
+ add_action('admin_footer', array(__CLASS__, 'theme_js'));
9
+ add_action('wp_ajax_cf7dp_save_settings', array(__CLASS__, 'ajax_save_settings'));
10
+ }
11
+
12
+ public static function enqueue_assets() {
13
+ if (is_admin() && ! self::is_wpcf7_page())
14
+ return;
15
+
16
+ ContactForm7Datepicker::enqueue_js();
17
+ ContactForm7Datepicker::enqueue_css();
18
+ }
19
+
20
+ public static function add_meta_box() {
21
+ if (! current_user_can('publish_pages'))
22
+ return;
23
+
24
+ add_meta_box(
25
+ 'datepickerthemediv',
26
+ __('Datepicker Theme'),
27
+ array(__CLASS__, 'theme_metabox'),
28
+ 'cfseven',
29
+ 'datepicker-theme',
30
+ 'core'
31
+ );
32
+
33
+ do_meta_boxes('cfseven', 'datepicker-theme', array());
34
+ }
35
+
36
+ public static function theme_metabox() {
37
+ ?>
38
+
39
+ <div id="preview" style="float: left; margin: 0 10px 0 0"></div>
40
+ <form action="">
41
+ <label for="jquery-ui-theme"><?php _e('Theme'); ?></label><br />
42
+ <?php self::themes_dropdown(); ?>
43
+ <input type="submit" id="save-ui-theme" value="<?php _e('Save'); ?>" class="button" />
44
+ </form>
45
+ <div class="clear"></div>
46
+
47
+ <?php
48
+ $dp = new CF7_DatePicker('#preview');
49
+ echo $dp->generate_code(true);
50
+ }
51
+
52
+ public static function theme_js() {
53
+ if (! self::is_wpcf7_page())
54
+ return;
55
+ ?>
56
+ <script type="text/javascript">
57
+ jQuery(function($){
58
+ var $spinner = $(new Image()).attr('src', '<?php echo admin_url('images/wpspin_light.gif'); ?>');
59
+ var old_href = '';
60
+
61
+ $('#jquery-ui-theme').change(function(){
62
+ var style = $(this).val();
63
+
64
+ var $link = $('#jquery-ui-theme-css');
65
+ var href = $link.attr('href');
66
+
67
+ if (style == 'disabled') {
68
+ old_href = href;
69
+ $link.attr('href', '');
70
+
71
+ return;
72
+ } else if (href === '') {
73
+ href = old_href;
74
+ }
75
+
76
+ href = href.replace(/\/themes\/[-a-z]+\//g, '/themes/' + style + '/');
77
+ $link.attr('href', href);
78
+ });
79
+
80
+ $('#save-ui-theme').click(function(){
81
+ var data = {
82
+ action: 'cf7dp_save_settings',
83
+ ui_theme: $('#jquery-ui-theme').val()
84
+ };
85
+
86
+ var $this_spinner = $spinner.clone();
87
+
88
+ $(this).after($this_spinner.show());
89
+
90
+ $.post(ajaxurl, data, function(response) {
91
+ var $prev = $( '.wrap > .updated, .wrap > .error' );
92
+ var $msg = $(response).hide().insertAfter($('.wrap h2'));
93
+ if ($prev.length > 0)
94
+ $prev.fadeOut('slow', function(){
95
+ $msg.fadeIn('slow');
96
+ });
97
+ else
98
+ $msg.fadeIn('slow');
99
+
100
+ $this_spinner.hide();
101
+ });
102
+
103
+ return false;
104
+ });
105
+ });
106
+ </script>
107
+ <?php
108
+ }
109
+
110
+ public static function ajax_save_settings() {
111
+ $successmsg = '<div id="message" class="updated fade"><p><strong>' . __('Options saved.') . '</strong></p></div>';
112
+ $errormsg = '<div id="message" class="error fade"><p><strong>' . __('Options could not be saved.') . '</strong></p></div>';
113
+
114
+ if (! isset($_POST['ui_theme']))
115
+ die($errormsg);
116
+
117
+ if (! is_admin())
118
+ die($errormsg);
119
+
120
+ $theme = trim($_POST['ui_theme']);
121
+
122
+ if (! preg_match('%[-a-z]+%i', $theme))
123
+ die($errormsg);
124
+
125
+ if (! update_option('cf7dp_ui_theme', $theme))
126
+ die($errormsg);
127
+
128
+ die($successmsg);
129
+ }
130
+
131
+ private static function themes_dropdown() {
132
+ $themes = array(
133
+ 'disabled' => __('Disabled'),
134
+ 'base' => 'Base',
135
+ 'black-tie' => 'Black Tie',
136
+ 'blitzer' => 'Blitzer',
137
+ 'cupertino' => 'Cupertino',
138
+ 'dark-hive' => 'Dark Hive',
139
+ 'dot-luv' => 'Dot Luv',
140
+ 'eggplant' => 'Eggplant',
141
+ 'excite-bike' => 'Excite Bike',
142
+ 'flick' => 'Flick',
143
+ 'hot-sneaks' => 'Hot Sneaks',
144
+ 'humanity' => 'Humanity',
145
+ 'le-frog' => 'Le frog',
146
+ 'mint-choc' => 'Mint Choc',
147
+ 'overcast' => 'Overcast',
148
+ 'pepper-grinder' => 'Pepper Grinder',
149
+ 'redmond' => 'Redmond',
150
+ 'smoothness' => 'Smoothness',
151
+ 'south-street' => 'South Street',
152
+ 'start' => 'Start',
153
+ 'sunny' => 'Sunny',
154
+ 'swanky-purse' => 'Swanky Purse',
155
+ 'trontastic' => 'Trontastic',
156
+ 'ui-darkness' => 'UI Darkness',
157
+ 'ui-lightness' => 'UI Lightness',
158
+ 'vader' => 'Vader'
159
+ );
160
+
161
+ $themes = apply_filters('cf7dp_ui_themes', $themes);
162
+
163
+ $html = "<select id=\"jquery-ui-theme\">\n";
164
+ foreach ($themes as $key => $val) {
165
+ $is_selected = ($key == get_option('cf7dp_ui_theme')) ? ' selected="selected"' : '';
166
+ $html .= "\t<option value=\"{$key}\"{$is_selected}>{$val}</option>\n";
167
+ }
168
+
169
+ $html .= "</select>\n";
170
+
171
+ echo $html;
172
+ }
173
+
174
+ private static function is_wpcf7_page() {
175
+ global $current_screen;
176
+
177
+ if (is_object($current_screen) && 'toplevel_page_wpcf7' == $current_screen->id)
178
+ return true;
179
+
180
+ return false;
181
+ }
182
+ }
contact-form-7-datepicker.php CHANGED
@@ -1,921 +1,82 @@
1
<?php
2
- /*
3
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.4
8
Author URI: https://github.com/relu/
9
*/
10
- ?>
11
- <?php
12
- /* Copyright 2011 Aurel Canciu <aurelcanciu at gmail.com>
13
-
14
- This program is free software; you can redistribute it and/or modify
15
- it under the terms of the GNU General Public License as published by
16
- the Free Software Foundation; either version 2 of the License, or
17
- (at your option) any later version.
18
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
*/
28
?>
29
<?php
30
31
- define('CF7_DATE_PICKER_VERSION', '0.7.4');
32
- define('PLUGIN_PATH', '/wp-content/plugins/'.plugin_basename(dirname(__FILE__)));
33
34
- if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
35
- define('CF7_DATE_PICKER_ENQUEUES', true);
36
- }
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",
48
- "limitToToday" => 0,
49
- "cellColorScheme" => "beige",
50
- "dateFormat" => "%d-%m-%Y",
51
- "weekStartDay" => 1,
52
- "directionality" => "ltr",
53
- "yearsRange" => "1970,2100",
54
- "yearButtons" => "true",
55
- "monthButtons" => "true",
56
- "animate" => "true",
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
-
69
- add_action('plugins_loaded', array(__CLASS__, 'register_shortcodes'));
70
- add_action('admin_init', array(__CLASS__, 'tag_generator'));
71
- add_action('admin_menu', array(__CLASS__, 'register_admin_settings'));
72
- add_action('init', array(__CLASS__, 'register_files'));
73
- if (CF7_DATE_PICKER_ENQUEUES) {
74
- add_action('wp_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
75
- }
76
- add_action('admin_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
77
-
78
- add_action('init', array(__CLASS__, 'calendar_l10n'));
79
80
-
81
- add_filter('wpcf7_validate_date', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
82
- add_filter('wpcf7_validate_date*', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
83
-
84
- add_action('init', array(__CLASS__, 'admin_l10n'));
85
- }
86
-
87
- /**
88
- * activate()
89
- *
90
- * Action triggered when plugin is activated
91
- * It inserts some default values as options
92
- */
93
- public static function activate() {
94
- foreach (self::$option_defaults as $option => $value) {
95
- add_option($option, $value);
96
}
97
}
98
99
- /**
100
- * deactivate()
101
- *
102
- * Action triggered when plugin is deactivated
103
- * It deletes the settings stored in the database
104
- */
105
- public static function deactivate() {
106
- foreach (self::$option_defaults as $option => $value) {
107
- delete_option($option);
108
- }
109
- }
110
-
111
- /**
112
- * update_settings($dataupdate)
113
- *
114
- * Updates plugin's settings into the database
115
- * @param Array $dateupdate, contains the updated settings
116
- */
117
- public static function update_settings($dataupdate) {
118
- foreach ($dataupdate as $option => $value) {
119
- if ($value != get_option($option))
120
- update_option($option, $value);
121
- }
122
- }
123
-
124
- /**
125
- * register_admin_settings()
126
- *
127
- * Registers the Admin panel so that it will show up as a submenu page in Contact Form 7's menu
128
- */
129
- public static function register_admin_settings() {
130
- if (function_exists('add_submenu_page')) {
131
- add_submenu_page('wpcf7',__('Datepicker Settings', 'contact-form-7-datepicker'),__('Datepicker Settings', 'contact-form-7-datepicker'),
132
- 'edit_themes',
133
- basename(__FILE__),
134
- array(__CLASS__,'admin_settings_html'));
135
- }
136
- }
137
-
138
- /**
139
- * read_schemes()
140
- *
141
- * Gets the names of the schemes available from the img/ directory
142
- * @return Array $themes, the names of the schemes found
143
- */
144
- private function read_schemes() {
145
- $path = ABSPATH.PLUGIN_PATH.'/img/';
146
- if ($handle = opendir($path)) {
147
- $themes = array() ;
148
- while (false !== ($file = readdir($handle))) {
149
- if (is_dir($path.$file) && $file != "." && $file != "..") {
150
- $themes[] = $file;
151
- }
152
- }
153
- }
154
- closedir($handle);
155
- return $themes;
156
- }
157
-
158
- /**
159
- * get_scheme_images($scheme)
160
- *
161
- * Gets the images of a scheme and natural sorts them
162
- * @param String $scheme, the name of the scheme to get images for
163
- * @return Array $schemeimg, the paths to the scheme images
164
- */
165
- private function get_scheme_images($scheme) {
166
- $path = ABSPATH.PLUGIN_PATH.'/img/'.$scheme.'/';
167
- if ($handle = opendir($path)) {
168
- $schemeimg = array();
169
- while (false !== ($file = readdir($handle))) {
170
- if (is_file($path.$file) && preg_match('/\.gif#x2F;i', $file))
171
- $schemeimg[] = get_option('siteurl').PLUGIN_PATH.'/img/'.$scheme.'/'.$file;
172
- }
173
- natsort($schemeimg);
174
- }
175
- closedir($handle);
176
- return $schemeimg;
177
- }
178
-
179
- /**
180
- * get_scheme_style($scheme)
181
- *
182
- * Checks if a CSS file exists in the scheme's directory and returns the path if so
183
- * @param String $scheme, the name of the scheme to get the CSS for
184
- * @return String the path to the CSS file
185
- * @return Boolean false if no file found
186
- */
187
- private function get_scheme_style($scheme) {
188
- $file = PLUGIN_PATH.'/css/schemes/'.$scheme.'.css';
189
- if (is_file(ABSPATH.$file)) {
190
- return get_option('siteurl').$file;
191
- }
192
- return false;
193
- }
194
-
195
- /**
196
- * admin_settings_html()
197
- *
198
- * Generates the admin panel HTML
199
- */
200
- public static function admin_settings_html() {
201
- if(isset($_POST['datepickersave'])) {
202
- foreach(self::$option_defaults as $option => $value)
203
- $dataupdate[$option] = $_POST[$option];
204
- $dataupdate['yearsRange'] = trim($_POST['yearmin']).",".trim($_POST['yearmax']);
205
-
206
- $dataupdate['yearButtons'] = (isset($_POST['yearButtons'])) ? "true" : "false";
207
- $dataupdate['monthButtons'] = (isset($_POST['monthButtons'])) ? "true" : "false";
208
-
209
- if ($_POST['selectedDate'] !== '') {
210
- if (get_option('dateFormat') !== $dataupdate['dateFormat']) {
211
- $df = $dataupdate['dateFormat'];
212
- } else {
213
- $df = get_option('dateFormat');
214
- }
215
- $df = str_replace('%', '', trim($df));
216
-
217
- $dataupdate['selectedDate'] = date($df, strtotime($_POST['selectedDate']));
218
- $dataupdate['selectedDate'] = date("Y-m-d", strtotime($dataupdate['selectedDate']));
219
- }
220
-
221
- self::update_settings($dataupdate);
222
- }
223
- $useMode = array(1,2);
224
- $limitToToday = array(
225
- __('Today and future', 'contact-form-7-datepicker'),
226
- __('Today and past', 'contact-form-7-datepicker'),
227
- __('No limit', 'contact-form-7-datepicker')
228
- );
229
- $isStripped = $animate = array(
230
- __('true', 'contact-form-7-datepicker'),
231
- __('false', 'contact-form-7-datepicker')
232
- );
233
- $cellColorScheme = self::read_schemes();
234
- $weekStartDay = array(
235
- __('Sunday', 'contact-form-7-datepicker'),
236
- __('Monday', 'contact-form-7-datepicker')
237
- );
238
- $directionality = array(
239
- __('Left to right', 'contact-form-7-datepicker'),
240
- __('Right to left', 'contact-form-7-datepicker')
241
- );
242
- $yearsRange = explode(",", trim(get_option('yearsRange')));
243
-
244
- ?>
245
- <div class="wrap">
246
- <h2>Contact Form 7 Datepicker</h2><?php
247
- echo __('<p>This plugin implements a new <strong>[date]</strong> tag in <a href="http://wordpress.org/extend/plugins/contact-form-7/">Contact Form 7</a>
248
- 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.<br />
249
- To use it simply insert the <strong>[date your-field-name]</strong> or <strong>[date* your-requierd-field-name]</strong> if you want it to be mandatory,
250
- in your Contact Form 7 edit section.</p>', 'contact-form-7-datepicker'); ?>
251
- <form method="post">
252
- <table class="widefat">
253
- <tbody>
254
- <tr>
255
- <th style="width:20%">
256
- <label><?php echo __('Color scheme', 'contact-form-7-datepicker'); ?></label>
257
- </th>
258
- <td colspan="2"><?php
259
- foreach($cellColorScheme as $scheme) {
260
- if($scheme == get_option('cellColorScheme'))
261
- $checked = "checked=\"checked\"";
262
- else
263
- $checked = ""; ?>
264
-
265
- <div style="float: left; width: 100px; margin: 30px 30px 0 0; text-align: center;">
266
- <div style="display: block; padding: 5px; background: #fff; border: 1px solid #ccc; border-radius: 4px 4px 4px 4px;">
267
- <label><?php echo $scheme; ?></label><br /><?php
268
- foreach(self::get_scheme_images($scheme) as $img) { ?>
269
- <img src="<?php echo $img; ?>" style="margin: 5px;" /><?php
270
- } ?><br /><br />
271
- <input name="cellColorScheme" type="radio" width="24" height="25" value="<?php echo $scheme; ?>" <?php echo $checked; ?> />
272
- </div>
273
- </div><?php
274
- } ?>
275
- </td>
276
- </tr>
277
-
278
- <tr>
279
- <th>
280
- <label><?php echo __('Use Mode', 'contact-form-7-datepicker'); ?></label>
281
- </th>
282
- <td>
283
- <select name="useMode"><?php
284
- foreach($useMode as $row) {
285
- if($row == get_option('useMode'))
286
- $selected = "selected";
287
- else
288
- $selected = "";
289
-
290
- echo "<option value='".$row."' ".$selected." >".$row."</option>";
291
- } ?>
292
- </select>
293
- </td>
294
- <td>
295
- <?php echo __('<p>1 – The calendar\'s HTML will be directly appended to the field supplied by target<br />
296
- 2 – The calendar will appear as a popup when the field with the id supplied in target is clicked.</p>', 'contact-form-7-datepicker'); ?>
297
- </td>
298
- </tr>
299
-
300
- <tr>
301
- <th>
302
- <label><?php echo __('Sripped', 'contact-form-7-datepicker'); ?></label>
303
- </th>
304
- <td>
305
- <select name="isStripped"><?php
306
- foreach($isStripped as $row) {
307
- if($row == __('true', 'contact-form-7-datepicker'))
308
- $val = "true";
309
- else
310
- $val = "false";
311
-
312
- if ($val == get_option('isStripped'))
313
- $selected = "selected";
314
- else
315
- $selected = "";
316
-
317
- echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
318
- } ?>
319
- </select>
320
- </td>
321
- <td>
322
- <?php echo __('<p>When set to true the calendar appears without the visual design - usually used with \'Use Mod\' 1.</p>','contact-form-7-datepicker'); ?>
323
- </td>
324
- </tr>
325
-
326
- <tr>
327
- <th>
328
- <label><?php echo __('Limit Dates To', 'contact-form-7-datepicker'); ?></label>
329
- </th>
330
- <td>
331
- <select name="limitToToday"><?php
332
- foreach($limitToToday as $row) {
333
- if ($row == __('Today and future', 'contact-form-7-datepicker'))
334
- $val = 1;
335
- elseif ($row == __('Today and past', 'contact-form-7-datepicker'))
336
- $val = -1;
337
- else
338
- $val = 0;
339
-
340
- if ($val == get_option('limitToToday'))
341
- $selected = "selected";
342
- else
343
- $selected = "";
344
-
345
- echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
346
- } ?>
347
- </select>
348
- </td>
349
- <td>
350
- <?php echo __('<p>Enables you to limit the possible picking dates according to the current date.</p>','contact-form-7-datepicker'); ?>
351
- </td>
352
- </tr>
353
-
354
- <tr>
355
- <th>
356
- <label><?php echo __('Week Start Day', 'contact-form-7-datepicker'); ?></h2></label>
357
- </th>
358
- <td>
359
- <select name="weekStartDay"><?php
360
- foreach($weekStartDay as $row) {
361
- if ($row == __('Sunday','contact-form-7-datepicker'))
362
- $val = 0;
363
- else
364
- $val = 1;
365
-
366
- if($val == get_option('weekStartDay'))
367
- $selected = "selected";
368
- else
369
- $selected = "";
370
-
371
- echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
372
- } ?>
373
- </select>
374
- </td>
375
- <td>
376
- </td>
377
- </tr>
378
-
379
- <tr>
380
- <th>
381
- <label><?php echo __('Years Range', 'contact-form-7-datepicker'); ?></h2></label>
382
- </th>
383
- <td colspan="2">
384
- <input name="yearmin" id="yearmin" type="text" value="<?php echo $yearsRange[0]; ?>" />&nbsp;-&nbsp;
385
- <input name="yearmax" id="yearmax" type="text" value="<?php echo $yearsRange[1]; ?>" />
386
- </td>
387
- </tr>
388
-
389
- <tr>
390
- <th>
391
- <label><?php echo __('Text Direction', 'contact-form-7-datepicker'); ?></h2></label>
392
- </th>
393
- <td>
394
- <select name="directionality"><?php
395
- foreach($directionality as $row) {
396
- if ($row == __('Left to right','contact-form-7-datepicker'))
397
- $val = "ltr";
398
- else
399
- $val = "rtl";
400
-
401
- if($val == get_option('directionality'))
402
- $selected = "selected";
403
- else
404
- $selected = "";
405
-
406
- echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
407
- } ?>
408
- </select>
409
- </td>
410
- <td>
411
- </td>
412
- </tr>
413
-
414
- <tr>
415
- <th>
416
- <label><?php echo __('Controls', 'contact-form-7-datepicker'); ?></h2></label>
417
- </th>
418
- <td><?php
419
-
420
- if (get_option('yearButtons') == "true")
421
- $checked = "checked=\"checked\"";
422
- else
423
- $checked = "";
424
- echo "<input type=\"checkbox\" name=\"yearButtons\" ".$checked.">"; ?>
425
- <label><?php echo __('Year Controls','contact-form-7-datepicker'); ?>&nbsp;</label>
426
- <br /><?php
427
-
428
- if (get_option('monthButtons') == "true")
429
- $checked = "checked=\"checked\"";
430
- else
431
- $checked = "";
432
- echo "<input type=\"checkbox\" name=\"monthButtons\" ".$checked." >"; ?>
433
- <label><?php echo __('Month Controls','contact-form-7-datepicker'); ?>&nbsp;</label>
434
- </td>
435
- <td>
436
- <?php echo __('<p>You can select here what controls would you like to display on the calendar.</p>', 'contact-form-7-datepicker'); ?>
437
- </td>
438
- </tr>
439
-
440
- <tr>
441
- <th>
442
- <label><?php echo __('Selected Date', 'contact-form-7-datepicker'); ?></label>
443
- </th>
444
- <td style="overflow: visible">
445
- <?php
446
- echo self::page_text_filter_callback("selectedDate");
447
- ?>
448
- </td>
449
- <td>
450
- <?php echo __('<p>You can set here a default selected date and have a look of how the calendar shows up.</p>', 'contact-form-7-datepicker'); ?>
451
- </td>
452
- </tr>
453
-
454
- <tr>
455
- <th>
456
- <label><?php echo __('Animate', 'contact-form-7-datepicker'); ?></label>
457
- </th>
458
- <td>
459
- <select name="animate"><?php
460
- foreach($animate as $row) {
461
- if($row == __('true', 'contact-form-7-datepicker'))
462
- $val = "true";
463
- else
464
- $val = "false";
465
-
466
- if ($val == get_option('animate'))
467
- $selected = "selected";
468
- else
469
- $selected = "";
470
-
471
- echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
472
- } ?>
473
- </select>
474
- </td>
475
- <td>
476
- <?php echo __('<p>Animation on display.</p>','contact-form-7-datepicker'); ?>
477
- </td>
478
- </tr>
479
-
480
- <tr>
481
- <th>
482
- <label><?php echo __('Date Format', 'contact-form-7-datepicker'); ?></label>
483
- </th>
484
- <td>
485
- <input name="dateFormat" id="dateFormat" type="text" value="<?php echo get_option('dateFormat'); ?>" />
486
- </td>
487
- <td>
488
- <?php echo __('<p>Possible values to use in the date format:<br />
489
- <br />
490
- %d - Day of the month, 2 digits with leading zeros<br />
491
- %j - Day of the month without leading zeros<br />
492
- %m - Numeric representation of a month, with leading zeros<br />
493
- %M - A short textual representation of a month, three letters<br />
494
- %n - Numeric representation of a month, without leading zeros<br />
495
- %F - A full textual representation of a month, such as January or March<br />
496
- %Y - A full numeric representation of a year, 4 digits<br />
497
- %y - A two digit representation of a year<br />
498
- <br />
499
- You can of course put whatever divider you want between them.<br /></p>',
500
- 'contact-form-7-datepicker'); ?>
501
- </td>
502
- </tr>
503
-
504
- <tr>
505
- <td colspan="2">
506
- </td>
507
- <td>
508
- <input name="datepickersave" id="datepickersave" type="submit" value="<?php echo __('Save Setting', 'contact-form-7-datepicker'); ?>" class="button" />
509
- </td>
510
- </tr>
511
- </tbody>
512
- </table>
513
- </form><?php
514
- }
515
-
516
- /**
517
- * register_files()
518
- *
519
- * Registers needed files
520
- */
521
- public static function register_files() {
522
- wp_register_style('jsdp_ltr', plugins_url( '/css/jsDatePick_ltr.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
523
- wp_register_style('jsdp_rtl', plugins_url( '/css/jsDatePick_rtl.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
524
-
525
- wp_register_script('jsDatePickJS', plugins_url( '/js/jsDatePick.jquery.min.js', __FILE__ ), array('jquery'), CF7_DATE_PICKER_VERSION, true);
526
- }
527
-
528
- /**
529
- * plugin_enqueues()
530
- *
531
- * Enqueues JS/CSS
532
- */
533
- public static function plugin_enqueues() {
534
- wp_enqueue_style('jsdp_'.get_option('directionality'));
535
- wp_enqueue_script('jsDatePickJS');
536
-
537
- do_action('plugin_enqueues');
538
}
539
540
- /**
541
- * page_text_filter_callback($data)
542
- *
543
- * If a match is found in the content of a form, this returns the HTML for the matched date input field
544
- * @param Array $data, an array of attributes and options for the input date field that we generate code for
545
- * @return String $string, the HTML for our match
546
- */
547
- private function page_text_filter_callback($data) {
548
- if (!is_array($data)) {
549
- $name = $data;
550
- } else {
551
- $name = $data['name'];
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
-
565
- } else {
566
- $seldate = get_option('selectedDate');
567
- }
568
-
569
- if ($seldate) {
570
- $ts = strtotime($seldate);
571
- $seldate = array(
572
- 'd' => date('d', $ts),
573
- 'm' => date('m', $ts),
574
- 'y' => date('Y', $ts)
575
- );
576
-
577
- $dateval = $seldate['y'].'-'.$seldate['m'].'-'.$seldate['d'];
578
- } else {
579
- $dateval = '';
580
- }
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
-
595
- if (!empty($dateval)) {
596
- $df = str_replace('%', '', get_option('dateFormat'));
597
- $dateval = date($df, strtotime($dateval));
598
- $attributes .= 'value="'.$dateval.'"';
599
- }
600
-
601
- $attributes = trim($attributes);
602
-
603
- $string = '';
604
-
605
- if ( (is_array($data) && $data['opts']['newfield'] === 'true') || !is_array($data) || (is_array($data) && empty($data['opts']['newfield'])))
606
- $string = '<input type="text" name="'.$name.'" '.$attributes.' />';
607
-
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.'",
615
- limitToToday:"'.get_option('limitToToday').'",
616
- cellColorScheme:"'.get_option('cellColorScheme').'",
617
- dateFormat:"'.get_option('dateFormat').'",
618
- imgPath:"'.plugins_url('/img/'.get_option('cellColorScheme').'/', __FILE__).'",
619
- weekStartDay:'.get_option('weekStartDay').',
620
- yearsRange:['.get_option('yearsRange').'],
621
- directionality:"'.get_option('directionality').'",
622
- yearButtons:'.get_option('yearButtons').',
623
- monthButtons:'.get_option('monthButtons').',
624
- animate:'.get_option('animate');
625
- if ($seldate) {
626
- $string .= ',
627
- selectedDate: {
628
- year: '.$seldate['y'].',
629
- month: '.$seldate['m'].',
630
- day: '.$seldate['d'].'
631
- }';
632
- }
633
- $string .= '
634
- });
635
- });
636
- </script>';
637
- $schemecss = self::get_scheme_style(get_option('cellColorScheme'));
638
- if ($schemecss)
639
- $string .= '
640
- <style type="text/css">
641
- @import url(\''.$schemecss.'\');
642
- </style>';
643
-
644
- return $string;
645
- }
646
-
647
- /**
648
- * wpcf7_shotcode_handler($tag)
649
- *
650
- * Handler for wpcf7 shortcodes [date ] and [date* ]
651
- * @param Array $tag, this is the tag that will be handled (can be 'date' or 'date*')
652
- * @return String $html, the HTML that will be appended to the form
653
- */
654
- public static function wpcf7_shotcode_handler($tag) {
655
- global $wpcf7_contact_form;
656
-
657
- if ( ! is_array( $tag ) )
658
- return '';
659
-
660
- $type = $tag['type'];
661
- $name = $tag['name'];
662
-
663
- $options = (array) $tag['options'];
664
- $values = (array) $tag['values'];
665
-
666
- if ( empty( $name ) )
667
- return '';
668
-
669
- $atts = array();
670
-
671
- if ( 'date*' == $type )
672
- $atts['class'] = ' wpcf7-validates-as-required';
673
-
674
- foreach ( $options as $option ) {
675
- if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
676
- $atts['id'] = $matches[1];
677
-
678
- } elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
679
- $atts['class'] .= ' ' . $matches[1];
680
-
681
- } elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
682
- $atts['size'] = (int) $matches[1];
683
- $atts['maxlength'] = (int) $matches[2];
684
- }
685
- }
686
-
687
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) && $wpcf7_contact_form->is_posted() ) {
688
- if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
689
- $value = '';
690
- else
691
- $value = $_POST[$name];
692
- } else {
693
- $value = $values[0];
694
- }
695
-
696
- $data = array(
697
- "name" => $name,
698
- "atts" => (array) $atts,
699
- "opts" => NULL,
700
- "value" => $value
701
- );
702
-
703
- $html = self::page_text_filter_callback($data);
704
- $validation_error = '';
705
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
706
- $validation_error = $wpcf7_contact_form->validation_error( $name );
707
-
708
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . str_replace('<p>','',$html) . $validation_error . '</span>';
709
-
710
- return $html;
711
}
712
713
- /**
714
- * wpcf7_validation_filter($result, $tag)
715
- *
716
- * This is used to validate the Contact Form 7 'date' field
717
- * @param Array $result, 'valid' key has a boolean value (true if valid)
718
- * and 'reason' key with a message if not valid
719
- * @param Array $tag, contains the type and name of the field that is validated
720
- * @return Array $result
721
- */
722
- public static function wpcf7_validation_filter( $result, $tag ) {
723
- global $wpcf7_contact_form;
724
725
- $type = $tag['type'];
726
- $name = $tag['name'];
727
728
- $_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
729
-
730
- if ( 'date*' == $type ) {
731
- if ( '' == $_POST[$name] ) {
732
- $result['valid'] = false;
733
- $result['reason'][$name] = $wpcf7_contact_form->message( 'invalid_required' );
734
- }
735
- }
736
737
- return $result;
738
- }
739
-
740
- /**
741
- * admin_l10n()
742
- *
743
- * Function for loading the l10n files from /languages/ dir for the administatrion panel
744
- */
745
- public static function admin_l10n() {
746
- load_plugin_textdomain( 'contact-form-7-datepicker', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
747
- }
748
-
749
- /**
750
- * datepicker_shortcode_handler()
751
- *
752
- * Function that handles the [datepicker name="?" id="?" class="?" newfield="?" value="?"] shortcode
753
- */
754
- public static function datepicker_shortcode_handler($atts) {
755
- extract(shortcode_atts(array(
756
- 'name' => '',
757
- 'id' => '',
758
- 'class' => '',
759
- 'newfield' => 'true',
760
- 'value' => ''
761
- ), $atts));
762
-
763
- $data = array(
764
- "name" => ($name) ? "{$name}" : "{$id}",
765
- "atts" => array(
766
- "id" => ($id) ? "{$id}" : "{$name}",
767
- "class" => "{$class}"),
768
- "opts" => array(
769
- "newfield" => "{$newfield}"),
770
- "value" => "{$value}"
771
);
772
-
773
- return self::page_text_filter_callback($data);
774
- }
775
-
776
- /**
777
- * calendar_l10n()
778
- *
779
- * Localization of JS file strings
780
- */
781
- public static function calendar_l10n() {
782
- $l10n_strings = array(
783
- 'MONTHS' => array(
784
- __('January', 'contact-form-7-datepicker'),
785
- __('February', 'contact-form-7-datepicker'),
786
- __('March', 'contact-form-7-datepicker'),
787
- __('April', 'contact-form-7-datepicker'),
788
- __('May', 'contact-form-7-datepicker'),
789
- __('June', 'contact-form-7-datepicker'),
790
- __('July', 'contact-form-7-datepicker'),
791
- __('August', 'contact-form-7-datepicker'),
792
- __('September', 'contact-form-7-datepicker'),
793
- __('October', 'contact-form-7-datepicker'),
794
- __('November', 'contact-form-7-datepicker'),
795
- __('December', 'contact-form-7-datepicker')
796
- ),
797
- 'DAYS_3' => array(
798
- __('Sun', 'contact-form-7-datepicker'),
799
- __('Mon', 'contact-form-7-datepicker'),
800
- __('Tue', 'contact-form-7-datepicker'),
801
- __('Wed', 'contact-form-7-datepicker'),
802
- __('Thu', 'contact-form-7-datepicker'),
803
- __('Fri', 'contact-form-7-datepicker'),
804
- __('Sat', 'contact-form-7-datepicker')
805
- ),
806
- 'MONTH_FWD' => __('Move a month forward', 'contact-form-7-datepicker'),
807
- 'MONTH_BCK' => __('Move a month backward', 'contact-form-7-datepicker'),
808
- 'YEAR_FWD' => __('Move a year forward', 'contact-form-7-datepicker'),
809
- 'YEAR_BCK' => __('Move a year backward', 'contact-form-7-datepicker'),
810
- 'CLOSE' => __('Close the calendar', 'contact-form-7-datepicker'),
811
- 'ERROR_2' => __('Date object invalid!', 'contact-form-7-datepicker'),
812
- 'ERROR_1' => __('Date object invalid!', 'contact-form-7-datepicker'),
813
- 'ERROR_4' => __('Target invalid!', 'contact-form-7-datepicker'),
814
- 'ERROR_3' => __('Target invalid!', 'contact-form-7-datepicker')
815
- );
816
- $l10n = array('l10n_print_after' => 'g_l10n = ' . json_encode($l10n_strings) . ';');
817
-
818
- wp_localize_script('jsDatePickJS', 'g_l10n', $l10n);
819
}
820
821
- /**
822
- * register_shortcodes()
823
- *
824
- * Function for registering our shortcodes with CF7
825
- */
826
- public static function register_shortcodes() {
827
- if (function_exists('wpcf7_add_shortcode')) {
828
- wpcf7_add_shortcode('date', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
829
- wpcf7_add_shortcode('date*', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
830
- }
831
832
- add_shortcode( 'datepicker', array(__CLASS__, 'datepicker_shortcode_handler') );
833
- }
834
835
- /**
836
- * tag_generator()
837
- *
838
- * Registers the tag generator for CF7
839
- */
840
- public static function tag_generator() {
841
- if (function_exists('wpcf7_add_tag_generator')) {
842
- wpcf7_add_tag_generator('date', __('Date field', 'contact-form-7-datepicker'),
843
- 'wpcf7-tg-pane-date', array(__CLASS__, 'wpcf7_tg_pane_datepicker_'));
844
- }
845
}
846
-
847
- /**
848
- * wpcf7_tg_pane_datepicker_(&$contact_form)
849
- *
850
- * Caller function for the tag generator
851
- * @param reference &$contact_form
852
- */
853
- public static function wpcf7_tg_pane_datepicker_(&$contact_form) {
854
- self::wpcf7_tg_pane_datepicker( 'date' );
855
- }
856
-
857
- /**
858
- * wpcf7_tg_pane_datepicker($type = 'date')
859
- *
860
- * Callback function for the tag generator (called by wpcf7_tg_pane_datepicker_)
861
- * @param $type = 'date'
862
- */
863
- private function wpcf7_tg_pane_datepicker($type = 'date') { ?>
864
- <div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
865
- <form action="">
866
- <table>
867
- <tr>
868
- <td>
869
- <input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?>
870
- </td>
871
- </tr>
872
- <tr>
873
- <td>
874
- <?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" />
875
- </td>
876
- <td></td>
877
- </tr>
878
- </table>
879
-
880
- <table>
881
- <tr>
882
- <td>
883
- <code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
884
- <input type="text" name="id" class="idvalue oneline option" />
885
- </td>
886
-
887
- <td>
888
- <code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
889
- <input type="text" name="class" class="classvalue oneline option" />
890
- </td>
891
- </tr>
892
-
893
- <tr>
894
- <td>
895
- <code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
896
- <input type="text" name="size" class="numeric oneline option" />
897
- </td>
898
-
899
- <td>
900
- <code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
901
- <input type="text" name="maxlength" class="numeric oneline option" />
902
- </td>
903
- </tr>
904
- </table>
905
-
906
- <div class="tg-tag">
907
- <?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="<?php echo $type; ?>" class="tag" readonly="readonly" onfocus="this.select()" />
908
- </div>
909
-
910
- <div class="tg-mail-tag">
911
- <?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" />
912
- </div>
913
- </form>
914
- </div><?php
915
- }
916
-
917
}
918
919
- new CF7DatePicker;
920
-
921
- ?>
1
<?php
2
+ /**
3
Plugin Name: Contact Form 7 Datepicker
4
Plugin URI: https://github.com/relu/contact-form-7-datepicker/
5
+ Description: Easily add a date field using jQuery UI's datepicker to your CF7 forms. This plugin depends on Contact Form 7.
6
Author: Aurel Canciu
7
+ Version: 2.0
8
Author URI: https://github.com/relu/
9
*/
10
11
+ /**
12
+ * This program is free software; you can redistribute it and/or modify
13
+ * it under the terms of the GNU General Public License as published by
14
+ * the Free Software Foundation; either version 2 of the License, or
15
+ * (at your option) any later version.
16
+ *
17
+ * This program is distributed in the hope that it will be useful,
18
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ * GNU General Public License for more details.
21
+ *
22
+ * You should have received a copy of the GNU General Public License
23
+ * along with this program; if not, write to the Free Software
24
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
*/
26
?>
27
<?php
28
29
+ class ContactForm7Datepicker {
30
31
+ public static function init() {
32
+ add_action('plugins_loaded', array(__CLASS__, 'load_date_module'), 10);
33
34
+ add_action('wpcf7_enqueue_scripts', array(__CLASS__, 'enqueue_js'));
35
+ add_action('wpcf7_enqueue_styles', array(__CLASS__, 'enqueue_css'));
36
37
register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
38
39
+ if (is_admin()) {
40
+ require_once dirname(__FILE__) . '/admin.php';
41
+ ContactForm7Datepicker_Admin::init();
42
}
43
}
44
45
+ public static function load_date_module() {
46
+ require_once dirname(__FILE__) . '/date-module.php';
47
+ ContactForm7Datepicker_Date::register();
48
}
49
50
+ public static function activate() {
51
+ if (! get_option('cf7dp_ui_theme'))
52
+ add_option('cf7dp_ui_theme', 'base');
53
}
54
55
+ public static function enqueue_js() {
56
+ wp_enqueue_script('jquery-ui-datepicker');
57
58
+ $regional = CF7_DatePicker::get_regional_match();
59
60
+ if (! $regional)
61
+ return;
62
63
+ wp_enqueue_script(
64
+ 'jquery-ui-' . $regional,
65
+ 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-' . $regional . '.min.js',
66
+ array('jquery-ui-datepicker'),
67
+ '',
68
+ false
69
);
70
}
71
72
+ public static function enqueue_css() {
73
+ $theme = get_option('cf7dp_ui_theme');
74
75
+ if (! is_admin() && $theme == 'disabled')
76
+ return;
77
78
+ wp_enqueue_style('jquery-ui-theme', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/' . $theme . '/jquery-ui.css', array(), '');
79
}
80
}
81
82
+ ContactForm7Datepicker::init();
css/jsDatePick_ltr.css DELETED
@@ -1,68 +0,0 @@
1
- /*
2
-
3
- Copyright 2009 Itamar Arjuan
4
- jsDatePick is distributed under the terms of the GNU General Public License.
5
-
6
- */
7
-
8
- .JsDatePickBox { position:relative; width:212px; font-family:Arial; }
9
-
10
- .JsDatePickBox .jsDatePickCloseButton { cursor:pointer; position:absolute; z-index:1; top:1px; right:10px; width:33px; height:13px; background:url(../img/closeButton_normal.gif) left top no-repeat; }
11
- .JsDatePickBox .jsDatePickCloseButtonOver { cursor:pointer; position:absolute; z-index:1; top:1px; right:10px; width:33px; height:13px; background:url(../img/closeButton_over.gif) left top no-repeat; }
12
- .JsDatePickBox .jsDatePickCloseButtonDown { cursor:pointer; position:absolute; z-index:1; top:1px; right:10px; width:33px; height:13px; background:url(../img/closeButton_down.gif) left top no-repeat; }
13
-
14
- .JsDatePickBox .boxLeftWall { float:left; width:7px; margin:0; padding:0; }
15
- .JsDatePickBox .boxLeftWall .leftTopCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxTopLeftCorner.png) left top no-repeat; overflow:hidden; }
16
- .JsDatePickBox .boxLeftWall .leftBottomCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxBottomLeftCorner.png) left top no-repeat; overflow:hidden; }
17
- .JsDatePickBox .boxLeftWall .leftWall{ margin:0; padding:0; width:7px; background:url(../img/boxSideWallPx.gif) #ffffff left top repeat-y; overflow:hidden; }
18
-
19
- .JsDatePickBox .boxRightWall { float:left; width:7px; margin:0; padding:0;}
20
- .JsDatePickBox .boxRightWall .rightTopCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxTopRightCorner.png) left top no-repeat; overflow:hidden; }
21
- .JsDatePickBox .boxRightWall .rightBottomCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxBottomRightCorner.png) left top no-repeat; overflow:hidden; }
22
- .JsDatePickBox .boxRightWall .rightWall{ margin:0; padding:0; width:7px; background:url(../img/boxSideWallPx.gif) #ffffff right top repeat-y; overflow:hidden; }
23
-
24
- .JsDatePickBox .topWall { position:absolute; overflow:hidden; top:0px; left:7px; width:198px; height:4px; background:url(../img/boxTopPx.gif) #ffffff left top repeat-x; }
25
- .JsDatePickBox .bottomWall { position:absolute; overflow:hidden; bottom:-1px; left:7px; width:198px; height:4px; background:url(../img/boxTopPx.gif) #ffffff left top repeat-x; }
26
-
27
- .JsDatePickBox .hiddenBoxLeftWall { float:left; width:0px; overflow:hidden; overflow:hidden;}
28
- .JsDatePickBox .hiddenBoxRightWall { float:left; width:0px; overflow:hidden; overflow:hidden;}
29
-
30
- .JsDatePickBox .boxMain { float:left; background-color:#ffffff; margin:0; padding:15px 0 5px 0; }
31
- .JsDatePickBox .boxMainStripped { background:#ffffff; border:none; }
32
- .JsDatePickBox .tooltip { height:12px; line-height:11px; overflow:hidden; font-size:10px; color:#666666; text-align:left; padding:0px; margin:2px 0 2px 0; }
33
- .JsDatePickBox .weekDaysRow { height:12px; overflow:hidden; line-height:11px; font-size:10px; color:#666666; text-align:center; padding:0px; margin:2px 0 0 0; }
34
- .JsDatePickBox .weekDaysRow .weekDay { float:left; height:14px; overflow:hidden; width:24px; margin:0 5px 0 0; padding:0; }
35
-
36
- .JsDatePickBox .boxMainInner { background:#ffffff; width:198px; float:left; margin:5px 0 0 0; padding:0; }
37
- .JsDatePickBox .boxMainCellsContainer { background-color:#ffffff; margin:0; padding:0; }
38
-
39
- .JsDatePickBox .boxMainInner .controlsBar { overflow:hidden; height:20px; position:relative; }
40
- .JsDatePickBox .boxMainInner .controlsBarText { overflow:hidden; height:20px; line-height:20px; color:#000000; font-size:12px; text-align:center; }
41
-
42
- .JsDatePickBox .boxMainInner .monthForwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_normal.gif) left top no-repeat; }
43
- .JsDatePickBox .boxMainInner .monthForwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_over.gif) left top no-repeat; }
44
- .JsDatePickBox .boxMainInner .monthForwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_down.gif) left top no-repeat; }
45
-
46
- .JsDatePickBox .boxMainInner .monthBackwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_normal.gif) left top no-repeat; }
47
- .JsDatePickBox .boxMainInner .monthBackwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_over.gif) left top no-repeat; }
48
- .JsDatePickBox .boxMainInner .monthBackwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_down.gif) left top no-repeat; }
49
-
50
- .JsDatePickBox .boxMainInner .yearForwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_normal.gif) left top no-repeat; }
51
- .JsDatePickBox .boxMainInner .yearForwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_over.gif) left top no-repeat; }
52
- .JsDatePickBox .boxMainInner .yearForwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_down.gif) left top no-repeat; }
53
-
54
- .JsDatePickBox .boxMainInner .yearBackwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_normal.gif) left top no-repeat; }
55
- .JsDatePickBox .boxMainInner .yearBackwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_over.gif) left top no-repeat; }
56
- .JsDatePickBox .boxMainInner .yearBackwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_down.gif) left top no-repeat; }
57
-
58
- .JsDatePickBox .boxMainInner .skipDay { cursor:default; overflow:hidden; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; }
59
- .JsDatePickBox .boxMainInner .dayNormal { -khtml-user-select: none; font-size:12px; cursor:pointer; overflow:hidden; color:#4c4c4c; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayNormal.gif) left top no-repeat;*/ }
60
- .JsDatePickBox .boxMainInner .dayNormalToday { -khtml-user-select: none; font-size:12px; cursor:pointer; overflow:hidden; color:#f40f0f; font-weight:bold; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayNormal.gif) left top no-repeat;*/ }
61
-
62
- .JsDatePickBox .boxMainInner .dayDisabled { -khtml-user-select: none; cursor:default; font-size:12px; overflow:hidden; color:#999999; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayNormal.gif) left top no-repeat;*/ }
63
-
64
- .JsDatePickBox .boxMainInner .dayOver { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#4c4c4c; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayOver.gif) left top no-repeat;*/ }
65
- .JsDatePickBox .boxMainInner .dayOverToday { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; font-weight:bold; color:#f40f0f; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayOver.gif) left top no-repeat;*/ }
66
-
67
- .JsDatePickBox .boxMainInner .dayDown { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#F9F9F9; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /*background:url(../img/dayDown.gif) left top no-repeat; */ }
68
- .JsDatePickBox .boxMainInner .dayDownToday { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#f40f0f; font-weight:bold; width:24px; height:25px; float:left; margin:4px 5px 0 0; padding:0; text-align:center; line-height:25px; /* background:url(../img/dayDown.gif) left top no-repeat;*/ }
css/jsDatePick_ltr.min.css DELETED
@@ -1 +0,0 @@
1
- .JsDatePickBox{position:relative;width:212px;font-family:Arial;}.JsDatePickBox .jsDatePickCloseButton{cursor:pointer;position:absolute;z-index:1;top:1px;right:10px;width:33px;height:13px;background:url(../img/closeButton_normal.gif) left top no-repeat;}.JsDatePickBox .jsDatePickCloseButtonOver{cursor:pointer;position:absolute;z-index:1;top:1px;right:10px;width:33px;height:13px;background:url(../img/closeButton_over.gif) left top no-repeat;}.JsDatePickBox .jsDatePickCloseButtonDown{cursor:pointer;position:absolute;z-index:1;top:1px;right:10px;width:33px;height:13px;background:url(../img/closeButton_down.gif) left top no-repeat;}.JsDatePickBox .boxLeftWall{float:left;width:7px;margin:0;padding:0;}.JsDatePickBox .boxLeftWall .leftTopCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxTopLeftCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxLeftWall .leftBottomCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxBottomLeftCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxLeftWall .leftWall{margin:0;padding:0;width:7px;background:url(../img/boxSideWallPx.gif) #fff left top repeat-y;overflow:hidden;}.JsDatePickBox .boxRightWall{float:left;width:7px;margin:0;padding:0;}.JsDatePickBox .boxRightWall .rightTopCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxTopRightCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxRightWall .rightBottomCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxBottomRightCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxRightWall .rightWall{margin:0;padding:0;width:7px;background:url(../img/boxSideWallPx.gif) #fff right top repeat-y;overflow:hidden;}.JsDatePickBox .topWall{position:absolute;overflow:hidden;top:0;left:7px;width:198px;height:4px;background:url(../img/boxTopPx.gif) #fff left top repeat-x;}.JsDatePickBox .bottomWall{position:absolute;overflow:hidden;bottom:-1px;left:7px;width:198px;height:4px;background:url(../img/boxTopPx.gif) #fff left top repeat-x;}.JsDatePickBox .hiddenBoxLeftWall{float:left;width:0;overflow:hidden;overflow:hidden;}.JsDatePickBox .hiddenBoxRightWall{float:left;width:0;overflow:hidden;overflow:hidden;}.JsDatePickBox .boxMain{float:left;background-color:#fff;margin:0;padding:15px 0 5px 0;}.JsDatePickBox .boxMainStripped{background:#fff;border:none;}.JsDatePickBox .tooltip{height:12px;line-height:11px;overflow:hidden;font-size:10px;color:#666;text-align:left;padding:0;margin:2px 0 2px 0;}.JsDatePickBox .weekDaysRow{height:12px;overflow:hidden;line-height:11px;font-size:10px;color:#666;text-align:center;padding:0;margin:2px 0 0 0;}.JsDatePickBox .weekDaysRow .weekDay{float:left;height:14px;overflow:hidden;width:24px;margin:0 5px 0 0;padding:0;}.JsDatePickBox .boxMainInner{background:#fff;width:198px;float:left;margin:5px 0 0 0;padding:0;}.JsDatePickBox .boxMainCellsContainer{background-color:#fff;margin:0;padding:0;}.JsDatePickBox .boxMainInner .controlsBar{overflow:hidden;height:20px;position:relative;}.JsDatePickBox .boxMainInner .controlsBarText{overflow:hidden;height:20px;line-height:20px;color:#000;font-size:12px;text-align:center;}.JsDatePickBox .boxMainInner .monthForwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthForwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthForwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .skipDay{cursor:default;overflow:hidden;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;}.JsDatePickBox .boxMainInner .dayNormal{-khtml-user-select:none;font-size:12px;cursor:pointer;overflow:hidden;color:#4c4c4c;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayNormalToday{-khtml-user-select:none;font-size:12px;cursor:pointer;overflow:hidden;color:#f40f0f;font-weight:bold;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDisabled{-khtml-user-select:none;cursor:default;font-size:12px;overflow:hidden;color:#999;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayOver{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#4c4c4c;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayOverToday{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;font-weight:bold;color:#f40f0f;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDown{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#F9F9F9;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDownToday{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#f40f0f;font-weight:bold;width:24px;height:25px;float:left;margin:4px 5px 0 0;padding:0;text-align:center;line-height:25px;}
css/jsDatePick_rtl.css DELETED
@@ -1,68 +0,0 @@
1
- /*
2
-
3
- Copyright 2009 Itamar Arjuan
4
- jsDatePick is distributed under the terms of the GNU General Public License.
5
-
6
- */
7
-
8
- .JsDatePickBox { position:relative; width:212px; font-family:Arial; }
9
-
10
- .JsDatePickBox .jsDatePickCloseButton { cursor:pointer; position:absolute; z-index:1; top:1px; left:10px; width:33px; height:13px; background:url(../img/closeButton_normal.gif) left top no-repeat; }
11
- .JsDatePickBox .jsDatePickCloseButtonOver { cursor:pointer; position:absolute; z-index:1; top:1px; left:10px; width:33px; height:13px; background:url(../img/closeButton_over.gif) left top no-repeat; }
12
- .JsDatePickBox .jsDatePickCloseButtonDown { cursor:pointer; position:absolute; z-index:1; top:1px; left:10px; width:33px; height:13px; background:url(../img/closeButton_down.gif) left top no-repeat; }
13
-
14
- .JsDatePickBox .boxLeftWall { float:left; width:7px; margin:0; padding:0; }
15
- .JsDatePickBox .boxLeftWall .leftTopCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxTopLeftCorner.png) left top no-repeat; overflow:hidden; }
16
- .JsDatePickBox .boxLeftWall .leftBottomCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxBottomLeftCorner.png) left top no-repeat; overflow:hidden; }
17
- .JsDatePickBox .boxLeftWall .leftWall{ margin:0; padding:0; width:7px; background:url(../img/boxSideWallPx.gif) #ffffff left top repeat-y; overflow:hidden; }
18
-
19
- .JsDatePickBox .boxRightWall { float:left; width:7px; margin:0; padding:0;}
20
- .JsDatePickBox .boxRightWall .rightTopCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxTopRightCorner.png) left top no-repeat; overflow:hidden; }
21
- .JsDatePickBox .boxRightWall .rightBottomCorner{ margin:0; padding:0; width:7px; height:8px; background:url(../img/boxBottomRightCorner.png) left top no-repeat; overflow:hidden; }
22
- .JsDatePickBox .boxRightWall .rightWall{ margin:0; padding:0; width:7px; background:url(../img/boxSideWallPx.gif) #ffffff right top repeat-y; overflow:hidden; }
23
-
24
- .JsDatePickBox .topWall { position:absolute; overflow:hidden; top:0px; left:7px; width:198px; height:4px; background:url(../img/boxTopPx.gif) #ffffff left top repeat-x; }
25
- .JsDatePickBox .bottomWall { position:absolute; overflow:hidden; bottom:-1px; left:7px; width:198px; height:4px; background:url(../img/boxTopPx.gif) #ffffff left top repeat-x; }
26
-
27
- .JsDatePickBox .hiddenBoxLeftWall { float:left; width:0px; overflow:hidden; overflow:hidden;}
28
- .JsDatePickBox .hiddenBoxRightWall { float:left; width:0px; overflow:hidden; overflow:hidden;}
29
-
30
- .JsDatePickBox .boxMain { float:left; background-color:#ffffff; margin:0; padding:15px 0 5px 0; }
31
- .JsDatePickBox .boxMainStripped { background:#ffffff; border:none; }
32
- .JsDatePickBox .tooltip { height:12px; direction:rtl; text-align:right; line-height:11px; overflow:hidden; font-size:10px; color:#666666; padding:0px; margin:2px 0 2px 0; }
33
- .JsDatePickBox .weekDaysRow { height:12px; overflow:hidden; line-height:11px; font-size:10px; color:#666666; text-align:center; padding:0px; margin:2px 0 0 0; }
34
- .JsDatePickBox .weekDaysRow .weekDay { float:right; direction:rtl; height:14px; overflow:hidden; width:24px; margin:0 5px 0 0; padding:0; }
35
-
36
- .JsDatePickBox .boxMainInner { background:#ffffff; width:198px; float:left; margin:5px 0 0 0; padding:0; }
37
- .JsDatePickBox .boxMainCellsContainer { background-color:#ffffff; margin:0; padding:0; }
38
-
39
- .JsDatePickBox .boxMainInner .controlsBar { overflow:hidden; height:20px; position:relative; }
40
- .JsDatePickBox .boxMainInner .controlsBarText { overflow:hidden; height:20px; direction:rtl; line-height:20px; color:#000000; font-size:12px; text-align:center; }
41
-
42
- .JsDatePickBox .boxMainInner .monthForwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_normal.gif) left top no-repeat; }
43
- .JsDatePickBox .boxMainInner .monthForwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_over.gif) left top no-repeat; }
44
- .JsDatePickBox .boxMainInner .monthForwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:22px; background:url(../img/monthBackward_down.gif) left top no-repeat; }
45
-
46
- .JsDatePickBox .boxMainInner .monthBackwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_normal.gif) left top no-repeat; }
47
- .JsDatePickBox .boxMainInner .monthBackwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_over.gif) left top no-repeat; }
48
- .JsDatePickBox .boxMainInner .monthBackwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:22px; background:url(../img/monthForward_down.gif) left top no-repeat; }
49
-
50
- .JsDatePickBox .boxMainInner .yearForwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_normal.gif) left top no-repeat; }
51
- .JsDatePickBox .boxMainInner .yearForwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_over.gif) left top no-repeat; }
52
- .JsDatePickBox .boxMainInner .yearForwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; left:0px; background:url(../img/yearBackward_down.gif) left top no-repeat; }
53
-
54
- .JsDatePickBox .boxMainInner .yearBackwardButton { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_normal.gif) left top no-repeat; }
55
- .JsDatePickBox .boxMainInner .yearBackwardButtonOver { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_over.gif) left top no-repeat; }
56
- .JsDatePickBox .boxMainInner .yearBackwardButtonDown { overflow:hidden; cursor:pointer; width:20px; height:20px; position:absolute; top:0px; right:0px; background:url(../img/yearForward_down.gif) left top no-repeat; }
57
-
58
- .JsDatePickBox .boxMainInner .skipDay { cursor:default; overflow:hidden; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; }
59
- .JsDatePickBox .boxMainInner .dayNormal { -khtml-user-select: none; font-size:12px; cursor:pointer; overflow:hidden; color:#4c4c4c; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
60
- .JsDatePickBox .boxMainInner .dayNormalToday { -khtml-user-select: none; font-size:12px; cursor:pointer; overflow:hidden; color:#f40f0f; font-weight:bold; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
61
-
62
- .JsDatePickBox .boxMainInner .dayDisabled { -khtml-user-select: none; cursor:default; font-size:12px; overflow:hidden; color:#999999; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
63
-
64
- .JsDatePickBox .boxMainInner .dayOver { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#4c4c4c; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
65
- .JsDatePickBox .boxMainInner .dayOverToday { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; font-weight:bold; color:#f40f0f; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
66
-
67
- .JsDatePickBox .boxMainInner .dayDown { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#F9F9F9; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
68
- .JsDatePickBox .boxMainInner .dayDownToday { -khtml-user-select: none; cursor:pointer; font-size:12px; overflow:hidden; color:#f40f0f; font-weight:bold; width:24px; height:25px; float:right; margin:4px 0 0 5px; padding:0; text-align:center; line-height:25px; }
css/jsDatePick_rtl.min.css DELETED
@@ -1 +0,0 @@
1
- .JsDatePickBox{position:relative;width:212px;font-family:Arial;}.JsDatePickBox .jsDatePickCloseButton{cursor:pointer;position:absolute;z-index:1;top:1px;left:10px;width:33px;height:13px;background:url(../img/closeButton_normal.gif) left top no-repeat;}.JsDatePickBox .jsDatePickCloseButtonOver{cursor:pointer;position:absolute;z-index:1;top:1px;left:10px;width:33px;height:13px;background:url(../img/closeButton_over.gif) left top no-repeat;}.JsDatePickBox .jsDatePickCloseButtonDown{cursor:pointer;position:absolute;z-index:1;top:1px;left:10px;width:33px;height:13px;background:url(../img/closeButton_down.gif) left top no-repeat;}.JsDatePickBox .boxLeftWall{float:left;width:7px;margin:0;padding:0;}.JsDatePickBox .boxLeftWall .leftTopCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxTopLeftCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxLeftWall .leftBottomCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxBottomLeftCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxLeftWall .leftWall{margin:0;padding:0;width:7px;background:url(../img/boxSideWallPx.gif) #fff left top repeat-y;overflow:hidden;}.JsDatePickBox .boxRightWall{float:left;width:7px;margin:0;padding:0;}.JsDatePickBox .boxRightWall .rightTopCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxTopRightCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxRightWall .rightBottomCorner{margin:0;padding:0;width:7px;height:8px;background:url(../img/boxBottomRightCorner.png) left top no-repeat;overflow:hidden;}.JsDatePickBox .boxRightWall .rightWall{margin:0;padding:0;width:7px;background:url(../img/boxSideWallPx.gif) #fff right top repeat-y;overflow:hidden;}.JsDatePickBox .topWall{position:absolute;overflow:hidden;top:0;left:7px;width:198px;height:4px;background:url(../img/boxTopPx.gif) #fff left top repeat-x;}.JsDatePickBox .bottomWall{position:absolute;overflow:hidden;bottom:-1px;left:7px;width:198px;height:4px;background:url(../img/boxTopPx.gif) #fff left top repeat-x;}.JsDatePickBox .hiddenBoxLeftWall{float:left;width:0;overflow:hidden;overflow:hidden;}.JsDatePickBox .hiddenBoxRightWall{float:left;width:0;overflow:hidden;overflow:hidden;}.JsDatePickBox .boxMain{float:left;background-color:#fff;margin:0;padding:15px 0 5px 0;}.JsDatePickBox .boxMainStripped{background:#fff;border:none;}.JsDatePickBox .tooltip{height:12px;direction:rtl;text-align:right;line-height:11px;overflow:hidden;font-size:10px;color:#666;padding:0;margin:2px 0 2px 0;}.JsDatePickBox .weekDaysRow{height:12px;overflow:hidden;line-height:11px;font-size:10px;color:#666;text-align:center;padding:0;margin:2px 0 0 0;}.JsDatePickBox .weekDaysRow .weekDay{float:right;direction:rtl;height:14px;overflow:hidden;width:24px;margin:0 5px 0 0;padding:0;}.JsDatePickBox .boxMainInner{background:#fff;width:198px;float:left;margin:5px 0 0 0;padding:0;}.JsDatePickBox .boxMainCellsContainer{background-color:#fff;margin:0;padding:0;}.JsDatePickBox .boxMainInner .controlsBar{overflow:hidden;height:20px;position:relative;}.JsDatePickBox .boxMainInner .controlsBarText{overflow:hidden;height:20px;direction:rtl;line-height:20px;color:#000;font-size:12px;text-align:center;}.JsDatePickBox .boxMainInner .monthForwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthForwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthForwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:22px;background:url(../img/monthBackward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .monthBackwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:22px;background:url(../img/monthForward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearForwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;left:0;background:url(../img/yearBackward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButton{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_normal.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButtonOver{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_over.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .yearBackwardButtonDown{overflow:hidden;cursor:pointer;width:20px;height:20px;position:absolute;top:0;right:0;background:url(../img/yearForward_down.gif) left top no-repeat;}.JsDatePickBox .boxMainInner .skipDay{cursor:default;overflow:hidden;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;}.JsDatePickBox .boxMainInner .dayNormal{-khtml-user-select:none;font-size:12px;cursor:pointer;overflow:hidden;color:#4c4c4c;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayNormalToday{-khtml-user-select:none;font-size:12px;cursor:pointer;overflow:hidden;color:#f40f0f;font-weight:bold;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDisabled{-khtml-user-select:none;cursor:default;font-size:12px;overflow:hidden;color:#999;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayOver{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#4c4c4c;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayOverToday{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;font-weight:bold;color:#f40f0f;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDown{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#F9F9F9;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}.JsDatePickBox .boxMainInner .dayDownToday{-khtml-user-select:none;cursor:pointer;font-size:12px;overflow:hidden;color:#f40f0f;font-weight:bold;width:24px;height:25px;float:right;margin:4px 0 0 5px;padding:0;text-align:center;line-height:25px;}
css/schemes/red.css DELETED
@@ -1,12 +0,0 @@
1
- .JsDatePickBox .boxMainInner .dayNormalToday, .JsDatePickBox .boxMainInner .dayDownToday {
2
- color: #000;
3
- }
4
-
5
- .JsDatePickBox .boxMainInner .dayOver,
6
- .JsDatePickBox .boxMainInner .dayOverToday {
7
- color: #fff;
8
- }
9
-
10
- .JsDatePickBox .boxMainInner .dayNormal {
11
- color: #444;
12
- }
date-module.php ADDED
@@ -0,0 +1,185 @@
1
+ <?php
2
+
3
+ class ContactForm7Datepicker_Date {
4
+
5
+ public static function register() {
6
+ require_once dirname(__FILE__) . '/datepicker.php';
7
+
8
+ // Register shortcodes
9
+ self::add_shortcodes();
10
+
11
+ // Validations
12
+ add_filter('wpcf7_validate_date', array(__CLASS__, 'validation_filter'), 10, 2);
13
+ add_filter('wpcf7_validate_date*', array(__CLASS__, 'validation_filter'), 10, 2);
14
+
15
+
16
+ // Tag generator
17
+ add_action('load-toplevel_page_wpcf7', array(__CLASS__, 'tag_generator'));
18
+ }
19
+
20
+ public static function shortcode_handler($tag) {
21
+ if (! is_array($tag))
22
+ return;
23
+
24
+ $type = $tag['type'];
25
+ $name = $tag['name'];
26
+ $options = (array) $tag['options'];
27
+ $values = (array) $tag['values'];
28
+
29
+ if (empty($name))
30
+ return;
31
+
32
+ $validation_error = wpcf7_get_validation_error($name);
33
+
34
+ $atts = $id_att = $size_att = $maxlen_att = '';
35
+ $tabindex_att = $title_att = '';
36
+
37
+ $class_att = wpcf7_form_controls_class( $type, 'wpcf7-date');
38
+
39
+ if ('date*' == $type)
40
+ $class_att .= ' wpcf7-validates-as-required';
41
+
42
+ if ($validation_error)
43
+ $class_att .= ' wpcf7-not-valid';
44
+
45
+ $dpOptions = array();
46
+ foreach ($options as $option) {
47
+ if (preg_match('%^id:([-_0-9a-z]+)$%i', $option, $matches)) {
48
+ $id_att = $matches[1];
49
+ } elseif (preg_match('%^class:([-_0-9a-z]+)$%i', $option, $matches)) {
50
+ $class_att .= " $matches[1]";
51
+ } elseif (preg_match('%^([0-9]*)[/x]([0-9]*)$%i', $option, $matches)) {
52
+ $size_att = (int) $matches[1];
53
+ $maxlen_att = (int) $matches[2];
54
+ } elseif (preg_match('%^tabindex:(\d+)$%i', $option, $matches)) {
55
+ $tabindex_att = (int) $matches[1];
56
+ } elseif (preg_match('%^date-format:([-_/\.a-z0-9]+)$%i', $option, $matches)) {
57
+ $dpOptions['dateFormat'] = str_replace('_', ' ', $matches[1]);
58
+ } elseif (preg_match('%^(min|max)-date:([-_/\., 0-9a-z]+)$%i', $option, $matches)) {
59
+ $dpOptions[$matches[1] . 'Date'] = $matches[2];
60
+ } elseif (preg_match('%^first-day:(\d)$%', $option, $matches)) {
61
+ $dpOptions['firstDay'] = (int) $matches[1];
62
+ } elseif (preg_match('%^animate:([a-z]+)$%i', $option, $matches)) {
63
+ $dpOptions['showAnim'] = $matches[1];
64
+ } elseif (preg_match('%^change-month:(true|false)$%i', $option, $matches)) {
65
+ $dpOptions['changeMonth'] = ('true' == $matches[1]);
66
+ } elseif (preg_match('%^change-year:(true|false)$%i', $option, $matches)) {
67
+ $dpOptions['changeYear'] = ('true' == $matches[1]);
68
+ } elseif (preg_match('%^year-range:([\d]+)-?([\d]+)?$%', $option, $matches)) {
69
+ $dpOptions['yearRange'] = "{$matches[1]}:{$matches[2]}";
70
+ } elseif (preg_match('%^months:([\d]+)$%', $option, $matches)) {
71
+ $dpOptions['numberOfMonths'] = (int) $matches[1];
72
+ } elseif (preg_match('%^buttons:(true|false)$%', $option, $matches)) {
73
+ $dpOptions['showButtonPanel'] = ('true' == $matches[1]);
74
+ }
75
+
76
+ do_action('cf7_datepicker_attr_match', $dpOptions, $option);
77
+ }
78
+
79
+ $value = reset($values);
80
+
81
+ if (wpcf7_script_is() && preg_grep('%^waremark$%', $options)) {
82
+ $class_att .= ' wpcf7-use-title-as-watermark';
83
+ $title_att .= " $value";
84
+ $value = '';
85
+ }
86
+
87
+ if (wpcf7_is_posted() && isset($_POST[$name]))
88
+ $value = stripslashes($_POST[$name]);
89
+
90
+ if ($id_att)
91
+ $atts .= ' id="' . trim($id_att) . '"';
92
+
93
+ if ($class_att)
94
+ $atts .= ' class="' . trim($class_att) . '"';
95
+
96
+ if ($size_att)
97
+ $atts .= ' size="' . $size_att . '"';
98
+ else
99
+ $atts .= ' size="40"';
100
+
101
+ if ($maxlen_att)
102
+ $atts .= ' maxlength="' . $maxlen_att . '"';
103
+
104
+ if ('' !== $tabindex_att)
105
+ $atts .= ' tabindex="' . $tabindex_att .'"';
106
+
107
+ if ($title_att)
108
+ $atts .= ' title="' . trim(esc_attr($title_att)) . '"';
109
+
110
+ $input = sprintf('<input type="text" name="%s" value="%s" %s/>',
111
+ esc_attr($name),
112
+ esc_attr($value),
113
+ $atts
114
+ );
115
+
116
+ $dp = new CF7_DatePicker($name, $dpOptions);
117
+
118
+ return sprintf('<span class="wpcf7-form-control-wrap %s">%s %s</span>%s',
119
+ esc_attr($name),
120
+ $input,
121
+ $validation_error,
122
+ $dp->generate_code()
123
+ );
124
+ }
125
+
126
+ public static function validation_filter($result, $tag) {
127
+ $type = $tag['type'];
128
+ $name = $tag['name'];
129
+
130
+ $value = trim($_POST[$name]);
131
+
132
+ if ('date*' == $type && '' == $value) {
133
+ $result['valid'] = false;
134
+ $result['reason'][$name] = wpcf7_get_message('invalid_required');
135
+ }
136
+
137
+ return $result;
138
+ }
139
+
140
+ public static function tag_generator() {
141
+ wpcf7_add_tag_generator('date',
142
+ __('Date field', 'wpcf7'),
143
+ 'wpcf7-tg-pane-date',
144
+ array(__CLASS__, 'tg_pane_date')
145
+ );
146
+ }
147
+
148
+ public static function tg_pane_date() {
149
+ require_once 'date-tag-generator.php';
150
+ }
151
+
152
+ private static function add_shortcodes() {
153
+ if (function_exists('wpcf7_add_shortcode')) {
154
+ wpcf7_add_shortcode('date', array(__CLASS__, 'shortcode_handler'), true);
155
+ wpcf7_add_shortcode('date*', array(__CLASS__, 'shortcode_handler'), true);
156
+ }
157
+ }
158
+
159
+
160
+ private static function animate_dropdown() {
161
+ $effects = array(
162
+ 'show' => __('Show'),
163
+ 'blind' => __('Blind'),
164
+ 'clip' => __('Clip'),
165
+ 'drop' => __('Drop'),
166
+ 'explode' => __('Explode'),
167
+ 'fade' => __('Fade'),
168
+ 'fold' => __('Fold'),
169
+ 'puff' => __('Puff'),
170
+ 'slide' => __('Slide'),
171
+ 'scale' => __('Scale')
172
+ );
173
+
174
+ $effects = apply_filters('cf7dp_effects', $effects);
175
+
176
+ $html = "<select id=\"animate\">\n";
177
+ foreach ($effects as $key => $val) {
178
+ $html .= "\t<option value=\"{$key}\">{$val}</option>\n";
179
+ }
180
+
181
+ $html .= "</select>";
182
+
183
+ echo $html;
184
+ }
185
+ }
date-tag-generator.php ADDED
@@ -0,0 +1,156 @@
1
+ <div id="wpcf7-tg-pane-date" class="hidden">
2
+ <form action="">
3
+ <table>
4
+ <tr>
5
+ <td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td>
6
+ </tr>
7
+ <tr>
8
+ <td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td>
9
+ </tr>
10
+ </table>
11
+
12
+ <table>
13
+ <tr>
14
+ <td>
15
+ <code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
16
+ <input type="text" name="id" class="idvalue oneline option" />
17
+ </td>
18
+
19
+ <td>
20
+ <code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
21
+ <input type="text" name="class" class="classvalue oneline option" />
22
+ </td>
23
+ </tr>
24
+
25
+ <tr>
26
+ <td>
27
+ <code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
28
+ <input type="text" name="size" class="numeric oneline option" />
29
+ </td>
30
+
31
+ <td>
32
+ <code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
33
+ <input type="text" name="maxlength" class="numeric oneline option" />
34
+ </td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <td>
39
+ <code>date-format</code><br />
40
+ <input type="text" value="mm/dd/yy" name="date-format" class="oneline option" />
41
+ </td>
42
+ <td>
43
+ <br />
44
+ <a href="http://docs.jquery.com/UI/Datepicker/formatDate" title="formatDate" target="_blank"><?php _e('Help'); ?></a>
45
+ </td>
46
+ </tr>
47
+
48
+ <tr>
49
+ <td>
50
+ <code>min-date</code><br />
51
+ <input type="text" name="min-date" class="oneline option" />
52
+ </td>
53
+ <td>
54
+ <code>max-date</code><br />
55
+ <input type="text" name="max-date" class="oneline option" />
56
+ </td>
57
+ </tr>
58
+
59
+ <tr>
60
+ <td>
61
+ <code>first-day</code><br />
62
+ <input type="text" name="first-day" class="option" style="display: none" />
63
+ <select id="first-day">
64
+ <option value="0" selected="selected"><?php _e('Sunday'); ?></option>
65
+ <option value="1"><?php _e('Monday'); ?></option>
66
+ </select>
67
+ </td>
68
+ <td>
69
+ <code>animate</code><br />
70
+ <input type="text" name="animate" class="option" style="display: none" />
71
+ <?php self::animate_dropdown(); ?>
72
+ </td>
73
+ </tr>
74
+
75
+ <tr>
76
+ <td>
77
+ <code>change-month</code><br />
78
+ <input type="text" name="change-month" class="option" style="display: none" />
79
+ <select id="change-month">
80
+ <option value="true"><?php _e('True'); ?></option>
81
+ <option value="false"><?php _e('False'); ?></option>
82
+ </select>
83
+ </td>
84
+ </tr>
85
+
86
+ <tr>
87
+ <td>
88
+ <code>change-year</code><br />
89
+ <input type="text" name="change-year" class="option" style="display: none" />
90
+ <select id="change-year">
91
+ <option value="true"><?php _e('True'); ?></option>
92
+ <option value="false" selected="selected"><?php _e('False'); ?></option>
93
+ </select>
94
+ </td>
95
+ <td>
96
+ <code>year-range</code><br />
97
+ <input type="text" name="year-range" class="option" style="display: none"/>
98
+ <input size="4" type="text" name="year-range-start" class="numeric" /> -
99
+ <input size="4"type="text" name="year-range-end" class="numeric" />
100
+ </td>
101
+ </tr>
102
+
103
+ <tr>
104
+ <td>
105
+ <code>months</code><br />
106
+ <input type="text" size="2" name="months" class="option"/>
107
+ </td>
108
+ <td>
109
+ <code>buttons</code><br />
110
+ <input type="text" name="buttons" class="option" style="display: none" />
111
+ <select id="buttons">
112
+ <option value="true"><?php _e('True'); ?></option>
113
+ <option value="false" selected="selected"><?php _e('False'); ?></option>
114
+ </select>
115
+ </td>
116
+ </tr>
117
+
118
+ <tr>
119
+ <td>
120
+ <?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" />
121
+ </td>
122
+
123
+ <td>
124
+ <br /><input type="checkbox" name="watermark" class="option" />&nbsp;<?php echo esc_html( __( 'Use this text as watermark?', 'wpcf7' ) ); ?>
125
+ </td>
126
+ </tr>
127
+ </table>
128
+
129
+ <div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="date" class="tag" readonly="readonly" onfocus="this.select()" /></div>
130
+
131
+ <div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
132
+ </form>
133
+ </div>
134
+
135
+ <script type="text/javascript">
136
+ jQuery(function($){
137
+ $('select').change(function(){
138
+ var $this = $(this),
139
+ value = $this.val();
140
+
141
+ if (! value)
142
+ return;
143
+
144
+ $('input[name="'+$this.attr('id')+'"]').val(value);
145
+ });
146
+
147
+ $('input[name="year-range-start"], input[name="year-range-end"]').change(function(){
148
+ var value = $('input[name="year-range-start"]').val() + '-' + $('input[name="year-range-end"]').val();
149
+
150
+ if (! value)
151
+ return;
152
+
153
+ $('input[name="year-range"]').val(value);
154
+ });
155
+ });
156
+ </script>
datepicker.php ADDED
@@ -0,0 +1,159 @@
1
+ <?php
2
+
3
+ class CF7_DatePicker {
4
+ private $input_name;
5
+
6
+ private $options = array(
7
+ 'dateFormat' => '',
8
+ 'minDate' => '',
9
+ 'maxDate' => '',
10
+ 'firstDay' => '',
11
+ 'defaultDate' => '',
12
+ 'showAnim' => 'show',
13
+ 'changeMonth' => '',
14
+ 'changeYear' => '',
15
+ 'yearRange' => '',
16
+ 'numberOfMonths' => 1,
17
+ 'showButtonPanel' => '',
18
+ );
19
+
20
+ protected static $regionals = array(
21
+ 'af' =>'Afrikaans',
22
+ 'sq' =>'Albanian',
23
+ 'ar-DZ' =>'Algerian Arabic',
24
+ 'ar' =>'Arabic',
25
+ 'hy' =>'Armenian',
26
+ 'az' =>'Azerbaijani',
27
+ 'eu' =>'Basque',
28
+ 'bs' =>'Bosnian',
29
+ 'bg' =>'Bulgarian',
30
+ 'ca' =>'Catalan',
31
+ 'zh-HK' =>'Chinese Hong Kong',
32
+ 'zh-CN' =>'Chinese Simplified',
33
+ 'zh-TW' =>'Chinese Traditional',
34
+ 'hr' =>'Croatian',
35
+ 'cs' =>'Czech',
36
+ 'da' =>'Danish',
37
+ 'nl-BE' =>'Dutch',
38
+ 'nl' =>'Dutch',
39
+ 'en-AU' =>'English/Australia',
40
+ 'en-NZ' =>'English/New Zealand',
41
+ 'en-GB' =>'English/UK',
42
+ 'eo' =>'Esperanto',
43
+ 'et' =>'Estonian',
44
+ 'fo' =>'Faroese',
45
+ 'fa' =>'Farsi/Persian',
46
+ 'fi' =>'Finnish',
47
+ 'fr' =>'French',
48
+ 'fr-CH' =>'French/Swiss',
49
+ 'gl' =>'Galician',
50
+ 'de' =>'German',
51
+ 'el' =>'Greek',
52
+ 'he' =>'Hebrew',
53
+ 'hu' =>'Hungarian',
54
+ 'is' =>'Icelandic',
55
+ 'id' =>'Indonesian',
56
+ 'it' =>'Italian',
57
+ 'ja' =>'Japanese',
58
+ 'kk' =>'Kazakhstan',
59
+ 'ko' =>'Korean',
60
+ 'lv' =>'Latvian',
61
+ 'lt' =>'Lithuanian',
62
+ 'lb' =>'Luxembourgish',
63
+ 'mk' =>'Macedonian',
64
+ 'ml' =>'Malayalam',
65
+ 'ms' =>'Malaysian',
66
+ 'no' =>'Norwegian',
67
+ 'pl' =>'Polish',
68
+ 'pt' =>'Portuguese',
69
+ 'pt-BR' =>'Portuguese/Brazilian',
70
+ 'rm' =>'Rhaeto-Romanic',
71
+ 'ro' =>'Romanian',
72
+ 'ru' =>'Russian',
73
+ 'sr' =>'Serbian',
74
+ 'sr-SR' =>'Serbian',
75
+ 'sk' =>'Slovak',
76
+ 'sl' =>'Slovenian',
77
+ 'es' =>'Spanish',
78
+ 'sv' =>'Swedish',
79
+ 'ta' =>'Tamil',
80
+ 'th' =>'Thai',
81
+ 'tj' =>'Tajikistan',
82
+ 'tr' =>'Turkish',
83
+ 'uk' =>'Ukranian',
84
+ 'vi' =>'Vietnamese',
85
+ 'cy-GB' =>'Welsh/UK',
86
+ );
87
+
88
+ function __construct($name, $options = array()) {
89
+ $this->input_name = $name;
90
+
91
+ $this->options['firstDay'] = get_option('start_of_week');
92
+ $this->options = wp_parse_args((array)$options, $this->options);
93
+ $this->options = apply_filters('cf7_datepicker_options', $this->options);
94
+ }
95
+
96
+ public function __set($option, $value) {
97
+ if (isset($this->options[$option])) {
98
+ $this->options[$option] = $value;
99
+ }
100
+ }
101
+
102
+ public function __get($option) {
103
+ return isset($this->options[$option]) ? $this->options[$option] : null;
104
+ }
105
+
106
+ public function get_all() {
107
+ return $this->options;
108
+ }
109
+
110
+ public function generate_code($inline = false) {
111
+ $selector = ($inline) ? "$('$this->input_name')" : "$('input[name=\"{$this->input_name}\"]')";
112
+
113
+ $out = "{$selector}.datepicker({$this->options_encode()});\n";
114
+ $out .= self::_regionalize($selector);
115
+
116
+ $out = "jQuery(function($){ $out });";
117
+
118
+ return "\n<script type=\"text/javascript\">{$out}</script>\n";
119
+ }
120
+
121
+ private function options_encode() {
122
+ $options = json_encode(array_filter(
123
+ $this->options,
124
+ create_function('$var', 'return ! empty($var);')
125
+ ));
126
+
127
+ return stripslashes($options);
128
+ }
129
+
130
+ private static function _regionalize($selector) {
131
+ $regional = self::get_regional_match();
132
+
133
+ $regional = apply_filters('cf7dp_datepicker_regional', $regional);
134
+
135
+ if ($regional)
136
+ return "{$selector}.datepicker('option', $.datepicker.regional['{$regional}']);";
137
+
138
+ return '';
139
+ }
140
+
141
+ public static function get_regional_match() {
142
+ $locale = get_locale();
143
+
144
+ $key_match = array(
145
+ substr($locale, 0, 2),
146
+ str_replace('_', '-', $locale),
147
+ );
148
+
149
+ if ($key_match[1] != 'en') {
150
+ foreach ($key_match as $key) {
151
+ if (array_key_exists($key, self::$regionals)) {
152
+ return $key;
153
+ }
154
+ }
155
+ }
156
+
157
+ return null;
158
+ }
159
+ }
img/aqua/aqua_dayDown.gif DELETED
Binary file
img/aqua/aqua_dayNormal.gif DELETED
Binary file
img/aqua/aqua_dayOver.gif DELETED
Binary file
img/armygreen/armygreen_dayDown.gif DELETED
Binary file
img/armygreen/armygreen_dayNormal.gif DELETED
Binary file
img/armygreen/armygreen_dayOver.gif DELETED
Binary file
img/bananasplit/bananasplit_dayDown.gif DELETED
Binary file
img/bananasplit/bananasplit_dayNormal.gif DELETED
Binary file
img/bananasplit/bananasplit_dayOver.gif DELETED
Binary file
img/beige/beige_dayDown.gif DELETED
Binary file
img/beige/beige_dayNormal.gif DELETED
Binary file