Sticky Side Buttons - Version 1.0.3

Version Description

  • Fixes z-index override issue
Download this release

Release Info

Developer EnigmaWeb
Plugin Icon 128x128 Sticky Side Buttons
Version 1.0.3
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.3

assets/js/ssb-ui-js.js CHANGED
@@ -1,48 +1,50 @@
1
- // SSB UI jQuery
2
- jQuery(function ($) {
3
-
4
- // Animation Slide
5
- var ssb_panel = $('#ssb-container'),
6
- ssb_panel_w = ssb_panel.width(),
7
- sbb_display_margin = 50;
8
-
9
- if (ssb_panel.hasClass('ssb-btns-left') && (ssb_panel.hasClass('ssb-anim-slide') || ssb_panel.hasClass('ssb-anim-icons'))) {
10
-
11
- ssb_panel.css('left', '-' + (ssb_panel_w - sbb_display_margin) + 'px');
12
-
13
- } else if (ssb_panel.hasClass('ssb-btns-right') && (ssb_panel.hasClass('ssb-anim-slide') || ssb_panel.hasClass('ssb-anim-icons'))) {
14
-
15
- ssb_panel.css('right', '-' + (ssb_panel_w - sbb_display_margin) + 'px');
16
-
17
- }
18
-
19
- // Slide when hover
20
- ssb_panel.hover(function () {
21
-
22
- if (ssb_panel.hasClass('ssb-btns-left') && ssb_panel.hasClass('ssb-anim-slide')) {
23
-
24
- ssb_panel.stop().animate({'left': 0}, 300);
25
-
26
- } else if (ssb_panel.hasClass('ssb-btns-right') && ssb_panel.hasClass('ssb-anim-slide')) {
27
-
28
- ssb_panel.stop().animate({'right': 0}, 300);
29
-
30
- }
31
-
32
- }, function () {
33
-
34
- if (ssb_panel.hasClass('ssb-btns-left') && ssb_panel.hasClass('ssb-anim-slide')) {
35
-
36
- ssb_panel.animate({'left': '-' + (ssb_panel_w - sbb_display_margin) + 'px'}, 300);
37
-
38
- } else if (ssb_panel.hasClass('ssb-btns-right') && ssb_panel.hasClass('ssb-anim-slide')) {
39
-
40
- ssb_panel.animate({'right': '-' + (ssb_panel_w - sbb_display_margin) + 'px'}, 300);
41
-
42
- }
43
-
44
- });
45
-
46
-
47
-
 
 
48
  });
1
+ // SSB UI jQuery
2
+ jQuery(function ($) {
3
+
4
+ // Animation Slide
5
+ var ssb_panel = $('#ssb-container'),
6
+ ssb_panel_w = ssb_panel.width(),
7
+ sbb_display_margin = 50;
8
+
9
+ ssb_panel.css('z-index', ssb_ui_data.z_index);
10
+
11
+ if (ssb_panel.hasClass('ssb-btns-left') && (ssb_panel.hasClass('ssb-anim-slide') || ssb_panel.hasClass('ssb-anim-icons'))) {
12
+
13
+ ssb_panel.css('left', '-' + (ssb_panel_w - sbb_display_margin) + 'px');
14
+
15
+ } else if (ssb_panel.hasClass('ssb-btns-right') && (ssb_panel.hasClass('ssb-anim-slide') || ssb_panel.hasClass('ssb-anim-icons'))) {
16
+
17
+ ssb_panel.css('right', '-' + (ssb_panel_w - sbb_display_margin) + 'px');
18
+
19
+ }
20
+
21
+ // Slide when hover
22
+ ssb_panel.hover(function () {
23
+
24
+ if (ssb_panel.hasClass('ssb-btns-left') && ssb_panel.hasClass('ssb-anim-slide')) {
25
+
26
+ ssb_panel.stop().animate({'left': 0}, 300);
27
+
28
+ } else if (ssb_panel.hasClass('ssb-btns-right') && ssb_panel.hasClass('ssb-anim-slide')) {
29
+
30
+ ssb_panel.stop().animate({'right': 0}, 300);
31
+
32
+ }
33
+
34
+ }, function () {
35
+
36
+ if (ssb_panel.hasClass('ssb-btns-left') && ssb_panel.hasClass('ssb-anim-slide')) {
37
+
38
+ ssb_panel.animate({'left': '-' + (ssb_panel_w - sbb_display_margin) + 'px'}, 300);
39
+
40
+ } else if (ssb_panel.hasClass('ssb-btns-right') && ssb_panel.hasClass('ssb-anim-slide')) {
41
+
42
+ ssb_panel.animate({'right': '-' + (ssb_panel_w - sbb_display_margin) + 'px'}, 300);
43
+
44
+ }
45
+
46
+ });
47
+
48
+
49
+
50
  });
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: EnigmaWeb
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEJ9HFWJ94BG4
4
  Tags: sticky, buttons, contact, side, social buttons, email button, phone button, floating
5
  Requires at least: 2.7
6
- Tested up to: 4.7.2
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -39,7 +39,17 @@ This simple button creator lets you create one or more floating buttons that sti
39
 
40
  == Frequently Asked Questions ==
41
 
42
- None yet.
 
 
 
 
 
 
 
 
 
 
43
 
44
 
45
  == Screenshots ==
@@ -54,6 +64,12 @@ None yet.
54
 
55
  == Changelog ==
56
 
 
 
 
 
 
 
57
  = 1.0.1 =
58
  * Removed unnecessary css background - works better when buttons are spaced
59
  * Added z-index so buttons don't hide behind things (fix for revolution slider)
@@ -63,6 +79,12 @@ None yet.
63
 
64
  == Upgrade Notice ==
65
 
 
 
 
 
 
 
66
  = 1.0.1 =
67
  * Minor update with some css tweaks
68
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=CEJ9HFWJ94BG4
4
  Tags: sticky, buttons, contact, side, social buttons, email button, phone button, floating
5
  Requires at least: 2.7
6
+ Tested up to: 4.8
7
  Stable tag: trunk
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
39
 
40
  == Frequently Asked Questions ==
41
 
