Version Description
- linguistic corrections
- cleanup of the options page
Download this release
Release Info
Developer | advancedads |
Plugin | Q2W3 Fixed Widget |
Version | 5.1.6 |
Comparing to | |
See all releases |
Code changes from version 5.1.5 to 5.1.6
- css/backend.css +47 -0
- q2w3-fixed-widget.php +616 -590
- readme.txt +6 -3
css/backend.css
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#q2w3_fixed_widget-recommend {
|
2 |
+
background: linear-gradient(to right, #42bcf3 0%,#1892eb 100%); background: #1892eb;
|
3 |
+
border: 1px solid #ffffff;
|
4 |
+
box-shadow: inset 0px 0px 35px 10px rgba(0,0,0,0.15), 0px 0px 5px rgba(0,0,0,0.25);
|
5 |
+
color: #ffffff;
|
6 |
+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
|
7 |
+
font-size: 1.2em;
|
8 |
+
}
|
9 |
+
|
10 |
+
#q2w3_fixed_widget-recommend.closed { border-bottom: 0; }
|
11 |
+
|
12 |
+
#q2w3_fixed_widget-recommend h2, #q2w3_fixed_widget-recommend .inside a, #q2w3_fixed_widget-recommend .handlediv, #q2w3_fixed_widget-recommend .toggle-indicator { color: #ffffff; }
|
13 |
+
|
14 |
+
#q2w3_fixed_widget-recommend h2 { font-size: 15px; }
|
15 |
+
|
16 |
+
#q2w3_fixed_widget-recommend .inside p { font-size: 14px; }
|
17 |
+
|
18 |
+
#q2w3_fixed_widget-recommend .inside div.review { text-align: center; margin: 20px 0px 0px 0px; }
|
19 |
+
#q2w3_fixed_widget-recommend .inside div.review h5 { font-weight: 400; font-size: 16px; margin: 0px 0px 5px 0px; font-style: italic; }
|
20 |
+
#q2w3_fixed_widget-recommend .inside div.review p { margin: 0px 0px 5px 0px; }
|
21 |
+
#q2w3_fixed_widget-recommend .inside div.review p.content { font-style: italic; font-size: 12px; }
|
22 |
+
#q2w3_fixed_widget-recommend .inside div.review p.subline { font-size: 12px; }
|
23 |
+
|
24 |
+
#q2w3_fixed_widget-recommend .inside .button-var1:hover { background: rgba(0,0,0,0.60); border-color: rgba(0,0,0,0.75); }
|
25 |
+
#q2w3_fixed_widget-recommend .inside .button-var1 {
|
26 |
+
display: inline-block;
|
27 |
+
padding: 5px 10px;
|
28 |
+
border: 1px solid #333333; border-color: rgba(0,0,0,0.95);
|
29 |
+
box-shadow: 0px 0px 10px rgba(0,0,0,0.25);
|
30 |
+
background: #000000; background: rgba(0,0,0,0.80);
|
31 |
+
color: #ffffff;
|
32 |
+
text-decoration: none;
|
33 |
+
font-weight: bold;
|
34 |
+
line-height: normal;
|
35 |
+
border-radius: 2px;
|
36 |
+
}
|
37 |
+
|
38 |
+
#q2w3_fixed_widget-recommend .inside div.review:before {
|
39 |
+
display: block;
|
40 |
+
content: " ";
|
41 |
+
/* https://www.iconfinder.com/icons/326703/favorite_rate_star_icon */
|
42 |
+
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAPCAYAAADtc08vAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAADEQAAAxEBQphATgAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAElSURBVCiRldI/T5NRFMfxz30aCzI4mJaJMpgYwKYmpdYYd3gHLiy+AgcmBth4Awy+C0fCIC+AaH1a4gCJgwMJDA5ER1OwlwFs+mifh/YkN7n5nXO+58+9FFjseB2PPC6KSYqcErtmbBWFhNzqX7wUfMZv156GV86n6yCxfXeb9cDOVB3EVANfR/xXokZo+/YfIH6yoKQhqGMZdTzDozHsHzgbnsR+iB1tiQNUc8cZb1196wFi14roI2oTJ5ethed+DncQU4s4xNKkyfyzxNhTNXCKSk7yHyWV0PTrr5B9xqZLzBVUL+mbHxWygGO1ewAkWvmAQWb+vuC9YBMXQzVYzQfc/oOID4J6aHkXWvY89ET0Ft/JAjIWUxux50Wu/0Q5pt6Majcm/kSYKQos8gAAAABJRU5ErkJggg==') top left repeat-x;
|
43 |
+
color: #ffffff;
|
44 |
+
height: 15px;
|
45 |
+
width: 80px;
|
46 |
+
margin: 0px auto 5px auto;
|
47 |
+
}
|
q2w3-fixed-widget.php
CHANGED
@@ -1,590 +1,616 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
Plugin Name: Q2W3 Fixed Widget
|
4 |
-
Plugin URI: https://wpadvancedads.com/fixed-widget-wordpress/
|
5 |
-
Description:
|
6 |
-
Text Domain: q2w3-fixed-widget
|
7 |
-
Author: Thomas Maier, Max Bond
|
8 |
-
Version: 5.1.
|
9 |
-
Author URI: https://wpadvancedads.com/fixed-widget-wordpress/
|
10 |
-
*/
|
11 |
-
|
12 |
-
add_action('init', array( 'q2w3_fixed_widget', 'init' )); // Main Hook
|
13 |
-
|
14 |
-
if ( class_exists('q2w3_fixed_widget', false) ) return; // if class is allready loaded return control to the main script
|
15 |
-
|
16 |
-
class q2w3_fixed_widget { // Plugin class
|
17 |
-
|
18 |
-
const ID = 'q2w3_fixed_widget';
|
19 |
-
|
20 |
-
const VERSION = '5.1.
|
21 |
-
|
22 |
-
protected static $sidebars_widgets;
|
23 |
-
|
24 |
-
protected static $fixed_widgets;
|
25 |
-
|
26 |
-
protected static $settings_page_hook;
|
27 |
-
|
28 |
-
|
29 |
-
public static function init() {
|
30 |
-
|
31 |
-
$options = self::load_options();
|
32 |
-
|
33 |
-
if ( $options['logged_in_req'] && !is_user_logged_in() ) return;
|
34 |
-
|
35 |
-
if ( is_admin() ) {
|
36 |
-
|
37 |
-
self::load_language();
|
38 |
-
|
39 |
-
add_action('in_widget_form', array( __CLASS__, 'add_widget_option' ), 10, 3);
|
40 |
-
|
41 |
-
add_filter('widget_update_callback', array( __CLASS__, 'update_widget_option' ), 10, 3);
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
add_action('
|
46 |
-
|
47 |
-
add_action('
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
'
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
$
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
}
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
$d['
|
327 |
-
|
328 |
-
$d['
|
329 |
-
|
330 |
-
$d['
|
331 |
-
|
332 |
-
$d['
|
333 |
-
|
334 |
-
$d['width
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
$d['
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
$
|
349 |
-
|
350 |
-
return
|
351 |
-
|
352 |
-
}
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
$input['
|
373 |
-
|
374 |
-
$input['
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
if(
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
add_meta_box(self::ID.'-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
echo '<
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
echo '<
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
echo '<div id="
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
echo '
|
447 |
-
|
448 |
-
echo '<
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
echo '</
|
453 |
-
|
454 |
-
echo '<
|
455 |
-
|
456 |
-
echo '
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
echo '<
|
463 |
-
|
464 |
-
echo '
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
echo '<p><span style="display: inline-block; width: 150px;">'. __('
|
471 |
-
|
472 |
-
echo '<p><span style="display: inline-block; width: 150px;">'. __('
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
echo '<p><span >'. __('
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Q2W3 Fixed Widget
|
4 |
+
Plugin URI: https://wpadvancedads.com/fixed-widget-wordpress/
|
5 |
+
Description: Use the fixed widget plugin to create sticky widgets that stay in the visible screen area when the page is scrolled up or down and boost your conversions.
|
6 |
+
Text Domain: q2w3-fixed-widget
|
7 |
+
Author: Thomas Maier, Max Bond
|
8 |
+
Version: 5.1.6
|
9 |
+
Author URI: https://wpadvancedads.com/fixed-widget-wordpress/
|
10 |
+
*/
|
11 |
+
|
12 |
+
add_action('init', array( 'q2w3_fixed_widget', 'init' )); // Main Hook
|
13 |
+
|
14 |
+
if ( class_exists('q2w3_fixed_widget', false) ) return; // if class is allready loaded return control to the main script
|
15 |
+
|
16 |
+
class q2w3_fixed_widget { // Plugin class
|
17 |
+
|
18 |
+
const ID = 'q2w3_fixed_widget';
|
19 |
+
|
20 |
+
const VERSION = '5.1.6';
|
21 |
+
|
22 |
+
protected static $sidebars_widgets;
|
23 |
+
|
24 |
+
protected static $fixed_widgets;
|
25 |
+
|
26 |
+
protected static $settings_page_hook;
|
27 |
+
|
28 |
+
|
29 |
+
public static function init() {
|
30 |
+
|
31 |
+
$options = self::load_options();
|
32 |
+
|
33 |
+
if ( $options['logged_in_req'] && !is_user_logged_in() ) return;
|
34 |
+
|
35 |
+
if ( is_admin() ) {
|
36 |
+
|
37 |
+
self::load_language();
|
38 |
+
|
39 |
+
add_action('in_widget_form', array( __CLASS__, 'add_widget_option' ), 10, 3);
|
40 |
+
|
41 |
+
add_filter('widget_update_callback', array( __CLASS__, 'update_widget_option' ), 10, 3);
|
42 |
+
|
43 |
+
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( __CLASS__, 'add_plugin_links' ) );
|
44 |
+
|
45 |
+
add_action('admin_init', array( __CLASS__, 'register_settings' ));
|
46 |
+
|
47 |
+
add_action('admin_menu', array( __CLASS__, 'admin_menu' ), 5);
|
48 |
+
|
49 |
+
add_action('admin_enqueue_scripts', array( __CLASS__, 'settings_page_js' ));
|
50 |
+
|
51 |
+
// add stylesheets for the plugin's backend
|
52 |
+
add_action('admin_enqueue_scripts', array( __CLASS__, 'load_custom_be_styles' ));
|
53 |
+
|
54 |
+
} else {
|
55 |
+
|
56 |
+
if ( $options['fix-widget-id'] ) self::registered_sidebars_filter();
|
57 |
+
|
58 |
+
add_action('wp_enqueue_scripts', array( __CLASS__, 'enqueue_scripts' ));
|
59 |
+
|
60 |
+
add_filter('widget_display_callback', array( __CLASS__, 'is_widget_fixed' ), 99, 3);
|
61 |
+
|
62 |
+
//add_filter('widget_display_callback', array( __CLASS__, 'is_widget_fixed' ), $options['widget_display_callback_priority'], 3);
|
63 |
+
|
64 |
+
//add_action('wp_loaded', array( __CLASS__, 'custom_ids' ));
|
65 |
+
|
66 |
+
//add_action('wp_footer', array( __CLASS__, 'js_settings' ));
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
}
|
73 |
+
|
74 |
+
public static function load_custom_be_styles() {
|
75 |
+
wp_register_style('fixedWidgetBEStyles', plugin_dir_url( __FILE__ ) . 'css/backend.css', false, '0.0.1' );
|
76 |
+
wp_enqueue_style( 'fixedWidgetBEStyles' );
|
77 |
+
}
|
78 |
+
|
79 |
+
public static function enqueue_scripts() {
|
80 |
+
|
81 |
+
self::custom_ids();
|
82 |
+
|
83 |
+
self::fixed_wigets();
|
84 |
+
|
85 |
+
wp_enqueue_script('jquery');
|
86 |
+
|
87 |
+
wp_enqueue_script(self::ID, plugin_dir_url( __FILE__ ) . 'js/q2w3-fixed-widget.min.js', array('jquery'), self::VERSION, true);
|
88 |
+
|
89 |
+
self::wp_localize_script();
|
90 |
+
|
91 |
+
}
|
92 |
+
|
93 |
+
|
94 |
+
protected static function wp_localize_script() {
|
95 |
+
|
96 |
+
$options = self::load_options();
|
97 |
+
|
98 |
+
if ( is_array(self::$fixed_widgets) && !empty(self::$fixed_widgets) ) {
|
99 |
+
|
100 |
+
if ( isset($options['window-load-enabled']) && $options['window-load-enabled'] == 'yes' ) $window_load_hook = true; else $window_load_hook = false;
|
101 |
+
|
102 |
+
if ( isset($options['width-inherit']) && $options['width-inherit'] ) $width_inherit = true; else $width_inherit = false;
|
103 |
+
|
104 |
+
if ( isset($options['disable-mo-api']) && $options['disable-mo-api'] ) $disable_mo_api = true; else $disable_mo_api = false;
|
105 |
+
|
106 |
+
if ( $options['refresh-interval'] > 0 ) $refresh_interval = $options['refresh-interval']; else $refresh_interval = 0;
|
107 |
+
|
108 |
+
$i = 0;
|
109 |
+
$sidebar_options = array();
|
110 |
+
|
111 |
+
self::$fixed_widgets = apply_filters( 'q2w3-fixed-widgets', self::$fixed_widgets ); // this filter was requested by users
|
112 |
+
|
113 |
+
foreach ( self::$fixed_widgets as $sidebar => $widgets ) {
|
114 |
+
|
115 |
+
$sidebar_options[ $i ] = array(
|
116 |
+
'sidebar' => $sidebar,
|
117 |
+
'margin_top' => $options['margin-top'],
|
118 |
+
'margin_bottom' => $options['margin-bottom'],
|
119 |
+
'stop_id' => $options['stop-id'],
|
120 |
+
'screen_max_width' => $options['screen-max-width'],
|
121 |
+
'screen_max_height' => $options['screen-max-height'],
|
122 |
+
'width_inherit' => $width_inherit,
|
123 |
+
'refresh_interval' => $refresh_interval,
|
124 |
+
'window_load_hook' => $window_load_hook,
|
125 |
+
'disable_mo_api' => $disable_mo_api,
|
126 |
+
'widgets' => array_values( $widgets )
|
127 |
+
);
|
128 |
+
|
129 |
+
$i++;
|
130 |
+
|
131 |
+
}
|
132 |
+
|
133 |
+
wp_localize_script( self::ID, 'q2w3_sidebar_options', $sidebar_options );
|
134 |
+
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
protected static function fixed_wigets() {
|
141 |
+
|
142 |
+
$sidebars = wp_get_sidebars_widgets();
|
143 |
+
|
144 |
+
if ( $sidebars && is_array($sidebars) ) foreach ( $sidebars as $sidebar_id => $sidebar_widgets ) {
|
145 |
+
|
146 |
+
if ( ! (stristr($sidebar_id, 'orphaned_widgets') !== false || $sidebar_id == 'wp_inactive_widgets') ) {
|
147 |
+
|
148 |
+
if ( $sidebar_widgets && is_array($sidebar_widgets) ) foreach ( $sidebar_widgets as $widget ) {
|
149 |
+
|
150 |
+
$widget_id = substr(strrchr($widget, '-'), 1);
|
151 |
+
|
152 |
+
$widget_type = stristr($widget, '-'.$widget_id, true);
|
153 |
+
|
154 |
+
$widget_options = get_option('widget_' . $widget_type);
|
155 |
+
|
156 |
+
if ( isset($widget_options[$widget_id]['q2w3_fixed_widget']) && $widget_options[$widget_id]['q2w3_fixed_widget']) self::$fixed_widgets[$sidebar_id][$widget] = $widget;
|
157 |
+
|
158 |
+
}
|
159 |
+
|
160 |
+
}
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
public static function is_widget_fixed($instance, $widget, $args) { // deprecated
|
168 |
+
|
169 |
+
if ( isset($instance['q2w3_fixed_widget']) && $instance['q2w3_fixed_widget'] && ! isset(self::$fixed_widgets[$args['id']][$widget->id]) ) {
|
170 |
+
|
171 |
+
//self::$fixed_widgets[$args['id']][$widget->id] = "'". $widget->id ."'";
|
172 |
+
|
173 |
+
//echo '<!-- fixed widget -->';
|
174 |
+
|
175 |
+
self::$fixed_widgets[$args['id']][$widget->id] = $widget->id;
|
176 |
+
|
177 |
+
self::wp_localize_script();
|
178 |
+
|
179 |
+
}
|
180 |
+
|
181 |
+
return $instance;
|
182 |
+
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
protected static function custom_ids() {
|
187 |
+
|
188 |
+
$options = self::load_options();
|
189 |
+
|
190 |
+
if ( isset($options['custom-ids']) && $options['custom-ids'] ) {
|
191 |
+
|
192 |
+
$ids = explode(PHP_EOL, $options['custom-ids']);
|
193 |
+
|
194 |
+
foreach ( $ids as $id ) {
|
195 |
+
|
196 |
+
$id = trim($id);
|
197 |
+
|
198 |
+
//if ( $id ) self::$fixed_widgets[self::get_widget_sidebar($id)][$id] = "'". $id ."'";
|
199 |
+
|
200 |
+
if ( $id ) self::$fixed_widgets[self::get_widget_sidebar($id)][$id] = $id;
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
}
|
205 |
+
|
206 |
+
}
|
207 |
+
|
208 |
+
protected static function get_widget_sidebar($widget_id) {
|
209 |
+
|
210 |
+
if ( !self::$sidebars_widgets ) {
|
211 |
+
|
212 |
+
self::$sidebars_widgets = wp_get_sidebars_widgets();
|
213 |
+
|
214 |
+
unset(self::$sidebars_widgets['wp_inactive_widgets']);
|
215 |
+
|
216 |
+
}
|
217 |
+
|
218 |
+
if ( is_array(self::$sidebars_widgets) ) {
|
219 |
+
|
220 |
+
foreach ( self::$sidebars_widgets as $sidebar => $widgets ) {
|
221 |
+
|
222 |
+
$key = array_search($widget_id, $widgets);
|
223 |
+
|
224 |
+
if ( $key !== false ) return $sidebar;
|
225 |
+
|
226 |
+
}
|
227 |
+
|
228 |
+
}
|
229 |
+
|
230 |
+
return 'q2w3-default-sidebar';
|
231 |
+
|
232 |
+
}
|
233 |
+
|
234 |
+
/*public static function js_settings() { // deprecated
|
235 |
+
|
236 |
+
$options = self::load_options();
|
237 |
+
|
238 |
+
$js = '';
|
239 |
+
|
240 |
+
if ( is_array(self::$fixed_widgets) && !empty(self::$fixed_widgets) ) {
|
241 |
+
|
242 |
+
$js .= 'var q2w3_sidebar_options = new Array();'.PHP_EOL;
|
243 |
+
|
244 |
+
if ( isset($options['window-load-enabled']) && $options['window-load-enabled'] == 'yes' ) $window_load_hook = 'true'; else $window_load_hook = 'false';
|
245 |
+
|
246 |
+
if ( isset($options['width-inherit']) && $options['width-inherit'] ) $width_inherit = 'true'; else $width_inherit = 'false';
|
247 |
+
|
248 |
+
if ( isset($options['disable-mo-api']) && $options['disable-mo-api'] ) $disable_mo_api = 'true'; else $disable_mo_api = 'false';
|
249 |
+
|
250 |
+
if ( $options['refresh-interval'] > 0 ) $refresh_interval = $options['refresh-interval']; else $refresh_interval = 0;
|
251 |
+
|
252 |
+
$i = 0;
|
253 |
+
|
254 |
+
foreach ( self::$fixed_widgets as $sidebar => $widgets ) {
|
255 |
+
|
256 |
+
$widgets_array = implode(',', $widgets);
|
257 |
+
|
258 |
+
$js .= 'q2w3_sidebar_options['. $i .'] = { "sidebar" : "'. $sidebar .'", "margin_top" : '. $options['margin-top'] .', "margin_bottom" : '. $options['margin-bottom'] .', "stop_id" : "' . $options['stop-id'] .'", "screen_max_width" : '. $options['screen-max-width'] .', "screen_max_height" : '. $options['screen-max-height'] .', "width_inherit" : '. $width_inherit .', "refresh_interval" : '. $refresh_interval .', "window_load_hook" : '. $window_load_hook .', "disable_mo_api" : '. $disable_mo_api .', "widgets" : ['. $widgets_array .'] };'.PHP_EOL;
|
259 |
+
|
260 |
+
$i++;
|
261 |
+
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
265 |
+
|
266 |
+
if ( $js && function_exists('wp_add_inline_script') && ! class_exists('BWP_MINIFY') ) {
|
267 |
+
|
268 |
+
wp_add_inline_script(self::ID, $js, 'before');
|
269 |
+
|
270 |
+
} elseif ( $js ) {
|
271 |
+
|
272 |
+
echo '<script type="text/javascript">'. $js .'</script>';
|
273 |
+
|
274 |
+
}
|
275 |
+
|
276 |
+
}*/
|
277 |
+
|
278 |
+
public static function add_widget_option($widget, $return, $instance) {
|
279 |
+
|
280 |
+
if ( isset($instance['q2w3_fixed_widget']) ) $iqfw = $instance['q2w3_fixed_widget']; else $iqfw = 0;
|
281 |
+
|
282 |
+
echo '<p>'.PHP_EOL;
|
283 |
+
|
284 |
+
echo '<input type="checkbox" name="'. $widget->get_field_name('q2w3_fixed_widget') .'" value="1" '. checked( $iqfw, 1, false ) .'/>'.PHP_EOL;
|
285 |
+
|
286 |
+
echo '<label for="'. $widget->get_field_id('q2w3_fixed_widget') .'">'. __('Fixed widget', 'q2w3-fixed-widget') .'</label>'.PHP_EOL;
|
287 |
+
|
288 |
+
echo '</p>'.PHP_EOL;
|
289 |
+
|
290 |
+
}
|
291 |
+
|
292 |
+
public static function update_widget_option($instance, $new_instance, $old_instance){
|
293 |
+
|
294 |
+
if ( isset($new_instance['q2w3_fixed_widget']) && $new_instance['q2w3_fixed_widget'] ) {
|
295 |
+
|
296 |
+
$instance['q2w3_fixed_widget'] = 1;
|
297 |
+
|
298 |
+
} else {
|
299 |
+
|
300 |
+
$instance['q2w3_fixed_widget'] = false;
|
301 |
+
|
302 |
+
}
|
303 |
+
|
304 |
+
return $instance;
|
305 |
+
|
306 |
+
}
|
307 |
+
|
308 |
+
protected static function load_language() {
|
309 |
+
|
310 |
+
$languages_path = plugin_basename( dirname(__FILE__).'/lang' );
|
311 |
+
|
312 |
+
load_plugin_textdomain( 'q2w3-fixed-widget', false, $languages_path );
|
313 |
+
|
314 |
+
}
|
315 |
+
|
316 |
+
public static function admin_menu() {
|
317 |
+
|
318 |
+
remove_action('admin_menu', array( 'q2w3_fixed_widget', 'admin_menu' )); // Remove free version plugin
|
319 |
+
|
320 |
+
self::$settings_page_hook = add_submenu_page( 'themes.php', __('Fixed Widget Options', 'q2w3-fixed-widget'), __('Fixed Widget Options', 'q2w3-fixed-widget'), 'activate_plugins', self::ID, array( __CLASS__, 'settings_page' ) );
|
321 |
+
|
322 |
+
}
|
323 |
+
|
324 |
+
protected static function defaults() {
|
325 |
+
|
326 |
+
$d['margin-top'] = 10;
|
327 |
+
|
328 |
+
$d['margin-bottom'] = 0;
|
329 |
+
|
330 |
+
$d['stop-id'] = '';
|
331 |
+
|
332 |
+
$d['refresh-interval'] = 1500;
|
333 |
+
|
334 |
+
$d['screen-max-width'] = 0;
|
335 |
+
|
336 |
+
$d['screen-max-height'] = 0;
|
337 |
+
|
338 |
+
$d['fix-widget-id'] = 'yes';
|
339 |
+
|
340 |
+
$d['window-load-enabled'] = false;
|
341 |
+
|
342 |
+
$d['logged_in_req'] = false;
|
343 |
+
|
344 |
+
$d['width-inherit'] = false;
|
345 |
+
|
346 |
+
//$d['widget_display_callback_priority'] = 30;
|
347 |
+
|
348 |
+
$d['disable-mo-api'] = false;
|
349 |
+
|
350 |
+
return $d;
|
351 |
+
|
352 |
+
}
|
353 |
+
|
354 |
+
protected static function load_options() {
|
355 |
+
|
356 |
+
$options = get_option(self::ID);
|
357 |
+
|
358 |
+
$options_old = get_option('q2w3_fixed_widget');
|
359 |
+
|
360 |
+
return array_merge(self::defaults(), (array)$options_old, (array)$options);
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
public static function register_settings() {
|
365 |
+
|
366 |
+
register_setting(self::ID, self::ID, array( __CLASS__, 'save_options_filter' ) );
|
367 |
+
|
368 |
+
}
|
369 |
+
|
370 |
+
public static function save_options_filter($input) { // Sanitize user input
|
371 |
+
|
372 |
+
$input['margin-top'] = (int)$input['margin-top'];
|
373 |
+
|
374 |
+
$input['margin-bottom'] = (int)$input['margin-bottom'];
|
375 |
+
|
376 |
+
$input['refresh-interval'] = (int)$input['refresh-interval'];
|
377 |
+
|
378 |
+
$input['screen-max-width'] = (int)$input['screen-max-width'];
|
379 |
+
|
380 |
+
$input['screen-max-height'] = (int)$input['screen-max-height'];
|
381 |
+
|
382 |
+
$input['custom-ids'] = trim(wp_strip_all_tags($input['custom-ids']));
|
383 |
+
|
384 |
+
$input['stop-id'] = trim(wp_strip_all_tags($input['stop-id']));
|
385 |
+
|
386 |
+
if ( !isset($input['fix-widget-id']) ) $input['fix-widget-id'] = false;
|
387 |
+
|
388 |
+
if ( !isset($input['window-load-enabled']) ) $input['window-load-enabled'] = false;
|
389 |
+
|
390 |
+
if ( !isset($input['logged_in_req']) ) $input['logged_in_req'] = false;
|
391 |
+
|
392 |
+
if ( !isset($input['width-inherit']) ) $input['width-inherit'] = false;
|
393 |
+
|
394 |
+
if ( !isset($input['disable-mo-api']) ) $input['disable-mo-api'] = false;
|
395 |
+
|
396 |
+
return $input;
|
397 |
+
|
398 |
+
}
|
399 |
+
|
400 |
+
public static function settings_page_js($hook) {
|
401 |
+
|
402 |
+
if( self::$settings_page_hook != $hook ) return;
|
403 |
+
|
404 |
+
wp_enqueue_script('postbox');
|
405 |
+
|
406 |
+
}
|
407 |
+
|
408 |
+
public static function settings_page() {
|
409 |
+
|
410 |
+
$screen = get_current_screen();
|
411 |
+
|
412 |
+
add_meta_box(self::ID.'-general', __('General Options', 'q2w3-fixed-widget'), array( __CLASS__, 'settings_page_general_box' ), $screen, 'normal');
|
413 |
+
|
414 |
+
add_meta_box(self::ID.'-compatibility', __('Compatibility', 'q2w3-fixed-widget'), array( __CLASS__, 'settings_page_compatibility_box' ), $screen, 'normal');
|
415 |
+
|
416 |
+
add_meta_box(self::ID.'-custom-ids', __('Custom IDs', 'q2w3-fixed-widget'), array( __CLASS__, 'settings_page_custom_ids_box' ), $screen, 'normal');
|
417 |
+
|
418 |
+
add_meta_box(self::ID.'-recommend', __('Recommended Integration', 'q2w3-fixed-widget'), array( __CLASS__, 'settings_page_recommend_box' ), $screen, 'side', 'high');
|
419 |
+
|
420 |
+
add_meta_box(self::ID.'-help', __('Documentation and Support', 'q2w3-fixed-widget'), array( __CLASS__, 'settings_page_help_box' ), $screen, 'side');
|
421 |
+
|
422 |
+
$options = self::load_options();
|
423 |
+
|
424 |
+
echo '<div class="wrap"><div id="icon-themes" class="icon32"><br /></div><h2>'. __('Fixed Widget Options', 'q2w3-fixed-widget') .'</h2>'.PHP_EOL;
|
425 |
+
|
426 |
+
if ( isset($_GET['settings-updated']) && $_GET['settings-updated'] == 'true' ) {
|
427 |
+
|
428 |
+
echo '<div id="message" class="updated"><p>'. __('Settings saved.') .'</p></div>'.PHP_EOL;
|
429 |
+
|
430 |
+
}
|
431 |
+
|
432 |
+
echo '<form method="post" action="options.php">'.PHP_EOL;
|
433 |
+
|
434 |
+
settings_fields(self::ID);
|
435 |
+
|
436 |
+
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
437 |
+
|
438 |
+
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
439 |
+
|
440 |
+
echo '<div id="poststuff" class="metabox-holder has-right-sidebar">'.PHP_EOL;
|
441 |
+
|
442 |
+
echo '<div class="inner-sidebar" id="side-info-column">'.PHP_EOL;
|
443 |
+
|
444 |
+
do_meta_boxes( $screen, 'side', $options );
|
445 |
+
|
446 |
+
echo '</div>'.PHP_EOL;
|
447 |
+
|
448 |
+
echo '<div id="post-body-content">'.PHP_EOL;
|
449 |
+
|
450 |
+
do_meta_boxes( $screen, 'normal', $options );
|
451 |
+
|
452 |
+
echo '</div>'.PHP_EOL;
|
453 |
+
|
454 |
+
echo '<p><em>'. __(" Note for users of caching plugins. Please, don’t forget to clear the cache after changing options.", 'q2w3-fixed-widget') .'</em></p>'.PHP_EOL;
|
455 |
+
|
456 |
+
echo '<p class="submit"><input type="submit" class="button-primary" value="'. __('Save Changes') .'" /></p>'.PHP_EOL;
|
457 |
+
|
458 |
+
echo '</div><!-- #poststuff -->'.PHP_EOL;
|
459 |
+
|
460 |
+
echo '</form>'.PHP_EOL;
|
461 |
+
|
462 |
+
echo '<script>jQuery(document).ready(function(){ postboxes.add_postbox_toggles(pagenow); });</script>'.PHP_EOL;
|
463 |
+
|
464 |
+
echo '</div><!-- .wrap -->'.PHP_EOL;
|
465 |
+
|
466 |
+
}
|
467 |
+
|
468 |
+
public static function settings_page_general_box($options) {
|
469 |
+
|
470 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Margin Top:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[margin-top]" value="'. $options['margin-top'] .'" style="width: 50px; text-align: center;" /> '. __('px', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
471 |
+
|
472 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Margin Bottom:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[margin-bottom]" value="'. $options['margin-bottom'] .'" style="width: 50px; text-align: center;" /> '. __('px', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
473 |
+
|
474 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Stop ID:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[stop-id]" value="'. $options['stop-id'] .'" style="width: 150px;"> '. __('You need to provide the HTML tag ID here. The position of that HTML element will determine the margin-bottom value.', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
475 |
+
|
476 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Refresh interval:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[refresh-interval]" value="'. $options['refresh-interval'] .'" style="width: 50px; text-align: center;" /> '. __('milliseconds', 'q2w3-fixed-widget') .' / '. __('Used only for compatibility with browsers without MutationObserver API support. Set 0 to disable it completely.', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
477 |
+
|
478 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Disable Width:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[screen-max-width]" value="'. $options['screen-max-width'] .'" style="width: 50px; text-align: center;" /> '. __('px', 'q2w3-fixed-widget') .' / '. __('Use this option to disable the plugin on portable devices. When the browser screen width is less than the specified value, the plugin will be disabled.', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
479 |
+
|
480 |
+
echo '<p><span style="display: inline-block; width: 150px;">'. __('Disable Height:', 'q2w3-fixed-widget') .'</span><input type="text" name="'. self::ID .'[screen-max-height]" value="'. $options['screen-max-height'] .'" style="width: 50px; text-align: center;" /> '. __('px', 'q2w3-fixed-widget') .' / '. __(' Works like the Disable Width option.', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
481 |
+
|
482 |
+
}
|
483 |
+
|
484 |
+
public static function settings_page_custom_ids_box($options) {
|
485 |
+
$custom_ids = isset($options['custom-ids']) ? $options['custom-ids'] : '' ;
|
486 |
+
echo '<p><span >'. __('Custom HTML IDs (each one on a new line):', 'q2w3-fixed-widget') .'</span><br/><br/><textarea name="'. self::ID .'[custom-ids]" style="width: 320px; height: 120px;">'. $custom_ids .'</textarea>'.PHP_EOL;
|
487 |
+
}
|
488 |
+
|
489 |
+
public static function settings_page_compatibility_box($options) {
|
490 |
+
|
491 |
+
echo '<p><span style="display: inline-block; width: 280px;">'. __('Auto fix widget ID:', 'q2w3-fixed-widget') .'</span><input type="checkbox" name="'. self::ID .'[fix-widget-id]" value="yes" '. checked('yes', $options['fix-widget-id'], false) .' /> </p>'.PHP_EOL;
|
492 |
+
|
493 |
+
echo '<p><span style="display: inline-block; width: 280px;">'. __('Disable MutationObserver:', 'q2w3-fixed-widget') .'</span><input type="checkbox" name="'. self::ID .'[disable-mo-api]" value="yes" '. checked('yes', $options['disable-mo-api'], false) .' /> '. __('If MutationObserver is disabled, the plugin will use the refresh interval to reflect page changes (version 4 behavior)', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
494 |
+
|
495 |
+
echo '<p><span style="display: inline-block; width: 280px;">'. __('Enable the plugin for logged-in users only:', 'q2w3-fixed-widget') .'</span><input type="checkbox" name="'. self::ID .'[logged_in_req]" value="yes" '. checked('yes', $options['logged_in_req'], false) .' /> '. __('Enable this option for debug purposes (frontend problems and etc.)', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
496 |
+
|
497 |
+
echo '<p><span style="display: inline-block; width: 280px;">'. __('Inherit widget width from the parent container:', 'q2w3-fixed-widget') .'</span><input type="checkbox" name="'. self::ID .'[width-inherit]" value="yes" '. checked('yes', $options['width-inherit'], false) .' /> '. __('Enable this option for themes with a responsive sidebar', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
498 |
+
|
499 |
+
echo '<p><span style="display: inline-block; width: 280px;">'. __('Use jQuery(window).load() hook:', 'q2w3-fixed-widget') .'</span><input type="checkbox" name="'. self::ID .'[window-load-enabled]" value="yes" '. checked('yes', $options['window-load-enabled'], false) .' /> '. __('Enable this option only if you have problems with other scroll oriented javascript code', 'q2w3-fixed-widget') .'</p>'.PHP_EOL;
|
500 |
+
|
501 |
+
//echo '<p><span style="display: inline-block; width: 280px;">'. __('widget_display_callback hook priority:', 'q2w3-fixed-widget') .'</span><select name="'. self::ID .'[widget_display_callback_priority]"><option value="1" '. selected('1', $options['widget_display_callback_priority'], false) .'>1</option><option value="10" '. selected('10', $options['widget_display_callback_priority'], false) .'>10</option><option value="20" '. selected('20', $options['widget_display_callback_priority'], false) .'>20</option><option value="30" '. selected('30', $options['widget_display_callback_priority'], false) .'>30</option><option value="50" '. selected('50', $options['widget_display_callback_priority'], false) .'>50</option><option value="100" '. selected('100', $options['widget_display_callback_priority'], false) .'>100</option></select></p>'.PHP_EOL;
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
public static function settings_page_recommend_box($options) {
|
506 |
+
echo '<p>';
|
507 |
+
echo '<a href="https://wordpress.org/plugins/advanced-ads/" target="_blank"><b>Advanced Ads</b></a>: ';
|
508 |
+
echo __('This ad management plugin provides many features to optimize your ads and to boost your conversions. It works perfectly with the Q2W3 Fixed Widget plugin.', 'q2w3-fixed-widget');
|
509 |
+
echo '</p>';
|
510 |
+
echo '<div class="review">';
|
511 |
+
echo '<h5>"Perfect plugin"</h5>';
|
512 |
+
echo '<p class="content">"The plugin contains everything I need for the ads management and publishing. Fair price, stable and functional."</p>';
|
513 |
+
echo '<p class="subline">from David H. on wordpress.org</p>';
|
514 |
+
echo '</div>';
|
515 |
+
echo ''.PHP_EOL;
|
516 |
+
|
517 |
+
if (! defined('ADVADS_VERSION')) {
|
518 |
+
// check whether is's installed
|
519 |
+
$plugins = get_plugins();
|
520 |
+
if( isset( $plugins['advanced-ads/advanced-ads.php'] ) ){
|
521 |
+
// advanced-ads is deactivated
|
522 |
+
$link = '<a class="button-var1" href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=advanced-ads/advanced-ads.php&', 'activate-plugin_advanced-ads/advanced-ads.php' ) . '">'. __('Activate Now', 'q2w3-fixed-widget') .'</a>';
|
523 |
+
}
|
524 |
+
else{
|
525 |
+
// advanced-ads is not installed
|
526 |
+
$link = '<a class="button-var1" href="' . wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=' . 'advanced-ads'), 'install-plugin_' . 'advanced-ads') . '">'. __('Install Now', 'q2w3-fixed-widget') .'</a>';
|
527 |
+
}
|
528 |
+
echo '<div style="margin-top:20px; text-align:center;">' . $link . '</div>';
|
529 |
+
}
|
530 |
+
}
|
531 |
+
|
532 |
+
public static function settings_page_help_box($options) {
|
533 |
+
echo '<ul>';
|
534 |
+
echo '<li><a href="https://wpadvancedads.com/fixed-widget-wordpress/?utm_source=fixed-widget&utm_medium=link&utm_campaign=BackendSidebar" target="_blank">FAQ</a></li>';
|
535 |
+
echo '<li><a href="https://wordpress.org/support/plugin/q2w3-fixed-widget/" target="_blank">Support</a></li>';
|
536 |
+
echo '</ul>';
|
537 |
+
echo ''.PHP_EOL;
|
538 |
+
}
|
539 |
+
|
540 |
+
public static function add_plugin_links( $links ) {
|
541 |
+
if ( ! is_array( $links ) ) {
|
542 |
+
return $links;
|
543 |
+
}
|
544 |
+
// add link to the settings
|
545 |
+
$extend_link = '<a href="' . get_site_url() . '/wp-admin/themes.php?page=' . self::ID . '">' . __( 'Settings', 'q2w3-fixed-widget' ) . '</a>';
|
546 |
+
array_unshift( $links, $extend_link );
|
547 |
+
return $links;
|
548 |
+
}
|
549 |
+
|
550 |
+
public static function registered_sidebars_filter() {
|
551 |
+
|
552 |
+
global $wp_registered_sidebars;
|
553 |
+
|
554 |
+
if ( !is_array($wp_registered_sidebars) ) return;
|
555 |
+
|
556 |
+
foreach ( $wp_registered_sidebars as $id => $sidebar ) {
|
557 |
+
|
558 |
+
if ( strpos($sidebar['before_widget'], 'id="%1$s"') === false && strpos($sidebar['before_widget'], 'id=\'%1$s\'') === false ) {
|
559 |
+
|
560 |
+
if ( $sidebar['before_widget'] == '' || $sidebar['before_widget'] == ' ' ) {
|
561 |
+
|
562 |
+
$wp_registered_sidebars[$id]['before_widget'] = '<div id="%1$s">';
|
563 |
+
|
564 |
+
$wp_registered_sidebars[$id]['after_widget'] = '</div>';
|
565 |
+
|
566 |
+
} elseif ( strpos($sidebar['before_widget'], 'id=') === false ) {
|
567 |
+
|
568 |
+
$tag_end_pos = strpos($sidebar['before_widget'], '>');
|
569 |
+
|
570 |
+
if ( $tag_end_pos !== false ) {
|
571 |
+
|
572 |
+
$wp_registered_sidebars[$id]['before_widget'] = substr_replace($sidebar['before_widget'], ' id="%1$s"', $tag_end_pos, 0);
|
573 |
+
|
574 |
+
}
|
575 |
+
|
576 |
+
} else {
|
577 |
+
|
578 |
+
$str_array = explode(' ', $sidebar['before_widget']);
|
579 |
+
|
580 |
+
if ( is_array($str_array) ) {
|
581 |
+
|
582 |
+
foreach ( $str_array as $str_part_id => $str_part ) {
|
583 |
+
|
584 |
+
if ( strpos($str_part, 'id="') !== false ) {
|
585 |
+
|
586 |
+
$p1 = strpos($str_part, 'id="');
|
587 |
+
|
588 |
+
$p2 = strpos($str_part, '"', $p1 + 4);
|
589 |
+
|
590 |
+
$str_array[$str_part_id] = substr_replace($str_part, 'id="%1$s"', $p1, $p2 + 1);
|
591 |
+
|
592 |
+
} elseif ( strpos($str_part, 'id=\'') !== false ) {
|
593 |
+
|
594 |
+
$p1 = strpos($str_part, 'id=\'');
|
595 |
+
|
596 |
+
$p2 = strpos($str_part, "'", $p1 + 4);
|
597 |
+
|
598 |
+
$str_array[$str_part_id] = substr_replace($str_part, 'id=\'%1$s\'', $p1, $p2);
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
}
|
603 |
+
|
604 |
+
$wp_registered_sidebars[$id]['before_widget'] = implode(' ', $str_array);
|
605 |
+
|
606 |
+
}
|
607 |
+
|
608 |
+
}
|
609 |
+
|
610 |
+
} // if id is wrong
|
611 |
+
|
612 |
+
} // foreach
|
613 |
+
|
614 |
+
} // registered_sidebars_filter()
|
615 |
+
|
616 |
+
} // q2w3_fixed_widget_pro class
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Q2W3 Fixed Widget for WordPress ===
|
2 |
-
Contributors: webzunft, max-bond
|
3 |
Tags: fixed widget, sticky widget, sidebar, ads, widget
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.1
|
6 |
-
Stable tag: 5.1.
|
7 |
|
8 |
More attention and a higher ad performance with fixed sticky widgets.
|
9 |
|
@@ -73,8 +73,11 @@ There are two options: `Disable Width` and `Disable Height`. They works the same
|
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
-
= 5.1.
|
|
|
|
|
77 |
|
|
|
78 |
* author change
|
79 |
|
80 |
= 5.1.4 =
|
1 |
=== Q2W3 Fixed Widget for WordPress ===
|
2 |
+
Contributors: webzunft, max-bond, advancedads
|
3 |
Tags: fixed widget, sticky widget, sidebar, ads, widget
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 5.1
|
6 |
+
Stable tag: 5.1.6
|
7 |
|
8 |
More attention and a higher ad performance with fixed sticky widgets.
|
9 |
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 5.1.6 =
|
77 |
+
* linguistic corrections
|
78 |
+
* cleanup of the options page
|
79 |
|
80 |
+
= 5.1.5 =
|
81 |
* author change
|
82 |
|
83 |
= 5.1.4 =
|