Q2W3 Fixed Widget - Version 5.1.3

Version Description

  • Now compatible witht WP Page Widget plugin
Download this release

Release Info

Developer Max Bond
Plugin Icon 128x128 Q2W3 Fixed Widget
Version 5.1.3
Comparing to
See all releases

Code changes from version 5.1.2 to 5.1.3

Files changed (2) hide show
  1. q2w3-fixed-widget.php +49 -35
  2. readme.txt +4 -1
q2w3-fixed-widget.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.q2w3.ru/q2w3-fixed-widget-wordpress-plugin/
5
  Description: Fixes positioning of the selected widgets, when the page is scrolled down.
6
  Text Domain: q2w3-fixed-widget
7
  Author: Max Bond
8
- Version: 5.1.2
9
  Author URI: http://www.q2w3.ru/
10
  */
11
 
@@ -17,7 +17,7 @@ class q2w3_fixed_widget { // Plugin class
17
 
18
  const ID = 'q2w3_fixed_widget';
19
 
20
- const VERSION = '5.1.2';
21
 
22
  protected static $sidebars_widgets;
23
 
@@ -50,13 +50,17 @@ class q2w3_fixed_widget { // Plugin class
50
 
51
  if ( $options['fix-widget-id'] ) self::registered_sidebars_filter();
52
 
 
 
 
 
53
  //add_filter('widget_display_callback', array( __CLASS__, 'is_widget_fixed' ), $options['widget_display_callback_priority'], 3);
54
 
55
  //add_action('wp_loaded', array( __CLASS__, 'custom_ids' ));
56
 
57
  //add_action('wp_footer', array( __CLASS__, 'js_settings' ));
58
 
59
- add_action('wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ));
60
 
61
  }
62
 
@@ -72,49 +76,56 @@ class q2w3_fixed_widget { // Plugin class
72
 
73
  wp_enqueue_script(self::ID, plugin_dir_url( __FILE__ ) . 'js/q2w3-fixed-widget.min.js', array('jquery'), self::VERSION, true);
74
 
 
 
 
 
 
 
 
75
  $options = self::load_options();
76
 
77
  if ( is_array(self::$fixed_widgets) && !empty(self::$fixed_widgets) ) {
78
 
79
  if ( isset($options['window-load-enabled']) && $options['window-load-enabled'] == 'yes' ) $window_load_hook = true; else $window_load_hook = false;
80
-
81
  if ( isset($options['width-inherit']) && $options['width-inherit'] ) $width_inherit = true; else $width_inherit = false;
82
-
83
  if ( isset($options['disable-mo-api']) && $options['disable-mo-api'] ) $disable_mo_api = true; else $disable_mo_api = false;
84
-
85
  if ( $options['refresh-interval'] > 0 ) $refresh_interval = $options['refresh-interval']; else $refresh_interval = 0;
86
-
87
  $i = 0;
88
  $sidebar_options = array();
89
-
90
  foreach ( self::$fixed_widgets as $sidebar => $widgets ) {
91
-
92
  $sidebar_options[ $i ] = array(
93
- 'sidebar' => $sidebar,
94
- 'margin_top' => $options['margin-top'],
95
- 'margin_bottom' => $options['margin-bottom'],
96
- 'stop_id' => $options['stop-id'],
97
- 'screen_max_width' => $options['screen-max-width'],
98
- 'screen_max_height' => $options['screen-max-height'],
99
- 'width_inherit' => $width_inherit,
100
- 'refresh_interval' => $refresh_interval,
101
- 'window_load_hook' => $window_load_hook,
102
- 'disable_mo_api' => $disable_mo_api,
103
- 'widgets' => array_values( $widgets )
104
  );
105
-
106
  $i++;
107
-
108
  }
109
-
110
  wp_localize_script( self::ID, 'q2w3_sidebar_options', $sidebar_options );
111
-
112
- }
113
 
114
  }
115
 
116
 
117
- public static function fixed_wigets() {
118
 
119
  $sidebars = wp_get_sidebars_widgets();
120
 
@@ -127,7 +138,7 @@ class q2w3_fixed_widget { // Plugin class
127
  $widget_id = substr(strrchr($widget, '-'), 1);
128
 
129
  $widget_type = stristr($widget, '-'.$widget_id, true);
130
-
131
  $widget_options = get_option('widget_' . $widget_type);
132
 
133
  if ( isset($widget_options[$widget_id]['q2w3_fixed_widget']) && $widget_options[$widget_id]['q2w3_fixed_widget']) self::$fixed_widgets[$sidebar_id][$widget] = $widget;
@@ -141,23 +152,26 @@ class q2w3_fixed_widget { // Plugin class
141
  }
142
 
143
 
144
- /*public static function is_widget_fixed($instance, $widget, $args) { // deprecated
145
 
146
- if ( isset($instance['q2w3_fixed_widget']) && $instance['q2w3_fixed_widget'] ) {
147
 
148
  //self::$fixed_widgets[$args['id']][$widget->id] = "'". $widget->id ."'";
149
-
 
 
150
  self::$fixed_widgets[$args['id']][$widget->id] = $widget->id;
151
-
152
- echo '<!-- fixed widget -->';
153
 
 
 
154
  }
155
 
156
  return $instance;
157
 
158
- }*/
 
159
 
160
- public static function custom_ids() {
161
 
162
  $options = self::load_options();
163
 
@@ -179,7 +193,7 @@ class q2w3_fixed_widget { // Plugin class
179
 
180
  }
181
 
182
- public static function get_widget_sidebar($widget_id) {
183
 
184
  if ( !self::$sidebars_widgets ) {
185
 
5
  Description: Fixes positioning of the selected widgets, when the page is scrolled down.
6
  Text Domain: q2w3-fixed-widget
7
  Author: Max Bond
8
+ Version: 5.1.3
9
  Author URI: http://www.q2w3.ru/
10
  */
11
 
17
 
18
  const ID = 'q2w3_fixed_widget';
19
 
20
+ const VERSION = '5.1.3';
21
 
22
  protected static $sidebars_widgets;
23
 
50
 
51
  if ( $options['fix-widget-id'] ) self::registered_sidebars_filter();
52
 
53
+ add_action('wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ));
54
+
55
+ add_filter('widget_display_callback', array( __CLASS__, 'is_widget_fixed' ), 99, 3);
56
+
57
  //add_filter('widget_display_callback', array( __CLASS__, 'is_widget_fixed' ), $options['widget_display_callback_priority'], 3);
58
 
59
  //add_action('wp_loaded', array( __CLASS__, 'custom_ids' ));
60
 
61
  //add_action('wp_footer', array( __CLASS__, 'js_settings' ));
62
 
63
+
64
 
65
  }
66
 
76
 
77
  wp_enqueue_script(self::ID, plugin_dir_url( __FILE__ ) . 'js/q2w3-fixed-widget.min.js', array('jquery'), self::VERSION, true);
78
 
79
+ self::wp_localize_script();
80
+
81
+ }
82
+
83
+
84
+ protected static function wp_localize_script() {
85
+
86
  $options = self::load_options();
87
 
88
  if ( is_array(self::$fixed_widgets) && !empty(self::$fixed_widgets) ) {
89
 
90
  if ( isset($options['window-load-enabled']) && $options['window-load-enabled'] == 'yes' ) $window_load_hook = true; else $window_load_hook = false;
91
+
92
  if ( isset($options['width-inherit']) && $options['width-inherit'] ) $width_inherit = true; else $width_inherit = false;
93
+
94
  if ( isset($options['disable-mo-api']) && $options['disable-mo-api'] ) $disable_mo_api = true; else $disable_mo_api = false;
95
+
96
  if ( $options['refresh-interval'] > 0 ) $refresh_interval = $options['refresh-interval']; else $refresh_interval = 0;
97
+
98
  $i = 0;
99
  $sidebar_options = array();
100
+
101
  foreach ( self::$fixed_widgets as $sidebar => $widgets ) {
102
+
103
  $sidebar_options[ $i ] = array(
104
+ 'sidebar' => $sidebar,
105
+ 'margin_top' => $options['margin-top'],
106
+ 'margin_bottom' => $options['margin-bottom'],
107
+ 'stop_id' => $options['stop-id'],
108
+ 'screen_max_width' => $options['screen-max-width'],
109
+ 'screen_max_height' => $options['screen-max-height'],
110
+ 'width_inherit' => $width_inherit,
111
+ 'refresh_interval' => $refresh_interval,
112
+ 'window_load_hook' => $window_load_hook,
113
+ 'disable_mo_api' => $disable_mo_api,
114
+ 'widgets' => array_values( $widgets )
115
  );
116
+
117
  $i++;
118
+
119
  }
120
+
121
  wp_localize_script( self::ID, 'q2w3_sidebar_options', $sidebar_options );
122
+
123
+ }
124
 
125
  }
126
 
127
 
128
+ protected static function fixed_wigets() {
129
 
130
  $sidebars = wp_get_sidebars_widgets();
131
 
138
  $widget_id = substr(strrchr($widget, '-'), 1);
139
 
140
  $widget_type = stristr($widget, '-'.$widget_id, true);
141
+
142
  $widget_options = get_option('widget_' . $widget_type);
143
 
144
  if ( isset($widget_options[$widget_id]['q2w3_fixed_widget']) && $widget_options[$widget_id]['q2w3_fixed_widget']) self::$fixed_widgets[$sidebar_id][$widget] = $widget;
152
  }
153
 
154
 
155
+ public static function is_widget_fixed($instance, $widget, $args) { // deprecated
156
 
157
+ if ( isset($instance['q2w3_fixed_widget']) && $instance['q2w3_fixed_widget'] && ! isset(self::$fixed_widgets[$args['id']][$widget->id]) ) {
158
 
159
  //self::$fixed_widgets[$args['id']][$widget->id] = "'". $widget->id ."'";
160
+
161
+ //echo '<!-- fixed widget -->';
162
+
163
  self::$fixed_widgets[$args['id']][$widget->id] = $widget->id;
 
 
164
 
165
+ self::wp_localize_script();
166
+
167
  }
168
 
169
  return $instance;
170
 
171
+ }
172
+
173
 
174
+ protected static function custom_ids() {
175
 
176
  $options = self::load_options();
177
 
193
 
194
  }
195
 
196
+ protected static function get_widget_sidebar($widget_id) {
197
 
198
  if ( !self::$sidebars_widgets ) {
199
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: Max Bond
3
  Tags: sidebar, widget, scroll, scrolling, fixed, fixed widget, floating, floating widget, sticky, sticky widget, russian, q2w3
4
  Requires at least: 4.0
5
  Tested up to: 4.9.3
6
- Stable tag: 5.1.2
7
 
8
  Fixes positioning of the selected widgets, when the page is scrolled down.
9
 
@@ -82,6 +82,9 @@ Other Q2W3 plugins:
82
 
83
  == Changelog ==
84
 
 
 
 
85
  = 5.1.2 =
86
  * Now works fine with Shortcodes Ultimate widgets!
87
 
3
  Tags: sidebar, widget, scroll, scrolling, fixed, fixed widget, floating, floating widget, sticky, sticky widget, russian, q2w3
4
  Requires at least: 4.0
5
  Tested up to: 4.9.3
6
+ Stable tag: 5.1.3
7
 
8
  Fixes positioning of the selected widgets, when the page is scrolled down.
9
 
82
 
83
  == Changelog ==
84
 
85
+ = 5.1.3 =
86
+ * Now compatible witht WP Page Widget plugin
87
+
88
  = 5.1.2 =
89
  * Now works fine with Shortcodes Ultimate widgets!
90