Version Description
- Adds support for an optional display timeout
- Adds min/max browser resolutions
- Adds foreground hover color
- Adds contextual help menu
- Adds settings link from plugin page
- Updated font-awesome version to v4.1.0
- Updated options/settings to persist after deactivating/activating the plugin.
Download this release
Release Info
Developer | joesexton00 |
Plugin | Scroll Back To Top |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0 to 1.1
- assets/js/scroll-back-to-top.js +9 -0
- controller/SBTT_AdminMenuController.php +146 -3
- controller/SBTT_FrontendController.php +40 -1
- framework/JmsAdminSettingsPage.php +49 -4
- framework/JmsBootstrap.php +3 -0
- framework/JmsController.php +3 -0
- framework/JmsUserOptionsCollection.php +20 -1
- framework/readme.md +4 -3
- model/SBTT_Options.php +45 -3
- readme.txt +11 -1
- assets/screenshot-1.png → screenshot-1.png +0 -0
- assets/screenshot-2.png → screenshot-2.png +0 -0
- assets/screenshot-3.png → screenshot-3.png +0 -0
- assets/screenshot-4.png → screenshot-4.png +0 -0
- assets/screenshot-5.png → screenshot-5.png +0 -0
- scroll-back-to-top.php +2 -1
- view/dynamic-styles.php +17 -1
- view/help/advanced.php +22 -0
- view/help/animation.php +17 -0
- view/help/appearance.php +27 -0
- view/help/label.php +34 -0
- view/help/location.php +29 -0
- view/help/overview.php +12 -0
- view/help/troubleshooting.php +32 -0
- view/help/visibility.php +17 -0
assets/js/scroll-back-to-top.js
CHANGED
@@ -19,6 +19,15 @@
|
|
19 |
$('.scroll-back-to-top-wrapper').removeClass('show');
|
20 |
}
|
21 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
});
|
23 |
|
24 |
function scrollToElement(selector, time, verticalOffset) {
|
19 |
$('.scroll-back-to-top-wrapper').removeClass('show');
|
20 |
}
|
21 |
});
|
22 |
+
|
23 |
+
if(typeof scrollBackToTop.visibilityDuration !== 'undefined' && scrollBackToTop.visibilityDuration){
|
24 |
+
$(window).on('scroll', function() {
|
25 |
+
clearTimeout($.data(this, 'sbttScrollTimer'));
|
26 |
+
$.data(this, 'sbttScrollTimer', setTimeout(function() {
|
27 |
+
$('.scroll-back-to-top-wrapper').removeClass('show');
|
28 |
+
}, scrollBackToTop.visibilityDuration));
|
29 |
+
});
|
30 |
+
}
|
31 |
});
|
32 |
|
33 |
function scrollToElement(selector, time, verticalOffset) {
|
controller/SBTT_AdminMenuController.php
CHANGED
@@ -5,14 +5,21 @@
|
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
|
|
|
|
|
|
|
|
8 |
*/
|
9 |
if ( !class_exists( 'SBTT_AdminMenuController' ) ){
|
10 |
class SBTT_AdminMenuController extends JmsAdminSettingsPage {
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
* register Wordpress actions and filters
|
14 |
*/
|
15 |
protected function _init() {
|
|
|
16 |
|
17 |
$options = new SBTT_Options();
|
18 |
$this->addOptionsPage(
|
@@ -20,7 +27,49 @@ class SBTT_AdminMenuController extends JmsAdminSettingsPage {
|
|
20 |
__( 'Scroll Back to Top', $this->textDomain() ),
|
21 |
$options
|
22 |
);
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
/**
|
26 |
* enqueue admin scripts
|
@@ -34,7 +83,7 @@ class SBTT_AdminMenuController extends JmsAdminSettingsPage {
|
|
34 |
* enqueue admin styles
|
35 |
*/
|
36 |
public function enqueueAdminStyles() {
|
37 |
-
$this->enqueueCdnStyle( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0
|
38 |
}
|
39 |
|
40 |
/**
|
@@ -42,7 +91,101 @@ class SBTT_AdminMenuController extends JmsAdminSettingsPage {
|
|
42 |
*/
|
43 |
public function onActivation() {
|
44 |
|
45 |
-
$this->options->
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
}
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
8 |
+
* @version 1.1
|
9 |
+
* @uses JmsController
|
10 |
+
* @uses JmsAdminSettingsPage
|
11 |
+
* @uses JmsUserOptionsCollection
|
12 |
*/
|
13 |
if ( !class_exists( 'SBTT_AdminMenuController' ) ){
|
14 |
class SBTT_AdminMenuController extends JmsAdminSettingsPage {
|
15 |
|
16 |
+
const VERSION = 1.1;
|
17 |
+
|
18 |
/**
|
19 |
* register Wordpress actions and filters
|
20 |
*/
|
21 |
protected function _init() {
|
22 |
+
$this->_upgrade();
|
23 |
|
24 |
$options = new SBTT_Options();
|
25 |
$this->addOptionsPage(
|
27 |
__( 'Scroll Back to Top', $this->textDomain() ),
|
28 |
$options
|
29 |
);
|
30 |
+
|
31 |
+
// activate plugin page extra links
|
32 |
+
add_filter("plugin_action_links_{$this->pluginBase}", array( $this, 'activatePluginPageLinksNameSection' ) );
|
33 |
+
add_filter('plugin_row_meta', array($this, 'activatePluginPageLinksDescriptionSection'),10,2);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Plugin upgrader
|
38 |
+
*/
|
39 |
+
protected function _upgrade() {
|
40 |
+
$options = new SBTT_Options();
|
41 |
+
$options->initOptions();
|
42 |
+
$defaults = $options->defaultOptions();
|
43 |
+
|
44 |
+
$key = $options->optionsKey();
|
45 |
+
$wp_option = get_option( $key, array() );
|
46 |
+
|
47 |
+
// v1.1 adds a few new options to the settings menu, init the default values.
|
48 |
+
if (
|
49 |
+
( isset($wp_option[SBTT_Options::VERSION_KEY] ) && $wp_option[SBTT_Options::VERSION_KEY] < 1.1 ) ||
|
50 |
+
!isset( $wp_option[SBTT_Options::VERSION_KEY] )
|
51 |
+
) {
|
52 |
+
|
53 |
+
$wp_option[SBTT_Options::VERSION_KEY] = static::VERSION;
|
54 |
+
|
55 |
+
if ( !isset( $wp_option['min_resolution'] ) ) {
|
56 |
+
$wp_option['min_resolution'] = $defaults['min_resolution'] ?: 0;
|
57 |
+
}
|
58 |
+
if ( !isset( $wp_option['max_resolution'] ) ) {
|
59 |
+
$wp_option['max_resolution'] = $defaults['max_resolution'] ?: 9999;
|
60 |
+
}
|
61 |
+
if ( !isset( $wp_option['visibility_duration'] ) ) {
|
62 |
+
$wp_option['visibility_duration'] = $defaults['visibility_duration'] ?: 0;
|
63 |
+
}
|
64 |
+
if ( !isset( $wp_option['color_foreground_hover'] ) && isset( $wp_option['color_foreground'] ) ) {
|
65 |
+
$wp_option['color_foreground_hover'] = $wp_option['color_foreground'];
|
66 |
+
} elseif ( !isset( $wp_option['color_foreground_hover'] ) ) {
|
67 |
+
$wp_option['color_foreground_hover'] = $defaults['color_foreground_hover'] ?: '#eeeeee';
|
68 |
+
}
|
69 |
+
|
70 |
+
update_option($key, $wp_option);
|
71 |
+
}
|
72 |
+
}
|
73 |
|
74 |
/**
|
75 |
* enqueue admin scripts
|
83 |
* enqueue admin styles
|
84 |
*/
|
85 |
public function enqueueAdminStyles() {
|
86 |
+
$this->enqueueCdnStyle( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css' );
|
87 |
}
|
88 |
|
89 |
/**
|
91 |
*/
|
92 |
public function onActivation() {
|
93 |
|
94 |
+
$this->options->initOptions();
|
95 |
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Add links to plugin page plugin area
|
99 |
+
*
|
100 |
+
* @param array $links
|
101 |
+
* Links.
|
102 |
+
*
|
103 |
+
* @return array
|
104 |
+
*/
|
105 |
+
public function activatePluginPageLinksNameSection( $links ) {
|
106 |
+
|
107 |
+
$settings_links = array(
|
108 |
+
"<a href='options-general.php?page={$this->pluginSlug}'>" . __( 'Settings', $this->textDomain() ) . "</a>"
|
109 |
+
);
|
110 |
+
$links = array_merge($links, $settings_links);
|
111 |
+
|
112 |
+
return $links;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Add links to plugin page description area
|
117 |
+
*
|
118 |
+
* @param array $links
|
119 |
+
* @param string $file
|
120 |
+
* @return array
|
121 |
+
*/
|
122 |
+
public function activatePluginPageLinksDescriptionSection( $links, $file ) {
|
123 |
+
|
124 |
+
if ( $file == $this->pluginBase ) {
|
125 |
+
$links[] = '<a href="http://www.webtipblog.com/scroll-back-top-wordpress-plugin-button-designs/" target="_blank">' . __( 'Design Inspiration', $this->textDomain() ) . '</a>';
|
126 |
+
$links[] = '<a href="https://wordpress.org/plugins/scroll-back-to-top/" target="_blank">' . __( 'Wordpress Plugin Page', $this->textDomain() ) . '</a>';
|
127 |
+
}
|
128 |
+
|
129 |
+
return $links;
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Render contextual help menu for an admin page
|
134 |
+
*
|
135 |
+
* @param WP_Screen $screen
|
136 |
+
* @return string
|
137 |
+
*/
|
138 |
+
protected function _renderContextualHelp(WP_Screen $screen) {
|
139 |
+
|
140 |
+
$screen->add_help_tab( array(
|
141 |
+
'id' => 'overview',
|
142 |
+
'title' => __( 'Overview', $this->textDomain() ),
|
143 |
+
'content' => $this->render('help:overview', array(), false),
|
144 |
+
) );
|
145 |
+
|
146 |
+
$screen->add_help_tab( array(
|
147 |
+
'id' => 'visibility',
|
148 |
+
'title' => __( 'Visibility', $this->textDomain() ),
|
149 |
+
'content' => $this->render('help:visibility', array(), false),
|
150 |
+
) );
|
151 |
+
|
152 |
+
$screen->add_help_tab( array(
|
153 |
+
'id' => 'appearance',
|
154 |
+
'title' => __( 'Button Appearance', $this->textDomain() ),
|
155 |
+
'content' => $this->render('help:appearance', array(), false),
|
156 |
+
) );
|
157 |
+
|
158 |
+
$screen->add_help_tab( array(
|
159 |
+
'id' => 'location',
|
160 |
+
'title' => __( 'Button Location', $this->textDomain() ),
|
161 |
+
'content' => $this->render('help:location', array(), false),
|
162 |
+
) );
|
163 |
+
|
164 |
+
$screen->add_help_tab( array(
|
165 |
+
'id' => 'label',
|
166 |
+
'title' => __( 'Button Label', $this->textDomain() ),
|
167 |
+
'content' => $this->render('help:label', array(), false),
|
168 |
+
) );
|
169 |
+
|
170 |
+
$screen->add_help_tab( array(
|
171 |
+
'id' => 'animation',
|
172 |
+
'title' => __( 'Animation Options', $this->textDomain() ),
|
173 |
+
'content' => $this->render('help:animation', array(), false),
|
174 |
+
) );
|
175 |
+
|
176 |
+
$screen->add_help_tab( array(
|
177 |
+
'id' => 'advanced',
|
178 |
+
'title' => __( 'Advanced Options', $this->textDomain() ),
|
179 |
+
'content' => $this->render('help:advanced', array(), false),
|
180 |
+
) );
|
181 |
+
|
182 |
+
$screen->add_help_tab( array(
|
183 |
+
'id' => 'troubleshooting',
|
184 |
+
'title' => __( 'Troubleshooting', $this->textDomain() ),
|
185 |
+
'content' => $this->render('help:troubleshooting', array(), false),
|
186 |
+
) );
|
187 |
+
|
188 |
+
return '';
|
189 |
+
}
|
190 |
}
|
191 |
}
|
controller/SBTT_FrontendController.php
CHANGED
@@ -5,10 +5,15 @@
|
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
|
|
|
|
|
|
8 |
*/
|
9 |
if ( !class_exists( 'SBTT_FrontEndController' ) ){
|
10 |
class SBTT_FrontEndController extends JmsController {
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
* @var array
|
14 |
*/
|
@@ -55,6 +60,10 @@ class SBTT_FrontEndController extends JmsController {
|
|
55 |
$vars['scrollBackToTop']['fadeDuration'] = $this->args['fade_duration'];
|
56 |
}
|
57 |
|
|
|
|
|
|
|
|
|
58 |
// load textfill js only if using auto font sizing
|
59 |
if ( isset($this->args['label_type']) && isset($this->args['font_size']) && $this->args['font_size'] == '0px' ) {
|
60 |
$this->enqueueCdnScript('text-fill', 'http://jquery-textfill.github.io/jquery-textfill/jquery.textfill.min.js' );
|
@@ -78,7 +87,7 @@ class SBTT_FrontEndController extends JmsController {
|
|
78 |
|
79 |
// Only need the font pack if using icons, not text
|
80 |
if ( isset( $this->args['label_type'] ) && $this->args['label_type'] != 'text' ) {
|
81 |
-
$this->enqueueCdnStyle( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0
|
82 |
}
|
83 |
}
|
84 |
|
@@ -126,6 +135,8 @@ class SBTT_FrontEndController extends JmsController {
|
|
126 |
protected function _preprocessArgs() {
|
127 |
|
128 |
$this->_processFade();
|
|
|
|
|
129 |
$this->_processHorizontalAlignment();
|
130 |
$this->_processVerticalAlignment();
|
131 |
$this->_processVerticalAlignment();
|
@@ -145,6 +156,34 @@ class SBTT_FrontEndController extends JmsController {
|
|
145 |
}
|
146 |
}
|
147 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
/**
|
149 |
* Process horizontal alignment
|
150 |
*/
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
8 |
+
* @version 1.1
|
9 |
+
* @uses SBTT_Options
|
10 |
+
* @uses JmsController
|
11 |
*/
|
12 |
if ( !class_exists( 'SBTT_FrontEndController' ) ){
|
13 |
class SBTT_FrontEndController extends JmsController {
|
14 |
|
15 |
+
const VERSION = 1.1;
|
16 |
+
|
17 |
/**
|
18 |
* @var array
|
19 |
*/
|
60 |
$vars['scrollBackToTop']['fadeDuration'] = $this->args['fade_duration'];
|
61 |
}
|
62 |
|
63 |
+
if ( isset($this->args['visibility_duration']) ) {
|
64 |
+
$vars['scrollBackToTop']['visibilityDuration'] = $this->args['visibility_duration'];
|
65 |
+
}
|
66 |
+
|
67 |
// load textfill js only if using auto font sizing
|
68 |
if ( isset($this->args['label_type']) && isset($this->args['font_size']) && $this->args['font_size'] == '0px' ) {
|
69 |
$this->enqueueCdnScript('text-fill', 'http://jquery-textfill.github.io/jquery-textfill/jquery.textfill.min.js' );
|
87 |
|
88 |
// Only need the font pack if using icons, not text
|
89 |
if ( isset( $this->args['label_type'] ) && $this->args['label_type'] != 'text' ) {
|
90 |
+
$this->enqueueCdnStyle( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.css' );
|
91 |
}
|
92 |
}
|
93 |
|
135 |
protected function _preprocessArgs() {
|
136 |
|
137 |
$this->_processFade();
|
138 |
+
$this->_processVisibilityDuration();
|
139 |
+
$this->_processBrowserResolutions();
|
140 |
$this->_processHorizontalAlignment();
|
141 |
$this->_processVerticalAlignment();
|
142 |
$this->_processVerticalAlignment();
|
156 |
}
|
157 |
}
|
158 |
|
159 |
+
/**
|
160 |
+
* Process visibility duration
|
161 |
+
*/
|
162 |
+
protected function _processVisibilityDuration(){
|
163 |
+
|
164 |
+
if ( !isset( $this->args['visibility_duration'] ) || $this->args['visibility_duration'] < 1 ) {
|
165 |
+
unset( $this->args['visibility_duration'] );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* Process browser resolutions
|
171 |
+
*/
|
172 |
+
protected function _processBrowserResolutions(){
|
173 |
+
|
174 |
+
if ( isset( $this->args['min_resolution'] ) && is_int( $this->args['min_resolution'] ) && $this->args['min_resolution'] > 0 ) {
|
175 |
+
$this->args['min_resolution'] = $this->args['min_resolution'] . 'px';
|
176 |
+
} else {
|
177 |
+
unset( $this->args['min_resolution'] );
|
178 |
+
}
|
179 |
+
|
180 |
+
if ( isset( $this->args['max_resolution'] ) && is_int( $this->args['max_resolution'] ) && $this->args['max_resolution'] < 9999 ) {
|
181 |
+
$this->args['max_resolution'] = $this->args['max_resolution'] . 'px';
|
182 |
+
} else {
|
183 |
+
unset( $this->args['max_resolution'] );
|
184 |
+
}
|
185 |
+
}
|
186 |
+
|
187 |
/**
|
188 |
* Process horizontal alignment
|
189 |
*/
|
framework/JmsAdminSettingsPage.php
CHANGED
@@ -6,13 +6,15 @@
|
|
6 |
* @author Joe Sexton <joe@josephmsexton.com>
|
7 |
* @package WordPress
|
8 |
* @subpackage JMS Plugin Framework
|
9 |
-
* @version 1.
|
10 |
* @uses JmsController
|
11 |
* @uses JmsUserOptionsCollection
|
12 |
*/
|
13 |
if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
14 |
abstract class JmsAdminSettingsPage extends JmsController {
|
15 |
|
|
|
|
|
16 |
/**
|
17 |
* @var string
|
18 |
*/
|
@@ -48,6 +50,19 @@ if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
|
48 |
*/
|
49 |
protected $manageSettingsCapability = 'manage_options';
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
/**
|
52 |
* settings page title
|
53 |
*
|
@@ -321,11 +336,13 @@ if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
|
321 |
*/
|
322 |
protected function _callAddMenuPageMethod( $menuType ){
|
323 |
|
|
|
|
|
324 |
// add menu page
|
325 |
if ( $this->_isValidMenuType( $menuType ) ) {
|
326 |
|
327 |
$method = $this->_getAddMenuPageMethod( $menuType );
|
328 |
-
|
329 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
330 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
331 |
$this->manageSettingsCapability(),
|
@@ -342,7 +359,7 @@ if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
|
342 |
// if we actually have a menu position set
|
343 |
if ( $this->menuPosition ) {
|
344 |
|
345 |
-
|
346 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
347 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
348 |
$this->manageSettingsCapability(),
|
@@ -352,7 +369,7 @@ if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
|
352 |
$this->menuPosition
|
353 |
);
|
354 |
} else {
|
355 |
-
|
356 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
357 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
358 |
$this->manageSettingsCapability(),
|
@@ -955,5 +972,33 @@ if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
|
955 |
{
|
956 |
return $this->settingsMenuTitle;
|
957 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
958 |
}
|
959 |
}
|
6 |
* @author Joe Sexton <joe@josephmsexton.com>
|
7 |
* @package WordPress
|
8 |
* @subpackage JMS Plugin Framework
|
9 |
+
* @version 1.3
|
10 |
* @uses JmsController
|
11 |
* @uses JmsUserOptionsCollection
|
12 |
*/
|
13 |
if ( !class_exists( 'JmsAdminSettingsPage' ) ){
|
14 |
abstract class JmsAdminSettingsPage extends JmsController {
|
15 |
|
16 |
+
const VERSION = 1.3;
|
17 |
+
|
18 |
/**
|
19 |
* @var string
|
20 |
*/
|
50 |
*/
|
51 |
protected $manageSettingsCapability = 'manage_options';
|
52 |
|
53 |
+
/**
|
54 |
+
* constructor
|
55 |
+
*
|
56 |
+
* @param string $pluginFile
|
57 |
+
* @param string $pluginName
|
58 |
+
*/
|
59 |
+
public function __construct( $pluginFile, $pluginName = '' ) {
|
60 |
+
|
61 |
+
parent::__construct( $pluginFile, $pluginName = '' );
|
62 |
+
|
63 |
+
add_filter('contextual_help', array( $this, 'contextualHelp' ), 10, 3);
|
64 |
+
}
|
65 |
+
|
66 |
/**
|
67 |
* settings page title
|
68 |
*
|
336 |
*/
|
337 |
protected function _callAddMenuPageMethod( $menuType ){
|
338 |
|
339 |
+
global $my_plugin_hook;
|
340 |
+
|
341 |
// add menu page
|
342 |
if ( $this->_isValidMenuType( $menuType ) ) {
|
343 |
|
344 |
$method = $this->_getAddMenuPageMethod( $menuType );
|
345 |
+
$my_plugin_hook = $method(
|
346 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
347 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
348 |
$this->manageSettingsCapability(),
|
359 |
// if we actually have a menu position set
|
360 |
if ( $this->menuPosition ) {
|
361 |
|
362 |
+
$my_plugin_hook = $method(
|
363 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
364 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
365 |
$this->manageSettingsCapability(),
|
369 |
$this->menuPosition
|
370 |
);
|
371 |
} else {
|
372 |
+
$my_plugin_hook = $method(
|
373 |
__( $this->settingsPageTitle(), $this->textDomain() ),
|
374 |
__( $this->settingsMenuTitle(), $this->textDomain() ),
|
375 |
$this->manageSettingsCapability(),
|
972 |
{
|
973 |
return $this->settingsMenuTitle;
|
974 |
}
|
975 |
+
|
976 |
+
/**
|
977 |
+
* Contextual help
|
978 |
+
*
|
979 |
+
* @param string $contextual_help
|
980 |
+
* @param string $screen_id
|
981 |
+
* @param WP_Screen $screen
|
982 |
+
* @return string
|
983 |
+
*/
|
984 |
+
public function contextualHelp( $contextual_help, $screen_id, $screen ){
|
985 |
+
global $my_plugin_hook;
|
986 |
+
|
987 |
+
if ($screen_id == $my_plugin_hook) {
|
988 |
+
$contextual_help = $this->_renderContextualHelp($screen);
|
989 |
+
}
|
990 |
+
|
991 |
+
return $contextual_help;
|
992 |
+
}
|
993 |
+
|
994 |
+
/**
|
995 |
+
* Render contextual help menu for an admin page
|
996 |
+
*
|
997 |
+
* @param WP_Screen $screen
|
998 |
+
* @return string
|
999 |
+
*/
|
1000 |
+
protected function _renderContextualHelp(WP_Screen $screen) {
|
1001 |
+
return '';
|
1002 |
+
}
|
1003 |
}
|
1004 |
}
|
framework/JmsBootstrap.php
CHANGED
@@ -12,6 +12,8 @@
|
|
12 |
if ( !class_exists( 'JmsBootstrap' ) ){
|
13 |
class JmsBootstrap {
|
14 |
|
|
|
|
|
15 |
/**
|
16 |
* @var string
|
17 |
*/
|
@@ -67,6 +69,7 @@ if ( !class_exists( 'JmsBootstrap' ) ){
|
|
67 |
|
68 |
$this->pluginFile = $pluginFile;
|
69 |
$this->pluginName = $pluginName;
|
|
|
70 |
|
71 |
spl_autoload_register( array( $this, '_autoload' ) );
|
72 |
|
12 |
if ( !class_exists( 'JmsBootstrap' ) ){
|
13 |
class JmsBootstrap {
|
14 |
|
15 |
+
const VERSION = 1.2;
|
16 |
+
|
17 |
/**
|
18 |
* @var string
|
19 |
*/
|
69 |
|
70 |
$this->pluginFile = $pluginFile;
|
71 |
$this->pluginName = $pluginName;
|
72 |
+
$this->pluginBase = plugin_basename($pluginFile);
|
73 |
|
74 |
spl_autoload_register( array( $this, '_autoload' ) );
|
75 |
|
framework/JmsController.php
CHANGED
@@ -12,6 +12,8 @@
|
|
12 |
if ( !class_exists( 'JmsController' ) ){
|
13 |
abstract class JmsController {
|
14 |
|
|
|
|
|
15 |
/**
|
16 |
* @var string
|
17 |
*/
|
@@ -78,6 +80,7 @@ if ( !class_exists( 'JmsController' ) ){
|
|
78 |
|
79 |
$this->pluginFile = $pluginFile;
|
80 |
$this->pluginName = $pluginName;
|
|
|
81 |
|
82 |
$pathParts = explode( '/', $pluginFile );
|
83 |
$filename = array_pop( $pathParts );
|
12 |
if ( !class_exists( 'JmsController' ) ){
|
13 |
abstract class JmsController {
|
14 |
|
15 |
+
const VERSION = 1.2;
|
16 |
+
|
17 |
/**
|
18 |
* @var string
|
19 |
*/
|
80 |
|
81 |
$this->pluginFile = $pluginFile;
|
82 |
$this->pluginName = $pluginName;
|
83 |
+
$this->pluginBase = plugin_basename($pluginFile);
|
84 |
|
85 |
$pathParts = explode( '/', $pluginFile );
|
86 |
$filename = array_pop( $pathParts );
|
framework/JmsUserOptionsCollection.php
CHANGED
@@ -6,11 +6,14 @@
|
|
6 |
* @author Joe Sexton <joe@josephmsexton.com>
|
7 |
* @package WordPress
|
8 |
* @subpackage JMS Plugin Framework
|
9 |
-
* @version 1.
|
10 |
*/
|
11 |
if ( !class_exists( 'JmsPluginUserOptionsCollection' ) ){
|
12 |
class JmsUserOptionsCollection {
|
13 |
|
|
|
|
|
|
|
14 |
/**
|
15 |
* @var string
|
16 |
*/
|
@@ -206,6 +209,7 @@ if ( !class_exists( 'JmsPluginUserOptionsCollection' ) ){
|
|
206 |
|
207 |
$defaults[$fieldKey] = $this->fieldOption( $fieldKey, 'default' );
|
208 |
}
|
|
|
209 |
|
210 |
return $defaults;
|
211 |
}
|
@@ -221,6 +225,21 @@ if ( !class_exists( 'JmsPluginUserOptionsCollection' ) ){
|
|
221 |
return update_option( $this->optionsKey, $defaults );
|
222 |
}
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
/**
|
225 |
* options mapping
|
226 |
*
|
6 |
* @author Joe Sexton <joe@josephmsexton.com>
|
7 |
* @package WordPress
|
8 |
* @subpackage JMS Plugin Framework
|
9 |
+
* @version 1.3
|
10 |
*/
|
11 |
if ( !class_exists( 'JmsPluginUserOptionsCollection' ) ){
|
12 |
class JmsUserOptionsCollection {
|
13 |
|
14 |
+
const VERSION_KEY = 'version';
|
15 |
+
const VERSION = 1.3;
|
16 |
+
|
17 |
/**
|
18 |
* @var string
|
19 |
*/
|
209 |
|
210 |
$defaults[$fieldKey] = $this->fieldOption( $fieldKey, 'default' );
|
211 |
}
|
212 |
+
$defaults[static::VERSION_KEY] = static::VERSION;
|
213 |
|
214 |
return $defaults;
|
215 |
}
|
225 |
return update_option( $this->optionsKey, $defaults );
|
226 |
}
|
227 |
|
228 |
+
/**
|
229 |
+
* init plugin's options if they don't exist
|
230 |
+
*
|
231 |
+
* @return boolean
|
232 |
+
*/
|
233 |
+
function initOptions(){
|
234 |
+
|
235 |
+
$defaults = $this->defaultOptions();
|
236 |
+
$options = get_option( $this->optionsKey, NULL );
|
237 |
+
if (empty($options)) {
|
238 |
+
return update_option( $this->optionsKey, $defaults );
|
239 |
+
}
|
240 |
+
return TRUE;
|
241 |
+
}
|
242 |
+
|
243 |
/**
|
244 |
* options mapping
|
245 |
*
|
framework/readme.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
-
v1.0 - Initial bootstrap class created, initial controller created
|
2 |
-
v1.1 - Updates to bootstrap, implement autoloading. Minor controller updates
|
3 |
-
v1.2 - Adds plugin name and text domain to bootstrap and controller. Minor controller updates. Adds basic plugin user options framework. Changes to parameters passed to bootstrap and controller, update all existing plugins.
|
|
1 |
+
v1.0 - Initial bootstrap class created, initial controller created.
|
2 |
+
v1.1 - Updates to bootstrap, implement autoloading. Minor controller updates.
|
3 |
+
v1.2 - Adds plugin name and text domain to bootstrap and controller. Minor controller updates. Adds basic plugin user options framework. Changes to parameters passed to bootstrap and controller, update all existing plugins.
|
4 |
+
v1.3 - Adds contextual help support to the admin menu controller. Adds ability to init options in user options collection if options don't currently exist.
|
model/SBTT_Options.php
CHANGED
@@ -5,10 +5,13 @@
|
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
|
|
8 |
*/
|
9 |
if ( !class_exists( 'SBTT_Options' ) ){
|
10 |
class SBTT_Options extends JmsUserOptionsCollection {
|
11 |
|
|
|
|
|
12 |
/**
|
13 |
* @var string
|
14 |
*/
|
@@ -40,6 +43,26 @@ class SBTT_Options extends JmsUserOptionsCollection {
|
|
40 |
),
|
41 |
'required' => true,
|
42 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
),
|
44 |
);
|
45 |
$this->optionMap['appearance'] = array(
|
@@ -75,7 +98,7 @@ class SBTT_Options extends JmsUserOptionsCollection {
|
|
75 |
'required' => true,
|
76 |
),
|
77 |
'color_hover' => array(
|
78 |
-
'label' => __( 'Hover Color', 'scroll-back-to-top' ),
|
79 |
'type' => 'text',
|
80 |
'default' => '#888888',
|
81 |
'options' => 'color-picker',
|
@@ -90,6 +113,14 @@ class SBTT_Options extends JmsUserOptionsCollection {
|
|
90 |
'data_type' => 'string',
|
91 |
'required' => true,
|
92 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
'opacity' => array(
|
94 |
'label' => __( 'Opacity', 'scroll-back-to-top' ),
|
95 |
'type' => 'text',
|
@@ -227,17 +258,28 @@ class SBTT_Options extends JmsUserOptionsCollection {
|
|
227 |
'default' => 500,
|
228 |
'min' => 0,
|
229 |
'max' => 5000,
|
230 |
-
'units' => __( 'ms', 'scroll-back-to-top' ),
|
231 |
'data_type' => 'integer',
|
232 |
'required' => true,
|
233 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
'fade_duration' => array(
|
235 |
'label' => __( 'Fade Duration', 'scroll-back-to-top' ),
|
236 |
'type' => 'text',
|
237 |
'default' => 500,
|
238 |
'min' => 0,
|
239 |
'max' => 5000,
|
240 |
-
'units' => __( 'ms', 'scroll-back-to-top' ),
|
241 |
'data_type' => 'integer',
|
242 |
'required' => true,
|
243 |
),
|
5 |
* @author Joe Sexton <joe@josephmsexton.com>
|
6 |
* @package WordPress
|
7 |
* @subpackage scroll-back-to-top
|
8 |
+
* @version 1.1
|
9 |
*/
|
10 |
if ( !class_exists( 'SBTT_Options' ) ){
|
11 |
class SBTT_Options extends JmsUserOptionsCollection {
|
12 |
|
13 |
+
const VERSION = 1.1;
|
14 |
+
|
15 |
/**
|
16 |
* @var string
|
17 |
*/
|
43 |
),
|
44 |
'required' => true,
|
45 |
),
|
46 |
+
'min_resolution' => array(
|
47 |
+
'label' => __( 'Minimum Browser Resolution', 'scroll-back-to-top' ),
|
48 |
+
'type' => 'text',
|
49 |
+
'default' => 0,
|
50 |
+
'min' => 0,
|
51 |
+
'max' => 9999,
|
52 |
+
'units' => __( 'px - smallest browser resolution the scroll button should appear on', 'scroll-back-to-top' ),
|
53 |
+
'data_type' => 'integer',
|
54 |
+
'required' => true,
|
55 |
+
),
|
56 |
+
'max_resolution' => array(
|
57 |
+
'label' => __( 'Maximum Browser Resolution', 'scroll-back-to-top' ),
|
58 |
+
'type' => 'text',
|
59 |
+
'default' => 9999,
|
60 |
+
'min' => 0,
|
61 |
+
'max' => 9999,
|
62 |
+
'units' => __( 'px - largest browser resolution the scroll button should appear on', 'scroll-back-to-top' ),
|
63 |
+
'data_type' => 'integer',
|
64 |
+
'required' => true,
|
65 |
+
),
|
66 |
),
|
67 |
);
|
68 |
$this->optionMap['appearance'] = array(
|
98 |
'required' => true,
|
99 |
),
|
100 |
'color_hover' => array(
|
101 |
+
'label' => __( 'Background Hover Color', 'scroll-back-to-top' ),
|
102 |
'type' => 'text',
|
103 |
'default' => '#888888',
|
104 |
'options' => 'color-picker',
|
113 |
'data_type' => 'string',
|
114 |
'required' => true,
|
115 |
),
|
116 |
+
'color_foreground_hover' => array(
|
117 |
+
'label' => __( 'Foreground Hover Color', 'scroll-back-to-top' ),
|
118 |
+
'type' => 'text',
|
119 |
+
'default' => '#eeeeee',
|
120 |
+
'options' => 'color-picker',
|
121 |
+
'data_type' => 'string',
|
122 |
+
'required' => true,
|
123 |
+
),
|
124 |
'opacity' => array(
|
125 |
'label' => __( 'Opacity', 'scroll-back-to-top' ),
|
126 |
'type' => 'text',
|
258 |
'default' => 500,
|
259 |
'min' => 0,
|
260 |
'max' => 5000,
|
261 |
+
'units' => __( 'ms - this is how long it takes to scroll back to the top after the button has been pressed', 'scroll-back-to-top' ),
|
262 |
'data_type' => 'integer',
|
263 |
'required' => true,
|
264 |
),
|
265 |
+
'visibility_duration' => array(
|
266 |
+
'label' => __( 'Visibility Duration', 'scroll-back-to-top' ),
|
267 |
+
'type' => 'text',
|
268 |
+
'default' => 0,
|
269 |
+
'min' => 0,
|
270 |
+
'max' => 10000,
|
271 |
+
'units' => __( 'ms - if set to 0 the button will never time out,
|
272 |
+
otherwise the button will disappear after the specified time', 'scroll-back-to-top' ),
|
273 |
+
'data_type' => 'integer',
|
274 |
+
'required' => true,
|
275 |
+
),
|
276 |
'fade_duration' => array(
|
277 |
'label' => __( 'Fade Duration', 'scroll-back-to-top' ),
|
278 |
'type' => 'text',
|
279 |
'default' => 500,
|
280 |
'min' => 0,
|
281 |
'max' => 5000,
|
282 |
+
'units' => __( 'ms - this is how long it takes for the transition to fade the button in and out', 'scroll-back-to-top' ),
|
283 |
'data_type' => 'integer',
|
284 |
'required' => true,
|
285 |
),
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: joesexton00
|
|
3 |
Tags: back to top, jquery, scroll to top, button, scroll, scroll top, scroll back to top, scroll up, widget, icon, scroller, vertical scroller, arrow, link to top, back to top, smooth scroll, top, back
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
This plugin will add a button that allows users to scroll smoothly to the top of the page.
|
9 |
|
@@ -63,6 +63,16 @@ Absolutely not. This plugin is designed to work immediately upon activation, wi
|
|
63 |
|
64 |
== Change Log ==
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
= 1.0 =
|
67 |
- Initial Release
|
68 |
|
3 |
Tags: back to top, jquery, scroll to top, button, scroll, scroll top, scroll back to top, scroll up, widget, icon, scroller, vertical scroller, arrow, link to top, back to top, smooth scroll, top, back
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.9
|
6 |
+
Stable tag: 1.1
|
7 |
|
8 |
This plugin will add a button that allows users to scroll smoothly to the top of the page.
|
9 |
|
63 |
|
64 |
== Change Log ==
|
65 |
|
66 |
+
= 1.1 =
|
67 |
+
- Adds support for an optional display timeout
|
68 |
+
- Adds min/max browser resolutions
|
69 |
+
- Adds foreground hover color
|
70 |
+
- Adds contextual help menu
|
71 |
+
- Adds settings link from plugin page
|
72 |
+
- Updated font-awesome version to v4.1.0
|
73 |
+
- Updated options/settings to persist after deactivating/activating the plugin.
|
74 |
+
|
75 |
+
|
76 |
= 1.0 =
|
77 |
- Initial Release
|
78 |
|
assets/screenshot-1.png → screenshot-1.png
RENAMED
File without changes
|
assets/screenshot-2.png → screenshot-2.png
RENAMED
File without changes
|
assets/screenshot-3.png → screenshot-3.png
RENAMED
File without changes
|
assets/screenshot-4.png → screenshot-4.png
RENAMED
File without changes
|
assets/screenshot-5.png → screenshot-5.png
RENAMED
File without changes
|
scroll-back-to-top.php
CHANGED
@@ -2,8 +2,9 @@
|
|
2 |
/*
|
3 |
Plugin Name: Scroll Back to Top
|
4 |
Description: Adds a scroll to top button
|
|
|
5 |
Text Domain: scroll-back-to-top
|
6 |
-
Version: 1.
|
7 |
Author: Joe Sexton
|
8 |
Author URI: http://www.josephmsexton.com
|
9 |
*/
|
2 |
/*
|
3 |
Plugin Name: Scroll Back to Top
|
4 |
Description: Adds a scroll to top button
|
5 |
+
Plugin URI: http://www.webtipblog.com/scroll-back-top-wordpress-plugin/
|
6 |
Text Domain: scroll-back-to-top
|
7 |
+
Version: 1.1
|
8 |
Author: Joe Sexton
|
9 |
Author URI: http://www.josephmsexton.com
|
10 |
*/
|
view/dynamic-styles.php
CHANGED
@@ -1,5 +1,15 @@
|
|
1 |
-
|
2 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
.scroll-back-to-top-wrapper {
|
4 |
position: fixed;
|
5 |
opacity: 0;
|
@@ -74,6 +84,9 @@
|
|
74 |
<?php if ( isset( $color_hover ) ) : ?>
|
75 |
background-color: <?php echo $color_hover; ?>;
|
76 |
<?php endif; ?>
|
|
|
|
|
|
|
77 |
}
|
78 |
.scroll-back-to-top-wrapper.show {
|
79 |
visibility:visible;
|
@@ -91,4 +104,7 @@
|
|
91 |
<?php if ( isset( $extra_css ) ) : ?>
|
92 |
<?php echo $extra_css; ?>
|
93 |
<?php endif; ?>
|
|
|
|
|
|
|
94 |
</style>
|
1 |
+
|
2 |
<style>
|
3 |
+
<?php $media_query = false; ?>
|
4 |
+
<?php if ( isset( $min_resolution ) || isset( $max_resolution ) ) : ?>
|
5 |
+
<?php $media_query = true; ?>
|
6 |
+
@media <?php if ( isset( $min_resolution ) ) : ?>(min-width: <?php echo $min_resolution; ?>)
|
7 |
+
<?php if ( isset( $max_resolution ) ) : ?>
|
8 |
+
and
|
9 |
+
<?php endif; ?>
|
10 |
+
<?php endif; ?>
|
11 |
+
<?php if ( isset( $max_resolution ) ) : ?>(max-width: <?php echo $max_resolution; ?>)<?php endif; ?> {
|
12 |
+
<?php endif; ?>
|
13 |
.scroll-back-to-top-wrapper {
|
14 |
position: fixed;
|
15 |
opacity: 0;
|
84 |
<?php if ( isset( $color_hover ) ) : ?>
|
85 |
background-color: <?php echo $color_hover; ?>;
|
86 |
<?php endif; ?>
|
87 |
+
<?php if ( isset( $color_foreground_hover ) ) : ?>
|
88 |
+
color: <?php echo $color_foreground_hover; ?>;
|
89 |
+
<?php endif; ?>
|
90 |
}
|
91 |
.scroll-back-to-top-wrapper.show {
|
92 |
visibility:visible;
|
104 |
<?php if ( isset( $extra_css ) ) : ?>
|
105 |
<?php echo $extra_css; ?>
|
106 |
<?php endif; ?>
|
107 |
+
<?php if ( $media_query ) : ?>
|
108 |
+
}
|
109 |
+
<?php endif; ?>
|
110 |
</style>
|
view/help/advanced.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Advanced Options</h2>
|
2 |
+
|
3 |
+
<h3>Extra CSS</h3>
|
4 |
+
This is an advanced setting that requires CSS knowledge to use. You must add selectors in this field, your
|
5 |
+
CSS should look something like:
|
6 |
+
|
7 |
+
<pre class="lang:css decode:true " >.scroll-back-to-top-wrapper:hover {
|
8 |
+
foreground-color:#FFFFFF
|
9 |
+
}</pre>
|
10 |
+
|
11 |
+
|
12 |
+
<h2>Filters</h2>
|
13 |
+
|
14 |
+
2 filters are provided for overriding default plugin behavior.
|
15 |
+
|
16 |
+
<ul>
|
17 |
+
|
18 |
+
<li>sbtt_styles - The CSS that is added to the <head> element will be passed through this filter. Use
|
19 |
+
this to add/change/remove some of the CSS.</li>
|
20 |
+
<li>sbtt_button_markup - The HTML markup for the button will be passed through this filter. Use this to add
|
21 |
+
additional markup to the button.</li>
|
22 |
+
</ul>
|
view/help/animation.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Animation Options</h2>
|
2 |
+
|
3 |
+
<h3>Scroll Duration</h3>
|
4 |
+
This setting determines how long it takes for the page to scroll to the top. Values here are in milliseconds.
|
5 |
+
Note that 500-100 is recommended for the best results, but you can enter any value you like here.
|
6 |
+
|
7 |
+
<h3>Visibility Duration</h3>
|
8 |
+
This setting is the time the button will be shown after the user scrolls down the page. The default value of
|
9 |
+
0 means that the option is disabled and the button will not time out. A value greater then 0 milliseconds will
|
10 |
+
cause the button to timeout after the set amount of time has passed. If you choose to use this option I recommend
|
11 |
+
a value between 1500ms-2500ms.
|
12 |
+
|
13 |
+
<h3>Fade Duration</h3>
|
14 |
+
This setting will change how fast the button fades in and out of the screen after the scrolling threshold is
|
15 |
+
reached. Values here are in milliseconds. Note that 500-100 is recommended for the best results, but you can
|
16 |
+
enter any value you like here.
|
17 |
+
|
view/help/appearance.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Button Appearance</h2>
|
2 |
+
|
3 |
+
<h3>Width</h3>
|
4 |
+
This setting will change the width of the button. The measurement is in pixels.
|
5 |
+
|
6 |
+
<h3>Height</h3>
|
7 |
+
This setting will change the height of the button. The measurement is in pixels.
|
8 |
+
|
9 |
+
<h3>Background Color</h3>
|
10 |
+
This setting will change the background color of the button in it's normal state.
|
11 |
+
A helpful color picker is provided, but the value is a hex color CSS value, so it should look like #123456.
|
12 |
+
|
13 |
+
<h3>Background Hover Color</h3>
|
14 |
+
This setting will change the background color of the button in it's hover state.
|
15 |
+
|
16 |
+
<h3>Foreground Color</h3>
|
17 |
+
This setting will change the foreground color of the button.
|
18 |
+
|
19 |
+
<h3>Foreground Hover Color</h3>
|
20 |
+
This setting will change the foreground color of the button in it's hover state.
|
21 |
+
|
22 |
+
<h3>Opacity</h3>
|
23 |
+
This setting will change the transparency of the button.
|
24 |
+
|
25 |
+
<h3>Border Radius</h3>
|
26 |
+
This setting allows you to change the corners of the button. Entering 0 will make sharp, hard corners.
|
27 |
+
Entering higher values will round the corner to that radius. This value is entered in pixels. Hint: if you want to create a circle button then set this value to be exactly half the width and height of the button.
|
view/help/label.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Button Label</h2>
|
2 |
+
|
3 |
+
<h3>Label Type</h3>
|
4 |
+
This setting will change what appears on the button. Choose an icon to put on the button or choose custom
|
5 |
+
text to add your own text.
|
6 |
+
<ul>
|
7 |
+
<li>Arrow 1</li>
|
8 |
+
<li>Arrow 2</li>
|
9 |
+
<li>Arrow 3</li>
|
10 |
+
<li>...</li>
|
11 |
+
<li>Custom Text</li>
|
12 |
+
</ul>
|
13 |
+
|
14 |
+
<h3>Icon Size</h3>
|
15 |
+
If you chose an icon for the 'label type' setting then this will determine the size of the icon. If you chose
|
16 |
+
'custom text' then this setting is not available.
|
17 |
+
<ul>
|
18 |
+
<li>1</li>
|
19 |
+
<li>2</li>
|
20 |
+
<li>3</li>
|
21 |
+
<li>4</li>
|
22 |
+
<li>5</li>
|
23 |
+
<li>6</li>
|
24 |
+
</ul>
|
25 |
+
|
26 |
+
<h3>Custom Label Text</h3>
|
27 |
+
If you chose 'custom text' for the 'label type' setting then this is where you can enter the text to display
|
28 |
+
on the button. If you chose an icon then this field is not available.
|
29 |
+
|
30 |
+
<h3>Font Size</h3>
|
31 |
+
If you chose 'custom text' for the 'label type' setting then this is how you can set the font size. Font
|
32 |
+
sizes are in px. I have included a auto font-sizing javascript library with this plugin. To enable auto-sizing
|
33 |
+
for the font size simply enter a 0 in this field and the plugin will handle the rest.
|
34 |
+
|
view/help/location.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Button Location</h2>
|
2 |
+
|
3 |
+
<h3>Horizontal Alignment</h3>
|
4 |
+
This setting will change where the button appears from left to right.
|
5 |
+
<ul>
|
6 |
+
<li>Left</li>
|
7 |
+
<li>Center</li>
|
8 |
+
<li>Right</li>
|
9 |
+
</ul>
|
10 |
+
|
11 |
+
<h3>Vertical Alignment</h3>
|
12 |
+
This setting will change whether the button appears on the top or bottom.
|
13 |
+
<ul>
|
14 |
+
<li>Top</li>
|
15 |
+
<li>Bottom</li>
|
16 |
+
</ul>
|
17 |
+
|
18 |
+
<h3>Horizontal Distance from Edge</h3>
|
19 |
+
This setting is how far away from the left or right side the button is positioned.
|
20 |
+
If the horizontal alignment is right then this setting will be the margin to the right side of the screen,
|
21 |
+
vice-versa if horizontal alignment is left. If the horizontal alignment is set to 'center' then this setting
|
22 |
+
has no effect. This value is in pixels. Hint: if you want to dock the button to the side of the screen then
|
23 |
+
enter a 0 for this value.
|
24 |
+
|
25 |
+
<h3>Vertical Distance from Edge</h3>
|
26 |
+
This setting is how far away from the top or bottom the button is positioned. If the vertical alignment is top
|
27 |
+
then this setting will be the margin to the top of the screen, vice-versa if vertical alignment is bottom.
|
28 |
+
This value is in pixels. Hint: if you want to dock the button to the top or bottom of the screen then enter
|
29 |
+
a 0 for this value.
|
view/help/overview.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Overview</h2>
|
2 |
+
|
3 |
+
<p>
|
4 |
+
This is a walkthrough of each configuration option, designed to help you understand how the plugin works and how the
|
5 |
+
different settings interact with each other. The configuration options are grouped by their basic function.
|
6 |
+
</p>
|
7 |
+
|
8 |
+
<a href="http://www.webtipblog.com/scroll-back-top-wordpress-plugin-button-designs/" target="_blank">Check out some custom button design
|
9 |
+
inspiration</a><br>
|
10 |
+
<a href="http://wordpress.org/plugins/scroll-back-to-top/" target="_blank">Check out the Wordpress Scroll Back to Top plugin page</a>
|
11 |
+
|
12 |
+
|
view/help/troubleshooting.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Troubleshooting</h2>
|
2 |
+
|
3 |
+
It is possible for conflicts to be caused if your theme uses a version of font-awesome that is different
|
4 |
+
from the version enqueued by the plugin. There are 2 solutions to this problem.
|
5 |
+
|
6 |
+
The first solution is to set the plugin to use "Custom Text" instead of an icon as the label. This may not
|
7 |
+
be the most ideal solution, but if no icons are used then the plugin will not try to include the font-awesome
|
8 |
+
library and will not cause a conflict.
|
9 |
+
|
10 |
+
A second solution is a little more code intensive. The plugin offers a filter for the HTML output of the
|
11 |
+
button. The idea is to set the plugin to use "Custom Text" but then set the "Custom Label Text" text box
|
12 |
+
to contain no text at all. This will not load the plugin's version of font-awesome and will render an empty
|
13 |
+
button. The next step is to apply the filter in your theme's functions.php file to add the font-awesome icon
|
14 |
+
manually. Here is an example of a code snippet you could include in functions.php to insert an icon into the
|
15 |
+
button's "Custom Label" area. This will use your theme's version of font-awesome and cause no conflicts.
|
16 |
+
|
17 |
+
|
18 |
+
<pre class="lang:php decode:true " >add_filter('sbtt_button_markup', 'my_scroll_back_to_top_filter');
|
19 |
+
function my_scroll_back_to_top_filter($text) {
|
20 |
+
$text = str_replace(
|
21 |
+
'<span class="scroll-back-to-top-inner">',
|
22 |
+
'<span class="scroll-back-to-top-inner"><i class="fa fa-arrow-circle-up"></i>',
|
23 |
+
$text
|
24 |
+
);
|
25 |
+
|
26 |
+
return $text;
|
27 |
+
}</pre>
|
28 |
+
|
29 |
+
|
30 |
+
The '<i class="fa fa-arrow-circle-up"></i>' is the icon for font-awesome. To see more options,
|
31 |
+
including the icons I included in the plugin, go to <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank">http://fortawesome.github.io/Font-Awesome/icons/</a>. I should
|
32 |
+
also note that this is the recommended method to add your own icons from any icon library if needed to match a theme.
|
view/help/visibility.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<h2>Visibility</h2>
|
2 |
+
|
3 |
+
<h3>Status</h3>
|
4 |
+
This setting will change the visibility of the button.
|
5 |
+
<ul>
|
6 |
+
<li>Publicly Visible - enable the button for all to see</li>
|
7 |
+
<li>Preview Mode - only displays the button for logged in users</li>
|
8 |
+
<li>Disabled - completely removes the button from the public facing side of the site.</li>
|
9 |
+
</ul>
|
10 |
+
|
11 |
+
<h3>Minimum Browser Resolution</h3>
|
12 |
+
This setting is the minimum browser resolution to display the button. To restrict the button from
|
13 |
+
appearing in smaller browsers, increase the value of this from 0 pixels to a higher value.
|
14 |
+
|
15 |
+
<h3>Maximum Browser Resolution</h3>
|
16 |
+
This setting is the maximum browser resolution to display the button. To restrict the button from
|
17 |
+
appearing in larger browsers, decrease the value of this from 9999 pixels to a lower value.
|