Changeset 2309158
- Timestamp:
- 05/20/2020 10:31:53 PM (6 years ago)
- Location:
- scrolltotop/trunk
- Files:
-
- 7 edited
-
includes/scrolltotop-admin-sidebar.php (modified) (1 diff)
-
includes/scrolltotop-admin.php (modified) (10 diffs)
-
includes/scrolltotop-functions.php (modified) (1 diff)
-
index.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
scrolltotop.php (modified) (16 diffs)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
scrolltotop/trunk/includes/scrolltotop-admin-sidebar.php
r2188887 r2309158 11 11 12 12 <aside class="plugin-sidebar"> 13 <div class="sidebar-inner">13 <div class="sidebar-inner"> 14 14 <?php 15 $sarvarov_plugins = array( 16 array( 'name' => 'scrollToTop', 'slug' => 'scrolltotop', 'url' => 'scrolltotop', 'description' => esc_html__( 'Displays cool back to top button or bar', 'scrolltotop' ) ), 17 array( 'name' => 'Lazy Load', 'slug' => 'sarvarov_lazy_load', 'url' => 'sarvarov-lazy-load', 'description' => esc_html__( 'Make all your images and iframes lazy', 'scrolltotop' ) ) 18 ); 15 $sarvarov_plugins = array( 16 array( 'name' => 'scrollToTop', 17 'slug' => 'scrolltotop', 18 'url' => 'scrolltotop', 19 'description' => esc_html__( 'Displays cool back to top button or bar', 'scrolltotop' ) 20 ), 21 array( 'name' => 'Lazy Load', 22 'slug' => 'sarvarov_lazy_load', 23 'url' => 'sarvarov-lazy-load', 24 'description' => esc_html__( 'Make all your images and iframes lazy', 'scrolltotop' ) 25 ) 26 ); 19 27 ?> 20 <div class="paypal-donate">21 <divclass="widget-header">28 <div class="paypal-donate"> 29 <div class="widget-header"> 22 30 <?php _e( 'Like the plugin? Support the developer.', 'scrolltotop' ); ?> 23 </div> 24 25 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> 26 <input type="hidden" name="cmd" value="_s-xclick" /> 27 <input type="hidden" name="hosted_button_id" value="LNVRV7LL39E2E" /> 28 <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" /> 29 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" /> 30 </form> 31 32 <div style="margin-top: 20px; opacity: .5;"> 31 </div> 32 33 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"> 34 <input type="hidden" name="cmd" value="_s-xclick"/> 35 <input type="hidden" name="hosted_button_id" value="LNVRV7LL39E2E"/> 36 <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" 37 name="submit" title="PayPal - The safer, easier way to pay online!" 38 alt="Donate with PayPal button"/> 39 <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"/> 40 </form> 41 42 <div style="margin-top: 20px; opacity: .5;"> 33 43 <?php _e( 'Even 1 dollar will make me happy :)', 'scrolltotop' ); ?> 34 </div>35 44 </div> 45 36 46 <?php 37 foreach( $sarvarov_plugins as $key => $value ) { 38 39 if( $value['slug'] != 'scrolltotop' ) 40 continue; 41 42 printf( '<a class="button button-primary" href="https://wordpress.org/plugins/%1$s/" target="_blank">⭐ %2$s</a>', $value['url'], esc_html__( 'Rate the plugin or ask a question', 'scrolltotop' ) ); 43 47 foreach ( $sarvarov_plugins as $key => $value ) { 48 49 if ( $value['slug'] != 'scrolltotop' ) { 50 continue; 44 51 } 52 53 printf( '<a class="button button-primary" href="https://wordpress.org/plugins/%1$s/" target="_blank">⭐ %2$s</a>', $value['url'], esc_html__( 'Rate the plugin or ask a question', 'scrolltotop' ) ); 54 55 } 45 56 ?> 46 </div>47 48 <div class="more-plugins">49 <divclass="widget-header">57 </div> 58 59 <div class="more-plugins"> 60 <div class="widget-header"> 50 61 <?php _e( 'Check out other plugins:', 'scrolltotop' ); ?> 51 </div>52 62 </div> 63 53 64 <?php 54 foreach( $sarvarov_plugins as $key => $value ) { 55 56 if( $value['slug'] == 'scrolltotop' ) 57 continue; 58 59 printf( '<a href="https://wordpress.org/plugins/%1$s/" target="_blank">%2$s<span>%3$s</span></a>', $value['url'], $value['name'], $value['description'] ); 60 65 foreach ( $sarvarov_plugins as $key => $value ) { 66 67 if ( $value['slug'] == 'scrolltotop' ) { 68 continue; 61 69 } 70 71 printf( '<a href="https://wordpress.org/plugins/%1$s/" target="_blank">%2$s<span>%3$s</span></a>', $value['url'], $value['name'], $value['description'] ); 72 73 } 62 74 ?> 63 </div> 64 65 <div class="twitter-widget"> 66 <a class="twitter-timeline" data-height="400" data-theme="light" href="https://twitter.com/sarvarovdev?ref_src=twsrc%5Etfw">Tweets by sarvarovdev</a> 67 <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 68 </div> 69 </div> 75 </div> 76 77 <div class="twitter-widget"> 78 <a class="twitter-timeline" data-height="400" data-theme="light" 79 href="https://twitter.com/sarvarovdev?ref_src=twsrc%5Etfw">Tweets by sarvarovdev</a> 80 <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script> 81 </div> 82 </div> 70 83 </aside> -
scrolltotop/trunk/includes/scrolltotop-admin.php
r2188887 r2309158 4 4 function scrolltotop_admin_menu() { 5 5 $settings = add_options_page( esc_html__( 'scrollToTop Settings', 'scrolltotop' ), 'scrollToTop', 'manage_options', 'scrolltotop_settings_page', 'scrolltotop_settings' ); 6 if ( ! $settings ) {6 if ( ! $settings ) { 7 7 return; 8 8 } … … 19 19 wp_enqueue_script( 'wp-color-picker-alpha', $global_scrolltotop_dir_url . 'assets/js/wp-color-picker-alpha.min.js', array( 20 20 'wp-color-picker' 21 ) , '1.0.0', true );21 ), '1.0.0', true ); 22 22 } 23 23 … … 28 28 } 29 29 30 function scrolltotop_settings() { 30 function scrolltotop_settings() { 31 31 global $global_scrolltotop_version; 32 ?> 33 <div class="wrap sarvarov-wrap"> 34 35 <h2 class="scrolltotop-title"><?php esc_html_e( 'scrollToTop Settings', 'scrolltotop' ); ?> <span class="scrolltotop-version">v<?php echo $global_scrolltotop_version; ?></span></h2> 36 37 <section class="plugin-settings" role="main"> 38 39 <form method="post" action="options.php"> 32 ?> 33 <div class="wrap sarvarov-wrap"> 34 35 <h2 class="scrolltotop-title"><?php esc_html_e( 'scrollToTop Settings', 'scrolltotop' ); ?> <span 36 class="scrolltotop-version">v<?php echo $global_scrolltotop_version; ?></span></h2> 37 38 <section class="plugin-settings" role="main"> 39 40 <form method="post" action="options.php"> 40 41 <?php settings_fields( 'scrolltotop_settings' ); ?> 41 42 <?php do_settings_sections( 'scrolltotop' ); ?> 42 43 <?php submit_button(); ?> 43 </form>44 44 </form> 45 45 46 <?php require_once plugin_dir_path( __FILE__ ) . 'scrolltotop-admin-sidebar.php'; ?> 46 47 <div id="loader" class="loader loader-inprogress"> 48 <div class="loader-activity"></div> 49 <noscript> 50 <style>#loader { display: none !important; }</style> 51 </noscript> 52 </div> 53 54 </section> 55 56 </div> 57 47 48 <div id="loader" class="loader loader-inprogress"> 49 <div class="loader-activity"></div> 50 <noscript> 51 <style>#loader { 52 display: none !important; 53 }</style> 54 </noscript> 55 </div> 56 57 </section> 58 59 </div> 60 58 61 <?php 59 62 } … … 66 69 add_settings_field( 'stt_mode', esc_html__( 'Mode', 'scrolltotop' ), 'stt_mode_field', 'scrolltotop', 'stt_general' ); 67 70 add_settings_field( 'stt_scroll_offset', esc_html__( 'Scroll offset', 'scrolltotop' ), 'stt_scroll_offset_field', 'scrolltotop', 'stt_general' ); 68 71 69 72 // bar settings 70 73 add_settings_section( 'stt_bar_settings', esc_html__( 'Bar Settings', 'scrolltotop' ), '__return_false', 'scrolltotop' ); … … 91 94 add_settings_field( 'stt_bar_make_smaller', esc_html__( 'Make smaller', 'scrolltotop' ), 'stt_bar_make_smaller_field', 'scrolltotop', 'stt_bar_settings' ); 92 95 add_settings_field( 'stt_bar_hide', esc_html__( 'Hide on small devices', 'scrolltotop' ), 'stt_bar_hide_field', 'scrolltotop', 'stt_bar_settings' ); 93 96 94 97 // transformed button 95 98 add_settings_field( 'stt_bar_transformed_size', esc_html__( 'Transformed bar size', 'scrolltotop' ), 'stt_bar_transformed_size_field', 'scrolltotop', 'stt_bar_settings', array( 'class' => 'stt-transformed' ) ); … … 99 102 add_settings_field( 'stt_bar_transformed_vertical_offset', esc_html__( 'Transformed bar vertical offset', 'scrolltotop' ), 'stt_bar_transformed_vertical_offset_field', 'scrolltotop', 'stt_bar_settings', array( 'class' => 'stt-transformed' ) ); 100 103 add_settings_field( 'stt_bar_transformed_border_radius', esc_html__( 'Transformed bar border radius', 'scrolltotop' ), 'stt_bar_transformed_border_radius_field', 'scrolltotop', 'stt_bar_settings', array( 'class' => 'stt-transformed' ) ); 101 104 102 105 // button settings 103 106 add_settings_section( 'stt_button_settings', esc_html__( 'Button Settings', 'scrolltotop' ), '__return_false', 'scrolltotop' ); … … 116 119 add_settings_field( 'stt_button_make_smaller', esc_html__( 'Make smaller', 'scrolltotop' ), 'stt_button_make_smaller_field', 'scrolltotop', 'stt_button_settings' ); 117 120 add_settings_field( 'stt_button_hide', esc_html__( 'Hide on small devices', 'scrolltotop' ), 'stt_button_hide_field', 'scrolltotop', 'stt_button_settings' ); 118 121 119 122 // advanced settings 120 123 add_settings_section( 'stt_advanced', esc_html__( 'Advanced Settings', 'scrolltotop' ), '__return_false', 'scrolltotop' ); … … 129 132 function stt_bar_position_field() { 130 133 $settings = scrolltotop_get_plugin_settings( 'stt_bar_position' ); 131 ?> 132 <fieldset> 133 <p> 134 <label> 135 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_position]" value="0" <?php checked( 0, $settings ); ?> /> 134 ?> 135 <fieldset> 136 <p> 137 <label> 138 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_position]" 139 value="0" <?php checked( 0, $settings ); ?> /> 136 140 <?php esc_html_e( 'Left', 'scrolltotop' ); ?> 137 </label> 138 <br /> 139 <label> 140 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_position]" value="1" <?php checked( 1, $settings ); ?> /> 141 </label> 142 <br/> 143 <label> 144 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_position]" 145 value="1" <?php checked( 1, $settings ); ?> /> 141 146 <?php esc_html_e( 'Right', 'scrolltotop' ); ?> 142 </label>143 </p>144 </fieldset>145 146 <?php147 </label> 148 </p> 149 </fieldset> 150 151 <?php 147 152 } 148 153 149 154 function stt_bar_element_position_field() { 150 155 $settings = scrolltotop_get_plugin_settings( 'stt_bar_element_position' ); 151 ?> 152 <fieldset> 153 <p> 154 <label> 155 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_element_position]" value="0" <?php checked( 0, $settings ); ?> /> 156 ?> 157 <fieldset> 158 <p> 159 <label> 160 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_element_position]" 161 value="0" <?php checked( 0, $settings ); ?> /> 156 162 <?php esc_html_e( 'Top', 'scrolltotop' ); ?> 157 </label> 158 <br /> 159 <label> 160 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_element_position]" value="1" <?php checked( 1, $settings ); ?> /> 163 </label> 164 <br/> 165 <label> 166 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_element_position]" 167 value="1" <?php checked( 1, $settings ); ?> /> 161 168 <?php esc_html_e( 'Bottom', 'scrolltotop' ); ?> 162 </label>163 </p>164 </fieldset>165 166 <?php169 </label> 170 </p> 171 </fieldset> 172 173 <?php 167 174 } 168 175 169 176 function stt_bar_top_offset_field() { 170 177 $settings = scrolltotop_get_plugin_settings( 'stt_bar_top_offset' ); 171 ?> 172 <input name="scrolltotop_plugin_settings[stt_bar_top_offset]" type="number" min="0" id="stt_bar_top_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 173 <?php 178 ?> 179 <input name="scrolltotop_plugin_settings[stt_bar_top_offset]" type="number" min="0" id="stt_bar_top_offset" 180 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 181 <?php 174 182 } 175 183 176 184 function stt_bar_horizontal_offset_field() { 177 185 $settings = scrolltotop_get_plugin_settings( 'stt_bar_horizontal_offset' ); 178 ?> 179 180 <input name="scrolltotop_plugin_settings[stt_bar_horizontal_offset]" type="number" min="0" id="stt_bar_horizontal_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 181 182 <?php 186 ?> 187 188 <input name="scrolltotop_plugin_settings[stt_bar_horizontal_offset]" type="number" min="0" 189 id="stt_bar_horizontal_offset" value="<?php echo (int) $settings; ?>" 190 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 191 192 <?php 183 193 } 184 194 185 195 function stt_mode_field() { 186 196 $settings = scrolltotop_get_plugin_settings( 'stt_mode' ); 187 ?> 188 <fieldset> 189 <p> 190 <label> 191 <input type="radio" name="scrolltotop_plugin_settings[stt_mode]" value="0" <?php checked( 0, $settings ); ?> /> 197 ?> 198 <fieldset> 199 <p> 200 <label> 201 <input type="radio" name="scrolltotop_plugin_settings[stt_mode]" 202 value="0" <?php checked( 0, $settings ); ?> /> 192 203 <?php esc_html_e( 'Bar', 'scrolltotop' ); ?> 193 </label> 194 <br /> 195 <label> 196 <input type="radio" name="scrolltotop_plugin_settings[stt_mode]" value="1" <?php checked( 1, $settings ); ?> /> 204 </label> 205 <br/> 206 <label> 207 <input type="radio" name="scrolltotop_plugin_settings[stt_mode]" 208 value="1" <?php checked( 1, $settings ); ?> /> 197 209 <?php esc_html_e( 'Button', 'scrolltotop' ); ?> 198 </label>199 </p>200 </fieldset>201 <?php210 </label> 211 </p> 212 </fieldset> 213 <?php 202 214 } 203 215 204 216 function stt_advanced_background_width_field() { 205 217 $settings = scrolltotop_get_plugin_settings( 'stt_advanced_background_width' ); 206 ?> 207 <label> 208 <?php esc_html_e( "Width:", 'scrolltotop' ); ?> <input name="scrolltotop_plugin_settings[stt_advanced_background_width]" type="number" min="0" id="stt_advanced_background_width" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 209 </label> 210 211 <p class="description"><?php esc_html_e( "0 – disable advanced background", 'scrolltotop' ); ?></p> 212 218 ?> 219 <label> 220 <?php esc_html_e( "Width:", 'scrolltotop' ); ?> <input 221 name="scrolltotop_plugin_settings[stt_advanced_background_width]" type="number" min="0" 222 id="stt_advanced_background_width" value="<?php echo (int) $settings; ?>" 223 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 224 </label> 225 226 <p class="description"><?php esc_html_e( "0 – disable advanced background", 'scrolltotop' ); ?></p> 227 213 228 <?php $settings = scrolltotop_get_plugin_settings( 'stt_advanced_background_sticky' ); ?> 214 229 215 <label class="stt_margin_top_15px"> 216 <input name="scrolltotop_plugin_settings[stt_advanced_background_sticky]" type="checkbox" id="stt_advanced_background_sticky" value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Enable sticky width', 'scrolltotop' ); ?> 217 </label> 218 230 <label class="stt_margin_top_15px"> 231 <input name="scrolltotop_plugin_settings[stt_advanced_background_sticky]" type="checkbox" 232 id="stt_advanced_background_sticky" 233 value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Enable sticky width', 'scrolltotop' ); ?> 234 </label> 235 219 236 <?php $settings = scrolltotop_get_plugin_settings( 'stt_advanced_background_hide' ); ?> 220 237 221 <label class="stt_margin_top_15px"><?php esc_html_e( "Hide advanced background if user's screen is less than", 'scrolltotop' ); ?> 222 <input name="scrolltotop_plugin_settings[stt_advanced_background_hide]" type="number" min="0" id="stt_advanced_background_hide" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 223 </label> 224 225 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 238 <label class="stt_margin_top_15px"><?php esc_html_e( "Hide advanced background if user's screen is less than", 'scrolltotop' ); ?> 239 <input name="scrolltotop_plugin_settings[stt_advanced_background_hide]" type="number" min="0" 240 id="stt_advanced_background_hide" value="<?php echo (int) $settings; ?>" 241 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 242 </label> 243 244 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 226 245 <?php 227 246 } … … 229 248 function stt_scroll_offset_field() { 230 249 $settings = scrolltotop_get_plugin_settings( 'stt_scroll_offset' ); 231 ?> 232 <label><?php esc_html_e( 'Show scrollToTop after scrolling', 'scrolltotop' ); ?> 233 <input name="scrolltotop_plugin_settings[stt_scroll_offset]" type="number" min="0" id="stt_scroll_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 234 </label> 235 <p class="description"><?php esc_html_e( '0 – is always visible', 'scrolltotop' ); ?></p> 236 <?php 250 ?> 251 <label><?php esc_html_e( 'Show scrollToTop after scrolling', 'scrolltotop' ); ?> 252 <input name="scrolltotop_plugin_settings[stt_scroll_offset]" type="number" min="0" id="stt_scroll_offset" 253 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 254 </label> 255 <p class="description"><?php esc_html_e( '0 – is always visible', 'scrolltotop' ); ?></p> 256 <?php 237 257 } 238 258 239 259 function stt_bar_text_field() { 240 260 $settings = scrolltotop_get_plugin_settings( 'stt_bar_text' ); 241 ?> 242 <input name="scrolltotop_plugin_settings[stt_bar_text]" type="text" placeholder="Scroll to Top" id="stt_bar_text" value="<?php echo $settings; ?>" /> 243 <?php 261 ?> 262 <input name="scrolltotop_plugin_settings[stt_bar_text]" type="text" placeholder="Scroll to Top" id="stt_bar_text" 263 value="<?php echo $settings; ?>"/> 264 <?php 244 265 } 245 266 246 267 function stt_bar_text_distance_field() { 247 268 $settings = scrolltotop_get_plugin_settings( 'stt_bar_text_distance' ); 248 ?> 249 <input name="scrolltotop_plugin_settings[stt_bar_text_distance]" type="number" min="0" id="stt_bar_text_distance" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 250 <?php 269 ?> 270 <input name="scrolltotop_plugin_settings[stt_bar_text_distance]" type="number" min="0" id="stt_bar_text_distance" 271 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 272 <?php 251 273 } 252 274 253 275 function stt_bar_fade_duration_field() { 254 276 $settings = scrolltotop_get_plugin_settings( 'stt_bar_fade_duration' ); 255 ?> 256 <input name="scrolltotop_plugin_settings[stt_bar_fade_duration]" type="number" min="0" step="100" max="1000" id="stt_bar_fade_duration" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 257 <p class="description"><?php esc_html_e( '0 – disable fade effect', 'scrolltotop' ); ?></p> 258 277 ?> 278 <input name="scrolltotop_plugin_settings[stt_bar_fade_duration]" type="number" min="0" step="100" max="1000" 279 id="stt_bar_fade_duration" value="<?php echo (int) $settings; ?>" 280 class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 281 <p class="description"><?php esc_html_e( '0 – disable fade effect', 'scrolltotop' ); ?></p> 282 259 283 <?php $settings = scrolltotop_get_plugin_settings( 'stt_bar_animation_on_load' ); ?> 260 261 <label class="stt_margin_top_15px"> 262 <input name="scrolltotop_plugin_settings[stt_bar_animation_on_load]" type="checkbox" id="stt_bar_animation_on_load" value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Disable fade effect on page load', 'scrolltotop' ); ?> 263 </label> 264 <?php 284 285 <label class="stt_margin_top_15px"> 286 <input name="scrolltotop_plugin_settings[stt_bar_animation_on_load]" type="checkbox" 287 id="stt_bar_animation_on_load" 288 value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Disable fade effect on page load', 'scrolltotop' ); ?> 289 </label> 290 <?php 265 291 } 266 292 267 293 function stt_bar_allow_back_field() { 268 294 $settings = scrolltotop_get_plugin_settings( 'stt_bar_allow_back' ); 269 ?> 270 <fieldset> 271 <p> 272 <label> 273 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_allow_back]" value="0" <?php checked( 0, $settings ); ?> /> 295 ?> 296 <fieldset> 297 <p> 298 <label> 299 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_allow_back]" 300 value="0" <?php checked( 0, $settings ); ?> /> 274 301 <?php esc_html_e( 'Yes', 'scrolltotop' ); ?> 275 </label> 276 <br /> 277 <label> 278 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_allow_back]" value="1" <?php checked( 1, $settings ); ?> /> 302 </label> 303 <br/> 304 <label> 305 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_allow_back]" 306 value="1" <?php checked( 1, $settings ); ?> /> 279 307 <?php esc_html_e( 'No', 'scrolltotop' ); ?> 280 </label>281 </p>282 </fieldset>283 <?php308 </label> 309 </p> 310 </fieldset> 311 <?php 284 312 } 285 313 286 314 function stt_script_loading_field() { 287 315 $settings = scrolltotop_get_plugin_settings( 'stt_script_loading' ); 288 ?> 289 <select name="scrolltotop_plugin_settings[stt_script_loading]" id="stt_script_loading"> 290 <option value="0" <?php selected( 0, $settings ); ?>><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></option> 291 <option value="1" <?php selected( 1, $settings ); ?>><?php esc_html_e( 'Async', 'scrolltotop' ); ?></option> 292 <option value="2" <?php selected( 2, $settings ); ?>><?php esc_html_e( 'Defer', 'scrolltotop' ); ?></option> 293 </select> 294 <p class="description"><span class="stt-warning"><?php esc_html_e( "Warning!", 'scrolltotop' ); ?></span> <?php esc_html_e( "Don't change this unless you know what you're doing", 'scrolltotop' ); ?></p> 295 <?php 316 ?> 317 <select name="scrolltotop_plugin_settings[stt_script_loading]" id="stt_script_loading"> 318 <option value="0" <?php selected( 0, $settings ); ?>><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></option> 319 <option value="1" <?php selected( 1, $settings ); ?>><?php esc_html_e( 'Async', 'scrolltotop' ); ?></option> 320 <option value="2" <?php selected( 2, $settings ); ?>><?php esc_html_e( 'Defer', 'scrolltotop' ); ?></option> 321 </select> 322 <p class="description"><span 323 class="stt-warning"><?php esc_html_e( "Warning!", 'scrolltotop' ); ?></span> <?php esc_html_e( "Don't change this unless you know what you're doing", 'scrolltotop' ); ?> 324 </p> 325 <?php 296 326 } 297 327 298 328 function stt_bar_width_field() { 299 329 $settings = scrolltotop_get_plugin_settings( 'stt_bar_width' ); 300 ?> 301 <input name="scrolltotop_plugin_settings[stt_bar_width]" type="number" id="stt_bar_width" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 330 ?> 331 <input name="scrolltotop_plugin_settings[stt_bar_width]" type="number" id="stt_bar_width" 332 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 302 333 303 334 <?php $settings = scrolltotop_get_plugin_settings( 'stt_bar_sticky' ); ?> 304 305 <label class="stt_margin_top_15px"> 306 <input name="scrolltotop_plugin_settings[stt_bar_sticky]" type="checkbox" id="stt_bar_sticky" value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Enable sticky width', 'scrolltotop' ); ?> 307 </label> 308 <?php 335 336 <label class="stt_margin_top_15px"> 337 <input name="scrolltotop_plugin_settings[stt_bar_sticky]" type="checkbox" id="stt_bar_sticky" 338 value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Enable sticky width', 'scrolltotop' ); ?> 339 </label> 340 <?php 309 341 } 310 342 311 343 function stt_bar_opacity_field() { 312 344 $settings = scrolltotop_get_plugin_settings( 'stt_bar_opacity' ); 313 ?> 314 <input name="scrolltotop_plugin_settings[stt_bar_opacity]" type="number" min="5" max="100" step="5" id="stt_bar_opacity" value="<?php echo (int)$settings; ?>" class="small-text" /> % 315 <?php 345 ?> 346 <input name="scrolltotop_plugin_settings[stt_bar_opacity]" type="number" min="5" max="100" step="5" 347 id="stt_bar_opacity" value="<?php echo (int) $settings; ?>" class="small-text"/> % 348 <?php 316 349 } 317 350 318 351 function stt_bar_arrow_icon_field() { 319 352 $settings = scrolltotop_get_plugin_settings( 'stt_bar_arrow_icon' ); 320 ?> 321 <fieldset class="arrow-icon-select"> 322 <p> 323 <label> 324 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="f077" <?php checked( 'f077', $settings ); ?> /> 325 <i class="arrow-style-icon f077"></i> 326 </label><br /> 327 328 <label> 329 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e800" <?php checked( 'e800', $settings ); ?> /> 330 <i class="arrow-style-icon e800"></i> 331 </label><br /> 332 333 <label> 334 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e801" <?php checked( 'e801', $settings ); ?> /> 335 <i class="arrow-style-icon e801"></i> 336 </label><br /> 337 338 <label> 339 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="f106" <?php checked( 'f106', $settings ); ?> /> 340 <i class="arrow-style-icon f106"></i> 341 </label><br /> 342 343 <label> 344 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="f102" <?php checked( 'f102', $settings ); ?> /> 345 <i class="arrow-style-icon f102"></i> 346 </label><br /> 347 348 <label> 349 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e80d" <?php checked( 'e80d', $settings ); ?> /> 350 <i class="arrow-style-icon e80d"></i> 351 </label><br /> 352 353 <label> 354 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="f0aa" <?php checked( 'f0aa', $settings ); ?> /> 355 <i class="arrow-style-icon f0aa"></i> 356 </label><br /> 357 358 <label> 359 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="f148" <?php checked( 'f148', $settings ); ?> /> 360 <i class="arrow-style-icon f148"></i> 361 </label><br /> 362 363 <label> 364 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e802" <?php checked( 'e802', $settings ); ?> /> 365 <i class="arrow-style-icon e802"></i> 366 </label><br /> 367 368 <label> 369 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e805" <?php checked( 'e805', $settings ); ?> /> 370 <i class="arrow-style-icon e805"></i> 371 </label><br /> 372 373 <label> 374 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e807" <?php checked( 'e807', $settings ); ?> /> 375 <i class="arrow-style-icon e807"></i> 376 </label><br /> 377 378 <label> 379 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e80b" <?php checked( 'e80b', $settings ); ?> /> 380 <i class="arrow-style-icon e80b"></i> 381 </label><br /> 382 383 <label> 384 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e809" <?php checked( 'e809', $settings ); ?> /> 385 <i class="arrow-style-icon e809"></i> 386 </label><br /> 387 388 <label> 389 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e803" <?php checked( 'e803', $settings ); ?> /> 390 <i class="arrow-style-icon e803"></i> 391 </label><br /> 392 393 <label> 394 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" value="e804" <?php checked( 'e804', $settings ); ?> /> 395 <i class="arrow-style-icon e804"></i> 396 </label> 397 </p> 398 </fieldset> 399 <?php 353 ?> 354 <fieldset class="arrow-icon-select"> 355 <p> 356 <label> 357 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 358 value="f077" <?php checked( 'f077', $settings ); ?> /> 359 <i class="arrow-style-icon f077"></i> 360 </label><br/> 361 362 <label> 363 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 364 value="e800" <?php checked( 'e800', $settings ); ?> /> 365 <i class="arrow-style-icon e800"></i> 366 </label><br/> 367 368 <label> 369 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 370 value="e801" <?php checked( 'e801', $settings ); ?> /> 371 <i class="arrow-style-icon e801"></i> 372 </label><br/> 373 374 <label> 375 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 376 value="f106" <?php checked( 'f106', $settings ); ?> /> 377 <i class="arrow-style-icon f106"></i> 378 </label><br/> 379 380 <label> 381 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 382 value="f102" <?php checked( 'f102', $settings ); ?> /> 383 <i class="arrow-style-icon f102"></i> 384 </label><br/> 385 386 <label> 387 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 388 value="e80d" <?php checked( 'e80d', $settings ); ?> /> 389 <i class="arrow-style-icon e80d"></i> 390 </label><br/> 391 392 <label> 393 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 394 value="f0aa" <?php checked( 'f0aa', $settings ); ?> /> 395 <i class="arrow-style-icon f0aa"></i> 396 </label><br/> 397 398 <label> 399 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 400 value="f148" <?php checked( 'f148', $settings ); ?> /> 401 <i class="arrow-style-icon f148"></i> 402 </label><br/> 403 404 <label> 405 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 406 value="e802" <?php checked( 'e802', $settings ); ?> /> 407 <i class="arrow-style-icon e802"></i> 408 </label><br/> 409 410 <label> 411 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 412 value="e805" <?php checked( 'e805', $settings ); ?> /> 413 <i class="arrow-style-icon e805"></i> 414 </label><br/> 415 416 <label> 417 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 418 value="e807" <?php checked( 'e807', $settings ); ?> /> 419 <i class="arrow-style-icon e807"></i> 420 </label><br/> 421 422 <label> 423 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 424 value="e80b" <?php checked( 'e80b', $settings ); ?> /> 425 <i class="arrow-style-icon e80b"></i> 426 </label><br/> 427 428 <label> 429 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 430 value="e809" <?php checked( 'e809', $settings ); ?> /> 431 <i class="arrow-style-icon e809"></i> 432 </label><br/> 433 434 <label> 435 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 436 value="e803" <?php checked( 'e803', $settings ); ?> /> 437 <i class="arrow-style-icon e803"></i> 438 </label><br/> 439 440 <label> 441 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_arrow_icon]" 442 value="e804" <?php checked( 'e804', $settings ); ?> /> 443 <i class="arrow-style-icon e804"></i> 444 </label> 445 </p> 446 </fieldset> 447 <?php 400 448 } 401 449 402 450 function stt_bar_arrow_rotate_speed_field() { 403 451 $settings = scrolltotop_get_plugin_settings( 'stt_bar_arrow_rotate_speed' ); 404 ?> 405 <input name="scrolltotop_plugin_settings[stt_bar_arrow_rotate_speed]" type="number" min="0" step="50" id="stt_bar_arrow_rotate_speed" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 406 <p class="description"><?php esc_html_e( '0 – instant rotate', 'scrolltotop' ); ?></p> 407 <?php 452 ?> 453 <input name="scrolltotop_plugin_settings[stt_bar_arrow_rotate_speed]" type="number" min="0" step="50" 454 id="stt_bar_arrow_rotate_speed" value="<?php echo (int) $settings; ?>" 455 class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 456 <p class="description"><?php esc_html_e( '0 – instant rotate', 'scrolltotop' ); ?></p> 457 <?php 408 458 } 409 459 410 460 function stt_bar_background_color_field() { 411 461 $settings = scrolltotop_get_plugin_settings( 'stt_bar_background_color' ); 412 ?> 413 414 <fieldset> 415 <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.2 )" name="scrolltotop_plugin_settings[stt_bar_background_color]" id="stt_bar_background_color" value="<?php echo sanitize_text_field( $settings ); ?>" /> 416 <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p> 417 </fieldset> 418 419 <?php 462 ?> 463 464 <fieldset> 465 <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.2 )" 466 name="scrolltotop_plugin_settings[stt_bar_background_color]" id="stt_bar_background_color" 467 value="<?php echo sanitize_text_field( $settings ); ?>"/> 468 <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p> 469 </fieldset> 470 471 <?php 420 472 $settings = scrolltotop_get_plugin_settings( 'stt_bar_background_color_on_hover' ); 421 ?> 422 <fieldset class="stt_margin_top_15px"> 423 <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.3 )" name="scrolltotop_plugin_settings[stt_bar_background_color_on_hover]" id="stt_bar_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>" /> 424 <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p> 425 </fieldset> 426 <?php 473 ?> 474 <fieldset class="stt_margin_top_15px"> 475 <input type="text" class="color-picker" data-alpha="true" data-default-color="rgba( 0,0,0,0.3 )" 476 name="scrolltotop_plugin_settings[stt_bar_background_color_on_hover]" 477 id="stt_bar_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>"/> 478 <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p> 479 </fieldset> 480 <?php 427 481 } 428 482 429 483 function stt_bar_hover_transition_field() { 430 484 $settings = scrolltotop_get_plugin_settings( 'stt_bar_hover_transition' ); 431 ?> 432 <input name="scrolltotop_plugin_settings[stt_bar_hover_transition]" type="number" min="0" step="50" id="stt_bar_hover_transition" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 433 <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p> 434 <?php 485 ?> 486 <input name="scrolltotop_plugin_settings[stt_bar_hover_transition]" type="number" min="0" step="50" 487 id="stt_bar_hover_transition" value="<?php echo (int) $settings; ?>" 488 class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 489 <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p> 490 <?php 435 491 } 436 492 437 493 function stt_bar_text_offset_field() { 438 494 $settings = scrolltotop_get_plugin_settings( 'stt_bar_text_offset' ); 439 ?> 440 <input name="scrolltotop_plugin_settings[stt_bar_text_offset]" type="number" min="0" id="stt_bar_text_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 441 <?php 495 ?> 496 <input name="scrolltotop_plugin_settings[stt_bar_text_offset]" type="number" min="0" id="stt_bar_text_offset" 497 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 498 <?php 442 499 } 443 500 444 501 function stt_bar_color_field() { 445 502 $settings = scrolltotop_get_plugin_settings( 'stt_bar_color' ); 446 ?> 447 <fieldset> 448 <p> 449 <input type="text" class="color-picker" data-alpha="true" data-default-color="#000000" name="scrolltotop_plugin_settings[stt_bar_color]" id="stt_bar_color" value="<?php echo $settings; ?>" /> 450 </p> 451 </fieldset> 452 <?php 503 ?> 504 <fieldset> 505 <p> 506 <input type="text" class="color-picker" data-alpha="true" data-default-color="#000000" 507 name="scrolltotop_plugin_settings[stt_bar_color]" id="stt_bar_color" 508 value="<?php echo $settings; ?>"/> 509 </p> 510 </fieldset> 511 <?php 453 512 } 454 513 455 514 function stt_bar_arrow_size_field() { 456 515 $settings = scrolltotop_get_plugin_settings( 'stt_bar_arrow_size' ); 457 ?> 458 <input name="scrolltotop_plugin_settings[stt_bar_arrow_size]" type="number" min="0" max="100" id="stt_bar_arrow_size" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 459 <p class="description"><?php esc_html_e( "0 – don't show the arrow", 'scrolltotop' ); ?></p> 460 <?php 516 ?> 517 <input name="scrolltotop_plugin_settings[stt_bar_arrow_size]" type="number" min="0" max="100" 518 id="stt_bar_arrow_size" value="<?php echo (int) $settings; ?>" 519 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 520 <p class="description"><?php esc_html_e( "0 – don't show the arrow", 'scrolltotop' ); ?></p> 521 <?php 461 522 } 462 523 463 524 function stt_bar_caption_size_field() { 464 525 $settings = scrolltotop_get_plugin_settings( 'stt_bar_caption_size' ); 465 ?> 466 <input name="scrolltotop_plugin_settings[stt_bar_caption_size]" type="number" min="0" max="30" id="stt_bar_caption_size" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 467 <?php 526 ?> 527 <input name="scrolltotop_plugin_settings[stt_bar_caption_size]" type="number" min="0" max="30" 528 id="stt_bar_caption_size" value="<?php echo (int) $settings; ?>" 529 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 530 <?php 468 531 } 469 532 470 533 function stt_bar_caption_position_field() { 471 534 $settings = scrolltotop_get_plugin_settings( 'stt_bar_caption_position' ); 472 ?> 473 <fieldset> 474 <p> 475 <label> 476 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_caption_position]" value="0" <?php checked( 0, $settings ); ?> /> 535 ?> 536 <fieldset> 537 <p> 538 <label> 539 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_caption_position]" 540 value="0" <?php checked( 0, $settings ); ?> /> 477 541 <?php esc_html_e( 'Under the arrow', 'scrolltotop' ); ?> 478 </label> 479 <br /> 480 <label> 481 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_caption_position]" value="1" <?php checked( 1, $settings ); ?> /> 542 </label> 543 <br/> 544 <label> 545 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_caption_position]" 546 value="1" <?php checked( 1, $settings ); ?> /> 482 547 <?php esc_html_e( 'To the right of the arrow', 'scrolltotop' ); ?> 483 </label>484 </p>485 </fieldset>486 <?php548 </label> 549 </p> 550 </fieldset> 551 <?php 487 552 } 488 553 489 554 function stt_bar_caption_font_field() { 490 555 $settings = scrolltotop_get_plugin_settings( 'stt_bar_caption_font' ); 491 ?> 492 <input name="scrolltotop_plugin_settings[stt_bar_caption_font]" type="text" placeholder=""Arial", sans-serif" id="stt_bar_caption_font" value="<?php echo esc_attr( $settings ); ?>" /> 493 <?php 556 ?> 557 <input name="scrolltotop_plugin_settings[stt_bar_caption_font]" type="text" 558 placeholder=""Arial", sans-serif" id="stt_bar_caption_font" 559 value="<?php echo esc_attr( $settings ); ?>"/> 560 <?php 494 561 } 495 562 496 563 function stt_sticky_container_field() { 497 564 $settings = scrolltotop_get_plugin_settings( 'stt_sticky_container' ); 498 ?> 499 <input name="scrolltotop_plugin_settings[stt_sticky_container]" type="text" id="stt_sticky_container" value="<?php echo esc_attr( $settings ); ?>" /> 500 <p class="description"><?php esc_html_e( "Usually this is #primary, #wrapper, #secondary, #sidebar or #content", 'scrolltotop' ); ?></p> 501 <?php 565 ?> 566 <input name="scrolltotop_plugin_settings[stt_sticky_container]" type="text" id="stt_sticky_container" 567 value="<?php echo esc_attr( $settings ); ?>"/> 568 <p class="description"><?php esc_html_e( "Usually this is #primary, #wrapper, #secondary, #sidebar or #content", 'scrolltotop' ); ?></p> 569 <?php 502 570 } 503 571 504 572 function stt_enqueue_styles_field() { 505 573 $settings = scrolltotop_get_plugin_settings( 'stt_enqueue_styles' ); 506 ?> 507 <fieldset> 508 <p> 509 <label> 510 <input type="radio" name="scrolltotop_plugin_settings[stt_enqueue_styles]" value="0" <?php checked( 0, $settings ); ?> /> 574 ?> 575 <fieldset> 576 <p> 577 <label> 578 <input type="radio" name="scrolltotop_plugin_settings[stt_enqueue_styles]" 579 value="0" <?php checked( 0, $settings ); ?> /> 511 580 <?php esc_html_e( 'Yes', 'scrolltotop' ); ?> 512 </label> 513 <br /> 514 <label> 515 <input type="radio" name="scrolltotop_plugin_settings[stt_enqueue_styles]" value="1" <?php checked( 1, $settings ); ?> /> 581 </label> 582 <br/> 583 <label> 584 <input type="radio" name="scrolltotop_plugin_settings[stt_enqueue_styles]" 585 value="1" <?php checked( 1, $settings ); ?> /> 516 586 <?php esc_html_e( 'No', 'scrolltotop' ); ?> 517 </label>518 </p>519 </fieldset>520 <?php587 </label> 588 </p> 589 </fieldset> 590 <?php 521 591 } 522 592 523 593 function stt_inline_styles_field() { 524 594 $settings = scrolltotop_get_plugin_settings( 'stt_inline_styles' ); 525 ?> 526 <fieldset id="stt_inline_styles"> 527 <p> 528 <label> 529 <input type="radio" name="scrolltotop_plugin_settings[stt_inline_styles]" value="0" <?php checked( 0, $settings ); ?> /> 595 ?> 596 <fieldset id="stt_inline_styles"> 597 <p> 598 <label> 599 <input type="radio" name="scrolltotop_plugin_settings[stt_inline_styles]" 600 value="0" <?php checked( 0, $settings ); ?> /> 530 601 <?php esc_html_e( 'Yes', 'scrolltotop' ); ?> 531 </label> 532 <br /> 533 <label> 534 <input type="radio" name="scrolltotop_plugin_settings[stt_inline_styles]" value="1" <?php checked( 1, $settings ); ?> /> 602 </label> 603 <br/> 604 <label> 605 <input type="radio" name="scrolltotop_plugin_settings[stt_inline_styles]" 606 value="1" <?php checked( 1, $settings ); ?> /> 535 607 <?php esc_html_e( 'No', 'scrolltotop' ); ?> 536 </label>537 </p>538 </fieldset>539 <?php608 </label> 609 </p> 610 </fieldset> 611 <?php 540 612 } 541 613 542 614 function stt_custom_css_field() { 543 615 $settings = scrolltotop_get_plugin_settings( 'stt_custom_css' ); 544 ?> 545 <textarea name="scrolltotop_plugin_settings[stt_custom_css]" id="stt_custom_css" placeholder="#scrollToTop { border-right: 1px solid #bbbbbb; }" id="stt_custom_css" cols="50" rows="12"><?php echo $settings; ?></textarea> 546 <?php 616 ?> 617 <textarea name="scrolltotop_plugin_settings[stt_custom_css]" id="stt_custom_css" 618 placeholder="#scrollToTop { border-right: 1px solid #bbbbbb; }" id="stt_custom_css" cols="50" 619 rows="12"><?php echo $settings; ?></textarea> 620 <?php 547 621 } 548 622 549 623 function stt_bar_make_smaller_field() { 550 624 $settings = scrolltotop_get_plugin_settings( 'stt_bar_make_smaller_width' ); 551 ?> 552 <label><?php esc_html_e( "Set width to", 'scrolltotop' ); ?> 553 <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_width]" type="number" min="0" step="5" id="stt_bar_make_smaller_width" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?></label> 554 625 ?> 626 <label><?php esc_html_e( "Set width to", 'scrolltotop' ); ?> 627 <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_width]" type="number" min="0" step="5" 628 id="stt_bar_make_smaller_width" value="<?php echo (int) $settings; ?>" 629 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?></label> 630 555 631 <?php $settings = scrolltotop_get_plugin_settings( 'stt_bar_make_smaller_screen' ); ?> 556 557 <label> 558 <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?> 559 <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_screen]" type="number" min="0" id="stt_bar_make_smaller_screen" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 560 </label> 561 <p class="description"><?php esc_html_e( "0 – don't make bar smaller", 'scrolltotop' ); ?></p> 562 <?php 632 633 <label> 634 <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?> 635 <input name="scrolltotop_plugin_settings[stt_bar_make_smaller_screen]" type="number" min="0" 636 id="stt_bar_make_smaller_screen" value="<?php echo (int) $settings; ?>" 637 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 638 </label> 639 <p class="description"><?php esc_html_e( "0 – don't make bar smaller", 'scrolltotop' ); ?></p> 640 <?php 563 641 } 564 642 565 643 function stt_button_make_smaller_field() { 566 644 $settings = scrolltotop_get_plugin_settings( 'stt_button_make_smaller_padding' ); 567 ?> 568 <label> 569 <?php esc_html_e( "Set padding to", 'scrolltotop' ); ?> 570 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_padding]" type="number" min="0" id="stt_button_make_smaller_padding" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 571 </label> 572 645 ?> 646 <label> 647 <?php esc_html_e( "Set padding to", 'scrolltotop' ); ?> 648 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_padding]" type="number" min="0" 649 id="stt_button_make_smaller_padding" value="<?php echo (int) $settings; ?>" 650 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 651 </label> 652 573 653 <?php $settings = scrolltotop_get_plugin_settings( 'stt_button_make_smaller_arrow_size' ); ?> 574 575 <label> 576 <?php esc_html_e( "and arrow size to", 'scrolltotop' ); ?> 577 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_arrow_size]" type="number" min="0" id="stt_button_make_smaller_arrow_size" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 578 </label> 579 654 655 <label> 656 <?php esc_html_e( "and arrow size to", 'scrolltotop' ); ?> 657 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_arrow_size]" type="number" min="0" 658 id="stt_button_make_smaller_arrow_size" value="<?php echo (int) $settings; ?>" 659 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 660 </label> 661 580 662 <?php $settings = scrolltotop_get_plugin_settings( 'stt_button_make_smaller_screen' ); ?> 581 582 <label> 583 <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?> 584 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_screen]" type="number" min="0" id="stt_button_make_smaller_screen" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 585 </label> 586 <p class="description"><?php esc_html_e( "0 – don't make button smaller", 'scrolltotop' ); ?></p> 587 <?php 663 664 <label> 665 <?php esc_html_e( "if user's screen is less than", 'scrolltotop' ); ?> 666 <input name="scrolltotop_plugin_settings[stt_button_make_smaller_screen]" type="number" min="0" 667 id="stt_button_make_smaller_screen" value="<?php echo (int) $settings; ?>" 668 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 669 </label> 670 <p class="description"><?php esc_html_e( "0 – don't make button smaller", 'scrolltotop' ); ?></p> 671 <?php 588 672 } 589 673 590 674 function stt_bar_hide_field() { 591 675 $settings = scrolltotop_get_plugin_settings( 'stt_bar_hide' ); 592 ?> 593 <label> 594 <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?> 595 <input name="scrolltotop_plugin_settings[stt_bar_hide]" type="number" min="0" id="stt_bar_hide" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 596 </label> 597 598 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 599 676 ?> 677 <label> 678 <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?> 679 <input name="scrolltotop_plugin_settings[stt_bar_hide]" type="number" min="0" id="stt_bar_hide" 680 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 681 </label> 682 683 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 684 600 685 <?php $settings = scrolltotop_get_plugin_settings( 'stt_bar_transform_to_button' ); ?> 601 602 <label class="stt_margin_top_15px"> 603 <input name="scrolltotop_plugin_settings[stt_bar_transform_to_button]" type="checkbox" id="stt_bar_transform_to_button" value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( "Transform into button instead of hide", 'scrolltotop' ); ?> <span class="stt-new"><?php echo esc_html__( 'NEW', 'scrolltotop' ); ?></span> 604 </label> 605 <?php 686 687 <label class="stt_margin_top_15px"> 688 <input name="scrolltotop_plugin_settings[stt_bar_transform_to_button]" type="checkbox" 689 id="stt_bar_transform_to_button" 690 value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( "Transform into button instead of hide", 'scrolltotop' ); ?> 691 <span class="stt-new"><?php echo esc_html__( 'NEW', 'scrolltotop' ); ?></span> 692 </label> 693 <?php 606 694 } 607 695 608 696 function stt_bar_transformed_size_field() { 609 697 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_size' ); 610 ?> 611 <input name="scrolltotop_plugin_settings[stt_bar_transformed_size]" type="number" min="0" id="stt_bar_transformed_size" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 612 <?php 698 ?> 699 <input name="scrolltotop_plugin_settings[stt_bar_transformed_size]" type="number" min="0" 700 id="stt_bar_transformed_size" value="<?php echo (int) $settings; ?>" 701 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 702 <?php 613 703 } 614 704 615 705 function stt_bar_transformed_vertical_position_field() { 616 706 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_vertical_position' ); 617 ?> 618 <fieldset> 619 <p> 620 <label> 621 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_position]" value="0" <?php checked( 0, $settings ); ?> /> 707 ?> 708 <fieldset> 709 <p> 710 <label> 711 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_position]" 712 value="0" <?php checked( 0, $settings ); ?> /> 622 713 <?php esc_html_e( 'Top', 'scrolltotop' ); ?> 623 </label> 624 <br /> 625 <label> 626 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_position]" value="1" <?php checked( 1, $settings ); ?> /> 714 </label> 715 <br/> 716 <label> 717 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_position]" 718 value="1" <?php checked( 1, $settings ); ?> /> 627 719 <?php esc_html_e( 'Bottom', 'scrolltotop' ); ?> 628 </label>629 </p>630 </fieldset>631 <?php720 </label> 721 </p> 722 </fieldset> 723 <?php 632 724 } 633 725 634 726 function stt_bar_transformed_horizontal_position_field() { 635 727 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_horizontal_position' ); 636 ?> 637 <fieldset> 638 <p> 639 <label> 640 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_position]" value="0" <?php checked( 0, $settings ); ?> /> 728 ?> 729 <fieldset> 730 <p> 731 <label> 732 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_position]" 733 value="0" <?php checked( 0, $settings ); ?> /> 641 734 <?php esc_html_e( 'Left', 'scrolltotop' ); ?> 642 </label> 643 <br /> 644 <label> 645 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_position]" value="1" <?php checked( 1, $settings ); ?> /> 735 </label> 736 <br/> 737 <label> 738 <input type="radio" name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_position]" 739 value="1" <?php checked( 1, $settings ); ?> /> 646 740 <?php esc_html_e( 'Right', 'scrolltotop' ); ?> 647 </label>648 </p>649 </fieldset>650 <?php741 </label> 742 </p> 743 </fieldset> 744 <?php 651 745 } 652 746 653 747 function stt_bar_transformed_vertical_offset_field() { 654 748 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_vertical_offset' ); 655 ?> 656 <input name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_offset]" type="number" min="0" id="stt_bar_transformed_vertical_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 657 <?php 749 ?> 750 <input name="scrolltotop_plugin_settings[stt_bar_transformed_vertical_offset]" type="number" min="0" 751 id="stt_bar_transformed_vertical_offset" value="<?php echo (int) $settings; ?>" 752 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 753 <?php 658 754 } 659 755 660 756 function stt_bar_transformed_horizontal_offset_field() { 661 757 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_horizontal_offset' ); 662 ?> 663 <input name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_offset]" type="number" min="0" id="stt_bar_transformed_horizontal_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 664 <?php 758 ?> 759 <input name="scrolltotop_plugin_settings[stt_bar_transformed_horizontal_offset]" type="number" min="0" 760 id="stt_bar_transformed_horizontal_offset" value="<?php echo (int) $settings; ?>" 761 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 762 <?php 665 763 } 666 764 667 765 function stt_bar_transformed_border_radius_field() { 668 766 $settings = scrolltotop_get_plugin_settings( 'stt_bar_transformed_border_radius' ); 669 ?> 670 <input name="scrolltotop_plugin_settings[stt_bar_transformed_border_radius]" type="text" id="stt_bar_transformed_border_radius" value="<?php echo $settings; ?>" class="small-text" /> 671 <?php 767 ?> 768 <input name="scrolltotop_plugin_settings[stt_bar_transformed_border_radius]" type="text" 769 id="stt_bar_transformed_border_radius" value="<?php echo $settings; ?>" class="small-text"/> 770 <?php 672 771 } 673 772 674 773 function stt_button_hide_field() { 675 774 $settings = scrolltotop_get_plugin_settings( 'stt_button_hide' ); 676 ?> 677 <label> 678 <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?> 679 <input name="scrolltotop_plugin_settings[stt_button_hide]" type="number" min="0" id="stt_button_hide" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 680 </label> 681 682 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 683 <?php 775 ?> 776 <label> 777 <?php esc_html_e( "Hide if user's screen is less than", 'scrolltotop' ); ?> 778 <input name="scrolltotop_plugin_settings[stt_button_hide]" type="number" min="0" id="stt_button_hide" 779 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 780 </label> 781 782 <p class="description"><?php esc_html_e( "0 – don't hide", 'scrolltotop' ); ?></p> 783 <?php 684 784 } 685 785 686 786 function stt_button_position_field() { 687 787 $settings = scrolltotop_get_plugin_settings( 'stt_button_position' ); 688 ?> 689 <fieldset> 690 <p> 691 <label> 692 <input type="radio" name="scrolltotop_plugin_settings[stt_button_position]" value="0" <?php checked( 0, $settings ); ?> /> 788 ?> 789 <fieldset> 790 <p> 791 <label> 792 <input type="radio" name="scrolltotop_plugin_settings[stt_button_position]" 793 value="0" <?php checked( 0, $settings ); ?> /> 693 794 <?php esc_html_e( 'Left', 'scrolltotop' ); ?> 694 </label> 695 <br /> 696 <label> 697 <input type="radio" name="scrolltotop_plugin_settings[stt_button_position]" value="1" <?php checked( 1, $settings ); ?> /> 795 </label> 796 <br/> 797 <label> 798 <input type="radio" name="scrolltotop_plugin_settings[stt_button_position]" 799 value="1" <?php checked( 1, $settings ); ?> /> 698 800 <?php esc_html_e( 'Right', 'scrolltotop' ); ?> 699 </label>700 </p>701 </fieldset>702 <?php801 </label> 802 </p> 803 </fieldset> 804 <?php 703 805 } 704 806 705 807 function stt_button_padding_field() { 706 808 $settings = scrolltotop_get_plugin_settings( 'stt_button_padding' ); 707 ?> 708 <input name="scrolltotop_plugin_settings[stt_button_padding]" type="number" min="0" id="stt_button_padding" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 709 <?php 809 ?> 810 <input name="scrolltotop_plugin_settings[stt_button_padding]" type="number" min="0" id="stt_button_padding" 811 value="<?php echo (int) $settings; ?>" class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 812 <?php 710 813 } 711 814 712 815 function stt_button_opacity_field() { 713 816 $settings = scrolltotop_get_plugin_settings( 'stt_button_opacity' ); 714 ?> 715 <input name="scrolltotop_plugin_settings[stt_button_opacity]" type="number" min="5" max="100" step="5" id="stt_button_opacity" value="<?php echo (int)$settings; ?>" class="small-text" /> % 716 <?php 817 ?> 818 <input name="scrolltotop_plugin_settings[stt_button_opacity]" type="number" min="5" max="100" step="5" 819 id="stt_button_opacity" value="<?php echo (int) $settings; ?>" class="small-text"/> % 820 <?php 717 821 } 718 822 719 823 function stt_button_horizontal_offset_field() { 720 824 $settings = scrolltotop_get_plugin_settings( 'stt_button_horizontal_offset' ); 721 ?> 722 <input name="scrolltotop_plugin_settings[stt_button_horizontal_offset]" type="number" min="0" id="stt_button_horizontal_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 723 <?php 825 ?> 826 <input name="scrolltotop_plugin_settings[stt_button_horizontal_offset]" type="number" min="0" 827 id="stt_button_horizontal_offset" value="<?php echo (int) $settings; ?>" 828 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 829 <?php 724 830 } 725 831 726 832 function stt_button_vertical_offset_field() { 727 833 $settings = scrolltotop_get_plugin_settings( 'stt_button_vertical_offset' ); 728 ?> 729 <input name="scrolltotop_plugin_settings[stt_button_vertical_offset]" type="number" min="0" id="stt_button_vertical_offset" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 730 <?php 834 ?> 835 <input name="scrolltotop_plugin_settings[stt_button_vertical_offset]" type="number" min="0" 836 id="stt_button_vertical_offset" value="<?php echo (int) $settings; ?>" 837 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 838 <?php 731 839 } 732 840 733 841 function stt_button_border_radius_field() { 734 842 $settings = scrolltotop_get_plugin_settings( 'stt_button_border_radius' ); 735 ?> 736 <input name="scrolltotop_plugin_settings[stt_button_border_radius]" type="text" id="stt_button_border_radius" value="<?php echo $settings; ?>" class="small-text" /> 737 <?php 843 ?> 844 <input name="scrolltotop_plugin_settings[stt_button_border_radius]" type="text" id="stt_button_border_radius" 845 value="<?php echo $settings; ?>" class="small-text"/> 846 <?php 738 847 } 739 848 740 849 function stt_button_background_color_field() { 741 850 $settings = scrolltotop_get_plugin_settings( 'stt_button_background_color' ); 742 ?> 743 <fieldset> 744 <input type="text" class="color-picker" data-alpha="true" data-default-color="#f44336" name="scrolltotop_plugin_settings[stt_button_background_color]" id="stt_button_background_color" value="<?php echo sanitize_text_field( $settings ); ?>" /> 745 <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p> 746 </fieldset> 747 851 ?> 852 <fieldset> 853 <input type="text" class="color-picker" data-alpha="true" data-default-color="#f44336" 854 name="scrolltotop_plugin_settings[stt_button_background_color]" id="stt_button_background_color" 855 value="<?php echo sanitize_text_field( $settings ); ?>"/> 856 <p class="description"><?php esc_html_e( 'Normal', 'scrolltotop' ); ?></p> 857 </fieldset> 858 748 859 <?php $settings = scrolltotop_get_plugin_settings( 'stt_button_background_color_on_hover' ); ?> 749 750 <fieldset class="stt_margin_top_15px"> 751 <input type="text" class="color-picker" data-alpha="true" data-default-color="#ff1744" name="scrolltotop_plugin_settings[stt_button_background_color_on_hover]" id="stt_button_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>" /> 752 <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p> 753 </fieldset> 754 <?php 860 861 <fieldset class="stt_margin_top_15px"> 862 <input type="text" class="color-picker" data-alpha="true" data-default-color="#ff1744" 863 name="scrolltotop_plugin_settings[stt_button_background_color_on_hover]" 864 id="stt_button_background_color_on_hover" value="<?php echo sanitize_text_field( $settings ); ?>"/> 865 <p class="description"><?php esc_html_e( 'On hover', 'scrolltotop' ); ?></p> 866 </fieldset> 867 <?php 755 868 } 756 869 757 870 function stt_button_animation_field() { 758 871 $settings = scrolltotop_get_plugin_settings( 'stt_button_animation' ); 759 ?>760 <label>761 <?php esc_html_e( 'Effect:', 'scrolltotop' ); ?> 762 <select name="scrolltotop_plugin_settings[stt_button_animation]" id="stt_button_animation">763 <option value="0" <?php selected( 0, $settings ); ?>><?php esc_html_e( 'None', 'scrolltotop' ); ?></option>764 <option value="1" <?php selected( 1, $settings ); ?>><?php esc_html_e( 'Slide', 'scrolltotop' ); ?></option>765 <option value="2" <?php selected( 2, $settings ); ?>><?php esc_html_e( 'Fade', 'scrolltotop' ); ?></option>766 </select>767 </label>768 872 ?> 873 <label> 874 <?php esc_html_e( 'Effect:', 'scrolltotop' ); ?> 875 <select name="scrolltotop_plugin_settings[stt_button_animation]" id="stt_button_animation"> 876 <option value="0" <?php selected( 0, $settings ); ?>><?php esc_html_e( 'None', 'scrolltotop' ); ?></option> 877 <option value="1" <?php selected( 1, $settings ); ?>><?php esc_html_e( 'Slide', 'scrolltotop' ); ?></option> 878 <option value="2" <?php selected( 2, $settings ); ?>><?php esc_html_e( 'Fade', 'scrolltotop' ); ?></option> 879 </select> 880 </label> 881 769 882 <?php $settings = scrolltotop_get_plugin_settings( 'stt_button_animation_speed' ); ?> 770 883 771 <label class="stt_margin_top_15px"> 772 <?php esc_html_e( 'Speed:', 'scrolltotop' ); ?> 773 <input name="scrolltotop_plugin_settings[stt_button_animation_speed]" type="number" min="1" max="1000" id="stt_button_animation_speed" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 774 </label> 775 884 <label class="stt_margin_top_15px"> 885 <?php esc_html_e( 'Speed:', 'scrolltotop' ); ?> 886 <input name="scrolltotop_plugin_settings[stt_button_animation_speed]" type="number" min="1" max="1000" 887 id="stt_button_animation_speed" value="<?php echo (int) $settings; ?>" 888 class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 889 </label> 890 776 891 <?php $settings = scrolltotop_get_plugin_settings( 'stt_button_animation_on_load' ); ?> 777 778 <label class="stt_margin_top_15px"> 779 <input name="scrolltotop_plugin_settings[stt_button_animation_on_load]" type="checkbox" id="stt_button_animation_on_load" value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Disable animation on page load', 'scrolltotop' ); ?> 780 </label> 781 <?php 892 893 <label class="stt_margin_top_15px"> 894 <input name="scrolltotop_plugin_settings[stt_button_animation_on_load]" type="checkbox" 895 id="stt_button_animation_on_load" 896 value="1" <?php checked( 1, $settings ); ?> /><?php esc_html_e( 'Disable animation on page load', 'scrolltotop' ); ?> 897 </label> 898 <?php 782 899 } 783 900 784 901 function stt_button_hover_transition_field() { 785 902 $settings = scrolltotop_get_plugin_settings( 'stt_button_hover_transition' ); 786 ?> 787 <input name="scrolltotop_plugin_settings[stt_button_hover_transition]" type="number" min="0" step="50" id="stt_button_hover_transition" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 788 <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p> 789 <?php 903 ?> 904 <input name="scrolltotop_plugin_settings[stt_button_hover_transition]" type="number" min="0" step="50" 905 id="stt_button_hover_transition" value="<?php echo (int) $settings; ?>" 906 class="small-text"/> <?php esc_html_e( 'ms', 'scrolltotop' ); ?> 907 <p class="description"><?php esc_html_e( '0 – disable smooth effect', 'scrolltotop' ); ?></p> 908 <?php 790 909 } 791 910 792 911 function stt_button_arrow_color_field() { 793 912 $settings = scrolltotop_get_plugin_settings( 'stt_button_arrow_color' ); 794 ?> 795 <fieldset> 796 <p> 797 <input type="text" class="color-picker" data-alpha="true" data-default-color="#ffffff" name="scrolltotop_plugin_settings[stt_button_arrow_color]" id="stt_button_arrow_color" value="<?php echo $settings; ?>" /> 798 </p> 799 </fieldset> 800 <?php 913 ?> 914 <fieldset> 915 <p> 916 <input type="text" class="color-picker" data-alpha="true" data-default-color="#ffffff" 917 name="scrolltotop_plugin_settings[stt_button_arrow_color]" id="stt_button_arrow_color" 918 value="<?php echo $settings; ?>"/> 919 </p> 920 </fieldset> 921 <?php 801 922 } 802 923 803 924 function stt_button_arrow_size_field() { 804 925 $settings = scrolltotop_get_plugin_settings( 'stt_button_arrow_size' ); 805 ?> 806 <input name="scrolltotop_plugin_settings[stt_button_arrow_size]" type="number" min="5" max="100" id="stt_button_arrow_size" value="<?php echo (int)$settings; ?>" class="small-text" /> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 807 <?php 926 ?> 927 <input name="scrolltotop_plugin_settings[stt_button_arrow_size]" type="number" min="5" max="100" 928 id="stt_button_arrow_size" value="<?php echo (int) $settings; ?>" 929 class="small-text"/> <?php esc_html_e( 'px', 'scrolltotop' ); ?> 930 <?php 808 931 } 809 932 810 933 function stt_button_arrow_icon_field() { 811 934 $settings = scrolltotop_get_plugin_settings( 'stt_button_arrow_icon' ); 812 ?> 813 <fieldset class="arrow-icon-select"> 814 <p> 815 <label> 816 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="f077" <?php checked( 'f077', $settings ); ?> /> 817 <i class="arrow-style-icon f077"></i> 818 </label> 819 <br /> 820 <label> 821 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e800" <?php checked( 'e800', $settings ); ?> /> 822 <i class="arrow-style-icon e800"></i> 823 </label> 824 <br /> 825 <label> 826 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e801" <?php checked( 'e801', $settings ); ?> /> 827 <i class="arrow-style-icon e801"></i> 828 </label> 829 <br /> 830 <label> 831 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="f106" <?php checked( 'f106', $settings ); ?> /> 832 <i class="arrow-style-icon f106"></i> 833 </label> 834 <br /> 835 <label> 836 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="f102" <?php checked( 'f102', $settings ); ?> /> 837 <i class="arrow-style-icon f102"></i> 838 </label> 839 <br /> 840 <label> 841 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e80d" <?php checked( 'e80d', $settings ); ?> /> 842 <i class="arrow-style-icon e80d"></i> 843 </label> 844 <br /> 845 <label> 846 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="f0aa" <?php checked( 'f0aa', $settings ); ?> /> 847 <i class="arrow-style-icon f0aa"></i> 848 </label> 849 <br /> 850 <label> 851 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="f148" <?php checked( 'f148', $settings ); ?> /> 852 <i class="arrow-style-icon f148"></i> 853 </label> 854 <br /> 855 <label> 856 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e802" <?php checked( 'e802', $settings ); ?> /> 857 <i class="arrow-style-icon e802"></i> 858 </label> 859 <br /> 860 <label> 861 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e805" <?php checked( 'e805', $settings ); ?> /> 862 <i class="arrow-style-icon e805"></i> 863 </label> 864 <br /> 865 <label> 866 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e807" <?php checked( 'e807', $settings ); ?> /> 867 <i class="arrow-style-icon e807"></i> 868 </label> 869 <br /> 870 <label> 871 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e80b" <?php checked( 'e80b', $settings ); ?> /> 872 <i class="arrow-style-icon e80b"></i> 873 </label> 874 <br /> 875 <label> 876 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e809" <?php checked( 'e809', $settings ); ?> /> 877 <i class="arrow-style-icon e809"></i> 878 </label> 879 <br /> 880 <label> 881 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e803" <?php checked( 'e803', $settings ); ?> /> 882 <i class="arrow-style-icon e803"></i> 883 </label> 884 <br /> 885 <label> 886 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" value="e804" <?php checked( 'e804', $settings ); ?> /> 887 <i class="arrow-style-icon e804"></i> 888 </label> 889 </p> 890 </fieldset> 891 <?php 935 ?> 936 <fieldset class="arrow-icon-select"> 937 <p> 938 <label> 939 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 940 value="f077" <?php checked( 'f077', $settings ); ?> /> 941 <i class="arrow-style-icon f077"></i> 942 </label> 943 <br/> 944 <label> 945 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 946 value="e800" <?php checked( 'e800', $settings ); ?> /> 947 <i class="arrow-style-icon e800"></i> 948 </label> 949 <br/> 950 <label> 951 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 952 value="e801" <?php checked( 'e801', $settings ); ?> /> 953 <i class="arrow-style-icon e801"></i> 954 </label> 955 <br/> 956 <label> 957 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 958 value="f106" <?php checked( 'f106', $settings ); ?> /> 959 <i class="arrow-style-icon f106"></i> 960 </label> 961 <br/> 962 <label> 963 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 964 value="f102" <?php checked( 'f102', $settings ); ?> /> 965 <i class="arrow-style-icon f102"></i> 966 </label> 967 <br/> 968 <label> 969 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 970 value="e80d" <?php checked( 'e80d', $settings ); ?> /> 971 <i class="arrow-style-icon e80d"></i> 972 </label> 973 <br/> 974 <label> 975 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 976 value="f0aa" <?php checked( 'f0aa', $settings ); ?> /> 977 <i class="arrow-style-icon f0aa"></i> 978 </label> 979 <br/> 980 <label> 981 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 982 value="f148" <?php checked( 'f148', $settings ); ?> /> 983 <i class="arrow-style-icon f148"></i> 984 </label> 985 <br/> 986 <label> 987 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 988 value="e802" <?php checked( 'e802', $settings ); ?> /> 989 <i class="arrow-style-icon e802"></i> 990 </label> 991 <br/> 992 <label> 993 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 994 value="e805" <?php checked( 'e805', $settings ); ?> /> 995 <i class="arrow-style-icon e805"></i> 996 </label> 997 <br/> 998 <label> 999 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 1000 value="e807" <?php checked( 'e807', $settings ); ?> /> 1001 <i class="arrow-style-icon e807"></i> 1002 </label> 1003 <br/> 1004 <label> 1005 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 1006 value="e80b" <?php checked( 'e80b', $settings ); ?> /> 1007 <i class="arrow-style-icon e80b"></i> 1008 </label> 1009 <br/> 1010 <label> 1011 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 1012 value="e809" <?php checked( 'e809', $settings ); ?> /> 1013 <i class="arrow-style-icon e809"></i> 1014 </label> 1015 <br/> 1016 <label> 1017 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 1018 value="e803" <?php checked( 'e803', $settings ); ?> /> 1019 <i class="arrow-style-icon e803"></i> 1020 </label> 1021 <br/> 1022 <label> 1023 <input type="radio" name="scrolltotop_plugin_settings[stt_button_arrow_icon]" 1024 value="e804" <?php checked( 'e804', $settings ); ?> /> 1025 <i class="arrow-style-icon e804"></i> 1026 </label> 1027 </p> 1028 </fieldset> 1029 <?php 892 1030 } 893 1031 894 1032 function scrolltotop_plugin_settings_validate( $settings ) { 895 if ( ! in_array( $settings['stt_bar_position'], array( 0, 1 ) ) )1033 if ( ! in_array( $settings['stt_bar_position'], array( 0, 1 ) ) ) { 896 1034 $settings['stt_bar_position'] = 0; 897 898 if( ! isset( $settings['stt_bar_animation_on_load']) || ! in_array( $settings['stt_bar_animation_on_load'], array( 0, 1 ) ) ) 1035 } 1036 1037 if ( ! isset( $settings['stt_bar_animation_on_load'] ) || ! in_array( $settings['stt_bar_animation_on_load'], array( 1038 0, 1039 1 1040 ) ) ) { 899 1041 $settings['stt_bar_animation_on_load'] = 0; 900 901 if( ! isset( $settings['stt_bar_transform_to_button']) || ! in_array( $settings['stt_bar_transform_to_button'], array( 0, 1 ) ) ) 1042 } 1043 1044 if ( ! isset( $settings['stt_bar_transform_to_button'] ) || ! in_array( $settings['stt_bar_transform_to_button'], array( 1045 0, 1046 1 1047 ) ) ) { 902 1048 $settings['stt_bar_transform_to_button'] = 0; 903 904 if( ! isset( $settings['stt_button_animation_on_load']) || ! in_array( $settings['stt_button_animation_on_load'], array( 0, 1 ) ) ) 1049 } 1050 1051 if ( ! isset( $settings['stt_button_animation_on_load'] ) || ! in_array( $settings['stt_button_animation_on_load'], array( 1052 0, 1053 1 1054 ) ) ) { 905 1055 $settings['stt_button_animation_on_load'] = 0; 906 907 if( ! in_array( $settings['stt_bar_element_position'], array( 0, 1 ) ) ) 1056 } 1057 1058 if ( ! in_array( $settings['stt_bar_element_position'], array( 0, 1 ) ) ) { 908 1059 $settings['stt_bar_element_position'] = 1; 909 910 if( ! in_array( $settings['stt_bar_transformed_vertical_position'], array( 0, 1 ) ) ) 1060 } 1061 1062 if ( ! in_array( $settings['stt_bar_transformed_vertical_position'], array( 0, 1 ) ) ) { 911 1063 $settings['stt_bar_transformed_vertical_position'] = 1; 912 913 if( ! in_array( $settings['stt_bar_transformed_horizontal_position'], array( 0, 1 ) ) ) 1064 } 1065 1066 if ( ! in_array( $settings['stt_bar_transformed_horizontal_position'], array( 0, 1 ) ) ) { 914 1067 $settings['stt_bar_transformed_horizontal_position'] = 1; 915 916 if( ! in_array( $settings['stt_mode'], array( 0, 1 ) ) ) 1068 } 1069 1070 if ( ! in_array( $settings['stt_mode'], array( 0, 1 ) ) ) { 917 1071 $settings['stt_mode'] = 0; 918 919 if( ! in_array( $settings['stt_custom_css'], array( 0, 1 ) ) ) 1072 } 1073 1074 if ( ! in_array( $settings['stt_custom_css'], array( 0, 1 ) ) ) { 920 1075 $settings['stt_custom_css'] = 0; 921 922 if( ! in_array( $settings['stt_inline_styles'], array( 0, 1 ) ) ) 1076 } 1077 1078 if ( ! in_array( $settings['stt_inline_styles'], array( 0, 1 ) ) ) { 923 1079 $settings['stt_inline_styles'] = 0; 924 925 if( ! in_array( $settings['stt_bar_allow_back'], array( 0, 1 ) ) ) 1080 } 1081 1082 if ( ! in_array( $settings['stt_bar_allow_back'], array( 0, 1 ) ) ) { 926 1083 $settings['stt_bar_allow_back'] = 0; 927 928 if( ! in_array( $settings['stt_script_loading'], array( 0, 1, 2 ) ) ) 1084 } 1085 1086 if ( ! in_array( $settings['stt_script_loading'], array( 0, 1, 2 ) ) ) { 929 1087 $settings['stt_script_loading'] = 0; 930 931 $icon_array = array( 'f077', 'f106', 'e801', 'e800', 'e80d', 'f0aa', 'f148', 'e802', 'e805', 'e807', 'e80b', 'e809', 'f102', 'e803', 'e804' ); 932 if( ! in_array( $settings['stt_bar_arrow_icon'], $icon_array ) ) 1088 } 1089 1090 $icon_array = array( 1091 'f077', 1092 'f106', 1093 'e801', 1094 'e800', 1095 'e80d', 1096 'f0aa', 1097 'f148', 1098 'e802', 1099 'e805', 1100 'e807', 1101 'e80b', 1102 'e809', 1103 'f102', 1104 'e803', 1105 'e804' 1106 ); 1107 if ( ! in_array( $settings['stt_bar_arrow_icon'], $icon_array ) ) { 933 1108 $settings['stt_bar_arrow_icon'] = 'f077'; 934 935 if( ! in_array( $settings['stt_button_arrow_icon'], $icon_array ) ) 1109 } 1110 1111 if ( ! in_array( $settings['stt_button_arrow_icon'], $icon_array ) ) { 936 1112 $settings['stt_button_arrow_icon'] = 'f077'; 937 938 if( ! in_array( $settings['stt_bar_caption_position'], array( 0, 1 ) ) ) 1113 } 1114 1115 if ( ! in_array( $settings['stt_bar_caption_position'], array( 0, 1 ) ) ) { 939 1116 $settings['stt_bar_caption_position'] = 0; 940 941 if( isset( $settings['stt_advanced_background_sticky']) && ! in_array( $settings['stt_advanced_background_sticky'], array( 0, 1 ) ) ) 1117 } 1118 1119 if ( isset( $settings['stt_advanced_background_sticky'] ) && ! in_array( $settings['stt_advanced_background_sticky'], array( 1120 0, 1121 1 1122 ) ) ) { 942 1123 $settings['stt_advanced_background_sticky'] = 0; 943 944 if( isset( $settings['stt_bar_sticky']) && ! in_array( $settings['stt_bar_sticky'], array( 0, 1 ) ) ) 1124 } 1125 1126 if ( isset( $settings['stt_bar_sticky'] ) && ! in_array( $settings['stt_bar_sticky'], array( 0, 1 ) ) ) { 945 1127 $settings['stt_bar_sticky'] = 0; 946 947 if( ! in_array( $settings['stt_button_position'], array( 0, 1 ) ) ) 1128 } 1129 1130 if ( ! in_array( $settings['stt_button_position'], array( 0, 1 ) ) ) { 948 1131 $settings['stt_button_position'] = 0; 949 950 if( ! in_array( $settings['stt_button_animation'], array( 0, 1, 2 ) ) ) 1132 } 1133 1134 if ( ! in_array( $settings['stt_button_animation'], array( 0, 1, 2 ) ) ) { 951 1135 $settings['stt_button_animation'] = 0; 952 953 $settings['stt_button_padding'] = absint( $settings['stt_button_padding'] ); 954 $settings['stt_button_opacity'] = absint( $settings['stt_button_opacity'] ); 955 if( (int)$settings['stt_button_opacity'] > 100 ) $settings['stt_button_opacity'] = 100; 956 $settings['stt_button_horizontal_offset'] = absint( $settings['stt_button_horizontal_offset'] ); 957 $settings['stt_button_vertical_offset'] = absint( $settings['stt_button_vertical_offset'] ); 958 $settings['stt_button_hover_transition'] = absint( $settings['stt_button_hover_transition'] ); 959 $settings['stt_button_arrow_size'] = absint( $settings['stt_button_arrow_size'] ); 960 $settings['stt_button_animation_speed'] = absint( $settings['stt_button_animation_speed'] ); 961 if( (int)$settings['stt_button_animation_speed'] < 1 ) { 1136 } 1137 1138 $settings['stt_button_padding'] = absint( $settings['stt_button_padding'] ); 1139 $settings['stt_button_opacity'] = absint( $settings['stt_button_opacity'] ); 1140 if ( (int) $settings['stt_button_opacity'] > 100 ) { 1141 $settings['stt_button_opacity'] = 100; 1142 } 1143 $settings['stt_button_horizontal_offset'] = absint( $settings['stt_button_horizontal_offset'] ); 1144 $settings['stt_button_vertical_offset'] = absint( $settings['stt_button_vertical_offset'] ); 1145 $settings['stt_button_hover_transition'] = absint( $settings['stt_button_hover_transition'] ); 1146 $settings['stt_button_arrow_size'] = absint( $settings['stt_button_arrow_size'] ); 1147 $settings['stt_button_animation_speed'] = absint( $settings['stt_button_animation_speed'] ); 1148 if ( (int) $settings['stt_button_animation_speed'] < 1 ) { 962 1149 $settings['stt_button_animation_speed'] = 200; 963 1150 } 964 $settings['stt_button_padding'] = absint( $settings['stt_button_padding'] ); 965 $settings['stt_button_border_radius'] = trim( sanitize_text_field( $settings['stt_button_border_radius'] ) ); 966 $settings['stt_button_border_radius'] = is_numeric( substr( $settings['stt_button_border_radius'], -1 ) ) && (int)$settings['stt_button_border_radius'] > 0 ? (int)$settings['stt_button_border_radius'] . 'px' : $settings['stt_button_border_radius']; 967 $settings['stt_bar_transformed_border_radius'] = trim( sanitize_text_field( $settings['stt_bar_transformed_border_radius'] ) ); 968 $settings['stt_bar_transformed_border_radius'] = is_numeric( substr( $settings['stt_bar_transformed_border_radius'], -1 ) ) && (int)$settings['stt_bar_transformed_border_radius'] > 0 ? (int)$settings['stt_bar_transformed_border_radius'] . 'px' : $settings['stt_bar_transformed_border_radius']; 969 $settings['stt_bar_text'] = trim( sanitize_text_field( $settings['stt_bar_text'] ) ); 970 $settings['stt_bar_caption_font'] = trim( sanitize_text_field( $settings['stt_bar_caption_font'] ) ); 971 $settings['stt_bar_top_offset'] = absint( $settings['stt_bar_top_offset'] ); 972 $settings['stt_bar_horizontal_offset'] = absint( $settings['stt_bar_horizontal_offset'] ); 973 $settings['stt_scroll_offset'] = absint( $settings['stt_scroll_offset'] ); 974 $settings['stt_bar_fade_duration'] = absint( $settings['stt_bar_fade_duration'] ); 975 $settings['stt_bar_opacity'] = absint( $settings['stt_bar_opacity'] ); 976 if( (int)$settings['stt_bar_opacity'] > 100 ) $settings['stt_bar_opacity'] = 100; 1151 $settings['stt_button_padding'] = absint( $settings['stt_button_padding'] ); 1152 $settings['stt_button_border_radius'] = trim( sanitize_text_field( $settings['stt_button_border_radius'] ) ); 1153 $settings['stt_button_border_radius'] = is_numeric( substr( $settings['stt_button_border_radius'], - 1 ) ) && (int) $settings['stt_button_border_radius'] > 0 ? (int) $settings['stt_button_border_radius'] . 'px' : $settings['stt_button_border_radius']; 1154 $settings['stt_bar_transformed_border_radius'] = trim( sanitize_text_field( $settings['stt_bar_transformed_border_radius'] ) ); 1155 $settings['stt_bar_transformed_border_radius'] = is_numeric( substr( $settings['stt_bar_transformed_border_radius'], - 1 ) ) && (int) $settings['stt_bar_transformed_border_radius'] > 0 ? (int) $settings['stt_bar_transformed_border_radius'] . 'px' : $settings['stt_bar_transformed_border_radius']; 1156 $settings['stt_bar_text'] = trim( sanitize_text_field( $settings['stt_bar_text'] ) ); 1157 $settings['stt_bar_caption_font'] = trim( sanitize_text_field( $settings['stt_bar_caption_font'] ) ); 1158 $settings['stt_bar_top_offset'] = absint( $settings['stt_bar_top_offset'] ); 1159 $settings['stt_bar_horizontal_offset'] = absint( $settings['stt_bar_horizontal_offset'] ); 1160 $settings['stt_scroll_offset'] = absint( $settings['stt_scroll_offset'] ); 1161 $settings['stt_bar_fade_duration'] = absint( $settings['stt_bar_fade_duration'] ); 1162 $settings['stt_bar_opacity'] = absint( $settings['stt_bar_opacity'] ); 1163 if ( (int) $settings['stt_bar_opacity'] > 100 ) { 1164 $settings['stt_bar_opacity'] = 100; 1165 } 977 1166 $settings['stt_bar_hover_transition'] = absint( $settings['stt_bar_hover_transition'] ); 978 1167 $settings['stt_bar_text_offset'] = absint( $settings['stt_bar_text_offset'] ); … … 985 1174 $settings['stt_button_make_smaller_arrow_size'] = absint( $settings['stt_button_make_smaller_arrow_size'] ); 986 1175 $settings['stt_button_make_smaller_screen'] = absint( $settings['stt_button_make_smaller_screen'] ); 987 if ( isset( $settings['stt_button_make_smaller_padding']) && (int)$settings['stt_button_make_smaller_padding'] > (int)$settings['stt_button_padding']) {988 $settings['stt_button_make_smaller_padding'] = (int)$settings['stt_button_padding'] - 5;989 } 990 991 $settings['stt_bar_width'] = absint( $settings['stt_bar_width'] );992 if ( isset( $settings['stt_bar_width']) && (int)$settings['stt_bar_make_smaller_width'] > (int)$settings['stt_bar_width'] && (int)$settings['stt_bar_width'] > 100 && (int)$settings['stt_bar_sticky'] == 0 ) {993 $settings['stt_bar_make_smaller_width'] = (int)$settings['stt_bar_width'] - 50;994 } 995 996 $settings['stt_bar_make_smaller_screen'] = absint( $settings['stt_bar_make_smaller_screen'] );997 $settings['stt_bar_hide'] = absint( $settings['stt_bar_hide'] );998 if ( (int)$settings['stt_bar_hide'] > (int)$settings['stt_bar_make_smaller_screen'] && ! empty( (int)$settings['stt_bar_make_smaller_screen']) ) {999 $settings['stt_bar_hide'] = (int) $settings['stt_bar_make_smaller_screen'] - 100;1000 } 1001 1002 $settings['stt_button_hide'] = absint( $settings['stt_button_hide'] );1003 if ( (int)$settings['stt_button_hide'] > (int)$settings['stt_button_make_smaller_screen'] && ! empty( (int)$settings['stt_button_make_smaller_screen']) ) {1004 $settings['stt_button_hide'] = (int) $settings['stt_button_make_smaller_screen'] - 100;1005 } 1006 1007 if ( isset( $settings['stt_advanced_background_width']) ) {1008 $settings['stt_advanced_background_width'] = absint( $settings['stt_advanced_background_width'] );1009 1010 if ( isset( $settings['stt_bar_width']) && (int)$settings['stt_bar_width'] > (int)$settings['stt_advanced_background_width'] && (int)$settings['stt_advanced_background_width'] != 0 ) {1011 $settings['stt_advanced_background_width'] = (int) $settings['stt_bar_width'] + 100;1176 if ( isset( $settings['stt_button_make_smaller_padding'] ) && (int) $settings['stt_button_make_smaller_padding'] > (int) $settings['stt_button_padding'] ) { 1177 $settings['stt_button_make_smaller_padding'] = (int) $settings['stt_button_padding'] - 5; 1178 } 1179 1180 $settings['stt_bar_width'] = absint( $settings['stt_bar_width'] ); 1181 if ( isset( $settings['stt_bar_width'] ) && (int) $settings['stt_bar_make_smaller_width'] > (int) $settings['stt_bar_width'] && (int) $settings['stt_bar_width'] > 100 && (int) $settings['stt_bar_sticky'] == 0 ) { 1182 $settings['stt_bar_make_smaller_width'] = (int) $settings['stt_bar_width'] - 50; 1183 } 1184 1185 $settings['stt_bar_make_smaller_screen'] = absint( $settings['stt_bar_make_smaller_screen'] ); 1186 $settings['stt_bar_hide'] = absint( $settings['stt_bar_hide'] ); 1187 if ( (int) $settings['stt_bar_hide'] > (int) $settings['stt_bar_make_smaller_screen'] && ! empty( (int) $settings['stt_bar_make_smaller_screen'] ) ) { 1188 $settings['stt_bar_hide'] = (int) $settings['stt_bar_make_smaller_screen'] - 100; 1189 } 1190 1191 $settings['stt_button_hide'] = absint( $settings['stt_button_hide'] ); 1192 if ( (int) $settings['stt_button_hide'] > (int) $settings['stt_button_make_smaller_screen'] && ! empty( (int) $settings['stt_button_make_smaller_screen'] ) ) { 1193 $settings['stt_button_hide'] = (int) $settings['stt_button_make_smaller_screen'] - 100; 1194 } 1195 1196 if ( isset( $settings['stt_advanced_background_width'] ) ) { 1197 $settings['stt_advanced_background_width'] = absint( $settings['stt_advanced_background_width'] ); 1198 1199 if ( isset( $settings['stt_bar_width'] ) && (int) $settings['stt_bar_width'] > (int) $settings['stt_advanced_background_width'] && (int) $settings['stt_advanced_background_width'] != 0 ) { 1200 $settings['stt_advanced_background_width'] = (int) $settings['stt_bar_width'] + 100; 1012 1201 } 1013 1202 } 1014 1015 $settings['stt_advanced_background_hide'] = absint( $settings['stt_advanced_background_hide'] );1016 if ( (int)$settings['stt_mode'] == 0 && (int)$settings['stt_bar_hide'] >= (int)$settings['stt_advanced_background_hide'] || (int)$settings['stt_mode'] == 1 && (int)$settings['stt_button_hide'] >= (int)$settings['stt_advanced_background_hide']) {1203 1204 $settings['stt_advanced_background_hide'] = absint( $settings['stt_advanced_background_hide'] ); 1205 if ( ( $settings['stt_mode'] === 0 && (int) $settings['stt_bar_hide'] >= (int) $settings['stt_advanced_background_hide'] ) || ( $settings['stt_mode'] === 1 && $settings['stt_button_hide'] >= $settings['stt_advanced_background_hide'] ) ) { 1017 1206 $settings['stt_advanced_background_hide'] = 0; 1018 1207 } 1019 1208 1020 $settings['stt_sticky_container'] = trim( $settings['stt_sticky_container'] );1021 if ( (int)$settings['stt_mode'] === 0 && ! empty( $settings['stt_bar_sticky'] ) && ! empty( $settings['stt_advanced_background_sticky'] ) ) {1209 $settings['stt_sticky_container'] = trim( $settings['stt_sticky_container'] ); 1210 if ( (int) $settings['stt_mode'] === 0 && ! empty( $settings['stt_bar_sticky'] ) && ! empty( $settings['stt_advanced_background_sticky'] ) ) { 1022 1211 $settings['stt_advanced_background_sticky'] = 0; 1023 1212 } 1024 1213 1025 1214 delete_transient( 'scrolltotop_dynamic_js' ); 1026 1215 delete_transient( 'scrolltotop_dynamic_css' ); 1027 1216 1028 1217 return $settings; 1029 1218 } -
scrolltotop/trunk/includes/scrolltotop-functions.php
r2188887 r2309158 3 3 function scrolltotop_get_plugin_settings( $option = '' ) { 4 4 $default_settings = array( 5 'stt_mode' => 0,6 'stt_bar_position' => 0,7 'stt_button_position' => 1,8 'stt_button_padding' => 14,9 'stt_button_opacity' => 100,10 'stt_button_horizontal_offset' => 25,11 'stt_button_vertical_offset' => 25,12 'stt_button_border_radius' => '5px',13 'stt_bar_transformed_border_radius' => '50%',14 'stt_bar_element_position' => 1,15 'stt_bar_top_offset' => 0,16 'stt_bar_horizontal_offset' => 0,17 'stt_scroll_offset' => 1,18 'stt_bar_text' => '',19 'stt_bar_text_distance' => '',20 'stt_bar_fade_duration' => 300,21 'stt_advanced_background_width' => 0,22 'stt_advanced_background_hide' => 1840,23 'stt_bar_animation_on_load' => 1,24 'stt_bar_allow_back' => 0,25 'stt_script_loading' => 0,26 'stt_bar_width' => 85,27 'stt_bar_opacity' => 20,28 'stt_bar_arrow_icon' => 'f077',29 'stt_button_arrow_icon' => 'e800',30 'stt_bar_arrow_rotate_speed' => 0,31 'stt_button_animation' => 1,32 'stt_button_animation_speed' => 200,33 'stt_button_hover_transition' => 100,34 'stt_button_animation_on_load' => 1,35 'stt_button_background_color' => '#f44336',36 'stt_button_background_color_on_hover' => '#ff5252',37 'stt_bar_background_color' => 'rgba( 0,0,0,0.2 )',38 'stt_bar_background_color_on_hover' => 'rgba( 0,0,0,0.3 )',39 'stt_bar_hover_transition' => 250,40 'stt_bar_text_offset' => 20,41 'stt_bar_color' => '#000000',42 'stt_button_arrow_color' => '#ffffff',43 'stt_bar_arrow_size' => 24,44 'stt_button_arrow_size' => 18,45 'stt_bar_caption_size' => 14,46 'stt_bar_caption_position' => 0,47 'stt_bar_caption_font' => '',48 'stt_sticky_container' => '',49 'stt_advanced_background_sticky' => 0,50 'stt_bar_sticky' => 0,51 'stt_custom_css' => '',52 'stt_bar_make_smaller_width' => 100,53 'stt_bar_make_smaller_screen' => 1680,54 'stt_button_make_smaller_padding' => 0,55 'stt_button_make_smaller_arrow_size' => 0,56 'stt_button_make_smaller_screen' => 600,57 'stt_bar_hide' => 1280,58 'stt_bar_transform_to_button' => 1,59 'stt_bar_transformed_size' => 60,60 'stt_bar_transformed_vertical_position' => 1,5 'stt_mode' => 0, 6 'stt_bar_position' => 0, 7 'stt_button_position' => 1, 8 'stt_button_padding' => 14, 9 'stt_button_opacity' => 100, 10 'stt_button_horizontal_offset' => 25, 11 'stt_button_vertical_offset' => 25, 12 'stt_button_border_radius' => '5px', 13 'stt_bar_transformed_border_radius' => '50%', 14 'stt_bar_element_position' => 1, 15 'stt_bar_top_offset' => 0, 16 'stt_bar_horizontal_offset' => 0, 17 'stt_scroll_offset' => 1, 18 'stt_bar_text' => '', 19 'stt_bar_text_distance' => '', 20 'stt_bar_fade_duration' => 300, 21 'stt_advanced_background_width' => 0, 22 'stt_advanced_background_hide' => 1840, 23 'stt_bar_animation_on_load' => 1, 24 'stt_bar_allow_back' => 0, 25 'stt_script_loading' => 0, 26 'stt_bar_width' => 85, 27 'stt_bar_opacity' => 20, 28 'stt_bar_arrow_icon' => 'f077', 29 'stt_button_arrow_icon' => 'e800', 30 'stt_bar_arrow_rotate_speed' => 0, 31 'stt_button_animation' => 1, 32 'stt_button_animation_speed' => 200, 33 'stt_button_hover_transition' => 100, 34 'stt_button_animation_on_load' => 1, 35 'stt_button_background_color' => '#f44336', 36 'stt_button_background_color_on_hover' => '#ff5252', 37 'stt_bar_background_color' => 'rgba( 0, 0, 0, 0.2 )', 38 'stt_bar_background_color_on_hover' => 'rgba( 0, 0, 0, 0.3 )', 39 'stt_bar_hover_transition' => 250, 40 'stt_bar_text_offset' => 20, 41 'stt_bar_color' => '#000000', 42 'stt_button_arrow_color' => '#ffffff', 43 'stt_bar_arrow_size' => 24, 44 'stt_button_arrow_size' => 18, 45 'stt_bar_caption_size' => 14, 46 'stt_bar_caption_position' => 0, 47 'stt_bar_caption_font' => '', 48 'stt_sticky_container' => '', 49 'stt_advanced_background_sticky' => 0, 50 'stt_bar_sticky' => 0, 51 'stt_custom_css' => '', 52 'stt_bar_make_smaller_width' => 100, 53 'stt_bar_make_smaller_screen' => 1680, 54 'stt_button_make_smaller_padding' => 0, 55 'stt_button_make_smaller_arrow_size' => 0, 56 'stt_button_make_smaller_screen' => 600, 57 'stt_bar_hide' => 1280, 58 'stt_bar_transform_to_button' => 1, 59 'stt_bar_transformed_size' => 60, 60 'stt_bar_transformed_vertical_position' => 1, 61 61 'stt_bar_transformed_horizontal_position' => 1, 62 'stt_bar_transformed_vertical_offset' => 25,63 'stt_bar_transformed_horizontal_offset' => 25,64 'stt_button_hide' => 0,65 'stt_enqueue_styles' => 0,66 'stt_inline_styles' => 062 'stt_bar_transformed_vertical_offset' => 25, 63 'stt_bar_transformed_horizontal_offset' => 25, 64 'stt_button_hide' => 0, 65 'stt_enqueue_styles' => 0, 66 'stt_inline_styles' => 0 67 67 ); 68 68 69 69 $default_settings = apply_filters( 'scrolltotop_default_settings', $default_settings ); 70 70 71 71 $settings = get_option( 'scrolltotop_plugin_settings', $default_settings ); 72 73 if ( empty( $option ) ) {74 if ( isset( $settings ) ) {72 73 if ( empty( $option ) ) { 74 if ( isset( $settings ) ) { 75 75 return array_merge( $default_settings, $settings ); 76 76 } 77 77 78 78 return $default_settings; 79 } else { 80 if( isset( $settings[$option] ) ) { 81 return $settings[$option]; 82 } 79 } 83 80 84 return $default_settings[$option]; 81 if ( isset( $settings[ $option ] ) ) { 82 return $settings[ $option ]; 85 83 } 84 85 return $default_settings[ $option ]; 86 86 } -
scrolltotop/trunk/index.php
r1699756 r2309158 1 <?php 2 # Silence is golden. 1 <?php // Silence is golden. -
scrolltotop/trunk/readme.txt
r2188887 r2309158 5 5 Tags: scroll to top, back to top, scroll, to top, scroll up, bar, button 6 6 Requires at least: 3.0.1 7 Tested up to: 5. 2.48 Stable tag: 1.1 37 Tested up to: 5.4.1 8 Stable tag: 1.14 9 9 License: GPLv3 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 62 62 63 63 == Changelog == 64 65 = 1.14 = 66 * WordPress 5.4.x support 67 * Code refactoring 64 68 65 69 = 1.13 = -
scrolltotop/trunk/scrolltotop.php
r2188899 r2309158 5 5 Author: Roman Sarvarov 6 6 Author URI: https://about.me/sarvaroff 7 Version: 1.1 37 Version: 1.14 8 8 Text Domain: scrolltotop 9 9 Domain Path: /languages/ … … 29 29 */ 30 30 31 $global_scrolltotop_version = 1.1 3;32 $global_scrolltotop_dir_url = str_replace( home_url() , '', plugin_dir_url( __FILE__ ));33 $global_scrolltotop_base = plugin_basename( __FILE__ );31 $global_scrolltotop_version = 1.14; 32 $global_scrolltotop_dir_url = parse_url( plugin_dir_url( __FILE__ ), PHP_URL_PATH ); 33 $global_scrolltotop_base = plugin_basename( __FILE__ ); 34 34 35 35 add_action( 'plugins_loaded', 'scrolltotop_init' ); 36 36 37 function scrolltotop_init() { 37 if( is_admin() ) {38 require_once( plugin_dir_path( __FILE__ ) . 'includes/scrolltotop-admin.php' );39 }40 41 require_once( plugin_dir_path( __FILE__ ) . 'includes/scrolltotop-functions.php' );38 if ( is_admin() ) { 39 require_once( plugin_dir_path( __FILE__ ) . 'includes/scrolltotop-admin.php' ); 40 } 41 42 require_once( plugin_dir_path( __FILE__ ) . 'includes/scrolltotop-functions.php' ); 42 43 } 43 44 44 45 add_action( 'plugins_loaded', 'scrolltotop_i18n' ); 45 46 function scrolltotop_i18n() { 46 global $global_scrolltotop_base;47 load_plugin_textdomain( 'scrolltotop', false, dirname( $global_scrolltotop_base ) . '/languages/' );47 global $global_scrolltotop_base; 48 load_plugin_textdomain( 'scrolltotop', false, dirname( $global_scrolltotop_base ) . '/languages/' ); 48 49 } 49 50 50 51 add_action( 'wp_enqueue_scripts', 'scrolltotop_front_init' ); 51 52 function scrolltotop_front_init() { 52 if ( apply_filters( 'scrolltotop_enabled', false ) )53 if ( apply_filters( 'scrolltotop_enabled', false ) ) { 53 54 return; 54 55 global $global_scrolltotop_version, $global_scrolltotop_dir_url; 56 57 $settings = scrolltotop_get_plugin_settings(); 58 59 // javascript 60 wp_enqueue_script( 'scrolltotop', $global_scrolltotop_dir_url . 'assets/js/scripts.min.js', array( 'jquery' ) , $global_scrolltotop_version, apply_filters( 'scrolltotop_scripts_to_footer', true ) ); 55 } 56 57 global $global_scrolltotop_version, $global_scrolltotop_dir_url; 58 59 $settings = scrolltotop_get_plugin_settings(); 60 61 // javascript 62 wp_enqueue_script( 'scrolltotop', $global_scrolltotop_dir_url . 'assets/js/scripts.min.js', array( 'jquery' ), $global_scrolltotop_version, apply_filters( 'scrolltotop_scripts_to_footer', true ) ); 61 63 62 64 // load cache if exist 63 65 $inline_scripts = get_transient( 'scrolltotop_dynamic_js' ); 64 65 if ( false === $inline_scripts ) {66 $inline_scripts = 'var ';66 67 if ( false === $inline_scripts ) { 68 $inline_scripts = 'var '; 67 69 $inline_scripts_array = array(); 68 if ( $settings['stt_sticky_container'] && ( (int)$settings['stt_bar_sticky'] === 1 || (int)$settings['stt_advanced_background_sticky'] === 1 ) ) {70 if ( $settings['stt_sticky_container'] && ( (int) $settings['stt_bar_sticky'] === 1 || (int) $settings['stt_advanced_background_sticky'] === 1 ) ) { 69 71 $inline_scripts_array['sttStickyContainer'] = $settings['stt_sticky_container']; 70 71 if ( (int)$settings['stt_bar_sticky'] === 1 && (int)$settings['stt_advanced_background_sticky'] === 0 ) {72 73 if ( (int) $settings['stt_bar_sticky'] === 1 && (int) $settings['stt_advanced_background_sticky'] === 0 ) { 72 74 $inline_scripts_array['sttBarSticky'] = 'true'; 73 75 } 74 76 } 75 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) || (int)$settings['stt_advanced_background_sticky'] === 1 ) {77 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) || (int) $settings['stt_advanced_background_sticky'] === 1 ) { 76 78 $inline_scripts_array['sttAdvancedBg'] = 'true'; 77 78 if ( (int)$settings['stt_advanced_background_sticky'] === 1 && $settings['stt_sticky_container'] ) {79 80 if ( (int) $settings['stt_advanced_background_sticky'] === 1 && $settings['stt_sticky_container'] ) { 79 81 $inline_scripts_array['sttAdvancedBgSticky'] = 'true'; 80 82 } 81 83 } 82 $inline_scripts_array['sttOffset'] = (int) $settings['stt_scroll_offset'];83 if ( (int)$settings['stt_mode'] === 0 ) {84 $inline_scripts_array['sttPos'] = (int)$settings['stt_bar_position'];85 $inline_scripts_array['sttBack'] = ( (int)$settings['stt_bar_allow_back'] == 0 ? 'true' : 'false' );86 $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_bar_animation_on_load'] === 1 ? 'true' : 'false' );84 $inline_scripts_array['sttOffset'] = (int) $settings['stt_scroll_offset']; 85 if ( (int) $settings['stt_mode'] === 0 ) { 86 $inline_scripts_array['sttPos'] = (int) $settings['stt_bar_position']; 87 $inline_scripts_array['sttBack'] = ( (int) $settings['stt_bar_allow_back'] == 0 ? 'true' : 'false' ); 88 $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_bar_animation_on_load'] === 1 ? 'true' : 'false' ); 87 89 } else { 88 $inline_scripts_array['sttPos'] = (int)$settings['stt_button_position'];89 $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_button_animation_on_load'] === 1 ? 'true' : 'false' );90 $inline_scripts_array['sttPos'] = (int) $settings['stt_button_position']; 91 $inline_scripts_array['sttOnload'] = ( (int) $settings['stt_button_animation_on_load'] === 1 ? 'true' : 'false' ); 90 92 } 91 93 92 94 $inline_scripts_row = 0; 93 foreach ( apply_filters( 'scrolltotop_inline_scripts', $inline_scripts_array ) as $script => $value ) {94 if ( $inline_scripts_row !== 0 ) {95 foreach ( apply_filters( 'scrolltotop_inline_scripts', $inline_scripts_array ) as $script => $value ) { 96 if ( $inline_scripts_row !== 0 ) { 95 97 $inline_scripts .= ',' . PHP_EOL . ' '; 96 98 } 97 99 $inline_scripts .= $script . ' = ' . $value; 98 ++ $inline_scripts_row;100 ++ $inline_scripts_row; 99 101 } 100 102 $inline_scripts .= ';'; 101 103 102 104 $inline_scripts = apply_filters( 'scrolltotop_dynamic_js', $inline_scripts ); 103 105 104 106 set_transient( 'scrolltotop_dynamic_js', $inline_scripts ); 105 107 } 106 108 107 wp_add_inline_script( 'scrolltotop', $inline_scripts, 'before' );108 109 // css110 if( apply_filters( 'scrolltotop_css_output', true )== true ) {111 if ( apply_filters( 'scrolltotop_stt_enqueue_styles', (int)$settings['stt_enqueue_styles'] === 0 ? true : false )== true ) {112 wp_enqueue_style( 'scrolltotop', $global_scrolltotop_dir_url . 'assets/css/styles.min.css', array() , $global_scrolltotop_version );113 } 114 115 if ( apply_filters( 'scrolltotop_css_inline_output', (int)$settings['stt_inline_styles'] === 0 ? true : false )== true ) {109 wp_add_inline_script( 'scrolltotop', $inline_scripts, 'before' ); 110 111 // css 112 if ( apply_filters( 'scrolltotop_css_output', true ) === true ) { 113 if ( apply_filters( 'scrolltotop_stt_enqueue_styles', (int) $settings['stt_enqueue_styles'] === 0 ) === true ) { 114 wp_enqueue_style( 'scrolltotop', $global_scrolltotop_dir_url . 'assets/css/styles.min.css', array(), $global_scrolltotop_version ); 115 } 116 117 if ( apply_filters( 'scrolltotop_css_inline_output', (int) $settings['stt_inline_styles'] === 0 ) === true ) { 116 118 $minify_css = apply_filters( 'scrolltotop_minify_css', true ); 117 119 118 120 // load cache if exist 119 121 $scrolltotop_dynamic_css = get_transient( 'scrolltotop_dynamic_css' ); 120 121 if ( false === $scrolltotop_dynamic_css ) {122 $extra_space = '';123 $newline = '';124 $newline_with_space = '';122 123 if ( false === $scrolltotop_dynamic_css ) { 124 $extra_space = ''; 125 $newline = ''; 126 $newline_with_space = ''; 125 127 $newline_with_space_x2 = ''; 126 128 127 if ( ! $minify_css ) {128 $extra_space = ' ';129 $newline = PHP_EOL;130 $newline_with_space = PHP_EOL . ' ';129 if ( ! $minify_css ) { 130 $extra_space = ' '; 131 $newline = PHP_EOL; 132 $newline_with_space = PHP_EOL . ' '; 131 133 $newline_with_space_x2 = PHP_EOL . ' ' . ' '; 132 134 } 133 135 134 136 // dynamic css 135 $scrolltotop_dynamic_css = '';136 $scrolltotop_dynamic_css_array = array();137 $scrolltotop_transition_array = array();137 $scrolltotop_dynamic_css = ''; 138 $scrolltotop_dynamic_css_array = array(); 139 $scrolltotop_transition_array = array(); 138 140 $scrolltotop_notransition_array = array(); 139 141 140 142 // .scrolltotop 141 if ( (int)$settings['stt_mode'] === 0 ) {142 143 if ( (int) $settings['stt_mode'] === 0 ) { 144 143 145 $scrolltotop_dynamic_css_array['.stt-bar'] = array( 144 146 'background' => scrolltotop_background_color_format( $settings['stt_bar_background_color'] ), 145 'color' => $settings['stt_bar_color'],146 'top' => ( ! empty( (int)$settings['stt_bar_top_offset'] ) ? (int)$settings['stt_bar_top_offset'] . 'px' : 0 )147 ); 148 149 $scrolltotop_dynamic_css_array['.stt-bar'][ ( (int)$settings['stt_bar_position'] == 0 ? 'left' : 'right' ) ] = ( $settings['stt_bar_horizontal_offset'] ? (int)$settings['stt_bar_horizontal_offset'] . 'px' : 0 );150 151 if ( ! empty( (int)$settings['stt_bar_width'] ) && empty( (int)$settings['stt_bar_sticky'] ) ) {152 $scrolltotop_dynamic_css_array['.stt-bar']['width'] = (int) $settings['stt_bar_width'] . 'px';153 } 154 155 if ( ! empty( (int)$settings['stt_bar_hover_transition'] ) ) {156 $scrolltotop_transition_array[] = 'background ' . ( (int)$settings['stt_bar_hover_transition'] ) . 'ms ease-in-out';157 $scrolltotop_notransition_array[] = 'background ' . ( (int) $settings['stt_bar_hover_transition'] ) . 'ms ease-in-out';147 'color' => $settings['stt_bar_color'], 148 'top' => ( ! empty( (int) $settings['stt_bar_top_offset'] ) ? (int) $settings['stt_bar_top_offset'] . 'px' : 0 ) 149 ); 150 151 $scrolltotop_dynamic_css_array['.stt-bar'][ ( (int) $settings['stt_bar_position'] === 0 ? 'left' : 'right' ) ] = ( $settings['stt_bar_horizontal_offset'] ? (int) $settings['stt_bar_horizontal_offset'] . 'px' : 0 ); 152 153 if ( ! empty( (int) $settings['stt_bar_width'] ) && empty( (int) $settings['stt_bar_sticky'] ) ) { 154 $scrolltotop_dynamic_css_array['.stt-bar']['width'] = (int) $settings['stt_bar_width'] . 'px'; 155 } 156 157 if ( ! empty( (int) $settings['stt_bar_hover_transition'] ) ) { 158 $scrolltotop_transition_array[] = 'background ' . ( (int) $settings['stt_bar_hover_transition'] ) . 'ms ease-in-out'; 159 $scrolltotop_notransition_array[] = 'background ' . ( (int) $settings['stt_bar_hover_transition'] ) . 'ms ease-in-out'; 158 160 } 159 161 160 162 // .scrolltotop:hover 161 if( $settings['stt_bar_background_color'] != $settings['stt_bar_background_color_on_hover'] ) $scrolltotop_dynamic_css_array['.stt-bar:hover'] = array( 162 'background' => scrolltotop_background_color_format( $settings['stt_bar_background_color_on_hover'] ) 163 ); 163 if ( $settings['stt_bar_background_color'] !== $settings['stt_bar_background_color_on_hover'] ) { 164 $scrolltotop_dynamic_css_array['.stt-bar:hover'] = array( 165 'background' => scrolltotop_background_color_format( $settings['stt_bar_background_color_on_hover'] ) 166 ); 167 } 164 168 165 169 // .scrolltotop b 166 170 $scrolltotop_dynamic_css_array['.stt-bar b'] = array(); 167 if ( (int)$settings['stt_bar_element_position']== 0 ) {168 $scrolltotop_dynamic_css_array['.stt-bar b']['top'] = (int) $settings['stt_bar_text_offset'] . 'px';171 if ( (int) $settings['stt_bar_element_position'] === 0 ) { 172 $scrolltotop_dynamic_css_array['.stt-bar b']['top'] = (int) $settings['stt_bar_text_offset'] . 'px'; 169 173 } else { 170 $scrolltotop_dynamic_css_array['.stt-bar b']['bottom'] = (int) $settings['stt_bar_text_offset'] . 'px';174 $scrolltotop_dynamic_css_array['.stt-bar b']['bottom'] = (int) $settings['stt_bar_text_offset'] . 'px'; 171 175 } 172 176 … … 176 180 ); 177 181 178 if ( (int)$settings['stt_bar_arrow_rotate_speed'] != 0 ) {179 $scrolltotop_dynamic_css_array['.stt-bar i:before']['-webkit-transition'] = 'all ' . ( (int) $settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in';180 $scrolltotop_dynamic_css_array['.stt-bar i:before']['-o-transition'] = 'all ' . ( (int)$settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in';181 $scrolltotop_dynamic_css_array['.stt-bar i:before']['transition'] = 'all ' . ( (int)$settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in';182 if ( (int) $settings['stt_bar_arrow_rotate_speed'] !== 0 ) { 183 $scrolltotop_dynamic_css_array['.stt-bar i:before']['-webkit-transition'] = 'all ' . ( (int) $settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in'; 184 $scrolltotop_dynamic_css_array['.stt-bar i:before']['-o-transition'] = 'all ' . ( (int) $settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in'; 185 $scrolltotop_dynamic_css_array['.stt-bar i:before']['transition'] = 'all ' . ( (int) $settings['stt_bar_arrow_rotate_speed'] ) . 'ms ease-in'; 182 186 } 183 187 184 188 // .scrolltotop i 185 189 $scrolltotop_dynamic_css_array['.stt-bar i'] = array( 186 'display' => ( (int)$settings['stt_bar_caption_position'] == 0 ? 'block' : 'inline' ),187 'font-size' => (int)$settings['stt_bar_arrow_size'] . 'px',188 'line-height' => (int) $settings['stt_bar_arrow_size'] . 'px'190 'display' => ( (int) $settings['stt_bar_caption_position'] === 0 ? 'block' : 'inline' ), 191 'font-size' => (int) $settings['stt_bar_arrow_size'] . 'px', 192 'line-height' => (int) $settings['stt_bar_arrow_size'] . 'px' 189 193 ); 190 194 191 195 // .scrolltotop u 192 196 $scrolltotop_dynamic_css_array['.stt-bar u'] = array( 193 'display' => ( (int)$settings['stt_bar_caption_position'] == 0 ? 'block' : 'inline' ),194 'font-family' => ( $settings['stt_bar_caption_font'] ? $settings['stt_bar_caption_font'] : '"Arial",' . $extra_space . 'sans-serif' ),195 'font-size' => (int)$settings['stt_bar_caption_size'] . 'px',196 'margin-' . ( (int) $settings['stt_bar_caption_position'] == 0 ? 'top' : 'left' ) => ( (int)$settings['stt_bar_text_distance'] ? (int)$settings['stt_bar_text_distance'] . 'px' : 0 )197 'display' => ( (int) $settings['stt_bar_caption_position'] === 0 ? 'block' : 'inline' ), 198 'font-family' => ( $settings['stt_bar_caption_font'] ?: '"Arial",' . $extra_space . 'sans-serif' ), 199 'font-size' => (int) $settings['stt_bar_caption_size'] . 'px', 200 'margin-' . ( (int) $settings['stt_bar_caption_position'] === 0 ? 'top' : 'left' ) => ( (int) $settings['stt_bar_text_distance'] ? (int) $settings['stt_bar_text_distance'] . 'px' : 0 ) 197 201 ); 198 202 199 203 // visible opacity 200 204 $scrolltotop_dynamic_css_array['.stt-bar.stt-visible'] = array( 201 'opacity' => ( (int) $settings['stt_bar_opacity'] / 100 ),205 'opacity' => ( (int) $settings['stt_bar_opacity'] / 100 ), 202 206 ); 203 207 204 208 // animation transition 205 array_push( $scrolltotop_transition_array, 'opacity ' . (int) $settings['stt_bar_fade_duration'] . 'ms ease-in-out', 'visibility ' . (int)$settings['stt_bar_fade_duration'] . 'ms ease-in-out' );209 array_push( $scrolltotop_transition_array, 'opacity ' . (int) $settings['stt_bar_fade_duration'] . 'ms ease-in-out', 'visibility ' . (int) $settings['stt_bar_fade_duration'] . 'ms ease-in-out' ); 206 210 array_push( $scrolltotop_notransition_array, 'opacity 0s', 'visibility 0s' ); 207 211 208 212 // make smaller 209 if ( ! empty( (int)$settings['stt_bar_make_smaller_screen'] ) ) {210 $bar_smaller_key = '@media only screen and (max-width:' . (int) $settings['stt_bar_make_smaller_screen'] . 'px)';211 212 $scrolltotop_dynamic_css_array[ $bar_smaller_key] = array(213 if ( ! empty( (int) $settings['stt_bar_make_smaller_screen'] ) ) { 214 $bar_smaller_key = '@media only screen and (max-width:' . (int) $settings['stt_bar_make_smaller_screen'] . 'px)'; 215 216 $scrolltotop_dynamic_css_array[ $bar_smaller_key ] = array( 213 217 'scrolltotop.stt-bar u' => array( 214 218 'display' => 'none' … … 216 220 ); 217 221 218 if( empty( (int)$settings['stt_bar_sticky'] ) && ! empty( (int)$settings['stt_bar_make_smaller_width'] ) ) $scrolltotop_dynamic_css_array[$bar_smaller_key]['.stt-bar']['width'] = (int)$settings['stt_bar_make_smaller_width'] . 'px'; 222 if ( empty( (int) $settings['stt_bar_sticky'] ) && ! empty( (int) $settings['stt_bar_make_smaller_width'] ) ) { 223 $scrolltotop_dynamic_css_array[ $bar_smaller_key ]['.stt-bar']['width'] = (int) $settings['stt_bar_make_smaller_width'] . 'px'; 224 } 219 225 } 220 226 221 227 // hide 222 if ( ! empty( (int)$settings['stt_bar_hide'] ) ) {223 224 $selector = '@media only screen and (max-width:' . (int)$settings['stt_bar_hide'] . 'px)';225 $scrolltotop_dynamic_css_array[ $selector] = array();226 227 if ( (int)$settings['stt_bar_transform_to_button'] === 1 ) {228 $scrolltotop_dynamic_css_array[ $selector]['.stt-bar'] = array(229 'width' => (int)$settings['stt_bar_transformed_size'] . 'px',230 'height' => (int) $settings['stt_bar_transformed_size'] . 'px',231 'top' => ( (int)$settings['stt_bar_transformed_vertical_position'] === 0 ? ( ! empty( (int)$settings['stt_bar_transformed_vertical_offset'] ) ? (int)$settings['stt_bar_transformed_vertical_offset'] . 'px' : 0 ) : 'auto' ),232 'bottom' => ( (int) $settings['stt_bar_transformed_vertical_position'] === 1 ? ( ! empty( (int)$settings['stt_bar_transformed_vertical_offset'] ) ? (int)$settings['stt_bar_transformed_vertical_offset'] . 'px' : 0 ) : 'auto' ),233 'left' => ( (int)$settings['stt_bar_transformed_horizontal_position'] === 0 ? ( ! empty( (int)$settings['stt_bar_transformed_horizontal_offset'] ) ? (int)$settings['stt_bar_transformed_horizontal_offset'] . 'px' : 0 ) : 'auto' ),234 'right' => ( (int)$settings['stt_bar_transformed_horizontal_position'] === 1 ? ( ! empty( (int)$settings['stt_bar_transformed_horizontal_offset'] ) ? (int)$settings['stt_bar_transformed_horizontal_offset'] . 'px' : 0 ) : 'auto' )235 ); 236 237 if ( ! empty( $settings['stt_bar_transformed_border_radius'] ) ) {238 $scrolltotop_dynamic_css_array[ $selector]['.stt-bar']['border-radius'] = is_numeric( substr( $settings['stt_bar_transformed_border_radius'], -1 ) ) ? (int)$settings['stt_bar_transformed_border_radius'] . 'px' : $settings['stt_bar_transformed_border_radius'];228 if ( ! empty( (int) $settings['stt_bar_hide'] ) ) { 229 230 $selector = '@media only screen and (max-width:' . (int) $settings['stt_bar_hide'] . 'px)'; 231 $scrolltotop_dynamic_css_array[ $selector ] = array(); 232 233 if ( (int) $settings['stt_bar_transform_to_button'] === 1 ) { 234 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar'] = array( 235 'width' => (int) $settings['stt_bar_transformed_size'] . 'px', 236 'height' => (int) $settings['stt_bar_transformed_size'] . 'px', 237 'top' => ( (int) $settings['stt_bar_transformed_vertical_position'] === 0 ? ( ! empty( (int) $settings['stt_bar_transformed_vertical_offset'] ) ? (int) $settings['stt_bar_transformed_vertical_offset'] . 'px' : 0 ) : 'auto' ), 238 'bottom' => ( (int) $settings['stt_bar_transformed_vertical_position'] === 1 ? ( ! empty( (int) $settings['stt_bar_transformed_vertical_offset'] ) ? (int) $settings['stt_bar_transformed_vertical_offset'] . 'px' : 0 ) : 'auto' ), 239 'left' => ( (int) $settings['stt_bar_transformed_horizontal_position'] === 0 ? ( ! empty( (int) $settings['stt_bar_transformed_horizontal_offset'] ) ? (int) $settings['stt_bar_transformed_horizontal_offset'] . 'px' : 0 ) : 'auto' ), 240 'right' => ( (int) $settings['stt_bar_transformed_horizontal_position'] === 1 ? ( ! empty( (int) $settings['stt_bar_transformed_horizontal_offset'] ) ? (int) $settings['stt_bar_transformed_horizontal_offset'] . 'px' : 0 ) : 'auto' ) 241 ); 242 243 if ( ! empty( $settings['stt_bar_transformed_border_radius'] ) ) { 244 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar']['border-radius'] = is_numeric( substr( $settings['stt_bar_transformed_border_radius'], - 1 ) ) ? (int) $settings['stt_bar_transformed_border_radius'] . 'px' : $settings['stt_bar_transformed_border_radius']; 239 245 } 240 241 $scrolltotop_dynamic_css_array[$selector]['.stt-bar b'] = array( 242 ( (int)$settings['stt_bar_element_position'] == 0 ? 'top' : 'bottom' ) => 'auto', 'position' => 'relative' 243 ); 244 245 $scrolltotop_dynamic_css_array[$selector]['.stt-bar i'] = array( 246 'line-height' => (int)$settings['stt_bar_transformed_size'] . 'px' 247 ); 248 249 $scrolltotop_dynamic_css_array[$selector]['.stt-bar u'] = array( 246 247 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar b'] = array( 248 ( (int) $settings['stt_bar_element_position'] == 0 ? 'top' : 'bottom' ) => 'auto', 249 'position' => 'relative' 250 ); 251 252 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar i'] = array( 253 'line-height' => (int) $settings['stt_bar_transformed_size'] . 'px' 254 ); 255 256 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar u'] = array( 250 257 'display' => 'none !important' 251 258 ); 252 259 } else { 253 $scrolltotop_dynamic_css_array[ $selector]['.stt-bar'] = array(260 $scrolltotop_dynamic_css_array[ $selector ]['.stt-bar'] = array( 254 261 'display' => 'none !important' 255 262 ); … … 258 265 259 266 // advanced background 260 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) || ! empty( (int)$settings['stt_advanced_background_sticky'] ) ) {267 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) || ! empty( (int) $settings['stt_advanced_background_sticky'] ) ) { 261 268 $scrolltotop_dynamic_css_array['.stt-bar .stt-advanced-bg'] = array( 262 ( (int) $settings['stt_bar_position'] === 0 ? 'left' : 'right' ) => ( ! empty( (int)$settings['stt_bar_horizontal_offset'] ) ? (int)$settings['stt_bar_horizontal_offset'] . 'px' : 0 )263 ); 264 265 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) && empty( (int)$settings['stt_advanced_background_sticky'] ) ) {266 $scrolltotop_dynamic_css_array['.stt-bar .stt-advanced-bg']['width'] = (int) $settings['stt_advanced_background_width'] . 'px';267 } 268 } 269 } elseif ( (int)$settings['stt_mode'] === 1 ) {269 ( (int) $settings['stt_bar_position'] === 0 ? 'left' : 'right' ) => ( ! empty( (int) $settings['stt_bar_horizontal_offset'] ) ? (int) $settings['stt_bar_horizontal_offset'] . 'px' : 0 ) 270 ); 271 272 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) && empty( (int) $settings['stt_advanced_background_sticky'] ) ) { 273 $scrolltotop_dynamic_css_array['.stt-bar .stt-advanced-bg']['width'] = (int) $settings['stt_advanced_background_width'] . 'px'; 274 } 275 } 276 } elseif ( (int) $settings['stt_mode'] === 1 ) { 270 277 $scrolltotop_dynamic_css_array['.stt-button'] = array( 271 278 'background' => $settings['stt_button_background_color'], 272 'padding' => ( ! empty( (int)$settings['stt_button_padding'] ) ? (int)$settings['stt_button_padding'] . 'px' : 0 ),273 'color' => $settings['stt_button_arrow_color'],274 'font-size' => (int)$settings['stt_button_arrow_size'] . 'px'275 ); 276 277 if ( ! empty( (int)$settings['stt_button_border_radius'] ) ) {278 $scrolltotop_dynamic_css_array['.stt-button']['border-radius'] = is_numeric( substr( $settings['stt_button_border_radius'], - 1 ) ) ? (int)$settings['stt_button_border_radius'] . 'px' : $settings['stt_button_border_radius'];279 } 280 281 if ( (int)$settings['stt_button_position'] === 0 ) {282 $scrolltotop_dynamic_css_array['.stt-button']['left'] = ( ! empty( (int) $settings['stt_button_horizontal_offset'] ) ? (int)$settings['stt_button_horizontal_offset'] . 'px' : 0 );279 'padding' => ( ! empty( (int) $settings['stt_button_padding'] ) ? (int) $settings['stt_button_padding'] . 'px' : 0 ), 280 'color' => $settings['stt_button_arrow_color'], 281 'font-size' => (int) $settings['stt_button_arrow_size'] . 'px' 282 ); 283 284 if ( ! empty( (int) $settings['stt_button_border_radius'] ) ) { 285 $scrolltotop_dynamic_css_array['.stt-button']['border-radius'] = is_numeric( substr( $settings['stt_button_border_radius'], - 1 ) ) ? (int) $settings['stt_button_border_radius'] . 'px' : $settings['stt_button_border_radius']; 286 } 287 288 if ( (int) $settings['stt_button_position'] === 0 ) { 289 $scrolltotop_dynamic_css_array['.stt-button']['left'] = ( ! empty( (int) $settings['stt_button_horizontal_offset'] ) ? (int) $settings['stt_button_horizontal_offset'] . 'px' : 0 ); 283 290 } else { 284 $scrolltotop_dynamic_css_array['.stt-button']['right'] = ( ! empty( (int) $settings['stt_button_horizontal_offset'] ) ? (int)$settings['stt_button_horizontal_offset'] . 'px' : 0 );291 $scrolltotop_dynamic_css_array['.stt-button']['right'] = ( ! empty( (int) $settings['stt_button_horizontal_offset'] ) ? (int) $settings['stt_button_horizontal_offset'] . 'px' : 0 ); 285 292 } 286 293 … … 290 297 ); 291 298 292 if ( ! empty( (int)$settings['stt_button_hover_transition'] ) ) {293 $scrolltotop_transition_array[] = 'background ' . ( (int)$settings['stt_button_hover_transition'] ) . 'ms ease-in-out';294 $scrolltotop_notransition_array[] = 'background ' . ( (int) $settings['stt_button_hover_transition'] ) . 'ms ease-in-out';299 if ( ! empty( (int) $settings['stt_button_hover_transition'] ) ) { 300 $scrolltotop_transition_array[] = 'background ' . ( (int) $settings['stt_button_hover_transition'] ) . 'ms ease-in-out'; 301 $scrolltotop_notransition_array[] = 'background ' . ( (int) $settings['stt_button_hover_transition'] ) . 'ms ease-in-out'; 295 302 } 296 303 297 304 // .scrolltotop:hover 298 if ( $settings['stt_button_background_color'] != $settings['stt_button_background_color_on_hover'] ) {305 if ( $settings['stt_button_background_color'] !== $settings['stt_button_background_color_on_hover'] ) { 299 306 $scrolltotop_dynamic_css_array['.stt-button:hover']['background'] = $settings['stt_button_background_color_on_hover']; 300 307 } 301 308 302 if ( $settings['stt_button_opacity'] != 100 ) {309 if ( (int) $settings['stt_button_opacity'] !== 100 ) { 303 310 $scrolltotop_dynamic_css_array['.stt-button:hover']['opacity'] = 1; 304 311 } 305 312 306 313 // animation 307 if ( isset( $settings['stt_button_animation'] ) && (int)$settings['stt_button_animation'] > 0 ) {308 if ( (int)$settings['stt_button_animation'] === 1 ) {309 $scrolltotop_dynamic_css_array['.stt-button']['opacity'] = ( (int) $settings['stt_button_opacity'] / 100 );314 if ( isset( $settings['stt_button_animation'] ) && (int) $settings['stt_button_animation'] > 0 ) { 315 if ( (int) $settings['stt_button_animation'] === 1 ) { 316 $scrolltotop_dynamic_css_array['.stt-button']['opacity'] = ( (int) $settings['stt_button_opacity'] / 100 ); 310 317 311 318 $scrolltotop_dynamic_css_array['.stt-visible'] = array( 312 'bottom' => ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int)$settings['stt_button_vertical_offset'] . 'px' : 0 )319 'bottom' => ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int) $settings['stt_button_vertical_offset'] . 'px' : 0 ) 313 320 ); 314 321 315 322 $scrolltotop_dynamic_css_array['.stt-hidden'] = array( 316 'bottom' => ( (int) $settings['stt_button_vertical_offset'] - 100 ) . 'px'317 ); 318 319 $scrolltotop_transition_array[] = 'bottom ' . (int)$settings['stt_button_animation_speed'] . 'ms ease-in-out';323 'bottom' => ( (int) $settings['stt_button_vertical_offset'] - 100 ) . 'px' 324 ); 325 326 $scrolltotop_transition_array[] = 'bottom ' . (int) $settings['stt_button_animation_speed'] . 'ms ease-in-out'; 320 327 $scrolltotop_notransition_array[] = 'bottom 0s'; 321 } else if ( (int)$settings['stt_button_animation']== 2 ) {322 $scrolltotop_dynamic_css_array['.stt-button']['bottom'] = ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int)$settings['stt_button_vertical_offset'] . 'px' : 0 );328 } else if ( (int) $settings['stt_button_animation'] === 2 ) { 329 $scrolltotop_dynamic_css_array['.stt-button']['bottom'] = ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int) $settings['stt_button_vertical_offset'] . 'px' : 0 ); 323 330 324 331 $scrolltotop_dynamic_css_array['.stt-visible'] = array( 325 332 'visibility' => 'visible', 326 'opacity' => ( (int)$settings['stt_button_opacity'] / 100 )333 'opacity' => ( (int) $settings['stt_button_opacity'] / 100 ) 327 334 ); 328 335 329 336 $scrolltotop_dynamic_css_array['.stt-hidden'] = array( 330 337 'visibility' => 'hidden', 331 'opacity' => '0 !important'332 ); 333 334 array_push( $scrolltotop_transition_array, 'opacity ' . (int) $settings['stt_button_animation_speed'] . 'ms ease-in-out', 'visibility ' . (int)$settings['stt_button_animation_speed'] . 'ms ease-in-out' );338 'opacity' => '0 !important' 339 ); 340 341 array_push( $scrolltotop_transition_array, 'opacity ' . (int) $settings['stt_button_animation_speed'] . 'ms ease-in-out', 'visibility ' . (int) $settings['stt_button_animation_speed'] . 'ms ease-in-out' ); 335 342 336 343 array_push( $scrolltotop_notransition_array, 'opacity 0s', 'visibility 0s' ); 337 344 } 338 345 } else { 339 $scrolltotop_dynamic_css_array['.stt-button']['bottom'] = ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int)$settings['stt_button_vertical_offset'] . 'px' : 0 );346 $scrolltotop_dynamic_css_array['.stt-button']['bottom'] = ( ! empty( (int) $settings['stt_button_vertical_offset'] ) ? (int) $settings['stt_button_vertical_offset'] . 'px' : 0 ); 340 347 341 348 $scrolltotop_dynamic_css_array['.stt-visible'] = array( … … 349 356 350 357 // make smaller 351 if( ! empty( (int)$settings['stt_button_make_smaller_screen'] ) && ! empty( (int)$settings['stt_button_make_smaller_padding'] ) || ! empty( (int)$settings['stt_button_make_smaller_arrow_size'] ) ) { 352 $button_smaller_key = '@media only screen and (max-width:' . (int)$settings['stt_button_make_smaller_screen'] . 'px)'; 353 354 if( ! empty( (int)$settings['stt_button_make_smaller_padding'] ) ) $scrolltotop_dynamic_css_array[$button_smaller_key]['.stt-button']['padding'] = ( (int)$settings['stt_button_make_smaller_padding'] > 0 ? (int)$settings['stt_button_make_smaller_padding'] . 'px' : 0 ); 355 356 if( ! empty( (int)$settings['stt_button_make_smaller_arrow_size'] ) ) $scrolltotop_dynamic_css_array[$button_smaller_key]['.stt-button']['font-size'] = ( (int)$settings['stt_button_make_smaller_arrow_size'] > 0 ? (int)$settings['stt_button_make_smaller_arrow_size'] . 'px' : 0 ); 358 if ( ( ! empty( (int) $settings['stt_button_make_smaller_screen'] ) && ! empty( (int) $settings['stt_button_make_smaller_padding'] ) ) || ! empty( (int) $settings['stt_button_make_smaller_arrow_size'] ) ) { 359 $button_smaller_key = '@media only screen and (max-width:' . (int) $settings['stt_button_make_smaller_screen'] . 'px)'; 360 361 if ( ! empty( (int) $settings['stt_button_make_smaller_padding'] ) ) { 362 $scrolltotop_dynamic_css_array[ $button_smaller_key ]['.stt-button']['padding'] = ( (int) $settings['stt_button_make_smaller_padding'] > 0 ? (int) $settings['stt_button_make_smaller_padding'] . 'px' : 0 ); 363 } 364 365 if ( ! empty( (int) $settings['stt_button_make_smaller_arrow_size'] ) ) { 366 $scrolltotop_dynamic_css_array[ $button_smaller_key ]['.stt-button']['font-size'] = ( (int) $settings['stt_button_make_smaller_arrow_size'] > 0 ? (int) $settings['stt_button_make_smaller_arrow_size'] . 'px' : 0 ); 367 } 357 368 } 358 369 359 370 // hide 360 if ( ! empty( (int)$settings['stt_button_hide'] ) ) {361 $scrolltotop_dynamic_css_array[ '@media only screen and (max-width:' . (int)$settings['stt_button_hide'] . 'px)'] = array(371 if ( ! empty( (int) $settings['stt_button_hide'] ) ) { 372 $scrolltotop_dynamic_css_array[ '@media only screen and (max-width:' . (int) $settings['stt_button_hide'] . 'px)' ] = array( 362 373 'scrolltotop.stt-button' => array( 363 374 'display' => 'none !important' … … 367 378 368 379 // advanced background 369 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) || ! empty( (int)$settings['stt_advanced_background_sticky'] ) ) {380 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) || ! empty( (int) $settings['stt_advanced_background_sticky'] ) ) { 370 381 $scrolltotop_dynamic_css_array['.stt-button .stt-advanced-bg'] = array( 371 ( (int) $settings['stt_button_position'] === 0 ? 'left' : 'right' ) => 0372 ); 373 374 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) && empty( (int)$settings['stt_advanced_background_sticky'] ) ) {375 $scrolltotop_dynamic_css_array['.stt-button .stt-advanced-bg']['width'] = (int) $settings['stt_advanced_background_width'] . 'px';382 ( (int) $settings['stt_button_position'] === 0 ? 'left' : 'right' ) => 0 383 ); 384 385 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) && empty( (int) $settings['stt_advanced_background_sticky'] ) ) { 386 $scrolltotop_dynamic_css_array['.stt-button .stt-advanced-bg']['width'] = (int) $settings['stt_advanced_background_width'] . 'px'; 376 387 } 377 388 } … … 379 390 380 391 // transition 381 if ( ! empty( $scrolltotop_transition_array ) ) {382 $transition = implode( ',' . $extra_space, $scrolltotop_transition_array );392 if ( ! empty( $scrolltotop_transition_array ) ) { 393 $transition = implode( ',' . $extra_space, $scrolltotop_transition_array ); 383 394 $scrolltotop_dynamic_css_array['']['-webkit-transition'] = $transition; 384 $scrolltotop_dynamic_css_array['']['-o-transition'] = $transition;385 $scrolltotop_dynamic_css_array['']['transition'] = $transition;386 } 387 388 if ( ! empty( $scrolltotop_notransition_array ) ) {389 $transition = implode( ',' . $extra_space, $scrolltotop_notransition_array );395 $scrolltotop_dynamic_css_array['']['-o-transition'] = $transition; 396 $scrolltotop_dynamic_css_array['']['transition'] = $transition; 397 } 398 399 if ( ! empty( $scrolltotop_notransition_array ) ) { 400 $transition = implode( ',' . $extra_space, $scrolltotop_notransition_array ); 390 401 $scrolltotop_dynamic_css_array['.stt-notransition']['-webkit-transition'] = $transition; 391 $scrolltotop_dynamic_css_array['.stt-notransition']['-o-transition'] = $transition;392 $scrolltotop_dynamic_css_array['.stt-notransition']['transition'] = $transition;402 $scrolltotop_dynamic_css_array['.stt-notransition']['-o-transition'] = $transition; 403 $scrolltotop_dynamic_css_array['.stt-notransition']['transition'] = $transition; 393 404 } 394 405 395 406 // advanced bg hide 396 if ( ! empty( (int)$settings['stt_advanced_background_width'] ) || (int)$settings['stt_advanced_background_sticky'] && ! empty( (int)$settings['stt_advanced_background_hide']) ) {397 $scrolltotop_dynamic_css_array[ '@media only screen and (max-width:' . (int)$settings['stt_advanced_background_hide'] . 'px)']['scrolltotop .stt-advanced-bg'] = array(407 if ( ! empty( (int) $settings['stt_advanced_background_width'] ) || ( (int) $settings['stt_advanced_background_sticky'] && ! empty( (int) $settings['stt_advanced_background_hide'] ) ) ) { 408 $scrolltotop_dynamic_css_array[ '@media only screen and (max-width:' . (int) $settings['stt_advanced_background_hide'] . 'px)' ]['scrolltotop .stt-advanced-bg'] = array( 398 409 'display' => 'none !important' 399 410 ); … … 402 413 $scrolltotop_dynamic_css_array = apply_filters( 'scrolltotop_dynamic_css', $scrolltotop_dynamic_css_array ); 403 414 404 foreach ( $scrolltotop_dynamic_css_array as $class => $styles ) {405 if ( substr( $class, 0, 1 ) !== '@' ) {415 foreach ( $scrolltotop_dynamic_css_array as $class => $styles ) { 416 if ( substr( $class, 0, 1 ) !== '@' ) { 406 417 $scrolltotop_dynamic_css .= '#scrollToTop' . $class . $extra_space . '{'; 407 418 408 foreach ( $styles as $style => $value ) {419 foreach ( $styles as $style => $value ) { 409 420 $scrolltotop_dynamic_css .= $newline_with_space . $style . ':' . $extra_space . $value . ';'; 410 421 } … … 413 424 } else { 414 425 $scrolltotop_dynamic_css .= $class . $extra_space . '{'; 415 foreach ( $styles as $style => $value ) {416 $scrolltotop_dynamic_css .= $newline_with_space . '#scrollToTop' . $style . $extra_space . '{' . $newline_with_space_x2;417 418 foreach ( $value as $style_class => $style_value ) {426 foreach ( $styles as $style => $value ) { 427 $scrolltotop_dynamic_css .= $newline_with_space . '#scrollToTop' . $style . $extra_space . '{' . $newline_with_space_x2; 428 429 foreach ( $value as $style_class => $style_value ) { 419 430 $scrolltotop_dynamic_css .= $style_class . ':' . $extra_space . $style_value . ';'; 420 431 } … … 430 441 431 442 // user custom css 432 if ( ! empty( $settings['stt_custom_css'] ) && apply_filters( 'stt_custom_css', true ) ) {443 if ( ! empty( $settings['stt_custom_css'] ) && apply_filters( 'stt_custom_css', true ) ) { 433 444 $custom_css = $settings['stt_custom_css']; 434 445 … … 436 447 $minify_custom_css = apply_filters( 'scrolltotop_minify_custom_css', true ); 437 448 438 if ( $minify_css && $minify_custom_css ) {449 if ( $minify_css && $minify_custom_css ) { 439 450 $custom_css = str_replace( array( 440 451 "\n", 441 452 "\r" 442 ) , '', $custom_css );453 ), '', $custom_css ); 443 454 $custom_css = preg_replace( '!\s+!', ' ', $custom_css ); 444 455 $custom_css = str_replace( array( … … 447 458 '{ ', 448 459 '; ' 449 ) , array(460 ), array( 450 461 '{', 451 462 '}', 452 463 '{', 453 464 ';' 454 ) , $custom_css ); 455 } 456 457 if( isset( $custom_css ) ) $scrolltotop_dynamic_css .= $custom_css; 458 } 459 465 ), $custom_css ); 466 } 467 468 if ( isset( $custom_css ) ) { 469 $scrolltotop_dynamic_css .= $custom_css; 470 } 471 } 472 460 473 set_transient( 'scrolltotop_dynamic_css', $scrolltotop_dynamic_css ); 461 474 } … … 463 476 wp_add_inline_style( 'scrolltotop', $scrolltotop_dynamic_css ); 464 477 } 465 }478 } 466 479 } 467 480 468 481 function scrolltotop_background_color_format( $color = '' ) { 469 if ( ! $color || strpos( $color, ',0 )' ) ) {482 if ( ! $color || strpos( $color, ',0 )' ) ) { 470 483 $color = 'transparent'; 471 484 } 472 485 473 486 return $color; 474 487 } … … 477 490 function scrolltotop_container() { 478 491 $container = ''; 479 492 480 493 // plugin URL 481 494 $show_plugin_link = apply_filters( 'scrolltotop_link_output', true ); 482 495 483 496 // scroll to top container 484 $settings = scrolltotop_get_plugin_settings();485 486 if ( $show_plugin_link ) {497 $settings = scrolltotop_get_plugin_settings(); 498 499 if ( $show_plugin_link ) { 487 500 global $global_scrolltotop_version; 488 489 $container .= PHP_EOL . '<!-- ' . sprintf( esc_html__( 'Do you want the same scroll up %s on your WordPress blog? This site uses free scrollToTop plugin', 'scrolltotop' ), ( (int)$settings['stt_mode'] === 0 ? esc_html__( 'bar', 'scrolltotop' ) : esc_html__( 'button', 'scrolltotop' ) ) ) . ' v' . $global_scrolltotop_version . ' - https://wordpress.org/plugins/scrolltotop/ -->' . PHP_EOL;490 } 491 492 $container .= '<div id="scrollToTop" class="scrolltotop stt-' . ( (int)$settings['stt_mode'] === 0 ? 'bar' : 'button' ) . (is_admin_bar_showing() ? ' stt-admin-bar' : '' ) . ( (int)$settings['stt_mode'] == 0 && (int)$settings['stt_bar_animation_on_load'] === 1 || (int)$settings['stt_mode'] === 1 && (int)$settings['stt_button_animation_on_load'] === 1 ? ' stt-notransition' : '' ) . ' stt-hidden">' . ( (int)$settings['stt_mode'] == 0 ? '<b>' : '' ) . '<i class="icon-up"></i>' . ( $settings['stt_bar_text'] && (int)$settings['stt_mode'] == 0 ? '<u>' . $settings['stt_bar_text'] . '</u>' : '' ) . ( (int)$settings['stt_mode'] == 0 ? '</b>' : '' ) . ( ! empty( (int)$settings['stt_advanced_background_width'] ) || (int)$settings['stt_advanced_background_sticky'] ? '<div class="stt-advanced-bg"></div>' : '' ) . '</div>' . PHP_EOL;493 494 echo apply_filters( 'scrolltotop_container_output', $container );495 501 502 $container .= PHP_EOL . '<!-- ' . sprintf( esc_html__( 'Do you want the same scroll up %s on your WordPress site? This site uses free scrollToTop plugin', 'scrolltotop' ), ( (int) $settings['stt_mode'] === 0 ? esc_html__( 'bar', 'scrolltotop' ) : esc_html__( 'button', 'scrolltotop' ) ) ) . ' v' . $global_scrolltotop_version . ' - https://wordpress.org/plugins/scrolltotop/ -->' . PHP_EOL; 503 } 504 505 $container .= '<div id="scrollToTop" class="scrolltotop stt-' . ( (int) $settings['stt_mode'] === 0 ? 'bar' : 'button' ) . ( is_admin_bar_showing() ? ' stt-admin-bar' : '' ) . ( ( (int) $settings['stt_mode'] === 0 && (int) $settings['stt_bar_animation_on_load'] === 1 ) || ( (int) $settings['stt_mode'] === 1 && (int) $settings['stt_button_animation_on_load'] === 1 ) ? ' stt-notransition' : '' ) . ' stt-hidden">' . ( (int) $settings['stt_mode'] === 0 ? '<b>' : '' ) . '<i class="icon-up"></i>' . ( $settings['stt_bar_text'] && (int) $settings['stt_mode'] === 0 ? '<u>' . $settings['stt_bar_text'] . '</u>' : '' ) . ( (int) $settings['stt_mode'] === 0 ? '</b>' : '' ) . ( ! empty( (int) $settings['stt_advanced_background_width'] ) || (int) $settings['stt_advanced_background_sticky'] ? '<div class="stt-advanced-bg"></div>' : '' ) . '</div>' . PHP_EOL; 506 507 echo apply_filters( 'scrolltotop_container_output', $container ); 508 496 509 } 497 510 498 511 add_filter( 'script_loader_tag', 'scrolltotop_async_load', 10, 2 ); 499 512 function scrolltotop_async_load( $tag, $handle ) { 500 $settings = scrolltotop_get_plugin_settings( 'stt_script_loading' ); 501 502 if( ! empty( $settings ) && $handle == 'scrolltotop' && ! is_admin() ) { 503 if( $settings == 1 ) { 504 return str_replace( ' src', ' async src', $tag ); 505 } elseif( $settings == 2 ) { 506 return str_replace( ' src', ' defer src', $tag ); 507 } 508 } 509 510 return $tag; 513 $settings = scrolltotop_get_plugin_settings( 'stt_script_loading' ); 514 515 if ( ! empty( $settings ) && $handle === 'scrolltotop' && ! is_admin() ) { 516 if ( (int) $settings === 1 ) { 517 return str_replace( ' src', ' async src', $tag ); 518 } 519 520 if ( (int) $settings === 2 ) { 521 return str_replace( ' src', ' defer src', $tag ); 522 } 523 } 524 525 return $tag; 511 526 } 512 527 513 528 add_filter( 'plugin_action_links_' . $global_scrolltotop_base, 'scrolltotop_settings_link' ); 514 529 function scrolltotop_settings_link( $links ) { 515 $page = '<a href="' . admin_url( 'options-general.php?page=scrolltotop_settings_page' ) . '">' . esc_html__( 'Settings', 'scrolltotop' ) . '</a>'; 516 517 array_unshift( $links, $page ); 518 return $links; 519 } 530 $page = '<a href="' . admin_url( 'options-general.php?page=scrolltotop_settings_page' ) . '">' . esc_html__( 'Settings', 'scrolltotop' ) . '</a>'; 531 532 array_unshift( $links, $page ); 533 534 return $links; 535 } -
scrolltotop/trunk/uninstall.php
r2188887 r2309158 1 1 <?php 2 if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) 2 3 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 3 4 exit(); 5 } 4 6 5 7 delete_option( 'scrolltotop_plugin_settings' );
Note: See TracChangeset
for help on using the changeset viewer.