42
+ = My sticky side buttons are covered by some other element. What should I do? =
43
+
44
+ In the plugin settings there is a field where you can define z-index for the buttons. An element with a higher z-index is always in front of an element with a lower z-index.
45
+
46
+ = Where can I get support for this plugin? =
47
+
48
+ If you've tried all the obvious stuff and it's still not working please request support via the forum. Remember to include a link to your site, and a full description of the issue plus the steps you've already taken to try to solve it.
49
+
50
+ = Can I contribute to this plugin? =
51
+
52
+ Absolutely! Please create a pull request on [GitHub here.](https://github.com/EnigmaWeb/sticky-side-buttons)
53
 
54
 
55
  == Screenshots ==
64
 
65
  == Changelog ==
66
 
67
+ = 1.0.3 =
68
+ * Fixes z-index override issue
69
+
70
+ = 1.0.2 =
71
+ * Adds a setting so user can define custom z-index
72
+
73
  = 1.0.1 =
74
  * Removed unnecessary css background - works better when buttons are spaced
75
  * Added z-index so buttons don't hide behind things (fix for revolution slider)
79
 
80
  == Upgrade Notice ==
81
 
82
+ = 1.0.3 =
83
+ * Fixes z-index override issue
84
+
85
+ = 1.0.2 =
86
+ * Adds a setting so user can define custom z-index. Thanks to AlexGStapleton.
87
+
88
  = 1.0.1 =
89
  * Minor update with some css tweaks
90
 
screenshot-1.jpg DELETED
Binary file
screenshot-2.jpg DELETED
Binary file
screenshot-3.jpg DELETED
Binary file
screenshot-4.jpg DELETED
Binary file
screenshot-5.jpg DELETED
Binary file
screenshot-6.jpg DELETED
Binary file
ssb-main.php CHANGED
@@ -1,193 +1,200 @@
1
- <?php
2
-
3
- /**
4
- * Main plugin class
5
- */
6
- class ssb_main {
7
-
8
- /**
9
- * @var object $ui
10
- */
11
- public $ui;
12
-
13
-
14
- /**
15
- * Dump everything for this plugin here :p
16
- *
17
- * @since 1.0
18
- */
19
- public function __construct() {
20
-
21
- // User interfaces object
22
- $this->ui = new ssb_ui;
23
-
24
- // Plugin text domain
25
- add_action( 'init', array( $this, 'ssb_textdomain' ) );
26
-
27
- // Register settings
28
- add_action( 'admin_init', array( $this, 'ssb_register_settings' ) );
29
-
30
- // Admin menu
31
- add_action( 'admin_menu', array( $this, 'ssb_admin_menu' ) );
32
-
33
- // Admin assets
34
- add_action( 'admin_enqueue_scripts', array( $this, 'ssb_admin_assets' ) );
35
-
36
- // Admin notices
37
- add_action( 'admin_notices', array( $this, 'ssb_admin_notices' ) );
38
-
39
- // Icons UI
40
- add_action( 'wp_footer', array( $this->ui, 'icons' ) );
41
-
42
- add_action( 'wp_enqueue_scripts', array( $this, 'ssb_ui_assets' ) );
43
-
44
-
45
- }
46
-
47
-
48
- /**
49
- * Load text domain
50
- *
51
- * @since 1.0
52
- */
53
- public function ssb_textdomain() {
54
-
55
- load_plugin_textdomain( 'sticky-side-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
56
-
57
- }
58
-
59
-
60
- /**
61
- * Register settings
62
- *
63
- * @since 1.0
64
- */
65
- public function ssb_register_settings() {
66
-
67
- register_setting( 'ssb_storage', 'ssb_settings' );
68
- register_setting( 'ssb_storage', 'ssb_buttons' );
69
-
70
- }
71
-
72
-
73
- /**
74
- * Admin menu
75
- *
76
- * @since 1.0
77
- */
78
- public function ssb_admin_menu() {
79
-
80
- add_menu_page(
81
- __( 'Sticky Side Buttons', 'sticky-side-buttons' ),
82
- __( 'Sticky Side Buttons', 'sticky-side-buttons' ),
83
- 'manage_options',
84
- 'ssb',
85
- array(
86
- $this->ui,
87
- 'admin_page'
88
- ),
89
- 'dashicons-list-view'
90
- );
91
-
92
- }
93
-
94
-
95
- /**
96
- * Admin style
97
- *
98
- * @since 1.0
99
- */
100
- public function ssb_admin_assets() {
101
-
102
- // CSS
103
- wp_enqueue_style( 'ssb-admin-style', plugins_url( 'assets/css/ssb-admin-style.css', __FILE__ ) );
104
- wp_enqueue_style( 'ssb-fontawesome', plugins_url( 'assets/css/font-awesome.css', __FILE__ ) );
105
- wp_enqueue_style( 'ssb-iconpicker', plugins_url( 'assets/css/fontawesome-iconpicker.css', __FILE__ ) );
106
- wp_enqueue_style( 'wp-color-picker' );
107
-
108
- // JS
109
- wp_enqueue_script( 'jquery-ui-core' );
110
- wp_enqueue_script( 'jquery-ui-accordion' );
111
- wp_enqueue_script( 'jquery-ui-sortable' );
112
- wp_enqueue_script( 'wp-color-picker' );
113
- wp_enqueue_script( 'ssb-iconpicker-js', plugins_url( 'assets/js/fontawesome-iconpicker.js', __FILE__ ) );
114
- wp_enqueue_script( 'ssb-admin-js', plugins_url( 'assets/js/ssb-admin-js.js', __FILE__ ) );
115
-
116
- }
117
-
118
-
119
- /**
120
- * Admin notices
121
- *
122
- * @since 1.0
123
- */
124
- public function ssb_admin_notices() {
125
-
126
- // Get current screen
127
- $screen = get_current_screen();
128
-
129
- /**
130
- * If settings updated successfully
131
- */
132
- if ( isset( $_GET['settings-updated'] ) && $screen->id == 'toplevel_page_ssb' ) {
133
- ?>
134
- <div class="notice notice-success is-dismissible">
135
- <p>Changes has been saved successfully!</p>
136
- </div>
137
- <?php
138
- }
139
-
140
- }
141
-
142
-
143
- /**
144
- * UI Assets
145
- *
146
- * @since 1.0
147
- */
148
- public function ssb_ui_assets() {
149
-
150
- // CSS
151
- wp_enqueue_style( 'ssb-ui-style', plugins_url( 'assets/css/ssb-ui-style.css', __FILE__ ) );
152
- wp_enqueue_style( 'ssb-fontawesome', plugins_url( 'assets/css/font-awesome.css', __FILE__ ) );
153
-
154
- $dynamic_css = null;
155
-
156
- if ($this->ui->buttons['btns']) {
157
-
158
- foreach ( $this->ui->btns_order AS $btn_key => $btn_id ) {
159
-
160
- // Hex to RGB
161
- $hex = str_replace('#', '', $this->ui->buttons['btns'][$btn_id]['btn_color']);
162
- $R = hexdec(substr($hex, 0, 2));
163
- $G = hexdec(substr($hex, 2, 2));
164
- $B = hexdec(substr($hex, 4, 2));
165
-
166
- $dynamic_css .= '#ssb-btn-' . $btn_id . '{background: ' . $this->ui->buttons['btns'][$btn_id]['btn_color'] . ';}' . PHP_EOL;
167
- $dynamic_css .= '#ssb-btn-' . $btn_id . ':hover{background:rgba(' . $R . ',' . $G . ',' . $B . ',0.9);}' . PHP_EOL;
168
- $dynamic_css .= '#ssb-btn-' . $btn_id . ' a{color: ' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . ';}' . PHP_EOL;
169
-
170
- // Share button color
171
- if ($btn_key == 0) {
172
- $dynamic_css .= '.ssb-share-btn,.ssb-share-btn .ssb-social-popup{background:' . $this->ui->buttons['btns'][$btn_id]['btn_color'] . ';color:' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . '}';
173
- $dynamic_css .= '.ssb-share-btn:hover{background:rgba(' . $R . ',' . $G . ',' . $B . ',0.9);}';
174
- $dynamic_css .= '.ssb-share-btn a{color:' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . ' !important;}';
175
- }
176
-
177
- }
178
-
179
- }
180
-
181
- // Inline CSS
182
- wp_add_inline_style('ssb-ui-style', $dynamic_css);
183
-
184
-
185
- // JS
186
- wp_enqueue_script('jquery-ui-core');
187
- wp_enqueue_script('jquery-effects-shake');
188
- wp_enqueue_script('ssb-ui-js', plugins_url('assets/js/ssb-ui-js.js', __FILE__));
189
-
190
- }
191
-
192
-
193
- }
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Main plugin class
5
+ */
6
+ class ssb_main {
7
+
8
+ /**
9
+ * @var object $ui
10
+ */
11
+ public $ui;
12
+
13
+
14
+ /**
15
+ * Dump everything for this plugin here :p
16
+ *
17
+ * @since 1.0
18
+ */
19
+ public function __construct() {
20
+
21
+ // User interfaces object
22
+ $this->ui = new ssb_ui;
23
+
24
+ // Pull stored data
25
+ $this->settings = get_option( 'ssb_settings' );
26
+
27
+ // Plugin text domain
28
+ add_action( 'init', array( $this, 'ssb_textdomain' ) );
29
+
30
+ // Register settings
31
+ add_action( 'admin_init', array( $this, 'ssb_register_settings' ) );
32
+
33
+ // Admin menu
34
+ add_action( 'admin_menu', array( $this, 'ssb_admin_menu' ) );
35
+
36
+ // Admin assets
37
+ add_action( 'admin_enqueue_scripts', array( $this, 'ssb_admin_assets' ) );
38
+
39
+ // Admin notices
40
+ add_action( 'admin_notices', array( $this, 'ssb_admin_notices' ) );
41
+
42
+ // Icons UI
43
+ add_action( 'wp_footer', array( $this->ui, 'icons' ) );
44
+
45
+ add_action( 'wp_enqueue_scripts', array( $this, 'ssb_ui_assets' ) );
46
+
47
+
48
+ }
49
+
50
+
51
+ /**
52
+ * Load text domain
53
+ *
54
+ * @since 1.0
55
+ */
56
+ public function ssb_textdomain() {
57
+
58
+ load_plugin_textdomain( 'sticky-side-buttons', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
59
+
60
+ }
61
+
62
+
63
+ /**
64
+ * Register settings
65
+ *
66
+ * @since 1.0
67
+ */
68
+ public function ssb_register_settings() {
69
+
70
+ register_setting( 'ssb_storage', 'ssb_settings' );
71
+ register_setting( 'ssb_storage', 'ssb_buttons' );
72
+
73
+ }
74
+
75
+
76
+ /**
77
+ * Admin menu
78
+ *
79
+ * @since 1.0
80
+ */
81
+ public function ssb_admin_menu() {
82
+
83
+ add_menu_page(
84
+ __( 'Sticky Side Buttons', 'sticky-side-buttons' ),
85
+ __( 'Sticky Side Buttons', 'sticky-side-buttons' ),
86
+ 'manage_options',
87
+ 'ssb',
88
+ array(
89
+ $this->ui,
90
+ 'admin_page'
91
+ ),
92
+ 'dashicons-list-view'
93
+ );
94
+
95
+ }
96
+
97
+
98
+ /**
99
+ * Admin style
100
+ *
101
+ * @since 1.0
102
+ */
103
+ public function ssb_admin_assets() {
104
+
105
+ // CSS
106
+ wp_enqueue_style( 'ssb-admin-style', plugins_url( 'assets/css/ssb-admin-style.css', __FILE__ ) );
107
+ wp_enqueue_style( 'ssb-fontawesome', plugins_url( 'assets/css/font-awesome.css', __FILE__ ) );
108
+ wp_enqueue_style( 'ssb-iconpicker', plugins_url( 'assets/css/fontawesome-iconpicker.css', __FILE__ ) );
109
+ wp_enqueue_style( 'wp-color-picker' );
110
+
111
+ // JS
112
+ wp_enqueue_script( 'jquery-ui-core' );
113
+ wp_enqueue_script( 'jquery-ui-accordion' );
114
+ wp_enqueue_script( 'jquery-ui-sortable' );
115
+ wp_enqueue_script( 'wp-color-picker' );
116
+ wp_enqueue_script( 'ssb-iconpicker-js', plugins_url( 'assets/js/fontawesome-iconpicker.js', __FILE__ ) );
117
+ wp_enqueue_script( 'ssb-admin-js', plugins_url( 'assets/js/ssb-admin-js.js', __FILE__ ) );
118
+
119
+ }
120
+
121
+
122
+ /**
123
+ * Admin notices
124
+ *
125
+ * @since 1.0
126
+ */
127
+ public function ssb_admin_notices() {
128
+
129
+ // Get current screen
130
+ $screen = get_current_screen();
131
+
132
+ /**
133
+ * If settings updated successfully
134
+ */
135
+ if ( isset( $_GET['settings-updated'] ) && $screen->id == 'toplevel_page_ssb' ) {
136
+ ?>
137
+ <div class="notice notice-success is-dismissible">
138
+ <p>Changes has been saved successfully!</p>
139
+ </div>
140
+ <?php
141
+ }
142
+
143
+ }
144
+
145
+
146
+ /**
147
+ * UI Assets
148
+ *
149
+ * @since 1.0
150
+ */
151
+ public function ssb_ui_assets() {
152
+
153
+ // CSS
154
+ wp_enqueue_style( 'ssb-ui-style', plugins_url( 'assets/css/ssb-ui-style.css', __FILE__ ) );
155
+ wp_enqueue_style( 'ssb-fontawesome', plugins_url( 'assets/css/font-awesome.css', __FILE__ ) );
156
+
157
+ $dynamic_css = null;
158
+
159
+ if ($this->ui->buttons['btns']) {
160
+
161
+ foreach ( $this->ui->btns_order AS $btn_key => $btn_id ) {
162
+
163
+ // Hex to RGB
164
+ $hex = str_replace('#', '', $this->ui->buttons['btns'][$btn_id]['btn_color']);
165
+ $R = hexdec(substr($hex, 0, 2));
166
+ $G = hexdec(substr($hex, 2, 2));
167
+ $B = hexdec(substr($hex, 4, 2));
168
+
169
+ $dynamic_css .= '#ssb-btn-' . $btn_id . '{background: ' . $this->ui->buttons['btns'][$btn_id]['btn_color'] . ';}' . PHP_EOL;
170
+ $dynamic_css .= '#ssb-btn-' . $btn_id . ':hover{background:rgba(' . $R . ',' . $G . ',' . $B . ',0.9);}' . PHP_EOL;
171
+ $dynamic_css .= '#ssb-btn-' . $btn_id . ' a{color: ' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . ';}' . PHP_EOL;
172
+
173
+ // Share button color
174
+ if ($btn_key == 0) {
175
+ $dynamic_css .= '.ssb-share-btn,.ssb-share-btn .ssb-social-popup{background:' . $this->ui->buttons['btns'][$btn_id]['btn_color'] . ';color:' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . '}';
176
+ $dynamic_css .= '.ssb-share-btn:hover{background:rgba(' . $R . ',' . $G . ',' . $B . ',0.9);}';
177
+ $dynamic_css .= '.ssb-share-btn a{color:' . $this->ui->buttons['btns'][$btn_id]['btn_font_color'] . ' !important;}';
178
+ }
179
+
180
+ }
181
+
182
+ }
183
+
184
+ // Inline CSS
185
+ wp_add_inline_style('ssb-ui-style', $dynamic_css);
186
+
187
+
188
+ // JS
189
+ wp_enqueue_script('jquery-ui-core');
190
+ wp_enqueue_script('jquery-effects-shake');
191
+ wp_enqueue_script('ssb-ui-js', plugins_url('assets/js/ssb-ui-js.js', __FILE__));
192
+
193
+ $btn_z_index = isset( $this->settings['btn_z_index'] ) ? $this->settings['btn_z_index'] : 1;
194
+ wp_localize_script( 'ssb-ui-js', 'ssb_ui_data', array(
195
+ 'z_index' => intval( $btn_z_index )
196
+ ));
197
+ }
198
+
199
+
200
+ }
ssb-ui.php CHANGED
@@ -1,380 +1,394 @@
1
- <?php
2
-
3
- /**
4
- * Sticky Side Buttons UIs
5
- *
6
- * User Interface class which will contain
7
- * UI for the front and admin panel
8
- */
9
- class ssb_ui {
10
-
11
- /**
12
- * @var array $buttons
13
- * @var array $settings
14
- */
15
- public $buttons;
16
- public $settings;
17
- public $btns_order;
18
-
19
- /**
20
- * Dump everything for this class here
21
- *
22
- * @since 1.0
23
- */
24
- public function __construct() {
25
-
26
- // Pull stored data
27
- $this->buttons = get_option( 'ssb_buttons' );
28
- $this->settings = get_option( 'ssb_settings' );
29
-
30
- // Buttons Sorting
31
- $this->btns_order = explode( '&', str_replace( 'sort=', '', $this->buttons['btns_order'] ) );
32
-
33
- }
34
-
35
-
36
- /**
37
- * Admin Page UI
38
- *
39
- * @since 1.0
40
- */
41
- public function admin_page() {
42
- ?>
43
- <div class="wrap" id="ssb-wrap">
44
- <h1>
45
- <?php echo get_admin_page_title(); ?>
46
- </h1>
47
- <form method="post" action="options.php">
48
- <?php
49
-
50
- // Button builder
51
- $this->button_builder();
52
-
53
- // General settings
54
- $this->general_settings();
55
-
56
- ?>
57
- </form>
58
- </div>
59
- <?php
60
- }
61
-
62
-
63
- /**
64
- * Button Builder UI Part
65
- *
66
- * @since 1.0
67
- */
68
- public function button_builder() {
69
- ?>
70
- <div class="ssb-panel">
71
- <?php settings_fields( 'ssb_storage' ); ?>
72
- <input type="hidden" name="ssb_buttons[btns_order]" id="ssb-btns-order"
73
- value="<?php echo $this->buttons['btns_order'] ?>">
74
- <header class="ssb-panel-header">
75
- <?php _e( 'Button Builder', 'sticky-side-buttons' ); ?>
76
- </header>
77
- <div class="ssb-panel-body">
78
- <p><?php _e( 'Add buttons then drag and drop to reorder them. Click the arrow on the right of each item to reveal more configuration options.', 'sticky-side-buttons' ); ?></p>
79
- <p><a href="#" class="button ssb-add-btn"><?php _e( 'Add Button', 'sticky-side-buttons' ); ?></a></p>
80
-
81
- <ul id="ssb-sortable-buttons">
82
- <?php
83
-
84
- // Buttons exists
85
- if ( isset( $this->buttons['btns'] ) ) {
86
-
87
- // Buttons loop + ordering
88
- foreach ( $this->btns_order AS $btn_key => $btn_id ) {
89
- ?>
90
- <li id="ssb_btn_<?php echo $btn_id; ?>">
91
- <header>
92
- <i class="fa fa-caret-down" aria-hidden="true"></i>
93
- <?php echo $this->buttons['btns'][ $btn_id ]['btn_text']; ?>
94
- </header>
95
- <div class="ssb-btn-body">
96
- <div class="ssb-body-left">
97
- <p>
98
- <label for="button-text-<?php echo $btn_id; ?>">Button Text</label>
99
- <input type="text"
100
- id="button-text-<?php echo $btn_id; ?>"
101
- class="widefat"
102
- name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_text]"
103
- value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_text']; ?>">
104
- </p>
105
- <p class="ssb-iconpicker-container">
106
- <label for="button-icon-<?php echo $btn_id; ?>">Button icon</label>
107
- <input type="text"
108
- id="button-icon-<?php echo $btn_id; ?>"
109
- class="widefat ssb-iconpicker"
110
- data-placement="bottomRight"
111
- name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_icon]"
112
- value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_icon']; ?>">
113
- <span class="ssb-icon-preview input-group-addon"></span>
114
- </p>
115
- <p>
116
- <label for="button-link-<?php echo $btn_id; ?>">link URL</label>
117
- <input type="text"
118
- id="button-link-<?php echo $btn_id; ?>"
119
- class="widefat"
120
- name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_link]"
121
- value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>">
122
- </p>
123
- </div>
124
- <div class="ssb-body-right">
125
- <p>
126
- <label for="button-color-<?php echo $btn_id; ?>">Button Color</label>
127
- <input type="text"
128
- id="button-color-<?php echo $btn_id; ?>"
129
- class="widefat ssb-colorpicker"
130
- name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_color]"
131
- value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_color']; ?>">
132
- </p>
133
- <p>
134
- <label for="button-font-color-<?php echo $btn_id; ?>">font color</label>
135
- <input type="text"
136
- id="button-font-color-<?php echo $btn_id; ?>"
137
- class="widefat ssb-colorpicker"
138
- name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_font_color]"
139
- value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_font_color']; ?>">
140
- </p>
141
- </div>
142
- <div class="ssb-btn-controls">
143
- <a href="#" class="ssb-remove-btn">Remove</a> |
144
- <a href="#" class="ssb-close-btn">Close</a>
145
- </div>
146
- </div>
147
- </li>
148
- <?php
149
- }
150
- }
151
- ?>
152
- </ul>
153
-
154
- </div>
155
- <footer class="ssb-panel-footer">
156
- <input type="submit" class="button-primary"
157
- value="<?php _e( 'Save Buttons', 'sticky-side-buttons' ); ?>">
158
- </footer>
159
- </div>
160
- <?php
161
- return true;
162
- }
163
-
164
-
165
- /**
166
- * General Settings UI Part
167
- *
168
- * @since 1.0
169
- */
170
- public
171
- function general_settings() {
172
- ?>
173
- <div class="ssb-panel">
174
- <?php settings_fields( 'ssb_storage' ); ?>
175
- <header class="ssb-panel-header">
176
- <?php _e( 'General Settings', 'sticky-side-buttons' ); ?>
177
- </header>
178
- <div class="ssb-panel-body">
179
- <div class="ssb-row">
180
- <div class="ssb-col">
181
- <label for="ssb-pos-left">
182
- <strong><?php _e( 'Button Position', 'sticky-side-buttons' ); ?>:</strong>
183
- </label>
184
- </div>
185
- <div class="ssb-col">
186
- <label for="ssb-pos-left">
187
- <input type="radio"
188
- name="ssb_settings[btn_pos]"
189
- id="ssb-pos-left"
190
- value="left"
191
- <?php echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'left' ) ? ' checked="checked"' : ''; ?>>
192
- <?php _e( 'Left', 'sticky-side-buttons' ); ?>
193
- </label>
194
- </div>
195
- <div class="ssb-col">
196
- <label for="ssb-pos-right">
197
- <input type="radio"
198
- name="ssb_settings[btn_pos]"
199
- id="ssb-pos-right"
200
- value="right"
201
- <?php echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'right' ) ? ' checked="checked"' : ''; ?>>
202
- <?php _e( 'Right', 'sticky-side-buttons' ); ?>
203
- </label>
204
- </div>
205
- </div>
206
-
207
- <div class="ssb-row">
208
- <div class="ssb-col">
209
- <label for="ssb-btn-dark">
210
- <strong><?php _e( 'Rollover Style', 'sticky-side-buttons' ); ?>:</strong>
211
- </label>
212
- </div>
213
- <div class="ssb-col">
214
- <label for="ssb-btn-dark">
215
- <input type="radio"
216
- name="ssb_settings[btn_hover]"
217
- id="ssb-btn-dark"
218
- value="dark"
219
- <?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'dark' ) ? ' checked="checked"' : ''; ?>>
220
- <?php _e( 'Darken', 'sticky-side-buttons' ); ?>
221
- </label>
222
- </div>
223
- <div class="ssb-col">
224
- <label for="ssb-btn-light">
225
- <input type="radio"
226
- name="ssb_settings[btn_hover]"
227
- id="ssb-btn-light"
228
- value="light"
229
- <?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'light' ) ? ' checked="checked"' : ''; ?>>
230
- <?php _e( 'Lighten', 'sticky-side-buttons' ); ?>
231
- </label>
232
- </div>
233
- </div>
234
-
235
- <div class="ssb-row">
236
- <div class="ssb-col">
237
- <label for="ssb-btn-none">
238
- <strong><?php _e( 'Animation', 'sticky-side-buttons' ); ?>:</strong>
239
- </label>
240
- </div>
241
- <div class="ssb-col">
242
- <label for="ssb-btn-none">
243
- <input type="radio"
244
- name="ssb_settings[btn_anim]"
245
- id="ssb-btn-none"
246
- value="none"
247
- <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'none' ) ? ' checked="checked"' : ''; ?>>
248
- <?php _e( 'None', 'sticky-side-buttons' ); ?>
249
- </label>
250
- </div>
251
- <div class="ssb-col">
252
- <label for="ssb-btn-slide">
253
- <input type="radio"
254
- name="ssb_settings[btn_anim]"
255
- id="ssb-btn-slide"
256
- value="slide"
257
- <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'slide' ) ? ' checked="checked"' : ''; ?>>
258
- <?php _e( 'Slide', 'sticky-side-buttons' ); ?>
259
- </label>
260
- </div>
261
- <div class="ssb-col">
262
- <label for="ssb-btn-icons">
263
- <input type="radio"
264
- name="ssb_settings[btn_anim]"
265
- id="ssb-btn-icons"
266
- value="icons"
267
- <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'icons' ) ? ' checked="checked"' : ''; ?>>
268
- <?php _e( 'Icons Only', 'sticky-side-buttons' ); ?>
269
- </label>
270
- </div>
271
- </div>
272
-
273
- <div class="ssb-row">
274
- <div class="ssb-col">
275
- <label for="ssb-btn-disable">
276
- <strong><?php _e( 'Enable Social Sharing', 'sticky-side-buttons' ); ?>:</strong>
277
- </label>
278
- </div>
279
- <div class="ssb-col">
280
- <label for="ssb-btn-share">
281
- <input type="checkbox"
282
- name="ssb_settings[btn_share]"
283
- id="ssb-btn-share"
284
- value="1"
285
- <?php echo ( isset( $this->settings['btn_share'] ) && $this->settings['btn_share'] == 1 ) ? ' checked="checked"' : ''; ?>>
286
- </label>
287
- </div>
288
- </div>
289
-
290
- <div class="ssb-row">
291
- <div class="ssb-col">
292
- <label for="ssb-btn-disable">
293
- <strong><?php _e( 'Disable on Mobile', 'sticky-side-buttons' ); ?>:</strong>
294
- </label>
295
- </div>
296
- <div class="ssb-col">
297
- <label for="ssb-btn-disable">
298
- <input type="checkbox"
299
- name="ssb_settings[btn_disable_mobile]"
300
- id="ssb-btn-disable"
301
- value="1"
302
- <?php echo ( isset( $this->settings['btn_disable_mobile'] ) && $this->settings['btn_disable_mobile'] == 1 ) ? ' checked="checked"' : ''; ?>>
303
- </label>
304
- </div>
305
- </div>
306
-
307
-
308
- </div>
309
- <footer class="ssb-panel-footer">
310
- <input type="submit" class="button-primary"
311
- value="<?php _e( 'Save Settings', 'sticky-side-buttons' ); ?>">
312
- </footer>
313
- </div>
314
- <?php
315
- return true;
316
- }
317
-
318
-
319
- /**
320
- * Icons UI Part
321
- *
322
- * @since 1.0
323
- */
324
- public function icons() {
325
-
326
- // Buttons exists
327
- if ( isset( $this->buttons['btns'] ) ) {
328
- ?>
329
- <div id="ssb-container"
330
- class="<?php
331
- echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'left' ) ? 'ssb-btns-left' : 'ssb-btns-right';
332
- echo ( isset( $this->settings['btn_disable_mobile'] ) ) ? ' ssb-disable-on-mobile' : '';
333
- echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'slide' ) ? ' ssb-anim-slide' : '';
334
- echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'icons' ) ? ' ssb-anim-icons' : '';
335
- ?>">
336
- <ul class="<?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'light' ) ? 'ssb-light-hover' : 'ssb-dark-hover'; ?>">
337
- <?php
338
- // Buttons loop + ordering
339
- foreach ( $this->btns_order AS $btn_key => $btn_id ) {
340
- ?>
341
- <li id="ssb-btn-<?php echo $btn_id; ?>">
342
- <p>
343
- <a href="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>"><?php
344
- echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_icon'] ) && $this->buttons['btns'][ $btn_id ]['btn_icon'] ) ? '<i class="fa ' . $this->buttons['btns'][ $btn_id ]['btn_icon'] . '"></i> ' : '';
345
- echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_text'] ) && ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] != 'icons' ) ) ? $this->buttons['btns'][ $btn_id ]['btn_text'] : ' &nbsp; ';
346
- ?></a>
347
- </p>
348
- </li>
349
- <?php
350
- }
351
-
352
- // Social Icons
353
- if ( isset( $this->settings['btn_share'] ) ) {
354
- ?>
355
- <li class="ssb-share-btn">
356
- <p>
357
- <a href="#"><i
358
- class="fa fa-share-alt ssb-share-icon"></i> <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] != 'icons' ) ? 'Social Share ' : ' &nbsp;&nbsp; '; ?>
359
- </a>
360
- </p>
361
- <div class="ssb-social-popup">
362
- <a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink() ?>"
363
- onclick="window.open(this.href, 'facebook', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-facebook-official"></i> Facebook</a>
364
- <a href="https://twitter.com/home?status=<?php the_permalink(); ?>"
365
- onclick="window.open(this.href, 'twitter', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-twitter"></i> Twitter</a>
366
- <a href="https://plus.google.com/share?url=<?php the_permalink(); ?>"
367
- onclick="window.open(this.href, 'google', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-google-plus"></i> Google+</a>
368
- </div>
369
- </li>
370
- <?php
371
- }
372
- ?>
373
- </ul>
374
- </div>
375
- <?php
376
- }
377
- }
378
-
379
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  }
1
+ <?php
2
+
3
+ /**
4
+ * Sticky Side Buttons UIs
5
+ *
6
+ * User Interface class which will contain
7
+ * UI for the front and admin panel
8
+ */
9
+ class ssb_ui {
10
+
11
+ /**
12
+ * @var array $buttons
13
+ * @var array $settings
14
+ */
15
+ public $buttons;
16
+ public $settings;
17
+ public $btns_order;
18
+
19
+ /**
20
+ * Dump everything for this class here
21
+ *
22
+ * @since 1.0
23
+ */
24
+ public function __construct() {
25
+
26
+ // Pull stored data
27
+ $this->buttons = get_option( 'ssb_buttons' );
28
+ $this->settings = get_option( 'ssb_settings' );
29
+
30
+ // Buttons Sorting
31
+ $this->btns_order = explode( '&', str_replace( 'sort=', '', $this->buttons['btns_order'] ) );
32
+
33
+ }
34
+
35
+
36
+ /**
37
+ * Admin Page UI
38
+ *
39
+ * @since 1.0
40
+ */
41
+ public function admin_page() {
42
+ ?>
43
+ <div class="wrap" id="ssb-wrap">
44
+ <h1>
45
+ <?php echo get_admin_page_title(); ?>
46
+ </h1>
47
+ <form method="post" action="options.php">
48
+ <?php
49
+
50
+ // Button builder
51
+ $this->button_builder();
52
+
53
+ // General settings
54
+ $this->general_settings();
55
+
56
+ ?>
57
+ </form>
58
+ </div>
59
+ <?php
60
+ }
61
+
62
+
63
+ /**
64
+ * Button Builder UI Part
65
+ *
66
+ * @since 1.0
67
+ */
68
+ public function button_builder() {
69
+ ?>
70
+ <div class="ssb-panel">
71
+ <?php settings_fields( 'ssb_storage' ); ?>
72
+ <input type="hidden" name="ssb_buttons[btns_order]" id="ssb-btns-order"
73
+ value="<?php echo $this->buttons['btns_order'] ?>">
74
+ <header class="ssb-panel-header">
75
+ <?php _e( 'Button Builder', 'sticky-side-buttons' ); ?>
76
+ </header>
77
+ <div class="ssb-panel-body">
78
+ <p><?php _e( 'Add buttons then drag and drop to reorder them. Click the arrow on the right of each item to reveal more configuration options.', 'sticky-side-buttons' ); ?></p>
79
+ <p><a href="#" class="button ssb-add-btn"><?php _e( 'Add Button', 'sticky-side-buttons' ); ?></a></p>
80
+
81
+ <ul id="ssb-sortable-buttons">
82
+ <?php
83
+
84
+ // Buttons exists
85
+ if ( isset( $this->buttons['btns'] ) ) {
86
+
87
+ // Buttons loop + ordering
88
+ foreach ( $this->btns_order AS $btn_key => $btn_id ) {
89
+ ?>
90
+ <li id="ssb_btn_<?php echo $btn_id; ?>">
91
+ <header>
92
+ <i class="fa fa-caret-down" aria-hidden="true"></i>
93
+ <?php echo $this->buttons['btns'][ $btn_id ]['btn_text']; ?>
94
+ </header>
95
+ <div class="ssb-btn-body">
96
+ <div class="ssb-body-left">
97
+ <p>
98
+ <label for="button-text-<?php echo $btn_id; ?>">Button Text</label>
99
+ <input type="text"
100
+ id="button-text-<?php echo $btn_id; ?>"
101
+ class="widefat"
102
+ name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_text]"
103
+ value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_text']; ?>">
104
+ </p>
105
+ <p class="ssb-iconpicker-container">
106
+ <label for="button-icon-<?php echo $btn_id; ?>">Button icon</label>
107
+ <input type="text"
108
+ id="button-icon-<?php echo $btn_id; ?>"
109
+ class="widefat ssb-iconpicker"
110
+ data-placement="bottomRight"
111
+ name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_icon]"
112
+ value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_icon']; ?>">
113
+ <span class="ssb-icon-preview input-group-addon"></span>
114
+ </p>
115
+ <p>
116
+ <label for="button-link-<?php echo $btn_id; ?>">link URL</label>
117
+ <input type="text"
118
+ id="button-link-<?php echo $btn_id; ?>"
119
+ class="widefat"
120
+ name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_link]"
121
+ value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>">
122
+ </p>
123
+ </div>
124
+ <div class="ssb-body-right">
125
+ <p>
126
+ <label for="button-color-<?php echo $btn_id; ?>">Button Color</label>
127
+ <input type="text"
128
+ id="button-color-<?php echo $btn_id; ?>"
129
+ class="widefat ssb-colorpicker"
130
+ name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_color]"
131
+ value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_color']; ?>">
132
+ </p>
133
+ <p>
134
+ <label for="button-font-color-<?php echo $btn_id; ?>">font color</label>
135
+ <input type="text"
136
+ id="button-font-color-<?php echo $btn_id; ?>"
137
+ class="widefat ssb-colorpicker"
138
+ name="ssb_buttons[btns][<?php echo $btn_id; ?>][btn_font_color]"
139
+ value="<?php echo $this->buttons['btns'][ $btn_id ]['btn_font_color']; ?>">
140
+ </p>
141
+ </div>
142
+ <div class="ssb-btn-controls">
143
+ <a href="#" class="ssb-remove-btn">Remove</a> |
144
+ <a href="#" class="ssb-close-btn">Close</a>
145
+ </div>
146
+ </div>
147
+ </li>
148
+ <?php
149
+ }
150
+ }
151
+ ?>
152
+ </ul>
153
+
154
+ </div>
155
+ <footer class="ssb-panel-footer">
156
+ <input type="submit" class="button-primary"
157
+ value="<?php _e( 'Save Buttons', 'sticky-side-buttons' ); ?>">
158
+ </footer>
159
+ </div>
160
+ <?php
161
+ return true;
162
+ }
163
+
164
+
165
+ /**
166
+ * General Settings UI Part
167
+ *
168
+ * @since 1.0
169
+ */
170
+ public
171
+ function general_settings() {
172
+ ?>
173
+ <div class="ssb-panel">
174
+ <?php settings_fields( 'ssb_storage' ); ?>
175
+ <header class="ssb-panel-header">
176
+ <?php _e( 'General Settings', 'sticky-side-buttons' ); ?>
177
+ </header>
178
+ <div class="ssb-panel-body">
179
+ <div class="ssb-row">
180
+ <div class="ssb-col">
181
+ <label for="ssb-pos-left">
182
+ <strong><?php _e( 'Button Position', 'sticky-side-buttons' ); ?>:</strong>
183
+ </label>
184
+ </div>
185
+ <div class="ssb-col">
186
+ <label for="ssb-pos-left">
187
+ <input type="radio"
188
+ name="ssb_settings[btn_pos]"
189
+ id="ssb-pos-left"
190
+ value="left"
191
+ <?php echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'left' ) ? ' checked="checked"' : ''; ?>>
192
+ <?php _e( 'Left', 'sticky-side-buttons' ); ?>
193
+ </label>
194
+ </div>
195
+ <div class="ssb-col">
196
+ <label for="ssb-pos-right">
197
+ <input type="radio"
198
+ name="ssb_settings[btn_pos]"
199
+ id="ssb-pos-right"
200
+ value="right"
201
+ <?php echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'right' ) ? ' checked="checked"' : ''; ?>>
202
+ <?php _e( 'Right', 'sticky-side-buttons' ); ?>
203
+ </label>
204
+ </div>
205
+ </div>
206
+
207
+ <div class="ssb-row">
208
+ <div class="ssb-col">
209
+ <label for="ssb-btn-dark">
210
+ <strong><?php _e( 'Rollover Style', 'sticky-side-buttons' ); ?>:</strong>
211
+ </label>
212
+ </div>
213
+ <div class="ssb-col">
214
+ <label for="ssb-btn-dark">
215
+ <input type="radio"
216
+ name="ssb_settings[btn_hover]"
217
+ id="ssb-btn-dark"
218
+ value="dark"
219
+ <?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'dark' ) ? ' checked="checked"' : ''; ?>>
220
+ <?php _e( 'Darken', 'sticky-side-buttons' ); ?>
221
+ </label>
222
+ </div>
223
+ <div class="ssb-col">
224
+ <label for="ssb-btn-light">
225
+ <input type="radio"
226
+ name="ssb_settings[btn_hover]"
227
+ id="ssb-btn-light"
228
+ value="light"
229
+ <?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'light' ) ? ' checked="checked"' : ''; ?>>
230
+ <?php _e( 'Lighten', 'sticky-side-buttons' ); ?>
231
+ </label>
232
+ </div>
233
+ </div>
234
+
235
+ <div class="ssb-row">
236
+ <div class="ssb-col">
237
+ <label for="ssb-btn-none">
238
+ <strong><?php _e( 'Animation', 'sticky-side-buttons' ); ?>:</strong>
239
+ </label>
240
+ </div>
241
+ <div class="ssb-col">
242
+ <label for="ssb-btn-none">
243
+ <input type="radio"
244
+ name="ssb_settings[btn_anim]"
245
+ id="ssb-btn-none"
246
+ value="none"
247
+ <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'none' ) ? ' checked="checked"' : ''; ?>>
248
+ <?php _e( 'None', 'sticky-side-buttons' ); ?>
249
+ </label>
250
+ </div>
251
+ <div class="ssb-col">
252
+ <label for="ssb-btn-slide">
253
+ <input type="radio"
254
+ name="ssb_settings[btn_anim]"
255
+ id="ssb-btn-slide"
256
+ value="slide"
257
+ <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'slide' ) ? ' checked="checked"' : ''; ?>>
258
+ <?php _e( 'Slide', 'sticky-side-buttons' ); ?>
259
+ </label>
260
+ </div>
261
+ <div class="ssb-col">
262
+ <label for="ssb-btn-icons">
263
+ <input type="radio"
264
+ name="ssb_settings[btn_anim]"
265
+ id="ssb-btn-icons"
266
+ value="icons"
267
+ <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'icons' ) ? ' checked="checked"' : ''; ?>>
268
+ <?php _e( 'Icons Only', 'sticky-side-buttons' ); ?>
269
+ </label>
270
+ </div>
271
+ </div>
272
+
273
+ <div class="ssb-row">
274
+ <div class="ssb-col">
275
+ <label for="ssb-btn-disable">
276
+ <strong><?php _e( 'Enable Social Sharing', 'sticky-side-buttons' ); ?>:</strong>
277
+ </label>
278
+ </div>
279
+ <div class="ssb-col">
280
+ <label for="ssb-btn-share">
281
+ <input type="checkbox"
282
+ name="ssb_settings[btn_share]"
283
+ id="ssb-btn-share"
284
+ value="1"
285
+ <?php echo ( isset( $this->settings['btn_share'] ) && $this->settings['btn_share'] == 1 ) ? ' checked="checked"' : ''; ?>>
286
+ </label>
287
+ </div>
288
+ </div>
289
+
290
+ <div class="ssb-row">
291
+ <div class="ssb-col">
292
+ <label for="ssb-btn-disable">
293
+ <strong><?php _e( 'Disable on Mobile', 'sticky-side-buttons' ); ?>:</strong>
294
+ </label>
295
+ </div>
296
+ <div class="ssb-col">
297
+ <label for="ssb-btn-disable">
298
+ <input type="checkbox"
299
+ name="ssb_settings[btn_disable_mobile]"
300
+ id="ssb-btn-disable"
301
+ value="1"
302
+ <?php echo ( isset( $this->settings['btn_disable_mobile'] ) && $this->settings['btn_disable_mobile'] == 1 ) ? ' checked="checked"' : ''; ?>>
303
+ </label>
304
+ </div>
305
+ </div>
306
+
307
+ <div class="ssb-row">
308
+ <div class="ssb-col">
309
+ <label for="ssb-btn-z-index">
310
+ <strong><?php _e( 'z-index', 'sticky-side-buttons' ); ?>:</strong>
311
+ </label>
312
+ </div>
313
+ <div class="ssb-col">
314
+ <input type="number"
315
+ name="ssb_settings[btn_z_index]"
316
+ id="ssb-btn-z-index" class="small-text"
317
+ value="<?php echo isset( $this->settings['btn_z_index'] ) ? intval( $this->settings['btn_z_index'] ) : 1 ?>">
318
+
319
+ </div>
320
+ </div>
321
+
322
+ </div>
323
+ <footer class="ssb-panel-footer">
324
+ <input type="submit" class="button-primary"
325
+ value="<?php _e( 'Save Settings', 'sticky-side-buttons' ); ?>">
326
+ </footer>
327
+ </div>
328
+ <?php
329
+ return true;
330
+ }
331
+
332
+
333
+ /**
334
+ * Icons UI Part
335
+ *
336
+ * @since 1.0
337
+ */
338
+ public function icons() {
339
+
340
+ // Buttons exists
341
+ if ( isset( $this->buttons['btns'] ) ) {
342
+ ?>
343
+ <div id="ssb-container"
344
+ class="<?php
345
+ echo ( isset( $this->settings['btn_pos'] ) && $this->settings['btn_pos'] == 'left' ) ? 'ssb-btns-left' : 'ssb-btns-right';
346
+ echo ( isset( $this->settings['btn_disable_mobile'] ) ) ? ' ssb-disable-on-mobile' : '';
347
+ echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'slide' ) ? ' ssb-anim-slide' : '';
348
+ echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] == 'icons' ) ? ' ssb-anim-icons' : '';
349
+ ?>">
350
+ <ul class="<?php echo ( isset( $this->settings['btn_hover'] ) && $this->settings['btn_hover'] == 'light' ) ? 'ssb-light-hover' : 'ssb-dark-hover'; ?>">
351
+ <?php
352
+ // Buttons loop + ordering
353
+ foreach ( $this->btns_order AS $btn_key => $btn_id ) {
354
+ ?>
355
+ <li id="ssb-btn-<?php echo $btn_id; ?>">
356
+ <p>
357
+ <a href="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>"><?php
358
+ echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_icon'] ) && $this->buttons['btns'][ $btn_id ]['btn_icon'] ) ? '<i class="fa ' . $this->buttons['btns'][ $btn_id ]['btn_icon'] . '"></i> ' : '';
359
+ echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_text'] ) && ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] != 'icons' ) ) ? $this->buttons['btns'][ $btn_id ]['btn_text'] : ' &nbsp; ';
360
+ ?></a>
361
+ </p>
362
+ </li>
363
+ <?php
364
+ }
365
+
366
+ // Social Icons
367
+ if ( isset( $this->settings['btn_share'] ) ) {
368
+ ?>
369
+ <li class="ssb-share-btn">
370
+ <p>
371
+ <a href="#"><i
372
+ class="fa fa-share-alt ssb-share-icon"></i> <?php echo ( isset( $this->settings['btn_anim'] ) && $this->settings['btn_anim'] != 'icons' ) ? 'Social Share ' : ' &nbsp;&nbsp; '; ?>
373
+ </a>
374
+ </p>
375
+ <div class="ssb-social-popup">
376
+ <a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink() ?>"
377
+ onclick="window.open(this.href, 'facebook', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-facebook-official"></i> Facebook</a>
378
+ <a href="https://twitter.com/home?status=<?php the_permalink(); ?>"
379
+ onclick="window.open(this.href, 'twitter', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-twitter"></i> Twitter</a>
380
+ <a href="https://plus.google.com/share?url=<?php the_permalink(); ?>"
381
+ onclick="window.open(this.href, 'google', 'left=60,top=40,width=500,height=500,toolbar=1,resizable=0'); return false;"><i class="fa fa-google-plus"></i> Google+</a>
382
+ </div>
383
+ </li>
384
+ <?php
385
+ }
386
+ ?>
387
+ </ul>
388
+ </div>
389
+ <?php
390
+ }
391
+ }
392
+
393
+
394
  }
sticky-side-buttons.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
- Version: 1.0.1
5
  Plugin URI: http://enigmaplugins.com.au/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Enigma Plugins
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
+ Version: 1.0.3
5
  Plugin URI: http://enigmaplugins.com.au/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Enigma Plugins