Version Description
- Added option of inserting the javascript in the footer or inline, after the countdown has been inserted.
Download this release
Release Info
Developer | baden03 |
Plugin | T(-) Countdown |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- countdown-timer.php +110 -37
- readme.txt +10 -4
countdown-timer.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
Plugin Name: jQuery T(-) Countdown
|
4 |
Plugin URI: http://www.twinpictures.de/jquery-t-minus-2-0/
|
5 |
Description: Display and configure multiple jQuery countdown timers using a shortcode or as a sidebar widget.
|
6 |
-
Version: 2.0.
|
7 |
Author: Twinpictures
|
8 |
Author URI: http://www.twinpictures.de
|
9 |
License: GPL2
|
@@ -119,6 +119,7 @@ class CountDownTimer extends WP_Widget {
|
|
119 |
$mintitle = empty($instance['mintitle']) ? 'minutes' : apply_filters('widget_mintitle', $instance['mintitle']);
|
120 |
$sectitle = empty($instance['sectitle']) ? 'seconds' : apply_filters('widget_sectitle', $instance['sectitle']);
|
121 |
$omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
|
|
|
122 |
|
123 |
//now
|
124 |
$now = time() + ( get_option( 'gmt_offset' ) * 3600);
|
@@ -271,22 +272,49 @@ class CountDownTimer extends WP_Widget {
|
|
271 |
$launchdiv = "widget";
|
272 |
}
|
273 |
|
274 |
-
$
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
}
|
291 |
|
292 |
/** Update */
|
@@ -361,6 +389,10 @@ class CountDownTimer extends WP_Widget {
|
|
361 |
if(!$style){
|
362 |
$style = 'jedi';
|
363 |
}
|
|
|
|
|
|
|
|
|
364 |
|
365 |
$isrockstar = get_option('rockstar');
|
366 |
|
@@ -389,6 +421,15 @@ class CountDownTimer extends WP_Widget {
|
|
389 |
}else{
|
390 |
$positive = 'CHECKED';
|
391 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
?>
|
393 |
<p><?php _e('Omit Weeks:'); ?> <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'); ?> </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'); ?></label></p>
|
394 |
<p><?php _e('Style:'); ?> <select name="<?php echo $this->get_field_name('style'); ?>" id="<?php echo $this->get_field_name('style'); ?>">
|
@@ -403,6 +444,8 @@ class CountDownTimer extends WP_Widget {
|
|
403 |
}
|
404 |
?>
|
405 |
</select></p>
|
|
|
|
|
406 |
<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; ?>" />
|
407 |
<?php
|
408 |
if($isrockstar){
|
@@ -461,7 +504,7 @@ class CountDownTimer extends WP_Widget {
|
|
461 |
// register CountDownTimer widget
|
462 |
add_action('widgets_init', create_function('', 'return register_widget("CountDownTimer");'));
|
463 |
|
464 |
-
|
465 |
//code fore the footer
|
466 |
add_action('wp_footer', 'print_my_script');
|
467 |
|
@@ -505,6 +548,7 @@ function print_my_script() {
|
|
505 |
<?php
|
506 |
}
|
507 |
|
|
|
508 |
function tminuscountdown($atts, $content=null) {
|
509 |
global $add_my_script;
|
510 |
//find a random number, incase there is no id assigned
|
@@ -527,6 +571,7 @@ function tminuscountdown($atts, $content=null) {
|
|
527 |
'launchwidth' => 'auto',
|
528 |
'launchheight' => 'auto',
|
529 |
'launchtarget' => 'countdown',
|
|
|
530 |
), $atts));
|
531 |
|
532 |
|
@@ -661,24 +706,52 @@ function tminuscountdown($atts, $content=null) {
|
|
661 |
$launchheight .= 'px';
|
662 |
}
|
663 |
$content = mysql_real_escape_string( $content);
|
664 |
-
$content = str_replace(array('\r\n', '\r', '\n<p>', '\n'), '', $content);
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
682 |
return $tminus;
|
683 |
}
|
684 |
add_shortcode('tminus', 'tminuscountdown');
|
1 |
<?php
|
2 |
/*
|
3 |
+
Plugin Name: jQuery T(-) Countdown
|
4 |
Plugin URI: http://www.twinpictures.de/jquery-t-minus-2-0/
|
5 |
Description: Display and configure multiple jQuery countdown timers using a shortcode or as a sidebar widget.
|
6 |
+
Version: 2.0.2
|
7 |
Author: Twinpictures
|
8 |
Author URI: http://www.twinpictures.de
|
9 |
License: GPL2
|
119 |
$mintitle = empty($instance['mintitle']) ? 'minutes' : apply_filters('widget_mintitle', $instance['mintitle']);
|
120 |
$sectitle = empty($instance['sectitle']) ? 'seconds' : apply_filters('widget_sectitle', $instance['sectitle']);
|
121 |
$omitweeks = empty($instance['omitweeks']) ? 'false' : apply_filters('widget_omitweeks', $instance['omitweeks']);
|
122 |
+
$jsplacement = empty($instance['jsplacement']) ? 'footer' : apply_filters('widget_jsplacement', $instance['jsplacement']);
|
123 |
|
124 |
//now
|
125 |
$now = time() + ( get_option( 'gmt_offset' ) * 3600);
|
272 |
$launchdiv = "widget";
|
273 |
}
|
274 |
|
275 |
+
if($jsplacement == "footer"){
|
276 |
+
$add_my_script[$id] = array(
|
277 |
+
'id' => $args['widget_id'],
|
278 |
+
'day' => $day,
|
279 |
+
'month' => $month,
|
280 |
+
'year' => $year,
|
281 |
+
'hour' => $hour,
|
282 |
+
'min' => $min,
|
283 |
+
'sec' => $sec,
|
284 |
+
'localtime' => $t,
|
285 |
+
'style' => $style,
|
286 |
+
'omitweeks' => $omitweeks,
|
287 |
+
'content' => trim($launchhtml),
|
288 |
+
'launchtarget' => $launchdiv,
|
289 |
+
'launchwidth' => 'auto',
|
290 |
+
'launchheight' => 'auto'
|
291 |
+
);
|
292 |
+
}
|
293 |
+
else{
|
294 |
+
?>
|
295 |
+
<script language="javascript" type="text/javascript">
|
296 |
+
jQuery(document).ready(function() {
|
297 |
+
jQuery('#<?php echo $args['widget_id']; ?>-dashboard').countDown({
|
298 |
+
targetDate: {
|
299 |
+
'day': <?php echo $day; ?>,
|
300 |
+
'month': <?php echo $month; ?>,
|
301 |
+
'year': <?php echo $year; ?>,
|
302 |
+
'hour': <?php echo $hour; ?>,
|
303 |
+
'min': <?php echo $min; ?>,
|
304 |
+
'sec': <?php echo $sec; ?>,
|
305 |
+
'localtime': '<?php echo $t; ?>',
|
306 |
+
},
|
307 |
+
style: '<?php echo $style; ?>',
|
308 |
+
omitWeeks: <?php echo $omitweeks;
|
309 |
+
if($launchhtml){
|
310 |
+
echo ", onComplete: function() { jQuery('#".$args['widget_id']."-".$launchdiv."').html('".do_shortcode($launchhtml)."'); }";
|
311 |
+
}
|
312 |
+
?>
|
313 |
+
});
|
314 |
+
});
|
315 |
+
</script>
|
316 |
+
<?php
|
317 |
+
}
|
318 |
}
|
319 |
|
320 |
/** Update */
|
389 |
if(!$style){
|
390 |
$style = 'jedi';
|
391 |
}
|
392 |
+
$jsplacement = esc_attr($instance['jsplacement']);
|
393 |
+
if(!$jsplacement){
|
394 |
+
$jsplacement = 'footer';
|
395 |
+
}
|
396 |
|
397 |
$isrockstar = get_option('rockstar');
|
398 |
|
421 |
}else{
|
422 |
$positive = 'CHECKED';
|
423 |
}
|
424 |
+
|
425 |
+
//JS Placement Slector
|
426 |
+
$foot = '';
|
427 |
+
$inline = '';
|
428 |
+
if($jsplacement == 'footer'){
|
429 |
+
$foot = 'CHECKED';
|
430 |
+
}else{
|
431 |
+
$inline = 'CHECKED';
|
432 |
+
}
|
433 |
?>
|
434 |
<p><?php _e('Omit Weeks:'); ?> <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'); ?> </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'); ?></label></p>
|
435 |
<p><?php _e('Style:'); ?> <select name="<?php echo $this->get_field_name('style'); ?>" id="<?php echo $this->get_field_name('style'); ?>">
|
444 |
}
|
445 |
?>
|
446 |
</select></p>
|
447 |
+
<p><?php _e('Inject Script:'); ?> <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'); ?> </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'); ?></label></p>
|
448 |
+
|
449 |
<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; ?>" />
|
450 |
<?php
|
451 |
if($isrockstar){
|
504 |
// register CountDownTimer widget
|
505 |
add_action('widgets_init', create_function('', 'return register_widget("CountDownTimer");'));
|
506 |
|
507 |
+
|
508 |
//code fore the footer
|
509 |
add_action('wp_footer', 'print_my_script');
|
510 |
|
548 |
<?php
|
549 |
}
|
550 |
|
551 |
+
//the short code
|
552 |
function tminuscountdown($atts, $content=null) {
|
553 |
global $add_my_script;
|
554 |
//find a random number, incase there is no id assigned
|
571 |
'launchwidth' => 'auto',
|
572 |
'launchheight' => 'auto',
|
573 |
'launchtarget' => 'countdown',
|
574 |
+
'jsplacement' => 'footer',
|
575 |
), $atts));
|
576 |
|
577 |
|
706 |
$launchheight .= 'px';
|
707 |
}
|
708 |
$content = mysql_real_escape_string( $content);
|
709 |
+
$content = str_replace(array('\r\n', '\r', '\n<p>', '\n'), '', $content);
|
710 |
+
if($jsplacement == "footer"){
|
711 |
+
$add_my_script[$id] = array(
|
712 |
+
'id' => $id,
|
713 |
+
'day' => $day,
|
714 |
+
'month' => $month,
|
715 |
+
'year' => $year,
|
716 |
+
'hour' => $hour,
|
717 |
+
'min' => $min,
|
718 |
+
'sec' => $sec,
|
719 |
+
'localtime' => $t,
|
720 |
+
'style' => $style,
|
721 |
+
'omitweeks' => $omitweeks,
|
722 |
+
'content' => $content,
|
723 |
+
'launchtarget' => $launchtarget,
|
724 |
+
'launchwidth' => $launchwidth,
|
725 |
+
'launchheight' => $launchheight
|
726 |
+
);
|
727 |
+
}
|
728 |
+
else{
|
729 |
+
?>
|
730 |
+
<script language="javascript" type="text/javascript">
|
731 |
+
jQuery(document).ready(function() {
|
732 |
+
jQuery('#<?php echo $id; ?>-dashboard').countDown({
|
733 |
+
targetDate: {
|
734 |
+
'day': <?php echo $day; ?>,
|
735 |
+
'month': <?php echo $month; ?>,
|
736 |
+
'year': <?php echo $year; ?>,
|
737 |
+
'hour': <?php echo $hour; ?>,
|
738 |
+
'min': <?php echo $min; ?>,
|
739 |
+
'sec': <?php echo $sec; ?>,
|
740 |
+
'localtime': '<?php echo $t; ?>',
|
741 |
+
},
|
742 |
+
style: '<?php echo $style; ?>',
|
743 |
+
omitWeeks: <?php echo $omitweeks;
|
744 |
+
if($content){
|
745 |
+
echo ", onComplete: function() {
|
746 |
+
jQuery('#".$id."-".$launchtarget."').css({'width' : '".$launchwidth."', 'height' : '".$launchheight."'});
|
747 |
+
jQuery('#".$id."-".$launchtarget."').html('".do_shortcode($content)."');
|
748 |
+
}";
|
749 |
+
}?>
|
750 |
+
});
|
751 |
+
});
|
752 |
+
</script>
|
753 |
+
<?php
|
754 |
+
}
|
755 |
return $tminus;
|
756 |
}
|
757 |
add_shortcode('tminus', 'tminuscountdown');
|
readme.txt
CHANGED
@@ -5,13 +5,13 @@ Donate link: http://www.twinpictures.de/jquery-t-minus-2-0/
|
|
5 |
Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, G2, spaceBros, littlewebtings, jQuery, javascript
|
6 |
Requires at least: 2.8
|
7 |
Tested up to: 3.1
|
8 |
-
Stable tag: 2.0.
|
9 |
|
10 |
-
jQuery T(-) CountDown
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
jQuery T(-) CountDown
|
15 |
|
16 |
== Installation ==
|
17 |
|
@@ -22,7 +22,7 @@ jQuery T(-) CountDown v2.0 will display a sweet, sexy and totally flash-free cou
|
|
22 |
1. Test that the this plugin meets your demanding needs.
|
23 |
1. Tweak the css files for premium enjoyment.
|
24 |
1. Rate the plugin and verify that it works at wordpress.org.
|
25 |
-
1. Leave a comment regarding bugs, feature request
|
26 |
|
27 |
== Frequently Asked Questions ==
|
28 |
|
@@ -45,6 +45,9 @@ The Daily Show with John Stewart
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
48 |
= 2.0.1 =
|
49 |
* Verify that a style has been set before looping - was throwing an error.
|
50 |
* Inproved loadtimes by printing all javascript in the footer
|
@@ -84,6 +87,9 @@ The Daily Show with John Stewart
|
|
84 |
|
85 |
== Upgrade Notice ==
|
86 |
|
|
|
|
|
|
|
87 |
= 2.0.1 =
|
88 |
Minor bug fixes and improved load times.
|
89 |
|
5 |
Tags: countdown, timer, clock, ticker, widget, event, counter, count down, t minus, t-minus, twinpictures, G2, spaceBros, littlewebtings, jQuery, javascript
|
6 |
Requires at least: 2.8
|
7 |
Tested up to: 3.1
|
8 |
+
Stable tag: 2.0.2
|
9 |
|
10 |
+
jQuery T(-) CountDown will dispaly a highly customizable, sweet-n-sexy flash-free countdown timer in the sidebar or in your post using a shortcode.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
jQuery T(-) CountDown will display a sweet, sexy and totally flash-free countdown timer clock based on littlewebthings' CountDown jQuery plugin. Perfect for informing one's website visitors of an upcoming event, such as a pending space voyage. Using Jedi Mindtricks and CSS... but mostly CSS, the countdown timer is highly customizable for your viewing pleasure. Intergalactic planetary thanks to CosmoBro at g2.de and Lauren at siliconstudio.com for the included css flavors.
|
15 |
|
16 |
== Installation ==
|
17 |
|
22 |
1. Test that the this plugin meets your demanding needs.
|
23 |
1. Tweak the css files for premium enjoyment.
|
24 |
1. Rate the plugin and verify that it works at wordpress.org.
|
25 |
+
1. Leave a comment regarding bugs, feature request or cocktail recipes at http://www.twinpictures.de/jquery-t-minus-2-0/
|
26 |
|
27 |
== Frequently Asked Questions ==
|
28 |
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
= 2.0.2 =
|
49 |
+
* Added option of inserting the javascript in the footer or inline, after the countdown has been inserted.
|
50 |
+
|
51 |
= 2.0.1 =
|
52 |
* Verify that a style has been set before looping - was throwing an error.
|
53 |
* Inproved loadtimes by printing all javascript in the footer
|
87 |
|
88 |
== Upgrade Notice ==
|
89 |
|
90 |
+
= 2.0.2 =
|
91 |
+
New option of placing the javascript in the footer or inline.
|
92 |
+
|
93 |
= 2.0.1 =
|
94 |
Minor bug fixes and improved load times.
|
95 |
|