Dynamic "To Top" Plugin - Version 3.1.7

Version Description

  • Introduced the filter 'mv_dynamic_to_top_css' to allow themes and plugins to add / alter the generated CSS.
  • Minified the JavaScript included.
  • Code improvements.
Download this release

Release Info

Developer sksmatt
Plugin Icon wp plugin Dynamic "To Top" Plugin
Version 3.1.7
Comparing to
See all releases

Code changes from version 3.1.6 to 3.1.7

css/dynamic-to-top-css.php CHANGED
@@ -2,23 +2,22 @@
2
  /**
3
  * Dynamic To Top CSS
4
  *
5
- * @package Dynamic To Top
6
- * @author Matt Varone
7
  */
8
 
9
  // set the correct header
10
- header ("content-type: text/css; charset: UTF-8");
11
 
12
  // require WordPress
13
- require_once('../../../../wp-load.php');
14
 
15
- if(!defined('MV_DYNAMIC_TO_TOP_VERSION'))
16
  die();
17
 
18
  global $OBJ_dynamic_to_top;
19
 
20
- if (!isset($OBJ_dynamic_to_top) OR !is_object($OBJ_dynamic_to_top))
21
- {
22
  if (!class_exists('Dynamic_To_Top'))
23
  die();
24
 
2
  /**
3
  * Dynamic To Top CSS
4
  *
5
+ * @package Dynamic To Top
6
+ * @author Matt Varone
7
  */
8
 
9
  // set the correct header
10
+ header( "content-type: text/css; charset: UTF-8" );
11
 
12
  // require WordPress
13
+ require_once( '../../../../wp-load.php' );
14
 
15
+ if( ! defined( 'MV_DYNAMIC_TO_TOP_VERSION' ) )
16
  die();
17
 
18
  global $OBJ_dynamic_to_top;
19
 
20
+ if ( !isset( $OBJ_dynamic_to_top ) OR ! is_object( $OBJ_dynamic_to_top ) ) {
 
21
  if (!class_exists('Dynamic_To_Top'))
22
  die();
23
 
dynamic-to-top.php CHANGED
@@ -1,20 +1,20 @@
1
  <?php
2
  /*
3
  Plugin Name: Dynamic To Top
4
- Version: 3.1.6
5
  Plugin URI: http://www.mattvarone.com/featured-content/dynamic-to-top/
6
  Description: Adds an automatic and dynamic "To Top" button to scroll long pages back to the top.
7
  Author: Matt Varone
8
  Author URI: http://www.mattvarone.com
9
 
10
- Copyright 2011 (email: contact@mattvarone.com)
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
14
  the Free Software Foundation; either version 2 of the License, or
15
- (at your option) any later version.
16
 
17
- This program is distributed in the hope that it will be useful,
18
  but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
  GNU General Public License for more details.
@@ -27,8 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
  /**
28
  * Dynamic To Top Initialize
29
  *
30
- * @package Dynamic To Top
31
- * @author Matt Varone
32
  */
33
 
34
  /*
@@ -37,12 +37,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37
  |--------------------------------------------------------------------------
38
  */
39
 
40
- define('MV_DYNAMIC_TO_TOP_BASENAME', plugin_basename(__FILE__));
41
- define('MV_DYNAMIC_TO_TOP_URL', plugins_url('',__FILE__));
42
- define('MV_DYNAMIC_TO_TOP_PATH', plugin_dir_path(__FILE__));
43
- define('MV_DYNAMIC_TO_TOP_VERSION', '3.1.6');
44
- define('MV_DYNAMIC_TO_TOP_FOLDER', basename(dirname(__FILE__)));
45
- define('MV_DYNAMIC_TO_TOP_DOMAIN', 'dynamic-to-top');
46
 
47
  /*
48
  |--------------------------------------------------------------------------
@@ -50,7 +50,7 @@ define('MV_DYNAMIC_TO_TOP_DOMAIN', 'dynamic-to-top');
50
  |--------------------------------------------------------------------------
51
  */
52
 
53
- load_plugin_textdomain( MV_DYNAMIC_TO_TOP_DOMAIN, false, '/'.MV_DYNAMIC_TO_TOP_FOLDER.'/lan' );
54
 
55
  /*
56
  |--------------------------------------------------------------------------
@@ -58,36 +58,33 @@ load_plugin_textdomain( MV_DYNAMIC_TO_TOP_DOMAIN, false, '/'.MV_DYNAMIC_TO_TOP_F
58
  |--------------------------------------------------------------------------
59
  */
60
 
61
- if (is_admin())
62
- require_once(MV_DYNAMIC_TO_TOP_PATH.'inc/dynamic-to-top-options.php');
63
  else
64
- require_once(MV_DYNAMIC_TO_TOP_PATH.'inc/dynamic-to-top-class.php');
65
 
66
  /*
67
  |--------------------------------------------------------------------------
68
  | DYNAMIC TO TOP ON ACTIVATION
69
  |--------------------------------------------------------------------------
70
  */
71
-
72
- if ( !function_exists('mv_dynamic_to_top_activation') )
73
- {
74
-
75
- /**
76
- * Dynamic To Top Activation
77
- *
78
- * @package Dynamic To Top
79
- * @since 3.1.5
80
- *
81
- */
82
 
 
 
 
 
 
 
 
 
83
  function mv_dynamic_to_top_activation()
84
  {
85
  // check compatibility
86
- if ( version_compare( get_bloginfo('version' ),'3.0') >= 0 )
87
  deactivate_plugins( basename( __FILE__ ) );
88
 
89
  // refresh cache
90
- delete_transient('dynamic_to_top_transient_css');
91
  }
92
 
93
  register_activation_hook( __FILE__, 'mv_dynamic_to_top_activation' );
1
  <?php
2
  /*
3
  Plugin Name: Dynamic To Top
4
+ Version: 3.1.7
5
  Plugin URI: http://www.mattvarone.com/featured-content/dynamic-to-top/
6
  Description: Adds an automatic and dynamic "To Top" button to scroll long pages back to the top.
7
  Author: Matt Varone
8
  Author URI: http://www.mattvarone.com
9
 
10
+ Copyright 2011 ( email: contact@mattvarone.com )
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
14
  the Free Software Foundation; either version 2 of the License, or
15
+ ( at your option ) any later version.
16
 
17
+ This program is distributed in the hope that it will be useful,
18
  but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
  GNU General Public License for more details.
27
  /**
28
  * Dynamic To Top Initialize
29
  *
30
+ * @package Dynamic To Top
31
+ * @author Matt Varone
32
  */
33
 
34
  /*
37
  |--------------------------------------------------------------------------
38
  */
39
 
40
+ define( 'MV_DYNAMIC_TO_TOP_BASENAME', plugin_basename( __FILE__ ) );
41
+ define( 'MV_DYNAMIC_TO_TOP_URL', plugins_url( '', __FILE__ ) );
42
+ define( 'MV_DYNAMIC_TO_TOP_PATH', plugin_dir_path( __FILE__ ) );
43
+ define( 'MV_DYNAMIC_TO_TOP_VERSION', '3.1.7' );
44
+ define( 'MV_DYNAMIC_TO_TOP_FOLDER', basename( dirname( __FILE__ ) ) );
45
+ define( 'MV_DYNAMIC_TO_TOP_DOMAIN', 'dynamic-to-top' );
46
 
47
  /*
48
  |--------------------------------------------------------------------------
50
  |--------------------------------------------------------------------------
51
  */
52
 
53
+ load_plugin_textdomain( MV_DYNAMIC_TO_TOP_DOMAIN, false, '/' . MV_DYNAMIC_TO_TOP_FOLDER.'/lan' );
54
 
55
  /*
56
  |--------------------------------------------------------------------------
58
  |--------------------------------------------------------------------------
59
  */
60
 
61
+ if ( is_admin() )
62
+ require_once( MV_DYNAMIC_TO_TOP_PATH . 'inc/dynamic-to-top-options.php' );
63
  else
64
+ require_once( MV_DYNAMIC_TO_TOP_PATH . 'inc/dynamic-to-top-class.php' );
65
 
66
  /*
67
  |--------------------------------------------------------------------------
68
  | DYNAMIC TO TOP ON ACTIVATION
69
  |--------------------------------------------------------------------------
70
  */
 
 
 
 
 
 
 
 
 
 
 
71
 
72
+ /**
73
+ * Dynamic To Top Activation
74
+ *
75
+ * @package Dynamic To Top
76
+ * @since 3.1.5
77
+ */
78
+ if ( !function_exists( 'mv_dynamic_to_top_activation' ) )
79
+ {
80
  function mv_dynamic_to_top_activation()
81
  {
82
  // check compatibility
83
+ if ( version_compare( get_bloginfo( 'version' ), '3.0' ) >= 0 )
84
  deactivate_plugins( basename( __FILE__ ) );
85
 
86
  // refresh cache
87
+ delete_transient( 'dynamic_to_top_transient_css' );
88
  }
89
 
90
  register_activation_hook( __FILE__, 'mv_dynamic_to_top_activation' );
inc/dynamic-to-top-class.php CHANGED
@@ -2,11 +2,11 @@
2
  /**
3
  * Dynamic To Top Class
4
  *
5
- * @package Dynamic To Top
6
- * @author Matt Varone
7
  */
8
 
9
- if ( !class_exists('MV_Dynamic_To_Top'))
10
  {
11
 
12
  class MV_Dynamic_To_Top
@@ -33,7 +33,7 @@ if ( !class_exists('MV_Dynamic_To_Top'))
33
  'text'=>'',
34
  'margin'=>20,
35
  'text_version'=>'',
36
- );
37
 
38
  /**
39
  * Dynamic To Top
@@ -46,8 +46,7 @@ if ( !class_exists('MV_Dynamic_To_Top'))
46
  *
47
  */
48
 
49
- function __construct()
50
- {
51
  // Get options.
52
  $this->get_options();
53
 
@@ -65,9 +64,8 @@ if ( !class_exists('MV_Dynamic_To_Top'))
65
  * @since 3.0
66
  */
67
 
68
- function get_options()
69
- {
70
- $this->options = wp_parse_args(get_option('dynamic_to_top'), $this->defaults);
71
  }
72
 
73
  /**
@@ -81,16 +79,14 @@ if ( !class_exists('MV_Dynamic_To_Top'))
81
  * @since 3.0
82
  */
83
 
84
- function enqueue_assets()
85
- {
86
- if ( $this->is_checked('prevent_on_mobile') )
87
- {
88
  if ( $this->is_mobile() )
89
- return false;
90
  }
91
 
92
- add_action('wp_print_styles', array(&$this,'enqueue_style'));
93
- add_action('wp_print_scripts', array(&$this,'enqueue_script'));
94
  }
95
 
96
  /**
@@ -101,9 +97,8 @@ if ( !class_exists('MV_Dynamic_To_Top'))
101
  * @since 3.0
102
  */
103
 
104
- function enqueue_style()
105
- {
106
- wp_enqueue_style('dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/css/dynamic-to-top-css.php', false, MV_DYNAMIC_TO_TOP_VERSION,'all');
107
  }
108
 
109
  /**
@@ -114,10 +109,10 @@ if ( !class_exists('MV_Dynamic_To_Top'))
114
  * @since 3.0
115
  */
116
 
117
- function enqueue_script()
118
- {
119
- wp_register_script('jquery-easing',MV_DYNAMIC_TO_TOP_URL . '/js/libs/jquery.easing.js', array('jquery'),'1.3', true);
120
- wp_enqueue_script('dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/js/dynamic.to.top.js', array('jquery-easing'), MV_DYNAMIC_TO_TOP_VERSION, true);
121
 
122
  $params = array(
123
  'text' => $this->options['text'],
@@ -126,7 +121,9 @@ if ( !class_exists('MV_Dynamic_To_Top'))
126
  'speed' => $this->options['speed'],
127
  'easing' => $this->get_easing_type(),
128
  'margin' => $this->options['margin'],
129
- );
 
 
130
 
131
  wp_localize_script( 'dynamic-to-top', 'mv_dynamic_to_top', $params );
132
  }
@@ -143,20 +140,20 @@ if ( !class_exists('MV_Dynamic_To_Top'))
143
  * @return string $css CSS Declarations.
144
  */
145
 
146
- function get_css($css="")
147
- {
148
- $css = get_transient('dynamic_to_top_transient_css');
149
 
150
- if ($css)
151
- return $css;
152
-
153
- $css = $this->minify($this->generate_custom_css());
154
-
155
- set_transient('dynamic_to_top_transient_css',$css,60*60*24*90);
156
 
157
  return $css;
158
  }
159
 
 
160
  /**
161
  * Generate Custom CSS
162
  *
@@ -168,8 +165,7 @@ if ( !class_exists('MV_Dynamic_To_Top'))
168
  * @return string $css CSS declarations.
169
  */
170
 
171
- function generate_custom_css($css="")
172
- {
173
 
174
  $css .= "/* Dynamic To Top Plugin ver. ".MV_DYNAMIC_TO_TOP_VERSION." - http://www.mattvarone.com */\n\n";
175
 
@@ -188,10 +184,10 @@ if ( !class_exists('MV_Dynamic_To_Top'))
188
  color:".$this->options['text_color'].";
189
  text-decoration:none;\n";
190
 
191
- if ( $this->is_checked('text_shadow') )
192
  $css .= "text-shadow:0 1px 0 ".$this->options['shadow_color'].";\n";
193
 
194
- if ( $this->is_checked('bold') )
195
  $css .="font-weight:bold;\n";
196
 
197
  $css.= "padding:".$this->options['padding_top_bottom']."px ".$this->options['padding_left_right']."px;
@@ -214,15 +210,15 @@ if ( !class_exists('MV_Dynamic_To_Top'))
214
 
215
  $box_shadow = "";
216
 
217
- if ( $this->is_checked('shadow'))
218
- $box_shadow .= "0 1px 3px rgba(0,0,0,0.4)";
219
 
220
- if ( $this->is_checked('inset') ) {
221
- if ( $box_shadow != "") $box_shadow = $box_shadow.",";
222
- $box_shadow .= "inset 0 0 0 1px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,.4),inset 0 10px 10px rgba(255,255,255,.1)";
223
  }
224
 
225
- if (strlen($box_shadow)>1)
226
  $css .= "-webkit-box-shadow:".$box_shadow.";
227
  -ms-box-shadow:".$box_shadow.";
228
  -moz-box-shadow:".$box_shadow.";
@@ -238,28 +234,28 @@ if ( !class_exists('MV_Dynamic_To_Top'))
238
  border-radius: ".$this->options['radius']."px;\n}\n\n";
239
 
240
  $css .= "#dynamic-to-top:hover {
241
- background: ".$this->get_ligther_hex($this->options['background_color']).";
242
- background: ".$this->options['background_color']." -webkit-gradient( linear, 0% 0%, 0% 100%, from(rgba(255,255,255,.2)),to(rgba(0,0,0,0)));
243
- background: ".$this->options['background_color']." -webkit-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
244
- background: ".$this->options['background_color']." -khtml-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
245
- background: ".$this->options['background_color']." -moz-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
246
- background: ".$this->options['background_color']." -o-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
247
- background: ".$this->options['background_color']." -ms-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
248
- background: ".$this->options['background_color']." -icab-linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
249
- background: ".$this->options['background_color']." linear-gradient( top, rgba(255,255,255,.2), rgba(0,0,0,0));
250
  cursor:pointer;
251
  }
252
 
253
  #dynamic-to-top:active {
254
  background: ".$this->options['background_color'].";
255
- background: ".$this->options['background_color']." -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(0,0,0,.3)), to(rgba(0,0,0,0)));
256
- background: ".$this->options['background_color']." -webkit-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
257
- background: ".$this->options['background_color']." -moz-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
258
- background: ".$this->options['background_color']." -khtml-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
259
- background: ".$this->options['background_color']." -o-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
260
- background: ".$this->options['background_color']." -ms-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
261
- background: ".$this->options['background_color']." -icab-linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
262
- background: ".$this->options['background_color']." linear-gradient( top, rgba(0,0,0,.1), rgba(0,0,0,0));
263
  }
264
 
265
  #dynamic-to-top,#dynamic-to-top:active,
@@ -273,7 +269,7 @@ if ( !class_exists('MV_Dynamic_To_Top'))
273
  overflow:hidden;
274
  width:14px;
275
  height:12px;
276
- background:url(".MV_DYNAMIC_TO_TOP_URL."/css/images/up.png) no-repeat center center;
277
  }";
