Sticky Side Buttons - Version 1.0.7

Version Description

  • Bug fix: errors when show on frontpage is checked
Download this release

Release Info

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

Code changes from version 1.0.6 to 1.0.7

Files changed (4) hide show
  1. readme.txt +6 -0
  2. ssb-main.php +1 -1
  3. ssb-ui.php +12 -12
  4. sticky-side-buttons.php +1 -1
readme.txt CHANGED
@@ -65,6 +65,9 @@ Absolutely! Please create a pull request on [GitHub here.](https://github.com/En
65
 
66
  == Changelog ==
67
 
 
 
 
68
  = 1.0.6 =
69
  * Support added for custom post types
70
 
@@ -94,6 +97,9 @@ Absolutely! Please create a pull request on [GitHub here.](https://github.com/En
94
 
95
  == Upgrade Notice ==
96
 
 
 
 
97
  = 1.0.6 =
98
  * Support added for custom post types
99
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.0.7 =
69
+ * Bug fix: errors when show on frontpage is checked
70
+
71
  = 1.0.6 =
72
  * Support added for custom post types
73
 
97
 
98
  == Upgrade Notice ==
99
 
100
+ = 1.0.7 =
101
+ * Bug fix: errors when show on frontpage is checked
102
+
103
  = 1.0.6 =
104
  * Support added for custom post types
105
 
ssb-main.php CHANGED
@@ -158,7 +158,7 @@ class ssb_main {
158
 
159
  $dynamic_css = null;
160
 
161
- if ($this->ui->buttons['btns']) {
162
 
163
  foreach ( $this->ui->btns_order AS $btn_key => $btn_id ) {
164
 
158
 
159
  $dynamic_css = null;
160
 
161
+ if (!empty($this->ui->buttons['btns']) && $this->ui->buttons['btns']) {
162
 
163
  foreach ( $this->ui->btns_order AS $btn_key => $btn_id ) {
164
 
ssb-ui.php CHANGED
@@ -26,8 +26,8 @@ class ssb_ui {
26
  public function __construct() {
27
 
28
  // Pull stored data
29
- $this->buttons = get_option( 'ssb_buttons' );
30
- $this->settings = get_option( 'ssb_settings' );
31
  $this->showoncpt = get_option( 'ssb_showoncpt' );
32
 
33
  // Buttons Sorting
@@ -359,20 +359,20 @@ class ssb_ui {
359
  <?php _e( 'Posts', 'sticky-side-buttons' ); ?>
360
  </label>
361
  </p>
362
- <?php $this->cpts = get_post_types( array( '_builtin' => false ), 'objects' );
363
- if ( $this->cpts ):
364
- foreach ( $this->cpts as $cpt ): ?>
365
  <p>
366
  <label for="show-on-<?php echo $cpt->name; ?>">
367
  <input type="checkbox"
368
  name="ssb_showoncpt[]"
369
  id="show-on-<?php echo $cpt->name; ?>"
370
  value="<?php echo $cpt->name; ?>"
371
- <?php echo ( in_array( $cpt->name, $this->showoncpt ) ) ? ' checked="checked"' : ''; ?>>
372
- <?php _e( $cpt->labels->name, 'sticky-side-buttons' ); ?>
373
  </label>
374
  </p>
375
- <?php endforeach; endif; ?>
376
  <p>
377
  <label for="show-on-frontpage">
378
  <input type="checkbox"
@@ -406,9 +406,9 @@ class ssb_ui {
406
  public function icons() {
407
 
408
  // Show on
409
- if ( ( $this->settings['show_on_pages'] && get_post_type() == 'page' && ! is_front_page() ) ||
410
- ( $this->settings['show_on_posts'] && ( get_post_type() == 'post' ) ) ||
411
- ( $this->settings['show_on_frontpage'] && is_front_page() ) || (in_array(get_post_type(), $this->showoncpt))) {
412
 
413
  // Buttons exists
414
  if ( isset( $this->buttons['btns'] ) ) {
@@ -427,7 +427,7 @@ class ssb_ui {
427
  ?>
428
  <li id="ssb-btn-<?php echo $btn_id; ?>">
429
  <p>
430
- <a href="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>" <?php echo ($this->buttons['btns'][ $btn_id ]['open_new_window']) ? 'target="_blank"' : ''; ?>><?php
431
  echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_icon'] ) && $this->buttons['btns'][ $btn_id ]['btn_icon'] ) ? '<span class="fa ' . $this->buttons['btns'][ $btn_id ]['btn_icon'] . '"></span> ' : '';
432
  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'], 'sticky-side-buttons' ) : ' &nbsp; ';
433
  ?></a>
26
  public function __construct() {
27
 
28
  // Pull stored data
29
+ $this->buttons = get_option( 'ssb_buttons' );
30
+ $this->settings = get_option( 'ssb_settings' );
31
  $this->showoncpt = get_option( 'ssb_showoncpt' );
32
 
33
  // Buttons Sorting
359
  <?php _e( 'Posts', 'sticky-side-buttons' ); ?>
360
  </label>
361
  </p>
362
+ <?php $this->cpts = get_post_types( array( '_builtin' => false ), 'objects' );
363
+ if ( $this->cpts ):
364
+ foreach ( $this->cpts as $cpt ): ?>
365
  <p>
366
  <label for="show-on-<?php echo $cpt->name; ?>">
367
  <input type="checkbox"
368
  name="ssb_showoncpt[]"
369
  id="show-on-<?php echo $cpt->name; ?>"
370
  value="<?php echo $cpt->name; ?>"
371
+ <?php echo ( in_array( $cpt->name, $this->showoncpt ) ) ? ' checked="checked"' : ''; ?>>
372
+ <?php _e( $cpt->labels->name, 'sticky-side-buttons' ); ?>
373
  </label>
374
  </p>
375
+ <?php endforeach; endif; ?>
376
  <p>
377
  <label for="show-on-frontpage">
378
  <input type="checkbox"
406
  public function icons() {
407
 
408
  // Show on
409
+ if ( ( isset( $this->settings['show_on_pages']) && $this->settings['show_on_pages'] && get_post_type() == 'page' && ! is_front_page() ) ||
410
+ ( isset($this->settings['show_on_posts']) && $this->settings['show_on_posts'] && ( get_post_type() == 'post' ) ) ||
411
+ ( isset($this->settings['show_on_frontpage']) && $this->settings['show_on_frontpage'] && is_front_page() ) || (!empty($this->showoncpt) && in_array( get_post_type(), $this->showoncpt ) ) ) {
412
 
413
  // Buttons exists
414
  if ( isset( $this->buttons['btns'] ) ) {
427
  ?>
428
  <li id="ssb-btn-<?php echo $btn_id; ?>">
429
  <p>
430
+ <a href="<?php echo $this->buttons['btns'][ $btn_id ]['btn_link']; ?>" <?php echo ( !empty($this->buttons['btns'][ $btn_id ]['open_new_window']) ) ? 'target="_blank"' : ''; ?>><?php
431
  echo ( isset( $this->buttons['btns'][ $btn_id ]['btn_icon'] ) && $this->buttons['btns'][ $btn_id ]['btn_icon'] ) ? '<span class="fa ' . $this->buttons['btns'][ $btn_id ]['btn_icon'] . '"></span> ' : '';
432
  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'], 'sticky-side-buttons' ) : ' &nbsp; ';
433
  ?></a>
sticky-side-buttons.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
- Version: 1.0.6
5
  Plugin URI: https://wordpress.org/plugins/sticky-side-buttons/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Maeve Lander
1
  <?php
2
  /*
3
  Plugin Name: Sticky Side Buttons
4
+ Version: 1.0.7
5
  Plugin URI: https://wordpress.org/plugins/sticky-side-buttons/
6
  Description: Flexible button creator allowing you to stick floating buttons to the side of your site.
7
  Author: Maeve Lander