Changeset 1009887
- Timestamp:
- 10/19/2014 08:10:31 AM (11 years ago)
- Location:
- jellyfish-counter-widget/trunk
- Files:
-
- 4 added
- 4 edited
-
css (added)
-
css/jellyfish-counter.css (added)
-
jellyfish-counter-widget.php (modified) (12 diffs)
-
js/jellyfish-counter-loader.js (added)
-
js/jellyfish-odometer.js (added)
-
languages/jellyfish_cw-en_GB.mo (modified) (previous)
-
languages/jellyfish_cw-en_GB.po (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jellyfish-counter-widget/trunk/jellyfish-counter-widget.php
r829329 r1009887 2 2 /* 3 3 Plugin Name: Jellyfish Counter Widget 4 Plugin URI: http://strawberryjellyfish.com/wordpress-plugin -jellyfish-counter-widget/5 Description: Creates a widget with an odometer style counter that displays either a static number or animates up to a predefined value.4 Plugin URI: http://strawberryjellyfish.com/wordpress-plugins/jellyfish-counter/ 5 Description: Fully configurable static or animated odometer style rotating counters. 6 6 Author: Rob Miller 7 Version: 1. 07 Version: 1.3 8 8 Author URI: http://strawberryjellyfish.com/ 9 9 */ … … 28 28 <?php 29 29 30 add_action( 'init', 'jellyfish_cw_action_init');31 add_action( 'widgets_init', 'jellyfish_cw_create_widgets');30 add_action( 'init', 'jellyfish_cw_action_init' ); 31 add_action( 'widgets_init', 'jellyfish_cw_create_widgets' ); 32 32 33 33 function jellyfish_cw_create_widgets() { 34 register_widget( 'Jellyfish_Counter_Widget');34 register_widget( 'Jellyfish_Counter_Widget' ); 35 35 } 36 36 37 37 function jellyfish_cw_action_init() { 38 load_plugin_textdomain('jellyfish_cw', false, dirname(plugin_basename(__FILE__))); 38 load_plugin_textdomain( 'jellyfish_cw', false, dirname( plugin_basename( __FILE__ ) ) ); 39 wp_register_style( 'jellyfish_cw_css', plugins_url( 'css/jellyfish-counter.css', __FILE__ ) ); 40 wp_register_script( 'jellyfish_cw_odometer', plugins_url( 'js/jellyfish-odometer.js', __FILE__ ), array( 'jquery' ), '', true ); 41 wp_register_script( 'jellyfish_cw_loader', plugins_url( 'js/jellyfish-counter-loader.js', __FILE__ ), array( 'jquery' ), '', true ); 42 // there is no way of knowing if we use a shortcode or not until well after 43 // the head has rendered which is too late to add css on demand... 44 // so just have to always enqueue css by default - not ideal 8| 45 wp_enqueue_style( 'jellyfish_cw_css' ); 46 add_shortcode( 'jellyfish_counter', 'jellyfish_cw_shortcode_handler' ); 39 47 } 48 49 function jellyfish_cw_shortcode_handler( $atts, $content = null ) { 50 global $post; 51 // merge shortcode args with default values 52 $a = shortcode_atts( 53 array( 54 'id' => time(), 55 'digits' => 6, 56 'format' => '', 57 'tenths' => true, 58 'digit_height' => 40, 59 'digit_width' => 30, 60 'digit_padding' => 0, 61 'digit_style' => '', 62 'bustedness' => 2, 63 'flat' => false, 64 'speed' => 80, 65 'start' => 0, 66 'end' => 0, 67 'direction' => 'up', 68 'timestamp' => false, 69 'interval' => 1 70 ), $atts ); 71 72 $element_id = 'jellyfish-counter-shortcode-' . esc_attr( $a['id'] ); 73 74 if ($a['timestamp']) { 75 $init_timestamp = strtotime($a['timestamp'], current_time( 'timestamp' )); 76 if ($init_timestamp) { 77 if ( $a['direction'] == 'down' ) { 78 $a['start'] -= round( ( current_time( 'timestamp' ) - $init_timestamp ) / $a['interval'] ); 79 if ( $a['start'] <= $a['end'] ) { 80 $a['start'] = $a['end']; 81 } 82 } else { 83 $a['start'] += round( ( current_time( 'timestamp' ) - $init_timestamp ) / $a['interval'] ); 84 if ( $a['start'] >= $a['end'] ) { 85 $a['start'] = $a['end']; 86 } 87 } 88 } 89 } else { 90 $current_value = $a['start']; 91 } 92 wp_enqueue_script( 'jellyfish_cw_odometer' ); 93 wp_enqueue_script( 'jellyfish_cw_loader' ); 94 95 $counter_html = ' 96 <div id="' . $element_id . '" 97 class="jellyfish-counter" 98 data-digits="' . esc_attr( $a['digits'] ) .'" 99 data-format="' . esc_attr( $a['format'] ) .'" 100 data-tenths="' . esc_attr( $a['tenths'] ) .'" 101 data-digit-height="' . esc_attr( $a['digit_height'] ) .'" 102 data-digit-width="' . esc_attr( $a['digit_width'] ) .'" 103 data-digit-padding="' . esc_attr( $a['digit_padding'] ) .'" 104 data-digit-style="' . esc_attr( $a['digit_style'] ) .'" 105 data-bustedness="' . esc_attr( $a['bustedness'] ) .'" 106 data-flat="' . esc_attr( $a['flat'] ) .'" 107 data-wait-time="' . max( 0, ( 100 - esc_attr( $a['speed'] ) ) ) .'" 108 data-start-value="' . esc_attr( $a['start'] ) .'" 109 data-end-value="' . esc_attr( $a['end'] ) .'" 110 data-direction="' . esc_attr( $a['direction'] ) .'" 111 data-timestamp="' . esc_attr( $a['timestamp'] ) .'" 112 data-interval="' . esc_attr( $a['interval'] ) .'"> 113 </div>'; 114 $jellyfish_cw_shortcode_id++; 115 return $counter_html; 116 } 117 118 40 119 41 120 // Counter Widget class … … 44 123 function __construct() { 45 124 parent::__construct( 46 'counter_widget', 'Counter Widget', array('description' => 'Show an odometer style counter')125 'counter_widget', 'Counter Widget', array( 'description' => 'Show an odometer style counter' ) 47 126 ); 48 127 } 49 128 50 129 // options form 51 function form( $instance) {130 function form( $instance ) { 52 131 // Retrieve previous values from instance or set default values if new 53 132 $disable_title = $instance['disable_title']; 54 133 $disable_depth = $instance['disable_depth']; 55 134 $disable_tenths = $instance['disable_tenths']; 56 $persist = ( $instance['persist'] == 'true' || $instance['persist'] == 'on') ? 'on' : null;135 $persist = ( $instance['persist'] == 'true' || $instance['persist'] == 'on' ) ? 'on' : null; 57 136 $init_timestamp = $instance['init_timestamp']; 58 137 59 $start_value = ( is_numeric($instance['start_value']) ? $instance['start_value'] : 0 );60 $end_value = ( is_numeric($instance['end_value']) ? $instance['end_value'] : 100 );61 $animate_speed = ( is_numeric($instance['animate_speed']) ? $instance['animate_speed'] : 50 );62 $direction = ( !empty($instance['direction']) ? $instance['direction'] : 'up' );63 $ persist_interval = (is_numeric($instance['persist_interval']) ? $instance['persist_interval'] : 1 );64 $number_of_digits = ( is_numeric($instance['number_of_digits']) ? $instance['number_of_digits'] : 5 );65 $digit_height = ( is_numeric($instance['digit_height']) ? $instance['digit_height'] : 40 );66 $digit_width = ( is_numeric($instance['digit_width']) ? $instance['digit_width'] : 30 );67 $digit_padding = ( is_numeric($instance['digit_padding']) ? $instance['digit_padding'] : 0 );68 $digit_bustedness = ( is_numeric($instance['digit_bustedness']) ? $instance['digit_bustedness'] : 2 );69 70 $digit_style = ( !empty($instance['digit_style']) ? $instance['digit_style'] : 'font-family: Courier New, Courier, monospace; font-weight: 900;' );71 $widget_title = ( !empty($instance['widget_title']) ? $instance['widget_title'] : 'Counter' );138 $start_value = ( is_numeric( $instance['start_value'] ) ? $instance['start_value'] : 0 ); 139 $end_value = ( is_numeric( $instance['end_value'] ) ? $instance['end_value'] : 100 ); 140 $animate_speed = ( is_numeric( $instance['animate_speed'] ) ? $instance['animate_speed'] : 50 ); 141 $direction = ( !empty( $instance['direction'] ) ? $instance['direction'] : 'up' ); 142 $interval = ( is_numeric( $instance['persist_interval'] ) ? $instance['persist_interval'] : 1 ); 143 $number_of_digits = ( is_numeric( $instance['number_of_digits'] ) ? $instance['number_of_digits'] : 5 ); 144 $digit_height = ( is_numeric( $instance['digit_height'] ) ? $instance['digit_height'] : 40 ); 145 $digit_width = ( is_numeric( $instance['digit_width'] ) ? $instance['digit_width'] : 30 ); 146 $digit_padding = ( is_numeric( $instance['digit_padding'] ) ? $instance['digit_padding'] : 0 ); 147 $digit_bustedness = ( is_numeric( $instance['digit_bustedness'] ) ? $instance['digit_bustedness'] : 2 ); 148 149 $digit_style = ( !empty( $instance['digit_style'] ) ? $instance['digit_style'] : 'font-family: Courier New, Courier, monospace; font-weight: 900;' ); 150 $widget_title = ( !empty( $instance['widget_title'] ) ? $instance['widget_title'] : 'Counter' ); 72 151 $before_text = $instance['before_text']; 73 152 $after_text = $instance['after_text']; 153 $format = $instance['format']; 74 154 75 155 // get the current count of an active continuous counter 76 if (($persist == 'on') && !empty($init_timestamp)) { 77 if ( $direction == 'down') { 78 $current_value = $start_value - round((time() - $init_timestamp) / $persist_interval); 79 if ($current_value < $end_value) { 80 $current_value = $end_value; 156 // set to end value if it's already finished 157 if ( ( $persist == 'on' ) && !empty( $init_timestamp ) ) { 158 if ( $direction == 'down' ) { 159 $start_value -= round( ( current_time( 'timestamp' ) - $init_timestamp ) / $interval ); 160 if ( $start_value < $end_value ) { 161 $start_value = $end_value; 81 162 } 82 } elseif ( $direction == 'up' ) {83 $ current_value = $start_value + round((time() - $init_timestamp) / $persist_interval);84 if ( $current_value > $end_value) {85 $ current_value = $end_value;163 } elseif ( $direction == 'up' ) { 164 $start_value += round( ( current_time( 'timestamp' ) - $init_timestamp ) / $interval ); 165 if ( $start_value > $end_value ) { 166 $start_value = $end_value; 86 167 } 87 168 } 88 169 } 89 170 90 ?>91 <p> 92 <label for="<?php echo $this->get_field_id( 'start_value'); ?>">93 <?php echo _e( 'Start Value:', 'jellyfish_cw'); ?>94 <input type="text" 95 id="<?php echo $this->get_field_id('start_value'); ?>"96 name="<?php echo $this->get_field_name('start_value'); ?>"97 value="<?php echo $start_value; ?>"98 class="widefat"99 />100 </label> 101 <?php if ( ($persist == 'on') && (isset($current_value))) { ?>171 ?> 172 <p> 173 <label for="<?php echo $this->get_field_id( 'start_value' ); ?>"> 174 <?php echo _e( 'Start Value:', 'jellyfish_cw' ); ?> 175 <input type="text" 176 id="<?php echo $this->get_field_id( 'start_value' ); ?>" 177 name="<?php echo $this->get_field_name( 'start_value' ); ?>" 178 value="<?php echo $start_value; ?>" 179 class="widefat" 180 /> 181 </label> 182 <?php if ( ( $persist == 'on' ) && ( isset( $current_value ) ) ) { ?> 102 183 <span class="description"> 103 <?php _e( 'This counter is active, the current count is', 'jellyfish_cw'); ?> <?php echo $current_value; ?>.104 <?php _e( 'Changing the start value will restart the counter.', 'jellyfish_cw'); ?>184 <?php _e( 'This counter is active, the current count is', 'jellyfish_cw' ); ?> <?php echo $current_value; ?>. 185 <?php _e( 'Changing the start value will restart the counter.', 'jellyfish_cw' ); ?> 105 186 </span> 106 187 <?php } ?> 107 188 </p> 108 <p> 109 <label for="<?php echo $this->get_field_id('end_value'); ?>"> 110 <?php _e('End Value:', 'jellyfish_cw'); ?> 111 <input type="text" 112 id="<?php echo $this->get_field_id('end_value'); ?>" 113 name="<?php echo $this->get_field_name('end_value'); ?>" 114 value="<?php echo $end_value; ?>" 115 class="widefat" 116 /> 117 </label> 118 </p> 119 <p> 120 <label for="<?php echo $this->get_field_id('direction'); ?>"> 121 <?php _e('Counter Type:', 'jellyfish_cw'); ?> 122 <select id="<?php echo $this->get_field_id('direction'); ?>" 123 name="<?php echo $this->get_field_name('direction'); ?>"> 189 190 <p> 191 <label for="<?php echo $this->get_field_id( 'end_value' ); ?>"> 192 <?php _e( 'End Value:', 'jellyfish_cw' ); ?> 193 <input type="text" 194 id="<?php echo $this->get_field_id( 'end_value' ); ?>" 195 name="<?php echo $this->get_field_name( 'end_value' ); ?>" 196 value="<?php echo $end_value; ?>" 197 class="widefat" 198 /> 199 </label> 200 </p> 201 <p> 202 <label for="<?php echo $this->get_field_id( 'direction' ); ?>"> 203 <?php _e( 'Counter Type:', 'jellyfish_cw' ); ?> 204 <select id="<?php echo $this->get_field_id( 'direction' ); ?>" 205 name="<?php echo $this->get_field_name( 'direction' ); ?>"> 124 206 <option value="up" 125 <?php selected($direction, 'up'); ?>>126 <?php _e( 'Count Up', 'jellyfish_cw'); ?></option>207 <?php selected( $direction, 'up' ); ?>> 208 <?php _e( 'Count Up', 'jellyfish_cw' ); ?></option> 127 209 <option value="static" 128 <?php selected($direction, 'static'); ?>>129 <?php _e( 'Static', 'jellyfish_cw'); ?></option>210 <?php selected( $direction, 'static' ); ?>> 211 <?php _e( 'Static', 'jellyfish_cw' ); ?></option> 130 212 <option value="down" 131 <?php selected($direction, 'down'); ?>>132 <?php _e( 'Count Down', 'jellyfish_cw'); ?></option>213 <?php selected( $direction, 'down' ); ?>> 214 <?php _e( 'Count Down', 'jellyfish_cw' ); ?></option> 133 215 </select> 134 216 </label> 135 217 </p> 136 218 <p> 137 <input class="checkbox" type="checkbox" <?php checked( $persist, 'on' ); ?>219 <input class="checkbox" type="checkbox" <?php checked( $persist, 'on' ); ?> 138 220 id="<?php echo $this->get_field_id( 'persist' ); ?>" 139 name="<?php echo $this->get_field_name( 'persist' ); ?>" />140 141 <label for="<?php echo $this->get_field_id( 'persist'); ?>">142 <?php _e( 'Continuous Counter', 'jellyfish_cw'); ?>221 name="<?php echo $this->get_field_name( 'persist' ); ?>" 222 /> 223 <label for="<?php echo $this->get_field_id( 'persist' ); ?>"> 224 <?php _e( 'Continuous Counter', 'jellyfish_cw' ); ?> 143 225 </label> 144 226 <br/> 145 227 <span class="description"> 146 <?php _e( 'Counts continuously in the background, starts as soon as this widget is saved.', 'jellyfish_cw'); ?>228 <?php _e( 'Counts continuously in the background, starts as soon as this widget is saved.', 'jellyfish_cw' ); ?> 147 229 </span> 148 230 </p> 149 231 <p> 150 <label for="<?php echo $this->get_field_id( 'persist_interval'); ?>">151 <?php _e( 'Continuous Interval:', 'jellyfish_cw'); ?>152 <input type="text" 153 id="<?php echo $this->get_field_id('persist_interval'); ?>"154 name="<?php echo $this->get_field_name('persist_interval'); ?>"155 value="<?php echo $persist_interval; ?>"156 size=6157 />158 <?php _e('seconds', 'jellyfish_cw'); ?>232 <label for="<?php echo $this->get_field_id( 'persist_interval' ); ?>"> 233 <?php _e( 'Continuous Interval:', 'jellyfish_cw' ); ?> 234 <input type="text" 235 id="<?php echo $this->get_field_id( 'persist_interval' ); ?>" 236 name="<?php echo $this->get_field_name( 'persist_interval' ); ?>" 237 value="<?php echo $interval; ?>" 238 size=6 239 /> 240 <?php _e( 'seconds', 'jellyfish_cw' ); ?> 159 241 </label> 160 242 <br/> 161 243 <span class="description"> 162 <?php _e( 'How often a continuous style counter updates', 'jellyfish_cw'); ?>244 <?php _e( 'How often a continuous style counter updates', 'jellyfish_cw' ); ?> 163 245 </span> 164 246 </p> 165 247 <hr> 166 <h3 class="title"><?php _e( 'Appearance', 'jellyfish_cw'); ?></h3>167 <p> 168 <label for="<?php echo $this->get_field_id( 'widget_title'); ?>">169 <?php _e( 'Widget Title:', 'jellyfish_cw'); ?>170 <input type="text" 171 id="<?php echo $this->get_field_id('widget_title'); ?>"172 name="<?php echo $this->get_field_name('widget_title'); ?>"173 value="<?php echo $widget_title; ?>"174 class="widefat"175 /> 176 </label> 177 </p> 178 <p> 179 <input class="checkbox" type="checkbox" <?php checked( $disable_title, 'on' ); ?>248 <h3 class="title"><?php _e( 'Appearance', 'jellyfish_cw' ); ?></h3> 249 <p> 250 <label for="<?php echo $this->get_field_id( 'widget_title' ); ?>"> 251 <?php _e( 'Widget Title:', 'jellyfish_cw' ); ?> 252 <input type="text" 253 id="<?php echo $this->get_field_id( 'widget_title' ); ?>" 254 name="<?php echo $this->get_field_name( 'widget_title' ); ?>" 255 value="<?php echo $widget_title; ?>" 256 class="widefat" 257 /> 258 </label> 259 </p> 260 <p> 261 <input class="checkbox" type="checkbox" <?php checked( $disable_title, 'on' ); ?> 180 262 id="<?php echo $this->get_field_id( 'disable_title' ); ?>" 181 name="<?php echo $this->get_field_name( 'disable_title' ); ?>" /> 182 <label for="<?php echo $this->get_field_id('disable_title'); ?>"> 183 <?php _e('Hide Title', 'jellyfish_cw'); ?> 184 </label> 185 </p> 186 <p> 187 <label for="<?php echo $this->get_field_id('before_text'); ?>"> 188 <?php _e('Text to display before counter:', 'jellyfish_cw'); ?></label> 189 <textarea id="<?php echo $this->get_field_id('before_text'); ?>" class="widefat" name="<?php echo $this->get_field_name('before_text'); ?>"><?php echo $before_text; ?></textarea> 190 </p> 191 <p> 192 <label for="<?php echo $this->get_field_id('after_text'); ?>"> 193 <?php _e('Text to display after counter:', 'jellyfish_cw'); ?></label> 194 <textarea id="<?php echo $this->get_field_id('after_text'); ?>" class="widefat" name="<?php echo $this->get_field_name('after_text'); ?>"><?php echo $after_text; ?></textarea> 195 </p> 196 <p> 197 <label for="<?php echo $this->get_field_id('number_of_digits'); ?>"> 198 <?php _e('Number of Digits:', 'jellyfish_cw'); ?> 199 <input type="text" 200 id="<?php echo $this->get_field_id('number_of_digits'); ?>" 201 name="<?php echo $this->get_field_name('number_of_digits'); ?>" 202 value="<?php echo $number_of_digits; ?>" 203 size=3 204 /> 205 </label> 206 </p> 207 <p> 208 <input class="checkbox" type="checkbox" <?php checked( $disable_tenths, 'on'); ?> 263 name="<?php echo $this->get_field_name( 'disable_title' ); ?>" 264 /> 265 <label for="<?php echo $this->get_field_id( 'disable_title' ); ?>"> 266 <?php _e( 'Hide Title', 'jellyfish_cw' ); ?> 267 </label> 268 </p> 269 <p> 270 <label for="<?php echo $this->get_field_id( 'before_text' ); ?>"> 271 <?php _e( 'Text to display before counter:', 'jellyfish_cw' ); ?> 272 </label> 273 <textarea id="<?php echo $this->get_field_id( 'before_text' ); ?>" class="widefat" name="<?php echo $this->get_field_name( 'before_text' ); ?>"><?php echo $before_text; ?></textarea> 274 </p> 275 <p> 276 <label for="<?php echo $this->get_field_id( 'after_text' ); ?>"> 277 <?php _e( 'Text to display after counter:', 'jellyfish_cw' ); ?> 278 </label> 279 <textarea id="<?php echo $this->get_field_id( 'after_text' ); ?>" class="widefat" name="<?php echo $this->get_field_name( 'after_text' ); ?>"><?php echo $after_text; ?></textarea> 280 </p> 281 <p> 282 <label for="<?php echo $this->get_field_id( 'number_of_digits' ); ?>"> 283 <?php _e( 'Number of Digits:', 'jellyfish_cw' ); ?> 284 <input type="text" 285 id="<?php echo $this->get_field_id( 'number_of_digits' ); ?>" 286 name="<?php echo $this->get_field_name( 'number_of_digits' ); ?>" 287 value="<?php echo $number_of_digits; ?>" 288 size=3 289 /> 290 </label> 291 </p> 292 <p> 293 <label for="<?php echo $this->get_field_id( 'format' ); ?>"> 294 <?php _e( 'Format:', 'jellyfish_cw' ); ?> 295 <input type="text" 296 id="<?php echo $this->get_field_id( 'format' ); ?>" 297 name="<?php echo $this->get_field_name( 'format' ); ?>" 298 value="<?php echo $format; ?>" 299 /> 300 </label> 301 <br/> 302 <span class="description"> 303 <?php _e( 'Allows a custom format for the counter e.g $00.00. This option with override the Number of Digits option. Any 0 will be replaced with a counter digit, any other characters will be displayed as it is.', 'jellyfish_cw' ); ?> 304 </span> 305 </p> 306 <p> 307 <input class="checkbox" type="checkbox" <?php checked( $disable_tenths, 'on' ); ?> 209 308 id="<?php echo $this->get_field_id( 'disable_tenths' ); ?>" 210 309 name="<?php echo $this->get_field_name( 'disable_tenths' ); ?>" /> 211 <label for="<?php echo $this->get_field_id( 'disable_tenths'); ?>">212 <?php _e( 'Disable Tenths', 'jellyfish_cw'); ?>213 </label> 214 </p> 215 <p> 216 <label for="<?php echo $this->get_field_id( 'animate_speed'); ?>">217 <?php _e( 'Animation Speed:', 'jellyfish_cw'); ?>218 <input type="text" 219 id="<?php echo $this->get_field_id('animate_speed'); ?>"220 name="<?php echo $this->get_field_name('animate_speed'); ?>"221 value="<?php echo $animate_speed; ?>"222 size=3310 <label for="<?php echo $this->get_field_id( 'disable_tenths' ); ?>"> 311 <?php _e( 'Disable Tenths', 'jellyfish_cw' ); ?> 312 </label> 313 </p> 314 <p> 315 <label for="<?php echo $this->get_field_id( 'animate_speed' ); ?>"> 316 <?php _e( 'Animation Speed:', 'jellyfish_cw' ); ?> 317 <input type="text" 318 id="<?php echo $this->get_field_id( 'animate_speed' ); ?>" 319 name="<?php echo $this->get_field_name( 'animate_speed' ); ?>" 320 value="<?php echo $animate_speed; ?>" 321 size=3 223 322 /> 224 323 </label> 225 324 <br/> 226 325 <span class="description"> 227 <?php _e( 'A value (1-100). Not used for continuous style counters', 'jellyfish_cw'); ?>326 <?php _e( 'A value (1-100). Not used for continuous style counters', 'jellyfish_cw' ); ?> 228 327 </span> 229 328 </p> 230 329 <p> 231 <label for="<?php echo $this->get_field_id( 'digit_height'); ?>">232 <?php _e( 'Digit Height:', 'jellyfish_cw'); ?>233 <input type="text" 234 id="<?php echo $this->get_field_id('digit_height'); ?>"235 name="<?php echo $this->get_field_name('digit_height'); ?>"236 value="<?php echo $digit_height; ?>"237 size=3330 <label for="<?php echo $this->get_field_id( 'digit_height' ); ?>"> 331 <?php _e( 'Digit Height:', 'jellyfish_cw' ); ?> 332 <input type="text" 333 id="<?php echo $this->get_field_id( 'digit_height' ); ?>" 334 name="<?php echo $this->get_field_name( 'digit_height' ); ?>" 335 value="<?php echo $digit_height; ?>" 336 size=3 238 337 /> 239 338 <?php echo ' px'; ?> … … 241 340 </p> 242 341 <p> 243 <label for="<?php echo $this->get_field_id( 'digit_width'); ?>">244 <?php _e( 'Digit Width:', 'jellyfish_cw'); ?>245 <input type="text" 246 id="<?php echo $this->get_field_id('digit_width'); ?>"247 name="<?php echo $this->get_field_name('digit_width'); ?>"248 value="<?php echo $digit_width; ?>"249 size=3342 <label for="<?php echo $this->get_field_id( 'digit_width' ); ?>"> 343 <?php _e( 'Digit Width:', 'jellyfish_cw' ); ?> 344 <input type="text" 345 id="<?php echo $this->get_field_id( 'digit_width' ); ?>" 346 name="<?php echo $this->get_field_name( 'digit_width' ); ?>" 347 value="<?php echo $digit_width; ?>" 348 size=3 250 349 /> 251 350 <?php echo ' px'; ?> … … 253 352 </p> 254 353 <p> 255 <label for="<?php echo $this->get_field_id( 'digit_padding'); ?>">256 <?php _e( 'Digit Padding:', 'jellyfish_cw'); ?>257 <input type="text" 258 id="<?php echo $this->get_field_id('digit_padding'); ?>"259 name="<?php echo $this->get_field_name('digit_padding'); ?>"260 value="<?php echo $digit_padding; ?>"261 size=3354 <label for="<?php echo $this->get_field_id( 'digit_padding' ); ?>"> 355 <?php _e( 'Digit Padding:', 'jellyfish_cw' ); ?> 356 <input type="text" 357 id="<?php echo $this->get_field_id( 'digit_padding' ); ?>" 358 name="<?php echo $this->get_field_name( 'digit_padding' ); ?>" 359 value="<?php echo $digit_padding; ?>" 360 size=3 262 361 /> 263 362 <?php echo ' px'; ?> … … 265 364 </p> 266 365 <p> 267 <input class="checkbox" type="checkbox" <?php checked( $disable_depth, 'on' ); ?>366 <input class="checkbox" type="checkbox" <?php checked( $disable_depth, 'on' ); ?> 268 367 id="<?php echo $this->get_field_id( 'disable_depth' ); ?>" 269 368 name="<?php echo $this->get_field_name( 'disable_depth' ); ?>" /> 270 <label for="<?php echo $this->get_field_id( 'disable_depth'); ?>">271 <?php _e( 'Disable 3D effect', 'jellyfish_cw'); ?>272 </label> 273 </p> 274 <p> 275 <label for="<?php echo $this->get_field_id( 'digit_bustedness'); ?>">276 <?php _e( 'Bustedness:', 'jellyfish_cw'); ?>277 <input type="text" 278 id="<?php echo $this->get_field_id('digit_bustedness'); ?>"279 name="<?php echo $this->get_field_name('digit_bustedness'); ?>"280 value="<?php echo $digit_bustedness; ?>"281 size=3369 <label for="<?php echo $this->get_field_id( 'disable_depth' ); ?>"> 370 <?php _e( 'Disable 3D effect', 'jellyfish_cw' ); ?> 371 </label> 372 </p> 373 <p> 374 <label for="<?php echo $this->get_field_id( 'digit_bustedness' ); ?>"> 375 <?php _e( 'Bustedness:', 'jellyfish_cw' ); ?> 376 <input type="text" 377 id="<?php echo $this->get_field_id( 'digit_bustedness' ); ?>" 378 name="<?php echo $this->get_field_name( 'digit_bustedness' ); ?>" 379 value="<?php echo $digit_bustedness; ?>" 380 size=3 282 381 /> 283 382 </label> … … 286 385 </p> 287 386 <p> 288 <label for="<?php echo $this->get_field_id( 'digit_style'); ?>">289 <?php _e( 'Digit Style:', 'jellyfish_cw'); ?>290 <input type="text" 291 id="<?php echo $this->get_field_id('digit_style'); ?>"292 name="<?php echo $this->get_field_name('digit_style'); ?>"293 value="<?php echo $digit_style; ?>"294 class="widefat"387 <label for="<?php echo $this->get_field_id( 'digit_style' ); ?>"> 388 <?php _e( 'Digit Style:', 'jellyfish_cw' ); ?> 389 <input type="text" 390 id="<?php echo $this->get_field_id( 'digit_style' ); ?>" 391 name="<?php echo $this->get_field_name( 'digit_style' ); ?>" 392 value="<?php echo $digit_style; ?>" 393 class="widefat" 295 394 /> 296 395 </label> 297 396 <br/> 298 397 <span class="description"> 299 <?php _e( 'CSS entered here will alter the appearance of the digits', 'jellyfish_cw'); ?>398 <?php _e( 'CSS entered here will alter the appearance of the digits', 'jellyfish_cw' ); ?> 300 399 </span> 301 400 </p> … … 303 402 } 304 403 305 function update( $new_instance, $old_instance) {404 function update( $new_instance, $old_instance ) { 306 405 $instance = $old_instance; 307 406 308 407 // string values 309 $instance['digit_style'] = sanitize_text_field($new_instance['digit_style']); 310 $instance['widget_title'] = sanitize_text_field($new_instance['widget_title']); 311 $instance['before_text'] = sanitize_text_field($new_instance['before_text']); 312 $instance['after_text'] = sanitize_text_field($new_instance['after_text']); 313 $instance['direction'] = sanitize_text_field($new_instance['direction']); 408 $instance['digit_style'] = sanitize_text_field( $new_instance['digit_style'] ); 409 $instance['widget_title'] = sanitize_text_field( $new_instance['widget_title'] ); 410 $instance['before_text'] = sanitize_text_field( $new_instance['before_text'] ); 411 $instance['after_text'] = sanitize_text_field( $new_instance['after_text'] ); 412 $instance['direction'] = sanitize_text_field( $new_instance['direction'] ); 413 $instance['format'] = sanitize_text_field( $new_instance['format'] ); 314 414 315 415 // boolean values … … 320 420 321 421 // numeric values 322 if ( is_numeric($new_instance['number_of_digits'])) {323 $instance['number_of_digits'] = intval( $new_instance['number_of_digits']);324 } 325 326 if ( is_numeric($new_instance['digit_height'])) {327 $instance['digit_height'] = intval( $new_instance['digit_height']);328 } 329 330 if ( is_numeric($new_instance['digit_width'])) {331 $instance['digit_width'] = intval( $new_instance['digit_width']);332 } 333 334 if ( is_numeric($new_instance['digit_padding'])) {335 $instance['digit_padding'] = intval( $new_instance['digit_padding']);336 } 337 338 if ( is_numeric($new_instance['digit_bustedness'])) {339 $instance['digit_bustedness'] = intval( $new_instance['digit_bustedness']);340 } 341 342 if ( is_numeric($new_instance['end_value'])) {343 $instance['end_value'] = intval( $new_instance['end_value']);344 } 345 346 if ( is_numeric($new_instance['animate_speed'])) {347 $instance['animate_speed'] = min( intval($new_instance['animate_speed']), 100);348 } 349 350 if ( is_numeric($new_instance['persist_interval'])) {351 $instance['persist_interval'] = intval( $new_instance['persist_interval']);352 } 353 354 if ( is_numeric($new_instance['start_value']) && ($new_instance['start_value'] != $instance['start_value'])) {422 if ( is_numeric( $new_instance['number_of_digits'] ) ) { 423 $instance['number_of_digits'] = intval( $new_instance['number_of_digits'] ); 424 } 425 426 if ( is_numeric( $new_instance['digit_height'] ) ) { 427 $instance['digit_height'] = intval( $new_instance['digit_height'] ); 428 } 429 430 if ( is_numeric( $new_instance['digit_width'] ) ) { 431 $instance['digit_width'] = intval( $new_instance['digit_width'] ); 432 } 433 434 if ( is_numeric( $new_instance['digit_padding'] ) ) { 435 $instance['digit_padding'] = intval( $new_instance['digit_padding'] ); 436 } 437 438 if ( is_numeric( $new_instance['digit_bustedness'] ) ) { 439 $instance['digit_bustedness'] = intval( $new_instance['digit_bustedness'] ); 440 } 441 442 if ( is_numeric( $new_instance['end_value'] ) ) { 443 $instance['end_value'] = intval( $new_instance['end_value'] ); 444 } 445 446 if ( is_numeric( $new_instance['animate_speed'] ) ) { 447 $instance['animate_speed'] = min( intval( $new_instance['animate_speed'] ), 100 ); 448 } 449 450 if ( is_numeric( $new_instance['persist_interval'] ) ) { 451 $instance['persist_interval'] = intval( $new_instance['persist_interval'] ); 452 } 453 454 if ( is_numeric( $new_instance['start_value'] ) && ( $new_instance['start_value'] != $instance['start_value'] ) ) { 355 455 // start value has changed, time to restart the counter 356 $instance['init_timestamp'] = time();456 $instance['init_timestamp'] = current_time( 'timestamp' ); 357 457 $instance['start_value'] = $new_instance['start_value']; 358 458 } 359 459 360 if ( empty($instance['init_timestamp'])) {361 $instance['init_timestamp'] = time();460 if ( empty( $instance['init_timestamp'] ) ) { 461 $instance['init_timestamp'] = current_time( 'timestamp' ); 362 462 } 363 463 return $instance; 364 464 } 365 465 366 function widget( $args, $instance) {466 function widget( $args, $instance ) { 367 467 // queue javascript if widget is used 368 if (is_active_widget(false, false, $this->id_base)) 369 wp_enqueue_script('odometer', plugins_url('js/odometer.js', __FILE__), array('jquery'), '', true); 370 468 if ( is_active_widget( false, false, $this->id_base ) ) { 469 wp_enqueue_script( 'jellyfish_cw_odometer' ); 470 wp_enqueue_script( 'jellyfish_cw_loader' ); 471 } 371 472 // Extract members of args array as individual variables 372 extract( $args);473 extract( $args ); 373 474 374 475 // these options were not in the first release so to play nice 375 476 // we'll add some defaults here to avoid any undefined indexes 376 477 377 $persist_interval = (isset($instance['persist_interval']) ? 378 $instance['persist_interval'] : 1 ); 379 380 $init_timestamp = (isset($instance['init_timestamp']) ? 381 $instance['init_timestamp'] : time() ); 382 // 383 384 $disable_title = isset($instance['disable_title']) ? 'true' : 'false'; 385 $disable_tenths = isset($instance['disable_tenths']) ? 'true' : 'false'; 478 $interval = ( isset( $instance['persist_interval'] ) ? 479 $instance['persist_interval'] : 1 ); 480 481 $init_timestamp = ( isset( $instance['init_timestamp'] ) ? 482 $instance['init_timestamp'] : current_time( 'timestamp' ) ); 483 484 $disable_title = isset( $instance['disable_title'] ) ? 'true' : 'false'; 485 $disable_tenths = isset( $instance['disable_tenths'] ) ? 'true' : 'false'; 386 486 $tenths = $disable_tenths == 'true' ? 'false' : 'true' ; 387 $disable_depth = isset( $instance['disable_depth']) ? 'true' : 'false';388 $persist = isset( $instance['persist']) ? 'true' : 'false';487 $disable_depth = isset( $instance['disable_depth'] ) ? 'true' : 'false'; 488 $persist = isset( $instance['persist'] ) ? 'true' : 'false'; 389 489 390 490 $number_of_digits = $instance['number_of_digits']; 491 $format = $instance['format']; 391 492 $start_value = $instance['start_value']; 392 493 $end_value = $instance['end_value']; 393 494 394 495 $animate_speed = $instance['animate_speed']; 395 $wait_time = max( 0, (100 - $animate_speed));496 $wait_time = max( 0, ( 100 - $animate_speed ) ); 396 497 397 498 $digit_height = $instance['digit_height']; … … 401 502 $digit_style = $instance['digit_style']; 402 503 $widget_title = $instance['widget_title']; 403 $before_text = esc_attr( $instance['before_text']);404 $after_text = esc_attr( $instance['after_text']);504 $before_text = esc_attr( $instance['before_text'] ); 505 $after_text = esc_attr( $instance['after_text'] ); 405 506 $direction = $instance['direction']; 406 507 407 if ( $persist == 'true') {408 // calculate how may 'counts' have passed since initializing the counter widget409 // and update the start_value appropriately. If we have already passed the end_value410 // then we don't want to continue counting.411 if ( $direction == 'down' ) {412 $start_value = $start_value - round((time() - $init_timestamp) / $persist_interval);413 if ( $start_value < $end_value) {508 if ( $persist == 'true' ) { 509 // calculate how may 'counts' have passed since initializing the counter 510 // widget and update the start_value appropriately. If we have already 511 // passed the end_value then we don't want to continue counting. 512 if ( $direction == 'down' ) { 513 $start_value -= round( ( current_time( 'timestamp' ) - $init_timestamp ) / $interval ); 514 if ( $start_value < $end_value ) { 414 515 $start_value = $end_value; 415 516 } 416 } elseif ( $direction == 'up' ) {417 $start_value = $start_value + round((time() - $init_timestamp) / $persist_interval);418 if ( $start_value > $end_value) {517 } elseif ( $direction == 'up' ) { 518 $start_value += round( ( current_time( 'timestamp' ) - $init_timestamp ) / $interval ); 519 if ( $start_value > $end_value ) { 419 520 $start_value = $end_value; 420 521 } … … 423 524 $tenths = 'false'; 424 525 } else { 425 $persist_interval = 1; 426 } 427 428 $persist_interval_ms = $persist_interval * 1000; 429 430 if ($direction == 'static') { 526 $interval = 1; 527 } 528 529 if ( $direction == 'static' ) { 431 530 $end_value = $start_value; 432 531 } … … 434 533 // Begin widget output 435 534 echo $before_widget; 436 if ( $disable_title == 'false') {535 if ( $disable_title == 'false' ) { 437 536 echo $before_title; 438 echo apply_filters( 'widget_title', $widget_title);537 echo apply_filters( 'widget_title', $widget_title ); 439 538 echo $after_title; 440 539 } 441 if ( $before_text) {540 if ( $before_text ) { 442 541 echo '<div class="odometer-description">'; 443 echo apply_filters( 'the_content', $before_text);542 echo apply_filters( 'widget_content', $before_text ); 444 543 echo '</div>'; 445 544 } 446 echo '<div id="odometer-' . $args['widget_id'] . '" class="odometer-widget"></div>'; 447 if ($after_text) { 545 echo '<div id="odometer-' . $args['widget_id'] . '" 546 class="odometer-widget jellyfish-counter" 547 data-digits="' . $number_of_digits .'" 548 data-format="' . $format .'" 549 data-tenths="' . $tenths .'" 550 data-digit-height="' . $digit_height .'" 551 data-digit-width="' . $digit_width .'" 552 data-digit-padding="' . $digit_padding .'" 553 data-digit-style="' . $digit_style .'" 554 data-bustedness="' . $digit_bustedness .'" 555 data-flat="' . $disable_depth .'" 556 data-wait-time="' . $wait_time .'" 557 data-start-value="' . $start_value .'" 558 data-end-value="' . $end_value .'" 559 data-direction="' . $direction .'" 560 data-timestamp="' . $persist .'" 561 data-interval="' . $interval .'"> 562 </div>'; 563 if ( $after_text ) { 448 564 echo '<div class="odometer-description">'; 449 echo apply_filters( 'the_content', $after_text);565 echo apply_filters( 'widget_content', $after_text ); 450 566 echo '</div>'; 451 567 } 452 // output javascript453 echo "<script type='text/javascript'>454 jQuery(document).ready(function() {455 var waitTime = $wait_time;456 var counterStartValue = $start_value;457 var counterEndValue = $end_value;458 var counterNow = $start_value;459 var direction = '$direction';460 var wholeNumber = 0;461 var persist = $persist;462 var div = document.getElementById('odometer-" . $args['widget_id'] . "');463 var myOdometer = new Odometer(div, {464 digits: $number_of_digits,465 tenths: $tenths,466 digitHeight: $digit_height,467 digitWidth: $digit_width,468 digitPadding: $digit_padding,469 fontStyle: '$digit_style',470 bustedness: $digit_bustedness,471 disableHighlights: $disable_depth472 });473 474 function updateOdometer() {475 if (persist) {476 if (direction =='down') {477 counterNow=counterNow-0.15;478 } else {479 counterNow=counterNow+0.15;480 }481 wholeNumber=wholeNumber+0.15;482 if (wholeNumber >= 1) {483 wholeNumber = 0;484 counterNow = Math.round(counterNow);485 waitTime = $persist_interval_ms;486 } else {487 waitTime = 1;488 }489 } else {490 if (direction =='down') {491 counterNow=counterNow-0.01;492 } else {493 counterNow=counterNow+0.01;494 }495 }496 if (( direction !='down' && (counterNow < counterEndValue)) || (direction =='down' && (counterNow > counterEndValue))) {497 myOdometer.set(counterNow);498 window.setTimeout(function() {499 updateOdometer();500 }, waitTime);501 }502 }503 504 if ( counterEndValue != counterStartValue) {505 myOdometer.set(counterStartValue);506 updateOdometer();507 } else {508 myOdometer.set(counterStartValue);509 }510 });511 </script>";512 568 // finish off widget 513 569 echo $after_widget; 514 570 } 515 571 } 572 516 573 ?> -
jellyfish-counter-widget/trunk/languages/jellyfish_cw-en_GB.po
r829329 r1009887 3 3 "Project-Id-Version: Jellyfish Counter Widget v1.0\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 "POT-Creation-Date: \n"6 "PO-Revision-Date: 201 3-12-27 03:00:14+0000\n"5 "POT-Creation-Date: 2014-09-19 19:14+0930\n" 6 "PO-Revision-Date: 2014-09-19 19:15+0930\n" 7 7 "Last-Translator: Rob Miller <[email protected]>\n" 8 8 "Language-Team: \n" 9 "Language: en_GB\n" 9 10 "MIME-Version: 1.0\n" 10 11 "Content-Type: text/plain; charset=UTF-8\n" 11 12 "Content-Transfer-Encoding: 8bit\n" 12 13 "Plural-Forms: nplurals=2; plural=n != 1;\n" 13 "X-Generator: CSL v1.x\n" 14 "X-Poedit-Language: English\n" 15 "X-Poedit-Country: UNITED KINGDOM\n" 14 "X-Generator: Poedit 1.6.3\n" 16 15 "X-Poedit-SourceCharset: utf-8\n" 17 "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n" 16 "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" 17 "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n" 18 18 "X-Poedit-Basepath: ../\n" 19 "X- Poedit-Bookmarks:\n"19 "X-Textdomain-Support: yes\n" 20 20 "X-Poedit-SearchPath-0: .\n" 21 "X-Textdomain-Support: yes"22 21 23 # : jellyfish-counter-widget.php:9724 # @ jellyfish_cw22 # @ jellyfish_cw 23 #: jellyfish-counter-widget.php:94 25 24 msgid "Start Value:" 26 25 msgstr "Start Value:" 27 26 28 #: jellyfish-counter-widget.php:114 29 #@ jellyfish_cw 27 # @ jellyfish_cw 28 #: jellyfish-counter-widget.php:104 29 msgid "This counter is active, the current count is" 30 msgstr "This counter is active, the current count is" 31 32 # @ jellyfish_cw 33 #: jellyfish-counter-widget.php:105 34 msgid "Changing the start value will restart the counter." 35 msgstr "Changing the start value will restart the counter." 36 37 # @ jellyfish_cw 38 #: jellyfish-counter-widget.php:111 30 39 msgid "End Value:" 31 40 msgstr "End Value:" 32 41 33 # : jellyfish-counter-widget.php:12534 # @ jellyfish_cw42 # @ jellyfish_cw 43 #: jellyfish-counter-widget.php:122 35 44 msgid "Counter Type:" 36 45 msgstr "Counter Type:" 37 46 38 # : jellyfish-counter-widget.php:13039 # @ jellyfish_cw47 # @ jellyfish_cw 48 #: jellyfish-counter-widget.php:127 40 49 msgid "Count Up" 41 50 msgstr "Count Up" 42 51 43 # : jellyfish-counter-widget.php:13344 # @ jellyfish_cw52 # @ jellyfish_cw 53 #: jellyfish-counter-widget.php:130 45 54 msgid "Static" 46 55 msgstr "Static" 47 56 48 # : jellyfish-counter-widget.php:13649 # @ jellyfish_cw57 # @ jellyfish_cw 58 #: jellyfish-counter-widget.php:133 50 59 msgid "Count Down" 51 60 msgstr "Count Down" 52 61 53 # : jellyfish-counter-widget.php:14654 # @ jellyfish_cw62 # @ jellyfish_cw 63 #: jellyfish-counter-widget.php:143 55 64 msgid "Continuous Counter" 56 65 msgstr "Continuous Counter" 57 66 58 #: jellyfish-counter-widget.php:150 59 #@ jellyfish_cw 60 msgid "Counts continuously in the background, starts as soon as this widget is saved." 61 msgstr "Counts continuously in the background, starts as soon as this widget is saved." 67 # @ jellyfish_cw 68 #: jellyfish-counter-widget.php:147 69 msgid "" 70 "Counts continuously in the background, starts as soon as this widget is " 71 "saved." 72 msgstr "" 73 "Counts continuously in the background, starts as soon as this widget is " 74 "saved." 62 75 63 # : jellyfish-counter-widget.php:15564 # @ jellyfish_cw76 # @ jellyfish_cw 77 #: jellyfish-counter-widget.php:152 65 78 msgid "Continuous Interval:" 66 79 msgstr "Continuous Interval:" 67 80 68 # : jellyfish-counter-widget.php:16269 # @ jellyfish_cw81 # @ jellyfish_cw 82 #: jellyfish-counter-widget.php:159 70 83 msgid "seconds" 71 84 msgstr "seconds" 72 85 73 # : jellyfish-counter-widget.php:16674 # @ jellyfish_cw86 # @ jellyfish_cw 87 #: jellyfish-counter-widget.php:163 75 88 msgid "How often a continuous style counter updates" 76 89 msgstr "How often a continuous style counter updates" 77 90 78 # : jellyfish-counter-widget.php:17079 # @ jellyfish_cw91 # @ jellyfish_cw 92 #: jellyfish-counter-widget.php:167 80 93 msgid "Appearance" 81 94 msgstr "Appearance" 82 95 83 # : jellyfish-counter-widget.php:17384 # @ jellyfish_cw96 # @ jellyfish_cw 97 #: jellyfish-counter-widget.php:170 85 98 msgid "Widget Title:" 86 99 msgstr "Widget Title:" 87 100 88 # : jellyfish-counter-widget.php:18789 # @ jellyfish_cw101 # @ jellyfish_cw 102 #: jellyfish-counter-widget.php:184 90 103 msgid "Hide Title" 91 104 msgstr "Hide Title" 92 105 93 # : jellyfish-counter-widget.php:19294 # @ jellyfish_cw106 # @ jellyfish_cw 107 #: jellyfish-counter-widget.php:189 95 108 msgid "Text to display before counter:" 96 109 msgstr "Text to display before counter:" 97 110 98 # : jellyfish-counter-widget.php:20099 # @ jellyfish_cw111 # @ jellyfish_cw 112 #: jellyfish-counter-widget.php:194 100 113 msgid "Text to display after counter:" 101 114 msgstr "Text to display after counter:" 102 115 103 # : jellyfish-counter-widget.php:208104 # @ jellyfish_cw116 # @ jellyfish_cw 117 #: jellyfish-counter-widget.php:199 105 118 msgid "Number of Digits:" 106 119 msgstr "Number of Digits:" 107 120 108 #: jellyfish-counter-widget.php:222 109 #@ jellyfish_cw 121 #: jellyfish-counter-widget.php:210 122 msgid "Format:" 123 msgstr "Format:" 124 125 #: jellyfish-counter-widget.php:219 126 msgid "" 127 "Allows a custom format for the counter e.g $00.00. This option with override " 128 "the Number of Digits option. Any 0 will be replaced with a counter digit, " 129 "any other characters will be displayed as it is." 130 msgstr "" 131 "Allows a custom format for the counter e.g $00.00. This option with override " 132 "the Number of Digits option. Any 0 will be replaced with a counter digit, " 133 "any other characters will be displayed as it is." 134 135 # @ jellyfish_cw 136 #: jellyfish-counter-widget.php:228 110 137 msgid "Disable Tenths" 111 138 msgstr "Disable Tenths" 112 139 113 # : jellyfish-counter-widget.php:227114 # @ jellyfish_cw140 # @ jellyfish_cw 141 #: jellyfish-counter-widget.php:233 115 142 msgid "Animation Speed:" 116 143 msgstr "Animation Speed:" 117 144 118 # : jellyfish-counter-widget.php:237119 # @ jellyfish_cw145 # @ jellyfish_cw 146 #: jellyfish-counter-widget.php:243 120 147 msgid "A value (1-100). Not used for continuous style counters" 121 148 msgstr "A value (1-100). Not used for continuous style counters" 122 149 123 # : jellyfish-counter-widget.php:242124 # @ jellyfish_cw150 # @ jellyfish_cw 151 #: jellyfish-counter-widget.php:248 125 152 msgid "Digit Height:" 126 153 msgstr "Digit Height:" 127 154 128 # : jellyfish-counter-widget.php:254129 # @ jellyfish_cw155 # @ jellyfish_cw 156 #: jellyfish-counter-widget.php:260 130 157 msgid "Digit Width:" 131 158 msgstr "Digit Width:" 132 159 133 # : jellyfish-counter-widget.php:266134 # @ jellyfish_cw160 # @ jellyfish_cw 161 #: jellyfish-counter-widget.php:272 135 162 msgid "Digit Padding:" 136 163 msgstr "Digit Padding:" 137 164 138 # : jellyfish-counter-widget.php:281139 # @ jellyfish_cw165 # @ jellyfish_cw 166 #: jellyfish-counter-widget.php:287 140 167 msgid "Disable 3D effect" 141 168 msgstr "Disable 3D effect" 142 169 143 # : jellyfish-counter-widget.php:286144 # @ jellyfish_cw170 # @ jellyfish_cw 171 #: jellyfish-counter-widget.php:292 145 172 msgid "Bustedness:" 146 173 msgstr "Bustedness:" 147 174 148 # : jellyfish-counter-widget.php:299149 # @ jellyfish_cw175 # @ jellyfish_cw 176 #: jellyfish-counter-widget.php:305 150 177 msgid "Digit Style:" 151 178 msgstr "Digit Style:" 152 179 153 # : jellyfish-counter-widget.php:309154 # @ jellyfish_cw180 # @ jellyfish_cw 181 #: jellyfish-counter-widget.php:315 155 182 msgid "CSS entered here will alter the appearance of the digits" 156 183 msgstr "CSS entered here will alter the appearance of the digits" 157 158 #: jellyfish-counter-widget.php:107159 #@ jellyfish_cw160 msgid "This counter is active, the current count is"161 msgstr "This counter is active, the current count is"162 163 #: jellyfish-counter-widget.php:108164 #@ jellyfish_cw165 msgid "Changing the start value will restart the counter."166 msgstr "Changing the start value will restart the counter."167 -
jellyfish-counter-widget/trunk/readme.txt
r829329 r1009887 3 3 Author URI: http://strawberryjellyfish.com/ 4 4 Donate link: http://strawberryjellyfish.com/donate/ 5 Plugin URI: http://strawberryjellyfish.com/wordpress-plugin -jellyfish-counter-widget/5 Plugin URI: http://strawberryjellyfish.com/wordpress-plugins/jellyfish-counter/ 6 6 Tags: counter, odometer, milometer, animated, widget, totaliser 7 7 Requires at least: 3.0 8 Tested up to: 3.89 Stable tag: 1. 08 Tested up to: 4.0 9 Stable tag: 1.3 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html 12 12 13 A rotating odometer style counter widget that can display either a static value 14 or animate to a predefined total. Great for tracking any totals, 15 not just for counting jellyfish. 13 Show eye catching totals with static or animated counter widgets and shortcodes. 14 Classic retro odometer style or easy customise your own custom look. 16 15 17 16 == Description == 18 17 19 This plugin allows you to add a widgets to your WordPress web site that can display 20 a static or animated odometer style counter. The counter can be used as a manually 21 updated total, an automatic counter updating over time or just as an animated 22 visual effect. 23 24 The counter can either count upwards or downwards and is suitable for both incrementing 25 totals or countdown situations. 26 27 A great visual effect for travel blogs or any website that wants to display a 28 running total of anything. 29 30 You can have as many counters as you wish, all can have individual settings for 31 totals and appearance. 32 33 The counters are highly configurable through the widget interface and are generated 34 using CSS and Javascript, requiring no external graphics files. 35 36 37 Demo 38 39 You can see a counter in action at http://sharkaroo.net/map 18 The Jellyfish Counter plugin provides a widget and shortcode enabling you to 19 easily add animated counters to your WordPress site. 20 21 Counters can be used as a manually updated total, an automatic counter that 22 updates over time or just as an animated visual effect. Each counter can count upwards or downwards making them suitable for both incrementing totals or countdown situations. A great visual effect for travel blogs or any website 23 that wants to display a running total or countdown of anything. 24 25 Jellyfish Counters are highly configurable through the widget interface, and 26 being generated using CSS and JavaScript, they require no external graphics 27 files. You may have as many counters as you wish on a page, all can have 28 individual settings for totals and appearance. 29 30 New Shortcode support allows you to generate a counter directly within any 31 post or page content making counters no longer limited to your sidebar or 32 other widgetable area. 33 34 Advanced users will find that Jellyfish Counter objects are fully accessible 35 via JavaScript and may be controlled and reconfigured as desired though your 36 own custom scripting. 37 38 39 =Demo= 40 41 Here's a typical counter in action at http://sharkaroo.net/map 40 42 Using an animated counter adds visual and narrative impact to an otherwise 41 43 static value. 42 44 43 Another demo and further information can be found at the plugin website 44 http://strawberryjellyfish.com/wordpress-plugin-jellyfish-counter-widget/ 45 46 This plugin uses a modified version of a javascript odometer class written by 47 Gavin Brock http://gavcode.wordpress.com/2008/04/07/cssjavascript-animated-odometer/ 48 49 50 ==Usage== 51 52 Add a counter widget to your sidebar and adjust the settings to suit your 53 requirements. 54 55 There are three basic modes of operation: 56 57 * Static - If you want the counter to simply display a non animate number just 58 set a Start Value to the desired number for the counter and set the 59 Counter Type to 'static' 60 61 * Animated – If you supply both start value and end value in the widget, the counter 62 will increment upwards or downwards depending on the chosen Counter Type until it 63 reaches the end value. Speed of the count is controlled by the Animation Speed option. 64 Note, this counter has no memory, it will reset when a page is reloaded or changed 65 but it is great for a visual effect where start and end values are very close together. 66 67 * Continuous – If you want to count over a long period of time and need your 68 counter to continue to count irrespective of page loads then just select the 69 continuous option in the widget. Then choose the interval between the counter 70 increments, in seconds. As soon as you save the widget the counter will "start" 71 and will continue to tick away even if nobody is viewing your blog. Changing the 72 setting on an active continuous counter will not effect the count value and it will 73 keep count, if you wish to reset an active continuous counter just change the start value 74 and save the widget and the counter will restart from the new starting value. 75 Note: In continuous mode, animation speed and display tenths have no effect. 76 77 The counter is very configurable through the widget panel. You can define the digit 78 height, width and font as well as animation speed (animated mode only) and "bustedness" 79 (misalignment of the digits). Additionally, through "Digit Style" setting you can 80 specify a font, font style, colour, background or any other CSS display properties for 81 the digits. 82 Note: you cannot adjust the size of the font here as is automatically calculated from 83 the height / width and padding settings. 84 85 Need a flat looking counter? "Disable 3D effect" removes the CSS shading effect. 45 Check out the plugin homepage for more demos and further information: 46 http://strawberryjellyfish.com/wordpress-plugins/jellyfish-counter/ 86 47 87 48 88 49 == Installation == 89 50 90 Extract the zip file and just drop the contents in the wp-content/plugins/ 91 directory of your WordPress installation and then activate the Plugin from 92 Plugins page. Go to the widgets admin page to add a counter widget, each widget 93 has its own settings. 51 Either install and activate the plugin via your WordPress Admin 52 53 Or 54 55 Extract the zip file and just drop the contents in the wp-content/plugins/ directory of your WordPress installation and then activate the Plugin from 56 Plugins page. 57 58 After activation you'll find a new Counter widget in the widgets panel of 59 your WordPress admin, drag as many counter widgets as you need to your sidebar 60 and other widgetable areas. Each counter widget has it's own settings. 61 62 You can also use the [jellyfish_counter] shortcode with page or post content 63 to display a counter within your page or post. Shortcode counters can be 64 configured just as much as their widget counterparts. See Usage for details. 65 66 67 == Frequently Asked Questions == 68 69 70 == Screenshots == 94 71 95 72 96 73 == Changelog == 74 75 = 1.3 = 76 * Shortcodes! You can now show counters directly in the post or page content 77 using the [jellyfish_counter] shortcode. 78 * The Odometer class has been extended further and renamed JellyfishOdometer. 79 * General code cleanups and function / variable renaming 80 * Added completedFunction attribute to jellyfish-odometer.js to allow defining 81 a callback function that will be triggered when the counter completes 82 * Continuous counter timestamps use your blogs local time instead of UTC 83 * Updated Readme 84 85 = 1.2 = 86 * Another major re-factoring of JavaScript. All counter functions are now part 87 of the odometer class which now takes it's configuration from data attributes 88 on the counter container element. No more inline JavaScript! 89 * Much of the inline CSS has now been abstracted to a base stylesheet making 90 it easier to restyle counters. Individual counter can still be styled through 91 their widgets. 92 93 = 1.1 = 94 * No longer use widget_content filter instead of the_content filter on widget 95 before/after text 96 * Major reworking of odometer class to incorporate new features 97 * Added format option to allow formatting the counter display to include non 98 counting characters such as prefixes or separators 97 99 98 100 = 1.0 = … … 120 122 == Upgrade Notice == 121 123 122 Existing counters should not be effected by an upgrade but it is always good practice 123 to backup your database and installation before performing an upgrade. 124 125 After an upgrade visit the widget admin page to check the new options available to your 126 counters. 124 Existing counters should not be effected by an upgrade but it is always good 125 practice to backup your database and installation before performing an upgrade. 126 127 After an upgrade visit the widget admin page to check the new options available 128 to your counters. 129 130 Note: 131 132 There have been changes in class names after vesrion 1.0, if you have added 133 custom counter styles to your WordPress theme you may need to make minor 134 changes to reflect the new CSS classes applied to counter elements. 135 136 If you have made any changes to the plugin files they will be lost if you 137 upgrade. 138 139 140 141 ==Usage== 142 143 =Widget= 144 145 Simply drag a counter widget to your sidebar and adjust the settings to suit 146 your needs. 147 148 There are three basic modes of operation: 149 150 * Static - If you want the counter to simply display a non animated number 151 just set a Start Value to the desired number for the counter and set the 152 Counter Type to 'static' 153 154 * Animated – If you supply both start value and end value in the widget, the 155 counter will increment upwards or downwards depending on the chosen Counter 156 Type until it reaches the end value. Speed of the count is controlled by the 157 Animation Speed option. Note, this counter has no memory, it will reset when a 158 page is reloaded or changed but it is great for a visual effect where start and 159 end values are relatively close together. 160 161 * Continuous – If you want to count over a long period of time and need your 162 counter to continue to count irrespective of page loads then just select the 163 continuous option in the widget. Then choose the interval between the counter 164 increments, in seconds. As soon as you save the widget the counter will "start" 165 and will continue to tick away even if nobody is viewing your blog. Changing the 166 setting on an active continuous counter will not effect the count value and it 167 will keep count, if you wish to reset an active continuous counter just change 168 the start value and save the widget and the counter will restart from the new 169 starting value. 170 Note: In continuous mode, animation speed and display tenths have no effect. 171 172 The counters are very configurable through the widget panel. You can define 173 the digit height, width and font as well as animation speed (animated mode only) 174 and "bustedness" (odometer style misalignment of the digits). 175 176 You can further customise the appearance of an individual counter via the 177 "Digit Style" input that will accept a valid CSS style attributes such as 178 font-family, colour, background etc. 179 180 Note: the size of the font here as is automatically calculated 181 from the height, width and padding settings. 182 183 Need a flat looking counter? 184 "Disable 3D effect" removes the CSS shading effect. 185 186 If you want to display a prefix on the counter or include separating 187 characters, use the Format input. Just enter a string here representing your 188 desired counter appearance, a 0 represents a counter digit, any other 189 character will be displayed as it is. The Format option overrides the number 190 of digits option, if a format string exists then the counter will use the 191 total number of 0 characters as the number of digits. 192 193 Example Formats: 194 195 $0.00 196 1,000,000 197 0000 km 198 199 =Shortcode= 200 201 You can generate a counter directly within page or post content using the 202 [jellyfish_counter] shortcode. The shortcode accepts a full range of 203 parameters to provide identical functionality to the widget version. 204 205 The following parameters may be used within a shortcode: 206 207 * digits : a number, Number of digits in the counter 208 * format : a string, representing any fancy display format 209 * tenths : true/false, display tenths digit or not 210 * digit_height : number, pixel height of digits 211 * digit_width : number, pixel width of digits 212 * digit_padding : number, pixel padding for digits 213 * digit_style : a string, custom css styles for the digits 214 * bustedness : a number, misalignment of digits 215 * flat : true/false, don't show 3d effect, show 3d effect 216 * speed : a number, 0 - 100, animation speed 217 * start : a number, starting value for the counter 218 * end : a number, ending value for the counter 219 * direction : a, string 'up' or 'down' 220 * interval : The number of seconds between updates of a continuous counter 221 * timestamp : false or a string representing the starting time for the counter 222 223 If you don't specify a parameter it's default value will be used. 224 225 Examples: 226 227 [jellyfish_counter end=100] 228 The above shortcode translates as: 229 Display a counter that animates upwards from 0 to 100 230 231 [jellyfish_counter start=999 end=0 direction="down" 232 digit_style="background: transparent; color: red;" flat=true; 233 timestamp="2014-09-28 9:20:21" interval=300 ] 234 235 The above shortcode translates as: 236 Display a counter that starts at 999 and ends at 0, counting downwards. 237 It has red digits on a transparent background with no 3D shading effect. 238 It is a persistent counter that started counting at 9:20:21 on 2014-09-28 and 239 has been decrementing by one every 300 seconds (5 minutes) since then. 240 241 242 = Styling = 243 244 You can modify the appearance of an individual counters text through the 245 widget control panel or through shortcode parameters. This should be 246 sufficient for most uses. 247 248 However, if you need to globally override the default counter style or make 249 other CSS changes to the counter digits or container, take a look at 250 jellyfish-counter.css for the appropriate class names. You should override 251 this in you theme rather than modifying this css file as any changes made 252 would be lost when the plugin upgrades..
Note: See TracChangeset
for help on using the changeset viewer.