278
 
279
  return $css;
@@ -291,9 +287,8 @@ if ( !class_exists('MV_Dynamic_To_Top'))
291
  * @return string $easing Name of easing function.
292
  */
293
 
294
- function get_easing_type($easing="linear")
295
- {
296
- switch ($this->options['easing'])
297
  {
298
  case 'Bounce':
299
  $easing = "easeOutBounce";
@@ -330,9 +325,8 @@ if ( !class_exists('MV_Dynamic_To_Top'))
330
  * @return string $position Properties of the position selected.
331
  */
332
 
333
- function get_position($position="")
334
- {
335
- switch ($this->options['position'])
336
  {
337
  case 'Bottom Right':
338
  $position = "bottom:".$this->options['margin']."px;right:".$this->options['margin']."px;top:auto;left:auto;";
@@ -367,18 +361,17 @@ if ( !class_exists('MV_Dynamic_To_Top'))
367
  * @return boolean
368
  */
369
 
370
- function is_checked($option="",$against="yes")
371
- {
372
- if ($option == "")
373
  return false;
374
 
375
- if (!isset($this->options[$option]))
376
  return false;
377
 
378
- if ($against == "")
379
  return true;
380
  else {
381
- if ($this->options[$option] == $against)
382
  return true;
383
  else
384
  return false;
@@ -398,18 +391,16 @@ if ( !class_exists('MV_Dynamic_To_Top'))
398
  * @return boolean.
399
  */
400
 
401
- function is_mobile()
402
- {
403
 
404
- if(isset($_SERVER["HTTP_X_WAP_PROFILE"]))
405
  return true;
406
 
407
- if(preg_match("/wap\.|\.wap/i",$_SERVER["HTTP_ACCEPT"]))
408
  return true;
409
 
410
- if(isset($_SERVER["HTTP_USER_AGENT"]))
411
- {
412
- $user_agents = array(
413
  "midp", "j2me", "iphone","avantg", "docomo", "novarra", "palmos",
414
  "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/",
415
  "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi",
@@ -417,11 +408,10 @@ if ( !class_exists('MV_Dynamic_To_Top'))
417
  "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC",
418
  "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover",
419
  "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal",
420
- "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto");
421
 
422
- foreach($user_agents as $user_string)
423
- {
424
- if(preg_match("/".$user_string."/i",$_SERVER["HTTP_USER_AGENT"]))
425
  return true;
426
  }
427
  }
@@ -442,32 +432,29 @@ if ( !class_exists('MV_Dynamic_To_Top'))
442
  * @return boolean.
443
  */
444
 
445
- function get_ligther_hex($hex,$factor = 30)
446
- {
447
 
448
  $new_hex = '#';
449
 
450
- if (strlen($hex)==7)
451
- {
452
- $base['R'] = hexdec($hex{0}.$hex{1});
453
- $base['G'] = hexdec($hex{2}.$hex{3});
454
- $base['B'] = hexdec($hex{4}.$hex{5});
455
  } else {
456
- $base['R'] = hexdec($hex{0}.$hex{0});
457
- $base['G'] = hexdec($hex{1}.$hex{1});
458
- $base['B'] = hexdec($hex{2}.$hex{2});
459
  }
460
- foreach ($base as $k=>$v)
461
- {
462
  $amount = 255 - $v;
463
  $amount = $amount / 100;
464
- $amount = round($amount * $factor);
465
  $new_decimal = $v + $amount;
466
 
467
- $new_hex_component = dechex($new_decimal);
468
 
469
- if(strlen($new_hex_component) < 2)
470
- $new_hex_component = "0".$new_hex_component;
471
 
472
  $new_hex .= $new_hex_component;
473
  }
@@ -489,12 +476,11 @@ if ( !class_exists('MV_Dynamic_To_Top'))
489
  * @return string.
490
  */
491
 
492
- function minify( $css )
493
- {
494
- $css = preg_replace('#\s+#', ' ', $css);
495
- $css = preg_replace('#/\*.*?\*/#s', '', $css);
496
- $css = str_replace(array('; ',': ',' {','{ ',', ','} ',';}'), array(';',':','{','{',',','}','}'),$css);
497
- return trim($css);
498
  }
499
 
500
 
@@ -506,8 +492,7 @@ if ( !class_exists('MV_Dynamic_To_Top'))
506
  |--------------------------------------------------------------------------
507
  */
508
 
509
- if (!function_exists('mv_dynamic_to_top_init'))
510
- {
511
 
512
  /**
513
  * Initializes the main Dynamic to top class.
@@ -517,12 +502,11 @@ if ( !class_exists('MV_Dynamic_To_Top'))
517
  *
518
  */
519
 
520
- function mv_dynamic_to_top_init()
521
- {
522
  global $OBJ_dynamic_to_top;
523
  $OBJ_dynamic_to_top = new MV_Dynamic_To_Top();
524
  }
525
 
526
- add_action('init', 'mv_dynamic_to_top_init');
527
  }
528
  }
2
  /**
3
  * Dynamic To Top Class
4
  *
5
+ * @package Dynamic To Top
6
+ * @author Matt Varone
7
  */
8
 
9
+ if ( ! class_exists( 'MV_Dynamic_To_Top' ) )
10
  {
11
 
12
  class MV_Dynamic_To_Top
33
  'text'=>'',
34
  'margin'=>20,
35
  'text_version'=>'',
36
+ );
37
 
38
  /**
39
  * Dynamic To Top
46
  *
47
  */
48
 
49
+ function __construct() {
 
50
  // Get options.
51
  $this->get_options();
52
 
64
  * @since 3.0
65
  */
66
 
67
+ function get_options() {
68
+ $this->options = wp_parse_args( get_option( 'dynamic_to_top' ), $this->defaults );
 
69
  }
70
 
71
  /**
79
  * @since 3.0
80
  */
81
 
82
+ function enqueue_assets() {
83
+ if ( $this->is_checked( 'prevent_on_mobile' ) ) {
 
 
84
  if ( $this->is_mobile() )
85
+ return;
86
  }
87
 
88
+ add_action( 'wp_print_styles', array( &$this,'enqueue_style' ) );
89
+ add_action( 'wp_print_scripts', array( &$this,'enqueue_script' ) );
90
  }
91
 
92
  /**
97
  * @since 3.0
98
  */
99
 
100
+ function enqueue_style() {
101
+ wp_enqueue_style( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/css/dynamic-to-top-css.php', false, MV_DYNAMIC_TO_TOP_VERSION,'all' );
 
102
  }
103
 
104
  /**
109
  * @since 3.0
110
  */
111
 
112
+ function enqueue_script() {
113
+ wp_register_script( 'jquery-easing', MV_DYNAMIC_TO_TOP_URL . '/js/libs/jquery.easing.js', array( 'jquery' ), '1.3', true );
114
+ $env = ( WP_DEBUG ) ? 'dev' : 'min';
115
+ wp_enqueue_script( 'dynamic-to-top', MV_DYNAMIC_TO_TOP_URL . '/js/dynamic.to.top.' . $env . '.js', array( 'jquery-easing' ), MV_DYNAMIC_TO_TOP_VERSION, true );
116
 
117
  $params = array(
118
  'text' => $this->options['text'],
121
  'speed' => $this->options['speed'],
122
  'easing' => $this->get_easing_type(),
123
  'margin' => $this->options['margin'],
124
+ );
125
+
126
+ $params = apply_filters( 'mv_dynamic_to_top_js_params', $params );
127
 
128
  wp_localize_script( 'dynamic-to-top', 'mv_dynamic_to_top', $params );
129
  }
140
  * @return string $css CSS Declarations.
141
  */
142
 
143
+ function get_css( $css = "" ) {
144
+ $css = get_transient( 'dynamic_to_top_transient_css' );
 
145
 
146
+ if ( ! $css ) {
147
+ $css = $this->minify( $this->generate_custom_css() );
148
+ set_transient( 'dynamic_to_top_transient_css', $css, 60*60*24*90 );
149
+ }
150
+
151
+ $css = apply_filters( 'mv_dynamic_to_top_css', $css );
152
 
153
  return $css;
154
  }
155
 
156
+
157
  /**
158
  * Generate Custom CSS
159
  *
165
  * @return string $css CSS declarations.
166
  */
167
 
168
+ function generate_custom_css( $css = "" ) {
 
169
 
170
  $css .= "/* Dynamic To Top Plugin ver. ".MV_DYNAMIC_TO_TOP_VERSION." - http://www.mattvarone.com */\n\n";
171
 
184
  color:".$this->options['text_color'].";
185
  text-decoration:none;\n";
186
 
187
+ if ( $this->is_checked( 'text_shadow' ) )
188
  $css .= "text-shadow:0 1px 0 ".$this->options['shadow_color'].";\n";
189
 
190
+ if ( $this->is_checked( 'bold' ) )
191
  $css .="font-weight:bold;\n";
192
 
193
  $css.= "padding:".$this->options['padding_top_bottom']."px ".$this->options['padding_left_right']."px;
210
 
211
  $box_shadow = "";
212
 
213
+ if ( $this->is_checked( 'shadow' ) )
214
+ $box_shadow .= "0 1px 3px rgba( 0,0,0,0.4 )";
215
 
216
+ if ( $this->is_checked( 'inset' ) ) {
217
+ if ( $box_shadow != "" ) $box_shadow = $box_shadow.",";
218
+ $box_shadow .= "inset 0 0 0 1px rgba( 0,0,0,0.2 ), inset 0 1px 0 rgba( 255,255,255,.4 ),inset 0 10px 10px rgba( 255,255,255,.1 )";
219
  }
220
 
221
+ if ( strlen( $box_shadow ) > 1 )
222
  $css .= "-webkit-box-shadow:".$box_shadow.";
223
  -ms-box-shadow:".$box_shadow.";
224
  -moz-box-shadow:".$box_shadow.";
234
  border-radius: ".$this->options['radius']."px;\n}\n\n";
235
 
236
  $css .= "#dynamic-to-top:hover {
237
+ background: ".$this->get_ligther_hex( $this->options['background_color'] ).";
238
+ background: ".$this->options['background_color']." -webkit-gradient( linear, 0% 0%, 0% 100%, from( rgba( 255,255,255,.2 ) ),to( rgba( 0,0,0,0 ) ) );
239
+ background: ".$this->options['background_color']." -webkit-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
240
+ background: ".$this->options['background_color']." -khtml-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
241
+ background: ".$this->options['background_color']." -moz-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
242
+ background: ".$this->options['background_color']." -o-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
243
+ background: ".$this->options['background_color']." -ms-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
244
+ background: ".$this->options['background_color']." -icab-linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
245
+ background: ".$this->options['background_color']." linear-gradient( top, rgba( 255,255,255,.2 ), rgba( 0,0,0,0 ) );
246
  cursor:pointer;
247
  }
248
 
249
  #dynamic-to-top:active {
250
  background: ".$this->options['background_color'].";
251
+ background: ".$this->options['background_color']." -webkit-gradient( linear, 0% 0%, 0% 100%, from( rgba( 0,0,0,.3 ) ), to( rgba( 0,0,0,0 ) ) );
252
+ background: ".$this->options['background_color']." -webkit-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
253
+ background: ".$this->options['background_color']." -moz-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
254
+ background: ".$this->options['background_color']." -khtml-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
255
+ background: ".$this->options['background_color']." -o-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
256
+ background: ".$this->options['background_color']." -ms-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
257
+ background: ".$this->options['background_color']." -icab-linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
258
+ background: ".$this->options['background_color']." linear-gradient( top, rgba( 0,0,0,.1 ), rgba( 0,0,0,0 ) );
259
  }
260
 
261
  #dynamic-to-top,#dynamic-to-top:active,
269
  overflow:hidden;
270
  width:14px;
271
  height:12px;
272
+ background:url( ".MV_DYNAMIC_TO_TOP_URL."/css/images/up.png ) no-repeat center center;
273
  }";
274
 
275
  return $css;
287
  * @return string $easing Name of easing function.
288
  */
289
 
290
+ function get_easing_type( $easing="linear" ) {
291
+ switch ( $this->options['easing'] )
 
292
  {
293
  case 'Bounce':
294
  $easing = "easeOutBounce";
325
  * @return string $position Properties of the position selected.
326
  */
327
 
328
+ function get_position( $position="" ) {
329
+ switch ( $this->options['position'] )
 
330
  {
331
  case 'Bottom Right':
332
  $position = "bottom:".$this->options['margin']."px;right:".$this->options['margin']."px;top:auto;left:auto;";
361
  * @return boolean
362
  */
363
 
364
+ function is_checked( $option = "", $against = "yes" ) {
365
+ if ( $option == "" )
 
366
  return false;
367
 
368
+ if ( ! isset( $this->options[$option] ) )
369
  return false;
370
 
371
+ if ( $against == "" )
372
  return true;
373
  else {
374
+ if ( $this->options[$option] == $against )
375
  return true;
376
  else
377
  return false;
391
  * @return boolean.
392
  */
393
 
394
+ function is_mobile() {
 
395
 
396
+ if( isset( $_SERVER["HTTP_X_WAP_PROFILE"] ) )
397
  return true;
398
 
399
+ if( preg_match( "/wap\.|\.wap/i",$_SERVER["HTTP_ACCEPT"] ) )
400
  return true;
401
 
402
+ if( isset( $_SERVER["HTTP_USER_AGENT"] ) ) {
403
+ $user_agents = array(
 
404
  "midp", "j2me", "iphone","avantg", "docomo", "novarra", "palmos",
405
  "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/",
406
  "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi",
408
  "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC",
409
  "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover",
410
  "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal",
411
+ "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto" );
412
 
413
+ foreach( $user_agents as $user_string ) {
414
+ if( preg_match( "/" . $user_string . "/i", $_SERVER["HTTP_USER_AGENT"] ) )
 
415
  return true;
416
  }
417
  }
432
  * @return boolean.
433
  */
434
 
435
+ function get_ligther_hex( $hex,$factor = 30 ) {
 
436
 
437
  $new_hex = '#';
438
 
439
+ if ( strlen( $hex ) == 7 ) {
440
+ $base['R'] = hexdec( $hex{0}.$hex{1} );
441
+ $base['G'] = hexdec( $hex{2}.$hex{3} );
442
+ $base['B'] = hexdec( $hex{4}.$hex{5} );
 
443
  } else {
444
+ $base['R'] = hexdec( $hex{0}.$hex{0} );
445
+ $base['G'] = hexdec( $hex{1}.$hex{1} );
446
+ $base['B'] = hexdec( $hex{2}.$hex{2} );
447
  }
448
+ foreach ( $base as $k=>$v ) {
 
449
  $amount = 255 - $v;
450
  $amount = $amount / 100;
451
+ $amount = round( $amount * $factor );
452
  $new_decimal = $v + $amount;
453
 
454
+ $new_hex_component = dechex( $new_decimal );
455
 
456
+ if( strlen( $new_hex_component ) < 2 )
457
+ $new_hex_component = "0" . $new_hex_component;
458
 
459
  $new_hex .= $new_hex_component;
460
  }
476
  * @return string.
477
  */
478
 
479
+ function minify( $css ) {
480
+ $css = preg_replace( '#\s+#', ' ', $css );
481
+ $css = preg_replace( '#/\*.*?\*/#s', '', $css );
482
+ $css = str_replace( array( '; ', ': ', ' {', '{ ', ', ', '} ', ';}' ), array( ';', ':', '{', '{', ',', '}', '}' ), $css );
483
+ return trim( $css );
 
484
  }
485
 
486
 
492
  |--------------------------------------------------------------------------
493
  */
494
 
495
+ if ( ! function_exists( 'mv_dynamic_to_top_init' ) ) {
 
496
 
497
  /**
498
  * Initializes the main Dynamic to top class.
502
  *
503
  */
504
 
505
+ function mv_dynamic_to_top_init() {
 
506
  global $OBJ_dynamic_to_top;
507
  $OBJ_dynamic_to_top = new MV_Dynamic_To_Top();
508
  }
509
 
510
+ add_action( 'init', 'mv_dynamic_to_top_init' );
511
  }
512
  }
inc/dynamic-to-top-options.php CHANGED
@@ -2,34 +2,33 @@
2
  /**
3
  * Dynamic To Top Options
4
  *
5
- * @package Dynamic To Top
6
- * @subpackage Options
7
- * @author Matt Varone
8
  */
9
 
10
- add_action('admin_menu', 'mv_dynamic_to_top_create_options_page');
11
- add_action('admin_init', 'mv_dynamic_to_top_register_and_build_fields');
12
 
13
- if ( !function_exists('mv_dynamic_to_top_create_options_page') )
14
  {
15
 
16
  /**
17
  * Create Options Page
18
  *
19
- * @package Dynamic To Top
20
- * @subpackage Options
21
- * @since 3.0
22
  *
23
  */
24
 
25
- function mv_dynamic_to_top_create_options_page()
26
- {
27
  // Create Options Page
28
- add_options_page('Dynamic To Top Options','Dynamic To Top', 'manage_options', __FILE__, 'mv_dynamic_to_top_options_page');
29
  }
30
  }
31
 
32
- if ( !function_exists('mv_dynamic_to_top_register_and_build_fields') )
33
  {
34
 
35
  /**
@@ -37,40 +36,39 @@ if ( !function_exists('mv_dynamic_to_top_register_and_build_fields') )
37
  *
38
  * Register fields and sections.
39
  *
40
- * @package Dynamic To Top
41
- * @subpackage Options
42
- * @since 3.0
43
  *
44
  */
45
 
46
- function mv_dynamic_to_top_register_and_build_fields()
47
- {
48
- register_setting('dynamic_to_top', 'dynamic_to_top','mv_dynamic_to_top_save_settings');
49
 
50
- add_settings_section('settings_section', __('Behavior', MV_DYNAMIC_TO_TOP_DOMAIN),'__return_true',__FILE__);
51
- add_settings_section('appearance_section', __('Appearance', MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_appearance_section',__FILE__);
52
 
53
- add_settings_field('speed',__('Scroll time',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_scroll_time',__FILE__,'settings_section');
54
- add_settings_field('distance',__('Fade-in distance',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_distance',__FILE__,'settings_section');
55
- add_settings_field('easing',__('Easing',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_easing',__FILE__,'settings_section');
56
- add_settings_field('position',__('Position',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_position',__FILE__,'settings_section');
57
- add_settings_field('prevent_on_mobile',__('Prevent on mobile',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_prevent_on_mobile',__FILE__,'settings_section');
58
 
59
- add_settings_field('text_version',__('Text version',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_text_version',__FILE__,'appearance_section');
60
- add_settings_field('text',__('Button text',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_text',__FILE__,'appearance_section');
61
- add_settings_field('padding_top_bottom',__('Top/bottom padding',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_padding_top_bottom',__FILE__,'appearance_section');
62
- add_settings_field('padding_left_right',__('Sides padding',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_padding_left_right',__FILE__,'appearance_section');
63
- add_settings_field('font_size',__('Font size',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_font_size',__FILE__,'appearance_section');
64
- add_settings_field('text_color',__('Text color',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_text_color',__FILE__,'appearance_section');
65
- add_settings_field('bold',__('Bold Text',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_bold',__FILE__,'appearance_section');
66
- add_settings_field('text_shadow',__('Text shadow',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_text_shadow',__FILE__,'appearance_section');
67
- add_settings_field('shadow_color',__('Text shadow color',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_text_shadow_color',__FILE__,'appearance_section');
68
- add_settings_field('background_color',__('Background color',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_background_color',__FILE__,'appearance_section');
69
- add_settings_field('border_color',__('Border color',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_border_color',__FILE__,'appearance_section');
70
- add_settings_field('border_width',__('Border width',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_border_width',__FILE__,'appearance_section');
71
- add_settings_field('radius',__('Border radius',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_border_radius',__FILE__,'appearance_section');
72
- add_settings_field('inset',__('Inset highlighting',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_inset',__FILE__,'appearance_section');
73
- add_settings_field('shadow',__('Shadow',MV_DYNAMIC_TO_TOP_DOMAIN),'mv_dynamic_to_top_field_shadow',__FILE__,'appearance_section');
74
 
75
  }
76
  }
@@ -81,62 +79,55 @@ if ( !function_exists('mv_dynamic_to_top_register_and_build_fields') )
81
  |--------------------------------------------------------------------------
82
  */
83
 
84
- if ( !function_exists('mv_dynamic_to_top_options_page') )
85
  {
86
  /**
87
  * Options Page
88
  *
89
  * Options page layout.
90
  *
91
- * @package Dynamic To Top
92
- * @subpackage Options
93
- * @since 3.0
94
  *
95
  */
96
 
97
- function mv_dynamic_to_top_options_page()
98
- {
99
-
100
  ?>
101
  <div class="wrap">
102
  <?php screen_icon(); ?>
103
- <h2><?php _e('Dynamic To Top Options', MV_DYNAMIC_TO_TOP_DOMAIN); ?></h2>
104
 
105
- <p><?php _e('Welcome to the <strong>Dynamic To Top</strong> plugin settings. Click <a href="http://www.mattvarone.com/featured-content/dynamic-to-top/" target="_blank">here</a> to learn more about this plugin.',MV_DYNAMIC_TO_TOP_DOMAIN); ?></p>
106
 
107
 
108
  <form method="post" action="options.php" enctype="multipart/form-data">
109
- <?php settings_fields('dynamic_to_top'); ?>
110
- <?php do_settings_sections(__FILE__); ?>
111
 
112
  <p class="submit">
113
- <input name="Submit" type="submit" class="button-primary" value="<?php _e('Save Changes', MV_DYNAMIC_TO_TOP_DOMAIN); ?>" />
114
  </p>
115
 
116
- <p><small><?php _e('<strong>Dynamic To Top</strong> plugin brought to you by',MV_DYNAMIC_TO_TOP_DOMAIN); ?> <a href="http://www.mattvarone.com" title="Matt Varone" target="_blank"><strong>Matt Varone</strong></a>.</small></p>
117
 
118
  </form>
119
  </div>
120
  <?php
121
  }
122
-
123
  }
124
 
125
- if ( !function_exists('mv_dynamic_to_top_appearance_section') )
126
- {
127
- function mv_dynamic_to_top_appearance_section()
128
- {
129
  echo '<div id="dynamic-to-top-preview"><div id="dynamic-to-top-button"><span id="dtt-text"></span><span id="dtt-image"></span></div></div>';
130
- echo '<p class="ddt-bg-colors"><small>'.__('Preview over',MV_DYNAMIC_TO_TOP_DOMAIN).' <a href="#" title="black">'.__('black',MV_DYNAMIC_TO_TOP_DOMAIN).'</a>, <a href="#" title="lightgrey">'.__('grey',MV_DYNAMIC_TO_TOP_DOMAIN).'</a> or <a href="#" title="white">'.__('white',MV_DYNAMIC_TO_TOP_DOMAIN).'</a>.</small></p>';
131
  }
132
  }
133
 
134
- if ( !function_exists('mv_dynamic_to_top_save_settings') )
135
- {
136
- function mv_dynamic_to_top_save_settings($options)
137
- {
138
- delete_transient('dynamic_to_top_transient_css');
139
- delete_transient('dynamic_to_top_transient_js');
140
 
141
  return $options;
142
  }
@@ -148,65 +139,59 @@ if ( !function_exists('mv_dynamic_to_top_save_settings') )
148
  |--------------------------------------------------------------------------
149
  */
150
 
151
- if ( !function_exists('mv_dynamic_to_top_styles') )
152
- {
153
  /**
154
  * Options page enqueue style.
155
  *
156
- * @package Dynamic To Top
157
- * @subpackage Options
158
- * @since 3.0
159
  *
160
  */
161
 
162
- function mv_dynamic_to_top_styles()
163
- {
164
- if (mv_dynamic_to_top_is_page_options()) {
165
- wp_enqueue_style('farbtastic');
166
- wp_enqueue_style('dynamic-to-top-jquery-ui', MV_DYNAMIC_TO_TOP_URL.'/css/dynamic-to-top-jquery-ui.css',array(),'1.8.13');
167
- wp_enqueue_style('dynamic-to-top-admin', MV_DYNAMIC_TO_TOP_URL.'/css/dynamic-to-top-admin.css',array('dynamic-to-top-jquery-ui'),MV_DYNAMIC_TO_TOP_VERSION);
168
  }
169
  }
170
 
171
  add_action( 'admin_print_styles', 'mv_dynamic_to_top_styles' );
172
  }
173
 
174
- if ( !function_exists('mv_dynamic_to_top_scripts') )
175
- {
176
 
177
  /**
178
  * Options page enqueue script.
179
  *
180
- * @package Dynamic To Top
181
- * @subpackage Options
182
- * @since 3.0
183
  *
184
  */
185
 
186
- function mv_dynamic_to_top_scripts()
187
- {
188
- if (mv_dynamic_to_top_is_page_options())
189
- {
190
- wp_enqueue_script('jquery-ui-widget', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.widget.js', array('jquery-ui-core'),'1.8.14');
191
- wp_enqueue_script('jquery-ui-mouse', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.mouse.js', array('jquery-ui-widget'),'1.8.14');
192
- wp_enqueue_script('jquery-ui-slider', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.slider.js', array('jquery-ui-mouse'),'1.8.14');
193
- wp_enqueue_script('dynamic-to-top-settings',MV_DYNAMIC_TO_TOP_URL.'/js/dynamic.to.top.settings.js',array('jquery-ui-slider','farbtastic'),'1.0',true);
194
  }
195
  }
196
 
197
  add_action( 'admin_print_scripts', 'mv_dynamic_to_top_scripts' );
198
  }
199
 
200
- if ( !function_exists('mv_dynamic_to_top_is_page_options') )
201
- {
202
 
203
  /**
204
  * Is dynamic to top page options?
205
  *
206
- * @package Dynamic To Top
207
- * @subpackage Options
208
- * @since 3.0
209
- * @return boolean
210
  *
211
  */
212
 
@@ -214,20 +199,18 @@ if ( !function_exists('mv_dynamic_to_top_is_page_options') )
214
  {
215
  global $pagenow;
216
 
217
- if (function_exists('get_current_screen'))
218
- {
219
  $screen = get_current_screen();
220
 
221
- if ( isset($screen->base) && $screen->base == 'settings_page_'.MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options')
222
  return true;
223
  else
224
  return false;
225
  }
226
- else
227
- {
228
- $pages = array('options-general.php');
229
 
230
- if (in_array($pagenow, $pages) && isset($_GET['page']) && $_GET['page'] == MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options.php')
231
  return true;
232
  }
233
 
@@ -243,351 +226,309 @@ if ( !function_exists('mv_dynamic_to_top_is_page_options') )
243
 
244
  // COLOR PICKERS /////////////////////////
245
 
246
- if ( !function_exists('mv_dynamic_to_top_field_border_color') )
247
- {
248
 
249
  /**
250
- * @package Dynamic To Top
251
- * @subpackage Options
252
- * @since 3.0
253
  *
254
  */
255
 
256
- function mv_dynamic_to_top_field_border_color()
257
- {
258
- echo mv_dynamic_to_top_do_textfield_color('border_color','#000',__('Color for the button border.',MV_DYNAMIC_TO_TOP_DOMAIN));
259
  }
260
  }
261
 
262
- if ( !function_exists('mv_dynamic_to_top_field_background_color') )
263
- {
264
 
265
  /**
266
- * @package Dynamic To Top
267
- * @subpackage Options
268
- * @since 3.0
269
  *
270
  */
271
 
272
- function mv_dynamic_to_top_field_background_color()
273
- {
274
- echo mv_dynamic_to_top_do_textfield_color('background_color','#111',__('Background color for the button.',MV_DYNAMIC_TO_TOP_DOMAIN));
275
  }
276
  }
277
 
278
- if ( !function_exists('mv_dynamic_to_top_field_text_color') )
279
- {
280
 
281
  /**
282
- * @package Dynamic To Top
283
- * @subpackage Options
284
- * @since 3.0
285
  *
286
  */
287
 
288
- function mv_dynamic_to_top_field_text_color()
289
- {
290
- echo mv_dynamic_to_top_do_textfield_color('text_color','#fff',__('Button text color.',MV_DYNAMIC_TO_TOP_DOMAIN));
291
  }
292
  }
293
 
294
- if ( !function_exists('mv_dynamic_to_top_field_text_shadow_color') )
295
- {
296
 
297
  /**
298
- * @package Dynamic To Top
299
- * @subpackage Options
300
- * @since 3.0
301
  *
302
  */
303
 
304
- function mv_dynamic_to_top_field_text_shadow_color()
305
- {
306
- echo mv_dynamic_to_top_do_textfield_color('shadow_color','#333',__('Text shadow color.',MV_DYNAMIC_TO_TOP_DOMAIN));
307
  }
308
  }
309
 
310
- if ( !function_exists('mv_dynamic_to_top_field_box_shadow_color') )
311
- {
312
 
313
  /**
314
- * @package Dynamic To Top
315
- * @subpackage Options
316
- * @since 3.0
317
  *
318
  */
319
 
320
- function mv_dynamic_to_top_field_box_shadow_color()
321
- {
322
- echo mv_dynamic_to_top_do_textfield_color('box_shadow_color','#333',__('Text shadow color.',MV_DYNAMIC_TO_TOP_DOMAIN));
323
  }
324
  }
325
 
326
  // SELECT BOX /////////////////////////
327
 
328
- if ( !function_exists('mv_dynamic_to_top_field_easing') )
329
- {
330
 
331
  /**
332
- * @package Dynamic To Top
333
- * @subpackage Options
334
- * @since 3.0
335
  *
336
  */
337
 
338
- function mv_dynamic_to_top_field_easing()
339
- {
340
- $options = array( 'Linear', 'In','Out','In Out','Bounce','Elastic');
341
 
342
- echo mv_dynamic_to_top_do_select('easing',$options,'In',__('<a href="http://gsgd.co.uk/sandbox/jquery/easing" title="Easing type">Easing type</a> used to scroll the page up.',MV_DYNAMIC_TO_TOP_DOMAIN));
343
  }
344
  }
345
 
346
- if ( !function_exists('mv_dynamic_to_top_field_position') )
347
- {
348
 
349
  /**
350
- * @package Dynamic To Top
351
- * @subpackage Options
352
- * @since 3.0
353
  *
354
  */
355
 
356
- function mv_dynamic_to_top_field_position()
357
- {
358
- $options = array( 'Top Left', 'Top Right', 'Bottom Left', 'Bottom Right');
359
 
360
- echo mv_dynamic_to_top_do_select('position',$options,'Bottom Right',__('Button position.',MV_DYNAMIC_TO_TOP_DOMAIN));
361
  }
362
  }
363
 
364
  // SLIDER UI /////////////////////////
365
 
366
- if ( !function_exists('mv_dynamic_to_top_field_scroll_time') )
367
- {
368
 
369
  /**
370
- * @package Dynamic To Top
371
- * @subpackage Options
372
- * @since 3.0
373
  *
374
  */
375
 
376
- function mv_dynamic_to_top_field_scroll_time()
377
- {
378
- echo mv_dynamic_to_top_do_slider('speed',1100,__('Time it takes for the page to scroll up. Less for faster. ( <span id="speed-val"></span> Milliseconds )',MV_DYNAMIC_TO_TOP_DOMAIN));
379
  }
380
  }
381
 
382
- if ( !function_exists('mv_dynamic_to_top_field_font_size') )
383
- {
384
 
385
  /**
386
- * @package Dynamic To Top
387
- * @subpackage Options
388
- * @since 3.0
389
  *
390
  */
391
 
392
- function mv_dynamic_to_top_field_font_size()
393
- {
394
- echo mv_dynamic_to_top_do_slider('font_size',1,__('Button text size. ( <span id="font-size-val"></span> Em/s )',MV_DYNAMIC_TO_TOP_DOMAIN));
395
  }
396
  }
397
 
398
- if ( !function_exists('mv_dynamic_to_top_field_padding_top_bottom') )
399
- {
400
 
401
  /**
402
- * @package Dynamic To Top
403
- * @subpackage Options
404
- * @since 3.0
405
  *
406
  */
407
 
408
- function mv_dynamic_to_top_field_padding_top_bottom()
409
- {
410
- echo mv_dynamic_to_top_do_slider('padding_top_bottom',21,__('Spacing on Top and Bottom. ( <span id="padding-top-bottom-val"></span>px )',MV_DYNAMIC_TO_TOP_DOMAIN));
411
  }
412
  }
413
 
414
- if ( !function_exists('mv_dynamic_to_top_field_padding_left_right') )
415
- {
416
 
417
  /**
418
- * @package Dynamic To Top
419
- * @subpackage Options
420
- * @since 3.0
421
  *
422
  */
423
 
424
- function mv_dynamic_to_top_field_padding_left_right()
425
- {
426
- echo mv_dynamic_to_top_do_slider('padding_left_right',19,__('Spacing on Left and Right. ( <span id="padding-left-right-val"></span>px )',MV_DYNAMIC_TO_TOP_DOMAIN));
427
  }
428
  }
429
 
430
- if ( !function_exists('mv_dynamic_to_top_field_border_width') )
431
- {
432
 
433
  /**
434
- * @package Dynamic To Top
435
- * @subpackage Options
436
- * @since 3.0
437
  *
438
  */
439
 
440
- function mv_dynamic_to_top_field_border_width()
441
- {
442
- echo mv_dynamic_to_top_do_slider('border_width','1',__('Button border width',MV_DYNAMIC_TO_TOP_DOMAIN).' <span id="border-val"></span>px.');
443
  }
444
  }
445
 
446
- if ( !function_exists('mv_dynamic_to_top_field_border_radius') )
447
- {
448
 
449
  /**
450
- * @package Dynamic To Top
451
- * @subpackage Options
452
- * @since 3.0
453
  *
454
  */
455
 
456
- function mv_dynamic_to_top_field_border_radius()
457
- {
458
- echo mv_dynamic_to_top_do_slider('radius','9',__('Button border radius',MV_DYNAMIC_TO_TOP_DOMAIN).' <span id="radius-val"></span>px.');
459
  }
460
  }
461
 
462
  // TEXTFIELDS /////////////////////////
463
 
464
- if ( !function_exists('mv_dynamic_to_top_field_distance') )
465
- {
466
 
467
  /**
468
- * @package Dynamic To Top
469
- * @subpackage Options
470
- * @since 3.0
471
  *
472
  */
473
 
474
- function mv_dynamic_to_top_field_distance()
475
- {
476
- echo mv_dynamic_to_top_do_textfield('distance',300,__('Distance from top to show the button. ( Pixels )',MV_DYNAMIC_TO_TOP_DOMAIN));
477
  }
478
  }
479
 
480
- if ( !function_exists('mv_dynamic_to_top_field_text') )
481
- {
482
 
483
  /**
484
- * @package Dynamic To Top
485
- * @subpackage Options
486
- * @since 3.0
487
  *
488
  */
489
 
490
- function mv_dynamic_to_top_field_text()
491
- {
492
- echo mv_dynamic_to_top_do_textfield('text',__('To Top',MV_DYNAMIC_TO_TOP_DOMAIN),__('Text displayed on the button.',MV_DYNAMIC_TO_TOP_DOMAIN),'regular-text');
493
  }
494
  }
495
 
496
  // CHECKBOXES /////////////////////////
497
 
498
- if ( !function_exists('mv_dynamic_to_top_field_prevent_on_mobile') )
499
- {
500
 
501
  /**
502
- * @package Dynamic To Top
503
- * @subpackage Options
504
- * @since 3.0
505
  *
506
  */
507
 
508
- function mv_dynamic_to_top_field_prevent_on_mobile()
509
- {
510
- echo mv_dynamic_to_top_do_checkbox('prevent_on_mobile',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',false,__('Disable the button on mobile browsers.',MV_DYNAMIC_TO_TOP_DOMAIN));
511
  }
512
  }
513
 
514
- if ( !function_exists('mv_dynamic_to_top_field_text_version') )
515
- {
516
 
517
  /**
518
- * @package Dynamic To Top
519
- * @subpackage Options
520
- * @since 3.0
521
  *
522
  */
523
 
524
- function mv_dynamic_to_top_field_text_version()
525
- {
526
- echo mv_dynamic_to_top_do_checkbox('text_version',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',false,__('Show a text version instead of the arrow up icon.',MV_DYNAMIC_TO_TOP_DOMAIN));
527
  }
528
  }
529
 
530
- if ( !function_exists('mv_dynamic_to_top_field_inset') )
531
- {
532
 
533
  /**
534
- * @package Dynamic To Top
535
- * @subpackage Options
536
- * @since 3.0
537
  *
538
  */
539
 
540
- function mv_dynamic_to_top_field_inset()
541
- {
542
- echo mv_dynamic_to_top_do_checkbox('inset',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',true,__('Add CSS3 inset-highlight.',MV_DYNAMIC_TO_TOP_DOMAIN));
543
  }
544
  }
545
 
546
- if ( !function_exists('mv_dynamic_to_top_field_shadow') )
547
- {
548
 
549
  /**
550
- * @package Dynamic To Top
551
- * @subpackage Options
552
- * @since 3.0
553
  *
554
  */
555
 
556
- function mv_dynamic_to_top_field_shadow()
557
- {
558
- echo mv_dynamic_to_top_do_checkbox('shadow',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',true,__('Add CSS3 shadow.',MV_DYNAMIC_TO_TOP_DOMAIN));
559
  }
560
  }
561
 
562
- if ( !function_exists('mv_dynamic_to_top_field_weight') )
563
- {
564
 
565
  /**
566
- * @package Dynamic To Top
567
- * @subpackage Options
568
- * @since 3.0
569
  *
570
  */
571
 
572
- function mv_dynamic_to_top_field_bold()
573
- {
574
- echo mv_dynamic_to_top_do_checkbox('bold',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',true,__('Make the text bold.',MV_DYNAMIC_TO_TOP_DOMAIN));
575
  }
576
  }
577
 
578
- if ( !function_exists('mv_dynamic_to_top_field_text_shadow') )
579
- {
580
 
581
  /**
582
- * @package Dynamic To Top
583
- * @subpackage Options
584
- * @since 3.0
585
  *
586
  */
587
 
588
- function mv_dynamic_to_top_field_text_shadow()
589
- {
590
- echo mv_dynamic_to_top_do_checkbox('text_shadow',__('Yes',MV_DYNAMIC_TO_TOP_DOMAIN),'yes',true,__('Add a subtle text shadow.',MV_DYNAMIC_TO_TOP_DOMAIN));
591
  }
592
  }
593
  /*
@@ -596,155 +537,151 @@ if ( !function_exists('mv_dynamic_to_top_field_text_shadow') )
596
  |--------------------------------------------------------------------------
597
  */
598
 
599
- if ( !function_exists('mv_dynamic_to_top_do_checkbox') )
600
- {
601
 
602
  /**
603
  * Do Checkbox
604
  *
605
  * Generates a checkbox.
606
  *
607
- * @package Dynamic To Top
608
- * @subpackage Options
609
- * @since 3.0
610
  *
611
  */
612
 
613
- function mv_dynamic_to_top_do_checkbox($meta,$label="Yes",$value='yes',$checked=false,$desc="")
614
  {
615
 
616
- $options_db = get_option('dynamic_to_top');
617
 
618
- if (isset($options_db[$meta]) && $options_db[$meta] == $value)
619
  $c = 'checked="checked"';
620
  else
621
  $c="";
622
 
623
 
624
- if ( $desc != "")
625
  $desc = '<div class="desc">'.$desc.'</div>';
626
 
627
- $sanitized_meta_title = str_replace('_','-',sanitize_title($meta));
628
 
629
  return '<input type="checkbox" name="dynamic_to_top['.$meta.']" value="'.$value.'" '.$c.' id="checkbox-'.$sanitized_meta_title.'" /> '.$label.$desc;
630
  }
631
  }
632
 
633
- if ( !function_exists('mv_dynamic_to_top_do_textfield') )
634
- {
635
 
636
  /**
637
  * Do Textfield
638
  *
639
  * Generates a Textfield.
640
  *
641
- * @package Dynamic To Top
642
- * @subpackage Options
643
- * @since 3.0
644
  *
645
  */
646
 
647
- function mv_dynamic_to_top_do_textfield($meta,$value="",$desc="",$class="")
648
  {
649
 
650
- $options_db = get_option('dynamic_to_top');
651
 
652
- if ( isset($options_db[$meta]))
653
  $value = $options_db[$meta];
654
 
655
- if ( $desc != "")
656
  $desc = '<div class="desc">'.$desc.'</div>';
657
 
658
- if ( $class != "")
659
  $class = 'class="'.$class.'"';
660
 
661
- $sanitized_meta_title = str_replace('_','-',sanitize_title($meta));
662
 
663
  return '<input type="text" id="text-'.$sanitized_meta_title.'" name="dynamic_to_top['.$meta.']" '.$class.' value="'.$value.'" /> '.$desc;
664
  }
665
  }
666
 
667
- if ( !function_exists('mv_dynamic_to_top_do_select') )
668
- {
669
 
670
  /**
671
  * Do Select Box
672
  *
673
  * Generate a select box.
674
  *
675
- * @package Dynamic To Top
676
- * @subpackage Options
677
- * @since 3.0
678
  *
679
  */
680
 
681
- function mv_dynamic_to_top_do_select($meta,$options=array(),$value="",$desc="")
682
  {
683
 
684
  $options_out = "";
685
 
686
- $options_db = get_option('dynamic_to_top');
687
 
688
- if ( isset($options_db[$meta]))
689
  $value = $options_db[$meta];
690
 
691
- $value = sanitize_title($value);
692
 
693
- foreach ($options as $option)
694
  {
695
  $selected = "";
696
 
697
- $option_slug = sanitize_title($option);
698
 
699
  if ( $value == $option_slug )
700
  $selected = 'selected="selected"';
701
 
702
- $options_out .= '<option name="'.sanitize_title($option).'" '.$selected.' >'.$option.'</option>';
703
  }
704
 
705
- if ( $desc != "")
706
  $desc = '<div class="desc">'.$desc.'</div>';
707
 
708
- $sanitized_meta_title = str_replace('_','-',sanitize_title($meta));
709
 
710
  return '<select name="dynamic_to_top['.$meta.']" id="select-'.$sanitized_meta_title.'"> '.$options_out.'</select>'.$desc;
711
  }
712
  }
713
 
714
- if ( !function_exists('mv_dynamic_to_top_do_textfield_color') )
715
- {
716
 
717
  /**
718
  * Do Textfield Color
719
  *
720
  * Generates a Textfield with Farbtastic.
721
  *
722
- * @package Dynamic To Top
723
- * @subpackage Options
724
- * @since 3.0
725
  *
726
  */
727
 
728
- function mv_dynamic_to_top_do_textfield_color($meta,$value="",$desc="",$class="")
729
  {
730
 
731
- $options_db = get_option('dynamic_to_top');
732
 
733
- if ( isset($options_db[$meta]))
734
  $value = $options_db[$meta];
735
 
736
- if ( $desc != "")
737
  $desc = '<div class="desc">'.$desc.'</div>';
738
 
739
- if ( $class != "")
740
  $class .= " ";
741
 
742
  $class = 'class="'.$class.'colorvalue"';
743
 
744
- $sanitized_meta_title = str_replace('_','-',sanitize_title($meta));
745
 
746
  $out = '<input type="text" name="dynamic_to_top['.$meta.']" id="farbtastic-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />';
747
- $out .= '<a class="picker hide-if-no-js" href="#" data-closed="'.__('close',MV_DYNAMIC_TO_TOP_DOMAIN).'" data-open="'.__('select a color',MV_DYNAMIC_TO_TOP_DOMAIN).'">'.__('select a color',MV_DYNAMIC_TO_TOP_DOMAIN).'</a>';
748
  $out .= '<div id="farbtastic-picker-'.$sanitized_meta_title.'" class="dtt-farbtastic"></div>';
749
  $out .= $desc;
750
 
@@ -752,37 +689,36 @@ if ( !function_exists('mv_dynamic_to_top_do_textfield_color') )
752
  }
753
  }
754
 
755
- if ( !function_exists('mv_dynamic_to_top_do_slider') )
756
- {
757
 
758
  /**
759
  * Do Textfield Color
760
  *
761
  * Generates a Textfield with a slider.
762
  *
763
- * @package Dynamic To Top
764
- * @subpackage Options
765
- * @since 3.0
766
  *
767
  */
768
 
769
- function mv_dynamic_to_top_do_slider($meta,$value="",$desc="",$class="")
770
  {
771
 
772
- $options_db = get_option('dynamic_to_top');
773
 
774
- if ( isset($options_db[$meta]))
775
  $value = $options_db[$meta];
776
 
777
- if ( $desc != "")
778
  $desc = '<div class="desc">'.$desc.'</div>';
779
 
780
- if ( $class != "")
781
  $class .= " ";
782
 
783
  $class = 'class="'.$class.'colorvalue"';
784
 
785
- $sanitized_meta_title = str_replace('_','-',sanitize_title($meta));
786
 
787
  return '<div id="slider-picker-'.$sanitized_meta_title.'" class="dtt-slider"></div><input type="text" name="dynamic_to_top['.$meta.']" id="slider-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />'.$desc;
788
  }
2
  /**
3
  * Dynamic To Top Options
4
  *
5
+ * @package Dynamic To Top
6
+ * @subpackage Options
7
+ * @author Matt Varone
8
  */
9
 
10
+ add_action( 'admin_menu', 'mv_dynamic_to_top_create_options_page' );
11
+ add_action( 'admin_init', 'mv_dynamic_to_top_register_and_build_fields' );
12
 
13
+ if ( ! function_exists( 'mv_dynamic_to_top_create_options_page' ) )
14
  {
15
 
16
  /**
17
  * Create Options Page
18
  *
19
+ * @package Dynamic To Top
20
+ * @subpackage Options
21
+ * @since 3.0
22
  *
23
  */
24
 
25
+ function mv_dynamic_to_top_create_options_page() {
 
26
  // Create Options Page
27
+ add_options_page( 'Dynamic To Top Options', 'Dynamic To Top', 'manage_options', __FILE__, 'mv_dynamic_to_top_options_page' );
28
  }
29
  }
30
 
31
+ if ( ! function_exists( 'mv_dynamic_to_top_register_and_build_fields' ) )
32
  {
33
 
34
  /**
36
  *
37
  * Register fields and sections.
38
  *
39
+ * @package Dynamic To Top
40
+ * @subpackage Options
41
+ * @since 3.0
42
  *
43
  */
44
 
45
+ function mv_dynamic_to_top_register_and_build_fields() {
46
+ register_setting( 'dynamic_to_top', 'dynamic_to_top', 'mv_dynamic_to_top_save_settings' );
 
47
 
48
+ add_settings_section( 'settings_section', __( 'Behavior', MV_DYNAMIC_TO_TOP_DOMAIN ), '__return_true', __FILE__ );
49
+ add_settings_section( 'appearance_section', __( 'Appearance', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_appearance_section', __FILE__ );
50
 
51
+ add_settings_field( 'speed', __( 'Scroll time', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_scroll_time', __FILE__, 'settings_section' );
52
+ add_settings_field( 'distance', __( 'Fade-in distance', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_distance', __FILE__, 'settings_section' );
53
+ add_settings_field( 'easing', __( 'Easing', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_easing', __FILE__, 'settings_section' );
54
+ add_settings_field( 'position', __( 'Position', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_position', __FILE__, 'settings_section' );
55
+ add_settings_field( 'prevent_on_mobile', __( 'Prevent on mobile', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_prevent_on_mobile', __FILE__, 'settings_section' );
56
 
57
+ add_settings_field( 'text_version', __( 'Text version', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_version', __FILE__, 'appearance_section' );
58
+ add_settings_field( 'text', __( 'Button text', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text', __FILE__, 'appearance_section' );
59
+ add_settings_field( 'padding_top_bottom', __( 'Top/bottom padding', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_padding_top_bottom', __FILE__, 'appearance_section' );
60
+ add_settings_field( 'padding_left_right', __( 'Sides padding', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_padding_left_right', __FILE__, 'appearance_section' );
61
+ add_settings_field( 'font_size', __( 'Font size', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_font_size', __FILE__, 'appearance_section' );
62
+ add_settings_field( 'text_color', __( 'Text color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_color', __FILE__, 'appearance_section' );
63
+ add_settings_field( 'bold', __( 'Bold Text', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_bold', __FILE__, 'appearance_section' );
64
+ add_settings_field( 'text_shadow', __( 'Text shadow', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_shadow', __FILE__, 'appearance_section' );
65
+ add_settings_field( 'shadow_color', __( 'Text shadow color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_text_shadow_color', __FILE__, 'appearance_section' );
66
+ add_settings_field( 'background_color', __( 'Background color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_background_color', __FILE__, 'appearance_section' );
67
+ add_settings_field( 'border_color', __( 'Border color', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_color', __FILE__, 'appearance_section' );
68
+ add_settings_field( 'border_width', __( 'Border width', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_width', __FILE__, 'appearance_section' );
69
+ add_settings_field( 'radius', __( 'Border radius', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_border_radius', __FILE__, 'appearance_section' );
70
+ add_settings_field( 'inset', __( 'Inset highlighting', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_inset', __FILE__, 'appearance_section' );
71
+ add_settings_field( 'shadow', __( 'Shadow', MV_DYNAMIC_TO_TOP_DOMAIN ), 'mv_dynamic_to_top_field_shadow', __FILE__, 'appearance_section' );
72
 
73
  }
74
  }
79
  |--------------------------------------------------------------------------
80
  */
81
 
82
+ if ( ! function_exists( 'mv_dynamic_to_top_options_page' ) )
83
  {
84
  /**
85
  * Options Page
86
  *
87
  * Options page layout.
88
  *
89
+ * @package Dynamic To Top
90
+ * @subpackage Options
91
+ * @since 3.0
92
  *
93
  */
94
 
95
+ function mv_dynamic_to_top_options_page() {
 
 
96
  ?>
97
  <div class="wrap">
98
  <?php screen_icon(); ?>
99
+ <h2><?php _e( 'Dynamic To Top Options', MV_DYNAMIC_TO_TOP_DOMAIN ); ?></h2>
100
 
101
+ <p><?php _e( 'Welcome to the <strong>Dynamic To Top</strong> plugin settings. Click <a href="http://www.mattvarone.com/featured-content/dynamic-to-top/" target="_blank">here</a> to learn more about this plugin.', MV_DYNAMIC_TO_TOP_DOMAIN ); ?></p>
102
 
103
 
104
  <form method="post" action="options.php" enctype="multipart/form-data">
105
+ <?php settings_fields( 'dynamic_to_top' ); ?>
106
+ <?php do_settings_sections( __FILE__ ); ?>
107
 
108
  <p class="submit">
109
+ <input name="Submit" type="submit" class="button-primary" value="<?php _e( 'Save Changes', MV_DYNAMIC_TO_TOP_DOMAIN ); ?>" />
110
  </p>
111
 
112
+ <p><small><?php _e( '<strong>Dynamic To Top</strong> plugin brought to you by', MV_DYNAMIC_TO_TOP_DOMAIN ); ?> <a href="http://www.mattvarone.com" title="Matt Varone" target="_blank"><strong>Matt Varone</strong></a>.</small></p>
113
 
114
  </form>
115
  </div>
116
  <?php
117
  }
 
118
  }
119
 
120
+ if ( ! function_exists( 'mv_dynamic_to_top_appearance_section' ) ) {
121
+ function mv_dynamic_to_top_appearance_section() {
 
 
122
  echo '<div id="dynamic-to-top-preview"><div id="dynamic-to-top-button"><span id="dtt-text"></span><span id="dtt-image"></span></div></div>';
123
+ echo '<p class="ddt-bg-colors"><small>'.__( 'Preview over', MV_DYNAMIC_TO_TOP_DOMAIN ).' <a href="#" title="black">'.__( 'black', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>, <a href="#" title="lightgrey">'.__( 'grey', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a> or <a href="#" title="white">'.__( 'white', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>.</small></p>';
124
  }
125
  }
126
 
127
+ if ( ! function_exists( 'mv_dynamic_to_top_save_settings' ) ) {
128
+ function mv_dynamic_to_top_save_settings( $options ) {
129
+ delete_transient( 'dynamic_to_top_transient_css' );
130
+ delete_transient( 'dynamic_to_top_transient_js' );
 
 
131
 
132
  return $options;
133
  }
139
  |--------------------------------------------------------------------------
140
  */
141
 
142
+ if ( ! function_exists( 'mv_dynamic_to_top_styles' ) ) {
 
143
  /**
144
  * Options page enqueue style.
145
  *
146
+ * @package Dynamic To Top
147
+ * @subpackage Options
148
+ * @since 3.0
149
  *
150
  */
151
 
152
+ function mv_dynamic_to_top_styles() {
153
+ if ( mv_dynamic_to_top_is_page_options() ) {
154
+ wp_enqueue_style( 'farbtastic' );
155
+ wp_enqueue_style( 'dynamic-to-top-jquery-ui', MV_DYNAMIC_TO_TOP_URL.'/css/dynamic-to-top-jquery-ui.css', array(), '1.8.13' );
156
+ wp_enqueue_style( 'dynamic-to-top-admin', MV_DYNAMIC_TO_TOP_URL.'/css/dynamic-to-top-admin.css', array( 'dynamic-to-top-jquery-ui' ), MV_DYNAMIC_TO_TOP_VERSION );
 
157
  }
158
  }
159
 
160
  add_action( 'admin_print_styles', 'mv_dynamic_to_top_styles' );
161
  }
162
 
163
+ if ( ! function_exists( 'mv_dynamic_to_top_scripts' ) ) {
 
164
 
165
  /**
166
  * Options page enqueue script.
167
  *
168
+ * @package Dynamic To Top
169
+ * @subpackage Options
170
+ * @since 3.0
171
  *
172
  */
173
 
174
+ function mv_dynamic_to_top_scripts() {
175
+ if ( mv_dynamic_to_top_is_page_options() ) {
176
+ wp_enqueue_script( 'jquery-ui-widget', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.widget.js', array( 'jquery-ui-core' ), '1.8.14' );
177
+ wp_enqueue_script( 'jquery-ui-mouse', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.mouse.js', array( 'jquery-ui-widget' ), '1.8.14' );
178
+ wp_enqueue_script( 'jquery-ui-slider', MV_DYNAMIC_TO_TOP_URL.'/js/libs/jquery.ui.slider.js', array( 'jquery-ui-mouse' ), '1.8.14' );
179
+ wp_enqueue_script( 'dynamic-to-top-settings', MV_DYNAMIC_TO_TOP_URL.'/js/dynamic.to.top.settings.js', array( 'jquery-ui-slider', 'farbtastic' ), '1.0', true );
 
 
180
  }
181
  }
182
 
183
  add_action( 'admin_print_scripts', 'mv_dynamic_to_top_scripts' );
184
  }
185
 
186
+ if ( ! function_exists( 'mv_dynamic_to_top_is_page_options' ) ) {
 
187
 
188
  /**
189
  * Is dynamic to top page options?
190
  *
191
+ * @package Dynamic To Top
192
+ * @subpackage Options
193
+ * @since 3.0
194
+ * @return boolean
195
  *
196
  */
197
 
199
  {
200
  global $pagenow;
201
 
202
+ if ( function_exists( 'get_current_screen' ) ) {
 
203
  $screen = get_current_screen();
204
 
205
+ if ( isset( $screen->base ) && $screen->base == 'settings_page_'.MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options' )
206
  return true;
207
  else
208
  return false;
209
  }
210
+ else {
211
+ $pages = array( 'options-general.php' );
 
212
 
213
+ if ( in_array( $pagenow, $pages ) && isset( $_GET['page'] ) && $_GET['page'] == MV_DYNAMIC_TO_TOP_FOLDER.'/inc/dynamic-to-top-options.php' )
214
  return true;
215
  }
216
 
226
 
227
  // COLOR PICKERS /////////////////////////
228
 
229
+ if ( ! function_exists( 'mv_dynamic_to_top_field_border_color' ) ) {
 
230
 
231
  /**
232
+ * @package Dynamic To Top
233
+ * @subpackage Options
234
+ * @since 3.0
235
  *
236
  */
237
 
238
+ function mv_dynamic_to_top_field_border_color() {
239
+ echo mv_dynamic_to_top_do_textfield_color( 'border_color', '#000', __( 'Color for the button border.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
240
  }
241
  }
242
 
243
+ if ( ! function_exists( 'mv_dynamic_to_top_field_background_color' ) ) {
 
244
 
245
  /**
246
+ * @package Dynamic To Top
247
+ * @subpackage Options
248
+ * @since 3.0
249
  *
250
  */
251
 
252
+ function mv_dynamic_to_top_field_background_color() {
253
+ echo mv_dynamic_to_top_do_textfield_color( 'background_color', '#111', __( 'Background color for the button.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
254
  }
255
  }
256
 
257
+ if ( ! function_exists( 'mv_dynamic_to_top_field_text_color' ) ) {
 
258
 
259
  /**
260
+ * @package Dynamic To Top
261
+ * @subpackage Options
262
+ * @since 3.0
263
  *
264
  */
265
 
266
+ function mv_dynamic_to_top_field_text_color() {
267
+ echo mv_dynamic_to_top_do_textfield_color( 'text_color', '#fff', __( 'Button text color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
268
  }
269
  }
270
 
271
+ if ( ! function_exists( 'mv_dynamic_to_top_field_text_shadow_color' ) ) {
 
272
 
273
  /**
274
+ * @package Dynamic To Top
275
+ * @subpackage Options
276
+ * @since 3.0
277
  *
278
  */
279
 
280
+ function mv_dynamic_to_top_field_text_shadow_color() {
281
+ echo mv_dynamic_to_top_do_textfield_color( 'shadow_color', '#333', __( 'Text shadow color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
282
  }
283
  }
284
 
285
+ if ( ! function_exists( 'mv_dynamic_to_top_field_box_shadow_color' ) ) {
 
286
 
287
  /**
288
+ * @package Dynamic To Top
289
+ * @subpackage Options
290
+ * @since 3.0
291
  *
292
  */
293
 
294
+ function mv_dynamic_to_top_field_box_shadow_color() {
295
+ echo mv_dynamic_to_top_do_textfield_color( 'box_shadow_color', '#333', __( 'Text shadow color.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
296
  }
297
  }
298
 
299
  // SELECT BOX /////////////////////////
300
 
301
+ if ( ! function_exists( 'mv_dynamic_to_top_field_easing' ) ) {
 
302
 
303
  /**
304
+ * @package Dynamic To Top
305
+ * @subpackage Options
306
+ * @since 3.0
307
  *
308
  */
309
 
310
+ function mv_dynamic_to_top_field_easing() {
311
+ $options = array( 'Linear', 'In', 'Out', 'In Out', 'Bounce', 'Elastic' );
 
312
 
313
+ echo mv_dynamic_to_top_do_select( 'easing', $options, 'In', __( '<a href="http://gsgd.co.uk/sandbox/jquery/easing" title="Easing type">Easing type</a> used to scroll the page up.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
314
  }
315
  }
316
 
317
+ if ( ! function_exists( 'mv_dynamic_to_top_field_position' ) ) {
 
318
 
319
  /**
320
+ * @package Dynamic To Top
321
+ * @subpackage Options
322
+ * @since 3.0
323
  *
324
  */
325
 
326
+ function mv_dynamic_to_top_field_position() {
327
+ $options = array( 'Top Left', 'Top Right', 'Bottom Left', 'Bottom Right' );
 
328
 
329
+ echo mv_dynamic_to_top_do_select( 'position', $options, 'Bottom Right', __( 'Button position.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
330
  }
331
  }
332
 
333
  // SLIDER UI /////////////////////////
334
 
335
+ if ( ! function_exists( 'mv_dynamic_to_top_field_scroll_time' ) ) {
 
336
 
337
  /**
338
+ * @package Dynamic To Top
339
+ * @subpackage Options
340
+ * @since 3.0
341
  *
342
  */
343
 
344
+ function mv_dynamic_to_top_field_scroll_time() {
345
+ echo mv_dynamic_to_top_do_slider( 'speed', 1100, __( 'Time it takes for the page to scroll up. Less for faster. ( <span id="speed-val"></span> Milliseconds )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
346
  }
347
  }
348
 
349
+ if ( ! function_exists( 'mv_dynamic_to_top_field_font_size' ) ) {
 
350
 
351
  /**
352
+ * @package Dynamic To Top
353
+ * @subpackage Options
354
+ * @since 3.0
355
  *
356
  */
357
 
358
+ function mv_dynamic_to_top_field_font_size() {
359
+ echo mv_dynamic_to_top_do_slider( 'font_size', 1, __( 'Button text size. ( <span id="font-size-val"></span> Em/s )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
360
  }
361
  }
362
 
363
+ if ( ! function_exists( 'mv_dynamic_to_top_field_padding_top_bottom' ) ) {
 
364
 
365
  /**
366
+ * @package Dynamic To Top
367
+ * @subpackage Options
368
+ * @since 3.0
369
  *
370
  */
371
 
372
+ function mv_dynamic_to_top_field_padding_top_bottom() {
373
+ echo mv_dynamic_to_top_do_slider( 'padding_top_bottom', 21, __( 'Spacing on Top and Bottom. ( <span id="padding-top-bottom-val"></span>px )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
374
  }
375
  }
376
 
377
+ if ( ! function_exists( 'mv_dynamic_to_top_field_padding_left_right' ) ) {
 
378
 
379
  /**
380
+ * @package Dynamic To Top
381
+ * @subpackage Options
382
+ * @since 3.0
383
  *
384
  */
385
 
386
+ function mv_dynamic_to_top_field_padding_left_right() {
387
+ echo mv_dynamic_to_top_do_slider( 'padding_left_right', 19, __( 'Spacing on Left and Right. ( <span id="padding-left-right-val"></span>px )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
388
  }
389
  }
390
 
391
+ if ( ! function_exists( 'mv_dynamic_to_top_field_border_width' ) ) {
 
392
 
393
  /**
394
+ * @package Dynamic To Top
395
+ * @subpackage Options
396
+ * @since 3.0
397
  *
398
  */
399
 
400
+ function mv_dynamic_to_top_field_border_width() {
401
+ echo mv_dynamic_to_top_do_slider( 'border_width', '1', __( 'Button border width', MV_DYNAMIC_TO_TOP_DOMAIN ).' <span id="border-val"></span>px.' );
 
402
  }
403
  }
404
 
405
+ if ( ! function_exists( 'mv_dynamic_to_top_field_border_radius' ) ) {
 
406
 
407
  /**
408
+ * @package Dynamic To Top
409
+ * @subpackage Options
410
+ * @since 3.0
411
  *
412
  */
413
 
414
+ function mv_dynamic_to_top_field_border_radius() {
415
+ echo mv_dynamic_to_top_do_slider( 'radius', '9', __( 'Button border radius', MV_DYNAMIC_TO_TOP_DOMAIN ).' <span id="radius-val"></span>px.' );
 
416
  }
417
  }
418
 
419
  // TEXTFIELDS /////////////////////////
420
 
421
+ if ( ! function_exists( 'mv_dynamic_to_top_field_distance' ) ) {
 
422
 
423
  /**
424
+ * @package Dynamic To Top
425
+ * @subpackage Options
426
+ * @since 3.0
427
  *
428
  */
429
 
430
+ function mv_dynamic_to_top_field_distance() {
431
+ echo mv_dynamic_to_top_do_textfield( 'distance', 300, __( 'Distance from top to show the button. ( Pixels )', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
432
  }
433
  }
434
 
435
+ if ( ! function_exists( 'mv_dynamic_to_top_field_text' ) ) {
 
436
 
437
  /**
438
+ * @package Dynamic To Top
439
+ * @subpackage Options
440
+ * @since 3.0
441
  *
442
  */
443
 
444
+ function mv_dynamic_to_top_field_text() {
445
+ echo mv_dynamic_to_top_do_textfield( 'text', __( 'To Top', MV_DYNAMIC_TO_TOP_DOMAIN ), __( 'Text displayed on the button.', MV_DYNAMIC_TO_TOP_DOMAIN ), 'regular-text' );
 
446
  }
447
  }
448
 
449
  // CHECKBOXES /////////////////////////
450
 
451
+ if ( ! function_exists( 'mv_dynamic_to_top_field_prevent_on_mobile' ) ) {
 
452
 
453
  /**
454
+ * @package Dynamic To Top
455
+ * @subpackage Options
456
+ * @since 3.0
457
  *
458
  */
459
 
460
+ function mv_dynamic_to_top_field_prevent_on_mobile() {
461
+ echo mv_dynamic_to_top_do_checkbox( 'prevent_on_mobile', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', false, __( 'Disable the button on mobile browsers.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
462
  }
463
  }
464
 
465
+ if ( ! function_exists( 'mv_dynamic_to_top_field_text_version' ) ) {
 
466
 
467
  /**
468
+ * @package Dynamic To Top
469
+ * @subpackage Options
470
+ * @since 3.0
471
  *
472
  */
473
 
474
+ function mv_dynamic_to_top_field_text_version() {
475
+ echo mv_dynamic_to_top_do_checkbox( 'text_version', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', false, __( 'Show a text version instead of the arrow up icon.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
476
  }
477
  }
478
 
479
+ if ( ! function_exists( 'mv_dynamic_to_top_field_inset' ) ) {
 
480
 
481
  /**
482
+ * @package Dynamic To Top
483
+ * @subpackage Options
484
+ * @since 3.0
485
  *
486
  */
487
 
488
+ function mv_dynamic_to_top_field_inset() {
489
+ echo mv_dynamic_to_top_do_checkbox( 'inset', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add CSS3 inset-highlight.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
490
  }
491
  }
492
 
493
+ if ( ! function_exists( 'mv_dynamic_to_top_field_shadow' ) ) {
 
494
 
495
  /**
496
+ * @package Dynamic To Top
497
+ * @subpackage Options
498
+ * @since 3.0
499
  *
500
  */
501
 
502
+ function mv_dynamic_to_top_field_shadow() {
503
+ echo mv_dynamic_to_top_do_checkbox( 'shadow', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add CSS3 shadow.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
504
  }
505
  }
506
 
507
+ if ( ! function_exists( 'mv_dynamic_to_top_field_weight' ) ) {
 
508
 
509
  /**
510
+ * @package Dynamic To Top
511
+ * @subpackage Options
512
+ * @since 3.0
513
  *
514
  */
515
 
516
+ function mv_dynamic_to_top_field_bold() {
517
+ echo mv_dynamic_to_top_do_checkbox( 'bold', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Make the text bold.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
518
  }
519
  }
520
 
521
+ if ( ! function_exists( 'mv_dynamic_to_top_field_text_shadow' ) ) {
 
522
 
523
  /**
524
+ * @package Dynamic To Top
525
+ * @subpackage Options
526
+ * @since 3.0
527
  *
528
  */
529
 
530
+ function mv_dynamic_to_top_field_text_shadow() {
531
+ echo mv_dynamic_to_top_do_checkbox( 'text_shadow', __( 'Yes', MV_DYNAMIC_TO_TOP_DOMAIN ), 'yes', true, __( 'Add a subtle text shadow.', MV_DYNAMIC_TO_TOP_DOMAIN ) );
 
532
  }
533
  }
534
  /*
537
  |--------------------------------------------------------------------------
538
  */
539
 
540
+ if ( ! function_exists( 'mv_dynamic_to_top_do_checkbox' ) ) {
 
541
 
542
  /**
543
  * Do Checkbox
544
  *
545
  * Generates a checkbox.
546
  *
547
+ * @package Dynamic To Top
548
+ * @subpackage Options
549
+ * @since 3.0
550
  *
551
  */
552
 
553
+ function mv_dynamic_to_top_do_checkbox( $meta, $label="Yes", $value='yes', $checked=false, $desc="" )
554
  {
555
 
556
+ $options_db = get_option( 'dynamic_to_top' );
557
 
558
+ if ( isset( $options_db[$meta] ) && $options_db[$meta] == $value )
559
  $c = 'checked="checked"';
560
  else
561
  $c="";
562
 
563
 
564
+ if ( $desc != "" )
565
  $desc = '<div class="desc">'.$desc.'</div>';
566
 
567
+ $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
568
 
569
  return '<input type="checkbox" name="dynamic_to_top['.$meta.']" value="'.$value.'" '.$c.' id="checkbox-'.$sanitized_meta_title.'" /> '.$label.$desc;
570
  }
571
  }
572
 
573
+ if ( ! function_exists( 'mv_dynamic_to_top_do_textfield' ) ) {
 
574
 
575
  /**
576
  * Do Textfield
577
  *
578
  * Generates a Textfield.
579
  *
580
+ * @package Dynamic To Top
581
+ * @subpackage Options
582
+ * @since 3.0
583
  *
584
  */
585
 
586
+ function mv_dynamic_to_top_do_textfield( $meta, $value="", $desc="", $class="" )
587
  {
588
 
589
+ $options_db = get_option( 'dynamic_to_top' );
590
 
591
+ if ( isset( $options_db[$meta] ) )
592
  $value = $options_db[$meta];
593
 
594
+ if ( $desc != "" )
595
  $desc = '<div class="desc">'.$desc.'</div>';
596
 
597
+ if ( $class != "" )
598
  $class = 'class="'.$class.'"';
599
 
600
+ $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
601
 
602
  return '<input type="text" id="text-'.$sanitized_meta_title.'" name="dynamic_to_top['.$meta.']" '.$class.' value="'.$value.'" /> '.$desc;
603
  }
604
  }
605
 
606
+ if ( ! function_exists( 'mv_dynamic_to_top_do_select' ) ) {
 
607
 
608
  /**
609
  * Do Select Box
610
  *
611
  * Generate a select box.
612
  *
613
+ * @package Dynamic To Top
614
+ * @subpackage Options
615
+ * @since 3.0
616
  *
617
  */
618
 
619
+ function mv_dynamic_to_top_do_select( $meta, $options=array(), $value="", $desc="" )
620
  {
621
 
622
  $options_out = "";
623
 
624
+ $options_db = get_option( 'dynamic_to_top' );
625
 
626
+ if ( isset( $options_db[$meta] ) )
627
  $value = $options_db[$meta];
628
 
629
+ $value = sanitize_title( $value );
630
 
631
+ foreach ( $options as $option )
632
  {
633
  $selected = "";
634
 
635
+ $option_slug = sanitize_title( $option );
636
 
637
  if ( $value == $option_slug )
638
  $selected = 'selected="selected"';
639
 
640
+ $options_out .= '<option name="'.sanitize_title( $option ).'" '.$selected.' >'.$option.'</option>';
641
  }
642
 
643
+ if ( $desc != "" )
644
  $desc = '<div class="desc">'.$desc.'</div>';
645
 
646
+ $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
647
 
648
  return '<select name="dynamic_to_top['.$meta.']" id="select-'.$sanitized_meta_title.'"> '.$options_out.'</select>'.$desc;
649
  }
650
  }
651
 
652
+ if ( ! function_exists( 'mv_dynamic_to_top_do_textfield_color' ) ) {
 
653
 
654
  /**
655
  * Do Textfield Color
656
  *
657
  * Generates a Textfield with Farbtastic.
658
  *
659
+ * @package Dynamic To Top
660
+ * @subpackage Options
661
+ * @since 3.0
662
  *
663
  */
664
 
665
+ function mv_dynamic_to_top_do_textfield_color( $meta, $value="", $desc="", $class="" )
666
  {
667
 
668
+ $options_db = get_option( 'dynamic_to_top' );
669
 
670
+ if ( isset( $options_db[$meta] ) )
671
  $value = $options_db[$meta];
672
 
673
+ if ( $desc != "" )
674
  $desc = '<div class="desc">'.$desc.'</div>';
675
 
676
+ if ( $class != "" )
677
  $class .= " ";
678
 
679
  $class = 'class="'.$class.'colorvalue"';
680
 
681
+ $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
682
 
683
  $out = '<input type="text" name="dynamic_to_top['.$meta.']" id="farbtastic-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />';
684
+ $out .= '<a class="picker hide-if-no-js" href="#" data-closed="'.__( 'close', MV_DYNAMIC_TO_TOP_DOMAIN ).'" data-open="'.__( 'select a color', MV_DYNAMIC_TO_TOP_DOMAIN ).'">'.__( 'select a color', MV_DYNAMIC_TO_TOP_DOMAIN ).'</a>';
685
  $out .= '<div id="farbtastic-picker-'.$sanitized_meta_title.'" class="dtt-farbtastic"></div>';
686
  $out .= $desc;
687
 
689
  }
690
  }
691
 
692
+ if ( ! function_exists( 'mv_dynamic_to_top_do_slider' ) ) {
 
693
 
694
  /**
695
  * Do Textfield Color
696
  *
697
  * Generates a Textfield with a slider.
698
  *
699
+ * @package Dynamic To Top
700
+ * @subpackage Options
701
+ * @since 3.0
702
  *
703
  */
704
 
705
+ function mv_dynamic_to_top_do_slider( $meta, $value="", $desc="", $class="" )
706
  {
707
 
708
+ $options_db = get_option( 'dynamic_to_top' );
709
 
710
+ if ( isset( $options_db[$meta] ) )
711
  $value = $options_db[$meta];
712
 
713
+ if ( $desc != "" )
714
  $desc = '<div class="desc">'.$desc.'</div>';
715
 
716
+ if ( $class != "" )
717
  $class .= " ";
718
 
719
  $class = 'class="'.$class.'colorvalue"';
720
 
721
+ $sanitized_meta_title = str_replace( '_', '-', sanitize_title( $meta ) );
722
 
723
  return '<div id="slider-picker-'.$sanitized_meta_title.'" class="dtt-slider"></div><input type="text" name="dynamic_to_top['.$meta.']" id="slider-'.$sanitized_meta_title.'" '.$class.' value="'.$value.'" />'.$desc;
724
  }
js/{dynamic.to.top.js → dynamic.to.top.dev.js} RENAMED
@@ -2,7 +2,6 @@
2
  * Dynamic To Top Plugin
3
  * http://www.mattvarone.com
4
  *
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
  * By Matt Varone
7
  * @sksmatt
8
  *
2
  * Dynamic To Top Plugin
3
  * http://www.mattvarone.com
4
  *
 
5
  * By Matt Varone
6
  * @sksmatt
7
  *
js/dynamic.to.top.min.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /* Dynamic To Top Plugin | http://www.mattvarone.com | @sksmatt */
2
+ ;var mv_dynamic_to_top;(function($){jQuery.fn.DynamicToTop=function(options){var defaults={text:mv_dynamic_to_top.text,min:mv_dynamic_to_top.min,fade_in:600,fade_out:400,speed:mv_dynamic_to_top.speed,easing:mv_dynamic_to_top.easing,version:mv_dynamic_to_top.version,id:'dynamic-to-top'};var settings=$.extend(defaults,options);if(settings.version==""){settings.text='<span>&nbsp;</span>';}
3
+ var $toTop=$('<a href=\"#\" id=\"'+settings.id+'\"></a>').html(settings.text);$('body').append($toTop);$toTop.hide().click(function(){$('html, body').stop().animate({scrollTop:0},settings.speed,settings.easing);return false;});$(window).scroll(function(){var sd=jQuery(window).scrollTop();if(typeof document.body.style.maxHeight==="undefined"){$toTop.css({'position':'absolute','top':jQuery(window).scrollTop()+$(window).height()-mv_dynamic_to_top.margin});}
4
+ if(sd>settings.min){$toTop.fadeIn(settings.fade_in);}else{$toTop.fadeOut(settings.fade_out);}});};$('body').DynamicToTop();})(jQuery);
js/dynamic.to.top.settings.js CHANGED
@@ -2,7 +2,6 @@
2
  * Dynamic To Top Plugin Settings
3
  * http://www.mattvarone.com
4
  *
5
- * Dual licensed under the MIT or GPL Version 2 licenses.
6
  * By Matt Varone
7
  * @sksmatt
8
  *
2
  * Dynamic To Top Plugin Settings
3
  * http://www.mattvarone.com
4
  *
 
5
  * By Matt Varone
6
  * @sksmatt
7
  *
js/libs/jquery.easing.js CHANGED
@@ -1,201 +1,5 @@
1
- /*
2
- * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
- *
4
- * Uses the built in easing capabilities added In jQuery 1.1
5
- * to offer multiple easing options
6
- *
7
- * TERMS OF USE - jQuery Easing
8
- *
9
- * Open source under the BSD License.
10
- *
11
- * Copyright © 2008 George McGinley Smith
12
- * All rights reserved.
13
- *
14
- * Redistribution and use in source and binary forms, with or without modification,
15
- * are permitted provided that the following conditions are met:
16
- *
17
- * Redistributions of source code must retain the above copyright notice, this list of
18
- * conditions and the following disclaimer.
19
- * Redistributions in binary form must reproduce the above copyright notice, this list
20
- * of conditions and the following disclaimer in the documentation and/or other materials
21
- * provided with the distribution.
22
- *
23
- * Neither the name of the author nor the names of contributors may be used to endorse
24
- * or promote products derived from this software without specific prior written permission.
25
- *
26
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
27
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
- * OF THE POSSIBILITY OF SUCH DAMAGE.
35
- *
36
- */
37
-
38
- jQuery.extend( jQuery.easing,
39
- {
40
- def: 'easeOutQuad',
41
- swing: function (x, t, b, c, d) {
42
- return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
43
- },
44
- easeInQuad: function (x, t, b, c, d) {
45
- return c*(t/=d)*t + b;
46
- },
47
- easeOutQuad: function (x, t, b, c, d) {
48
- return -c *(t/=d)*(t-2) + b;
49
- },
50
- easeInOutQuad: function (x, t, b, c, d) {
51
- if ((t/=d/2) < 1) return c/2*t*t + b;
52
- return -c/2 * ((--t)*(t-2) - 1) + b;
53
- },
54
- easeInCubic: function (x, t, b, c, d) {
55
- return c*(t/=d)*t*t + b;
56
- },
57
- easeOutCubic: function (x, t, b, c, d) {
58
- return c*((t=t/d-1)*t*t + 1) + b;
59
- },
60
- easeInOutCubic: function (x, t, b, c, d) {
61
- if ((t/=d/2) < 1) return c/2*t*t*t + b;
62
- return c/2*((t-=2)*t*t + 2) + b;
63
- },
64
- easeInQuart: function (x, t, b, c, d) {
65
- return c*(t/=d)*t*t*t + b;
66
- },
67
- easeOutQuart: function (x, t, b, c, d) {
68
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
69
- },
70
- easeInOutQuart: function (x, t, b, c, d) {
71
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
72
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
73
- },
74
- easeInQuint: function (x, t, b, c, d) {
75
- return c*(t/=d)*t*t*t*t + b;
76
- },
77
- easeOutQuint: function (x, t, b, c, d) {
78
- return c*((t=t/d-1)*t*t*t*t + 1) + b;
79
- },
80
- easeInOutQuint: function (x, t, b, c, d) {
81
- if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
82
- return c/2*((t-=2)*t*t*t*t + 2) + b;
83
- },
84
- easeInSine: function (x, t, b, c, d) {
85
- return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
86
- },
87
- easeOutSine: function (x, t, b, c, d) {
88
- return c * Math.sin(t/d * (Math.PI/2)) + b;
89
- },
90
- easeInOutSine: function (x, t, b, c, d) {
91
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
92
- },
93
- easeInExpo: function (x, t, b, c, d) {
94
- return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
95
- },
96
- easeOutExpo: function (x, t, b, c, d) {
97
- return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
98
- },
99
- easeInOutExpo: function (x, t, b, c, d) {
100
- if (t==0) return b;
101
- if (t==d) return b+c;
102
- if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
103
- return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
104
- },
105
- easeInCirc: function (x, t, b, c, d) {
106
- return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
107
- },
108
- easeOutCirc: function (x, t, b, c, d) {
109
- return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
110
- },
111
- easeInOutCirc: function (x, t, b, c, d) {
112
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
113
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
114
- },
115
- easeInElastic: function (x, t, b, c, d) {
116
- var s=1.70158;var p=0;var a=c;
117
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
118
- if (a < Math.abs(c)) { a=c; var s=p/4; }
119
- else var s = p/(2*Math.PI) * Math.asin (c/a);
120
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
121
- },
122
- easeOutElastic: function (x, t, b, c, d) {
123
- var s=1.70158;var p=0;var a=c;
124
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
125
- if (a < Math.abs(c)) { a=c; var s=p/4; }
126
- else var s = p/(2*Math.PI) * Math.asin (c/a);
127
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
128
- },
129
- easeInOutElastic: function (x, t, b, c, d) {
130
- var s=1.70158;var p=0;var a=c;
131
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
132
- if (a < Math.abs(c)) { a=c; var s=p/4; }
133
- else var s = p/(2*Math.PI) * Math.asin (c/a);
134
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
135
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
136
- },
137
- easeInBack: function (x, t, b, c, d, s) {
138
- if (s == undefined) s = 1.70158;
139
- return c*(t/=d)*t*((s+1)*t - s) + b;
140
- },
141
- easeOutBack: function (x, t, b, c, d, s) {
142
- if (s == undefined) s = 1.70158;
143
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
144
- },
145
- easeInOutBack: function (x, t, b, c, d, s) {
146
- if (s == undefined) s = 1.70158;
147
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
148
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
149
- },
150
- easeInBounce: function (x, t, b, c, d) {
151
- return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
152
- },
153
- easeOutBounce: function (x, t, b, c, d) {
154
- if ((t/=d) < (1/2.75)) {
155
- return c*(7.5625*t*t) + b;
156
- } else if (t < (2/2.75)) {
157
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
158
- } else if (t < (2.5/2.75)) {
159
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
160
- } else {
161
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
162
- }
163
- },
164
- easeInOutBounce: function (x, t, b, c, d) {
165
- if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
166
- return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
167
- }
168
- });
169
-
170
- /*
171
- *
172
- * TERMS OF USE - EASING EQUATIONS
173
- *
174
- * Open source under the BSD License.
175
- *
176
- * Copyright © 2001 Robert Penner
177
- * All rights reserved.
178
- *
179
- * Redistribution and use in source and binary forms, with or without modification,
180
- * are permitted provided that the following conditions are met:
181
- *
182
- * Redistributions of source code must retain the above copyright notice, this list of
183
- * conditions and the following disclaimer.
184
- * Redistributions in binary form must reproduce the above copyright notice, this list
185
- * of conditions and the following disclaimer in the documentation and/or other materials
186
- * provided with the distribution.
187
- *
188
- * Neither the name of the author nor the names of contributors may be used to endorse
189
- * or promote products derived from this software without specific prior written permission.
190
- *
191
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
192
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
193
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
194
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
195
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
196
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
197
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
198
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
199
- * OF THE POSSIBILITY OF SUCH DAMAGE.
200
- *
201
- */
1
+ /* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ | BSD License | Copyright © 2008 George McGinley Smith */
2
+ jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
3
+ else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
4
+ else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;}
5
+ else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lan/dynamic-to-top-fr_FR.mo ADDED
Binary file
lan/dynamic-to-top-fr_FR.po ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Dynamic To Top\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2011-07-31 17:40-0300\n"
6
+ "PO-Revision-Date: 2011-09-01 11:27+0100\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Matt Varone\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;__e;_e\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "X-Poedit-Language: Spanish\n"
15
+ "X-Poedit-Country: ARGENTINA\n"
16
+ "X-Poedit-SearchPath-0: .\n"
17
+
18
+ #: inc/dynamic-to-top-options.php:50
19
+ msgid "Behavior"
20
+ msgstr "Comportement"
21
+
22
+ #: inc/dynamic-to-top-options.php:51
23
+ msgid "Appearance"
24
+ msgstr "Apparence"
25
+
26
+ #: inc/dynamic-to-top-options.php:53
27
+ msgid "Scroll time"
28
+ msgstr "Durée du défilement"
29
+
30
+ #: inc/dynamic-to-top-options.php:54
31
+ msgid "Fade-in distance"
32
+ msgstr "Distance du fade-in"
33
+
34
+ #: inc/dynamic-to-top-options.php:55
35
+ msgid "Easing"
36
+ msgstr "Easing"
37
+
38
+ #: inc/dynamic-to-top-options.php:56
39
+ msgid "Position"
40
+ msgstr "Position"
41
+
42
+ #: inc/dynamic-to-top-options.php:57
43
+ msgid "Prevent on mobile"
44
+ msgstr "Ne pas appliquer pour les mobiles"
45
+
46
+ #: inc/dynamic-to-top-options.php:59
47
+ msgid "Text version"
48
+ msgstr "Version texte"
49
+
50
+ #: inc/dynamic-to-top-options.php:60
51
+ msgid "Button text"
52
+ msgstr "Texte du bouton"
53
+
54
+ #: inc/dynamic-to-top-options.php:61
55
+ msgid "Top/bottom padding"
56
+ msgstr "Padding haut/bas"
57
+
58
+ #: inc/dynamic-to-top-options.php:62
59
+ msgid "Sides padding"
60
+ msgstr "Padding latéraux"
61
+
62
+ #: inc/dynamic-to-top-options.php:63
63
+ msgid "Font size"
64
+ msgstr "Taille de la police"
65
+
66
+ #: inc/dynamic-to-top-options.php:64
67
+ msgid "Text color"
68
+ msgstr "Couleur du texte"
69
+
70
+ #: inc/dynamic-to-top-options.php:65
71
+ msgid "Bold Text"
72
+ msgstr "Texte en gras"
73
+
74
+ #: inc/dynamic-to-top-options.php:66
75
+ msgid "Text shadow"
76
+ msgstr "Ombre du texte"
77
+
78
+ #: inc/dynamic-to-top-options.php:67
79
+ msgid "Text shadow color"
80
+ msgstr "Couleur de l'ombre de texte"
81
+
82
+ #: inc/dynamic-to-top-options.php:68
83
+ msgid "Background color"
84
+ msgstr "Couleur de fond"
85
+
86
+ #: inc/dynamic-to-top-options.php:69
87
+ msgid "Border color"
88
+ msgstr "Couleur de la bordure"
89
+
90
+ #: inc/dynamic-to-top-options.php:70
91
+ msgid "Border width"
92
+ msgstr "Epaisseur de la bordure"
93
+
94
+ #: inc/dynamic-to-top-options.php:71
95
+ msgid "Border radius"
96
+ msgstr "Rayon de la bordure"
97
+
98
+ #: inc/dynamic-to-top-options.php:72
99
+ msgid "Inset highlighting"
100
+ msgstr "Eclairage en médaillon"
101
+
102
+ #: inc/dynamic-to-top-options.php:73
103
+ msgid "Shadow"
104
+ msgstr "Ombre"
105
+
106
+ #: inc/dynamic-to-top-options.php:103
107
+ msgid "Dynamic To Top Options"
108
+ msgstr "Paramétrage de Dynamic To Top"
109
+
110
+ #: inc/dynamic-to-top-options.php:105
111
+ msgid "Welcome to the <strong>Dynamic To Top</strong> plugin settings. Click <a href=\"http://www.mattvarone.com/featured-content/dynamic-to-top/\" target=\"_blank\">here</a> to learn more about this plugin."
112
+ msgstr "Bienvenue sur les paramètres de réglage de l'extension <strong>Dynamic To Top</strong>. Cliquez <a href=\"http://www.mattvarone.com/featured-content/dynamic-to-top/\" target=\"_blank\">ici</a> pour plus d'informations sur cette extension."
113
+
114
+ #: inc/dynamic-to-top-options.php:113
115
+ msgid "Save Changes"
116
+ msgstr "Enregistrer les modifications"
117
+
118
+ #: inc/dynamic-to-top-options.php:116
119
+ msgid "<strong>Dynamic To Top</strong> plugin brought to you by"
120
+ msgstr "Extension <strong>Dynamic To Top</strong> développée par"
121
+
122
+ #: inc/dynamic-to-top-options.php:130
123
+ msgid "Preview over"
124
+ msgstr "Prévisualisation"
125
+
126
+ #: inc/dynamic-to-top-options.php:130
127
+ msgid "black"
128
+ msgstr "noir"
129
+
130
+ #: inc/dynamic-to-top-options.php:130
131
+ msgid "grey"
132
+ msgstr "gris"
133
+
134
+ #: inc/dynamic-to-top-options.php:130
135
+ msgid "white"
136
+ msgstr "blanc"
137
+
138
+ #: inc/dynamic-to-top-options.php:258
139
+ msgid "Color for the button border."
140
+ msgstr "Couleur de la bordure du bouton."
141
+
142
+ #: inc/dynamic-to-top-options.php:274
143
+ msgid "Background color for the button."
144
+ msgstr "Couleur de fond du bouton."
145
+
146
+ #: inc/dynamic-to-top-options.php:290
147
+ msgid "Button text color."
148
+ msgstr "Couleur du texte."
149
+
150
+ #: inc/dynamic-to-top-options.php:306
151
+ #: inc/dynamic-to-top-options.php:322
152
+ msgid "Text shadow color."
153
+ msgstr "Couleur de l'ombre portée."
154
+
155
+ #: inc/dynamic-to-top-options.php:342
156
+ msgid "<a href=\"http://gsgd.co.uk/sandbox/jquery/easing\" title=\"Easing type\">Easing type</a> used to scroll the page up."
157
+ msgstr "Type d'<a href=\"http://gsgd.co.uk/sandbox/jquery/easing\" title=\"Easing type\">Easing</a> à utiliser pour le défilement vertical."
158
+
159
+ #: inc/dynamic-to-top-options.php:360
160
+ msgid "Button position."
161
+ msgstr "Position du bouton."
162
+
163
+ #: inc/dynamic-to-top-options.php:378
164
+ msgid "Time it takes for the page to scroll up. Less for faster. ( <span id=\"speed-val\"></span> Milliseconds )"
165
+ msgstr "Durée du défilement vertical. Diminuez la valeur pour augmenter la vitesse. ( <span id=\"speed-val\"></span> Millisecondes )"
166
+
167
+ #: inc/dynamic-to-top-options.php:394
168
+ msgid "Button text size. ( <span id=\"font-size-val\"></span> Em/s )"
169
+ msgstr "Taille de la police du bouton. ( <span id=\"font-size-val\"></span> Em/s )"
170
+
171
+ #: inc/dynamic-to-top-options.php:410
172
+ msgid "Spacing on Top and Bottom. ( <span id=\"padding-top-bottom-val\"></span>px )"
173
+ msgstr "Espacement Haut et Bas. ( <span id=\"padding-top-bottom-val\"></span>px )"
174
+
175
+ #: inc/dynamic-to-top-options.php:426
176
+ msgid "Spacing on Left and Right. ( <span id=\"padding-left-right-val\"></span>px )"
177
+ msgstr "Espacement Gauche et Droit. ( <span id=\"padding-left-right-val\"></span>px )"
178
+
179
+ #: inc/dynamic-to-top-options.php:442
180
+ msgid "Button border width"
181
+ msgstr "Epaisseur de bordure du bouton"
182
+
183
+ #: inc/dynamic-to-top-options.php:458
184
+ msgid "Button border radius"
185
+ msgstr "Rayon de bordure du bouton"
186
+
187
+ #: inc/dynamic-to-top-options.php:476
188
+ msgid "Distance from top to show the button. ( Pixels )"
189
+ msgstr "Distance du bouton depuis le haut. (Pixels)"
190
+
191
+ #: inc/dynamic-to-top-options.php:492
192
+ msgid "To Top"
193
+ msgstr "Haut de page"
194
+
195
+ #: inc/dynamic-to-top-options.php:492
196
+ msgid "Text displayed on the button."
197
+ msgstr "Texte du bouton."
198
+
199
+ #: inc/dynamic-to-top-options.php:510
200
+ #: inc/dynamic-to-top-options.php:526
201
+ #: inc/dynamic-to-top-options.php:542
202
+ #: inc/dynamic-to-top-options.php:558
203
+ #: inc/dynamic-to-top-options.php:574
204
+ #: inc/dynamic-to-top-options.php:590
205
+ msgid "Yes"
206
+ msgstr "Oui"
207
+
208
+ #: inc/dynamic-to-top-options.php:510
209
+ msgid "Disable the button on mobile browsers."
210
+ msgstr "Désactiver le bouton pour les mobiles."
211
+
212
+ #: inc/dynamic-to-top-options.php:526
213
+ msgid "Show a text version instead of the arrow up icon."
214
+ msgstr "Afficher une version texte plutôt que la flèche."
215
+
216
+ #: inc/dynamic-to-top-options.php:542
217
+ msgid "Add CSS3 inset-highlight."
218
+ msgstr "Utiliser un inset-highlight CSS3."
219
+
220
+ #: inc/dynamic-to-top-options.php:558
221
+ msgid "Add CSS3 shadow."
222
+ msgstr "Utiliser une ombre portée CSS3."
223
+
224
+ #: inc/dynamic-to-top-options.php:574
225
+ msgid "Make the text bold."
226
+ msgstr "Passer le texte en gras."
227
+
228
+ #: inc/dynamic-to-top-options.php:590
229
+ msgid "Add a subtle text shadow."
230
+ msgstr "Ajouter une ombre subtile au texte."
231
+
232
+ #: inc/dynamic-to-top-options.php:747
233
+ msgid "close"
234
+ msgstr "fermer"
235
+
236
+ #: inc/dynamic-to-top-options.php:747
237
+ msgid "select a color"
238
+ msgstr "choisir une couleur"
239
+
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Dynamic "To Top" Plugin ===
2
  Contributors: sksmatt
3
  Donate link: http://www.mattvarone.com/donate/
4
- Tags: Dynamic, UI, Scroll, To top, Automatic, Enhance, UX
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
- Stable tag: 3.1.6
8
 
9
  Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
10
 
@@ -21,7 +21,7 @@ It features an intuitive control panel to style and adjust to each website's nee
21
  * Caches and minify CSS for better performance.
22
  * Ready for internationalization.
23
  * Uninstall included.
24
- * Ships with Spanish, Bulgarian and Arabic translations.
25
 
26
  == Installation ==
27
 
@@ -40,6 +40,11 @@ It features an intuitive control panel to style and adjust to each website's nee
40
 
41
  == Change log ==
42
 
 
 
 
 
 
43
  = 3.1.6 =
44
  * Added 3 new languages (Spanish, Bulgarian and Arabic).
45
  * Prefixed functions as better practice.
1
  === Dynamic "To Top" Plugin ===
2
  Contributors: sksmatt
3
  Donate link: http://www.mattvarone.com/donate/
4
+ Tags: Dynamic, UI, Scroll, To top, Automatic, Enhance, UX, Button, jQuery
5
  Requires at least: 3.0
6
  Tested up to: 3.2.1
7
+ Stable tag: 3.1.7
8
 
9
  Adds an automatic and dynamic "To Top" button to easily scroll long pages back to the top.
10
 
21
  * Caches and minify CSS for better performance.
22
  * Ready for internationalization.
23
  * Uninstall included.
24
+ * Ships with Spanish, French, Arabic and Bulgarian translations.
25
 
26
  == Installation ==
27
 
40
 
41
  == Change log ==
42
 
43
+ = 3.1.7 =
44
+ * Introduced the filter 'mv_dynamic_to_top_css' to allow themes and plugins to add / alter the generated CSS.
45
+ * Minified the JavaScript included.
46
+ * Code improvements.
47
+
48
  = 3.1.6 =
49
  * Added 3 new languages (Spanish, Bulgarian and Arabic).
50
  * Prefixed functions as better practice.
uninstall.php CHANGED
@@ -2,12 +2,12 @@
2
  /**
3
  * Dynamic To Top Uninstall
4
  *
5
- * @package Dynamic To Top
6
- * @author Matt Varone
7
  */
8
 
9
  // If uninstall not called from WordPress exit
10
- if(!defined('WP_UNINSTALL_PLUGIN'))
11
  exit();
12
  // Delete option from options table
13
- delete_option('dynamic_to_top');
2
  /**
3
  * Dynamic To Top Uninstall
4
  *
5
+ * @package Dynamic To Top
6
+ * @author Matt Varone
7
  */
8
 
9
  // If uninstall not called from WordPress exit
10
+ if( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
11
  exit();
12
  // Delete option from options table
13
+ delete_option( 'dynamic_to_top' );