T(-) Countdown - Version 2.3.0

Version Description

  • complete code update
  • added plugin options page
  • added datetimepicker to widget
  • added T(-) Countdown Event integration
  • new method of handling styles and custom styles
Download this release

Release Info

Developer baden03
Plugin Icon 128x128 T(-) Countdown
Version 2.3.0
Comparing to
See all releases

Code changes from version 2.2.20 to 2.3.0

countdown-timer.php CHANGED
@@ -5,30 +5,282 @@ Text Domain: tminus
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
7
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
8
- Version: 2.2.20
9
  Author: twinpictures, baden03
10
  Author URI: http://www.twinpictures.de/
11
  License: GPL2
12
  */
13
 
14
- //plugin init scripts
15
- add_action( 'init', 'countdown_init_scripts' );
16
- function countdown_init_scripts(){
17
- $current_version = '2.2.20';
18
- $installed_version = get_option('t-minus_version');
19
-
20
- if($current_version != $installed_version){
21
- //add or update version
22
- update_option('t-minus_version', $current_version);
23
-
24
- //add or update styles
25
- $styles_arr = array("hoth","TIE-fighter","c-3po","c-3po-mini","carbonite","carbonite-responsive","carbonlite","cloud-city","darth","jedi", "sith");
26
- update_option('t-minus_styles', $styles_arr);
27
-
28
- //reset rockstar option
29
- update_option('rockstar', '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
 
32
 
33
  //set global vars
34
  add_action( 'wp_head', 'tminus_js_vars' );
@@ -38,23 +290,29 @@ function tminus_js_vars(){
38
  echo "var tminusnow = '".$plugin_url."/js/now.php';\n";
39
  echo "</script>";
40
  }
41
-
42
  //load scripts on the widget admin page
43
  add_action( 'admin_enqueue_scripts', 'tminus_admin_scripts');
44
- function tminus_admin_scripts($hook){
45
  if( $hook == 'widgets.php' ){
46
  //jquery datepicker
47
  wp_enqueue_script( 'jquery-ui-datepicker' );
48
- wp_register_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css', array (), '1.10.4' );
 
 
49
  wp_enqueue_style('jquery-ui-css');
50
-
 
51
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
52
-
53
  //jquery widget scripts
54
- wp_register_script('tminus-admin-script', $plugin_url.'/js/jquery.collapse.js', array ('jquery'), '1.2.1' );
 
 
 
55
  wp_enqueue_script('tminus-admin-script');
56
-
57
- wp_register_style('collapse-admin-css', $plugin_url.'/admin/collapse-style.css', array (), '1.0' );
58
  wp_enqueue_style('collapse-admin-css');
59
  }
60
  }
@@ -63,16 +321,19 @@ function tminus_admin_scripts($hook){
63
  add_action('wp_enqueue_scripts', 'countdown_scripts' );
64
  function countdown_scripts(){
65
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
66
-
67
  //lwtCountdown script
68
- wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.4' );
69
  wp_enqueue_script('countdown-script');
70
-
71
- //register all countdown styles for enqueue-as-needed
72
- $styles_arr = get_option('t-minus_styles');
73
- foreach($styles_arr as $style_name){
74
- wp_register_style( 'countdown-'.$style_name.'-css', $plugin_url.'/css/'.$style_name.'/style.css', array(), '1.3' );
 
 
75
  }
 
76
  }
77
 
78
  //style folders array
@@ -81,12 +342,13 @@ function folder_array($path, $exclude = ".|..") {
81
  $dh = opendir($path);
82
  $exclude_array = explode("|", $exclude);
83
  $result = array();
84
- while(false !== ( $file = readdir($dh) ) ) {
85
- if( !in_array( strtolower( $file ), $exclude_array) ){
86
  $result[] = $file;
87
  }
88
  }
89
  closedir($dh);
 
90
  return $result;
91
  }
92
  }
@@ -97,400 +359,289 @@ function folder_array($path, $exclude = ".|..") {
97
  class CountDownTimer extends WP_Widget {
98
  /** constructor */
99
  function CountDownTimer() {
100
- load_plugin_textdomain( 'tminus', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
101
- $widget_ops = array('classname' => 'CountDownTimer', 'description' => __('A highly customizable jQuery countdown timer by Twinpictures', 'tminus') );
102
- $this->WP_Widget('CountDownTimer', 'T(-) Countdown', $widget_ops);
103
  }
104
-
105
  /** Widget */
106
  function widget($args, $instance) {
107
- global $add_my_script;
108
- extract( $args );
109
- //insert some style into your life
110
- $style = empty($instance['style']) ? 'jedi' : apply_filters('widget_style', $instance['style']);
111
- wp_enqueue_style( 'countdown-'.$style.'-css' );
112
-
113
- $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
114
- $tophtml = empty($instance['tophtml']) ? ' ' : apply_filters('widget_tophtml', stripslashes($instance['tophtml']));
115
- $bothtml = empty($instance['bothtml']) ? ' ' : apply_filters('widget_bothtml', stripslashes($instance['bothtml']));
116
- $launchhtml = empty($instance['launchhtml']) ? ' ' : apply_filters('widget_launchhtml', $instance['launchhtml']);
117
- $launchtarget = empty($instance['launchtarget']) ? 'After Countdown' : apply_filters('widget_launchtarget', $instance['launchtarget']);
118
-
119
- $day = empty($instance['day']) ? 20 : apply_filters('widget_day', $instance['day']);
120
- $month = empty($instance['month']) ? 12 : apply_filters('widget_month', $instance['month']);
121
- $year = empty($instance['year']) ? 2014 : apply_filters('widget_year', $instance['year']);
122
-
123
- $date = empty($instance['date']) ? $year.'-'.$month.'-'.$day : apply_filters('widget_date', $instance['date']);
124
- $hour = empty($instance['hour']) ? 20 : apply_filters('widget_hour', $instance['hour']);
125
- $min = empty($instance['min']) ? 12 : apply_filters('widget_min', $instance['min']);
126
- $sec = empty($instance['sec']) ? 20 : apply_filters('widget_sec', $instance['sec']);
127
-
128
- $weektitle = empty($instance['weektitle']) ? __('weeks', 'tminus') : apply_filters('widget_weektitle', stripslashes($instance['weektitle']));
129
- $daytitle = empty($instance['daytitle']) ? __('days', 'tminus') : apply_filters('widget_daytitle', stripslashes($instance['daytitle']));
130
- $hourtitle = empty($instance['hourtitle']) ? __('hours', 'tminus') : apply_filters('widget_hourtitle', stripslashes($instance['hourtitle']));
131
- $mintitle = empty($instance['mintitle']) ? __('minutes', 'tminus') : apply_filters('widget_mintitle', stripslashes($instance['mintitle']));
132
- $sectitle = empty($instance['sectitle']) ? __('seconds', 'tminus') : apply_filters('widget_sectitle', stripslashes($instance['sectitle']));
133
-
134
- $omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
135
- $jsplacement = empty($instance['jsplacement']) ? 'footer' : apply_filters('widget_jsplacement', $instance['jsplacement']);
136
-
137
- //now
138
- //$now = time() + ( get_option( 'gmt_offset' ) * 3600);
139
- //$now = current_time('timestamp');
140
- $now = strtotime(current_time('mysql'));
141
-
142
- //target
143
- $target = strtotime( $date.' '.$hour.':'.$min.':'.$sec );
144
-
145
- //difference in seconds
146
- $diffSecs = $target - $now;
147
-
148
- //countdown digits
149
- $date = array();
150
- $date['secs'] = $diffSecs % 60;
151
- $date['mins'] = floor($diffSecs/60)%60;
152
- $date['hours'] = floor($diffSecs/60/60)%24;
153
- if($omitweeks == 'false'){
154
- $date['days'] = floor($diffSecs/60/60/24)%7;
155
- }
156
- else{
157
- $date['days'] = floor($diffSecs/60/60/24);
158
- }
159
- $date['weeks'] = floor($diffSecs/60/60/24/7);
160
-
161
- foreach ($date as $i => $d) {
162
- $d1 = $d%10;
163
- //53 = 3
164
- //153 = 3
165
- if($d < 100){
166
- $d2 = ($d-$d1) / 10;
167
- //53 = 50 / 10 = 5
168
- $d3 = 0;
169
- }
170
- else{
171
- $dr = $d%100;
172
- //153 = 53
173
- //345 = 45
174
- $dm = $d-$dr;
175
- //153 = 100
176
- //345 = 300
177
- $d2 = ($d-$dm-$d1) / 10;
178
- //153 = 50 / 10 = 5
179
- //345 = 40 / 10 = 4
180
- $d3 = $dm / 100;
181
  }
182
- /* here is where the 1000's support might go... someday. */
183
-
184
- //now assign all the digits to the array
185
- $date[$i] = array(
186
- (int)$d3,
187
- (int)$d2,
188
- (int)$d1,
189
- (int)$d
190
- );
191
- }
192
-
193
-
194
- echo $before_widget;
195
- if ( $title ){
196
- echo $before_title . $title . $after_title;
197
- }
198
- echo '<div id="'.$args['widget_id'].'-widget">';
199
- echo '<div id="'.$args['widget_id'].'-tophtml" class="'.$style.'-tophtml" >';
200
- if($tophtml){
201
- echo stripslashes($tophtml);
202
- }
203
- echo '</div>';
204
-
205
- //drop in the dashboard
206
- echo '<div id="'.$args['widget_id'].'-dashboard" class="'.$style.'-dashboard">';
207
-
208
- if($omitweeks == 'false'){
209
- //set up correct style class for double or triple digit love
210
- $wclass = $style.'-dash '.$style.'-weeks_dash';
211
- if( abs($date['weeks'][0]) > 0 ){
212
- $wclass = $style.'-tripdash '.$style.'-weeks_trip_dash';
213
  }
214
-
215
- echo '<div class="'.$wclass.'">
216
- <span class="'.$style.'-dash_title">'.$weektitle.'</span>';
217
- //show third week digit if the number of weeks is greater than 99
218
- if( abs($date['weeks'][0]) > 0 ){
219
- echo '<div class="'.$style.'-digit">'.$date['weeks'][0].'</div>';
220
  }
221
- echo '<div class="'.$style.'-digit">'.$date['weeks'][1].'</div>
222
- <div class="'.$style.'-digit">'.$date['weeks'][2].'</div>
223
- </div>';
224
  }
225
-
226
- //set up correct style class for double or triple digit love
227
- $dclass = $style.'-dash '.$style.'-days_dash';
228
- if($omitweeks == 'true' && abs($date['days'][3]) > 99){
229
- $dclass = $style.'-tripdash '.$style.'-days_trip_dash';
230
  }
231
-
232
- echo '<div class="'.$dclass.'">
233
- <span class="'.$style.'-dash_title">'.$daytitle.'</span>';
234
- //show third day digit if there are NO weeks and the number of days is greater that 99
235
- if($omitweeks == 'true' && abs($date['days'][3]) > 99){
236
- echo '<div class="'.$style.'-digit">'.$date['days'][0].'</div>';
237
  }
238
- echo '<div class="'.$style.'-digit">'.$date['days'][1].'</div>
239
- <div class="'.$style.'-digit">'.$date['days'][2].'</div>
240
- </div>
241
-
242
- <div class="'.$style.'-dash '.$style.'-hours_dash">
243
- <span class="'.$style.'-dash_title">'.$hourtitle.'</span>
244
- <div class="'.$style.'-digit">'.$date['hours'][1].'</div>
245
- <div class="'.$style.'-digit">'.$date['hours'][2].'</div>
246
- </div>
247
-
248
- <div class="'.$style.'-dash '.$style.'-minutes_dash">
249
- <span class="'.$style.'-dash_title">'.$mintitle.'</span>
250
- <div class="'.$style.'-digit">'.$date['mins'][1].'</div>
251
- <div class="'.$style.'-digit">'.$date['mins'][2].'</div>
252
- </div>
253
-
254
- <div class="'.$style.'-dash '.$style.'-seconds_dash">
255
- <span class="'.$style.'-dash_title">'.$sectitle.'</span>
256
- <div class="'.$style.'-digit">'.$date['secs'][1].'</div>
257
- <div class="'.$style.'-digit">'.$date['secs'][2].'</div>
258
- </div>
259
- </div>'; //close the dashboard
260
-
261
- echo '<div id="'.$args['widget_id'].'-bothtml" class="'.$style.'-bothtml">';
262
- if($bothtml){
263
- echo stripslashes($bothtml);
264
- }
265
- echo '</div>';
266
- echo '</div>';
267
- echo $after_widget;
268
- //$t = date( 'n/j/Y H:i:s', time() + ( get_option( 'gmt_offset' ) * 3600));
269
- $t = date( 'n/j/Y H:i:s', strtotime(current_time('mysql')) );
270
-
271
- //launch div
272
- $launchdiv = "";
273
- if($launchtarget == "Above Countdown"){
274
- $launchdiv = "tophtml";
275
- }
276
- else if($launchtarget == "Below Countdown"){
277
- $launchdiv = "bothtml";
278
- }
279
- else if($launchtarget == "Entire Widget"){
280
- $launchdiv = "widget";
281
- }
282
- else if($launchtarget == "Count Up"){
283
- $launchdiv = "countup";
284
- }
285
 
286
- if($jsplacement == "footer"){
287
- $add_my_script[$args['widget_id']] = array(
288
- 'id' => $args['widget_id'],
289
- 'day' => date('d', $target),
290
- 'month' => date('m', $target),
291
- 'year' => date('Y', $target),
292
- 'hour' => $hour,
293
- 'min' => $min,
294
- 'sec' => $sec,
295
- 'localtime' => $t,
296
- 'style' => $style,
297
- 'omitweeks' => $omitweeks,
298
- 'content' => trim($launchhtml),
299
- 'launchtarget' => $launchdiv,
300
- 'launchwidth' => 'auto',
301
- 'launchheight' => 'auto'
302
- );
303
- }
304
- else{
305
- ?>
306
- <script language="javascript" type="text/javascript">
307
- jQuery(document).ready(function($) {
308
- $('#<?php echo $args['widget_id']; ?>-dashboard').countDown({
309
- targetDate: {
310
- 'day': <?php echo date('d', $target); ?>,
311
- 'month': <?php echo date('m', $target); ?>,
312
- 'year': <?php echo date('Y', $target); ?>,
313
- 'hour': <?php echo $hour; ?>,
314
- 'min': <?php echo $min; ?>,
315
- 'sec': <?php echo $sec; ?>,
316
- 'localtime': '<?php echo $t; ?>',
317
- /*
318
- 'mysqltime': '<?php echo current_time('mysql'); ?>'
319
- */
320
- },
321
- style: '<?php echo $style; ?>',
322
- launchtarget: '<?php echo $launchdiv; ?>',
323
- omitWeeks: '<?php echo $omitweeks; ?>'
324
- <?php
325
- if($launchhtml){
326
- echo ", onComplete: function() { $('#".$args['widget_id']."-".$launchdiv."').html('".do_shortcode($launchhtml)."'); }";
327
- }
328
- ?>
329
- });
330
- });
331
- </script>
332
- <?php
333
- }
334
- }
335
-
336
- function update( $new_instance, $old_instance ) {
337
- $instance = array_merge($old_instance, $new_instance);
338
- $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
339
- if($instance['isrockstar'] == 'rockstar'){
340
- update_option('rockstar', 'rockstar');
341
  }
342
- return $instance;
343
- }
344
 
345
  /** Form */
346
- function form($instance) {
347
- $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
348
- $day = empty($instance['day']) ? 12 : apply_filters('widget_day', $instance['day']);
349
- if($day > 31){
350
- $day = 31;
351
- }
352
- $month = empty($instance['month']) ? 12 : apply_filters('widget_month', $instance['month']);
353
- if($month > 12){
354
- $month = 12;
355
- }
356
- $year = empty($instance['year']) ? 2014 : apply_filters('widget_year', $instance['year']);
357
- $date = empty($instance['date']) ? $year.'-'.$month.'-'.$day : apply_filters('widget_date', $instance['date']);
358
- $hour = empty($instance['hour']) ? 12 : apply_filters('widget_hour', $instance['hour']);
359
- if($hour > 23){
360
- $hour = 23;
361
- }
362
- $min = empty($instance['min']) ? 12 : apply_filters('widget_min', $instance['min']);
363
- if($min > 59){
364
- $min = 59;
365
- }
366
- $sec = empty($instance['sec']) ? 12 : apply_filters('widget_sec', $instance['sec']);
367
- if($sec > 59){
368
- $sec = 59;
369
- }
370
- $omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
371
- $style = empty($instance['style']) ? 'jedi' : apply_filters('widget_style', $instance['style']);
372
- $jsplacement = empty($instance['jsplacement']) ? 'footer' : apply_filters('widget_jsplacement', $instance['jsplacement']);
373
-
374
- $weektitle = empty($instance['weektitle']) ? __('weeks', 'tminus') : apply_filters('widget_weektitle', stripslashes($instance['weektitle']));
375
- $daytitle = empty($instance['daytitle']) ? __('days', 'tminus') : apply_filters('widget_daytitle', stripslashes($instance['daytitle']));
376
- $hourtitle = empty($instance['hourtitle']) ? __('hours', 'tminus') : apply_filters('widget_hourtitle', stripslashes($instance['hourtitle']));
377
- $mintitle = empty($instance['mintitle']) ? __('minutes', 'tminus') : apply_filters('widget_mintitle', stripslashes($instance['mintitle']));
378
- $sectitle = empty($instance['sectitle']) ? __('seconds', 'tminus') : apply_filters('widget_sectitle', stripslashes($instance['sectitle']));
379
-
380
- $isrockstar = get_option('rockstar');
381
-
382
- if($isrockstar){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  //rockstar features
384
- $tophtml = empty($instance['tophtml']) ? ' ' : apply_filters('widget_tophtml', stripslashes($instance['tophtml']));
385
- $bothtml = empty($instance['bothtml']) ? ' ' : apply_filters('widget_bothtml', stripslashes($instance['bothtml']));
386
- $launchhtml = empty($instance['launchhtml']) ? ' ' : apply_filters('widget_launchhtml', stripslashes($instance['launchhtml']));
387
- $launchtarget = empty($instance['launchtarget']) ? 'After Counter' : apply_filters('widget_launchtarget', $instance['launchtarget']);
388
- }
389
- ?>
390
- <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
391
- <p><label for="<?php echo $this->get_field_id('date'); ?>"><?php _e('Target Date:', 'tminus'); ?></label><br/><input style="width: 90px;" id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" type="text" value="<?php echo $date; ?>" class="t-datepicker"/></p>
392
- <p><label for="<?php echo $this->get_field_id('hour'); ?>"><?php _e('Target Time (HH:MM:SS):', 'tminus'); ?></label><br/><input style="width: 30px;" id="<?php echo $this->get_field_id('hour'); ?>" name="<?php echo $this->get_field_name('hour'); ?>" type="text" value="<?php echo $hour; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('min'); ?>" name="<?php echo $this->get_field_name('min'); ?>" type="text" value="<?php echo $min; ?>" />:<input style="width: 30px;" id="<?php echo $this->get_field_id('sec'); ?>" name="<?php echo $this->get_field_name('sec'); ?>" type="text" value="<?php echo $sec; ?>" /></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  <?php
394
- //Omit Week Selector
395
- $negative = '';
396
- $positive = '';
397
- if($omitweeks == 'false'){
398
- $negative = 'CHECKED';
399
- }else{
400
- $positive = 'CHECKED';
401
- }
402
-
403
- //JS Placement Selector
404
- $foot = '';
405
- $inline = '';
406
- if($jsplacement == 'footer'){
407
- $foot = 'CHECKED';
408
- }else{
409
- $inline = 'CHECKED';
410
- }
 
 
 
 
411
  ?>
412
- <p><?php _e('Omit Weeks:', 'tminus'); ?> <input id="<?php echo $this->get_field_id('omitweeks'); ?>-no" name="<?php echo $this->get_field_name('omitweeks'); ?>" type="radio" <?php echo $negative; ?> value="false" /><label for="<?php echo $this->get_field_id('omitweeks'); ?>-no"> <?php _e('No', 'tminus'); ?> </label> <input id="<?php echo $this->get_field_id('omitweeks'); ?>-yes" name="<?php echo $this->get_field_name('omitweeks'); ?>" type="radio" <?php echo $positive; ?> value="true" /> <label for="<?php echo $this->get_field_id('omitweeks'); ?>-yes"> <?php _e('Yes', 'tminus'); ?></label></p>
413
  <p><?php _e('Style:', 'tminus'); ?> <select name="<?php echo $this->get_field_name('style'); ?>" id="<?php echo $this->get_field_name('style'); ?>">
414
- <?php
415
-
416
- $styles_arr = folder_array(WP_PLUGIN_DIR.'/'. dirname( plugin_basename(__FILE__) ).'/css');
417
- update_option('t-minus_styles', $styles_arr);
418
- foreach($styles_arr as $style_name){
419
- $selected = "";
420
- if($style == $style_name){
421
- $selected = 'SELECTED';
422
  }
423
- echo '<option value="'.$style_name.'" '.$selected.'>'.$style_name.'</option>';
424
- }
425
- ?>
426
- </select></p>
427
- <p><?php _e('Inject Script:', 'tminus'); ?> <input id="<?php echo $this->get_field_id('jsplacement'); ?>-foot" name="<?php echo $this->get_field_name('jsplacement'); ?>" type="radio" <?php echo $foot; ?> value="footer" /><label for="<?php echo $this->get_field_id('jsplacement'); ?>-foot"> <?php _e('Footer', 'tminus'); ?> </label> <input id="<?php echo $this->get_field_id('jsplacement'); ?>-inline" name="<?php echo $this->get_field_name('jsplacement'); ?>" type="radio" <?php echo $inline; ?> value="inline" /> <label for="<?php echo $this->get_field_id('jsplacement'); ?>-inline"> <?php _e('Inline', 'tminus'); ?></label></p>
428
-
429
- <input class="isrockstar" id="<?php echo $this->get_field_id('isrockstar'); ?>" name="<?php echo $this->get_field_name('isrockstar'); ?>" type="hidden" value="<?php echo $isrockstar; ?>" />
430
  <?php
431
- if($isrockstar){
432
- echo __('Rockstar Features', 'tminus').'<br/>';
433
- }
434
- else{
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  $like_it_arr = array('makes me feel warm and fuzzy inside... in a good way', 'restores my faith in humanity... if only for a fleating second', 'rocked my world and is totally worth 3 bucks', 'offered me a positive vision of future living', 'inspires me to commit random acts of kindness', 'helped organize my life in one of the small ways that matter', 'saved me minutes if not tens of minutes writing your own solution', 'brightened my day... or darkened it since I wanted to sleep in anyway', 'is totally worth 3 bucks');
436
  $rand_key = array_rand($like_it_arr);
437
  $like_it = $like_it_arr[$rand_key];
438
- ?>
439
- <p id="header-<?php echo $this->get_field_id('isrockstar'); ?>"><input class="rockstar" id="<?php echo $this->get_field_id('isrockstar'); ?>" name="<?php echo $this->get_field_name('isrockstar'); ?>" type="checkbox" value="rockstar" /> <label for="<?php echo $this->get_field_id('isrockstar'); ?>"><span title="<?php _e('check the box and save to unlock rockstar features.', 'tminus'); ?>"><?php printf( __('T(-) Countdown %s!', 'tminus'), $like_it); ?></span></label></p>
440
- <div id="target-<?php echo $this->get_field_id('isrockstar'); ?>" class="collapseomatic_content">
441
- <?php
442
- }
443
-
444
- if($isrockstar){
445
- ?>
446
- <a class="collapseomatic" id="tophtml<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Above Countdown', 'tminus'); ?></a>
447
- <div id="target-tophtml<?php echo $this->get_field_id('tophtml'); ?>" class="collapseomatic_content">
448
- <p><label for="<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Top HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('tophtml'); ?>" name="<?php echo $this->get_field_name('tophtml'); ?>"><?php echo $tophtml; ?></textarea></p>
449
- </div>
450
- <br/>
451
- <a class="collapseomatic" id="bothtml<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Below Countdown', 'tminus'); ?></a>
452
- <div id="target-bothtml<?php echo $this->get_field_id('bothtml'); ?>" class="collapseomatic_content">
453
- <p><label for="<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Bottom HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('bothtml'); ?>" name="<?php echo $this->get_field_name('bothtml'); ?>"><?php echo $bothtml; ?></textarea></p>
454
- </div>
455
- <br/>
456
- <a class="collapseomatic" id="launchhtml<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('When Countdown Reaches Zero', 'tminus'); ?></a>
457
- <div id="target-launchhtml<?php echo $this->get_field_id('launchhtml'); ?>" class="collapseomatic_content">
458
- <p><label for="<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('Launch Event HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('launchhtml'); ?>" name="<?php echo $this->get_field_name('launchhtml'); ?>"><?php echo $launchhtml; ?></textarea></p>
459
- <p><?php _e('Launch Target:', 'tminus'); ?> <select name="<?php echo $this->get_field_name('launchtarget'); ?>" id="<?php echo $this->get_field_name('launchtarget'); ?>">
460
- <?php
461
- $target_arr = array('Above Countdown', 'Below Countdown', 'Entire Widget', 'Count Up');
462
- foreach($target_arr as $target_name){
463
- $selected = "";
464
- if($launchtarget == $target_name){
465
- $selected = 'SELECTED';
466
- }
467
- echo '<option value="'.$target_name.'" '.$selected.'>'.__($target_name, "tminus").'</option>';
468
- }
469
- ?>
470
- </select></p>
471
- </div>
472
- <br/>
473
- <a class="collapseomatic" id="titles<?php echo $this->get_field_id('weektitle'); ?>"><?php _e('Digit Titles', 'tminus'); ?></a>
474
- <div id="target-titles<?php echo $this->get_field_id('weektitle'); ?>" class="collapseomatic_content">
475
- <p><label for="<?php echo $this->get_field_id('weektitle'); ?>"><?php _e('How do you spell "weeks"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('weektitle'); ?>" name="<?php echo $this->get_field_name('weektitle'); ?>" type="text" value="<?php echo $weektitle; ?>" /></label></p>
476
- <p><label for="<?php echo $this->get_field_id('daytitle'); ?>"><?php _e('How do you spell "days"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('daytitle'); ?>" name="<?php echo $this->get_field_name('daytitle'); ?>" type="text" value="<?php echo $daytitle; ?>" /></label></p>
477
- <p><label for="<?php echo $this->get_field_id('hourtitle'); ?>"><?php _e('How do you spell "hours"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('hourtitle'); ?>" name="<?php echo $this->get_field_name('hourtitle'); ?>" type="text" value="<?php echo $hourtitle; ?>" /></label></p>
478
- <p><label for="<?php echo $this->get_field_id('mintitle'); ?>"><?php _e('How do you spell "minutes"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('mintitle'); ?>" name="<?php echo $this->get_field_name('mintitle'); ?>" type="text" value="<?php echo $mintitle; ?>" /></label></p>
479
- <p><label for="<?php echo $this->get_field_id('sectitle'); ?>"><?php _e('And "seconds" are spelled:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('sectitle'); ?>" name="<?php echo $this->get_field_name('sectitle'); ?>" type="text" value="<?php echo $sectitle; ?>" /></label></p>
480
- </div>
481
-
482
- <?php
483
- }
484
- else{
485
- echo '</div>';
486
- }
487
-
488
  ?>
 
 
 
 
 
 
489
  <br/>
490
  <a class="collapseomatic" id="tccc<?php echo $this->get_field_id('isrockstar'); ?>"><?php _e('Schedule Recurring Countdown', 'tminus'); ?></a>
491
  <div id="target-tccc<?php echo $this->get_field_id('isrockstar'); ?>" class="collapseomatic_content">
492
- <p><?php printf(__('%sT(-) Countdown Control%s is a premium countdown plugin that includes the ability to schedule and manage multiple recurring T(-) Countdowns... the Jedi way.', 'tminus'), '<a href="http://plugins.twinpictures.de/premium-plugins/t-minus-countdown-control/?utm_source=t-countdown&utm_medium=widget-settings&utm_content=t-countdown-control&utm_campaign=t-countdown-widget" target="blank" title="(-) Countdown Control">', '</a>'); ?></p>
493
  </div>
 
494
  <?php
495
  }
496
  } // class CountDownTimer
@@ -501,13 +652,13 @@ add_action('widgets_init', create_function('', 'return register_widget("CountDow
501
 
502
  //code for the footer
503
  add_action('wp_footer', 'print_my_script', 99);
504
-
505
  function print_my_script() {
506
  global $add_my_script;
507
  if ( ! $add_my_script ){
508
  return;
509
  }
510
-
511
  ?>
512
  <script language="javascript" type="text/javascript">
513
  jQuery(document).ready(function($) {
@@ -515,7 +666,7 @@ function print_my_script() {
515
  //var_dump('hey dude', $add_my_script);
516
  foreach((array) $add_my_script as $script){
517
  ?>
518
- $('#<?php echo $script['id']; ?>-dashboard').countDown({
519
  targetDate: {
520
  'day': <?php echo $script['day']; ?>,
521
  'month': <?php echo $script['month']; ?>,
@@ -524,13 +675,12 @@ function print_my_script() {
524
  'min': <?php echo $script['min']; ?>,
525
  'sec': <?php echo $script['sec']; ?>,
526
  'localtime': '<?php echo $script['localtime']; ?>',
527
- /*
528
- 'mysqltime': '<?php echo current_time('mysql'); ?>'
529
- */
530
  },
531
  style: '<?php echo $script['style']; ?>',
532
  launchtarget: '<?php echo $script['launchtarget']; ?>',
533
- omitWeeks: '<?php echo $script['omitweeks']; ?>'
 
 
534
  <?php
535
  if($script['content']){
536
  echo ", onComplete: function() {
@@ -553,7 +703,7 @@ function tminuscountdown($atts, $content=null) {
553
  global $add_my_script;
554
  //find a random number, if no id was assigned
555
  $ran = rand(1, 10000);
556
-
557
  extract(shortcode_atts(array(
558
  'id' => $ran,
559
  't' => '',
@@ -572,18 +722,26 @@ function tminuscountdown($atts, $content=null) {
572
  'launchheight' => 'auto',
573
  'launchtarget' => 'countdown',
574
  'jsplacement' => 'footer',
 
575
  ), $atts));
576
-
577
  if(empty($t)){
578
  return;
579
  }
580
- //enqueue style that was already registerd
581
- wp_enqueue_style( 'countdown-'.$style.'-css' );
582
-
583
- //$now = time() + ( get_option( 'gmt_offset' ) * 3600);
 
 
 
 
 
 
 
584
  $now = strtotime(current_time('mysql'));
585
  $target = strtotime($t, $now);
586
-
587
  //difference in seconds
588
  $diffSecs = $target - $now;
589
 
@@ -593,21 +751,23 @@ function tminuscountdown($atts, $content=null) {
593
  $hour = date ( 'H', $target );
594
  $min = date ( 'i', $target );
595
  $sec = date ( 's', $target );
596
-
597
  //countdown digits
598
  $date_arr = array();
599
  $date_arr['secs'] = $diffSecs % 60;
600
  $date_arr['mins'] = floor($diffSecs/60)%60;
601
  $date_arr['hours'] = floor($diffSecs/60/60)%24;
602
-
603
  if($omitweeks == 'false'){
 
604
  $date_arr['days'] = floor($diffSecs/60/60/24)%7;
605
  }
606
  else{
607
- $date_arr['days'] = floor($diffSecs/60/60/24);
 
608
  }
609
  $date_arr['weeks'] = floor($diffSecs/60/60/24/7);
610
-
611
  foreach ($date_arr as $i => $d) {
612
  $d1 = $d%10;
613
  if($d < 100){
@@ -621,7 +781,7 @@ function tminuscountdown($atts, $content=null) {
621
  $d3 = $dm / 100;
622
  }
623
  /* here is where the 1000's support will go... someday. */
624
-
625
  //now assign all the digits to the array
626
  $date_arr[$i] = array(
627
  (int)$d3,
@@ -630,20 +790,21 @@ function tminuscountdown($atts, $content=null) {
630
  (int)$d
631
  );
632
  }
633
-
634
  if(is_numeric($width)){
635
  $width .= 'px';
636
  }
637
  if(is_numeric($height)){
638
  $height .= 'px';
639
  }
640
- $tminus = '<div id="'.$id.'-countdown" style="width:'.$width.'; height:'.$height.';">';
641
- $tminus .= '<div id="'.$id.'-above" class="'.$style.'-tophtml">';
 
642
  if($before){
643
- $tminus .= $before;
644
  }
645
  $tminus .= '</div>';
646
-
647
  //drop in the dashboard
648
  $tminus .= '<div id="'.$id.'-dashboard" class="'.$style.'-dashboard">';
649
  if($omitweeks == 'false'){
@@ -652,63 +813,60 @@ function tminuscountdown($atts, $content=null) {
652
  if($date_arr['weeks'][0] > 0){
653
  $wclass = $style.'-tripdash '.$style.'-weeks_trip_dash';
654
  }
655
-
656
- $tminus .= '<div class="'.$wclass.'"><span class="'.$style.'-dash_title">'.$weeks.'</span>';
657
  if($date_arr['weeks'][0] > 0){
658
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][0].'</div>';
659
  }
660
- $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][1].'</div><div class="'.$style.'-digit">'.$date_arr['weeks'][2].'</div></div>';
661
  }
662
-
663
  //set up correct style class for double or triple digit love
664
  $dclass = $style.'-dash '.$style.'-days_dash';
665
-
666
  if($omitweeks == 'true' && $date_arr['days'][3] > 99){
667
  $dclass = $style.'-tripdash '.$style.'-days_trip_dash';
668
  }
669
-
670
- $tminus .= '<div class="'.$dclass.'"><span class="'.$style.'-dash_title">'.$days.'</span>';
671
-
672
- //show third day digit if there are NO weeks and the number of days is greater that 99
673
- //var_dump($date_arr['days']); array(4) { [0]=> int(3) [1]=> int(3) [2]=> int(5) [3]=> int(335) }
674
  if($omitweeks == 'true' && $date_arr['days'][3] > 99){
675
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][0].'</div>';
676
  }
677
- $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][1].'</div><div class="'.$style.'-digit">'.$date_arr['days'][2].'</div>';
678
  $tminus .= '</div>';
679
  $tminus .= '<div class="'.$style.'-dash '.$style.'-hours_dash">';
680
- $tminus .= '<span class="'.$style.'-dash_title">'.$hours.'</span>';
681
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['hours'][1].'</div>';
682
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['hours'][2].'</div>';
683
  $tminus .= '</div>';
684
  $tminus .= '<div class="'.$style.'-dash '.$style.'-minutes_dash">';
685
- $tminus .= '<span class="'.$style.'-dash_title">'.$minutes.'</span>';
686
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['mins'][1].'</div>';
687
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['mins'][2].'</div>';
688
  $tminus .= '</div>';
689
  $tminus .= '<div class="'.$style.'-dash '.$style.'-seconds_dash">';
690
- $tminus .= '<span class="'.$style.'-dash_title">'.$seconds.'</span>';
691
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['secs'][1].'</div>';
692
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['secs'][2].'</div>';
693
  $tminus .= '</div>';
694
  $tminus .= '</div>'; //close the dashboard
695
 
696
- $tminus .= '<div id="'.$id.'-below" class="'.$style.'-bothtml">';
697
  if($after){
698
- $tminus .= $after;
699
  }
700
- $tminus .= '</div></div>';
701
-
702
- //$t = date( 'n/j/Y H:i:s', gmmktime() + ( get_option( 'gmt_offset' ) * 3600));
703
  $t = date( 'n/j/Y H:i:s', strtotime(current_time('mysql')) );
704
-
705
  if(is_numeric($launchwidth)){
706
  $launchwidth .= 'px';
707
  }
708
  if(is_numeric($launchheight)){
709
  $launchheight .= 'px';
710
  }
711
- //$content = mysql_real_escape_string( $content);
712
  $content = str_replace(array('\r\n', '\r', '\n<p>', '\n'), '', $content);
713
  $content = stripslashes($content);
714
  if($jsplacement == "footer"){
@@ -726,13 +884,14 @@ function tminuscountdown($atts, $content=null) {
726
  'content' => $content,
727
  'launchtarget' => $launchtarget,
728
  'launchwidth' => $launchwidth,
729
- 'launchheight' => $launchheight
 
730
  );
731
  }
732
  else{
733
  $tminus .= "<script language='javascript' type='text/javascript'>
734
  jQuery(document).ready(function($) {
735
- $('#".$id."-dashboard').countDown({
736
  targetDate: {
737
  'day': ".$day.",
738
  'month': ".$month.",
@@ -742,13 +901,15 @@ function tminuscountdown($atts, $content=null) {
742
  'sec': ".$sec."
743
  },
744
  style: '".$style."',
 
 
745
  launchtarget: '".$launchtarget."',
746
  omitWeeks: '".$omitweeks."'";
747
-
748
  if($content){
749
  $tminus .= ", onComplete: function() {
750
  $('#".$id."-".$launchtarget."').css({'width' : '".$launchwidth."', 'height' : '".$launchheight."'});
751
- $('#".$id."-".$launchtarget."').html('".do_shortcode($content)."');
752
  }";
753
  }
754
  $tminus .= "});
@@ -759,4 +920,17 @@ function tminuscountdown($atts, $content=null) {
759
  }
760
  add_shortcode('tminus', 'tminuscountdown');
761
 
762
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Domain Path: /languages
6
  Plugin URI: http://plugins.twinpictures.de/plugins/t-minus-countdown/
7
  Description: Display and configure multiple T(-) Countdown timers using a shortcode or sidebar widget.
8
+ Version: 2.3.0
9
  Author: twinpictures, baden03
10
  Author URI: http://www.twinpictures.de/
11
  License: GPL2
12
  */
13
 
14
+ //delete_option('WP_TMC_options');
15
+
16
+ class WP_TMinusCD {
17
+ var $plugin_name = 'T(-) Countdown';
18
+ var $version = '2.3.0';
19
+ var $domain = 'tminus';
20
+ var $plguin_options_page_title = 'T(-) Countdown Options';
21
+ var $plugin_options_menue_title = 'T(-) Countdown';
22
+ var $plugin_options_slug = 't-countdown';
23
+
24
+ var $options_name = 'WP_TMC_options';
25
+ /**
26
+ * @var array
27
+ */
28
+ var $options = array(
29
+ 'custom_css' => '',
30
+ 'rockstar' => '',
31
+ );
32
+
33
+ var $license_group = 'tminus_countdown_licenseing';
34
+ var $license_name = 'WP_tminus_countdown_license';
35
+
36
+ var $license_options = array(
37
+ 'tminus_event_license_key' => '',
38
+ 'tminus_event_license_status' => '',
39
+ );
40
+
41
+ function __construct() {
42
+ $this->_set_options();
43
+
44
+ // add actions
45
+ add_action( 'admin_menu', array( $this, 'admin_menu' ) );
46
+ add_action( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'plugin_actions' ) );
47
+ add_action( 'admin_init', array( $this, 'admin_init' ) );
48
+ add_action( 'wp_head', array( $this, 'plugin_head_inject' ) );
49
+ }
50
+
51
+ /**
52
+ * Callback admin_menu
53
+ */
54
+ function admin_menu() {
55
+ if ( function_exists( 'add_options_page' ) AND current_user_can( 'manage_options' ) ) {
56
+ // add options page
57
+ $options_page = add_options_page($this->plguin_options_page_title, $this->plugin_options_menue_title, 'manage_options', $this->plugin_options_slug, array( $this, 'options_page' ));
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Callback admin_init
63
+ */
64
+ function admin_init() {
65
+ register_setting( $this->domain, $this->options_name );
66
+ if( is_plugin_active( 't-countdown-events/t-countdown-events.php' ) ){
67
+ register_setting( $this->license_group, $this->license_name, array('WP_TminusEvents', 'edd_sanitize_license') );
68
+ }
69
+ }
70
+
71
+ // Add link to options page from plugin list
72
+ function plugin_actions($links) {
73
+ $new_links = array();
74
+ $new_links[] = '<a href="options-general.php?page='.$this->plugin_options_slug.'">' . __('Settings', $this->domain) . '</a>';
75
+ return array_merge($new_links, $links);
76
+ }
77
+
78
+ //plugin header inject
79
+ function plugin_head_inject(){
80
+ // custom css
81
+ if( !empty( $this->options['custom_css'] ) ){
82
+ echo "<style>\n";
83
+ echo $this->options['custom_css'];
84
+ echo "\n</style>\n";
85
  }
86
+ }
87
+
88
+ /**
89
+ * Admin options page
90
+ */
91
+ function options_page() {
92
+ $like_it_arr = array(
93
+ __('made you feel all warm and fuzzy on the inside', $this->domain),
94
+ __('restored your faith in humanity... even if only for a fleeting second', $this->domain),
95
+ __('rocked your world', 'provided a positive vision of future living', $this->domain),
96
+ __('inspired you to commit a random act of kindness', $this->domain),
97
+ __('encouraged more regular flossing of the teeth', $this->domain),
98
+ __('helped organize your life in the small ways that matter', $this->domain),
99
+ __('saved your minutes--if not tens of minutes--writing your own solution', $this->domain),
100
+ __('brightened your day... or darkened it if sleeping in', $this->domain),
101
+ __('caused you to dance a little jig of joy and joyousness', $this->domain),
102
+ __('inspired you to tweet a little @twinpictues social love', $this->domain),
103
+ __('tasted great, while also being less filling', $this->domain),
104
+ __('caused you to shout: "everybody spread love, give me some mo!"', $this->domain),
105
+ __('really tied the room together, Dude', $this->domain),
106
+ __('helped you keep the funk alive', $this->domain),
107
+ __('<a href="http://www.youtube.com/watch?v=dvQ28F5fOdU" target="_blank">soften hands while you do dishes</a>', $this->domain),
108
+ __('helped that little old lady <a href="http://www.youtube.com/watch?v=Ug75diEyiA0" target="_blank">find the beef</a>', $this->domain)
109
+ );
110
+ $rand_key = array_rand($like_it_arr);
111
+ $like_it = $like_it_arr[$rand_key];
112
+
113
+ $share_it_arr = array(
114
+ 'http://www.facebook.com/twinpictures',
115
+ 'http://twitter.com/twinpictures',
116
+ 'http://plus.google.com/+TwinpicturesDe',
117
+ 'https://wordpress.org/support/view/plugin-reviews/jquery-t-countdown-widget'
118
+ );
119
+ $rand_key = array_rand($share_it_arr);
120
+ $share_it = $share_it_arr[$rand_key];
121
+
122
+ ?>
123
+ <div class="wrap">
124
+ <h2><?php echo $this->plguin_options_page_title; ?></h2>
125
+ </div>
126
+
127
+ <div class="postbox-container metabox-holder meta-box-sortables" style="width: 69%">
128
+ <div style="margin:0 5px;">
129
+ <div class="postbox">
130
+ <div class="handlediv" title="<?php _e( 'Click to toggle', $this->domain ) ?>"><br/></div>
131
+ <h3 class="handle"><?php _e( 'T(-) Countdown Settings', $this->domain ) ?></h3>
132
+ <div class="inside">
133
+ <form method="post" action="options.php">
134
+ <?php
135
+ settings_fields( $this->domain );
136
+ $options = $this->options;
137
+ ?>
138
+
139
+ <table class="form-table">
140
+ <tr>
141
+ <th><?php _e( 'Rockstar Features', $this->domain ) ?>:</th>
142
+ <td><label><input type="checkbox" id="<?php echo $this->options_name ?>[rockstar]" name="<?php echo $this->options_name ?>[rockstar]" value="rockstar" <?php echo checked( $options['rockstar'], 'rockstar' ); ?> /> <?php _e('Enable', $this->domain); ?>
143
+ <br /><span class="description"><?php _e('Enable rockstar features.', $this->domain); ?></span></label>
144
+ </td>
145
+ </tr>
146
+
147
+ <tr>
148
+ <th><?php _e( 'Custom CSS', $this->domain ) ?>:</th>
149
+ <td><label><textarea id="<?php echo $this->options_name ?>[custom_css]" name="<?php echo $this->options_name ?>[custom_css]" style="width: 100%; height: 537px;"><?php echo $options['custom_css']; ?></textarea>
150
+ <br /><span class="description"><?php _e( 'Custom CSS style for <em>ultimate flexibility</em>', $this->domain ) ?></span></label>
151
+ </td>
152
+ </tr>
153
+ </table>
154
+ <p class="submit" style="margin-bottom: 20px;">
155
+ <input class="button-primary" type="submit" value="<?php _e( 'Save Changes', $this->domain ) ?>" style="float: right;" />
156
+ </p>
157
+ </form>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ </div>
162
+
163
+ <div class="postbox-container side metabox-holder" style="width:29%;">
164
+ <div style="margin:0 5px;">
165
+ <div class="postbox">
166
+ <h3><?php _e( 'About' ) ?></h3>
167
+ <div class="inside">
168
+ <h4><?php echo $this->plugin_name; ?> <?php _e('Version', $this->domain); ?> <?php echo $this->version; ?></h4>
169
+ <p><?php _e( 'T(-) Countdown is a highly customizable, HTML5 countdown timer that can be displayed as a sidebar widget or in a post or page using a shortcode.', $this->domain) ?></p>
170
+ <ul>
171
+ <li><?php printf( __( '%sDetailed documentation%s, complete with working demonstrations of all shortcode attributes, is availabel for your instructional enjoyment.', 'tminus'), '<a href="http://plugins.twinpictures.de/plugins/t-minus-countdown/documentation/" target="_blank">', '</a>'); ?></li>
172
+ <li><?php printf( __( 'A %sCommunity translation%s tool has been set up that allows anyone to assist in translating T(-) Countdown. All are %swelcome to participate%s.', 'tminus'), '<a href="http://translate.twinpictures.de/projects/t-countdown" target="_blank">', '</a>', '<a href="http://translate.twinpictures.de/wordpress/wp-login.php?action=register" target="_blank">', '</a>' ); ?></li>
173
+ <li><?php printf( __( 'If this plugin %s, please consider %ssharing your story%s with others.', 'tminus'), $like_it, '<a href="'.$share_it.'" target="_blank">', '</a>' ) ?></li>
174
+ <li><a href="https://wordpress.org/plugins/jquery-t-countdown-widget/" target="_blank">WordPress.org</a> | <a href="http://plugins.twinpictures.de/plugins/t-minus-countdown/" target="_blank">Twinpictues Plugin Oven</a></li>
175
+ </ul>
176
+ </ul>
177
+ </div>
178
+ </div>
179
+ </div>
180
+ </div>
181
+
182
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
183
+ <div style="margin:0 5px;">
184
+ <div class="postbox">
185
+ <div class="handlediv" title="<?php _e( 'Click to toggle' ) ?>"><br/></div>
186
+ <h3 class="handle"><?php _e( 'T(-) Countdown Control' ) ?></h3>
187
+ <div class="inside">
188
+ <p><?php printf(__( '%sT(-) Countdown Control%s is our premium plugin that manages and schedules multiple recurring countdown timers for repeating events.', 'tminus' ), '<a href="http://plugins.twinpictures.de/premium-plugins/t-minus-countdown-control/?utm_source=t-countdown&utm_medium=plugin-settings-page&utm_content=t-countdown&utm_campaign=t-control-sidebar">', '</a>'); ?></p>
189
+ <h4><?php _e('Reasons To Go Pro', 'tminus'); ?></h4>
190
+ <ol>
191
+ <li><?php _e('Schedule and manage multiple recurring countdowns', 'tminus'); ?></li>
192
+ <li><?php _e('Highly responsive professional support', 'tminus'); ?></li>
193
+ <li><?php printf(__('%sT(-) Countdown Control Testimonials%s', 'tminus'), '<a href="http://plugins.twinpictures.de/testimonial/t-countdown-control-testimonias/" target="_blank">', '</a>'); ?></li>
194
+ </ol>
195
+ </div>
196
+ </div>
197
+ </div>
198
+ <div class="clear"></div>
199
+ </div>
200
+
201
+ <?php if( is_plugin_active( 't-countdown-events/t-countdown-events.php' ) ) : ?>
202
+
203
+ <div class="postbox-container side metabox-holder" style="width:29%;">
204
+ <div style="margin:0 5px;">
205
+ <div class="postbox">
206
+ <h3 class="handle"><?php _e( 'Register T(-) Countdown Events', $this->domain) ?></h3>
207
+ <div class="inside">
208
+ <p><?php printf( __('To receive plugin updates you must register your plugin. Enter your T(-) Countdown Events licence key below. Licence keys may be viewed and managed by logging into %syour account%s.', $this->domain), '<a href="http://plugins.twinpictures.de/your-account/" target="_blank">', '</a>'); ?></p>
209
+ <form method="post" action="options.php">
210
+ <?php
211
+ settings_fields( $this->license_group );
212
+ $options = get_option($this->license_name);
213
+ $tce_licence = ( !isset( $options['tminus_event_license_key'] ) ) ? '' : $options['tminus_event_license_key'];
214
+ ?>
215
+ <fieldset>
216
+ <table style="width: 100%">
217
+ <tbody>
218
+ <tr>
219
+ <th><?php _e( 'License Key', $this->domain ) ?>:</th>
220
+ <td><label for="<?php echo $this->license_name ?>[tminus_event_license_key]"><input type="password" id="<?php echo $this->license_name ?>[tminus_event_license_key]" name="<?php echo $this->license_name ?>[tminus_event_license_key]" value="<?php esc_attr_e( $tce_licence ); ?>" style="width: 100%" />
221
+ <br /><span class="description"><?php _e('Enter your license key', $this->domain); ?></span></label>
222
+ </td>
223
+
224
+ </tr>
225
+
226
+ <?php if( isset($options['tminus_event_license_key']) ) { ?>
227
+ <tr valign="top">
228
+ <th><?php _e('License Status', $this->domain); ?>:</th>
229
+ <td>
230
+ <?php if( isset($options['tminus_event_license_status']) && $options['tminus_event_license_status'] == 'valid' ) { ?>
231
+ <span style="color:green;"><?php _e('active'); ?></span><br/>
232
+ <input type="submit" class="button-secondary" name="edd_tce_license_deactivate" value="<?php _e('Deactivate License'); ?>"/>
233
+ <?php } else {
234
+ if( isset($options['tminus_event_license_status'])){ ?>
235
+ <span style="color: red"><?php echo $options['tminus_event_license_status']; ?></span><br/>
236
+ <?php } else { ?>
237
+ <span style="color: grey">inactive</span><br/>
238
+ <?php } ?>
239
+ <input type="submit" class="button-secondary" name="edd_tce_license_activate" value="<?php _e('Activate License'); ?>"/>
240
+ <?php } ?>
241
+ </td>
242
+ </tr>
243
+ <?php } ?>
244
+ </tbody>
245
+ </table>
246
+ </fieldset>
247
+ <?php submit_button( __( 'Register', $this->domain) ); ?>
248
+ </form>
249
+ </div>
250
+ </div>
251
+ </div>
252
+ </div>
253
+ <?php else: ?>
254
+ <div class="postbox-container side metabox-holder meta-box-sortables" style="width:29%;">
255
+ <div style="margin:0 5px;">
256
+ <div class="postbox">
257
+ <div class="handlediv" title="<?php _e( 'Click to toggle', 'colomat' ) ?>"><br/></div>
258
+ <h3 class="hndle">T(-) Countdown Events</h3>
259
+ <div class="inside">
260
+ <p><?php printf( __('%sT(-) Countdown Events%s is a new add-on plugin for T(-) Countdown Control that adds multiple event scheduling. Trigger events, such as changing content or firing a javascript function at specific times while the countdown is running.', $this->domain), '<a href="http://plugins.twinpictures.de/premium-plugins/t-countdown-events/?utm_source=t-countdown&utm_medium=plugin-settings-page&utm_content=t-countdown&utm_campaign=t-events-sidebar" target="_blank">', '</a>'); ?></p>
261
+ </div>
262
+ </div>
263
+ </div>
264
+ <div class="clear"></div>
265
+ </div>
266
+ <?php endif; ?>
267
+ <?php
268
+ }
269
+
270
+ function _set_options() {
271
+ // set options
272
+ $saved_options = get_option( $this->options_name );
273
+
274
+ // set all options
275
+ if ( ! empty( $saved_options ) ) {
276
+ foreach ( $this->options AS $key => $option ) {
277
+ $this->options[ $key ] = ( empty( $saved_options[ $key ] ) ) ? '' : $saved_options[ $key ];
278
+ }
279
+ }
280
+ }
281
+
282
  }
283
+ $WP_TMinusCD = new WP_TMinusCD;
284
 
285
  //set global vars
286
  add_action( 'wp_head', 'tminus_js_vars' );
290
  echo "var tminusnow = '".$plugin_url."/js/now.php';\n";
291
  echo "</script>";
292
  }
293
+
294
  //load scripts on the widget admin page
295
  add_action( 'admin_enqueue_scripts', 'tminus_admin_scripts');
296
+ function tminus_admin_scripts($hook){
297
  if( $hook == 'widgets.php' ){
298
  //jquery datepicker
299
  wp_enqueue_script( 'jquery-ui-datepicker' );
300
+ wp_enqueue_script( 'jquery-ui-slider' );
301
+
302
+ wp_register_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css', array (), '1.10.4' );
303
  wp_enqueue_style('jquery-ui-css');
304
+
305
+
306
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
307
+
308
  //jquery widget scripts
309
+ wp_register_script('jquery-ui-timepicker-addon', $plugin_url.'/js/jquery-ui-timepicker-addon.min.js', array ('jquery'), '1.5.2', true);
310
+ wp_enqueue_script('jquery-ui-timepicker-addon');
311
+
312
+ wp_register_script('tminus-admin-script', $plugin_url.'/js/jquery.collapse.js', array ('jquery', 'jquery-ui-datepicker', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), '1.2.2', true);
313
  wp_enqueue_script('tminus-admin-script');
314
+
315
+ wp_register_style('collapse-admin-css', $plugin_url.'/admin/collapse-style.css' );
316
  wp_enqueue_style('collapse-admin-css');
317
  }
318
  }
321
  add_action('wp_enqueue_scripts', 'countdown_scripts' );
322
  function countdown_scripts(){
323
  $plugin_url = plugins_url() .'/'. dirname( plugin_basename(__FILE__) );
324
+
325
  //lwtCountdown script
326
+ wp_register_script('countdown-script', $plugin_url.'/js/jquery.t-countdown.js', array ('jquery'), '1.5.4', 'true');
327
  wp_enqueue_script('countdown-script');
328
+
329
+ // callback for t(-) events if installed
330
+ if( is_plugin_active( 't-countdown-events/t-countdown-events.php' ) ){
331
+ wp_localize_script( 'countdown-script', 'tCountAjax', array(
332
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
333
+ 'countdownNonce' => wp_create_nonce( 'tountajax-countdownonce-nonce' ),
334
+ ));
335
  }
336
+
337
  }
338
 
339
  //style folders array
342
  $dh = opendir($path);
343
  $exclude_array = explode("|", $exclude);
344
  $result = array();
345
+ while(false !==($file = readdir($dh))) {
346
+ if( !in_array(strtolower($file), $exclude_array) && substr($file, 0, 1) != '.' ){
347
  $result[] = $file;
348
  }
349
  }
350
  closedir($dh);
351
+ print_r($result);
352
  return $result;
353
  }
354
  }
359
  class CountDownTimer extends WP_Widget {
360
  /** constructor */
361
  function CountDownTimer() {
362
+ load_plugin_textdomain( 'tminus', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
363
+ $widget_ops = array('classname' => 'CountDownTimer', 'description' => __('A highly customizable jQuery countdown timer by Twinpictures', 'tminus') );
364
+ $this->WP_Widget('CountDownTimer', 'T(-) Countdown', $widget_ops);
365
  }
366
+
367
  /** Widget */
368
  function widget($args, $instance) {
369
+ global $add_my_script;
370
+ extract( $args );
371
+
372
+ if(empty($instance['id'])){
373
+ $instance['id'] = $args['widget_id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  }
375
+
376
+ if( empty($instance['t']) ){
377
+ //ancient
378
+ if( !empty($instance['year']) ){
379
+ $instance['t'] = $instance['year'].'-'.$instance['month'].'-'.$instance['day'].' '.$instance['hour'].':'.$instance['min'].':'.$instance['sec'];
380
+ $instance['year'] = '';
381
+ $instance['month'] = '';
382
+ $instance['day'] = '';
383
+ $instance['hour'] = '';
384
+ $instance['min'] = '';
385
+ $instance['sec'] = '';
386
+ }
387
+ //old
388
+ else if( !empty( $instance['date'] )){
389
+ $instance['t'] = $instance['date'].' '.$instance['hour'].':'.$instance['min'].':'.$instance['sec'];
390
+ $instance['date'] = '';
391
+ $instance['hour'] = '';
392
+ $instance['min'] = '';
393
+ $instance['sec'] = '';
 
 
 
 
 
 
 
 
 
 
 
 
394
  }
395
+ //empty
396
+ else{
397
+ $instance['t'] = '2015-05-04 12:00:00';
 
 
 
398
  }
 
 
 
399
  }
400
+
401
+ if(!empty($instance['tophtml'])){
402
+ $instance['before'] = $instance['tophtml'];
403
+ $instance['tophtml'] = '';
 
404
  }
405
+
406
+ if(!empty($instance['bothtml'])){
407
+ $instance['after'] = $instance['bothtml'];
408
+ $instance['bothtml'] = '';
 
 
409
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
410
 
411
+ $content = '';
412
+ if(!empty($instance['launchhtml'])){
413
+ $content = $instance['launchhtml'];
414
+ $instance['launchhtml'] = '';
415
+ }
416
+
417
+ echo $args['before_widget'];
418
+
419
+ if ( !empty($instance['title']) ){
420
+ echo $args['before_title']. $instance['title'] . $args['after_title'];
421
+ }
422
+
423
+ $sc_atts = '';
424
+ foreach($instance AS $key => $value){
425
+ if(!empty($value)){
426
+ $sc_atts .= $key . '="'.$value.'" ';
427
+ }
428
+ }
429
+
430
+ echo do_shortcode('[tminus '.$sc_atts.']'.$content.'[/tminus]');
431
+
432
+ echo $args['after_widget'];
433
+ }
434
+
435
+ function get_styles($custom_css = null) {
436
+ //default styles
437
+ $styles_arr = folder_array(WP_PLUGIN_DIR.'/'. dirname( plugin_basename(__FILE__) ).'/css');
438
+ if( !empty( $custom_css ) ){
439
+ preg_match_all("/.(\w+)-dashboard/", $custom_css, $custom_styles);
440
+ $styles_arr = array_merge($styles_arr, $custom_styles[1]);
441
+ }
442
+ natcasesort($styles_arr);
443
+ return $styles_arr;
444
+
445
+ }
446
+
447
+ function update( $new_instance, $old_instance ) {
448
+ $instance = array_merge($old_instance, $new_instance);
449
+
450
+ $instance['title'] = (empty( $new_instance['title'])) ? '' : strip_tags( $new_instance['title'] );
451
+ $instance['omitweeks'] = (empty($new_instance['omitweeks'])) ? '' : $new_instance['omitweeks'];
452
+ $instance['jsplacement'] = (empty($new_instance['jsplacement'])) ? '' : $new_instance['jsplacement'];
453
+
454
+ return $instance;
 
 
 
 
 
 
 
 
 
 
 
455
  }
 
 
456
 
457
  /** Form */
458
+ function form($instance) {
459
+ $options = get_option('WP_TMC_options');
460
+
461
+ extract(shortcode_atts(array(
462
+ 'title' => '',
463
+ 'id' => '',
464
+ 't' => '',
465
+ 'weeks' => '',
466
+ 'days' => '',
467
+ 'hours' => '',
468
+ 'minutes' => '',
469
+ 'seconds' => '',
470
+ 'omitweeks' => '',
471
+ 'style' => 'jedi',
472
+ 'before' => '',
473
+ 'after' => '',
474
+ 'width' => '',
475
+ 'height' => '',
476
+ 'launchwidth' => '',
477
+ 'launchheight' => '',
478
+ 'launchtarget' => 'countdown',
479
+ 'jsplacement' => '',
480
+ 'event_id' => '',
481
+ ), $instance));
482
+
483
+ //var_dump($instance);
484
+ if( empty($t) ){
485
+ //ancient
486
+ if( !empty($instance['year']) ){
487
+ $t = $instance['year'].'-'.$instance['month'].'-'.$instance['day'].' '.$instance['hour'].':'.$instance['min'].':'.$instance['sec'];
488
+ }
489
+ //old
490
+ else if( !empty( $instance['date'] )){
491
+ $t = $instance['date'].' '.$instance['hour'].':'.$instance['min'].':'.$instance['sec'];
492
+ }
493
+ }
494
+
495
+ //old values remove in a few versions
496
+ if(!empty($instance['jsplacement']) && $instance['jsplacement'] == 'footer'){
497
+ $jsplacement = '';
498
+ }
499
+ if(!empty($instance['weektitle'])){
500
+ $weeks = $instance['weektitle'];
501
+ }
502
+ if(!empty($instance['daytitle'])){
503
+ $days = $instance['daytitle'];
504
+ }
505
+ if(!empty($instance['hourtitle'])){
506
+ $hours = $instance['hourtitle'];
507
+ }
508
+ if(!empty($instance['mintitle'])){
509
+ $minutes = $instance['mintitle'];
510
+ }
511
+ if(!empty($instance['sectitle'])){
512
+ $seconds = $instance['sectitle'];
513
+ }
514
+
515
+ $isrockstar = empty($options['rockstar']) ? '' : $options['rockstar'];
516
+
517
  //rockstar features
518
+ if($isrockstar){
519
+ $tophtml = empty($instance['tophtml']) ? '' : apply_filters('widget_tophtml', stripslashes($instance['tophtml']));
520
+ $bothtml = empty($instance['bothtml']) ? '' : apply_filters('widget_bothtml', stripslashes($instance['bothtml']));
521
+ $launchhtml = empty($instance['launchhtml']) ? '' : apply_filters('widget_launchhtml', stripslashes($instance['launchhtml']));
522
+
523
+ //old values - remove in a vew versions
524
+ if($launchtarget == 'Above Countdown'){
525
+ $launchtarget = 'above';
526
+ }
527
+ else if($launchtarget == 'Below Countdown'){
528
+ $launchtarget = 'below';
529
+ }
530
+ else if($launchtarget == 'Entire Widget'){
531
+ $launchtarget = 'countdown';
532
+ }
533
+ else if($launchtarget == 'Count Up'){
534
+ $launchtarget = 'countup';
535
+ }
536
+ }
537
+ ?>
538
+ <p><label><?php _e('Title:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label></p>
539
+
540
+ <p><label><?php _e('Target:', 'tminus'); ?> <input style="width: 230px;" id="<?php echo $this->get_field_id('t'); ?>" name="<?php echo $this->get_field_name('t'); ?>" type="text" value="<?php echo $t; ?>" class="t-datepicker"/></label></p>
541
  <?php
542
+ if( is_plugin_active( 't-countdown-events/t-countdown-events.php' ) ){
543
+ echo '<p><label>Event: <select name="'.$this->get_field_name('event_id').'" id="'.$this->get_field_name('event_id').'">';
544
+ echo '<option value="">'.__('Select Event', 'tminus').'</option>';
545
+ $args = array(
546
+ 'post_type' => 't-countdown-events',
547
+ 'posts_per_page' => -1,
548
+ 'post_parent' => 0
549
+ );
550
+ $event_query = new WP_Query($args);
551
+
552
+ while ($event_query->have_posts()) : $event_query->the_post();
553
+ $eventID = get_the_ID();
554
+ $selected = "";
555
+ if($event_id == $eventID){
556
+ $selected = 'SELECTED';
557
+ }
558
+ echo '<option value="'.$eventID.'" '.$selected.'>'.get_the_title().'</option>';
559
+ endwhile;
560
+ wp_reset_postdata();
561
+ echo '</select></p>';
562
+ }
563
  ?>
 
564
  <p><?php _e('Style:', 'tminus'); ?> <select name="<?php echo $this->get_field_name('style'); ?>" id="<?php echo $this->get_field_name('style'); ?>">
565
+ <?php
566
+ $styles_arr = $this->get_styles($options['custom_css']);
567
+ foreach($styles_arr as $style_name){
568
+ $selected = "";
569
+ if($style == $style_name){
570
+ $selected = 'SELECTED';
571
+ }
572
+ echo '<option value="'.$style_name.'" '.$selected.'>'.$style_name.'</option>';
573
  }
574
+ ?>
575
+ </select></p>
576
+
577
+ <p><label><input type="checkbox" id="<?php echo $this->get_field_id('omitweeks'); ?>" name="<?php echo $this->get_field_name('omitweeks'); ?>" value="true" <?php echo checked( $omitweeks, 'true' ); ?> /> <?php _e('Omit weeks from timer.', 'tminus'); ?></label></p>
578
+
579
+ <p><label><input type="checkbox" id="<?php echo $this->get_field_id('jsplacement'); ?>" name="<?php echo $this->get_field_name('jsplacement'); ?>" value="inline" <?php echo checked( $jsplacement, 'inline' ); ?> /> <?php _e('Inject JavaScript Inline.', 'tminus'); ?></label></p>
580
+
581
  <?php
582
+ echo '<h3>'.__('Rockstar Features', 'tminus').'</h3>';
583
+ if($isrockstar){
584
+ ?>
585
+ <a class="collapseomatic" id="tophtml<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Above Countdown', 'tminus'); ?></a>
586
+ <div id="target-tophtml<?php echo $this->get_field_id('tophtml'); ?>" class="collapseomatic_content">
587
+ <p><label for="<?php echo $this->get_field_id('tophtml'); ?>"><?php _e('Top HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('tophtml'); ?>" name="<?php echo $this->get_field_name('tophtml'); ?>"><?php echo $tophtml; ?></textarea></p>
588
+ </div>
589
+ <br/>
590
+ <a class="collapseomatic" id="bothtml<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Below Countdown', 'tminus'); ?></a>
591
+ <div id="target-bothtml<?php echo $this->get_field_id('bothtml'); ?>" class="collapseomatic_content">
592
+ <p><label for="<?php echo $this->get_field_id('bothtml'); ?>"><?php _e('Bottom HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('bothtml'); ?>" name="<?php echo $this->get_field_name('bothtml'); ?>"><?php echo $bothtml; ?></textarea></p>
593
+ </div>
594
+ <br/>
595
+ <a class="collapseomatic" id="launchhtml<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('When Countdown Reaches Zero', 'tminus'); ?></a>
596
+ <div id="target-launchhtml<?php echo $this->get_field_id('launchhtml'); ?>" class="collapseomatic_content">
597
+ <p><label for="<?php echo $this->get_field_id('launchhtml'); ?>"><?php _e('Launch Event HTML:', 'tminus'); ?></label> <textarea id="<?php echo $this->get_field_id('launchhtml'); ?>" name="<?php echo $this->get_field_name('launchhtml'); ?>"><?php echo $launchhtml; ?></textarea></p>
598
+ <p><?php _e('Launch Target:', 'tminus'); ?> <select name="<?php echo $this->get_field_name('launchtarget'); ?>" id="<?php echo $this->get_field_name('launchtarget'); ?>">
599
+ <?php
600
+ $target_arr = array(
601
+ 'tophtml' => __('Above Countdown', 'tminus'),
602
+ 'bothtml' => __('Below Countdown', 'tminus'),
603
+ 'countdown' => __('Entire Countdown', 'tminus'),
604
+ 'countup' => __('Count Up', 'tminus')
605
+ );
606
+ foreach($target_arr as $key => $val){
607
+ $selected = "";
608
+ if($launchtarget == $key){
609
+ $selected = 'SELECTED';
610
+ }
611
+ echo '<option value="'.$key.'" '.$selected.'>'.$val.'</option>';
612
+ }
613
+ ?>
614
+ </select></p>
615
+ </div>
616
+ <br/>
617
+ <a class="collapseomatic" id="titles<?php echo $this->get_field_id('weeks'); ?>"><?php _e('Digit Titles', 'tminus'); ?></a>
618
+ <div id="target-titles<?php echo $this->get_field_id('weeks'); ?>" class="collapseomatic_content">
619
+ <p><label for="<?php echo $this->get_field_id('weeks'); ?>"><?php _e('How do you spell "weeks"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('weeks'); ?>" name="<?php echo $this->get_field_name('weeks'); ?>" type="text" value="<?php echo $weeks; ?>" /></label></p>
620
+ <p><label for="<?php echo $this->get_field_id('days'); ?>"><?php _e('How do you spell "days"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('days'); ?>" name="<?php echo $this->get_field_name('days'); ?>" type="text" value="<?php echo $days; ?>" /></label></p>
621
+ <p><label for="<?php echo $this->get_field_id('hours'); ?>"><?php _e('How do you spell "hours"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('hours'); ?>" name="<?php echo $this->get_field_name('hours'); ?>" type="text" value="<?php echo $hours; ?>" /></label></p>
622
+ <p><label for="<?php echo $this->get_field_id('minutes'); ?>"><?php _e('How do you spell "minutes"?:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('minutes'); ?>" name="<?php echo $this->get_field_name('minutes'); ?>" type="text" value="<?php echo $minutes; ?>" /></label></p>
623
+ <p><label for="<?php echo $this->get_field_id('seconds'); ?>"><?php _e('And "seconds" are spelled:', 'tminus'); ?> <input class="widefat" id="<?php echo $this->get_field_id('seconds'); ?>" name="<?php echo $this->get_field_name('seconds'); ?>" type="text" value="<?php echo $seconds; ?>" /></label></p>
624
+ </div>
625
+
626
+ <?php
627
+ }
628
+ else{
629
  $like_it_arr = array('makes me feel warm and fuzzy inside... in a good way', 'restores my faith in humanity... if only for a fleating second', 'rocked my world and is totally worth 3 bucks', 'offered me a positive vision of future living', 'inspires me to commit random acts of kindness', 'helped organize my life in one of the small ways that matter', 'saved me minutes if not tens of minutes writing your own solution', 'brightened my day... or darkened it since I wanted to sleep in anyway', 'is totally worth 3 bucks');
630
  $rand_key = array_rand($like_it_arr);
631
  $like_it = $like_it_arr[$rand_key];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
632
  ?>
633
+ <p>
634
+ <?php printf( __('T(-) Countdown %s!', 'tminus'), $like_it); ?>
635
+ <a href="options-general.php?page=t-countdown"><?php _e('Enable Rockstar Features', 'tminus'); ?></a>
636
+ </p>
637
+ <?php } //end if not rockstar ?>
638
+
639
  <br/>
640
  <a class="collapseomatic" id="tccc<?php echo $this->get_field_id('isrockstar'); ?>"><?php _e('Schedule Recurring Countdown', 'tminus'); ?></a>
641
  <div id="target-tccc<?php echo $this->get_field_id('isrockstar'); ?>" class="collapseomatic_content">
642
+ <p><?php printf(__('%sT(-) Countdown Control%s is a premium countdown plugin that includes the ability to schedule and manage multiple recurring T(-) Countdowns... the Jedi way.', 'tminus'), '<a href="http://plugins.twinpictures.de/premium-plugins/t-minus-countdown-control/?utm_source=t-countdown&utm_medium=widget-settings&utm_content=t-countdown-control&utm_campaign=t-countdown-widget" target="blank" title="(-) Countdown Control">', '</a>'); ?></p>
643
  </div>
644
+ <br/><br/>
645
  <?php
646
  }
647
  } // class CountDownTimer
652
 
653
  //code for the footer
654
  add_action('wp_footer', 'print_my_script', 99);
655
+
656
  function print_my_script() {
657
  global $add_my_script;
658
  if ( ! $add_my_script ){
659
  return;
660
  }
661
+
662
  ?>
663
  <script language="javascript" type="text/javascript">
664
  jQuery(document).ready(function($) {
666
  //var_dump('hey dude', $add_my_script);
667
  foreach((array) $add_my_script as $script){
668
  ?>
669
+ $('#<?php echo $script['id']; ?>-dashboard').countDown({
670
  targetDate: {
671
  'day': <?php echo $script['day']; ?>,
672
  'month': <?php echo $script['month']; ?>,
675
  'min': <?php echo $script['min']; ?>,
676
  'sec': <?php echo $script['sec']; ?>,
677
  'localtime': '<?php echo $script['localtime']; ?>',
 
 
 
678
  },
679
  style: '<?php echo $script['style']; ?>',
680
  launchtarget: '<?php echo $script['launchtarget']; ?>',
681
+ omitWeeks: '<?php echo $script['omitweeks']; ?>',
682
+ id: '<?php echo $script['id']; ?>',
683
+ event_id: '<?php echo $script['event_id']; ?>'
684
  <?php
685
  if($script['content']){
686
  echo ", onComplete: function() {
703
  global $add_my_script;
704
  //find a random number, if no id was assigned
705
  $ran = rand(1, 10000);
706
+
707
  extract(shortcode_atts(array(
708
  'id' => $ran,
709
  't' => '',
722
  'launchheight' => 'auto',
723
  'launchtarget' => 'countdown',
724
  'jsplacement' => 'footer',
725
+ 'event_id' => '',
726
  ), $atts));
727
+
728
  if(empty($t)){
729
  return;
730
  }
731
+
732
+ //insert some style into your life
733
+ $style_file_url = plugins_url('/css/'.$style.'/style.css', __FILE__);
734
+
735
+ if ( file_exists( __DIR__ .'/css/'.$style.'/style.css' ) ) {
736
+ if (! wp_style_is( 'countdown-'.$style.'-css', 'registered' )) {
737
+ wp_register_style( 'countdown-'.$style.'-css', $style_file_url, array(), '2.0');
738
+ }
739
+ wp_enqueue_style( 'countdown-'.$style.'-css' );
740
+ }
741
+
742
  $now = strtotime(current_time('mysql'));
743
  $target = strtotime($t, $now);
744
+
745
  //difference in seconds
746
  $diffSecs = $target - $now;
747
 
751
  $hour = date ( 'H', $target );
752
  $min = date ( 'i', $target );
753
  $sec = date ( 's', $target );
754
+
755
  //countdown digits
756
  $date_arr = array();
757
  $date_arr['secs'] = $diffSecs % 60;
758
  $date_arr['mins'] = floor($diffSecs/60)%60;
759
  $date_arr['hours'] = floor($diffSecs/60/60)%24;
760
+
761
  if($omitweeks == 'false'){
762
+ $dash_omitweeks_class = '';
763
  $date_arr['days'] = floor($diffSecs/60/60/24)%7;
764
  }
765
  else{
766
+ $dash_omitweeks_class = 'omitweeks';
767
+ $date_arr['days'] = floor($diffSecs/60/60/24);
768
  }
769
  $date_arr['weeks'] = floor($diffSecs/60/60/24/7);
770
+
771
  foreach ($date_arr as $i => $d) {
772
  $d1 = $d%10;
773
  if($d < 100){
781
  $d3 = $dm / 100;
782
  }
783
  /* here is where the 1000's support will go... someday. */
784
+
785
  //now assign all the digits to the array
786
  $date_arr[$i] = array(
787
  (int)$d3,
790
  (int)$d
791
  );
792
  }
793
+
794
  if(is_numeric($width)){
795
  $width .= 'px';
796
  }
797
  if(is_numeric($height)){
798
  $height .= 'px';
799
  }
800
+ $tminus = '<div id="'.$id.'-countdown" class="tminus_countdown" style="width:'.$width.'; height:'.$height.';">';
801
+ $tminus .= '<div class="'.$style.'-countdown '.$dash_omitweeks_class.'">';
802
+ $tminus .= '<div id="'.$id.'-tophtml" class="'.$style.'-tophtml">';
803
  if($before){
804
+ $tminus .= $before;
805
  }
806
  $tminus .= '</div>';
807
+
808
  //drop in the dashboard
809
  $tminus .= '<div id="'.$id.'-dashboard" class="'.$style.'-dashboard">';
810
  if($omitweeks == 'false'){
813
  if($date_arr['weeks'][0] > 0){
814
  $wclass = $style.'-tripdash '.$style.'-weeks_trip_dash';
815
  }
816
+
817
+ $tminus .= '<div class="'.$wclass.'"><div class="'.$style.'-dash_title">'.$weeks.'</div>';
818
  if($date_arr['weeks'][0] > 0){
819
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][0].'</div>';
820
  }
821
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['weeks'][1].'</div><div class="'.$style.'-digit">'.$date_arr['weeks'][2].'</div></div>';
822
  }
823
+
824
  //set up correct style class for double or triple digit love
825
  $dclass = $style.'-dash '.$style.'-days_dash';
826
+
827
  if($omitweeks == 'true' && $date_arr['days'][3] > 99){
828
  $dclass = $style.'-tripdash '.$style.'-days_trip_dash';
829
  }
830
+
831
+ $tminus .= '<div class="'.$dclass.'"><div class="'.$style.'-dash_title">'.$days.'</div>';
832
+
 
 
833
  if($omitweeks == 'true' && $date_arr['days'][3] > 99){
834
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][0].'</div>';
835
  }
836
+ $tminus .= '<div class="'.$style.'-digit">'.$date_arr['days'][1].'</div><div class="'.$style.'-digit">'.$date_arr['days'][2].'</div>';
837
  $tminus .= '</div>';
838
  $tminus .= '<div class="'.$style.'-dash '.$style.'-hours_dash">';
839
+ $tminus .= '<div class="'.$style.'-dash_title">'.$hours.'</div>';
840
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['hours'][1].'</div>';
841
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['hours'][2].'</div>';
842
  $tminus .= '</div>';
843
  $tminus .= '<div class="'.$style.'-dash '.$style.'-minutes_dash">';
844
+ $tminus .= '<div class="'.$style.'-dash_title">'.$minutes.'</div>';
845
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['mins'][1].'</div>';
846
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['mins'][2].'</div>';
847
  $tminus .= '</div>';
848
  $tminus .= '<div class="'.$style.'-dash '.$style.'-seconds_dash">';
849
+ $tminus .= '<div class="'.$style.'-dash_title">'.$seconds.'</div>';
850
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['secs'][1].'</div>';
851
  $tminus .= '<div class="'.$style.'-digit">'.$date_arr['secs'][2].'</div>';
852
  $tminus .= '</div>';
853
  $tminus .= '</div>'; //close the dashboard
854
 
855
+ $tminus .= '<div id="'.$id.'-bothtml" class="'.$style.'-bothtml">';
856
  if($after){
857
+ $tminus .= $after;
858
  }
859
+ $tminus .= '</div></div></div>';
860
+
 
861
  $t = date( 'n/j/Y H:i:s', strtotime(current_time('mysql')) );
862
+
863
  if(is_numeric($launchwidth)){
864
  $launchwidth .= 'px';
865
  }
866
  if(is_numeric($launchheight)){
867
  $launchheight .= 'px';
868
  }
869
+
870
  $content = str_replace(array('\r\n', '\r', '\n<p>', '\n'), '', $content);
871
  $content = stripslashes($content);
872
  if($jsplacement == "footer"){
884
  'content' => $content,
885
  'launchtarget' => $launchtarget,
886
  'launchwidth' => $launchwidth,
887
+ 'launchheight' => $launchheight,
888
+ 'event_id' => $event_id,
889
  );
890
  }
891
  else{
892
  $tminus .= "<script language='javascript' type='text/javascript'>
893
  jQuery(document).ready(function($) {
894
+ $('#".$id."-dashboard').countDown({
895
  targetDate: {
896
  'day': ".$day.",
897
  'month': ".$month.",
901
  'sec': ".$sec."
902
  },
903
  style: '".$style."',
904
+ id: '".$id."',
905
+ event_id: '".$event_id."',
906
  launchtarget: '".$launchtarget."',
907
  omitWeeks: '".$omitweeks."'";
908
+
909
  if($content){
910
  $tminus .= ", onComplete: function() {
911
  $('#".$id."-".$launchtarget."').css({'width' : '".$launchwidth."', 'height' : '".$launchheight."'});
912
+ $('#".$id."-".$launchtarget."').html('".do_shortcode($content)."');
913
  }";
914
  }
915
  $tminus .= "});
920
  }
921
  add_shortcode('tminus', 'tminuscountdown');
922
 
923
+ add_action('wp_ajax_tminusevents', 'tminusevents_callback');
924
+ add_action('wp_ajax_nopriv_tminusevents', 'tminusevents_callback');
925
+
926
+ function tminusevents_callback() {
927
+ $nonce = $_POST['countdownNonce'];
928
+ if ( ! wp_verify_nonce( $nonce, 'tountajax-countdownonce-nonce' ) ){
929
+ die ( 'Busted!');
930
+ }
931
+
932
+ echo WP_TminusEvents::tminusEvents( $_POST['event_id'] );
933
+ wp_die();
934
+ }
935
+
936
+ ?>
css/naboo/style.css ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .naboo-countdown {
2
+ background: #72aed3;
3
+ color: #fffff;
4
+ margin: 0 auto;
5
+ padding: 10px 0;
6
+ max-width: 360px;
7
+ text-align: center;
8
+ }
9
+
10
+ .naboo-countdown.omitweeks {
11
+ max-width: 295px;
12
+ }
13
+
14
+ .naboo-dashboard {
15
+ margin: 0 auto;
16
+ padding-bottom: 10px;
17
+ }
18
+
19
+ .naboo-tophtml, .naboo-bothtml {
20
+ margin: 0;
21
+ padding: 0;
22
+ font-family: "Gill Sans ", "Gill Sans MT", Calibri, sans-serif;
23
+ font-size: 16px;
24
+ text-align: center;
25
+ color: #ffffff;
26
+ }
27
+
28
+ .naboo-tophtml p, .naboo-bothtml p {
29
+ margin-bottom: 0;
30
+ }
31
+
32
+ .naboo-timer_icon {
33
+ display: none;
34
+ }
35
+
36
+ .naboo-dash, .naboo-tripdash {
37
+ display: inline-block;
38
+ padding: 5px;
39
+ margin-left: 10px;
40
+ height: 30px;
41
+ }
42
+
43
+ .naboo-digit {
44
+ display: inline-block;
45
+ float: left;
46
+ font-family: "Gill Sans ", "Gill Sans MT", Calibri, sans-serif;
47
+ font-weight: 100;
48
+ font-size: 42px;
49
+ line-height: 42px;
50
+ color: #ffffff;
51
+ }
52
+
53
+ .naboo-dash_title {
54
+ -webkit-transform: rotate(-90deg);
55
+ -moz-transform: rotate(-90deg);
56
+ filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
57
+ font-size: 10px;
58
+ font-weight: 100;
59
+ overflow: visible;
60
+ white-space: nowrap;
61
+ width: 23px;
62
+ color: #ffffff;
63
+ position: absolute;
64
+ margin-top: 10px;
65
+ margin-left: -20px;
66
+ font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
67
+ }
js/jquery-ui-timepicker-addon.min.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
1
+ /*! jQuery Timepicker Addon - v1.5.2 - 2015-03-15
2
+ * http://trentrichardson.com/examples/timepicker
3
+ * Copyright (c) 2015 Trent Richardson; Licensed MIT */
4
+ (function(e){"function"==typeof define&&define.amd?define(["jquery","jquery.ui"],e):e(jQuery)})(function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"1.5.2"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,timeOnlyShowDate:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,maxTime:null,minTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,altRedirectFocus:!0,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",oneLine:!1,defaultValue:null,parse:"strict",afterInject:null},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,maxTime:null,minTime:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(e,t){return $.isFunction(tp_inst._defaults.evnts.beforeShow)?tp_inst._defaults.evnts.beforeShow.call($input[0],e,t,tp_inst):void 0},onChangeMonthYear:function(e,t,i){$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],e,t,i,tp_inst)},onClose:function(e,t){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(t),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],e,t,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(e){return e.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(e){return e.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&$.ui.slider===void 0&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzl>tzi;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField),tp_inst._defaults.altRedirectFocus===!0&&tp_inst.$altInput.css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),(0===tp_inst._defaults.minDate||0===tp_inst._defaults.minDateTime)&&(tp_inst._defaults.minDate=new Date),(0===tp_inst._defaults.maxDate||0===tp_inst._defaults.maxDateTime)&&(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){tp_inst._onFocus()}),tp_inst},_addTimePicker:function(e){var t=$.trim(this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val());this.timeDefined=this._parseTime(t),this._limitMinMaxDateTime(e,!1),this._injectTimePicker(),this._afterInject()},_parseTime:function(e,t){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),t||!this._defaults.timeOnly){var i=$.datepicker._get(this.inst,"dateFormat");try{var s=parseDateTimeInternal(i,this._defaults.timeFormat,e,$.datepicker._getFormatConfig(this.inst),this._defaults);if(!s.timeObj)return!1;$.extend(this,s.timeObj)}catch(a){return $.timepicker.log("Error parsing the date/time string: "+a+"\ndate/time string = "+e+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+i),!1}return!0}var n=$.datepicker.parseTime(this._defaults.timeFormat,e,this._defaults);return n?($.extend(this,n),!0):!1},_afterInject:function(){var e=this.inst.settings;$.isFunction(e.afterInject)&&e.afterInject.call(this)},_injectTimePicker:function(){var e=this.inst.dpDiv,t=this.inst.settings,i=this,s="",a="",n=null,r={},l={},o=null,c=0,u=0;if(0===e.find("div.ui-timepicker-div").length&&t.showTimepicker){var m=" ui_tpicker_unit_hide",d='<div class="ui-timepicker-div'+(t.isRTL?" ui-timepicker-rtl":"")+(t.oneLine&&"select"===t.controlType?" ui-timepicker-oneLine":"")+'"><dl>'+'<dt class="ui_tpicker_time_label"'+(t.showTime?"":m)+">"+t.timeText+"</dt>"+'<dd class="ui_tpicker_time '+(t.showTime?"":m)+'"></dd>';for(c=0,u=this.units.length;u>c;c++){if(s=this.units[c],a=s.substr(0,1).toUpperCase()+s.substr(1),n=null!==t["show"+a]?t["show"+a]:this.support[s],r[s]=parseInt(t[s+"Max"]-(t[s+"Max"]-t[s+"Min"])%t["step"+a],10),l[s]=0,d+='<dt class="ui_tpicker_'+s+"_label"+(n?"":m)+'">'+t[s+"Text"]+"</dt>"+'<dd class="ui_tpicker_'+s+(n?"":m)+'"><div class="ui_tpicker_'+s+"_slider"+(n?"":m)+'"></div>',n&&t[s+"Grid"]>0){if(d+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===s)for(var h=t[s+"Min"];r[s]>=h;h+=parseInt(t[s+"Grid"],10)){l[s]++;var p=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:h},t);d+='<td data-for="'+s+'">'+p+"</td>"}else for(var _=t[s+"Min"];r[s]>=_;_+=parseInt(t[s+"Grid"],10))l[s]++,d+='<td data-for="'+s+'">'+(10>_?"0":"")+_+"</td>";d+="</tr></table></div>"}d+="</dd>"}var f=null!==t.showTimezone?t.showTimezone:this.support.timezone;d+='<dt class="ui_tpicker_timezone_label'+(f?"":m)+'">'+t.timezoneText+"</dt>",d+='<dd class="ui_tpicker_timezone'+(f?"":m)+'"></dd>',d+="</dl></div>";var g=$(d);for(t.timeOnly===!0&&(g.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+t.timeOnlyTitle+"</div>"+"</div>"),e.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),c=0,u=i.units.length;u>c;c++)s=i.units[c],a=s.substr(0,1).toUpperCase()+s.substr(1),n=null!==t["show"+a]?t["show"+a]:this.support[s],i[s+"_slider"]=i.control.create(i,g.find(".ui_tpicker_"+s+"_slider"),s,i[s],t[s+"Min"],r[s],t["step"+a]),n&&t[s+"Grid"]>0&&(o=100*l[s]*t[s+"Grid"]/(r[s]-t[s+"Min"]),g.find(".ui_tpicker_"+s+" table").css({width:o+"%",marginLeft:t.isRTL?"0":o/(-2*l[s])+"%",marginRight:t.isRTL?o/(-2*l[s])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(){var e=$(this),t=e.html(),a=parseInt(t.replace(/[^0-9]/g),10),n=t.replace(/[^apm]/gi),r=e.data("for");"hour"===r&&(-1!==n.indexOf("p")&&12>a?a+=12:-1!==n.indexOf("a")&&12===a&&(a=0)),i.control.value(i,i[r+"_slider"],s,a),i._onTimeChange(),i._onSelectHandler()}).css({cursor:"pointer",width:100/l[s]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=g.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(t.timezoneList,function(e){return $("<option />").val("object"==typeof e?e.value:e).text("object"==typeof e?e.label:e)})),this.timezone!==void 0&&null!==this.timezone&&""!==this.timezone){var M=-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset();M===this.timezone?selectLocalTimezone(i):this.timezone_select.val(this.timezone)}else this.hour!==void 0&&null!==this.hour&&""!==this.hour?this.timezone_select.val(t.timezone):selectLocalTimezone(i);this.timezone_select.change(function(){i._onTimeChange(),i._onSelectHandler(),i._afterInject()});var v=e.find(".ui-datepicker-buttonpane");if(v.length?v.before(g):e.append(g),this.$timeObj=g.find(".ui_tpicker_time"),null!==this.inst){var k=this.timeDefined;this._onTimeChange(),this.timeDefined=k}if(this._defaults.addSliderAccess){var T=this._defaults.sliderAccessArgs,D=this._defaults.isRTL;T.isRTL=D,setTimeout(function(){if(0===g.find(".ui-slider-access").length){g.find(".ui-slider:visible").sliderAccess(T);var e=g.find(".ui-slider-access:eq(0)").outerWidth(!0);e&&g.find("table:visible").each(function(){var t=$(this),i=t.outerWidth(),s=(""+t.css(D?"marginRight":"marginLeft")).replace("%",""),a=i-e,n=s*a/i+"%",r={width:a,marginRight:0,marginLeft:0};r[D?"marginRight":"marginLeft"]=n,t.css(r)})}},10)}i._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(e,t){var i=this._defaults,s=new Date(e.selectedYear,e.selectedMonth,e.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(e,"minDateTime")&&void 0!==$.datepicker._get(e,"minDateTime")&&s){var a=$.datepicker._get(e,"minDateTime"),n=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0);(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)&&(this.hourMinOriginal=i.hourMin,this.minuteMinOriginal=i.minuteMin,this.secondMinOriginal=i.secondMin,this.millisecMinOriginal=i.millisecMin,this.microsecMinOriginal=i.microsecMin),e.settings.timeOnly||n.getTime()===s.getTime()?(this._defaults.hourMin=a.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=a.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=a.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=a.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=a.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(e,"maxDateTime")&&void 0!==$.datepicker._get(e,"maxDateTime")&&s){var r=$.datepicker._get(e,"maxDateTime"),l=new Date(r.getFullYear(),r.getMonth(),r.getDate(),0,0,0,0);(null===this.hourMaxOriginal||null===this.minuteMaxOriginal||null===this.secondMaxOriginal||null===this.millisecMaxOriginal)&&(this.hourMaxOriginal=i.hourMax,this.minuteMaxOriginal=i.minuteMax,this.secondMaxOriginal=i.secondMax,this.millisecMaxOriginal=i.millisecMax,this.microsecMaxOriginal=i.microsecMax),e.settings.timeOnly||l.getTime()===s.getTime()?(this._defaults.hourMax=r.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=r.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=r.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=r.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=r.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(null!==e.settings.minTime){var o=new Date("01/01/1970 "+e.settings.minTime);this.hour<o.getHours()?(this.hour=this._defaults.hourMin=o.getHours(),this.minute=this._defaults.minuteMin=o.getMinutes()):this.hour===o.getHours()&&this.minute<o.getMinutes()?this.minute=this._defaults.minuteMin=o.getMinutes():this._defaults.hourMin<o.getHours()?(this._defaults.hourMin=o.getHours(),this._defaults.minuteMin=o.getMinutes()):this._defaults.minuteMin=this._defaults.hourMin===o.getHours()===this.hour&&this._defaults.minuteMin<o.getMinutes()?o.getMinutes():0}if(null!==e.settings.maxTime){var c=new Date("01/01/1970 "+e.settings.maxTime);this.hour>c.getHours()?(this.hour=this._defaults.hourMax=c.getHours(),this.minute=this._defaults.minuteMax=c.getMinutes()):this.hour===c.getHours()&&this.minute>c.getMinutes()?this.minute=this._defaults.minuteMax=c.getMinutes():this._defaults.hourMax>c.getHours()?(this._defaults.hourMax=c.getHours(),this._defaults.minuteMax=c.getMinutes()):this._defaults.minuteMax=this._defaults.hourMax===c.getHours()===this.hour&&this._defaults.minuteMax>c.getMinutes()?c.getMinutes():59}if(void 0!==t&&t===!0){var u=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),m=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),d=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),h=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),p=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:u,step:this._defaults.stepHour}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:m,step:this._defaults.stepMinute}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:d,step:this._defaults.stepSecond}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:h,step:this._defaults.stepMillisec}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:p,step:this._defaults.stepMicrosec}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var e=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,t=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,i=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,s=this.millisec_slider?this.control.value(this,this.millisec_slider,"millisec"):!1,a=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,n=this.timezone_select?this.timezone_select.val():!1,r=this._defaults,l=r.pickerTimeFormat||r.timeFormat,o=r.pickerTimeSuffix||r.timeSuffix;"object"==typeof e&&(e=!1),"object"==typeof t&&(t=!1),"object"==typeof i&&(i=!1),"object"==typeof s&&(s=!1),"object"==typeof a&&(a=!1),"object"==typeof n&&(n=!1),e!==!1&&(e=parseInt(e,10)),t!==!1&&(t=parseInt(t,10)),i!==!1&&(i=parseInt(i,10)),s!==!1&&(s=parseInt(s,10)),a!==!1&&(a=parseInt(a,10)),n!==!1&&(n=""+n);var c=r[12>e?"amNames":"pmNames"][0],u=e!==parseInt(this.hour,10)||t!==parseInt(this.minute,10)||i!==parseInt(this.second,10)||s!==parseInt(this.millisec,10)||a!==parseInt(this.microsec,10)||this.ampm.length>0&&12>e!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&n!==""+this.timezone;u&&(e!==!1&&(this.hour=e),t!==!1&&(this.minute=t),i!==!1&&(this.second=i),s!==!1&&(this.millisec=s),a!==!1&&(this.microsec=a),n!==!1&&(this.timezone=n),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=c),this.formattedTime=$.datepicker.formatTime(r.timeFormat,this,r),this.$timeObj&&(l===r.timeFormat?this.$timeObj.text(this.formattedTime+o):this.$timeObj.text($.datepicker.formatTime(l,this,r)+o)),this.timeDefined=!0,u&&this._updateDateTime()}},_onSelectHandler:function(){var e=this._defaults.onSelect||this.inst.settings.onSelect,t=this.$input?this.$input[0]:null;e&&t&&e.apply(t,[this.formattedDateTime,this])},_updateDateTime:function(e){e=this.inst||e;var t=e.currentYear>0?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(e.selectedYear,e.selectedMonth,e.selectedDay),i=$.datepicker._daylightSavingAdjust(t),s=$.datepicker._get(e,"dateFormat"),a=$.datepicker._getFormatConfig(e),n=null!==i&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(s,null===i?new Date:i,a);var r=this.formattedDate;if(""===e.lastVal&&(e.currentYear=e.selectedYear,e.currentMonth=e.selectedMonth,e.currentDay=e.selectedDay),this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!1?r=this.formattedTime:(this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||n)||this._defaults.timeOnly===!0&&this._defaults.timeOnlyShowDate===!0)&&(r+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=r,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(r);var l="",o=null!==this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,c=null!==this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(l=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===i?new Date:i,a):this.formattedDate,l&&(l+=o)),l+=null!==this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+c:this.formattedTime+c,this.$altInput.val(l)}else this.$input.val(r);else this.$input.val(this.formattedDate);this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var e=$.datepicker._getInst(this.$input.get(0)),t=$.datepicker._get(e,"timepicker");if(t&&t._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(i){$.timepicker.log(i)}}},_controls:{slider:{create:function(e,t,i,s,a,n,r){var l=e._defaults.isRTL;return t.prop("slide",null).slider({orientation:"horizontal",value:l?-1*s:s,min:l?-1*n:a,max:l?-1*a:n,step:r,slide:function(t,s){e.control.value(e,$(this),i,l?-1*s.value:s.value),e._onTimeChange()},stop:function(){e._onSelectHandler()}})},options:function(e,t,i,s,a){if(e._defaults.isRTL){if("string"==typeof s)return"min"===s||"max"===s?void 0!==a?t.slider(s,-1*a):Math.abs(t.slider(s)):t.slider(s);var n=s.min,r=s.max;return s.min=s.max=null,void 0!==n&&(s.max=-1*n),void 0!==r&&(s.min=-1*r),t.slider(s)}return"string"==typeof s&&void 0!==a?t.slider(s,a):t.slider(s)},value:function(e,t,i,s){return e._defaults.isRTL?void 0!==s?t.slider("value",-1*s):Math.abs(t.slider("value")):void 0!==s?t.slider("value",s):t.slider("value")}},select:{create:function(e,t,i,s,a,n,r){for(var l='<select class="ui-timepicker-select ui-state-default ui-corner-all" data-unit="'+i+'" data-min="'+a+'" data-max="'+n+'" data-step="'+r+'">',o=e._defaults.pickerTimeFormat||e._defaults.timeFormat,c=a;n>=c;c+=r)l+='<option value="'+c+'"'+(c===s?" selected":"")+">",l+="hour"===i?$.datepicker.formatTime($.trim(o.replace(/[^ht ]/gi,"")),{hour:c},e._defaults):"millisec"===i||"microsec"===i||c>=10?c:"0"+(""+c),l+="</option>";return l+="</select>",t.children("select").remove(),$(l).appendTo(t).change(function(){e._onTimeChange(),e._onSelectHandler(),e._afterInject()}),t},options:function(e,t,i,s,a){var n={},r=t.children("select");if("string"==typeof s){if(void 0===a)return r.data(s);n[s]=a}else n=s;return e.control.create(e,t,r.data("unit"),r.val(),n.min>=0?n.min:r.data("min"),n.max||r.data("max"),n.step||r.data("step"))},value:function(e,t,i,s){var a=t.children("select");return void 0!==s?a.val(s):a.val()}}}}),$.fn.extend({timepicker:function(e){e=e||{};var t=Array.prototype.slice.call(arguments);return"object"==typeof e&&(t[0]=$.extend(e,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),t)})},datetimepicker:function(e){e=e||{};var t=arguments;return"string"==typeof e?"getDate"===e||"option"===e&&2===t.length&&"string"==typeof t[1]?$.fn.datepicker.apply($(this[0]),t):this.each(function(){var e=$(this);e.datepicker.apply(e,t)}):this.each(function(){var t=$(this);t.datepicker($.timepicker._newInst(t,e)._defaults)})}}),$.datepicker.parseDateTime=function(e,t,i,s,a){var n=parseDateTimeInternal(e,t,i,s,a);if(n.timeObj){var r=n.timeObj;n.date.setHours(r.hour,r.minute,r.second,r.millisec),n.date.setMicroseconds(r.microsec)}return n.date},$.datepicker.parseTime=function(e,t,i){var s=extendRemove(extendRemove({},$.timepicker._defaults),i||{});-1!==e.replace(/\'.*?\'/g,"").indexOf("Z");var a=function(e,t,i){var s,a=function(e,t){var i=[];return e&&$.merge(i,e),t&&$.merge(i,t),i=$.map(i,function(e){return e.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+i.join("|")+")?"},n=function(e){var t=e.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),i={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(t)for(var s=0;t.length>s;s++)-1===i[(""+t[s]).charAt(0)]&&(i[(""+t[s]).charAt(0)]=s+1);return i},r="^"+(""+e).replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(e){var t=e.length;switch(e.charAt(0).toLowerCase()){case"h":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"m":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"s":return 1===t?"(\\d?\\d)":"(\\d{"+t+"})";case"l":return"(\\d?\\d?\\d)";case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return a(i.amNames,i.pmNames);default:return"("+e.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(e){return"\\"+e})+")?"}}).replace(/\s/g,"\\s?")+i.timeSuffix+"$",l=n(e),o="";s=t.match(RegExp(r,"i"));var c={hour:0,minute:0,second:0,millisec:0,microsec:0};return s?(-1!==l.t&&(void 0===s[l.t]||0===s[l.t].length?(o="",c.ampm=""):(o=-1!==$.inArray(s[l.t].toUpperCase(),$.map(i.amNames,function(e){return e.toUpperCase()}))?"AM":"PM",c.ampm=i["AM"===o?"amNames":"pmNames"][0])),-1!==l.h&&(c.hour="AM"===o&&"12"===s[l.h]?0:"PM"===o&&"12"!==s[l.h]?parseInt(s[l.h],10)+12:Number(s[l.h])),-1!==l.m&&(c.minute=Number(s[l.m])),-1!==l.s&&(c.second=Number(s[l.s])),-1!==l.l&&(c.millisec=Number(s[l.l])),-1!==l.c&&(c.microsec=Number(s[l.c])),-1!==l.z&&void 0!==s[l.z]&&(c.timezone=$.timepicker.timezoneOffsetNumber(s[l.z])),c):!1},n=function(e,t,i){try{var s=new Date("2012-01-01 "+t);if(isNaN(s.getTime())&&(s=new Date("2012-01-01T"+t),isNaN(s.getTime())&&(s=new Date("01/01/2012 "+t),isNaN(s.getTime()))))throw"Unable to parse time with native Date: "+t;return{hour:s.getHours(),minute:s.getMinutes(),second:s.getSeconds(),millisec:s.getMilliseconds(),microsec:s.getMicroseconds(),timezone:-1*s.getTimezoneOffset()}}catch(n){try{return a(e,t,i)}catch(r){$.timepicker.log("Unable to parse \ntimeString: "+t+"\ntimeFormat: "+e)}}return!1};return"function"==typeof s.parse?s.parse(e,t,s):"loose"===s.parse?n(e,t,s):a(e,t,s)},$.datepicker.formatTime=function(e,t,i){i=i||{},i=$.extend({},$.timepicker._defaults,i),t=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},t);var s=e,a=i.amNames[0],n=parseInt(t.hour,10);return n>11&&(a=i.pmNames[0]),s=s.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(e){switch(e){case"HH":return("0"+n).slice(-2);case"H":return n;case"hh":return("0"+convert24to12(n)).slice(-2);case"h":return convert24to12(n);case"mm":return("0"+t.minute).slice(-2);case"m":return t.minute;case"ss":return("0"+t.second).slice(-2);case"s":return t.second;case"l":return("00"+t.millisec).slice(-3);case"c":return("00"+t.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===t.timezone?i.timezone:t.timezone,!0);case"T":return a.charAt(0).toUpperCase();case"TT":return a.toUpperCase();case"t":return a.charAt(0).toLowerCase();case"tt":return a.toLowerCase();default:return e.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(e,t){var i,s=this._getInst($(e)[0]),a=this._get(s,"timepicker");a&&s.settings.showTimepicker?(a._limitMinMaxDateTime(s,!0),i=s.inline,s.inline=s.stay_open=!0,this._base_selectDate(e,t),s.inline=i,s.stay_open=!1,this._notifyChange(s),this._updateDatepicker(s)):this._base_selectDate(e,t)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(e){var t=e.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==e&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==t||"boolean"==typeof e.stay_open&&e.stay_open!==!1)){this._base_updateDatepicker(e);var i=this._get(e,"timepicker");i&&i._addTimePicker(e)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");if(i&&$.datepicker._get(t,"constrainInput")){var s=i.support.ampm,a=null!==i._defaults.showTimezone?i._defaults.showTimezone:i.support.timezone,n=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=(""+i._defaults.timeFormat).replace(/[hms]/g,"").replace(/TT/g,s?"APM":"").replace(/Tt/g,s?"AaPpMm":"").replace(/tT/g,s?"AaPpMm":"").replace(/T/g,s?"AP":"").replace(/tt/g,s?"apm":"").replace(/t/g,s?"ap":"")+" "+i._defaults.separator+i._defaults.timeSuffix+(a?i._defaults.timezoneList.join(""):"")+i._defaults.amNames.join("")+i._defaults.pmNames.join("")+n,l=String.fromCharCode(void 0===e.charCode?e.keyCode:e.charCode);return e.ctrlKey||" ">l||!n||r.indexOf(l)>-1}return $.datepicker._base_doKeyPress(e)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(e){var t=this._get(e,"timepicker");if(t){var i=t._defaults.altField;if(i){var s=(t._defaults.altFormat||t._defaults.dateFormat,this._getDate(e)),a=$.datepicker._getFormatConfig(e),n="",r=t._defaults.altSeparator?t._defaults.altSeparator:t._defaults.separator,l=t._defaults.altTimeSuffix?t._defaults.altTimeSuffix:t._defaults.timeSuffix,o=null!==t._defaults.altTimeFormat?t._defaults.altTimeFormat:t._defaults.timeFormat;n+=$.datepicker.formatTime(o,t,t._defaults)+l,t._defaults.timeOnly||t._defaults.altFieldTimeOnly||null===s||(n=t._defaults.altFormat?$.datepicker.formatDate(t._defaults.altFormat,s,a)+r+n:t.formattedDate+r+n),$(i).val(e.input.val()?n:"")}}else $.datepicker._base_updateAlternate(e)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(e){var t=$.datepicker._getInst(e.target),i=$.datepicker._get(t,"timepicker");if(i&&i._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(s){$.timepicker.log(s)}return $.datepicker._base_doKeyUp(e)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(e){var t=this._getInst($(e)[0]);t.dpDiv,this._base_gotoToday(e);var i=this._get(t,"timepicker");selectLocalTimezone(i);var s=new Date;this._setTime(t,s),this._setDate(t,s)},$.datepicker._disableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!1,i._defaults.showTimepicker=!1,i._updateDateTime(t))
5
+ }},$.datepicker._enableTimepickerDatepicker=function(e){var t=this._getInst(e);if(t){var i=this._get(t,"timepicker");$(e).datepicker("getDate"),i&&(t.settings.showTimepicker=!0,i._defaults.showTimepicker=!0,i._addTimePicker(t),i._updateDateTime(t))}},$.datepicker._setTime=function(e,t){var i=this._get(e,"timepicker");if(i){var s=i._defaults;i.hour=t?t.getHours():s.hour,i.minute=t?t.getMinutes():s.minute,i.second=t?t.getSeconds():s.second,i.millisec=t?t.getMilliseconds():s.millisec,i.microsec=t?t.getMicroseconds():s.microsec,i._limitMinMaxDateTime(e,!0),i._onTimeChange(),i._updateDateTime(e)}},$.datepicker._setTimeDatepicker=function(e,t,i){var s=this._getInst(e);if(s){var a=this._get(s,"timepicker");if(a){this._setDateFromField(s);var n;t&&("string"==typeof t?(a._parseTime(t,i),n=new Date,n.setHours(a.hour,a.minute,a.second,a.millisec),n.setMicroseconds(a.microsec)):(n=new Date(t.getTime()),n.setMicroseconds(t.getMicroseconds())),"Invalid Date"==""+n&&(n=void 0),this._setTime(s,n))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(e,t){var i=this._getInst(e),s=t;if(i){"string"==typeof t&&(s=new Date(t),s.getTime()||(this._base_setDateDatepicker.apply(this,arguments),s=$(e).datepicker("getDate")));var a,n=this._get(i,"timepicker");s instanceof Date?(a=new Date(s.getTime()),a.setMicroseconds(s.getMicroseconds())):a=s,n&&a&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=-1*a.getTimezoneOffset()),s=$.timepicker.timezoneAdjust(s,n.timezone),a=$.timepicker.timezoneAdjust(a,n.timezone)),this._updateDatepicker(i),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(e,a,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(e,t){var i=this._getInst(e);if(i){var s=this._get(i,"timepicker");if(s){void 0===i.lastVal&&this._setDateFromField(i,t);var a=this._getDate(i);return a&&s._parseTime($(e).val(),s.timeOnly)&&(a.setHours(s.hour,s.minute,s.second,s.millisec),a.setMicroseconds(s.microsec),null!=s.timezone&&(s.support.timezone||null!==s._defaults.timezone||(s.timezone=-1*a.getTimezoneOffset()),a=$.timepicker.timezoneAdjust(a,s.timezone))),a}return this._base_getDateDatepicker(e,t)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(e,t,i){var s;try{s=this._base_parseDate(e,t,i)}catch(a){if(!(a.indexOf(":")>=0))throw a;s=this._base_parseDate(e,t.substring(0,t.length-(a.length-a.indexOf(":")-2)),i),$.timepicker.log("Error parsing the date string: "+a+"\ndate string = "+t+"\ndate format = "+e)}return s},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(e){var t=this._get(e,"timepicker");return t?(t._updateDateTime(e),t.$input.val()):this._base_formatDate(e)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(e,t,i){var s,a=this._getInst(e);if(!a)return null;var n=this._get(a,"timepicker");if(n){var r,l,o,c,u=null,m=null,d=null,h=n._defaults.evnts,p={};if("string"==typeof t){if("minDate"===t||"minDateTime"===t)u=i;else if("maxDate"===t||"maxDateTime"===t)m=i;else if("onSelect"===t)d=i;else if(h.hasOwnProperty(t)){if(i===void 0)return h[t];p[t]=i,s={}}}else if("object"==typeof t){t.minDate?u=t.minDate:t.minDateTime?u=t.minDateTime:t.maxDate?m=t.maxDate:t.maxDateTime&&(m=t.maxDateTime);for(r in h)h.hasOwnProperty(r)&&t[r]&&(p[r]=t[r])}for(r in p)p.hasOwnProperty(r)&&(h[r]=p[r],s||(s=$.extend({},t)),delete s[r]);if(s&&isEmptyObject(s))return;if(u?(u=0===u?new Date:new Date(u),n._defaults.minDate=u,n._defaults.minDateTime=u):m?(m=0===m?new Date:new Date(m),n._defaults.maxDate=m,n._defaults.maxDateTime=m):d&&(n._defaults.onSelect=d),u||m)return c=$(e),o=c.datetimepicker("getDate"),l=this._base_optionDatepicker.call($.datepicker,e,s||t,i),c.datetimepicker("setDate",o),l}return void 0===i?this._base_optionDatepicker.call($.datepicker,e,t):this._base_optionDatepicker.call($.datepicker,e,s||t,i)};var isEmptyObject=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0},extendRemove=function(e,t){$.extend(e,t);for(var i in t)(null===t[i]||void 0===t[i])&&(e[i]=t[i]);return e},detectSupport=function(e){var t=e.replace(/'.*?'/g,"").toLowerCase(),i=function(e,t){return-1!==e.indexOf(t)?!0:!1};return{hour:i(t,"h"),minute:i(t,"m"),second:i(t,"s"),millisec:i(t,"l"),microsec:i(t,"c"),timezone:i(t,"z"),ampm:i(t,"t")&&i(e,"h"),iso8601:i(e,"Z")}},convert24to12=function(e){return e%=12,0===e&&(e=12),e+""},computeEffectiveSetting=function(e,t){return e&&e[t]?e[t]:$.timepicker._defaults[t]},splitDateTime=function(e,t){var i=computeEffectiveSetting(t,"separator"),s=computeEffectiveSetting(t,"timeFormat"),a=s.split(i),n=a.length,r=e.split(i),l=r.length;return l>1?{dateString:r.splice(0,l-n).join(i),timeString:r.splice(0,n).join(i)}:{dateString:e,timeString:""}},parseDateTimeInternal=function(e,t,i,s,a){var n,r,l;if(r=splitDateTime(i,a),n=$.datepicker._base_parseDate(e,r.dateString,s),""===r.timeString)return{date:n};if(l=$.datepicker.parseTime(t,r.timeString,a),!l)throw"Wrong time format";return{date:n,timeObj:l}},selectLocalTimezone=function(e,t){if(e&&e.timezone_select){var i=t||new Date;e.timezone_select.val(-i.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(e,t){if(isNaN(e)||e>840||-720>e)return e;var i=e,s=i%60,a=(i-s)/60,n=t?":":"",r=(i>=0?"+":"-")+("0"+Math.abs(a)).slice(-2)+n+("0"+Math.abs(s)).slice(-2);return"+00:00"===r?"Z":r},$.timepicker.timezoneOffsetNumber=function(e){var t=(""+e).replace(":","");return"Z"===t.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(t)?("-"===t.substr(0,1)?-1:1)*(60*parseInt(t.substr(1,2),10)+parseInt(t.substr(3,2),10)):e},$.timepicker.timezoneAdjust=function(e,t){var i=$.timepicker.timezoneOffsetNumber(t);return isNaN(i)||e.setMinutes(e.getMinutes()+-e.getTimezoneOffset()-i),e},$.timepicker.timeRange=function(e,t,i){return $.timepicker.handleRange("timepicker",e,t,i)},$.timepicker.datetimeRange=function(e,t,i){$.timepicker.handleRange("datetimepicker",e,t,i)},$.timepicker.dateRange=function(e,t,i){$.timepicker.handleRange("datepicker",e,t,i)},$.timepicker.handleRange=function(e,t,i,s){function a(a,n){var r=t[e]("getDate"),l=i[e]("getDate"),o=a[e]("getDate");if(null!==r){var c=new Date(r.getTime()),u=new Date(r.getTime());c.setMilliseconds(c.getMilliseconds()+s.minInterval),u.setMilliseconds(u.getMilliseconds()+s.maxInterval),s.minInterval>0&&c>l?i[e]("setDate",c):s.maxInterval>0&&l>u?i[e]("setDate",u):r>l&&n[e]("setDate",o)}}function n(t,i,a){if(t.val()){var n=t[e].call(t,"getDate");null!==n&&s.minInterval>0&&("minDate"===a&&n.setMilliseconds(n.getMilliseconds()+s.minInterval),"maxDate"===a&&n.setMilliseconds(n.getMilliseconds()-s.minInterval)),n.getTime&&i[e].call(i,"option",a,n)}}s=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},s);var r=!1;return"timepicker"===e&&(r=!0,e="datetimepicker"),$.fn[e].call(t,$.extend({timeOnly:r,onClose:function(){a($(this),i)},onSelect:function(){n($(this),i,"minDate")}},s,s.start)),$.fn[e].call(i,$.extend({timeOnly:r,onClose:function(){a($(this),t)},onSelect:function(){n($(this),t,"maxDate")}},s,s.end)),a(t,i),n(t,i,"minDate"),n(i,t,"maxDate"),$([t.get(0),i.get(0)])},$.timepicker.log=function(){window.console&&window.console.log.apply(window.console,Array.prototype.slice.call(arguments))},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(e){return this.setMilliseconds(this.getMilliseconds()+Math.floor(e/1e3)),this.microseconds=e%1e3,this}),$.timepicker.version="1.5.2"}});
js/jquery.collapse.js CHANGED
@@ -1,9 +1,9 @@
1
  /*!
2
- * jQuery Collapse-O-Matic for T-Minus v1.2.1
3
  * http://www.twinpictures.de/
4
  *
5
  * Copyright 2014, Twinpictures
6
- *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
9
  * in the Software without restriction, including without limitation the rights
@@ -11,10 +11,10 @@
11
  * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
  * and to permit persons to whom the Software is furnished to do so, subject to
13
  * the following conditions:
14
- *
15
  * The above copyright notice and this permission notice shall be included in
16
  * all copies or substantial portions of the Software.
17
- *
18
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,14 +27,20 @@
27
  jQuery(document).ready(function() {
28
 
29
  jQuery(document).on('click', '.t-datepicker', function(event) {
30
- jQuery(this).datepicker('destroy').datepicker({dateFormat : 'yy-mm-dd'}).focus();
 
 
 
 
 
31
  });
32
-
 
33
  jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
34
  var thisid = jQuery(this).attr('id');
35
  jQuery('#target-'+thisid).css('display', 'none');
36
  });
37
-
38
  jQuery(document).on('click', '.collapseomatic', function(event) {
39
  //alert('phones ringin dude');
40
  jQuery(this).toggleClass('colomat-close');
@@ -43,13 +49,4 @@ jQuery(document).ready(function() {
43
  // Animation complete.
44
  });
45
  });
46
-
47
- jQuery(document).on('click', '.rockstar', function(event) {
48
- //alert('phones ringin dude');
49
- var id = jQuery(this).attr('id');
50
- var key = jQuery(this).val();
51
- jQuery('.isrockstar').each(function(){
52
- jQuery(this).val('Rockstar Features:');
53
- });
54
- });
55
- });
1
  /*!
2
+ * jQuery Collapse-O-Matic for T-Minus v1.2.2
3
  * http://www.twinpictures.de/
4
  *
5
  * Copyright 2014, Twinpictures
6
+ *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
9
  * in the Software without restriction, including without limitation the rights
11
  * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
  * and to permit persons to whom the Software is furnished to do so, subject to
13
  * the following conditions:
14
+ *
15
  * The above copyright notice and this permission notice shall be included in
16
  * all copies or substantial portions of the Software.
17
+ *
18
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
  jQuery(document).ready(function() {
28
 
29
  jQuery(document).on('click', '.t-datepicker', function(event) {
30
+ jQuery(this).datetimepicker('destroy').datetimepicker(
31
+ {
32
+ dateFormat : 'yy-mm-dd',
33
+ timeFormat: 'HH:mm:ss'
34
+ }
35
+ ).focus();
36
  });
37
+
38
+
39
  jQuery('.collapseomatic:not(.colomat-close)').each(function(index) {
40
  var thisid = jQuery(this).attr('id');
41
  jQuery('#target-'+thisid).css('display', 'none');
42
  });
43
+
44
  jQuery(document).on('click', '.collapseomatic', function(event) {
45
  //alert('phones ringin dude');
46
  jQuery(this).toggleClass('colomat-close');
49
  // Animation complete.
50
  });
51
  });
52
+ });
 
 
 
 
 
 
 
 
 
js/jquery.t-countdown.js CHANGED
@@ -1,9 +1,9 @@
1
  /*
2
- * T- Countdown v1.5.4
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2015, Twinpictures
6
- *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
9
  * in the Software without restriction, including without limitation the rights
@@ -11,10 +11,10 @@
11
  * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
  * and to permit persons to whom the Software is furnished to do so, subject to
13
  * the following conditions:
14
- *
15
  * The above copyright notice and this permission notice shall be included in
16
  * all copies or substantial portions of the Software.
17
- *
18
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -30,13 +30,31 @@
30
  $.extend(config, options);
31
  targetTime = this.setTargetTime(config);
32
  //set diffSecs and launch the countdown once the ajax for now loads
33
- //console.log(config.targetDate.localtime); //this did not support caching plugins
34
  diffSecs = this.setDiffSecs(targetTime, options.targetDate.localtime);
35
  before = new Date();
36
  $.data($(this)[0], 'before', before);
37
  $.data($(this)[0], 'status', 'play');
 
38
  style = config.style;
39
  $.data($(this)[0], 'style', config.style);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  if( config.launchtarget ) {
41
  $.data($(this)[0], 'launchtarget', config.launchtarget);
42
  }
@@ -52,7 +70,7 @@
52
  $('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="top"></div><div class="bottom"></div>');
53
  return this;
54
  };
55
-
56
  $.fn.stopCountDown = function () {
57
  $.data(this[0], 'status', 'stop');
58
  };
@@ -66,10 +84,11 @@
66
  var diffSecs = null;
67
  $.ajax({
68
  url: tminusnow,
69
- cache: false,
 
70
  success: $.proxy(function( data ) {
71
- //console.log(data);
72
- nowTime = new Date(data);
73
  diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
74
  $(this).doCountDown($(this).attr('id'), diffSecs, 500);
75
  }, this),
@@ -80,7 +99,7 @@
80
  }, this)
81
  });
82
  };
83
-
84
  $.fn.setTargetTime = function (options) {
85
  var targetTime = new Date();
86
  if (options.targetDate){
@@ -94,13 +113,13 @@
94
  targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
95
  targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
96
  }
97
-
98
  return targetTime;
99
  };
100
 
101
  $.fn.doCountDown = function (id, diffSecs, duration) {
102
  $this = $('#' + id);
103
-
104
  if (diffSecs <= 0){
105
  if( $.data($this[0], 'launchtarget') != 'countup' ){
106
  diffSecs = 0;
@@ -126,7 +145,15 @@
126
  $this.dashChangeTo(id, style + '-days_trip_dash', days, duration ? duration : 1000);
127
  $this.dashChangeTo(id, style + '-weeks_dash', weeks, duration ? duration : 1000);
128
  $this.dashChangeTo(id, style + '-weeks_trip_dash', weeks, duration ? duration : 1000);
 
129
  $.data($this[0], 'diffSecs', diffSecs);
 
 
 
 
 
 
 
130
  if (diffSecs > 0 || $.data($this[0], 'launchtarget') == 'countup'){
131
  if($.data($this[0], 'status') == 'play'){
132
  var delta = 0;
@@ -156,7 +183,7 @@
156
  }
157
 
158
  };
159
-
160
  $.fn.dashChangeTo = function(id, dash, n, duration) {
161
  $this = $('#' + id);
162
  style = $.data($this[0], 'style');
@@ -166,7 +193,7 @@
166
  $this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .' + style + '-digit:eq('+i+')', d, duration);
167
  }
168
  };
169
-
170
  $.fn.digitChangeTo = function (digit, n, duration) {
171
  if (!duration){
172
  duration = 500;
@@ -182,4 +209,33 @@
182
  });
183
  }
184
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  })(jQuery);
1
  /*
2
+ * T- Countdown v1.5.5
3
  * http://plugins.twinpictures.de/plugins/t-minus-countdown/
4
  *
5
  * Copyright 2015, Twinpictures
6
+ *
7
  * Permission is hereby granted, free of charge, to any person obtaining a copy
8
  * of this software and associated documentation files (the "Software"), to deal
9
  * in the Software without restriction, including without limitation the rights
11
  * bake, hack, scramble, difiburlate, digest and/or sell copies of the Software,
12
  * and to permit persons to whom the Software is furnished to do so, subject to
13
  * the following conditions:
14
+ *
15
  * The above copyright notice and this permission notice shall be included in
16
  * all copies or substantial portions of the Software.
17
+ *
18
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
  $.extend(config, options);
31
  targetTime = this.setTargetTime(config);
32
  //set diffSecs and launch the countdown once the ajax for now loads
 
33
  diffSecs = this.setDiffSecs(targetTime, options.targetDate.localtime);
34
  before = new Date();
35
  $.data($(this)[0], 'before', before);
36
  $.data($(this)[0], 'status', 'play');
37
+ $.data($(this)[0], 'id', config.id);
38
  style = config.style;
39
  $.data($(this)[0], 'style', config.style);
40
+
41
+ if ( config.event_id ) {
42
+ $.data($(this)[0], 'event_id', config.event_id);
43
+ $.ajax({
44
+ url: tCountAjax.ajaxurl,
45
+ type : "post",
46
+ dataType : "json",
47
+ data: {
48
+ action : 'tminusevents',
49
+ event_id : config.event_id,
50
+ countdownNonce : tCountAjax.countdownNonce
51
+ },
52
+ success: $.proxy(function( jsonobj ) {
53
+ $.data($(this)[0], 'eventObj', jsonobj);
54
+ }, this)
55
+ });
56
+ }
57
+
58
  if( config.launchtarget ) {
59
  $.data($(this)[0], 'launchtarget', config.launchtarget);
60
  }
70
  $('#' + $(this).attr('id') + ' .' + style + '-digit').html('<div class="top"></div><div class="bottom"></div>');
71
  return this;
72
  };
73
+
74
  $.fn.stopCountDown = function () {
75
  $.data(this[0], 'status', 'stop');
76
  };
84
  var diffSecs = null;
85
  $.ajax({
86
  url: tminusnow,
87
+ type : "post",
88
+ dataType : "json",
89
  success: $.proxy(function( data ) {
90
+ //console.log(data['now']);
91
+ nowTime = new Date(data['now']);
92
  diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
93
  $(this).doCountDown($(this).attr('id'), diffSecs, 500);
94
  }, this),
99
  }, this)
100
  });
101
  };
102
+
103
  $.fn.setTargetTime = function (options) {
104
  var targetTime = new Date();
105
  if (options.targetDate){
113
  targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
114
  targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
115
  }
116
+
117
  return targetTime;
118
  };
119
 
120
  $.fn.doCountDown = function (id, diffSecs, duration) {
121
  $this = $('#' + id);
122
+
123
  if (diffSecs <= 0){
124
  if( $.data($this[0], 'launchtarget') != 'countup' ){
125
  diffSecs = 0;
145
  $this.dashChangeTo(id, style + '-days_trip_dash', days, duration ? duration : 1000);
146
  $this.dashChangeTo(id, style + '-weeks_dash', weeks, duration ? duration : 1000);
147
  $this.dashChangeTo(id, style + '-weeks_trip_dash', weeks, duration ? duration : 1000);
148
+
149
  $.data($this[0], 'diffSecs', diffSecs);
150
+
151
+ //events
152
+ if( $.data($this[0], 'event_id') ){
153
+ $this.checkEvent(id, diffSecs);
154
+ }
155
+
156
+
157
  if (diffSecs > 0 || $.data($this[0], 'launchtarget') == 'countup'){
158
  if($.data($this[0], 'status') == 'play'){
159
  var delta = 0;
183
  }
184
 
185
  };
186
+
187
  $.fn.dashChangeTo = function(id, dash, n, duration) {
188
  $this = $('#' + id);
189
  style = $.data($this[0], 'style');
193
  $this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .' + style + '-digit:eq('+i+')', d, duration);
194
  }
195
  };
196
+
197
  $.fn.digitChangeTo = function (digit, n, duration) {
198
  if (!duration){
199
  duration = 500;
209
  });
210
  }
211
  };
212
+
213
+ $.fn.checkEvent = function () {
214
+ if ( ! $.data( this[0], 'eventObj' ) ) {
215
+ return;
216
+ }
217
+
218
+ var eventObj = $.data( this[0], 'eventObj' ).tevent;
219
+ for (var key in eventObj) {
220
+ if (eventObj[key].hasOwnProperty('tevents_event_time') && eventObj[key]['tevents_event_time'] == $.data( this[0], 'diffSecs' ) ) {
221
+ //content (even if it's blank)
222
+ if (eventObj[key].hasOwnProperty('tevents_target_elem') && eventObj[key]['tevents_event_target'] == 'other') {
223
+ target_elem = eventObj[key]['tevents_target_elem'];
224
+ }
225
+ else{
226
+ target_elem = '#' + $.data( this[0], 'id' ) + '-' + eventObj[key]['tevents_event_target'];
227
+ }
228
+ $(target_elem).html( eventObj[key]['tevents_event_content'] );
229
+
230
+ //function
231
+ if ( eventObj[key]['tevents_event_function'] ) {
232
+ var fn = window[ eventObj[key]['tevents_event_function'] ];
233
+ if(typeof fn === 'function') {
234
+ fn();
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
  })(jQuery);
js/now.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
2
  require_once("../../../../wp-load.php");
3
- echo date( 'n/j/Y H:i:s', strtotime(current_time('mysql')) );
4
- ?>
 
 
1
  <?php
2
  require_once("../../../../wp-load.php");
3
+ $response = array( 'now' => date( 'n/j/Y H:i:s', strtotime(current_time('mysql'))));
4
+ echo json_encode($response);
5
+ die();
6
+ ?>
readme.txt CHANGED
@@ -5,15 +5,15 @@ Donate link: http://plugins.twinpictures.de/plugins/t-minus-countdown/
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
  Requires at least: 3.9
7
  Tested up to: 4.2
8
- Stable tag: 2.2.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- T(-) Countdown will display a highly customizable, flash-free countdown timer as a sidebar widget or in a post or page using a shortcode.
13
 
14
  == Description ==
15
 
16
- T(-) Countdown will display a highly customizable jQuery countdown timer as a sidebar widget or in a post or page using a shortcode. Perfect for informing one's website visitors of an upcoming event, such as a pending space voyage. Using Jedi Mind-tricks and CSS... but mostly CSS, the countdown timer is highly customizable for your viewing pleasure. A <a href='http://plugins.twinpictures.de/plugins/t-minus-countdown/documentation/'>complete listing of shortcode options</a> are available, as well as <a href='http://wordpress.org/support/plugin/jquery-t-countdown-widget'>free community</a> support. This plug-in was inspired by littlewebthings' CountDown jQuery plugin. Intergalactic planetary thanks to g2.de, siliconstudio.com and be.net/arturex for the included css styles.
17
 
18
  == Installation ==
19
 
@@ -50,8 +50,9 @@ Yes, yes... <a href='http://www.facebook.com/twinpictures'>Twinpictures is on Fa
50
  = Does Twinpictures do the Twitter? =
51
  Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the Twitter.
52
 
53
- = Where may one view the week in review that gives giggle? =
54
- Last Week Tonight With John Oliver
 
55
 
56
  == Screenshots ==
57
 
@@ -60,15 +61,23 @@ Last Week Tonight With John Oliver
60
  1. The basic T(-) Countdown widget options.
61
  1. An expansive view of the available Countdown widget options, provided for your viewing pleasure.
62
  1. The magical jQuery Datepicker.
 
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
 
 
66
  = 2.2.20 =
67
  * updated method of formatting time in meta-box
68
- * Error handling if the ajax call returns an error
69
 
70
  = 2.2.19 =
71
- * The time calculation for NOW is done via ajax, so now caching plugins may be used
72
 
73
  = 2.2.18 =
74
  * countdown script moved in loading priority to after jQuery, when loaded in the footer
@@ -220,138 +229,8 @@ Last Week Tonight With John Oliver
220
 
221
  == Upgrade Notice ==
222
 
223
- = 2.2.17 =
224
- * addressed jQuery undefined function error on some WordPress installs
225
- * javascript cleanup
226
-
227
- = 2.2.16 =
228
- * fixed TIE-Fighter style to deal with box-sizing and will now adjust width automatically
229
- * updated the enqueue_scripts to be called using the proper hooks
230
- * only load the widget admin scripts on the widget page
231
- * datepicker now works when widget is first dropped on a sidebar
232
-
233
- = 2.2.15 =
234
- * fixed but with omitweeks attribute
235
-
236
- = 2.2.14 =
237
- * fixed IE rotation issue on some styles
238
-
239
- = 2.2.13 =
240
- * updated jQuery UI datepicker style.
241
- * added Russian language
242
- * added Slovak language
243
- * added Persian language
244
- * added Czech language
245
- * added Lithuanian language
246
- * added Catalan language
247
- * added French language
248
-
249
- = 2.2.12 =
250
- * added cloud-city style
251
-
252
- = 2.2.11 =
253
- * added new style: sith
254
- * jsplacment inline improved
255
- * Escape characters no longer converted in widget tile
256
- * Fixed 'Top Scroll' issue
257
-
258
- = 2.2.10 =
259
- * jQuery datepicker and related css will only load when needed
260
- * countup will use triple digit class for numbers above 100
261
- * new carbonite-responsive style
262
-
263
- = 2.2.9 =
264
- * current time calculation now uses WordPress current_time() function
265
- * bug fix for iOS devices using Chrome
266
-
267
- = 2.2.8 =
268
- * small bug fix that was causing issues on some systems.
269
-
270
- = 2.2.7 =
271
- * Language support added
272
- * German translation added
273
-
274
- = 2.2.6 =
275
- * Animations remain smooth for inactive tabs.
276
-
277
- = 2.2.5 =
278
- * Fixed missing single quote that was causing JS error.
279
-
280
- = 2.2.4 =
281
- * jQuery datepicker is now used to select date
282
- * Added new Count Up feature
283
-
284
- = 2.2.3 =
285
- * fixed spacing issues with some styles
286
- * rockstar features will now display collapsed by default
287
- * will discover plugin directory if wp-content is renamed
288
-
289
- = 2.2.2 =
290
- * Streamlined the method of loading css styles. Now only the styles that are being used will be loaded.
291
-
292
- = 2.2.1 =
293
- * Fixed CSS bugs, added new style: c-p30 mini
294
-
295
- = 2.2 =
296
- * Countdown scrip has been streamlined to improved efficiency.
297
-
298
- = 2.0.9 =
299
- * Two new image-free css styles have been added: TIE-Fighter and C-3PO
300
- * Spacing issued caused by WordPress' wonky wpautop function has been fixed
301
- * Fixed closed arrow issue on the widget options page.
302
- * Moved plugin page at Twinpictures' Plugin Oven
303
- * Consolidated support to WordPress Forums and added Premium Support option.
304
-
305
- = 2.0.9 =
306
- * fixed issue with Display Titles not saving
307
-
308
- = 2.0.8 =
309
- * fixed css issue for WordPress 3.3
310
-
311
- = 2.0.7 =
312
- * fixing svn issues. old js file is being uploaded. grrr.
313
-
314
- = 2.0.6 =
315
- * Additional countdown timer optimizations.
316
-
317
- = 2.0.5 =
318
- * Improved countdown timer that reduces the browser's CPU footprint and improves battery life for mobile devices.
319
-
320
- = 2.0.4 =
321
- * Works with retched Internet Explorer browser-like crap. Includes new single-line 'carbonlite' theme.
322
-
323
- = 2.0.3 =
324
- Onlaunch HTML shortcode bug fix.
325
-
326
- = 2.0.2 =
327
- New option of placing the javascript in the footer or inline.
328
-
329
- = 2.0.1 =
330
- Minor bug fixes and improved load times.
331
-
332
- = 2.0 =
333
- Requires WordPress version 2.8 or higher. Backup custom CSS folders.
334
-
335
- = 1.7 =
336
- 1.6 failed to upload correctly to svn... very messed up situation
337
-
338
- = 1.6 =
339
- Version 1.6 brings much love to the countdown user. First, automatic triple digit weeks and days have been added. Next, the Jedi style switcher has been revamped to better handle user generated css. Finally, a third default style has been added called Carbonite designed by Laruen at siliconstudio.com.
340
-
341
- = 1.5 =
342
- Version 1.5 cleans up code that was causing array_merge errors on some systems. NOTE: if a custom CSS is being used, be sure to back up your css and image files before updating. Updating will overwrite custom css styles.
343
-
344
- = 1.4 =
345
- Version 1.4 refers to your local WordPress Timezone for time calculations. In case the server is hosted outside of the website's local timezone. It happens.
346
-
347
- = 1.3 =
348
- Version 1.3 fixes the issue no before/after widget/title issues due to lack of sleep during v. 1.2.
349
-
350
- = 1.2 =
351
- Version 1.2 fixes the issue that disabled the TinyMCE/Visual Editor.
352
-
353
- = 1.1 =
354
- Version 1.1 fixes the extract() warning that was being thrown on some systems.
355
-
356
- = 1.0 =
357
- Where once there was not, there now is.
5
  Tags: countdown, timer, clock, ticker, widget, event, counter, count down, twinpictures, t minus, t-minus, plugin-oven, pluginoven, G2, spaceBros, littlewebtings, jQuery, javascript
6
  Requires at least: 3.9
7
  Tested up to: 4.2
8
+ Stable tag: 2.3.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ T(-) Countdown will display a highly customizable, HTML5 countdown timer as a sidebar widget or in a post or page using a shortcode.
13
 
14
  == Description ==
15
 
16
+ T(-) Countdown will display a highly customizable HTML5 countdown timer as a sidebar widget or in a post or page using a shortcode. Perfect for informing one's website visitors of an upcoming event, such as a pending space voyage. Using Jedi Mind-tricks and CSS... but mostly CSS, the countdown timer is highly customizable for your viewing pleasure. A <a href='http://plugins.twinpictures.de/plugins/t-minus-countdown/documentation/'>complete listing of shortcode options</a> are available, as well as <a href='http://wordpress.org/support/plugin/jquery-t-countdown-widget'>free community</a> support. This plug-in was inspired by littlewebthings' CountDown jQuery plugin. Intergalactic planetary thanks to g2.de, siliconstudio.com and be.net/arturex for the included css styles.
17
 
18
  == Installation ==
19
 
50
  = Does Twinpictures do the Twitter? =
51
  Ah yes! <a href='http://twitter.com/#!/twinpictures'>@Twinpictures</a> is on the Twitter.
52
 
53
+ = Where may one enjoy U.S. news that gives giggle? =
54
+ * The Daily Show with John Stewart
55
+ * Last Week Tonight with John Oliver
56
 
57
  == Screenshots ==
58
 
61
  1. The basic T(-) Countdown widget options.
62
  1. An expansive view of the available Countdown widget options, provided for your viewing pleasure.
63
  1. The magical jQuery Datepicker.
64
+ 1. Plugin options page with Custom CSS section
65
 
66
  == Changelog ==
67
 
68
+ = 2.3.0 =
69
+ * complete code update
70
+ * added plugin options page
71
+ * added datetimepicker to widget
72
+ * added T(-) Countdown Event integration
73
+ * new method of handling styles and custom styles
74
+
75
  = 2.2.20 =
76
  * updated method of formatting time in meta-box
77
+ * error handling if the ajax call is not successful
78
 
79
  = 2.2.19 =
80
+ * time calculation for NOW is done via ajax, so now caching plugins may be used
81
 
82
  = 2.2.18 =
83
  * countdown script moved in loading priority to after jQuery, when loaded in the footer
229
 
230
  == Upgrade Notice ==
231
 
232
+ = 2.3.0 =
233
+ * updated method of formatting time in meta-box
234
+ * error handling if the ajax call is not successful
235
+ * added plugin options page
236
+ * new method of handling styles and custom styles