Version Description
- Fixed CSS issue with other plugins.
- Fixed missing icons on Elementor page builder.
Download this release
Release Info
Developer | edbertguinto |
Plugin | Widget Options |
Version | 3.7.10 |
Comparing to | |
See all releases |
Code changes from version 3.7.9 to 3.7.10
- assets/css/widget-options.css +1 -1
- assets/js/widgets.js +222 -222
- assets/js/wpWidgetOpts.js +421 -421
- assets/scss/widget-options.scss +68 -68
- includes/admin/import-export.php +702 -702
- includes/admin/notices.php +83 -83
- includes/admin/settings/display-settings.php +121 -121
- includes/admin/settings/modules/animation.php +35 -35
- includes/admin/settings/modules/cache.php +35 -35
- includes/admin/settings/modules/clone.php +35 -35
- includes/admin/settings/modules/columns.php +36 -36
- includes/admin/settings/modules/dates.php +36 -36
- includes/admin/settings/modules/disable_widgets.php +35 -35
- includes/admin/settings/modules/fixed.php +36 -36
- includes/admin/settings/modules/links.php +35 -35
- includes/admin/settings/modules/permission.php +36 -36
- includes/admin/settings/modules/roles.php +36 -36
- includes/admin/settings/modules/shortcodes.php +35 -35
- includes/admin/settings/modules/sidebar-more_plugins.php +35 -35
- includes/admin/settings/modules/sidebar-opt_in.php +60 -60
- includes/admin/settings/modules/sidebar-support_box.php +49 -49
- includes/admin/settings/modules/sidebar-upsell_pro.php +68 -68
- includes/admin/settings/modules/sliding.php +43 -43
- includes/admin/settings/modules/styling.php +35 -35
- includes/admin/settings/modules/taxonomies.php +35 -35
- includes/admin/settings/modules/urls.php +35 -35
- includes/admin/settings/register-settings.php +181 -181
- includes/admin/welcome.php +103 -103
- includes/extras.php +186 -186
- includes/install.php +98 -98
- includes/pagebuilders/beaver/beaver.php +834 -834
- includes/pagebuilders/elementor/elementor.php +502 -502
- includes/pagebuilders/elementor/render.php +448 -448
- includes/pagebuilders/siteorigin.php +75 -75
- includes/widgets/display.php +480 -480
- includes/widgets/option-tabs/alignment.php +71 -71
- includes/widgets/option-tabs/upsell.php +91 -91
- plugin.php +269 -269
- readme.md +27 -27
- readme.txt +303 -299
assets/css/widget-options.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
body .extendedwopts-show{display:none}body .widgetopts-hide_title .widget-title{display:none}body .extendedwopts-md-right{text-align:right}body .extendedwopts-md-left{text-align:left}body .extendedwopts-md-center{text-align:center}body .extendedwopts-md-justify{text-align:justify}@media screen and (min-width: 769px){body .extendedwopts-hide.extendedwopts-desktop{display:none !important;}body .extendedwopts-show.extendedwopts-desktop{display:block}body .widget.clearfix-desktop{clear:both}}@media screen and (max-width: 768px) and (min-width: 737px){body .extendedwopts-hide.extendedwopts-tablet{display:none !important;}body .extendedwopts-show.extendedwopts-tablet{display:block}body .widget.clearfix-desktop{clear:none}body .widget.clearfix-tablet{clear:both}}@media screen and (max-width: 736px){body .extendedwopts-hide.extendedwopts-mobile{display:none !important;}body .extendedwopts-show.extendedwopts-mobile{display:block}body .widget.clearfix-desktop,body .widget.clearfix-tablet{clear:none}body .widget.clearfix-mobile{clear:both}}
|
1 |
+
body .extendedwopts-show{display:none}body .widgetopts-hide_title .widget-title{display:none}body .extendedwopts-md-right{text-align:right}body .extendedwopts-md-left{text-align:left}body .extendedwopts-md-center{text-align:center}body .extendedwopts-md-justify{text-align:justify}@media screen and (min-width: 769px){body .extendedwopts-hide.extendedwopts-desktop{display:none !important;}body .extendedwopts-show.extendedwopts-desktop{display:block}body .widget.clearfix-desktop{clear:both}}@media screen and (max-width: 768px) and (min-width: 737px){body .extendedwopts-hide.extendedwopts-tablet{display:none !important;}body .extendedwopts-show.extendedwopts-tablet{display:block}body .widget.clearfix-desktop{clear:none}body .widget.clearfix-tablet{clear:both}}@media screen and (max-width: 736px){body .extendedwopts-hide.extendedwopts-mobile{display:none !important;}body .extendedwopts-show.extendedwopts-mobile{display:block}body .widget.clearfix-desktop,body .widget.clearfix-tablet{clear:none}body .widget.clearfix-mobile{clear:both}}
|
assets/js/widgets.js
CHANGED
@@ -1,222 +1,222 @@
|
|
1 |
-
(function( $, window, document, undefined ) {
|
2 |
-
if( $('.extended-widget-opts-tabs').length > 0 ){
|
3 |
-
extended_widget_opts_init( '', 'loaded' );
|
4 |
-
}
|
5 |
-
|
6 |
-
$(document).ready(function(){
|
7 |
-
$(".widget-liquid-right .widget, .inactive-sidebar .widget, #accordion-panel-widgets .customize-control-widget_form").each(function (i, widget) {
|
8 |
-
extended_widget_opts_init( '', 'loaded' );
|
9 |
-
});
|
10 |
-
$(document).on('widget-added', function(event, widget) {
|
11 |
-
extended_widget_opts_init( widget, 'added' );
|
12 |
-
|
13 |
-
// if( $( '.widgets-chooser .widgets-chooser-sidebars' ).length > 0 ){
|
14 |
-
// $( '.widgets-chooser .widgets-chooser-sidebars li' ).removeClass( 'widgetopts-is-hidden' );
|
15 |
-
// }
|
16 |
-
//
|
17 |
-
// if( $( '#widgetopts-search-chooser' ).length > 0 ){
|
18 |
-
// $( '#widgetopts-search-chooser' ).val('');
|
19 |
-
// }
|
20 |
-
|
21 |
-
});
|
22 |
-
$(document).on('widget-updated', function(event, widget) {
|
23 |
-
extended_widget_opts_init( widget, 'updated' );
|
24 |
-
});
|
25 |
-
$(document).on( 'click', '.extended-widget-opts-inner-lists h4',function(){
|
26 |
-
getid = $(this).attr('id');
|
27 |
-
$('.extended-widget-opts-inner-lists .'+ getid).slideToggle(250);
|
28 |
-
} );
|
29 |
-
$(document).on( 'click', '.widget-opts-toggler-note',function(e){
|
30 |
-
$(this).parent('p').parent('.widget-opts-logic').find('.widget-opts-toggle-note').slideToggle(250);
|
31 |
-
|
32 |
-
e.preventDefault();
|
33 |
-
e.stopPropagation();
|
34 |
-
} );
|
35 |
-
|
36 |
-
//admin settings
|
37 |
-
$(document).on( 'click', '.opts-add-class-btn',function(e){
|
38 |
-
getVal = $('.opts-add-class-txtfld').val();
|
39 |
-
var fname = 'extwopts_class_settings[classlists][]';
|
40 |
-
if( $(this).hasClass('widgetopts-add-class-btn') ){
|
41 |
-
fname = 'classes[classlists][]';
|
42 |
-
}
|
43 |
-
if( getVal.length > 0 ){
|
44 |
-
$('#opts-predefined-classes ul').append('<li><input type="hidden" name="'+ fname +'" value="'+ getVal +'" /><span class"opts-li-value">'+ getVal +'</span> <a href="#" class="opts-remove-class-btn"><span class="dashicons dashicons-dismiss"></span></a></li>');
|
45 |
-
$('.opts-add-class-txtfld').val('');
|
46 |
-
}
|
47 |
-
|
48 |
-
e.preventDefault();
|
49 |
-
e.stopPropagation();
|
50 |
-
} );
|
51 |
-
$(document).on( 'click', '.opts-remove-class-btn',function(e){
|
52 |
-
$(this).parent('li').fadeOut('fast',function(){
|
53 |
-
$(this).remove();
|
54 |
-
});
|
55 |
-
e.preventDefault();
|
56 |
-
e.stopPropagation();
|
57 |
-
} );
|
58 |
-
|
59 |
-
if( $('.wp-admin.widgets-php .wrap a.page-title-action').length > 0 ){
|
60 |
-
$('.wp-admin.widgets-php .wrap a.page-title-action').after('<a href="'+ widgetopts10n.opts_page +'" class="page-title-action hide-if-no-customize">'+ widgetopts10n.translation.manage_settings +'</a>');
|
61 |
-
}
|
62 |
-
|
63 |
-
//add live filter
|
64 |
-
if ( typeof $.fn.liveFilter !== 'undefined' && $( '#widgetopts-widgets-search' ).length > 0 ) {
|
65 |
-
// Add separator to distinguish between visible and hidden widgets
|
66 |
-
$('.widget:last-of-type').after('<div class="widgetopts-separator" />');
|
67 |
-
|
68 |
-
// Add data attribute for order to each widget
|
69 |
-
$('#widgets-left .widget').each(function() {
|
70 |
-
var index = $(this).index() + 1;
|
71 |
-
$(this).attr( 'data-widget-index', index );
|
72 |
-
});
|
73 |
-
|
74 |
-
// Add liveFilter : credits to https://wordpress.org/plugins/widget-search-filter/ plugin
|
75 |
-
$('#widgets-left').liveFilter('#widgetopts-widgets-search', '.widget', {
|
76 |
-
filterChildSelector: '.widget-title h4, .widget-title h3',
|
77 |
-
after: function(contains, containsNot) {
|
78 |
-
|
79 |
-
// Move all hidden widgets to end.
|
80 |
-
containsNot.each(function() {
|
81 |
-
$(this).insertAfter($(this).parent().find('.widgetopts-separator'));
|
82 |
-
});
|
83 |
-
|
84 |
-
// Sort all visible widgets by original index
|
85 |
-
contains.sort(function(a,b) {
|
86 |
-
return a.getAttribute('data-widget-index') - b.getAttribute('data-widget-index');
|
87 |
-
});
|
88 |
-
|
89 |
-
// Move all visible back
|
90 |
-
contains.each(function() {
|
91 |
-
$(this).insertBefore($(this).parent().find('.widgetopts-separator'));
|
92 |
-
});
|
93 |
-
|
94 |
-
}
|
95 |
-
});
|
96 |
-
|
97 |
-
//add clear search
|
98 |
-
$( '#wpbody-content' ).on( 'keyup', '.widgetopts-widgets-search', function(e){
|
99 |
-
p = $(this).parent().find( '.widgetopts-clear-results' );
|
100 |
-
if ( '' !== $(this).val() ) {
|
101 |
-
p.addClass( 'widgetopts-is-visible' );
|
102 |
-
}else{
|
103 |
-
p.removeClass( 'widgetopts-is-visible' );
|
104 |
-
}
|
105 |
-
} );
|
106 |
-
|
107 |
-
$( '#wpbody-content' ).on( 'click', '.widgetopts-clear-results', function(e){
|
108 |
-
s = $(this).parent().find( '.widgetopts-widgets-search' );
|
109 |
-
s.val( '' ).focus().trigger( 'keyup' );
|
110 |
-
|
111 |
-
if( s.attr( 'id' ) == 'widgetopts-search-chooser' ){
|
112 |
-
$( '.widgets-chooser-sidebars li:not(:first)' ).removeClass( 'widgets-chooser-selected' );
|
113 |
-
}
|
114 |
-
|
115 |
-
e.preventDefault();
|
116 |
-
e.stopPropagation();
|
117 |
-
return false;
|
118 |
-
} );
|
119 |
-
|
120 |
-
//add sidebar chooser search field
|
121 |
-
$('.widgets-chooser').prepend( widgetopts10n.search_form );
|
122 |
-
//live filter
|
123 |
-
$('.widgets-chooser').liveFilter('#widgetopts-search-chooser', '.widgets-chooser-sidebars li', {
|
124 |
-
// filterChildSelector: 'li',
|
125 |
-
after: function( contains, containsNot ) {
|
126 |
-
//hide
|
127 |
-
containsNot.each(function() {
|
128 |
-
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
129 |
-
});
|
130 |
-
contains.each(function() {
|
131 |
-
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
132 |
-
});
|
133 |
-
if( contains.length > 0 ){
|
134 |
-
$( contains[0] ).addClass( 'widgets-chooser-selected' );
|
135 |
-
}
|
136 |
-
|
137 |
-
}
|
138 |
-
});
|
139 |
-
|
140 |
-
// if( $( '.widgets-chooser-cancel' ).length > 0 ){
|
141 |
-
// $('.widgets-chooser').on( 'click', '.widgets-chooser-cancel', function(e){
|
142 |
-
// if( $( '.widgets-chooser .widgets-chooser-sidebars' ).length > 0 ){
|
143 |
-
// $( '.widgets-chooser .widgets-chooser-sidebars li' ).removeClass( 'widgetopts-is-hidden' );
|
144 |
-
// }
|
145 |
-
//
|
146 |
-
// if( $( '#widgetopts-search-chooser' ).length > 0 ){
|
147 |
-
// $( '#widgetopts-search-chooser' ).val('');
|
148 |
-
// }
|
149 |
-
// });
|
150 |
-
// }
|
151 |
-
|
152 |
-
}
|
153 |
-
|
154 |
-
});
|
155 |
-
|
156 |
-
function extended_widget_opts_init( widget, action ){
|
157 |
-
selected = 0;
|
158 |
-
selected_visibility = 0;
|
159 |
-
selected_settings = 0;
|
160 |
-
in_customizer = false;
|
161 |
-
// check for wp.customize return boolean
|
162 |
-
if ( typeof wp !== 'undefined' ) {
|
163 |
-
in_customizer = typeof wp.customize !== 'undefined' ? true : false;
|
164 |
-
}
|
165 |
-
if( '' != widget ){
|
166 |
-
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-selectedtab').length > 0 ){
|
167 |
-
selected = $( '#' + widget.attr('id') ).find('#extended-widget-opts-selectedtab').val();
|
168 |
-
selected = parseInt( selected );
|
169 |
-
}
|
170 |
-
|
171 |
-
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
172 |
-
selected_visibility = $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').val();
|
173 |
-
selected_visibility = parseInt( selected_visibility );
|
174 |
-
}
|
175 |
-
|
176 |
-
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
177 |
-
selected_settings = $( '#' + widget.attr('id') ).find('#extended-widget-opts-settings-selectedtab').val();
|
178 |
-
selected_settings = parseInt( selected_settings );
|
179 |
-
}
|
180 |
-
// console.log( in_customizer );
|
181 |
-
}
|
182 |
-
if( action == 'added' ){
|
183 |
-
selected = 0;
|
184 |
-
selected_visibility = 0;
|
185 |
-
selected_settings = 0;
|
186 |
-
}
|
187 |
-
|
188 |
-
if( '' != widget ){
|
189 |
-
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-tabs').length > 0 ){
|
190 |
-
$( '#' + widget.attr('id') ).find('.extended-widget-opts-tabs').tabs({ active: selected });
|
191 |
-
}
|
192 |
-
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-visibility-tabs').length > 0 ){
|
193 |
-
$( '#' + widget.attr('id') ).find('.extended-widget-opts-visibility-tabs').tabs({ active: selected_visibility });
|
194 |
-
}
|
195 |
-
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-settings-tabs').length > 0 ){
|
196 |
-
$( '#' + widget.attr('id') ).find('.extended-widget-opts-settings-tabs').tabs({ active: selected_settings });
|
197 |
-
}
|
198 |
-
}else{
|
199 |
-
$('.extended-widget-opts-tabs').tabs({ active: selected });
|
200 |
-
$('.extended-widget-opts-visibility-tabs').tabs({ active: selected_visibility });
|
201 |
-
$('.extended-widget-opts-settings-tabs').tabs({ active: selected_settings });
|
202 |
-
}
|
203 |
-
|
204 |
-
$('.extended-widget-opts-tabs').click('tabsselect', function (event, ui) {
|
205 |
-
if( $(this).find('#extended-widget-opts-selectedtab').length > 0 ){
|
206 |
-
$(this).find('#extended-widget-opts-selectedtab').val( $(this).tabs('option', 'active') );
|
207 |
-
}
|
208 |
-
});
|
209 |
-
|
210 |
-
$('.extended-widget-opts-visibility-tabs').click('tabsselect', function (event, ui) {
|
211 |
-
if( $(this).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
212 |
-
$(this).find('#extended-widget-opts-visibility-selectedtab').val( $(this).tabs('option', 'active') );
|
213 |
-
}
|
214 |
-
});
|
215 |
-
|
216 |
-
$('.extended-widget-opts-settings-tabs').click('tabsselect', function (event, ui) {
|
217 |
-
if( $(this).find('#extended-widget-opts-settings-selectedtab').length > 0 ){
|
218 |
-
$(this).find('#extended-widget-opts-settings-selectedtab').val( $(this).tabs('option', 'active') );
|
219 |
-
}
|
220 |
-
});
|
221 |
-
}
|
222 |
-
})( jQuery, window, document );
|
1 |
+
(function( $, window, document, undefined ) {
|
2 |
+
if( $('.extended-widget-opts-tabs').length > 0 ){
|
3 |
+
extended_widget_opts_init( '', 'loaded' );
|
4 |
+
}
|
5 |
+
|
6 |
+
$(document).ready(function(){
|
7 |
+
$(".widget-liquid-right .widget, .inactive-sidebar .widget, #accordion-panel-widgets .customize-control-widget_form").each(function (i, widget) {
|
8 |
+
extended_widget_opts_init( '', 'loaded' );
|
9 |
+
});
|
10 |
+
$(document).on('widget-added', function(event, widget) {
|
11 |
+
extended_widget_opts_init( widget, 'added' );
|
12 |
+
|
13 |
+
// if( $( '.widgets-chooser .widgets-chooser-sidebars' ).length > 0 ){
|
14 |
+
// $( '.widgets-chooser .widgets-chooser-sidebars li' ).removeClass( 'widgetopts-is-hidden' );
|
15 |
+
// }
|
16 |
+
//
|
17 |
+
// if( $( '#widgetopts-search-chooser' ).length > 0 ){
|
18 |
+
// $( '#widgetopts-search-chooser' ).val('');
|
19 |
+
// }
|
20 |
+
|
21 |
+
});
|
22 |
+
$(document).on('widget-updated', function(event, widget) {
|
23 |
+
extended_widget_opts_init( widget, 'updated' );
|
24 |
+
});
|
25 |
+
$(document).on( 'click', '.extended-widget-opts-inner-lists h4',function(){
|
26 |
+
getid = $(this).attr('id');
|
27 |
+
$('.extended-widget-opts-inner-lists .'+ getid).slideToggle(250);
|
28 |
+
} );
|
29 |
+
$(document).on( 'click', '.widget-opts-toggler-note',function(e){
|
30 |
+
$(this).parent('p').parent('.widget-opts-logic').find('.widget-opts-toggle-note').slideToggle(250);
|
31 |
+
|
32 |
+
e.preventDefault();
|
33 |
+
e.stopPropagation();
|
34 |
+
} );
|
35 |
+
|
36 |
+
//admin settings
|
37 |
+
$(document).on( 'click', '.opts-add-class-btn',function(e){
|
38 |
+
getVal = $('.opts-add-class-txtfld').val();
|
39 |
+
var fname = 'extwopts_class_settings[classlists][]';
|
40 |
+
if( $(this).hasClass('widgetopts-add-class-btn') ){
|
41 |
+
fname = 'classes[classlists][]';
|
42 |
+
}
|
43 |
+
if( getVal.length > 0 ){
|
44 |
+
$('#opts-predefined-classes ul').append('<li><input type="hidden" name="'+ fname +'" value="'+ getVal +'" /><span class"opts-li-value">'+ getVal +'</span> <a href="#" class="opts-remove-class-btn"><span class="dashicons dashicons-dismiss"></span></a></li>');
|
45 |
+
$('.opts-add-class-txtfld').val('');
|
46 |
+
}
|
47 |
+
|
48 |
+
e.preventDefault();
|
49 |
+
e.stopPropagation();
|
50 |
+
} );
|
51 |
+
$(document).on( 'click', '.opts-remove-class-btn',function(e){
|
52 |
+
$(this).parent('li').fadeOut('fast',function(){
|
53 |
+
$(this).remove();
|
54 |
+
});
|
55 |
+
e.preventDefault();
|
56 |
+
e.stopPropagation();
|
57 |
+
} );
|
58 |
+
|
59 |
+
if( $('.wp-admin.widgets-php .wrap a.page-title-action').length > 0 ){
|
60 |
+
$('.wp-admin.widgets-php .wrap a.page-title-action').after('<a href="'+ widgetopts10n.opts_page +'" class="page-title-action hide-if-no-customize">'+ widgetopts10n.translation.manage_settings +'</a>');
|
61 |
+
}
|
62 |
+
|
63 |
+
//add live filter
|
64 |
+
if ( typeof $.fn.liveFilter !== 'undefined' && $( '#widgetopts-widgets-search' ).length > 0 ) {
|
65 |
+
// Add separator to distinguish between visible and hidden widgets
|
66 |
+
$('.widget:last-of-type').after('<div class="widgetopts-separator" />');
|
67 |
+
|
68 |
+
// Add data attribute for order to each widget
|
69 |
+
$('#widgets-left .widget').each(function() {
|
70 |
+
var index = $(this).index() + 1;
|
71 |
+
$(this).attr( 'data-widget-index', index );
|
72 |
+
});
|
73 |
+
|
74 |
+
// Add liveFilter : credits to https://wordpress.org/plugins/widget-search-filter/ plugin
|
75 |
+
$('#widgets-left').liveFilter('#widgetopts-widgets-search', '.widget', {
|
76 |
+
filterChildSelector: '.widget-title h4, .widget-title h3',
|
77 |
+
after: function(contains, containsNot) {
|
78 |
+
|
79 |
+
// Move all hidden widgets to end.
|
80 |
+
containsNot.each(function() {
|
81 |
+
$(this).insertAfter($(this).parent().find('.widgetopts-separator'));
|
82 |
+
});
|
83 |
+
|
84 |
+
// Sort all visible widgets by original index
|
85 |
+
contains.sort(function(a,b) {
|
86 |
+
return a.getAttribute('data-widget-index') - b.getAttribute('data-widget-index');
|
87 |
+
});
|
88 |
+
|
89 |
+
// Move all visible back
|
90 |
+
contains.each(function() {
|
91 |
+
$(this).insertBefore($(this).parent().find('.widgetopts-separator'));
|
92 |
+
});
|
93 |
+
|
94 |
+
}
|
95 |
+
});
|
96 |
+
|
97 |
+
//add clear search
|
98 |
+
$( '#wpbody-content' ).on( 'keyup', '.widgetopts-widgets-search', function(e){
|
99 |
+
p = $(this).parent().find( '.widgetopts-clear-results' );
|
100 |
+
if ( '' !== $(this).val() ) {
|
101 |
+
p.addClass( 'widgetopts-is-visible' );
|
102 |
+
}else{
|
103 |
+
p.removeClass( 'widgetopts-is-visible' );
|
104 |
+
}
|
105 |
+
} );
|
106 |
+
|
107 |
+
$( '#wpbody-content' ).on( 'click', '.widgetopts-clear-results', function(e){
|
108 |
+
s = $(this).parent().find( '.widgetopts-widgets-search' );
|
109 |
+
s.val( '' ).focus().trigger( 'keyup' );
|
110 |
+
|
111 |
+
if( s.attr( 'id' ) == 'widgetopts-search-chooser' ){
|
112 |
+
$( '.widgets-chooser-sidebars li:not(:first)' ).removeClass( 'widgets-chooser-selected' );
|
113 |
+
}
|
114 |
+
|
115 |
+
e.preventDefault();
|
116 |
+
e.stopPropagation();
|
117 |
+
return false;
|
118 |
+
} );
|
119 |
+
|
120 |
+
//add sidebar chooser search field
|
121 |
+
$('.widgets-chooser').prepend( widgetopts10n.search_form );
|
122 |
+
//live filter
|
123 |
+
$('.widgets-chooser').liveFilter('#widgetopts-search-chooser', '.widgets-chooser-sidebars li', {
|
124 |
+
// filterChildSelector: 'li',
|
125 |
+
after: function( contains, containsNot ) {
|
126 |
+
//hide
|
127 |
+
containsNot.each(function() {
|
128 |
+
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
129 |
+
});
|
130 |
+
contains.each(function() {
|
131 |
+
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
132 |
+
});
|
133 |
+
if( contains.length > 0 ){
|
134 |
+
$( contains[0] ).addClass( 'widgets-chooser-selected' );
|
135 |
+
}
|
136 |
+
|
137 |
+
}
|
138 |
+
});
|
139 |
+
|
140 |
+
// if( $( '.widgets-chooser-cancel' ).length > 0 ){
|
141 |
+
// $('.widgets-chooser').on( 'click', '.widgets-chooser-cancel', function(e){
|
142 |
+
// if( $( '.widgets-chooser .widgets-chooser-sidebars' ).length > 0 ){
|
143 |
+
// $( '.widgets-chooser .widgets-chooser-sidebars li' ).removeClass( 'widgetopts-is-hidden' );
|
144 |
+
// }
|
145 |
+
//
|
146 |
+
// if( $( '#widgetopts-search-chooser' ).length > 0 ){
|
147 |
+
// $( '#widgetopts-search-chooser' ).val('');
|
148 |
+
// }
|
149 |
+
// });
|
150 |
+
// }
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
});
|
155 |
+
|
156 |
+
function extended_widget_opts_init( widget, action ){
|
157 |
+
selected = 0;
|
158 |
+
selected_visibility = 0;
|
159 |
+
selected_settings = 0;
|
160 |
+
in_customizer = false;
|
161 |
+
// check for wp.customize return boolean
|
162 |
+
if ( typeof wp !== 'undefined' ) {
|
163 |
+
in_customizer = typeof wp.customize !== 'undefined' ? true : false;
|
164 |
+
}
|
165 |
+
if( '' != widget ){
|
166 |
+
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-selectedtab').length > 0 ){
|
167 |
+
selected = $( '#' + widget.attr('id') ).find('#extended-widget-opts-selectedtab').val();
|
168 |
+
selected = parseInt( selected );
|
169 |
+
}
|
170 |
+
|
171 |
+
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
172 |
+
selected_visibility = $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').val();
|
173 |
+
selected_visibility = parseInt( selected_visibility );
|
174 |
+
}
|
175 |
+
|
176 |
+
if( $( '#' + widget.attr('id') ).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
177 |
+
selected_settings = $( '#' + widget.attr('id') ).find('#extended-widget-opts-settings-selectedtab').val();
|
178 |
+
selected_settings = parseInt( selected_settings );
|
179 |
+
}
|
180 |
+
// console.log( in_customizer );
|
181 |
+
}
|
182 |
+
if( action == 'added' ){
|
183 |
+
selected = 0;
|
184 |
+
selected_visibility = 0;
|
185 |
+
selected_settings = 0;
|
186 |
+
}
|
187 |
+
|
188 |
+
if( '' != widget ){
|
189 |
+
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-tabs').length > 0 ){
|
190 |
+
$( '#' + widget.attr('id') ).find('.extended-widget-opts-tabs').tabs({ active: selected });
|
191 |
+
}
|
192 |
+
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-visibility-tabs').length > 0 ){
|
193 |
+
$( '#' + widget.attr('id') ).find('.extended-widget-opts-visibility-tabs').tabs({ active: selected_visibility });
|
194 |
+
}
|
195 |
+
if( $( '#' + widget.attr('id') ).find('.extended-widget-opts-settings-tabs').length > 0 ){
|
196 |
+
$( '#' + widget.attr('id') ).find('.extended-widget-opts-settings-tabs').tabs({ active: selected_settings });
|
197 |
+
}
|
198 |
+
}else{
|
199 |
+
$('.extended-widget-opts-tabs').tabs({ active: selected });
|
200 |
+
$('.extended-widget-opts-visibility-tabs').tabs({ active: selected_visibility });
|
201 |
+
$('.extended-widget-opts-settings-tabs').tabs({ active: selected_settings });
|
202 |
+
}
|
203 |
+
|
204 |
+
$('.extended-widget-opts-tabs').click('tabsselect', function (event, ui) {
|
205 |
+
if( $(this).find('#extended-widget-opts-selectedtab').length > 0 ){
|
206 |
+
$(this).find('#extended-widget-opts-selectedtab').val( $(this).tabs('option', 'active') );
|
207 |
+
}
|
208 |
+
});
|
209 |
+
|
210 |
+
$('.extended-widget-opts-visibility-tabs').click('tabsselect', function (event, ui) {
|
211 |
+
if( $(this).find('#extended-widget-opts-visibility-selectedtab').length > 0 ){
|
212 |
+
$(this).find('#extended-widget-opts-visibility-selectedtab').val( $(this).tabs('option', 'active') );
|
213 |
+
}
|
214 |
+
});
|
215 |
+
|
216 |
+
$('.extended-widget-opts-settings-tabs').click('tabsselect', function (event, ui) {
|
217 |
+
if( $(this).find('#extended-widget-opts-settings-selectedtab').length > 0 ){
|
218 |
+
$(this).find('#extended-widget-opts-settings-selectedtab').val( $(this).tabs('option', 'active') );
|
219 |
+
}
|
220 |
+
});
|
221 |
+
}
|
222 |
+
})( jQuery, window, document );
|
assets/js/wpWidgetOpts.js
CHANGED
@@ -1,421 +1,421 @@
|
|
1 |
-
/*global ajaxurl, isRtl */
|
2 |
-
var wpWidgetOpts;
|
3 |
-
(function($) {
|
4 |
-
var $document = $( document );
|
5 |
-
|
6 |
-
wpWidgetOpts = {
|
7 |
-
/**
|
8 |
-
* A closed Sidebar that gets a Widget dragged over it.
|
9 |
-
*
|
10 |
-
* @var element|null
|
11 |
-
*/
|
12 |
-
hoveredSidebar: null,
|
13 |
-
|
14 |
-
init : function() {
|
15 |
-
var self = this,
|
16 |
-
title = $( '.wp-admin.widgets-php .wrap a.page-title-action' ),
|
17 |
-
tabs = $( '.extended-widget-opts-tabs' ),
|
18 |
-
chooser = $( '.widgetsopts-chooser' ),
|
19 |
-
selectSidebar = chooser.find( '.widgetopts-chooser-sidebars' );
|
20 |
-
// ta = chooser.find('.widgets-chooser-sidebars'),
|
21 |
-
// sidebars = $('div.widgets-sortables'),
|
22 |
-
// isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
|
23 |
-
|
24 |
-
if( tabs.length > 0 ){
|
25 |
-
self.loaded( '', 'loaded' );
|
26 |
-
}
|
27 |
-
|
28 |
-
//runs on customizer
|
29 |
-
$( '.widget-liquid-right .widget, .inactive-sidebar .widget, #accordion-panel-widgets .customize-control-widget_form' ).each(function (i, widget) {
|
30 |
-
self.loaded( '', 'loaded' );
|
31 |
-
});
|
32 |
-
|
33 |
-
//fires when widget added
|
34 |
-
$document.on( 'widget-added', function( event, widget ) {
|
35 |
-
self.loaded( widget, 'added' );
|
36 |
-
});
|
37 |
-
|
38 |
-
//fires when widget updated
|
39 |
-
$document.on( 'widget-updated', function( event, widget ) {
|
40 |
-
self.loaded( widget, 'updated' );
|
41 |
-
});
|
42 |
-
|
43 |
-
//toggle accordions
|
44 |
-
$document.on( 'click', '.extended-widget-opts-inner-lists h4',function(){
|
45 |
-
var getid = $(this).attr('id');
|
46 |
-
$( '.extended-widget-opts-inner-lists .'+ getid ).slideToggle(250);
|
47 |
-
} );
|
48 |
-
|
49 |
-
//toggle widget logic notice
|
50 |
-
$document.on( 'click', '.widget-opts-toggler-note',function(e){
|
51 |
-
$( this ).parent( 'p' ).parent( '.widget-opts-logic' ).find( '.widget-opts-toggle-note' ).slideToggle( 250 );
|
52 |
-
e.preventDefault();
|
53 |
-
e.stopPropagation();
|
54 |
-
} );
|
55 |
-
|
56 |
-
//add link to settings page on title
|
57 |
-
if( title.length > 0 ){
|
58 |
-
title.after('<a href="'+ widgetopts10n.opts_page +'" class="page-title-action hide-if-no-customize">'+ widgetopts10n.translation.manage_settings +'</a>');
|
59 |
-
}
|
60 |
-
|
61 |
-
//live search filter
|
62 |
-
self.live_search();
|
63 |
-
|
64 |
-
//append move and clone button to .widget-control-actions
|
65 |
-
$( '.widget-control-actions .alignleft .widget-control-remove' ).after( widgetopts10n.controls );
|
66 |
-
|
67 |
-
//chooser for move and clone action
|
68 |
-
self.do_chooser( chooser, selectSidebar );
|
69 |
-
|
70 |
-
//add sidebar options
|
71 |
-
self.sidebarOptions();
|
72 |
-
self.removeSidebarWidgets();
|
73 |
-
|
74 |
-
},
|
75 |
-
loaded : function( widget, action ){
|
76 |
-
var widget_id,
|
77 |
-
selected = 0,
|
78 |
-
selected_styling = 0,
|
79 |
-
selected_main = 0,
|
80 |
-
selected_visibility = 0,
|
81 |
-
selected_settings = 0,
|
82 |
-
in_customizer = false,
|
83 |
-
tabs = '.extended-widget-opts-tabs',
|
84 |
-
styling_tabs = '.extended-widget-opts-styling-tabs',
|
85 |
-
visibility_main = '.extended-widget-opts-visibility-m-tabs',
|
86 |
-
visibility_tabs = '.extended-widget-opts-visibility-tabs',
|
87 |
-
settings_tabs = '.extended-widget-opts-settings-tabs',
|
88 |
-
selectedtab = '#extended-widget-opts-selectedtab',
|
89 |
-
selectedstyling = '#extended-widget-opts-styling-selectedtab',
|
90 |
-
selectedmain = '#extended-widget-opts-visibility-m-selectedtab',
|
91 |
-
selectedvisibility = '#extended-widget-opts-visibility-selectedtab',
|
92 |
-
selectedsettings = '#extended-widget-opts-settings-selectedtab';
|
93 |
-
|
94 |
-
// check for wp.customize return boolean
|
95 |
-
if ( typeof wp !== 'undefined' ) {
|
96 |
-
in_customizer = typeof wp.customize !== 'undefined' ? true : false;
|
97 |
-
}
|
98 |
-
if( '' != widget ){
|
99 |
-
widget_id = '#' + widget.attr('id');
|
100 |
-
|
101 |
-
if( $( widget_id ).find( selectedtab ).length > 0 ){
|
102 |
-
selected = $( '#' + widget.attr('id') ).find( selectedtab ).val();
|
103 |
-
selected = parseInt( selected );
|
104 |
-
}
|
105 |
-
|
106 |
-
if( $( widget_id ).find( selectedvisibility ).length > 0 ){
|
107 |
-
selected_visibility = $( '#' + widget.attr('id') ).find( selectedvisibility ).val();
|
108 |
-
selected_visibility = parseInt( selected_visibility );
|
109 |
-
}
|
110 |
-
|
111 |
-
if( $( widget_id ).find( selectedmain ).length > 0 ){
|
112 |
-
selected_main = $( '#' + widget.attr('id') ).find( selectedmain ).val();
|
113 |
-
selected_main = parseInt( selected_main );
|
114 |
-
}
|
115 |
-
|
116 |
-
if( $( widget_id ).find( selectedsettings ).length > 0 ){
|
117 |
-
selected_settings = $( '#' + widget.attr('id') ).find( selectedsettings ).val();
|
118 |
-
selected_settings = parseInt( selected_settings );
|
119 |
-
}
|
120 |
-
// console.log( in_customizer );
|
121 |
-
}
|
122 |
-
if( action == 'added' ){
|
123 |
-
selected = 0;
|
124 |
-
selected_main = 0,
|
125 |
-
selected_visibility = 0;
|
126 |
-
selected_settings = 0;
|
127 |
-
}
|
128 |
-
|
129 |
-
if( '' != widget ){
|
130 |
-
if( $( widget_id ).find( tabs ).length > 0 ){
|
131 |
-
$( widget_id ).find( tabs ).tabs({ active: selected });
|
132 |
-
}
|
133 |
-
if( $( widget_id ).find( visibility_main ).length > 0 ){
|
134 |
-
$( widget_id ).find( visibility_main ).tabs({ active: selected_main });
|
135 |
-
}
|
136 |
-
if( $( widget_id ).find( visibility_tabs ).length > 0 ){
|
137 |
-
$( widget_id ).find( visibility_tabs ).tabs({ active: selected_visibility });
|
138 |
-
}
|
139 |
-
if( $( widget_id ).find( settings_tabs ).length > 0 ){
|
140 |
-
$( widget_id ).find( settings_tabs ).tabs({ active: selected_settings });
|
141 |
-
}
|
142 |
-
}else{
|
143 |
-
$( tabs ).tabs({ active: selected });
|
144 |
-
$( styling_tabs ).tabs({ active: selected_styling });
|
145 |
-
$( visibility_main ).tabs({ active: selected_main });
|
146 |
-
$( visibility_tabs ).tabs({ active: selected_visibility });
|
147 |
-
$( settings_tabs ).tabs({ active: selected_settings });
|
148 |
-
}
|
149 |
-
|
150 |
-
$( tabs ).click('tabsselect', function (event, ui) {
|
151 |
-
if( $(this).find( selectedtab ).length > 0 ){
|
152 |
-
$(this).find( selectedtab ).val( $(this).tabs('option', 'active') );
|
153 |
-
}
|
154 |
-
});
|
155 |
-
|
156 |
-
$( visibility_tabs ).click('tabsselect', function (event, ui) {
|
157 |
-
if( $(this).find( selectedvisibility ).length > 0 ){
|
158 |
-
$(this).find( selectedvisibility ).val( $(this).tabs('option', 'active') );
|
159 |
-
}
|
160 |
-
});
|
161 |
-
|
162 |
-
$( visibility_main ).click('tabsselect', function (event, ui) {
|
163 |
-
if( $(this).find( selectedmain ).length > 0 ){
|
164 |
-
$(this).find( selectedmain ).val( $(this).tabs('option', 'active') );
|
165 |
-
}
|
166 |
-
});
|
167 |
-
|
168 |
-
$( settings_tabs ).click('tabsselect', function (event, ui) {
|
169 |
-
if( $(this).find( selectedsettings ).length > 0 ){
|
170 |
-
$(this).find( selectedsettings ).val( $(this).tabs('option', 'active') );
|
171 |
-
}
|
172 |
-
});
|
173 |
-
},
|
174 |
-
live_search : function(){
|
175 |
-
if ( typeof $.fn.liveFilter !== 'undefined' && $( '#widgetopts-widgets-search' ).length > 0 ) {
|
176 |
-
// Add separator to distinguish between visible and hidden widgets
|
177 |
-
$('.widget:last-of-type').after('<div class="widgetopts-separator" />');
|
178 |
-
|
179 |
-
// Add data attribute for order to each widget
|
180 |
-
$('#widgets-left .widget').each(function() {
|
181 |
-
var index = $(this).index() + 1;
|
182 |
-
$(this).attr( 'data-widget-index', index );
|
183 |
-
});
|
184 |
-
|
185 |
-
// Add liveFilter : credits to https://wordpress.org/plugins/widget-search-filter/ plugin
|
186 |
-
$('#widgets-left').liveFilter('#widgetopts-widgets-search', '.widget', {
|
187 |
-
filterChildSelector: '.widget-title h4, .widget-title h3',
|
188 |
-
after: function(contains, containsNot) {
|
189 |
-
|
190 |
-
// Move all hidden widgets to end.
|
191 |
-
containsNot.each(function() {
|
192 |
-
$(this).insertAfter($(this).parent().find('.widgetopts-separator'));
|
193 |
-
});
|
194 |
-
|
195 |
-
// Sort all visible widgets by original index
|
196 |
-
contains.sort(function(a,b) {
|
197 |
-
return a.getAttribute('data-widget-index') - b.getAttribute('data-widget-index');
|
198 |
-
});
|
199 |
-
|
200 |
-
// Move all visible back
|
201 |
-
contains.each(function() {
|
202 |
-
$(this).insertBefore($(this).parent().find('.widgetopts-separator'));
|
203 |
-
});
|
204 |
-
|
205 |
-
}
|
206 |
-
});
|
207 |
-
|
208 |
-
//add clear search
|
209 |
-
$( '#wpbody-content' ).on( 'keyup', '.widgetopts-widgets-search', function(e){
|
210 |
-
p = $(this).parent().find( '.widgetopts-clear-results' );
|
211 |
-
if ( '' !== $(this).val() ) {
|
212 |
-
p.addClass( 'widgetopts-is-visible' );
|
213 |
-
}else{
|
214 |
-
p.removeClass( 'widgetopts-is-visible' );
|
215 |
-
}
|
216 |
-
} );
|
217 |
-
|
218 |
-
$( '#wpbody-content' ).on( 'click', '.widgetopts-clear-results', function(e){
|
219 |
-
s = $(this).parent().find( '.widgetopts-widgets-search' );
|
220 |
-
s.val( '' ).focus().trigger( 'keyup' );
|
221 |
-
|
222 |
-
if( s.attr( 'id' ) == 'widgetopts-search-chooser' ){
|
223 |
-
$( '.widgets-chooser-sidebars li:not(:first)' ).removeClass( 'widgets-chooser-selected' );
|
224 |
-
}else if( s.hasClass('widgetsopts-widgets-search') ){
|
225 |
-
$( '.widgetopts-chooser-sidebars li:not(:first)' ).removeClass( 'widgetopts-chooser-selected' );
|
226 |
-
}
|
227 |
-
|
228 |
-
e.preventDefault();
|
229 |
-
e.stopPropagation();
|
230 |
-
return false;
|
231 |
-
} );
|
232 |
-
|
233 |
-
//add sidebar chooser search field
|
234 |
-
$('.widgets-chooser').prepend( widgetopts10n.search_form );
|
235 |
-
//live filter
|
236 |
-
$('.widgets-chooser').liveFilter('#widgetopts-search-chooser', '.widgets-chooser-sidebars li', {
|
237 |
-
// filterChildSelector: 'li',
|
238 |
-
after: function( contains, containsNot ) {
|
239 |
-
//hide
|
240 |
-
containsNot.each(function() {
|
241 |
-
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
242 |
-
});
|
243 |
-
contains.each(function() {
|
244 |
-
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
245 |
-
});
|
246 |
-
if( contains.length > 0 ){
|
247 |
-
$( contains[0] ).addClass( 'widgets-chooser-selected' );
|
248 |
-
}
|
249 |
-
|
250 |
-
}
|
251 |
-
});
|
252 |
-
|
253 |
-
}
|
254 |
-
},
|
255 |
-
do_chooser : function( chooser, selectSidebar ){
|
256 |
-
var self = this;
|
257 |
-
|
258 |
-
//add sidebar lists on chooser
|
259 |
-
$( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
|
260 |
-
var $element = $( element ),
|
261 |
-
name = $element.find( '.sidebar-name h2' ).text(),
|
262 |
-
id = $element.find( '.widgets-sortables' ).attr( 'id' ),
|
263 |
-
li = $('<li tabindex="0">').text(name.trim());
|
264 |
-
|
265 |
-
if ( index === 0 ) {
|
266 |
-
li.addClass( 'widgetopts-chooser-selected' );
|
267 |
-
}
|
268 |
-
|
269 |
-
selectSidebar.append( li );
|
270 |
-
li.attr( 'data-sidebarId', id );
|
271 |
-
});
|
272 |
-
|
273 |
-
//do click
|
274 |
-
$document.on( 'click', '.widgetopts-control', function(e){
|
275 |
-
var lbl = $(this).text(),
|
276 |
-
action = $( this ).attr( 'data-action' );
|
277 |
-
|
278 |
-
if( $(this).hasClass( 'widgetopts-control-open' ) ){
|
279 |
-
self.closeChooser();
|
280 |
-
$( '.widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
281 |
-
}else{
|
282 |
-
|
283 |
-
chooser.find( '.widgetopts-chooser-action span' ).text( lbl );
|
284 |
-
chooser.find( '.widgetopts-chooser-action' ).attr( 'data-action', action );
|
285 |
-
$(this).parents('.widget-control-actions').find('.clear').after( chooser );
|
286 |
-
|
287 |
-
chooser.slideDown( 300, function() {
|
288 |
-
selectSidebar.find('.widgets-chooser-selected').focus();
|
289 |
-
});
|
290 |
-
$( '.widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
291 |
-
$(this).addClass( 'widgetopts-control-open' );
|
292 |
-
|
293 |
-
self.chooserSearch();
|
294 |
-
}
|
295 |
-
|
296 |
-
e.preventDefault();
|
297 |
-
} );
|
298 |
-
|
299 |
-
//add selected on click
|
300 |
-
$document.on( 'click', '.widgetopts-chooser-sidebars li', function(e){
|
301 |
-
selectSidebar.find('.widgetopts-chooser-selected').removeClass( 'widgetopts-chooser-selected' );
|
302 |
-
$(this).addClass( 'widgetopts-chooser-selected' );
|
303 |
-
} );
|
304 |
-
|
305 |
-
//do action
|
306 |
-
$document.on( 'click', '.widgetsopts-chooser .widgetopts-chooser-action', function(e){
|
307 |
-
var $container = $( 'html,body' ),
|
308 |
-
$action = $( this ).attr( 'data-action' ),
|
309 |
-
parentSidebar = $( this ).parents('.widgets-sortables').attr('id'),
|
310 |
-
widgetID = $( this ).parents('.widget').attr('id'),
|
311 |
-
$widget = $( '#'+ widgetID );
|
312 |
-
sidebarID = $( '.widgetopts-chooser-selected' ).attr('data-sidebarId');
|
313 |
-
// console.log( $action + ' ' + parentSidebar +' ' + widgetID + ' ' + sidebarID);
|
314 |
-
//remove chooser
|
315 |
-
$( '#'+ widgetID + ' .widgetsopts-chooser' ).remove();
|
316 |
-
$widget.find(' .widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
317 |
-
|
318 |
-
switch ( $action ) {
|
319 |
-
case 'move':
|
320 |
-
$( '#' + parentSidebar ).find( '#' + widgetID ).appendTo( '#' + sidebarID );
|
321 |
-
|
322 |
-
$('#' + sidebarID).sortable('refresh');
|
323 |
-
$widget.addClass( 'widgetopts-move-ds' );
|
324 |
-
$( '#' + sidebarID ).parent('.widgets-holder-wrap').removeClass( 'closed' );
|
325 |
-
wpWidgets.save( $( '#' + widgetID ), 0, 0, 1 );
|
326 |
-
break;
|
327 |
-
default:
|
328 |
-
break;
|
329 |
-
|
330 |
-
}
|
331 |
-
|
332 |
-
var $scrollTo = $( '.widgetopts-move-ds' );
|
333 |
-
|
334 |
-
$container.animate({ scrollTop: $scrollTo.offset().top - ( $container.offset().top + $container.scrollTop() + 60 ) }, 200 );
|
335 |
-
$( '.widgetopts-move-ds' ).removeClass( '.widgetopts-move-ds' );
|
336 |
-
e.preventDefault();
|
337 |
-
} );
|
338 |
-
|
339 |
-
//cancel chooser
|
340 |
-
$document.on( 'click', '.widgetsopts-chooser .widgetsopts-chooser-cancel', function(e){
|
341 |
-
self.closeChooser( chooser );
|
342 |
-
e.preventDefault();
|
343 |
-
} );
|
344 |
-
},
|
345 |
-
closeChooser : function( chooser ) {
|
346 |
-
var self = this;
|
347 |
-
|
348 |
-
$( '.widgetsopts-chooser' ).slideUp( 200, function() {
|
349 |
-
$( '.widgetopts-control' ).removeClass( 'widgetopts-control-open' );
|
350 |
-
$( '#wpbody-content' ).append( this );
|
351 |
-
});
|
352 |
-
},
|
353 |
-
chooserSearch : function(){
|
354 |
-
//add livefilter
|
355 |
-
if( $( '#widgetsopts-widgets-search' ).length > 0 ){
|
356 |
-
$('.widgetsopts-chooser').liveFilter('#widgetsopts-widgets-search', '.widgetopts-chooser-sidebars li', {
|
357 |
-
// filterChildSelector: 'li',
|
358 |
-
after: function( contains, containsNot ) {
|
359 |
-
//hide
|
360 |
-
containsNot.each(function() {
|
361 |
-
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgetopts-chooser-selected' );
|
362 |
-
});
|
363 |
-
contains.each(function() {
|
364 |
-
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgetopts-chooser-selected' );
|
365 |
-
});
|
366 |
-
if( contains.length > 0 ){
|
367 |
-
$( contains[0] ).addClass( 'widgetopts-chooser-selected' );
|
368 |
-
}
|
369 |
-
|
370 |
-
}
|
371 |
-
});
|
372 |
-
}
|
373 |
-
},
|
374 |
-
sidebarOptions : function(){
|
375 |
-
var self = this;
|
376 |
-
if( widgetopts10n.sidebaropts.length > 0 ){
|
377 |
-
$( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
|
378 |
-
var sidebar_opts_h2 = $(this).find('.widgets-sortables h2').text();
|
379 |
-
dl_link = widgetopts10n.sidebaropts.replace( '__sidebaropts__', $(this).find('.widgets-sortables').attr('id') );
|
380 |
-
dl_link = dl_link.replace( '__sidebar_opts__', sidebar_opts_h2.trim() );
|
381 |
-
$(this).append( dl_link );
|
382 |
-
});
|
383 |
-
}
|
384 |
-
},
|
385 |
-
removeSidebarWidgets : function(){
|
386 |
-
var self = this;
|
387 |
-
var $container = $( 'html,body' );
|
388 |
-
$document.on( 'click', '.sidebaropts-clear', function(e){
|
389 |
-
//show confirmation
|
390 |
-
$(this).parent().find( '.sidebaropts-confirm' ).addClass( 'sidebaropts-confirmed' );
|
391 |
-
$(this).parent().find( '.sidebaropts-confirm' ).slideToggle(250);
|
392 |
-
|
393 |
-
e.preventDefault();
|
394 |
-
});
|
395 |
-
|
396 |
-
$document.on( 'click', '.sidebaropts-confirmed .button', function(e){
|
397 |
-
sidebar_id = $(this).parent().parent().parent().find('.widgets-sortables');
|
398 |
-
|
399 |
-
if( $(this).hasClass( 'button-primary' ) ){
|
400 |
-
var $scrollTo = sidebar_id;
|
401 |
-
|
402 |
-
$(this).parent().slideToggle(50);
|
403 |
-
$container.animate({ scrollTop: $scrollTo.offset().top - 50 }, 200 );
|
404 |
-
|
405 |
-
sidebar_id.find( '.widget' ).each( function( index, element ) {
|
406 |
-
$( element ).fadeOut();
|
407 |
-
wpWidgets.save( $( element ), 1, 1, 0 );
|
408 |
-
});
|
409 |
-
|
410 |
-
}else{
|
411 |
-
$(this).parent().slideToggle(250);
|
412 |
-
}
|
413 |
-
|
414 |
-
e.preventDefault();
|
415 |
-
});
|
416 |
-
}
|
417 |
-
};
|
418 |
-
|
419 |
-
$document.ready( function(){ wpWidgetOpts.init(); } );
|
420 |
-
|
421 |
-
})(jQuery);
|
1 |
+
/*global ajaxurl, isRtl */
|
2 |
+
var wpWidgetOpts;
|
3 |
+
(function($) {
|
4 |
+
var $document = $( document );
|
5 |
+
|
6 |
+
wpWidgetOpts = {
|
7 |
+
/**
|
8 |
+
* A closed Sidebar that gets a Widget dragged over it.
|
9 |
+
*
|
10 |
+
* @var element|null
|
11 |
+
*/
|
12 |
+
hoveredSidebar: null,
|
13 |
+
|
14 |
+
init : function() {
|
15 |
+
var self = this,
|
16 |
+
title = $( '.wp-admin.widgets-php .wrap a.page-title-action' ),
|
17 |
+
tabs = $( '.extended-widget-opts-tabs' ),
|
18 |
+
chooser = $( '.widgetsopts-chooser' ),
|
19 |
+
selectSidebar = chooser.find( '.widgetopts-chooser-sidebars' );
|
20 |
+
// ta = chooser.find('.widgets-chooser-sidebars'),
|
21 |
+
// sidebars = $('div.widgets-sortables'),
|
22 |
+
// isRTL = !! ( 'undefined' !== typeof isRtl && isRtl );
|
23 |
+
|
24 |
+
if( tabs.length > 0 ){
|
25 |
+
self.loaded( '', 'loaded' );
|
26 |
+
}
|
27 |
+
|
28 |
+
//runs on customizer
|
29 |
+
$( '.widget-liquid-right .widget, .inactive-sidebar .widget, #accordion-panel-widgets .customize-control-widget_form' ).each(function (i, widget) {
|
30 |
+
self.loaded( '', 'loaded' );
|
31 |
+
});
|
32 |
+
|
33 |
+
//fires when widget added
|
34 |
+
$document.on( 'widget-added', function( event, widget ) {
|
35 |
+
self.loaded( widget, 'added' );
|
36 |
+
});
|
37 |
+
|
38 |
+
//fires when widget updated
|
39 |
+
$document.on( 'widget-updated', function( event, widget ) {
|
40 |
+
self.loaded( widget, 'updated' );
|
41 |
+
});
|
42 |
+
|
43 |
+
//toggle accordions
|
44 |
+
$document.on( 'click', '.extended-widget-opts-inner-lists h4',function(){
|
45 |
+
var getid = $(this).attr('id');
|
46 |
+
$( '.extended-widget-opts-inner-lists .'+ getid ).slideToggle(250);
|
47 |
+
} );
|
48 |
+
|
49 |
+
//toggle widget logic notice
|
50 |
+
$document.on( 'click', '.widget-opts-toggler-note',function(e){
|
51 |
+
$( this ).parent( 'p' ).parent( '.widget-opts-logic' ).find( '.widget-opts-toggle-note' ).slideToggle( 250 );
|
52 |
+
e.preventDefault();
|
53 |
+
e.stopPropagation();
|
54 |
+
} );
|
55 |
+
|
56 |
+
//add link to settings page on title
|
57 |
+
if( title.length > 0 ){
|
58 |
+
title.after('<a href="'+ widgetopts10n.opts_page +'" class="page-title-action hide-if-no-customize">'+ widgetopts10n.translation.manage_settings +'</a>');
|
59 |
+
}
|
60 |
+
|
61 |
+
//live search filter
|
62 |
+
self.live_search();
|
63 |
+
|
64 |
+
//append move and clone button to .widget-control-actions
|
65 |
+
$( '.widget-control-actions .alignleft .widget-control-remove' ).after( widgetopts10n.controls );
|
66 |
+
|
67 |
+
//chooser for move and clone action
|
68 |
+
self.do_chooser( chooser, selectSidebar );
|
69 |
+
|
70 |
+
//add sidebar options
|
71 |
+
self.sidebarOptions();
|
72 |
+
self.removeSidebarWidgets();
|
73 |
+
|
74 |
+
},
|
75 |
+
loaded : function( widget, action ){
|
76 |
+
var widget_id,
|
77 |
+
selected = 0,
|
78 |
+
selected_styling = 0,
|
79 |
+
selected_main = 0,
|
80 |
+
selected_visibility = 0,
|
81 |
+
selected_settings = 0,
|
82 |
+
in_customizer = false,
|
83 |
+
tabs = '.extended-widget-opts-tabs',
|
84 |
+
styling_tabs = '.extended-widget-opts-styling-tabs',
|
85 |
+
visibility_main = '.extended-widget-opts-visibility-m-tabs',
|
86 |
+
visibility_tabs = '.extended-widget-opts-visibility-tabs',
|
87 |
+
settings_tabs = '.extended-widget-opts-settings-tabs',
|
88 |
+
selectedtab = '#extended-widget-opts-selectedtab',
|
89 |
+
selectedstyling = '#extended-widget-opts-styling-selectedtab',
|
90 |
+
selectedmain = '#extended-widget-opts-visibility-m-selectedtab',
|
91 |
+
selectedvisibility = '#extended-widget-opts-visibility-selectedtab',
|
92 |
+
selectedsettings = '#extended-widget-opts-settings-selectedtab';
|
93 |
+
|
94 |
+
// check for wp.customize return boolean
|
95 |
+
if ( typeof wp !== 'undefined' ) {
|
96 |
+
in_customizer = typeof wp.customize !== 'undefined' ? true : false;
|
97 |
+
}
|
98 |
+
if( '' != widget ){
|
99 |
+
widget_id = '#' + widget.attr('id');
|
100 |
+
|
101 |
+
if( $( widget_id ).find( selectedtab ).length > 0 ){
|
102 |
+
selected = $( '#' + widget.attr('id') ).find( selectedtab ).val();
|
103 |
+
selected = parseInt( selected );
|
104 |
+
}
|
105 |
+
|
106 |
+
if( $( widget_id ).find( selectedvisibility ).length > 0 ){
|
107 |
+
selected_visibility = $( '#' + widget.attr('id') ).find( selectedvisibility ).val();
|
108 |
+
selected_visibility = parseInt( selected_visibility );
|
109 |
+
}
|
110 |
+
|
111 |
+
if( $( widget_id ).find( selectedmain ).length > 0 ){
|
112 |
+
selected_main = $( '#' + widget.attr('id') ).find( selectedmain ).val();
|
113 |
+
selected_main = parseInt( selected_main );
|
114 |
+
}
|
115 |
+
|
116 |
+
if( $( widget_id ).find( selectedsettings ).length > 0 ){
|
117 |
+
selected_settings = $( '#' + widget.attr('id') ).find( selectedsettings ).val();
|
118 |
+
selected_settings = parseInt( selected_settings );
|
119 |
+
}
|
120 |
+
// console.log( in_customizer );
|
121 |
+
}
|
122 |
+
if( action == 'added' ){
|
123 |
+
selected = 0;
|
124 |
+
selected_main = 0,
|
125 |
+
selected_visibility = 0;
|
126 |
+
selected_settings = 0;
|
127 |
+
}
|
128 |
+
|
129 |
+
if( '' != widget ){
|
130 |
+
if( $( widget_id ).find( tabs ).length > 0 ){
|
131 |
+
$( widget_id ).find( tabs ).tabs({ active: selected });
|
132 |
+
}
|
133 |
+
if( $( widget_id ).find( visibility_main ).length > 0 ){
|
134 |
+
$( widget_id ).find( visibility_main ).tabs({ active: selected_main });
|
135 |
+
}
|
136 |
+
if( $( widget_id ).find( visibility_tabs ).length > 0 ){
|
137 |
+
$( widget_id ).find( visibility_tabs ).tabs({ active: selected_visibility });
|
138 |
+
}
|
139 |
+
if( $( widget_id ).find( settings_tabs ).length > 0 ){
|
140 |
+
$( widget_id ).find( settings_tabs ).tabs({ active: selected_settings });
|
141 |
+
}
|
142 |
+
}else{
|
143 |
+
$( tabs ).tabs({ active: selected });
|
144 |
+
$( styling_tabs ).tabs({ active: selected_styling });
|
145 |
+
$( visibility_main ).tabs({ active: selected_main });
|
146 |
+
$( visibility_tabs ).tabs({ active: selected_visibility });
|
147 |
+
$( settings_tabs ).tabs({ active: selected_settings });
|
148 |
+
}
|
149 |
+
|
150 |
+
$( tabs ).click('tabsselect', function (event, ui) {
|
151 |
+
if( $(this).find( selectedtab ).length > 0 ){
|
152 |
+
$(this).find( selectedtab ).val( $(this).tabs('option', 'active') );
|
153 |
+
}
|
154 |
+
});
|
155 |
+
|
156 |
+
$( visibility_tabs ).click('tabsselect', function (event, ui) {
|
157 |
+
if( $(this).find( selectedvisibility ).length > 0 ){
|
158 |
+
$(this).find( selectedvisibility ).val( $(this).tabs('option', 'active') );
|
159 |
+
}
|
160 |
+
});
|
161 |
+
|
162 |
+
$( visibility_main ).click('tabsselect', function (event, ui) {
|
163 |
+
if( $(this).find( selectedmain ).length > 0 ){
|
164 |
+
$(this).find( selectedmain ).val( $(this).tabs('option', 'active') );
|
165 |
+
}
|
166 |
+
});
|
167 |
+
|
168 |
+
$( settings_tabs ).click('tabsselect', function (event, ui) {
|
169 |
+
if( $(this).find( selectedsettings ).length > 0 ){
|
170 |
+
$(this).find( selectedsettings ).val( $(this).tabs('option', 'active') );
|
171 |
+
}
|
172 |
+
});
|
173 |
+
},
|
174 |
+
live_search : function(){
|
175 |
+
if ( typeof $.fn.liveFilter !== 'undefined' && $( '#widgetopts-widgets-search' ).length > 0 ) {
|
176 |
+
// Add separator to distinguish between visible and hidden widgets
|
177 |
+
$('.widget:last-of-type').after('<div class="widgetopts-separator" />');
|
178 |
+
|
179 |
+
// Add data attribute for order to each widget
|
180 |
+
$('#widgets-left .widget').each(function() {
|
181 |
+
var index = $(this).index() + 1;
|
182 |
+
$(this).attr( 'data-widget-index', index );
|
183 |
+
});
|
184 |
+
|
185 |
+
// Add liveFilter : credits to https://wordpress.org/plugins/widget-search-filter/ plugin
|
186 |
+
$('#widgets-left').liveFilter('#widgetopts-widgets-search', '.widget', {
|
187 |
+
filterChildSelector: '.widget-title h4, .widget-title h3',
|
188 |
+
after: function(contains, containsNot) {
|
189 |
+
|
190 |
+
// Move all hidden widgets to end.
|
191 |
+
containsNot.each(function() {
|
192 |
+
$(this).insertAfter($(this).parent().find('.widgetopts-separator'));
|
193 |
+
});
|
194 |
+
|
195 |
+
// Sort all visible widgets by original index
|
196 |
+
contains.sort(function(a,b) {
|
197 |
+
return a.getAttribute('data-widget-index') - b.getAttribute('data-widget-index');
|
198 |
+
});
|
199 |
+
|
200 |
+
// Move all visible back
|
201 |
+
contains.each(function() {
|
202 |
+
$(this).insertBefore($(this).parent().find('.widgetopts-separator'));
|
203 |
+
});
|
204 |
+
|
205 |
+
}
|
206 |
+
});
|
207 |
+
|
208 |
+
//add clear search
|
209 |
+
$( '#wpbody-content' ).on( 'keyup', '.widgetopts-widgets-search', function(e){
|
210 |
+
p = $(this).parent().find( '.widgetopts-clear-results' );
|
211 |
+
if ( '' !== $(this).val() ) {
|
212 |
+
p.addClass( 'widgetopts-is-visible' );
|
213 |
+
}else{
|
214 |
+
p.removeClass( 'widgetopts-is-visible' );
|
215 |
+
}
|
216 |
+
} );
|
217 |
+
|
218 |
+
$( '#wpbody-content' ).on( 'click', '.widgetopts-clear-results', function(e){
|
219 |
+
s = $(this).parent().find( '.widgetopts-widgets-search' );
|
220 |
+
s.val( '' ).focus().trigger( 'keyup' );
|
221 |
+
|
222 |
+
if( s.attr( 'id' ) == 'widgetopts-search-chooser' ){
|
223 |
+
$( '.widgets-chooser-sidebars li:not(:first)' ).removeClass( 'widgets-chooser-selected' );
|
224 |
+
}else if( s.hasClass('widgetsopts-widgets-search') ){
|
225 |
+
$( '.widgetopts-chooser-sidebars li:not(:first)' ).removeClass( 'widgetopts-chooser-selected' );
|
226 |
+
}
|
227 |
+
|
228 |
+
e.preventDefault();
|
229 |
+
e.stopPropagation();
|
230 |
+
return false;
|
231 |
+
} );
|
232 |
+
|
233 |
+
//add sidebar chooser search field
|
234 |
+
$('.widgets-chooser').prepend( widgetopts10n.search_form );
|
235 |
+
//live filter
|
236 |
+
$('.widgets-chooser').liveFilter('#widgetopts-search-chooser', '.widgets-chooser-sidebars li', {
|
237 |
+
// filterChildSelector: 'li',
|
238 |
+
after: function( contains, containsNot ) {
|
239 |
+
//hide
|
240 |
+
containsNot.each(function() {
|
241 |
+
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
242 |
+
});
|
243 |
+
contains.each(function() {
|
244 |
+
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgets-chooser-selected' );
|
245 |
+
});
|
246 |
+
if( contains.length > 0 ){
|
247 |
+
$( contains[0] ).addClass( 'widgets-chooser-selected' );
|
248 |
+
}
|
249 |
+
|
250 |
+
}
|
251 |
+
});
|
252 |
+
|
253 |
+
}
|
254 |
+
},
|
255 |
+
do_chooser : function( chooser, selectSidebar ){
|
256 |
+
var self = this;
|
257 |
+
|
258 |
+
//add sidebar lists on chooser
|
259 |
+
$( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
|
260 |
+
var $element = $( element ),
|
261 |
+
name = $element.find( '.sidebar-name h2' ).text(),
|
262 |
+
id = $element.find( '.widgets-sortables' ).attr( 'id' ),
|
263 |
+
li = $('<li tabindex="0">').text(name.trim());
|
264 |
+
|
265 |
+
if ( index === 0 ) {
|
266 |
+
li.addClass( 'widgetopts-chooser-selected' );
|
267 |
+
}
|
268 |
+
|
269 |
+
selectSidebar.append( li );
|
270 |
+
li.attr( 'data-sidebarId', id );
|
271 |
+
});
|
272 |
+
|
273 |
+
//do click
|
274 |
+
$document.on( 'click', '.widgetopts-control', function(e){
|
275 |
+
var lbl = $(this).text(),
|
276 |
+
action = $( this ).attr( 'data-action' );
|
277 |
+
|
278 |
+
if( $(this).hasClass( 'widgetopts-control-open' ) ){
|
279 |
+
self.closeChooser();
|
280 |
+
$( '.widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
281 |
+
}else{
|
282 |
+
|
283 |
+
chooser.find( '.widgetopts-chooser-action span' ).text( lbl );
|
284 |
+
chooser.find( '.widgetopts-chooser-action' ).attr( 'data-action', action );
|
285 |
+
$(this).parents('.widget-control-actions').find('.clear').after( chooser );
|
286 |
+
|
287 |
+
chooser.slideDown( 300, function() {
|
288 |
+
selectSidebar.find('.widgets-chooser-selected').focus();
|
289 |
+
});
|
290 |
+
$( '.widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
291 |
+
$(this).addClass( 'widgetopts-control-open' );
|
292 |
+
|
293 |
+
self.chooserSearch();
|
294 |
+
}
|
295 |
+
|
296 |
+
e.preventDefault();
|
297 |
+
} );
|
298 |
+
|
299 |
+
//add selected on click
|
300 |
+
$document.on( 'click', '.widgetopts-chooser-sidebars li', function(e){
|
301 |
+
selectSidebar.find('.widgetopts-chooser-selected').removeClass( 'widgetopts-chooser-selected' );
|
302 |
+
$(this).addClass( 'widgetopts-chooser-selected' );
|
303 |
+
} );
|
304 |
+
|
305 |
+
//do action
|
306 |
+
$document.on( 'click', '.widgetsopts-chooser .widgetopts-chooser-action', function(e){
|
307 |
+
var $container = $( 'html,body' ),
|
308 |
+
$action = $( this ).attr( 'data-action' ),
|
309 |
+
parentSidebar = $( this ).parents('.widgets-sortables').attr('id'),
|
310 |
+
widgetID = $( this ).parents('.widget').attr('id'),
|
311 |
+
$widget = $( '#'+ widgetID );
|
312 |
+
sidebarID = $( '.widgetopts-chooser-selected' ).attr('data-sidebarId');
|
313 |
+
// console.log( $action + ' ' + parentSidebar +' ' + widgetID + ' ' + sidebarID);
|
314 |
+
//remove chooser
|
315 |
+
$( '#'+ widgetID + ' .widgetsopts-chooser' ).remove();
|
316 |
+
$widget.find(' .widgetopts-control-open' ).removeClass( 'widgetopts-control-open' );
|
317 |
+
|
318 |
+
switch ( $action ) {
|
319 |
+
case 'move':
|
320 |
+
$( '#' + parentSidebar ).find( '#' + widgetID ).appendTo( '#' + sidebarID );
|
321 |
+
|
322 |
+
$('#' + sidebarID).sortable('refresh');
|
323 |
+
$widget.addClass( 'widgetopts-move-ds' );
|
324 |
+
$( '#' + sidebarID ).parent('.widgets-holder-wrap').removeClass( 'closed' );
|
325 |
+
wpWidgets.save( $( '#' + widgetID ), 0, 0, 1 );
|
326 |
+
break;
|
327 |
+
default:
|
328 |
+
break;
|
329 |
+
|
330 |
+
}
|
331 |
+
|
332 |
+
var $scrollTo = $( '.widgetopts-move-ds' );
|
333 |
+
|
334 |
+
$container.animate({ scrollTop: $scrollTo.offset().top - ( $container.offset().top + $container.scrollTop() + 60 ) }, 200 );
|
335 |
+
$( '.widgetopts-move-ds' ).removeClass( '.widgetopts-move-ds' );
|
336 |
+
e.preventDefault();
|
337 |
+
} );
|
338 |
+
|
339 |
+
//cancel chooser
|
340 |
+
$document.on( 'click', '.widgetsopts-chooser .widgetsopts-chooser-cancel', function(e){
|
341 |
+
self.closeChooser( chooser );
|
342 |
+
e.preventDefault();
|
343 |
+
} );
|
344 |
+
},
|
345 |
+
closeChooser : function( chooser ) {
|
346 |
+
var self = this;
|
347 |
+
|
348 |
+
$( '.widgetsopts-chooser' ).slideUp( 200, function() {
|
349 |
+
$( '.widgetopts-control' ).removeClass( 'widgetopts-control-open' );
|
350 |
+
$( '#wpbody-content' ).append( this );
|
351 |
+
});
|
352 |
+
},
|
353 |
+
chooserSearch : function(){
|
354 |
+
//add livefilter
|
355 |
+
if( $( '#widgetsopts-widgets-search' ).length > 0 ){
|
356 |
+
$('.widgetsopts-chooser').liveFilter('#widgetsopts-widgets-search', '.widgetopts-chooser-sidebars li', {
|
357 |
+
// filterChildSelector: 'li',
|
358 |
+
after: function( contains, containsNot ) {
|
359 |
+
//hide
|
360 |
+
containsNot.each(function() {
|
361 |
+
$(this).addClass( 'widgetopts-is-hidden' ).removeClass( 'widgetopts-chooser-selected' );
|
362 |
+
});
|
363 |
+
contains.each(function() {
|
364 |
+
$(this).removeClass( 'widgetopts-is-hidden' ).removeClass( 'widgetopts-chooser-selected' );
|
365 |
+
});
|
366 |
+
if( contains.length > 0 ){
|
367 |
+
$( contains[0] ).addClass( 'widgetopts-chooser-selected' );
|
368 |
+
}
|
369 |
+
|
370 |
+
}
|
371 |
+
});
|
372 |
+
}
|
373 |
+
},
|
374 |
+
sidebarOptions : function(){
|
375 |
+
var self = this;
|
376 |
+
if( widgetopts10n.sidebaropts.length > 0 ){
|
377 |
+
$( '#widgets-right .widgets-holder-wrap' ).each( function( index, element ) {
|
378 |
+
var sidebar_opts_h2 = $(this).find('.widgets-sortables h2').text();
|
379 |
+
dl_link = widgetopts10n.sidebaropts.replace( '__sidebaropts__', $(this).find('.widgets-sortables').attr('id') );
|
380 |
+
dl_link = dl_link.replace( '__sidebar_opts__', sidebar_opts_h2.trim() );
|
381 |
+
$(this).append( dl_link );
|
382 |
+
});
|
383 |
+
}
|
384 |
+
},
|
385 |
+
removeSidebarWidgets : function(){
|
386 |
+
var self = this;
|
387 |
+
var $container = $( 'html,body' );
|
388 |
+
$document.on( 'click', '.sidebaropts-clear', function(e){
|
389 |
+
//show confirmation
|
390 |
+
$(this).parent().find( '.sidebaropts-confirm' ).addClass( 'sidebaropts-confirmed' );
|
391 |
+
$(this).parent().find( '.sidebaropts-confirm' ).slideToggle(250);
|
392 |
+
|
393 |
+
e.preventDefault();
|
394 |
+
});
|
395 |
+
|
396 |
+
$document.on( 'click', '.sidebaropts-confirmed .button', function(e){
|
397 |
+
sidebar_id = $(this).parent().parent().parent().find('.widgets-sortables');
|
398 |
+
|
399 |
+
if( $(this).hasClass( 'button-primary' ) ){
|
400 |
+
var $scrollTo = sidebar_id;
|
401 |
+
|
402 |
+
$(this).parent().slideToggle(50);
|
403 |
+
$container.animate({ scrollTop: $scrollTo.offset().top - 50 }, 200 );
|
404 |
+
|
405 |
+
sidebar_id.find( '.widget' ).each( function( index, element ) {
|
406 |
+
$( element ).fadeOut();
|
407 |
+
wpWidgets.save( $( element ), 1, 1, 0 );
|
408 |
+
});
|
409 |
+
|
410 |
+
}else{
|
411 |
+
$(this).parent().slideToggle(250);
|
412 |
+
}
|
413 |
+
|
414 |
+
e.preventDefault();
|
415 |
+
});
|
416 |
+
}
|
417 |
+
};
|
418 |
+
|
419 |
+
$document.ready( function(){ wpWidgetOpts.init(); } );
|
420 |
+
|
421 |
+
})(jQuery);
|
assets/scss/widget-options.scss
CHANGED
@@ -1,68 +1,68 @@
|
|
1 |
-
@import 'compass';
|
2 |
-
$desktop : 769px;
|
3 |
-
$tablet : 768px;
|
4 |
-
$mobile : 736px;
|
5 |
-
body{
|
6 |
-
.extendedwopts-show{
|
7 |
-
display: none;
|
8 |
-
}
|
9 |
-
.widgetopts-hide_title{
|
10 |
-
.widget-title{
|
11 |
-
display: none;
|
12 |
-
}
|
13 |
-
}
|
14 |
-
|
15 |
-
//alignment
|
16 |
-
.extendedwopts-md-right{
|
17 |
-
text-align: right;
|
18 |
-
}
|
19 |
-
.extendedwopts-md-left{
|
20 |
-
text-align: left;
|
21 |
-
}
|
22 |
-
.extendedwopts-md-center{
|
23 |
-
text-align: center;
|
24 |
-
}
|
25 |
-
.extendedwopts-md-justify{
|
26 |
-
text-align: justify;
|
27 |
-
}
|
28 |
-
@media screen and (min-width: $desktop) {
|
29 |
-
.extendedwopts-hide.extendedwopts-desktop{
|
30 |
-
display: none !important;
|
31 |
-
}
|
32 |
-
.extendedwopts-show.extendedwopts-desktop{
|
33 |
-
display: block;
|
34 |
-
}
|
35 |
-
.widget.clearfix-desktop{
|
36 |
-
clear: both;
|
37 |
-
}
|
38 |
-
}
|
39 |
-
@media screen and (max-width: $tablet)
|
40 |
-
and (min-width: $mobile + 1) {
|
41 |
-
.extendedwopts-hide.extendedwopts-tablet{
|
42 |
-
display: none !important;
|
43 |
-
}
|
44 |
-
.extendedwopts-show.extendedwopts-tablet{
|
45 |
-
display: block;
|
46 |
-
}
|
47 |
-
.widget.clearfix-desktop{
|
48 |
-
clear: none;
|
49 |
-
}
|
50 |
-
.widget.clearfix-tablet{
|
51 |
-
clear: both;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
@media screen and (max-width: $mobile) {
|
55 |
-
.extendedwopts-hide.extendedwopts-mobile{
|
56 |
-
display: none !important;
|
57 |
-
}
|
58 |
-
.extendedwopts-show.extendedwopts-mobile{
|
59 |
-
display: block;
|
60 |
-
}
|
61 |
-
.widget.clearfix-desktop, .widget.clearfix-tablet{
|
62 |
-
clear: none;
|
63 |
-
}
|
64 |
-
.widget.clearfix-mobile{
|
65 |
-
clear: both;
|
66 |
-
}
|
67 |
-
}
|
68 |
-
}
|
1 |
+
@import 'compass';
|
2 |
+
$desktop : 769px;
|
3 |
+
$tablet : 768px;
|
4 |
+
$mobile : 736px;
|
5 |
+
body{
|
6 |
+
.extendedwopts-show{
|
7 |
+
display: none;
|
8 |
+
}
|
9 |
+
.widgetopts-hide_title{
|
10 |
+
.widget-title{
|
11 |
+
display: none;
|
12 |
+
}
|
13 |
+
}
|
14 |
+
|
15 |
+
//alignment
|
16 |
+
.extendedwopts-md-right{
|
17 |
+
text-align: right;
|
18 |
+
}
|
19 |
+
.extendedwopts-md-left{
|
20 |
+
text-align: left;
|
21 |
+
}
|
22 |
+
.extendedwopts-md-center{
|
23 |
+
text-align: center;
|
24 |
+
}
|
25 |
+
.extendedwopts-md-justify{
|
26 |
+
text-align: justify;
|
27 |
+
}
|
28 |
+
@media screen and (min-width: $desktop) {
|
29 |
+
.extendedwopts-hide.extendedwopts-desktop{
|
30 |
+
display: none !important;
|
31 |
+
}
|
32 |
+
.extendedwopts-show.extendedwopts-desktop{
|
33 |
+
display: block;
|
34 |
+
}
|
35 |
+
.widget.clearfix-desktop{
|
36 |
+
clear: both;
|
37 |
+
}
|
38 |
+
}
|
39 |
+
@media screen and (max-width: $tablet)
|
40 |
+
and (min-width: $mobile + 1) {
|
41 |
+
.extendedwopts-hide.extendedwopts-tablet{
|
42 |
+
display: none !important;
|
43 |
+
}
|
44 |
+
.extendedwopts-show.extendedwopts-tablet{
|
45 |
+
display: block;
|
46 |
+
}
|
47 |
+
.widget.clearfix-desktop{
|
48 |
+
clear: none;
|
49 |
+
}
|
50 |
+
.widget.clearfix-tablet{
|
51 |
+
clear: both;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
@media screen and (max-width: $mobile) {
|
55 |
+
.extendedwopts-hide.extendedwopts-mobile{
|
56 |
+
display: none !important;
|
57 |
+
}
|
58 |
+
.extendedwopts-show.extendedwopts-mobile{
|
59 |
+
display: block;
|
60 |
+
}
|
61 |
+
.widget.clearfix-desktop, .widget.clearfix-tablet{
|
62 |
+
clear: none;
|
63 |
+
}
|
64 |
+
.widget.clearfix-mobile{
|
65 |
+
clear: both;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
includes/admin/import-export.php
CHANGED
@@ -1,702 +1,702 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Widget Options Importer
|
4 |
-
*
|
5 |
-
* @category Widgets
|
6 |
-
* @author Jeffrey Carandang
|
7 |
-
* @version 1.0
|
8 |
-
*/
|
9 |
-
// Exit if accessed directly.
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
if ( ! class_exists( 'WP_Widget_Options_Importer' ) ) :
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Main WP_Widget_Options_Importer Class.
|
15 |
-
*
|
16 |
-
* @since 1.0
|
17 |
-
*/
|
18 |
-
class WP_Widget_Options_Importer {
|
19 |
-
|
20 |
-
protected $imported = array();
|
21 |
-
|
22 |
-
function __construct(){
|
23 |
-
global $widget_options;
|
24 |
-
if( ( isset( $widget_options['import_export'] ) && 'activate' == $widget_options['import_export'] ) ||
|
25 |
-
( isset( $widget_options['widget_area'] ) && 'activate' == $widget_options['widget_area'] )
|
26 |
-
){
|
27 |
-
add_action( 'admin_menu', array( &$this, 'options_page' ), 10 );
|
28 |
-
add_action( 'wp_ajax_widgetopts_migrator', array( &$this, 'ajax_migration' ) );
|
29 |
-
add_action( 'load-tools_page_widgetopts_migrator_settings', array( &$this, 'export_json_file' ) );
|
30 |
-
add_action( 'load-tools_page_widgetopts_migrator_settings', array( &$this, 'import_json_file' ) );
|
31 |
-
|
32 |
-
if( !isset( $widget_options['import_export'] ) || ( isset( $widget_options['import_export'] ) && 'activate' != $widget_options['import_export'] ) ){
|
33 |
-
add_action( 'admin_footer', array( &$this, 'admin_footer' ), 10 );
|
34 |
-
}
|
35 |
-
|
36 |
-
}
|
37 |
-
}
|
38 |
-
|
39 |
-
function options_page() {
|
40 |
-
add_management_page(
|
41 |
-
__( 'Import / Export Widgets', 'widget-options' ),
|
42 |
-
__( 'Import / Export Widgets', 'widget-options' ),
|
43 |
-
'manage_options',
|
44 |
-
'widgetopts_migrator_settings',
|
45 |
-
array( &$this, 'settings_page' )
|
46 |
-
);
|
47 |
-
}
|
48 |
-
|
49 |
-
function settings_page(){
|
50 |
-
$upgrade_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=importexport&utm_campaign=titlelink');
|
51 |
-
?>
|
52 |
-
<div class="wrap">
|
53 |
-
<h1>
|
54 |
-
<?php _e( 'Import or Export Widgets', 'widget-options' ); ?>
|
55 |
-
<a href="<?php echo esc_url( admin_url( 'options-general.php?page=widgetopts_plugin_settings' ) );?>" class="page-title-action"><?php _e( 'Manage Widget Options', 'widget-options' );?></a>
|
56 |
-
<a href="<?php echo esc_url( apply_filters( 'widget_options_upgrade_url', $upgrade_url ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Upgrade', 'widget-options' ); ?></a>
|
57 |
-
</h1>
|
58 |
-
<div class="widgetopts-imex">
|
59 |
-
<?php if( !empty( $this->imported ) ){
|
60 |
-
global $wp_registered_sidebars;
|
61 |
-
|
62 |
-
//move inactive widgets to bottom
|
63 |
-
if( isset( $this->imported['wp_inactive_widgets'] ) ){
|
64 |
-
$inactive = $this->imported['wp_inactive_widgets'];
|
65 |
-
unset( $this->imported['wp_inactive_widgets'] );
|
66 |
-
$this->imported['wp_inactive_widgets'] = $inactive;
|
67 |
-
} ?>
|
68 |
-
<div class="widgetopts-imex-imported-widgets widgetopts-imex-col">
|
69 |
-
<h3><?php _e( 'Widget Import Results', 'widget-options' ); ?></h3>
|
70 |
-
<p><?php
|
71 |
-
printf(
|
72 |
-
wp_kses(
|
73 |
-
__( 'Imported widgets displayed in their respective widget areas. Please take note that whenever the widget area is not available, the widget will be assigned automatically to Inactive Sidebar & Widgets for you to be able to still use them. To check and manage imported widgets go to <a href="%1$s">Appearance > Widgets</a>.', 'widget-options' ),
|
74 |
-
array(
|
75 |
-
'a' => array(
|
76 |
-
'href' => array(),
|
77 |
-
),
|
78 |
-
)
|
79 |
-
),
|
80 |
-
esc_url( admin_url( 'widgets.php' ) )
|
81 |
-
); ?></p>
|
82 |
-
<?php foreach ( $this->imported as $sidebar_id => $sidebar ) {
|
83 |
-
if( $sidebar_id == 'sidebars' ) continue;
|
84 |
-
if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) && $sidebar_id != 'wp_inactive_widgets' ){
|
85 |
-
continue;
|
86 |
-
}
|
87 |
-
if( isset( $sidebar['name'] ) ){
|
88 |
-
echo '<h4>'. $sidebar['name'] .'</h4>';
|
89 |
-
}
|
90 |
-
if( isset( $sidebar['widgets'] ) && !empty( $sidebar['widgets'] ) ){
|
91 |
-
echo '<ul>';
|
92 |
-
foreach ( $sidebar['widgets'] as $widget_id => $widget ) {
|
93 |
-
|
94 |
-
?>
|
95 |
-
|
96 |
-
<li class="widgetopts-imex-imported-<?php echo $widget['message_type'];?>">
|
97 |
-
<span class="dashicons dashicons-<?php echo $widget['message_type'];?>"></span>
|
98 |
-
<span class="widgetopts-imex-imported">
|
99 |
-
<?php echo ( isset( $widget['title'] ) ) ? $widget['title'] : '';?>
|
100 |
-
<span class="widgetopts-imex-wid"><?php echo $widget_id;?></span>
|
101 |
-
<span class="widgetopts-imex-msg"><?php echo $widget['message'];?></span>
|
102 |
-
</span>
|
103 |
-
</li>
|
104 |
-
|
105 |
-
<?php }
|
106 |
-
echo '</ul>';
|
107 |
-
}
|
108 |
-
} ?>
|
109 |
-
|
110 |
-
</div>
|
111 |
-
<?php } ?>
|
112 |
-
|
113 |
-
<div class="widgetopts-imex-col widgetopts-imex-col-1">
|
114 |
-
<h3><?php _e( 'Export Widgets', 'widget-options' ); ?></h3>
|
115 |
-
<p><?php _e( 'Click the button below to export all your website\'s widgets.', 'widget-options' ); ?></p>
|
116 |
-
<form action="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) ) ); ?>" method="GET">
|
117 |
-
<input type="hidden" name="page" value="<?php echo ( isset( $_GET['page'] ) ) ? sanitize_text_field( $_GET['page'] ) : 'widgetopts_migrator_settings';?>" />
|
118 |
-
<input type="hidden" name="action" value="export" />
|
119 |
-
<?php wp_nonce_field( 'widgeopts_export', 'widgeopts_nonce_export' ); ?>
|
120 |
-
<p>
|
121 |
-
<input type="checkbox" value="1" name="inactive" id="widgetopts-imex-ex" />
|
122 |
-
<label for="widgetopts-imex-ex"><?php _e( 'Check this option if you wish to include inactive widgets', 'widget-options' ); ?></label>
|
123 |
-
</p>
|
124 |
-
<input type="submit" class="button button-primary" value="<?php _e( 'Export Widgets', 'widget-options' ); ?>" />
|
125 |
-
</form>
|
126 |
-
|
127 |
-
</div>
|
128 |
-
|
129 |
-
|
130 |
-
<div class="widgetopts-imex-col">
|
131 |
-
<h3><?php _e( 'Import Widgets', 'widget-options' ); ?></h3>
|
132 |
-
<p><?php _e( 'Upload <strong>.json</strong> file that\'s generated by this plugin. Then manage the widgets to be imported.', 'widget-options' ); ?></p>
|
133 |
-
|
134 |
-
<form method="POST" enctype="multipart/form-data">
|
135 |
-
<input type="hidden" name="page" value="<?php echo ( isset( $_GET['page'] ) ) ? sanitize_text_field( $_GET['page'] ) : 'widgetopts_migrator_settings';?>" />
|
136 |
-
<input type="hidden" name="action" value="import" />
|
137 |
-
<?php wp_nonce_field( 'widgeopts_import', 'widgeopts_nonce_import' ); ?>
|
138 |
-
<p>
|
139 |
-
<input type="file" name="widgeopts_file" id="widgetopts-imex-file"/>
|
140 |
-
</p>
|
141 |
-
<input type="submit" class="button button-primary" value="<?php _e( 'Upload', 'widget-options' ); ?>" />
|
142 |
-
</form>
|
143 |
-
</div>
|
144 |
-
|
145 |
-
</div>
|
146 |
-
|
147 |
-
</div>
|
148 |
-
<style type="text/css">
|
149 |
-
.widgetopts-imex-col{
|
150 |
-
float: left;
|
151 |
-
width: 48%;
|
152 |
-
background: #fff;
|
153 |
-
border: 1px solid #e5e5e5;
|
154 |
-
padding: 25px;
|
155 |
-
box-sizing: border-box;
|
156 |
-
margin-top: 30px;
|
157 |
-
min-height: 250px;
|
158 |
-
}
|
159 |
-
.widgetopts-imex-col-1{
|
160 |
-
margin-right: 1.5%;
|
161 |
-
}
|
162 |
-
.widgetopts-imex-col.widgetopts-imex-imported-widgets{
|
163 |
-
width: 97.5%;
|
164 |
-
position: relative;
|
165 |
-
}
|
166 |
-
.widgetopts-imex-col h3{
|
167 |
-
margin-top: 0px;
|
168 |
-
}
|
169 |
-
.widgetopts-imex-col p{
|
170 |
-
margin-bottom: 25px;
|
171 |
-
}
|
172 |
-
.widgetopts-imex-col .button{
|
173 |
-
font-size: 14px;
|
174 |
-
padding: 5px 20px 30px;
|
175 |
-
}
|
176 |
-
.widgetopts-imex-imported-widgets li{
|
177 |
-
padding-bottom: 10px;
|
178 |
-
}
|
179 |
-
.widgetopts-imex-imported-widgets li .dashicons{
|
180 |
-
float: left;
|
181 |
-
font-size: 26px;
|
182 |
-
line-height: 40px;
|
183 |
-
height: 50px;
|
184 |
-
width: 31px;
|
185 |
-
}
|
186 |
-
.widgetopts-imex-imported-widgets .dashicons-no-alt{
|
187 |
-
color: #a53e3e;
|
188 |
-
}
|
189 |
-
.widgetopts-imex-imported-widgets .dashicons-warning{
|
190 |
-
color: #ec6c3b;
|
191 |
-
}
|
192 |
-
.widgetopts-imex-imported-widgets .dashicons-yes{
|
193 |
-
color: #46b450;
|
194 |
-
}
|
195 |
-
.widgetopts-imex-imported-widgets li .widgetopts-imex-wid,
|
196 |
-
.widgetopts-imex-imported-widgets li .widgetopts-imex-msg{
|
197 |
-
/* padding-left: 8px; */
|
198 |
-
font-size: 12px;
|
199 |
-
color: #999;
|
200 |
-
}
|
201 |
-
.widgetopts-imex-imported-widgets li.widgetopts-imex-imported-yes .widgetopts-imex-msg{
|
202 |
-
color: #46b450;
|
203 |
-
}
|
204 |
-
.widgetopts-imex-imported-widgets li .widgetopts-imex-msg{
|
205 |
-
display: block;
|
206 |
-
color: #a53e3e;
|
207 |
-
}
|
208 |
-
.widgetopts-imex-imported-widgets li label{
|
209 |
-
vertical-align: unset;
|
210 |
-
}
|
211 |
-
</style>
|
212 |
-
<?php }
|
213 |
-
|
214 |
-
function admin_footer(){ ?>
|
215 |
-
<script type="text/javascript">
|
216 |
-
jQuery( document ).ready( function(){
|
217 |
-
jQuery( '#adminmenu .menu-icon-tools a[href="tools.php?page=widgetopts_migrator_settings"]' ).hide();
|
218 |
-
} );
|
219 |
-
</script>
|
220 |
-
<?php }
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Generate export data
|
224 |
-
*
|
225 |
-
* @since 1.0
|
226 |
-
* @return string Export file contents
|
227 |
-
*/
|
228 |
-
function generate_export_data( $inactive = false , $single_sidebar = false ) {
|
229 |
-
|
230 |
-
global $wp_registered_widgets;
|
231 |
-
$checked = array();
|
232 |
-
$sidebars_dummy = array();
|
233 |
-
|
234 |
-
// Store all widgets in array
|
235 |
-
$widget_instances = $this->get_widget_instances();
|
236 |
-
|
237 |
-
// print_r( $this->get_available_widgets() );
|
238 |
-
|
239 |
-
// get all sidebar widgets
|
240 |
-
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
241 |
-
$sidebars_widget_instances = array();
|
242 |
-
|
243 |
-
if( $single_sidebar && isset( $sidebars_widgets[ $single_sidebar ] ) ){
|
244 |
-
$sidebars_dummy[ $single_sidebar ] = $sidebars_widgets[ $single_sidebar ];
|
245 |
-
|
246 |
-
//switch to single sidebar
|
247 |
-
$sidebars_widgets = $sidebars_dummy;
|
248 |
-
}
|
249 |
-
|
250 |
-
foreach ( $sidebars_widgets as $sidebar_id => $widgetids ) {
|
251 |
-
|
252 |
-
// Skip inactive widgets.
|
253 |
-
if ( !$inactive && 'wp_inactive_widgets' === $sidebar_id ) {
|
254 |
-
continue;
|
255 |
-
}
|
256 |
-
|
257 |
-
// Skip not array or empty data
|
258 |
-
if ( ! is_array( $widgetids ) || empty( $widgetids ) ) {
|
259 |
-
continue;
|
260 |
-
}
|
261 |
-
|
262 |
-
// Loop widget IDs for this sidebar.
|
263 |
-
foreach ( $widgetids as $widgetid ) {
|
264 |
-
|
265 |
-
// Is there an instance for this widget ID?
|
266 |
-
if ( isset( $widget_instances[ $widgetid ] ) ) {
|
267 |
-
|
268 |
-
// Add to array.
|
269 |
-
$sidebars_widget_instances[ $sidebar_id ][ $widgetid ] = $widget_instances[ $widgetid ];
|
270 |
-
|
271 |
-
}
|
272 |
-
|
273 |
-
}
|
274 |
-
|
275 |
-
}
|
276 |
-
|
277 |
-
$sidebars_widget_instances['widgetopts_exported'] = true;
|
278 |
-
|
279 |
-
$data = apply_filters( 'widgetopts_unencoded_export_data', $sidebars_widget_instances );
|
280 |
-
$encoded = wp_json_encode( $data );
|
281 |
-
|
282 |
-
return apply_filters( 'widgetopts_exported_data', $encoded );
|
283 |
-
}
|
284 |
-
|
285 |
-
/**
|
286 |
-
* Export .json file with widgets data
|
287 |
-
*/
|
288 |
-
function export_json_file() {
|
289 |
-
|
290 |
-
// Export requested.
|
291 |
-
if ( isset( $_GET['action'] ) && 'export' == sanitize_text_field( $_GET['action'] ) ) {
|
292 |
-
|
293 |
-
// Check referer before doing anything else.
|
294 |
-
check_admin_referer( 'widgeopts_export', 'widgeopts_nonce_export' );
|
295 |
-
|
296 |
-
$inactive = false;
|
297 |
-
$single_sidebar = false;
|
298 |
-
|
299 |
-
if( isset( $_GET['inactive'] ) && !empty( $_GET['inactive'] ) ){
|
300 |
-
$inactive = true;
|
301 |
-
}
|
302 |
-
|
303 |
-
if ( isset( $_GET['single_sidebar'] ) && !empty( $_GET['single_sidebar'] ) ) {
|
304 |
-
$single_sidebar = sanitize_text_field( $_GET['single_sidebar'] );
|
305 |
-
}
|
306 |
-
|
307 |
-
// Build filename similar with Widget Importer & Exporter Plugin but on json extension
|
308 |
-
// Single Site: yoursite.com-widgets.json
|
309 |
-
// Multisite: site.multisite.com-widgets.json or multisite.com-site-widgets.json.
|
310 |
-
$site_url = site_url( '', 'http' );
|
311 |
-
$site_url = trim( $site_url, '/\\' ); // Remove trailing slash.
|
312 |
-
$filename = str_replace( 'http://', '', $site_url ); // Remove http://.
|
313 |
-
$filename = str_replace( array( '/', '\\' ), '-', $filename ); // Replace slashes with - .
|
314 |
-
|
315 |
-
if( $single_sidebar ){
|
316 |
-
$filename .= '-' . $single_sidebar;
|
317 |
-
}
|
318 |
-
|
319 |
-
$filename .= '-widgets.json'; // Append.
|
320 |
-
$filename = apply_filters( 'widgetopts_exported_file', $filename );
|
321 |
-
|
322 |
-
|
323 |
-
$file_contents = $this->generate_export_data( $inactive, $single_sidebar );
|
324 |
-
$filesize = strlen( $file_contents );
|
325 |
-
|
326 |
-
// Headers to prompt "Save As".
|
327 |
-
header( 'Content-Type: application/octet-stream' );
|
328 |
-
header( 'Content-Disposition: attachment; filename=' . $filename );
|
329 |
-
header( 'Expires: 0' );
|
330 |
-
header( 'Cache-Control: must-revalidate' );
|
331 |
-
header( 'Pragma: public' );
|
332 |
-
header( 'Content-Length: ' . $filesize );
|
333 |
-
|
334 |
-
// Clear buffering just in case.
|
335 |
-
// @codingStandardsIgnoreLine
|
336 |
-
@ob_end_clean();
|
337 |
-
flush();
|
338 |
-
|
339 |
-
// Output file contents.
|
340 |
-
echo $file_contents;
|
341 |
-
|
342 |
-
// Stop execution.
|
343 |
-
exit;
|
344 |
-
|
345 |
-
}
|
346 |
-
|
347 |
-
}
|
348 |
-
|
349 |
-
/**
|
350 |
-
* Import .json file with widgets data
|
351 |
-
*/
|
352 |
-
function import_json_file() {
|
353 |
-
// Export requested.
|
354 |
-
if ( !empty( $_POST ) && isset( $_POST['action'] ) && 'import' == sanitize_text_field( $_POST['action'] ) && check_admin_referer( 'widgeopts_import', 'widgeopts_nonce_import' ) ) {
|
355 |
-
|
356 |
-
//allow .json upload
|
357 |
-
add_filter( 'wp_check_filetype_and_ext', array( &$this, 'disable_real_mime_check' ), 10 , 4 );
|
358 |
-
add_filter( 'upload_mimes', array( &$this, 'add_mime_types' ) );
|
359 |
-
|
360 |
-
$uploaded_file = $_FILES['widgeopts_file'];
|
361 |
-
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
362 |
-
|
363 |
-
if ( 'json' !== $wp_filetype['ext'] && ! wp_match_mime_types( 'json', $wp_filetype['type'] ) ) {
|
364 |
-
|
365 |
-
wp_die(
|
366 |
-
wp_kses(
|
367 |
-
__( 'Invalid File! Please upload Widget Options exported data.' . $wp_filetype['ext'], 'widget-options' ),
|
368 |
-
array(
|
369 |
-
'b' => array(),
|
370 |
-
)
|
371 |
-
),
|
372 |
-
'',
|
373 |
-
array(
|
374 |
-
'back_link' => true,
|
375 |
-
)
|
376 |
-
);
|
377 |
-
|
378 |
-
}
|
379 |
-
|
380 |
-
// Check and move file to uploads directory
|
381 |
-
$file_data = wp_handle_upload( $uploaded_file, array(
|
382 |
-
'test_form' => false,
|
383 |
-
) );
|
384 |
-
|
385 |
-
if ( isset( $file_data['error'] ) ) {
|
386 |
-
wp_die(
|
387 |
-
esc_html( $file_data['error'] ),
|
388 |
-
'',
|
389 |
-
array(
|
390 |
-
'back_link' => true,
|
391 |
-
)
|
392 |
-
);
|
393 |
-
}
|
394 |
-
|
395 |
-
// Check if file exists?
|
396 |
-
if ( ! file_exists( $file_data['file'] ) ) {
|
397 |
-
wp_die(
|
398 |
-
esc_html__( 'Import file could not be found. Please try again.', 'widget-options' ),
|
399 |
-
'',
|
400 |
-
array(
|
401 |
-
'back_link' => true,
|
402 |
-
)
|
403 |
-
);
|
404 |
-
}
|
405 |
-
|
406 |
-
// Get file contents and decode.
|
407 |
-
$data = implode( '', file( $file_data['file'] ) );
|
408 |
-
$data = json_decode( $data, true );
|
409 |
-
|
410 |
-
// Delete import file.
|
411 |
-
unlink( $file_data['file'] );
|
412 |
-
|
413 |
-
if ( !is_array( $data ) || !isset( $data['widgetopts_exported'] ) ) {
|
414 |
-
wp_die(
|
415 |
-
esc_html__( 'Imported file invalid and not generated by Widget Options Plugin.', 'widget-options' ),
|
416 |
-
'',
|
417 |
-
array(
|
418 |
-
'back_link' => true,
|
419 |
-
)
|
420 |
-
);
|
421 |
-
}
|
422 |
-
|
423 |
-
//assign to variable to be able to used on frontend
|
424 |
-
$this->imported = $this->organized_imported_data( $data );
|
425 |
-
}
|
426 |
-
}
|
427 |
-
|
428 |
-
/**
|
429 |
-
*
|
430 |
-
* Parse imported data and compares to existing widgets
|
431 |
-
*
|
432 |
-
*/
|
433 |
-
function organized_imported_data( $data ){
|
434 |
-
global $wp_registered_sidebars, $wp_registered_widgets;
|
435 |
-
|
436 |
-
//variables
|
437 |
-
$checked = array();
|
438 |
-
$inactive = false;
|
439 |
-
$supported_widgets = $this->supported_widgets();
|
440 |
-
|
441 |
-
//Add Inactive Widgets
|
442 |
-
$wpregistered_sidebars = $wp_registered_sidebars;
|
443 |
-
$wpregistered_sidebars['wp_inactive_widgets'] = array( 'name' => __( 'Inactive Sidebars & Widgets', 'widget-options' ), 'id' => 'wp_inactive_widgets' );
|
444 |
-
|
445 |
-
// Hook before import.
|
446 |
-
do_action( 'widgetopts_before_render_import' );
|
447 |
-
|
448 |
-
//create filter for developers
|
449 |
-
$data = apply_filters( 'widgetopts_imported_data', $data );
|
450 |
-
|
451 |
-
if( isset( $data['wp_inactive_widgets'] ) && !empty( $data['wp_inactive_widgets'] ) ){
|
452 |
-
$inactive = true;
|
453 |
-
}
|
454 |
-
|
455 |
-
$widget_instances = json_decode( $this->generate_export_data( $inactive ), true );
|
456 |
-
|
457 |
-
//remove placeholder
|
458 |
-
unset( $data['widgetopts_exported'] );
|
459 |
-
|
460 |
-
// Begin results.
|
461 |
-
$results = array();
|
462 |
-
|
463 |
-
// Loop imported data's sidebars.
|
464 |
-
foreach ( $data as $sidebar => $widgets ) {
|
465 |
-
|
466 |
-
// Check if sidebar is available on this site.
|
467 |
-
if ( isset( $wpregistered_sidebars[ $sidebar ] ) ) {
|
468 |
-
$is_sidebar_available = true;
|
469 |
-
$sidebar_id = $sidebar;
|
470 |
-
$sidebar_message_type = 'yes';
|
471 |
-
$sidebar_message = '';
|
472 |
-
} else {
|
473 |
-
//add to inactive if sidebar not available
|
474 |
-
$is_sidebar_available = false;
|
475 |
-
$sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
|
476 |
-
$sidebar_message_type = 'error';
|
477 |
-
$sidebar_message = esc_html__( 'Widget area does not exist in theme (using Inactive)', 'widget-options' );
|
478 |
-
}
|
479 |
-
|
480 |
-
// Result for sidebar
|
481 |
-
// Sidebar name if theme supports it; otherwise ID.
|
482 |
-
$results[ $sidebar ]['name'] = ! empty( $wpregistered_sidebars[ $sidebar ]['name'] ) ? $wpregistered_sidebars[ $sidebar ]['name'] : $sidebar;
|
483 |
-
$results[ $sidebar ]['message_type'] = $sidebar_message_type;
|
484 |
-
$results[ $sidebar ]['message'] = $sidebar_message;
|
485 |
-
$results[ $sidebar ]['widgets'] = array();
|
486 |
-
$results['sidebars'][ $sidebar ] = $results[ $sidebar ]['name'];
|
487 |
-
|
488 |
-
//Loop assigned widgets
|
489 |
-
foreach ( $widgets as $widget_id => $widget ) {
|
490 |
-
$fail = false;
|
491 |
-
|
492 |
-
// Get id_base (remove -# from end) and instance ID number.
|
493 |
-
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_id );
|
494 |
-
$instance_id_number = str_replace( $id_base . '-', '', $widget_id );
|
495 |
-
|
496 |
-
// Does site support this widget?
|
497 |
-
if ( ! $fail && ! isset( $supported_widgets[ $id_base ] ) ) {
|
498 |
-
$fail = true;
|
499 |
-
$widget_message_type = 'error';
|
500 |
-
$widget_message = esc_html__( 'Widget Type not available.', 'widget-options' ); // Explain why widget not imported.
|
501 |
-
}
|
502 |
-
|
503 |
-
//check if same widget already available
|
504 |
-
if ( ! $fail && isset( $widget_instances[ $sidebar ][ $widget_id ] ) ) {
|
505 |
-
//compare if same sidebar and widget id have same contents too
|
506 |
-
if( $widget === $widget_instances[ $sidebar ][ $widget_id ] ){
|
507 |
-
$fail = true;
|
508 |
-
$widget_message_type = 'no-alt';
|
509 |
-
$widget_message = esc_html__( 'Widget already exists', 'widget-options' );
|
510 |
-
}
|
511 |
-
}
|
512 |
-
|
513 |
-
//double check if values exists with different widget keys
|
514 |
-
if ( ! $fail && isset( $widget_instances[ $sidebar ] ) && is_array( $widget_instances[ $sidebar ] ) && in_array( $widget, $widget_instances[ $sidebar ] ) ) {
|
515 |
-
$in_array_key = array_search( $widget, $widget_instances[ $sidebar ] );
|
516 |
-
$in_array_id_base = preg_replace( '/-[0-9]+$/', '', $in_array_key );
|
517 |
-
|
518 |
-
if( $id_base == $in_array_id_base ){
|
519 |
-
$fail = true;
|
520 |
-
$widget_message_type = 'no-alt';
|
521 |
-
$widget_message = esc_html__( 'Widget already exists', 'widget-options' );
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
// No failure.
|
526 |
-
if ( ! $fail ) {
|
527 |
-
$get_widget_instances = get_option( 'widget_' . $id_base );
|
528 |
-
$get_widget_instances = ! empty( $get_widget_instances ) ? $get_widget_instances : array(
|
529 |
-
'_multiwidget' => 1,
|
530 |
-
);
|
531 |
-
|
532 |
-
// add widget values to instances - to update later
|
533 |
-
$get_widget_instances[] = $widget;
|
534 |
-
|
535 |
-
// Get the given key
|
536 |
-
end( $get_widget_instances );
|
537 |
-
$new_instance_number = key( $get_widget_instances );
|
538 |
-
|
539 |
-
// Change number to 1 when it's 0 to avoid issues
|
540 |
-
if ( '0' === strval( $new_instance_number ) ) {
|
541 |
-
$new_instance_number = 1;
|
542 |
-
$get_widget_instances[ $new_instance_number ] = $get_widget_instances[0];
|
543 |
-
unset( $get_widget_instances[0] );
|
544 |
-
}
|
545 |
-
|
546 |
-
// Change widget options key to the given id_base and number to work perfectly
|
547 |
-
if( isset( $get_widget_instances[ $new_instance_number ] ) && isset( $get_widget_instances[ $new_instance_number ]['extended_widget_opts'] ) ){
|
548 |
-
$get_widget_instances[ $new_instance_number ]['extended_widget_opts-' . $id_base . '-' . $new_instance_number] = $get_widget_instances[ $new_instance_number ]['extended_widget_opts'];
|
549 |
-
unset( $get_widget_instances[ $new_instance_number ]['extended_widget_opts'] );
|
550 |
-
}
|
551 |
-
|
552 |
-
// Move _multiwidget to the end
|
553 |
-
if ( isset( $get_widget_instances['_multiwidget'] ) ) {
|
554 |
-
$multiwidget = $get_widget_instances['_multiwidget'];
|
555 |
-
unset( $get_widget_instances['_multiwidget'] );
|
556 |
-
$get_widget_instances['_multiwidget'] = $multiwidget;
|
557 |
-
}
|
558 |
-
|
559 |
-
// Update option with new widget.
|
560 |
-
update_option( 'widget_' . $id_base, $get_widget_instances );
|
561 |
-
|
562 |
-
// Get sidebar widgets
|
563 |
-
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
564 |
-
|
565 |
-
// Avoid error when empty
|
566 |
-
if ( ! $sidebars_widgets ) {
|
567 |
-
$sidebars_widgets = array();
|
568 |
-
}
|
569 |
-
|
570 |
-
// Use ID number from new widget instance.
|
571 |
-
$new_instance_id = $id_base . '-' . $new_instance_number;
|
572 |
-
|
573 |
-
// Add new instance to sidebar.
|
574 |
-
$sidebars_widgets[ $sidebar ][] = $new_instance_id;
|
575 |
-
|
576 |
-
// Save new sidebar widgets options
|
577 |
-
update_option( 'sidebars_widgets', $sidebars_widgets );
|
578 |
-
|
579 |
-
// Success message.
|
580 |
-
if ( $is_sidebar_available ) {
|
581 |
-
$widget_message_type = 'yes';
|
582 |
-
$widget_message = esc_html__( 'Successfully Imported', 'widget-options' );
|
583 |
-
} else {
|
584 |
-
$widget_message_type = 'warning';
|
585 |
-
$widget_message = esc_html__( 'Sidebar Widget Area Not Available', 'widget-options' );
|
586 |
-
}
|
587 |
-
}
|
588 |
-
|
589 |
-
// Result for widget instance
|
590 |
-
$results[ $sidebar_id ]['widgets'][ $widget_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base;
|
591 |
-
$results[ $sidebar_id ]['widgets'][ $widget_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : esc_html__( 'No Title', 'widget-options' );
|
592 |
-
$results[ $sidebar_id ]['widgets'][ $widget_id ]['message_type'] = $widget_message_type;
|
593 |
-
$results[ $sidebar_id ]['widgets'][ $widget_id ]['message'] = $widget_message;
|
594 |
-
|
595 |
-
}
|
596 |
-
|
597 |
-
} //endforeach
|
598 |
-
|
599 |
-
// Hook after import.
|
600 |
-
do_action( 'widgetopts_after_render_import' );
|
601 |
-
|
602 |
-
// Return results.
|
603 |
-
return $this->imported = apply_filters( 'widgetopts_imported_results', $results );
|
604 |
-
|
605 |
-
}
|
606 |
-
|
607 |
-
function get_widget_instances(){
|
608 |
-
global $wp_registered_widgets;
|
609 |
-
$checked = array();
|
610 |
-
|
611 |
-
// Store all widgets in array
|
612 |
-
$widget_instances = array();
|
613 |
-
|
614 |
-
foreach ( $wp_registered_widgets as $widget ) {
|
615 |
-
$id_base = is_array( $widget['callback'] ) ? $widget['callback'][0]->id_base : '';
|
616 |
-
$opts = array();
|
617 |
-
if( !empty( $id_base ) ){
|
618 |
-
$instance = get_option( 'widget_' . $id_base );
|
619 |
-
}
|
620 |
-
|
621 |
-
$number = $widget['params'][0]['number'];
|
622 |
-
if ( ! isset( $instance[ $number ] ) ) {
|
623 |
-
continue;
|
624 |
-
}
|
625 |
-
|
626 |
-
$widget_id = $id_base . '-' . $number;
|
627 |
-
|
628 |
-
//bypass if widget id already checked
|
629 |
-
if ( isset( $checked[ $widget_id ] ) ) {
|
630 |
-
continue;
|
631 |
-
}
|
632 |
-
$checked[ $widget_id ] = '1';
|
633 |
-
$k = 'extended_widget_opts-'. $widget_id;
|
634 |
-
if( isset( $instance[ $number ][ $k ] ) ){
|
635 |
-
|
636 |
-
//unset id_base
|
637 |
-
if( isset( $instance[ $number ][ $k ]['id_base'] ) ){
|
638 |
-
unset( $instance[ $number ][ $k ]['id_base'] );
|
639 |
-
}
|
640 |
-
|
641 |
-
$instance[ $number ]['extended_widget_opts'] = $instance[ $number ][ $k ];
|
642 |
-
unset( $instance[ $number ][ $k ] );
|
643 |
-
}
|
644 |
-
$widget_instances[ $widget_id ] = $instance[ $number ];
|
645 |
-
}
|
646 |
-
|
647 |
-
return apply_filters( 'widgetopts_widget_instances', $widget_instances );
|
648 |
-
}
|
649 |
-
|
650 |
-
function supported_widgets() {
|
651 |
-
|
652 |
-
global $wp_registered_widget_controls;
|
653 |
-
|
654 |
-
$widget_controls = $wp_registered_widget_controls;
|
655 |
-
|
656 |
-
$available_widgets = array();
|
657 |
-
|
658 |
-
foreach ( $widget_controls as $widget ) {
|
659 |
-
|
660 |
-
// No duplicates.
|
661 |
-
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) {
|
662 |
-
$available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
|
663 |
-
$available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
|
664 |
-
}
|
665 |
-
|
666 |
-
}
|
667 |
-
|
668 |
-
return apply_filters( 'widgetopts_supported_widgets', $available_widgets );
|
669 |
-
|
670 |
-
}
|
671 |
-
|
672 |
-
/**
|
673 |
-
* Add mime type for upload
|
674 |
-
*
|
675 |
-
* Make sure the WordPress install will accept .json uploads.
|
676 |
-
*
|
677 |
-
*/
|
678 |
-
function add_mime_types( $mime_types ) {
|
679 |
-
|
680 |
-
$mime_types['json'] = 'application/json';
|
681 |
-
|
682 |
-
return $mime_types;
|
683 |
-
|
684 |
-
}
|
685 |
-
|
686 |
-
function disable_real_mime_check( $data, $file, $filename, $mimes ) {
|
687 |
-
$wp_version = get_bloginfo( 'version' );
|
688 |
-
|
689 |
-
if ( version_compare( $wp_version, '4.7', '<=' ) ) {
|
690 |
-
return $data;
|
691 |
-
}
|
692 |
-
$wp_filetype = wp_check_filetype( $filename, $mimes );
|
693 |
-
$ext = $wp_filetype['ext'];
|
694 |
-
$type = $wp_filetype['type'];
|
695 |
-
$proper_filename = $data['proper_filename'];
|
696 |
-
return compact( 'ext', 'type', 'proper_filename' );
|
697 |
-
}
|
698 |
-
}
|
699 |
-
|
700 |
-
new WP_Widget_Options_Importer();
|
701 |
-
|
702 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widget Options Importer
|
4 |
+
*
|
5 |
+
* @category Widgets
|
6 |
+
* @author Jeffrey Carandang
|
7 |
+
* @version 1.0
|
8 |
+
*/
|
9 |
+
// Exit if accessed directly.
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
if ( ! class_exists( 'WP_Widget_Options_Importer' ) ) :
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Main WP_Widget_Options_Importer Class.
|
15 |
+
*
|
16 |
+
* @since 1.0
|
17 |
+
*/
|
18 |
+
class WP_Widget_Options_Importer {
|
19 |
+
|
20 |
+
protected $imported = array();
|
21 |
+
|
22 |
+
function __construct(){
|
23 |
+
global $widget_options;
|
24 |
+
if( ( isset( $widget_options['import_export'] ) && 'activate' == $widget_options['import_export'] ) ||
|
25 |
+
( isset( $widget_options['widget_area'] ) && 'activate' == $widget_options['widget_area'] )
|
26 |
+
){
|
27 |
+
add_action( 'admin_menu', array( &$this, 'options_page' ), 10 );
|
28 |
+
add_action( 'wp_ajax_widgetopts_migrator', array( &$this, 'ajax_migration' ) );
|
29 |
+
add_action( 'load-tools_page_widgetopts_migrator_settings', array( &$this, 'export_json_file' ) );
|
30 |
+
add_action( 'load-tools_page_widgetopts_migrator_settings', array( &$this, 'import_json_file' ) );
|
31 |
+
|
32 |
+
if( !isset( $widget_options['import_export'] ) || ( isset( $widget_options['import_export'] ) && 'activate' != $widget_options['import_export'] ) ){
|
33 |
+
add_action( 'admin_footer', array( &$this, 'admin_footer' ), 10 );
|
34 |
+
}
|
35 |
+
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function options_page() {
|
40 |
+
add_management_page(
|
41 |
+
__( 'Import / Export Widgets', 'widget-options' ),
|
42 |
+
__( 'Import / Export Widgets', 'widget-options' ),
|
43 |
+
'manage_options',
|
44 |
+
'widgetopts_migrator_settings',
|
45 |
+
array( &$this, 'settings_page' )
|
46 |
+
);
|
47 |
+
}
|
48 |
+
|
49 |
+
function settings_page(){
|
50 |
+
$upgrade_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=importexport&utm_campaign=titlelink');
|
51 |
+
?>
|
52 |
+
<div class="wrap">
|
53 |
+
<h1>
|
54 |
+
<?php _e( 'Import or Export Widgets', 'widget-options' ); ?>
|
55 |
+
<a href="<?php echo esc_url( admin_url( 'options-general.php?page=widgetopts_plugin_settings' ) );?>" class="page-title-action"><?php _e( 'Manage Widget Options', 'widget-options' );?></a>
|
56 |
+
<a href="<?php echo esc_url( apply_filters( 'widget_options_upgrade_url', $upgrade_url ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Upgrade', 'widget-options' ); ?></a>
|
57 |
+
</h1>
|
58 |
+
<div class="widgetopts-imex">
|
59 |
+
<?php if( !empty( $this->imported ) ){
|
60 |
+
global $wp_registered_sidebars;
|
61 |
+
|
62 |
+
//move inactive widgets to bottom
|
63 |
+
if( isset( $this->imported['wp_inactive_widgets'] ) ){
|
64 |
+
$inactive = $this->imported['wp_inactive_widgets'];
|
65 |
+
unset( $this->imported['wp_inactive_widgets'] );
|
66 |
+
$this->imported['wp_inactive_widgets'] = $inactive;
|
67 |
+
} ?>
|
68 |
+
<div class="widgetopts-imex-imported-widgets widgetopts-imex-col">
|
69 |
+
<h3><?php _e( 'Widget Import Results', 'widget-options' ); ?></h3>
|
70 |
+
<p><?php
|
71 |
+
printf(
|
72 |
+
wp_kses(
|
73 |
+
__( 'Imported widgets displayed in their respective widget areas. Please take note that whenever the widget area is not available, the widget will be assigned automatically to Inactive Sidebar & Widgets for you to be able to still use them. To check and manage imported widgets go to <a href="%1$s">Appearance > Widgets</a>.', 'widget-options' ),
|
74 |
+
array(
|
75 |
+
'a' => array(
|
76 |
+
'href' => array(),
|
77 |
+
),
|
78 |
+
)
|
79 |
+
),
|
80 |
+
esc_url( admin_url( 'widgets.php' ) )
|
81 |
+
); ?></p>
|
82 |
+
<?php foreach ( $this->imported as $sidebar_id => $sidebar ) {
|
83 |
+
if( $sidebar_id == 'sidebars' ) continue;
|
84 |
+
if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) && $sidebar_id != 'wp_inactive_widgets' ){
|
85 |
+
continue;
|
86 |
+
}
|
87 |
+
if( isset( $sidebar['name'] ) ){
|
88 |
+
echo '<h4>'. $sidebar['name'] .'</h4>';
|
89 |
+
}
|
90 |
+
if( isset( $sidebar['widgets'] ) && !empty( $sidebar['widgets'] ) ){
|
91 |
+
echo '<ul>';
|
92 |
+
foreach ( $sidebar['widgets'] as $widget_id => $widget ) {
|
93 |
+
|
94 |
+
?>
|
95 |
+
|
96 |
+
<li class="widgetopts-imex-imported-<?php echo $widget['message_type'];?>">
|
97 |
+
<span class="dashicons dashicons-<?php echo $widget['message_type'];?>"></span>
|
98 |
+
<span class="widgetopts-imex-imported">
|
99 |
+
<?php echo ( isset( $widget['title'] ) ) ? $widget['title'] : '';?>
|
100 |
+
<span class="widgetopts-imex-wid"><?php echo $widget_id;?></span>
|
101 |
+
<span class="widgetopts-imex-msg"><?php echo $widget['message'];?></span>
|
102 |
+
</span>
|
103 |
+
</li>
|
104 |
+
|
105 |
+
<?php }
|
106 |
+
echo '</ul>';
|
107 |
+
}
|
108 |
+
} ?>
|
109 |
+
|
110 |
+
</div>
|
111 |
+
<?php } ?>
|
112 |
+
|
113 |
+
<div class="widgetopts-imex-col widgetopts-imex-col-1">
|
114 |
+
<h3><?php _e( 'Export Widgets', 'widget-options' ); ?></h3>
|
115 |
+
<p><?php _e( 'Click the button below to export all your website\'s widgets.', 'widget-options' ); ?></p>
|
116 |
+
<form action="<?php echo esc_url( admin_url( basename( $_SERVER['PHP_SELF'] ) ) ); ?>" method="GET">
|
117 |
+
<input type="hidden" name="page" value="<?php echo ( isset( $_GET['page'] ) ) ? sanitize_text_field( $_GET['page'] ) : 'widgetopts_migrator_settings';?>" />
|
118 |
+
<input type="hidden" name="action" value="export" />
|
119 |
+
<?php wp_nonce_field( 'widgeopts_export', 'widgeopts_nonce_export' ); ?>
|
120 |
+
<p>
|
121 |
+
<input type="checkbox" value="1" name="inactive" id="widgetopts-imex-ex" />
|
122 |
+
<label for="widgetopts-imex-ex"><?php _e( 'Check this option if you wish to include inactive widgets', 'widget-options' ); ?></label>
|
123 |
+
</p>
|
124 |
+
<input type="submit" class="button button-primary" value="<?php _e( 'Export Widgets', 'widget-options' ); ?>" />
|
125 |
+
</form>
|
126 |
+
|
127 |
+
</div>
|
128 |
+
|
129 |
+
|
130 |
+
<div class="widgetopts-imex-col">
|
131 |
+
<h3><?php _e( 'Import Widgets', 'widget-options' ); ?></h3>
|
132 |
+
<p><?php _e( 'Upload <strong>.json</strong> file that\'s generated by this plugin. Then manage the widgets to be imported.', 'widget-options' ); ?></p>
|
133 |
+
|
134 |
+
<form method="POST" enctype="multipart/form-data">
|
135 |
+
<input type="hidden" name="page" value="<?php echo ( isset( $_GET['page'] ) ) ? sanitize_text_field( $_GET['page'] ) : 'widgetopts_migrator_settings';?>" />
|
136 |
+
<input type="hidden" name="action" value="import" />
|
137 |
+
<?php wp_nonce_field( 'widgeopts_import', 'widgeopts_nonce_import' ); ?>
|
138 |
+
<p>
|
139 |
+
<input type="file" name="widgeopts_file" id="widgetopts-imex-file"/>
|
140 |
+
</p>
|
141 |
+
<input type="submit" class="button button-primary" value="<?php _e( 'Upload', 'widget-options' ); ?>" />
|
142 |
+
</form>
|
143 |
+
</div>
|
144 |
+
|
145 |
+
</div>
|
146 |
+
|
147 |
+
</div>
|
148 |
+
<style type="text/css">
|
149 |
+
.widgetopts-imex-col{
|
150 |
+
float: left;
|
151 |
+
width: 48%;
|
152 |
+
background: #fff;
|
153 |
+
border: 1px solid #e5e5e5;
|
154 |
+
padding: 25px;
|
155 |
+
box-sizing: border-box;
|
156 |
+
margin-top: 30px;
|
157 |
+
min-height: 250px;
|
158 |
+
}
|
159 |
+
.widgetopts-imex-col-1{
|
160 |
+
margin-right: 1.5%;
|
161 |
+
}
|
162 |
+
.widgetopts-imex-col.widgetopts-imex-imported-widgets{
|
163 |
+
width: 97.5%;
|
164 |
+
position: relative;
|
165 |
+
}
|
166 |
+
.widgetopts-imex-col h3{
|
167 |
+
margin-top: 0px;
|
168 |
+
}
|
169 |
+
.widgetopts-imex-col p{
|
170 |
+
margin-bottom: 25px;
|
171 |
+
}
|
172 |
+
.widgetopts-imex-col .button{
|
173 |
+
font-size: 14px;
|
174 |
+
padding: 5px 20px 30px;
|
175 |
+
}
|
176 |
+
.widgetopts-imex-imported-widgets li{
|
177 |
+
padding-bottom: 10px;
|
178 |
+
}
|
179 |
+
.widgetopts-imex-imported-widgets li .dashicons{
|
180 |
+
float: left;
|
181 |
+
font-size: 26px;
|
182 |
+
line-height: 40px;
|
183 |
+
height: 50px;
|
184 |
+
width: 31px;
|
185 |
+
}
|
186 |
+
.widgetopts-imex-imported-widgets .dashicons-no-alt{
|
187 |
+
color: #a53e3e;
|
188 |
+
}
|
189 |
+
.widgetopts-imex-imported-widgets .dashicons-warning{
|
190 |
+
color: #ec6c3b;
|
191 |
+
}
|
192 |
+
.widgetopts-imex-imported-widgets .dashicons-yes{
|
193 |
+
color: #46b450;
|
194 |
+
}
|
195 |
+
.widgetopts-imex-imported-widgets li .widgetopts-imex-wid,
|
196 |
+
.widgetopts-imex-imported-widgets li .widgetopts-imex-msg{
|
197 |
+
/* padding-left: 8px; */
|
198 |
+
font-size: 12px;
|
199 |
+
color: #999;
|
200 |
+
}
|
201 |
+
.widgetopts-imex-imported-widgets li.widgetopts-imex-imported-yes .widgetopts-imex-msg{
|
202 |
+
color: #46b450;
|
203 |
+
}
|
204 |
+
.widgetopts-imex-imported-widgets li .widgetopts-imex-msg{
|
205 |
+
display: block;
|
206 |
+
color: #a53e3e;
|
207 |
+
}
|
208 |
+
.widgetopts-imex-imported-widgets li label{
|
209 |
+
vertical-align: unset;
|
210 |
+
}
|
211 |
+
</style>
|
212 |
+
<?php }
|
213 |
+
|
214 |
+
function admin_footer(){ ?>
|
215 |
+
<script type="text/javascript">
|
216 |
+
jQuery( document ).ready( function(){
|
217 |
+
jQuery( '#adminmenu .menu-icon-tools a[href="tools.php?page=widgetopts_migrator_settings"]' ).hide();
|
218 |
+
} );
|
219 |
+
</script>
|
220 |
+
<?php }
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Generate export data
|
224 |
+
*
|
225 |
+
* @since 1.0
|
226 |
+
* @return string Export file contents
|
227 |
+
*/
|
228 |
+
function generate_export_data( $inactive = false , $single_sidebar = false ) {
|
229 |
+
|
230 |
+
global $wp_registered_widgets;
|
231 |
+
$checked = array();
|
232 |
+
$sidebars_dummy = array();
|
233 |
+
|
234 |
+
// Store all widgets in array
|
235 |
+
$widget_instances = $this->get_widget_instances();
|
236 |
+
|
237 |
+
// print_r( $this->get_available_widgets() );
|
238 |
+
|
239 |
+
// get all sidebar widgets
|
240 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
241 |
+
$sidebars_widget_instances = array();
|
242 |
+
|
243 |
+
if( $single_sidebar && isset( $sidebars_widgets[ $single_sidebar ] ) ){
|
244 |
+
$sidebars_dummy[ $single_sidebar ] = $sidebars_widgets[ $single_sidebar ];
|
245 |
+
|
246 |
+
//switch to single sidebar
|
247 |
+
$sidebars_widgets = $sidebars_dummy;
|
248 |
+
}
|
249 |
+
|
250 |
+
foreach ( $sidebars_widgets as $sidebar_id => $widgetids ) {
|
251 |
+
|
252 |
+
// Skip inactive widgets.
|
253 |
+
if ( !$inactive && 'wp_inactive_widgets' === $sidebar_id ) {
|
254 |
+
continue;
|
255 |
+
}
|
256 |
+
|
257 |
+
// Skip not array or empty data
|
258 |
+
if ( ! is_array( $widgetids ) || empty( $widgetids ) ) {
|
259 |
+
continue;
|
260 |
+
}
|
261 |
+
|
262 |
+
// Loop widget IDs for this sidebar.
|
263 |
+
foreach ( $widgetids as $widgetid ) {
|
264 |
+
|
265 |
+
// Is there an instance for this widget ID?
|
266 |
+
if ( isset( $widget_instances[ $widgetid ] ) ) {
|
267 |
+
|
268 |
+
// Add to array.
|
269 |
+
$sidebars_widget_instances[ $sidebar_id ][ $widgetid ] = $widget_instances[ $widgetid ];
|
270 |
+
|
271 |
+
}
|
272 |
+
|
273 |
+
}
|
274 |
+
|
275 |
+
}
|
276 |
+
|
277 |
+
$sidebars_widget_instances['widgetopts_exported'] = true;
|
278 |
+
|
279 |
+
$data = apply_filters( 'widgetopts_unencoded_export_data', $sidebars_widget_instances );
|
280 |
+
$encoded = wp_json_encode( $data );
|
281 |
+
|
282 |
+
return apply_filters( 'widgetopts_exported_data', $encoded );
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Export .json file with widgets data
|
287 |
+
*/
|
288 |
+
function export_json_file() {
|
289 |
+
|
290 |
+
// Export requested.
|
291 |
+
if ( isset( $_GET['action'] ) && 'export' == sanitize_text_field( $_GET['action'] ) ) {
|
292 |
+
|
293 |
+
// Check referer before doing anything else.
|
294 |
+
check_admin_referer( 'widgeopts_export', 'widgeopts_nonce_export' );
|
295 |
+
|
296 |
+
$inactive = false;
|
297 |
+
$single_sidebar = false;
|
298 |
+
|
299 |
+
if( isset( $_GET['inactive'] ) && !empty( $_GET['inactive'] ) ){
|
300 |
+
$inactive = true;
|
301 |
+
}
|
302 |
+
|
303 |
+
if ( isset( $_GET['single_sidebar'] ) && !empty( $_GET['single_sidebar'] ) ) {
|
304 |
+
$single_sidebar = sanitize_text_field( $_GET['single_sidebar'] );
|
305 |
+
}
|
306 |
+
|
307 |
+
// Build filename similar with Widget Importer & Exporter Plugin but on json extension
|
308 |
+
// Single Site: yoursite.com-widgets.json
|
309 |
+
// Multisite: site.multisite.com-widgets.json or multisite.com-site-widgets.json.
|
310 |
+
$site_url = site_url( '', 'http' );
|
311 |
+
$site_url = trim( $site_url, '/\\' ); // Remove trailing slash.
|
312 |
+
$filename = str_replace( 'http://', '', $site_url ); // Remove http://.
|
313 |
+
$filename = str_replace( array( '/', '\\' ), '-', $filename ); // Replace slashes with - .
|
314 |
+
|
315 |
+
if( $single_sidebar ){
|
316 |
+
$filename .= '-' . $single_sidebar;
|
317 |
+
}
|
318 |
+
|
319 |
+
$filename .= '-widgets.json'; // Append.
|
320 |
+
$filename = apply_filters( 'widgetopts_exported_file', $filename );
|
321 |
+
|
322 |
+
|
323 |
+
$file_contents = $this->generate_export_data( $inactive, $single_sidebar );
|
324 |
+
$filesize = strlen( $file_contents );
|
325 |
+
|
326 |
+
// Headers to prompt "Save As".
|
327 |
+
header( 'Content-Type: application/octet-stream' );
|
328 |
+
header( 'Content-Disposition: attachment; filename=' . $filename );
|
329 |
+
header( 'Expires: 0' );
|
330 |
+
header( 'Cache-Control: must-revalidate' );
|
331 |
+
header( 'Pragma: public' );
|
332 |
+
header( 'Content-Length: ' . $filesize );
|
333 |
+
|
334 |
+
// Clear buffering just in case.
|
335 |
+
// @codingStandardsIgnoreLine
|
336 |
+
@ob_end_clean();
|
337 |
+
flush();
|
338 |
+
|
339 |
+
// Output file contents.
|
340 |
+
echo $file_contents;
|
341 |
+
|
342 |
+
// Stop execution.
|
343 |
+
exit;
|
344 |
+
|
345 |
+
}
|
346 |
+
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* Import .json file with widgets data
|
351 |
+
*/
|
352 |
+
function import_json_file() {
|
353 |
+
// Export requested.
|
354 |
+
if ( !empty( $_POST ) && isset( $_POST['action'] ) && 'import' == sanitize_text_field( $_POST['action'] ) && check_admin_referer( 'widgeopts_import', 'widgeopts_nonce_import' ) ) {
|
355 |
+
|
356 |
+
//allow .json upload
|
357 |
+
add_filter( 'wp_check_filetype_and_ext', array( &$this, 'disable_real_mime_check' ), 10 , 4 );
|
358 |
+
add_filter( 'upload_mimes', array( &$this, 'add_mime_types' ) );
|
359 |
+
|
360 |
+
$uploaded_file = $_FILES['widgeopts_file'];
|
361 |
+
$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'], false );
|
362 |
+
|
363 |
+
if ( 'json' !== $wp_filetype['ext'] && ! wp_match_mime_types( 'json', $wp_filetype['type'] ) ) {
|
364 |
+
|
365 |
+
wp_die(
|
366 |
+
wp_kses(
|
367 |
+
__( 'Invalid File! Please upload Widget Options exported data.' . $wp_filetype['ext'], 'widget-options' ),
|
368 |
+
array(
|
369 |
+
'b' => array(),
|
370 |
+
)
|
371 |
+
),
|
372 |
+
'',
|
373 |
+
array(
|
374 |
+
'back_link' => true,
|
375 |
+
)
|
376 |
+
);
|
377 |
+
|
378 |
+
}
|
379 |
+
|
380 |
+
// Check and move file to uploads directory
|
381 |
+
$file_data = wp_handle_upload( $uploaded_file, array(
|
382 |
+
'test_form' => false,
|
383 |
+
) );
|
384 |
+
|
385 |
+
if ( isset( $file_data['error'] ) ) {
|
386 |
+
wp_die(
|
387 |
+
esc_html( $file_data['error'] ),
|
388 |
+
'',
|
389 |
+
array(
|
390 |
+
'back_link' => true,
|
391 |
+
)
|
392 |
+
);
|
393 |
+
}
|
394 |
+
|
395 |
+
// Check if file exists?
|
396 |
+
if ( ! file_exists( $file_data['file'] ) ) {
|
397 |
+
wp_die(
|
398 |
+
esc_html__( 'Import file could not be found. Please try again.', 'widget-options' ),
|
399 |
+
'',
|
400 |
+
array(
|
401 |
+
'back_link' => true,
|
402 |
+
)
|
403 |
+
);
|
404 |
+
}
|
405 |
+
|
406 |
+
// Get file contents and decode.
|
407 |
+
$data = implode( '', file( $file_data['file'] ) );
|
408 |
+
$data = json_decode( $data, true );
|
409 |
+
|
410 |
+
// Delete import file.
|
411 |
+
unlink( $file_data['file'] );
|
412 |
+
|
413 |
+
if ( !is_array( $data ) || !isset( $data['widgetopts_exported'] ) ) {
|
414 |
+
wp_die(
|
415 |
+
esc_html__( 'Imported file invalid and not generated by Widget Options Plugin.', 'widget-options' ),
|
416 |
+
'',
|
417 |
+
array(
|
418 |
+
'back_link' => true,
|
419 |
+
)
|
420 |
+
);
|
421 |
+
}
|
422 |
+
|
423 |
+
//assign to variable to be able to used on frontend
|
424 |
+
$this->imported = $this->organized_imported_data( $data );
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
*
|
430 |
+
* Parse imported data and compares to existing widgets
|
431 |
+
*
|
432 |
+
*/
|
433 |
+
function organized_imported_data( $data ){
|
434 |
+
global $wp_registered_sidebars, $wp_registered_widgets;
|
435 |
+
|
436 |
+
//variables
|
437 |
+
$checked = array();
|
438 |
+
$inactive = false;
|
439 |
+
$supported_widgets = $this->supported_widgets();
|
440 |
+
|
441 |
+
//Add Inactive Widgets
|
442 |
+
$wpregistered_sidebars = $wp_registered_sidebars;
|
443 |
+
$wpregistered_sidebars['wp_inactive_widgets'] = array( 'name' => __( 'Inactive Sidebars & Widgets', 'widget-options' ), 'id' => 'wp_inactive_widgets' );
|
444 |
+
|
445 |
+
// Hook before import.
|
446 |
+
do_action( 'widgetopts_before_render_import' );
|
447 |
+
|
448 |
+
//create filter for developers
|
449 |
+
$data = apply_filters( 'widgetopts_imported_data', $data );
|
450 |
+
|
451 |
+
if( isset( $data['wp_inactive_widgets'] ) && !empty( $data['wp_inactive_widgets'] ) ){
|
452 |
+
$inactive = true;
|
453 |
+
}
|
454 |
+
|
455 |
+
$widget_instances = json_decode( $this->generate_export_data( $inactive ), true );
|
456 |
+
|
457 |
+
//remove placeholder
|
458 |
+
unset( $data['widgetopts_exported'] );
|
459 |
+
|
460 |
+
// Begin results.
|
461 |
+
$results = array();
|
462 |
+
|
463 |
+
// Loop imported data's sidebars.
|
464 |
+
foreach ( $data as $sidebar => $widgets ) {
|
465 |
+
|
466 |
+
// Check if sidebar is available on this site.
|
467 |
+
if ( isset( $wpregistered_sidebars[ $sidebar ] ) ) {
|
468 |
+
$is_sidebar_available = true;
|
469 |
+
$sidebar_id = $sidebar;
|
470 |
+
$sidebar_message_type = 'yes';
|
471 |
+
$sidebar_message = '';
|
472 |
+
} else {
|
473 |
+
//add to inactive if sidebar not available
|
474 |
+
$is_sidebar_available = false;
|
475 |
+
$sidebar_id = 'wp_inactive_widgets'; // Add to inactive if sidebar does not exist in theme.
|
476 |
+
$sidebar_message_type = 'error';
|
477 |
+
$sidebar_message = esc_html__( 'Widget area does not exist in theme (using Inactive)', 'widget-options' );
|
478 |
+
}
|
479 |
+
|
480 |
+
// Result for sidebar
|
481 |
+
// Sidebar name if theme supports it; otherwise ID.
|
482 |
+
$results[ $sidebar ]['name'] = ! empty( $wpregistered_sidebars[ $sidebar ]['name'] ) ? $wpregistered_sidebars[ $sidebar ]['name'] : $sidebar;
|
483 |
+
$results[ $sidebar ]['message_type'] = $sidebar_message_type;
|
484 |
+
$results[ $sidebar ]['message'] = $sidebar_message;
|
485 |
+
$results[ $sidebar ]['widgets'] = array();
|
486 |
+
$results['sidebars'][ $sidebar ] = $results[ $sidebar ]['name'];
|
487 |
+
|
488 |
+
//Loop assigned widgets
|
489 |
+
foreach ( $widgets as $widget_id => $widget ) {
|
490 |
+
$fail = false;
|
491 |
+
|
492 |
+
// Get id_base (remove -# from end) and instance ID number.
|
493 |
+
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_id );
|
494 |
+
$instance_id_number = str_replace( $id_base . '-', '', $widget_id );
|
495 |
+
|
496 |
+
// Does site support this widget?
|
497 |
+
if ( ! $fail && ! isset( $supported_widgets[ $id_base ] ) ) {
|
498 |
+
$fail = true;
|
499 |
+
$widget_message_type = 'error';
|
500 |
+
$widget_message = esc_html__( 'Widget Type not available.', 'widget-options' ); // Explain why widget not imported.
|
501 |
+
}
|
502 |
+
|
503 |
+
//check if same widget already available
|
504 |
+
if ( ! $fail && isset( $widget_instances[ $sidebar ][ $widget_id ] ) ) {
|
505 |
+
//compare if same sidebar and widget id have same contents too
|
506 |
+
if( $widget === $widget_instances[ $sidebar ][ $widget_id ] ){
|
507 |
+
$fail = true;
|
508 |
+
$widget_message_type = 'no-alt';
|
509 |
+
$widget_message = esc_html__( 'Widget already exists', 'widget-options' );
|
510 |
+
}
|
511 |
+
}
|
512 |
+
|
513 |
+
//double check if values exists with different widget keys
|
514 |
+
if ( ! $fail && isset( $widget_instances[ $sidebar ] ) && is_array( $widget_instances[ $sidebar ] ) && in_array( $widget, $widget_instances[ $sidebar ] ) ) {
|
515 |
+
$in_array_key = array_search( $widget, $widget_instances[ $sidebar ] );
|
516 |
+
$in_array_id_base = preg_replace( '/-[0-9]+$/', '', $in_array_key );
|
517 |
+
|
518 |
+
if( $id_base == $in_array_id_base ){
|
519 |
+
$fail = true;
|
520 |
+
$widget_message_type = 'no-alt';
|
521 |
+
$widget_message = esc_html__( 'Widget already exists', 'widget-options' );
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
// No failure.
|
526 |
+
if ( ! $fail ) {
|
527 |
+
$get_widget_instances = get_option( 'widget_' . $id_base );
|
528 |
+
$get_widget_instances = ! empty( $get_widget_instances ) ? $get_widget_instances : array(
|
529 |
+
'_multiwidget' => 1,
|
530 |
+
);
|
531 |
+
|
532 |
+
// add widget values to instances - to update later
|
533 |
+
$get_widget_instances[] = $widget;
|
534 |
+
|
535 |
+
// Get the given key
|
536 |
+
end( $get_widget_instances );
|
537 |
+
$new_instance_number = key( $get_widget_instances );
|
538 |
+
|
539 |
+
// Change number to 1 when it's 0 to avoid issues
|
540 |
+
if ( '0' === strval( $new_instance_number ) ) {
|
541 |
+
$new_instance_number = 1;
|
542 |
+
$get_widget_instances[ $new_instance_number ] = $get_widget_instances[0];
|
543 |
+
unset( $get_widget_instances[0] );
|
544 |
+
}
|
545 |
+
|
546 |
+
// Change widget options key to the given id_base and number to work perfectly
|
547 |
+
if( isset( $get_widget_instances[ $new_instance_number ] ) && isset( $get_widget_instances[ $new_instance_number ]['extended_widget_opts'] ) ){
|
548 |
+
$get_widget_instances[ $new_instance_number ]['extended_widget_opts-' . $id_base . '-' . $new_instance_number] = $get_widget_instances[ $new_instance_number ]['extended_widget_opts'];
|
549 |
+
unset( $get_widget_instances[ $new_instance_number ]['extended_widget_opts'] );
|
550 |
+
}
|
551 |
+
|
552 |
+
// Move _multiwidget to the end
|
553 |
+
if ( isset( $get_widget_instances['_multiwidget'] ) ) {
|
554 |
+
$multiwidget = $get_widget_instances['_multiwidget'];
|
555 |
+
unset( $get_widget_instances['_multiwidget'] );
|
556 |
+
$get_widget_instances['_multiwidget'] = $multiwidget;
|
557 |
+
}
|
558 |
+
|
559 |
+
// Update option with new widget.
|
560 |
+
update_option( 'widget_' . $id_base, $get_widget_instances );
|
561 |
+
|
562 |
+
// Get sidebar widgets
|
563 |
+
$sidebars_widgets = get_option( 'sidebars_widgets' );
|
564 |
+
|
565 |
+
// Avoid error when empty
|
566 |
+
if ( ! $sidebars_widgets ) {
|
567 |
+
$sidebars_widgets = array();
|
568 |
+
}
|
569 |
+
|
570 |
+
// Use ID number from new widget instance.
|
571 |
+
$new_instance_id = $id_base . '-' . $new_instance_number;
|
572 |
+
|
573 |
+
// Add new instance to sidebar.
|
574 |
+
$sidebars_widgets[ $sidebar ][] = $new_instance_id;
|
575 |
+
|
576 |
+
// Save new sidebar widgets options
|
577 |
+
update_option( 'sidebars_widgets', $sidebars_widgets );
|
578 |
+
|
579 |
+
// Success message.
|
580 |
+
if ( $is_sidebar_available ) {
|
581 |
+
$widget_message_type = 'yes';
|
582 |
+
$widget_message = esc_html__( 'Successfully Imported', 'widget-options' );
|
583 |
+
} else {
|
584 |
+
$widget_message_type = 'warning';
|
585 |
+
$widget_message = esc_html__( 'Sidebar Widget Area Not Available', 'widget-options' );
|
586 |
+
}
|
587 |
+
}
|
588 |
+
|
589 |
+
// Result for widget instance
|
590 |
+
$results[ $sidebar_id ]['widgets'][ $widget_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base;
|
591 |
+
$results[ $sidebar_id ]['widgets'][ $widget_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : esc_html__( 'No Title', 'widget-options' );
|
592 |
+
$results[ $sidebar_id ]['widgets'][ $widget_id ]['message_type'] = $widget_message_type;
|
593 |
+
$results[ $sidebar_id ]['widgets'][ $widget_id ]['message'] = $widget_message;
|
594 |
+
|
595 |
+
}
|
596 |
+
|
597 |
+
} //endforeach
|
598 |
+
|
599 |
+
// Hook after import.
|
600 |
+
do_action( 'widgetopts_after_render_import' );
|
601 |
+
|
602 |
+
// Return results.
|
603 |
+
return $this->imported = apply_filters( 'widgetopts_imported_results', $results );
|
604 |
+
|
605 |
+
}
|
606 |
+
|
607 |
+
function get_widget_instances(){
|
608 |
+
global $wp_registered_widgets;
|
609 |
+
$checked = array();
|
610 |
+
|
611 |
+
// Store all widgets in array
|
612 |
+
$widget_instances = array();
|
613 |
+
|
614 |
+
foreach ( $wp_registered_widgets as $widget ) {
|
615 |
+
$id_base = is_array( $widget['callback'] ) ? $widget['callback'][0]->id_base : '';
|
616 |
+
$opts = array();
|
617 |
+
if( !empty( $id_base ) ){
|
618 |
+
$instance = get_option( 'widget_' . $id_base );
|
619 |
+
}
|
620 |
+
|
621 |
+
$number = $widget['params'][0]['number'];
|
622 |
+
if ( ! isset( $instance[ $number ] ) ) {
|
623 |
+
continue;
|
624 |
+
}
|
625 |
+
|
626 |
+
$widget_id = $id_base . '-' . $number;
|
627 |
+
|
628 |
+
//bypass if widget id already checked
|
629 |
+
if ( isset( $checked[ $widget_id ] ) ) {
|
630 |
+
continue;
|
631 |
+
}
|
632 |
+
$checked[ $widget_id ] = '1';
|
633 |
+
$k = 'extended_widget_opts-'. $widget_id;
|
634 |
+
if( isset( $instance[ $number ][ $k ] ) ){
|
635 |
+
|
636 |
+
//unset id_base
|
637 |
+
if( isset( $instance[ $number ][ $k ]['id_base'] ) ){
|
638 |
+
unset( $instance[ $number ][ $k ]['id_base'] );
|
639 |
+
}
|
640 |
+
|
641 |
+
$instance[ $number ]['extended_widget_opts'] = $instance[ $number ][ $k ];
|
642 |
+
unset( $instance[ $number ][ $k ] );
|
643 |
+
}
|
644 |
+
$widget_instances[ $widget_id ] = $instance[ $number ];
|
645 |
+
}
|
646 |
+
|
647 |
+
return apply_filters( 'widgetopts_widget_instances', $widget_instances );
|
648 |
+
}
|
649 |
+
|
650 |
+
function supported_widgets() {
|
651 |
+
|
652 |
+
global $wp_registered_widget_controls;
|
653 |
+
|
654 |
+
$widget_controls = $wp_registered_widget_controls;
|
655 |
+
|
656 |
+
$available_widgets = array();
|
657 |
+
|
658 |
+
foreach ( $widget_controls as $widget ) {
|
659 |
+
|
660 |
+
// No duplicates.
|
661 |
+
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) {
|
662 |
+
$available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
|
663 |
+
$available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
|
664 |
+
}
|
665 |
+
|
666 |
+
}
|
667 |
+
|
668 |
+
return apply_filters( 'widgetopts_supported_widgets', $available_widgets );
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
+
/**
|
673 |
+
* Add mime type for upload
|
674 |
+
*
|
675 |
+
* Make sure the WordPress install will accept .json uploads.
|
676 |
+
*
|
677 |
+
*/
|
678 |
+
function add_mime_types( $mime_types ) {
|
679 |
+
|
680 |
+
$mime_types['json'] = 'application/json';
|
681 |
+
|
682 |
+
return $mime_types;
|
683 |
+
|
684 |
+
}
|
685 |
+
|
686 |
+
function disable_real_mime_check( $data, $file, $filename, $mimes ) {
|
687 |
+
$wp_version = get_bloginfo( 'version' );
|
688 |
+
|
689 |
+
if ( version_compare( $wp_version, '4.7', '<=' ) ) {
|
690 |
+
return $data;
|
691 |
+
}
|
692 |
+
$wp_filetype = wp_check_filetype( $filename, $mimes );
|
693 |
+
$ext = $wp_filetype['ext'];
|
694 |
+
$type = $wp_filetype['type'];
|
695 |
+
$proper_filename = $data['proper_filename'];
|
696 |
+
return compact( 'ext', 'type', 'proper_filename' );
|
697 |
+
}
|
698 |
+
}
|
699 |
+
|
700 |
+
new WP_Widget_Options_Importer();
|
701 |
+
|
702 |
+
endif;
|
includes/admin/notices.php
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Handles additional widget tab options
|
4 |
-
* run on __construct function
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Admin Messages
|
13 |
-
* @return void
|
14 |
-
*/
|
15 |
-
if( !function_exists( 'widgetopts_admin_notices' ) ):
|
16 |
-
function widgetopts_admin_notices() {
|
17 |
-
if( !current_user_can( 'update_plugins' ) )
|
18 |
-
return;
|
19 |
-
|
20 |
-
//show rating notice to page that matters most
|
21 |
-
global $pagenow;
|
22 |
-
if( !in_array( $pagenow, array( 'widgets.php', 'options-general.php' ) ) ){
|
23 |
-
return;
|
24 |
-
}
|
25 |
-
|
26 |
-
if( $pagenow == 'options-general.php' && function_exists( 'get_current_screen' ) ){
|
27 |
-
$screen = get_current_screen();
|
28 |
-
if( isset( $screen->base ) && $screen->base != 'settings_page_widgetopts_plugin_settings' ){
|
29 |
-
return;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
|
33 |
-
$install_date = get_option( 'widgetopts_installDate' );
|
34 |
-
$saved = get_option( 'widgetopts_RatingDiv' );
|
35 |
-
$display_date = date( 'Y-m-d h:i:s' );
|
36 |
-
$datetime1 = new DateTime( $install_date );
|
37 |
-
$datetime2 = new DateTime( $display_date );
|
38 |
-
$diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' ) ) / (60*60*24));
|
39 |
-
if( 'yes' != $saved && $diff_intrval >= 7 ){
|
40 |
-
echo '<div class="widgetopts_notice updated" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
41 |
-
<p>Well done! You have been enjoying <strong>Widget Options</strong> for more than a week.
|
42 |
-
<br>
|
43 |
-
Do you love it? Are you over the moon? Will you give us a <a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;"><strong>5-star rating</strong></a> on WordPress?
|
44 |
-
</br>
|
45 |
-
Your review is essential to the Widget Options community and our ongoing succes.
|
46 |
-
<br><br>
|
47 |
-
Thank you so much! � Your Widget Options Team
|
48 |
-
<ul>
|
49 |
-
<li><a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">'. __( 'Definitely. Widget Options is the best!', 'widget-options' ) .'</a></li>
|
50 |
-
<li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="I already did" style="font-weight:bold;">'. __( 'Already done!', 'widget-options' ) .'</a></li>
|
51 |
-
<li><a href="https://widget-options.com/contact/" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">'. __( "I�m not convinced yet. Still thinking about it.", 'widget-options' ) .'</a></li>
|
52 |
-
<li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="No, not good enough" style="font-weight:bold;">'. __( "I don�t do ratings", 'widget-options' ) .'</a></li>
|
53 |
-
</ul>
|
54 |
-
</div>
|
55 |
-
<script>
|
56 |
-
jQuery( document ).ready(function( $ ) {
|
57 |
-
|
58 |
-
jQuery(\'.widgetopts_bHideRating\').click(function(){
|
59 |
-
var data={\'action\':\'widgetopts_hideRating\'}
|
60 |
-
jQuery.ajax({
|
61 |
-
|
62 |
-
url: "'. admin_url( 'admin-ajax.php' ) .'",
|
63 |
-
type: "post",
|
64 |
-
data: data,
|
65 |
-
dataType: "json",
|
66 |
-
async: !0,
|
67 |
-
success: function(e) {
|
68 |
-
if (e=="success") {
|
69 |
-
jQuery(\'.widgetopts_notice\').slideUp(\'slow\');
|
70 |
-
|
71 |
-
}
|
72 |
-
}
|
73 |
-
});
|
74 |
-
})
|
75 |
-
|
76 |
-
});
|
77 |
-
</script>
|
78 |
-
';
|
79 |
-
}
|
80 |
-
}
|
81 |
-
add_action( 'admin_notices', 'widgetopts_admin_notices' );
|
82 |
-
endif;
|
83 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles additional widget tab options
|
4 |
+
* run on __construct function
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
9 |
+
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Admin Messages
|
13 |
+
* @return void
|
14 |
+
*/
|
15 |
+
if( !function_exists( 'widgetopts_admin_notices' ) ):
|
16 |
+
function widgetopts_admin_notices() {
|
17 |
+
if( !current_user_can( 'update_plugins' ) )
|
18 |
+
return;
|
19 |
+
|
20 |
+
//show rating notice to page that matters most
|
21 |
+
global $pagenow;
|
22 |
+
if( !in_array( $pagenow, array( 'widgets.php', 'options-general.php' ) ) ){
|
23 |
+
return;
|
24 |
+
}
|
25 |
+
|
26 |
+
if( $pagenow == 'options-general.php' && function_exists( 'get_current_screen' ) ){
|
27 |
+
$screen = get_current_screen();
|
28 |
+
if( isset( $screen->base ) && $screen->base != 'settings_page_widgetopts_plugin_settings' ){
|
29 |
+
return;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
$install_date = get_option( 'widgetopts_installDate' );
|
34 |
+
$saved = get_option( 'widgetopts_RatingDiv' );
|
35 |
+
$display_date = date( 'Y-m-d h:i:s' );
|
36 |
+
$datetime1 = new DateTime( $install_date );
|
37 |
+
$datetime2 = new DateTime( $display_date );
|
38 |
+
$diff_intrval = round( ($datetime2->format( 'U' ) - $datetime1->format( 'U' ) ) / (60*60*24));
|
39 |
+
if( 'yes' != $saved && $diff_intrval >= 7 ){
|
40 |
+
echo '<div class="widgetopts_notice updated" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
41 |
+
<p>Well done! You have been enjoying <strong>Widget Options</strong> for more than a week.
|
42 |
+
<br>
|
43 |
+
Do you love it? Are you over the moon? Will you give us a <a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;"><strong>5-star rating</strong></a> on WordPress?
|
44 |
+
</br>
|
45 |
+
Your review is essential to the Widget Options community and our ongoing succes.
|
46 |
+
<br><br>
|
47 |
+
Thank you so much! � Your Widget Options Team
|
48 |
+
<ul>
|
49 |
+
<li><a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">'. __( 'Definitely. Widget Options is the best!', 'widget-options' ) .'</a></li>
|
50 |
+
<li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="I already did" style="font-weight:bold;">'. __( 'Already done!', 'widget-options' ) .'</a></li>
|
51 |
+
<li><a href="https://widget-options.com/contact/" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">'. __( "I�m not convinced yet. Still thinking about it.", 'widget-options' ) .'</a></li>
|
52 |
+
<li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="No, not good enough" style="font-weight:bold;">'. __( "I don�t do ratings", 'widget-options' ) .'</a></li>
|
53 |
+
</ul>
|
54 |
+
</div>
|
55 |
+
<script>
|
56 |
+
jQuery( document ).ready(function( $ ) {
|
57 |
+
|
58 |
+
jQuery(\'.widgetopts_bHideRating\').click(function(){
|
59 |
+
var data={\'action\':\'widgetopts_hideRating\'}
|
60 |
+
jQuery.ajax({
|
61 |
+
|
62 |
+
url: "'. admin_url( 'admin-ajax.php' ) .'",
|
63 |
+
type: "post",
|
64 |
+
data: data,
|
65 |
+
dataType: "json",
|
66 |
+
async: !0,
|
67 |
+
success: function(e) {
|
68 |
+
if (e=="success") {
|
69 |
+
jQuery(\'.widgetopts_notice\').slideUp(\'slow\');
|
70 |
+
|
71 |
+
}
|
72 |
+
}
|
73 |
+
});
|
74 |
+
})
|
75 |
+
|
76 |
+
});
|
77 |
+
</script>
|
78 |
+
';
|
79 |
+
}
|
80 |
+
}
|
81 |
+
add_action( 'admin_notices', 'widgetopts_admin_notices' );
|
82 |
+
endif;
|
83 |
+
?>
|
includes/admin/settings/display-settings.php
CHANGED
@@ -1,121 +1,121 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Admin Options Page
|
4 |
-
* Settings > Widget Options
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 4.1
|
8 |
-
*/
|
9 |
-
// Exit if accessed directly
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Creates the admin submenu pages under the Settings menu and assigns their
|
14 |
-
*
|
15 |
-
* @since 1.0
|
16 |
-
* @return void
|
17 |
-
*/
|
18 |
-
if( !function_exists( 'widgetopts_add_options_link' ) ):
|
19 |
-
function widgetopts_add_options_link() {
|
20 |
-
add_options_page(
|
21 |
-
__( 'Widget Options', 'widget-options' ),
|
22 |
-
__( 'Widget Options', 'widget-options' ),
|
23 |
-
'manage_options',
|
24 |
-
'widgetopts_plugin_settings',
|
25 |
-
'widgetopts_options_page'
|
26 |
-
);
|
27 |
-
}
|
28 |
-
add_action( 'admin_menu', 'widgetopts_add_options_link', 10 );
|
29 |
-
endif;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Options Page
|
33 |
-
*
|
34 |
-
* Renders the options page contents.
|
35 |
-
*
|
36 |
-
* @since 1.0
|
37 |
-
* @return void
|
38 |
-
*/
|
39 |
-
if( !function_exists( 'widgetopts_options_page' ) ):
|
40 |
-
function widgetopts_options_page(){
|
41 |
-
$view = 'grid'; //define so that we can add more views later on
|
42 |
-
$upgrade_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsproupgrade');
|
43 |
-
?>
|
44 |
-
<div class="wrap">
|
45 |
-
<h1>
|
46 |
-
<?php _e( 'Widget Options', 'widget-options' ); ?>
|
47 |
-
<a href="<?php echo esc_url( apply_filters( 'widget_options_support_url', 'https://wordpress.org/support/plugin/widget-options/' ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Support', 'widget-options' ); ?></a>
|
48 |
-
<a href="<?php echo esc_url( apply_filters( 'widget_options_upgrade_url', $upgrade_url ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Upgrade', 'widget-options' ); ?></a>
|
49 |
-
</h1>
|
50 |
-
|
51 |
-
<div id="widgetopts-settings-messages-container"></div>
|
52 |
-
<div class="widgetopts-settings-desc">
|
53 |
-
<?php _e( 'Enable or disable any widget options tabs using this option. Some features has settings configuration that you can take advantage of to get the most out of Extended Widget Options on fully managing your widgets.', 'widget-options' );?>
|
54 |
-
</div>
|
55 |
-
<div class="widgetopts-badge widgetopts-badge-settings">
|
56 |
-
<span class="widgetopts-mascot"></span>
|
57 |
-
</div>
|
58 |
-
|
59 |
-
<div id="poststuff" class="widgetopts-poststuff">
|
60 |
-
<div id="post-body" class="metabox-holder columns-2 hide-if-no-js">
|
61 |
-
<div id="postbox-container-2" class="postbox-container">
|
62 |
-
|
63 |
-
<div class="widgetopts-module-cards-container <?php echo $view; ?> hide-if-no-js">
|
64 |
-
<form enctype="multipart/form-data" method="post" action="/wp-admin/admin.php?page=widgetopts_plugin_settings" id="widgetopts-module-settings-form">
|
65 |
-
<ul class="widgetopts-module-cards">
|
66 |
-
<?php echo do_action( 'widgetopts_module_cards' );?>
|
67 |
-
</ul>
|
68 |
-
</form>
|
69 |
-
</div>
|
70 |
-
<div class="widgetopts-modal-background"></div>
|
71 |
-
</div>
|
72 |
-
|
73 |
-
<div id="postbox-container-1" class="postbox-container">
|
74 |
-
<?php echo do_action( 'widgetopts_module_sidebar' );?>
|
75 |
-
</div>
|
76 |
-
|
77 |
-
</div>
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
<?php
|
81 |
-
}
|
82 |
-
endif;
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Modal Wrapper
|
86 |
-
*
|
87 |
-
* Create callable modal wrappers to avoid writing same code again
|
88 |
-
*
|
89 |
-
* @since 4.0
|
90 |
-
* @return void
|
91 |
-
*/
|
92 |
-
if( !function_exists( 'widgetopts_modal_start' ) ):
|
93 |
-
function widgetopts_modal_start( $option = null ){ ?>
|
94 |
-
<div class="widgetopts-module-settings-container">
|
95 |
-
<div class="widgetopts-modal-navigation">
|
96 |
-
<button class="dashicons widgetopts-close-modal"></button>
|
97 |
-
</div>
|
98 |
-
<div class="widgetopts-module-settings-content-container">
|
99 |
-
<div class="widgetopts-module-settings-content">
|
100 |
-
<?php }
|
101 |
-
endif;
|
102 |
-
|
103 |
-
if( !function_exists( 'widgetopts_modal_end' ) ):
|
104 |
-
function widgetopts_modal_end( $option = null ){ ?>
|
105 |
-
</div>
|
106 |
-
</div>
|
107 |
-
<div class="widgetopts-list-content-footer hide-if-no-js">
|
108 |
-
<button class="button button-primary align-left widgetopts-module-settings-save"><?php _e( 'Save Settings', 'widget-options' );?></button>
|
109 |
-
<button class="button button-secondary align-left widgetopts-module-settings-cancel"><?php _e( 'Cancel', 'widget-options' );?></button>
|
110 |
-
</div>
|
111 |
-
<div class="widgetopts-modal-content-footer">
|
112 |
-
<?php if( $option == 'activate' ){ ?>
|
113 |
-
<button class="button button-secondary align-right widgetopts-toggle-activation"><?php _e( 'Disable', 'widget-options' );?></button>
|
114 |
-
<?php }else{ ?>
|
115 |
-
<button class="button button-primary align-right widgetopts-toggle-activation"><?php _e( 'Enable', 'widget-options' );?></button>
|
116 |
-
<?php } ?>
|
117 |
-
<button class="button button-primary align-left widgetopts-module-settings-save"><?php _e( 'Save Settings', 'widget-options' );?></button>
|
118 |
-
</div>
|
119 |
-
</div>
|
120 |
-
<?php }
|
121 |
-
endif; ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Admin Options Page
|
4 |
+
* Settings > Widget Options
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 4.1
|
8 |
+
*/
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Creates the admin submenu pages under the Settings menu and assigns their
|
14 |
+
*
|
15 |
+
* @since 1.0
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
if( !function_exists( 'widgetopts_add_options_link' ) ):
|
19 |
+
function widgetopts_add_options_link() {
|
20 |
+
add_options_page(
|
21 |
+
__( 'Widget Options', 'widget-options' ),
|
22 |
+
__( 'Widget Options', 'widget-options' ),
|
23 |
+
'manage_options',
|
24 |
+
'widgetopts_plugin_settings',
|
25 |
+
'widgetopts_options_page'
|
26 |
+
);
|
27 |
+
}
|
28 |
+
add_action( 'admin_menu', 'widgetopts_add_options_link', 10 );
|
29 |
+
endif;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Options Page
|
33 |
+
*
|
34 |
+
* Renders the options page contents.
|
35 |
+
*
|
36 |
+
* @since 1.0
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
if( !function_exists( 'widgetopts_options_page' ) ):
|
40 |
+
function widgetopts_options_page(){
|
41 |
+
$view = 'grid'; //define so that we can add more views later on
|
42 |
+
$upgrade_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsproupgrade');
|
43 |
+
?>
|
44 |
+
<div class="wrap">
|
45 |
+
<h1>
|
46 |
+
<?php _e( 'Widget Options', 'widget-options' ); ?>
|
47 |
+
<a href="<?php echo esc_url( apply_filters( 'widget_options_support_url', 'https://wordpress.org/support/plugin/widget-options/' ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Support', 'widget-options' ); ?></a>
|
48 |
+
<a href="<?php echo esc_url( apply_filters( 'widget_options_upgrade_url', $upgrade_url ) ); ?>" target="_blank" class="page-title-action"><?php _e( 'Upgrade', 'widget-options' ); ?></a>
|
49 |
+
</h1>
|
50 |
+
|
51 |
+
<div id="widgetopts-settings-messages-container"></div>
|
52 |
+
<div class="widgetopts-settings-desc">
|
53 |
+
<?php _e( 'Enable or disable any widget options tabs using this option. Some features has settings configuration that you can take advantage of to get the most out of Extended Widget Options on fully managing your widgets.', 'widget-options' );?>
|
54 |
+
</div>
|
55 |
+
<div class="widgetopts-badge widgetopts-badge-settings">
|
56 |
+
<span class="widgetopts-mascot"></span>
|
57 |
+
</div>
|
58 |
+
|
59 |
+
<div id="poststuff" class="widgetopts-poststuff">
|
60 |
+
<div id="post-body" class="metabox-holder columns-2 hide-if-no-js">
|
61 |
+
<div id="postbox-container-2" class="postbox-container">
|
62 |
+
|
63 |
+
<div class="widgetopts-module-cards-container <?php echo $view; ?> hide-if-no-js">
|
64 |
+
<form enctype="multipart/form-data" method="post" action="/wp-admin/admin.php?page=widgetopts_plugin_settings" id="widgetopts-module-settings-form">
|
65 |
+
<ul class="widgetopts-module-cards">
|
66 |
+
<?php echo do_action( 'widgetopts_module_cards' );?>
|
67 |
+
</ul>
|
68 |
+
</form>
|
69 |
+
</div>
|
70 |
+
<div class="widgetopts-modal-background"></div>
|
71 |
+
</div>
|
72 |
+
|
73 |
+
<div id="postbox-container-1" class="postbox-container">
|
74 |
+
<?php echo do_action( 'widgetopts_module_sidebar' );?>
|
75 |
+
</div>
|
76 |
+
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<?php
|
81 |
+
}
|
82 |
+
endif;
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Modal Wrapper
|
86 |
+
*
|
87 |
+
* Create callable modal wrappers to avoid writing same code again
|
88 |
+
*
|
89 |
+
* @since 4.0
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
+
if( !function_exists( 'widgetopts_modal_start' ) ):
|
93 |
+
function widgetopts_modal_start( $option = null ){ ?>
|
94 |
+
<div class="widgetopts-module-settings-container">
|
95 |
+
<div class="widgetopts-modal-navigation">
|
96 |
+
<button class="dashicons widgetopts-close-modal"></button>
|
97 |
+
</div>
|
98 |
+
<div class="widgetopts-module-settings-content-container">
|
99 |
+
<div class="widgetopts-module-settings-content">
|
100 |
+
<?php }
|
101 |
+
endif;
|
102 |
+
|
103 |
+
if( !function_exists( 'widgetopts_modal_end' ) ):
|
104 |
+
function widgetopts_modal_end( $option = null ){ ?>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
<div class="widgetopts-list-content-footer hide-if-no-js">
|
108 |
+
<button class="button button-primary align-left widgetopts-module-settings-save"><?php _e( 'Save Settings', 'widget-options' );?></button>
|
109 |
+
<button class="button button-secondary align-left widgetopts-module-settings-cancel"><?php _e( 'Cancel', 'widget-options' );?></button>
|
110 |
+
</div>
|
111 |
+
<div class="widgetopts-modal-content-footer">
|
112 |
+
<?php if( $option == 'activate' ){ ?>
|
113 |
+
<button class="button button-secondary align-right widgetopts-toggle-activation"><?php _e( 'Disable', 'widget-options' );?></button>
|
114 |
+
<?php }else{ ?>
|
115 |
+
<button class="button button-primary align-right widgetopts-toggle-activation"><?php _e( 'Enable', 'widget-options' );?></button>
|
116 |
+
<?php } ?>
|
117 |
+
<button class="button button-primary align-left widgetopts-module-settings-save"><?php _e( 'Save Settings', 'widget-options' );?></button>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
<?php }
|
121 |
+
endif; ?>
|
includes/admin/settings/modules/animation.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Animations Settings Module
|
4 |
-
* Settings > Widget Options :: Animation
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Animation Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_animation' ) ):
|
20 |
-
function widgetopts_settings_animation(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="animation">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widget-animations/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Animation', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Add CSS animation effect to your widgets on page load or page scroll.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_animation', 130 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Animations Settings Module
|
4 |
+
* Settings > Widget Options :: Animation
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Animation Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_animation' ) ):
|
20 |
+
function widgetopts_settings_animation(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="animation">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widget-animations/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Animation', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Add CSS animation effect to your widgets on page load or page scroll.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_animation', 130 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/cache.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Widget Caching Settings Module
|
4 |
-
* Settings > Widget Options :: Cache
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 3.2
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Fixed Widget Options
|
15 |
-
*
|
16 |
-
* @since 3.2
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_cache' ) ):
|
20 |
-
function widgetopts_settings_cache(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="cache">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widget-cache/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Widget Cache', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Improve loading and performance by caching widget output using Transient API.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_cache', 175 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widget Caching Settings Module
|
4 |
+
* Settings > Widget Options :: Cache
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 3.2
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Fixed Widget Options
|
15 |
+
*
|
16 |
+
* @since 3.2
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_cache' ) ):
|
20 |
+
function widgetopts_settings_cache(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="cache">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widget-cache/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Widget Cache', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Improve loading and performance by caching widget output using Transient API.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_cache', 175 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/clone.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Clone Widgets Settings Module
|
4 |
-
* Settings > Widget Options :: Clone Widget
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 3.4
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Clone Widgets
|
15 |
-
*
|
16 |
-
* @since 3.4
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_clone' ) ):
|
20 |
-
function widgetopts_settings_clone(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="clone">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/clone-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Clone Widget', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Clone any widgets easily and assign them to your selected sidebar widget areas.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_clone', 69 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Clone Widgets Settings Module
|
4 |
+
* Settings > Widget Options :: Clone Widget
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 3.4
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Clone Widgets
|
15 |
+
*
|
16 |
+
* @since 3.4
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_clone' ) ):
|
20 |
+
function widgetopts_settings_clone(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="clone">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/clone-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Clone Widget', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Clone any widgets easily and assign them to your selected sidebar widget areas.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_clone', 69 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/columns.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Columns Settings Module
|
4 |
-
* Settings > Widget Options :: Column Display
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Column Display Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_columns' ) ):
|
20 |
-
function widgetopts_settings_columns(){
|
21 |
-
?>
|
22 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="columns">
|
23 |
-
<div class="widgetopts-module-card-content">
|
24 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/responsive-wordpress-widget-columns/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
-
<h2><?php _e( 'Column Display', 'widget-options' );?></h2>
|
26 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
-
<p class="widgetopts-module-desc">
|
28 |
-
<?php _e( 'Manage your widgets display as columns, set different columns for specific devices.', 'widget-options' );?>
|
29 |
-
</p>
|
30 |
-
</div>
|
31 |
-
</li>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_columns', 90 );
|
35 |
-
endif;
|
36 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Columns Settings Module
|
4 |
+
* Settings > Widget Options :: Column Display
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Column Display Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_columns' ) ):
|
20 |
+
function widgetopts_settings_columns(){
|
21 |
+
?>
|
22 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="columns">
|
23 |
+
<div class="widgetopts-module-card-content">
|
24 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/responsive-wordpress-widget-columns/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
+
<h2><?php _e( 'Column Display', 'widget-options' );?></h2>
|
26 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
+
<p class="widgetopts-module-desc">
|
28 |
+
<?php _e( 'Manage your widgets display as columns, set different columns for specific devices.', 'widget-options' );?>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
</li>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_columns', 90 );
|
35 |
+
endif;
|
36 |
+
?>
|
includes/admin/settings/modules/dates.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Days & Date Range Settings Module
|
4 |
-
* Settings > Widget Options :: Days & Date Range
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Days & Date Range Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @global $widget_options
|
18 |
-
* @return void
|
19 |
-
*/
|
20 |
-
if( !function_exists( 'widgetopts_settings_dates' ) ):
|
21 |
-
function widgetopts_settings_dates(){ ?>
|
22 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="dates">
|
23 |
-
<div class="widgetopts-module-card-content">
|
24 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/restrict-wordpress-widgets-per-days-date-range/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
-
<h2><?php _e( 'Days & Date Range', 'widget-options' );?></h2>
|
26 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
-
<p class="widgetopts-module-desc">
|
28 |
-
<?php _e( 'Restrict widget visibility in any day of the week and/or specific date range.', 'widget-options' );?>
|
29 |
-
</p>
|
30 |
-
</div>
|
31 |
-
</li>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_dates', 110 );
|
35 |
-
endif;
|
36 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Days & Date Range Settings Module
|
4 |
+
* Settings > Widget Options :: Days & Date Range
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Days & Date Range Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @global $widget_options
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
if( !function_exists( 'widgetopts_settings_dates' ) ):
|
21 |
+
function widgetopts_settings_dates(){ ?>
|
22 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="dates">
|
23 |
+
<div class="widgetopts-module-card-content">
|
24 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/restrict-wordpress-widgets-per-days-date-range/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
+
<h2><?php _e( 'Days & Date Range', 'widget-options' );?></h2>
|
26 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
+
<p class="widgetopts-module-desc">
|
28 |
+
<?php _e( 'Restrict widget visibility in any day of the week and/or specific date range.', 'widget-options' );?>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
</li>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_dates', 110 );
|
35 |
+
endif;
|
36 |
+
?>
|
includes/admin/settings/modules/disable_widgets.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Disable Widgets Settings Module
|
4 |
-
* Settings > Widget Options :: Disable Widgets
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Disable Widgets Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_disable_widgets' ) ):
|
20 |
-
function widgetopts_settings_disable_widgets(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="disable_widgets">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Disable Widgets', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Disable several widgets that you won\'t be using to lessen widget dashboard space.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_disable_widgets', 150 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Disable Widgets Settings Module
|
4 |
+
* Settings > Widget Options :: Disable Widgets
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Disable Widgets Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_disable_widgets' ) ):
|
20 |
+
function widgetopts_settings_disable_widgets(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="disable_widgets">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Disable Widgets', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Disable several widgets that you won\'t be using to lessen widget dashboard space.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_disable_widgets', 150 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/fixed.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Fixed Widget Settings Module
|
4 |
-
* Settings > Widget Options :: Fixed Widget
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Fixed Widget Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @global $widget_options
|
18 |
-
* @return void
|
19 |
-
*/
|
20 |
-
if( !function_exists( 'widgetopts_settings_fixed' ) ):
|
21 |
-
function widgetopts_settings_fixed(){ ?>
|
22 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="fixed">
|
23 |
-
<div class="widgetopts-module-card-content">
|
24 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/sticky-fixed-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
-
<h2><?php _e( 'Fixed Widget', 'widget-options' );?></h2>
|
26 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
-
<p class="widgetopts-module-desc">
|
28 |
-
<?php _e( 'Add fixed positioning to each widget when the page is scrolled.', 'widget-options' );?>
|
29 |
-
</p>
|
30 |
-
</div>
|
31 |
-
</li>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_fixed', 68 );
|
35 |
-
endif;
|
36 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Fixed Widget Settings Module
|
4 |
+
* Settings > Widget Options :: Fixed Widget
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Fixed Widget Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @global $widget_options
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
if( !function_exists( 'widgetopts_settings_fixed' ) ):
|
21 |
+
function widgetopts_settings_fixed(){ ?>
|
22 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="fixed">
|
23 |
+
<div class="widgetopts-module-card-content">
|
24 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/sticky-fixed-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
+
<h2><?php _e( 'Fixed Widget', 'widget-options' );?></h2>
|
26 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
+
<p class="widgetopts-module-desc">
|
28 |
+
<?php _e( 'Add fixed positioning to each widget when the page is scrolled.', 'widget-options' );?>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
</li>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_fixed', 68 );
|
35 |
+
endif;
|
36 |
+
?>
|
includes/admin/settings/modules/links.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Links Settings Module
|
4 |
-
* Settings > Widget Options :: Link Widget
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Custom Links Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_links' ) ):
|
20 |
-
function widgetopts_settings_links(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="links">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/link-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Link Widget', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Add custom links to any widgets to redirect users on click action.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_links', 70 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Links Settings Module
|
4 |
+
* Settings > Widget Options :: Link Widget
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Custom Links Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_links' ) ):
|
20 |
+
function widgetopts_settings_links(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="links">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/link-wordpress-widgets/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Link Widget', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Add custom links to any widgets to redirect users on click action.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_links', 70 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/permission.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Alignment Settings Module
|
4 |
-
* Settings > Widget Options :: Custom Alignment
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Custom Alignment Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_permissions' ) ):
|
20 |
-
function widgetopts_settings_permissions(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="permission">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Permission', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Hide widget options tabs below each widgets to selected user roles.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_permissions', 160 );
|
35 |
-
endif;
|
36 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Alignment Settings Module
|
4 |
+
* Settings > Widget Options :: Custom Alignment
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Custom Alignment Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_permissions' ) ):
|
20 |
+
function widgetopts_settings_permissions(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="permission">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Permission', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Hide widget options tabs below each widgets to selected user roles.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_permissions', 160 );
|
35 |
+
endif;
|
36 |
+
?>
|
includes/admin/settings/modules/roles.php
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Roles Settings Module
|
4 |
-
* Settings > Widget Options :: User Roles Restriction
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for User Roles Restriction
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @global $widget_options
|
18 |
-
* @return void
|
19 |
-
*/
|
20 |
-
if( !function_exists( 'widgetopts_settings_roles' ) ):
|
21 |
-
function widgetopts_settings_roles(){ ?>
|
22 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="roles">
|
23 |
-
<div class="widgetopts-module-card-content">
|
24 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/restrict-wordpress-widgets-per-user-roles/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
-
<h2><?php _e( 'User Roles Restriction', 'widget-options' );?></h2>
|
26 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
-
<p class="widgetopts-module-desc">
|
28 |
-
<?php _e( 'Restrict each widgets visibility for each user roles at ease via checkboxes.', 'widget-options' );?>
|
29 |
-
</p>
|
30 |
-
</div>
|
31 |
-
</li>
|
32 |
-
<?php
|
33 |
-
}
|
34 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_roles', 100 );
|
35 |
-
endif;
|
36 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Roles Settings Module
|
4 |
+
* Settings > Widget Options :: User Roles Restriction
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for User Roles Restriction
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @global $widget_options
|
18 |
+
* @return void
|
19 |
+
*/
|
20 |
+
if( !function_exists( 'widgetopts_settings_roles' ) ):
|
21 |
+
function widgetopts_settings_roles(){ ?>
|
22 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="roles">
|
23 |
+
<div class="widgetopts-module-card-content">
|
24 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/restrict-wordpress-widgets-per-user-roles/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
25 |
+
<h2><?php _e( 'User Roles Restriction', 'widget-options' );?></h2>
|
26 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
27 |
+
<p class="widgetopts-module-desc">
|
28 |
+
<?php _e( 'Restrict each widgets visibility for each user roles at ease via checkboxes.', 'widget-options' );?>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
</li>
|
32 |
+
<?php
|
33 |
+
}
|
34 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_roles', 100 );
|
35 |
+
endif;
|
36 |
+
?>
|
includes/admin/settings/modules/shortcodes.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Shortcodes Settings Module
|
4 |
-
* Settings > Widget Options :: Shortcodes
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Shortcodes Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_shortcodes' ) ):
|
20 |
-
function widgetopts_settings_shortcodes(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="shortcodes">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/sidebar-widgets-shortcodes/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Shortcodes', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Display any sidebars and widgets anywhere using shortcodes.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_shortcodes', 170 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Shortcodes Settings Module
|
4 |
+
* Settings > Widget Options :: Shortcodes
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Shortcodes Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_shortcodes' ) ):
|
20 |
+
function widgetopts_settings_shortcodes(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="shortcodes">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/sidebar-widgets-shortcodes/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Shortcodes', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Display any sidebars and widgets anywhere using shortcodes.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_shortcodes', 170 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/sidebar-more_plugins.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Support Sidebar Metabox
|
4 |
-
* Settings > Widget Options
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 4.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Metabox for Support
|
15 |
-
*
|
16 |
-
* @since 4.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_more_plugins' ) ):
|
20 |
-
function widgetopts_settings_more_plugins(){ ?>
|
21 |
-
<div id="widgetopts-sidebar-widget-more_plugins" class="postbox widgetopts-sidebar-widget">
|
22 |
-
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Ready for Gutenberg?', 'widget-options' );?></span></h3>
|
23 |
-
<div class="inside">
|
24 |
-
<p><?php _e( 'Get the same controls for your Gutenberg blocks using our brand new plugin Block Options for Gutenberg. Also available for free on plugin repository.', 'widget-options' );?></p>
|
25 |
-
<p>
|
26 |
-
<a class="button-secondary" href="https://wordpress.org/plugins/block-options/" target="_blank"><?php _e( 'Download Block Options', 'widget-options' );?></a>
|
27 |
-
</p>
|
28 |
-
</div>
|
29 |
-
</div>
|
30 |
-
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
//add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_more_plugins', 25 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Support Sidebar Metabox
|
4 |
+
* Settings > Widget Options
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 4.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Metabox for Support
|
15 |
+
*
|
16 |
+
* @since 4.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_more_plugins' ) ):
|
20 |
+
function widgetopts_settings_more_plugins(){ ?>
|
21 |
+
<div id="widgetopts-sidebar-widget-more_plugins" class="postbox widgetopts-sidebar-widget">
|
22 |
+
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Ready for Gutenberg?', 'widget-options' );?></span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p><?php _e( 'Get the same controls for your Gutenberg blocks using our brand new plugin Block Options for Gutenberg. Also available for free on plugin repository.', 'widget-options' );?></p>
|
25 |
+
<p>
|
26 |
+
<a class="button-secondary" href="https://wordpress.org/plugins/block-options/" target="_blank"><?php _e( 'Download Block Options', 'widget-options' );?></a>
|
27 |
+
</p>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
//add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_more_plugins', 25 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/sidebar-opt_in.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Support Sidebar Metabox
|
4 |
-
* Settings > Widget Options
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 4.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Metabox for Support
|
15 |
-
*
|
16 |
-
* @since 4.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_sidebar_opt_in' ) ):
|
20 |
-
function widgetopts_settings_sidebar_opt_in(){ ?>
|
21 |
-
<div id="widgetopts-sidebar-widget-optin" class="postbox widgetopts-sidebar-widget">
|
22 |
-
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Download our Ultimate Guide: Optimizing WordPress Sidebars and Widgets for Better Traffic and Conversions', 'widget-options' );?></span></h3>
|
23 |
-
<div class="inside">
|
24 |
-
<p style="text-align: center;"><img src="<?php echo WIDGETOPTS_PLUGIN_URL . '/assets/images/cover-book.jpg'?>" width="180"></p>
|
25 |
-
<form action="https://phpbits.us12.list-manage.com/subscribe/post?u=5597485458f20da5305e44c55&id=6729a2bb96" method="post" class="validate widgetopts-ebook-form" target="_blank" novalidate>
|
26 |
-
<p>
|
27 |
-
<?php _e( 'Get detailed insights based on our research on 70+ popular websites that will help you optimize your WordPress sidebars and widgets.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
<p>
|
30 |
-
<?php _e( 'Email Address:', 'widget-options' );?><br />
|
31 |
-
<input name="EMAIL" class="required email widefat" placeholder="<?php _e( 'email@domain.com', 'widget-options' );?>" />
|
32 |
-
|
33 |
-
<input type="hidden" name="MMERGE3" value="Freebies" />
|
34 |
-
<input type="hidden" name="MMERGE4" value="Plugin Campaign" />
|
35 |
-
<input type="hidden" name="MMERGE5" value="Introducing Ultimate Guide: Optimizing WordPress Sidebars and Widgets for Better Traffic and Conversions" />
|
36 |
-
</p>
|
37 |
-
<p>
|
38 |
-
<button class="button-secondary"><?php _e( 'Subscribe & Download', 'widget-options' );?></button>
|
39 |
-
</p>
|
40 |
-
</form>
|
41 |
-
</div>
|
42 |
-
</div>
|
43 |
-
<script type="text/javascript">
|
44 |
-
jQuery( document ).ready( function(){
|
45 |
-
jQuery( '.widgetopts-ebook-form' ).on( 'submit', function(e){
|
46 |
-
if( jQuery( this ).find( '.required' ).val() == '' ){
|
47 |
-
jQuery( this ).find( '.required' ).css({ 'border' : '1px solid red' });
|
48 |
-
return false;
|
49 |
-
}else{
|
50 |
-
jQuery( this ).find( '.required' ).removeAttr('style');
|
51 |
-
}
|
52 |
-
} );
|
53 |
-
} );
|
54 |
-
</script>
|
55 |
-
|
56 |
-
<?php
|
57 |
-
}
|
58 |
-
//add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_sidebar_opt_in', 20 );
|
59 |
-
endif;
|
60 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Support Sidebar Metabox
|
4 |
+
* Settings > Widget Options
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 4.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Metabox for Support
|
15 |
+
*
|
16 |
+
* @since 4.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_sidebar_opt_in' ) ):
|
20 |
+
function widgetopts_settings_sidebar_opt_in(){ ?>
|
21 |
+
<div id="widgetopts-sidebar-widget-optin" class="postbox widgetopts-sidebar-widget">
|
22 |
+
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Download our Ultimate Guide: Optimizing WordPress Sidebars and Widgets for Better Traffic and Conversions', 'widget-options' );?></span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p style="text-align: center;"><img src="<?php echo WIDGETOPTS_PLUGIN_URL . '/assets/images/cover-book.jpg'?>" width="180"></p>
|
25 |
+
<form action="https://phpbits.us12.list-manage.com/subscribe/post?u=5597485458f20da5305e44c55&id=6729a2bb96" method="post" class="validate widgetopts-ebook-form" target="_blank" novalidate>
|
26 |
+
<p>
|
27 |
+
<?php _e( 'Get detailed insights based on our research on 70+ popular websites that will help you optimize your WordPress sidebars and widgets.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
<p>
|
30 |
+
<?php _e( 'Email Address:', 'widget-options' );?><br />
|
31 |
+
<input name="EMAIL" class="required email widefat" placeholder="<?php _e( 'email@domain.com', 'widget-options' );?>" />
|
32 |
+
|
33 |
+
<input type="hidden" name="MMERGE3" value="Freebies" />
|
34 |
+
<input type="hidden" name="MMERGE4" value="Plugin Campaign" />
|
35 |
+
<input type="hidden" name="MMERGE5" value="Introducing Ultimate Guide: Optimizing WordPress Sidebars and Widgets for Better Traffic and Conversions" />
|
36 |
+
</p>
|
37 |
+
<p>
|
38 |
+
<button class="button-secondary"><?php _e( 'Subscribe & Download', 'widget-options' );?></button>
|
39 |
+
</p>
|
40 |
+
</form>
|
41 |
+
</div>
|
42 |
+
</div>
|
43 |
+
<script type="text/javascript">
|
44 |
+
jQuery( document ).ready( function(){
|
45 |
+
jQuery( '.widgetopts-ebook-form' ).on( 'submit', function(e){
|
46 |
+
if( jQuery( this ).find( '.required' ).val() == '' ){
|
47 |
+
jQuery( this ).find( '.required' ).css({ 'border' : '1px solid red' });
|
48 |
+
return false;
|
49 |
+
}else{
|
50 |
+
jQuery( this ).find( '.required' ).removeAttr('style');
|
51 |
+
}
|
52 |
+
} );
|
53 |
+
} );
|
54 |
+
</script>
|
55 |
+
|
56 |
+
<?php
|
57 |
+
}
|
58 |
+
//add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_sidebar_opt_in', 20 );
|
59 |
+
endif;
|
60 |
+
?>
|
includes/admin/settings/modules/sidebar-support_box.php
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Support Sidebar Metabox
|
4 |
-
* Settings > Widget Options
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 4.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Metabox for Support
|
15 |
-
*
|
16 |
-
* @since 4.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_support_box' ) ):
|
20 |
-
function widgetopts_settings_support_box(){ ?>
|
21 |
-
<div id="widgetopts-sidebar-widget-support" class="postbox widgetopts-sidebar-widget">
|
22 |
-
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Need Help on Managing Widgets?', 'widget-options' );?></span></h3>
|
23 |
-
<div class="inside">
|
24 |
-
<p>
|
25 |
-
<?php _e( 'Since you are using the free version, you can get the free support on WordPress.org community forums. Thanks!', 'widget-options' );?>
|
26 |
-
</p>
|
27 |
-
<p>
|
28 |
-
<a class="button-secondary" href="https://wordpress.org/support/plugin/widget-options/" target="_blank"><?php _e( 'Get Free Support', 'widget-options' );?></a>
|
29 |
-
</p>
|
30 |
-
<p>
|
31 |
-
<?php _e( 'Manage your widgets better and get fast professional support by upgrading to Extended Widget Options.', 'widget-options' );?>
|
32 |
-
</p>
|
33 |
-
<p>
|
34 |
-
<a class="button-secondary" href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsprocta');?>" target="_blank"><?php _e( 'Get Extended Widget Options', 'widget-options' );?></a>
|
35 |
-
</p>
|
36 |
-
<!--<p>
|
37 |
-
<?php //_e( 'You can also join our community via Facebook Group.', 'widget-options' );?>
|
38 |
-
</p>
|
39 |
-
<p>
|
40 |
-
<a class="button-secondary" href="https://www.facebook.com/groups/WPwidgets/" target="_blank"><?php //_e( 'Join Facebook Group', 'widget-options' );?></a>
|
41 |
-
</p>-->
|
42 |
-
</div>
|
43 |
-
</div>
|
44 |
-
|
45 |
-
<?php
|
46 |
-
}
|
47 |
-
add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_support_box', 30 );
|
48 |
-
endif;
|
49 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Support Sidebar Metabox
|
4 |
+
* Settings > Widget Options
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 4.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Metabox for Support
|
15 |
+
*
|
16 |
+
* @since 4.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_support_box' ) ):
|
20 |
+
function widgetopts_settings_support_box(){ ?>
|
21 |
+
<div id="widgetopts-sidebar-widget-support" class="postbox widgetopts-sidebar-widget">
|
22 |
+
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Need Help on Managing Widgets?', 'widget-options' );?></span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p>
|
25 |
+
<?php _e( 'Since you are using the free version, you can get the free support on WordPress.org community forums. Thanks!', 'widget-options' );?>
|
26 |
+
</p>
|
27 |
+
<p>
|
28 |
+
<a class="button-secondary" href="https://wordpress.org/support/plugin/widget-options/" target="_blank"><?php _e( 'Get Free Support', 'widget-options' );?></a>
|
29 |
+
</p>
|
30 |
+
<p>
|
31 |
+
<?php _e( 'Manage your widgets better and get fast professional support by upgrading to Extended Widget Options.', 'widget-options' );?>
|
32 |
+
</p>
|
33 |
+
<p>
|
34 |
+
<a class="button-secondary" href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsprocta');?>" target="_blank"><?php _e( 'Get Extended Widget Options', 'widget-options' );?></a>
|
35 |
+
</p>
|
36 |
+
<!--<p>
|
37 |
+
<?php //_e( 'You can also join our community via Facebook Group.', 'widget-options' );?>
|
38 |
+
</p>
|
39 |
+
<p>
|
40 |
+
<a class="button-secondary" href="https://www.facebook.com/groups/WPwidgets/" target="_blank"><?php //_e( 'Join Facebook Group', 'widget-options' );?></a>
|
41 |
+
</p>-->
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
<?php
|
46 |
+
}
|
47 |
+
add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_support_box', 30 );
|
48 |
+
endif;
|
49 |
+
?>
|
includes/admin/settings/modules/sidebar-upsell_pro.php
CHANGED
@@ -1,68 +1,68 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Purchase Key Validation Sidebar Metabox
|
4 |
-
* Settings > Widget Options
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 4.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Metabox for Purchase Validation
|
15 |
-
*
|
16 |
-
* @since 4.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_upgrade_pro' ) ):
|
20 |
-
function widgetopts_settings_upgrade_pro(){ ?>
|
21 |
-
<div id="widgetopts-sidebar-widget-support" class="postbox widgetopts-sidebar-widget" style="border-color: #ffb310; border-width: 3px;">
|
22 |
-
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Get Extended Widget Options', 'widget-options' );?></span></h3>
|
23 |
-
<div class="inside">
|
24 |
-
<p>
|
25 |
-
<?php
|
26 |
-
$site_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE));
|
27 |
-
_e( '<strong>Unlock all features!</strong> Get the world\'s most complete widget management and get best out of your widgets with <a href="'.$site_url.'" target="_blank">Extended Widget Options</a> including: ', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
<ul style="list-style: outside; padding-left: 15px;">
|
30 |
-
<li>
|
31 |
-
<?php _e( 'Custom Styling', 'widget-options' );?>
|
32 |
-
</li>
|
33 |
-
<li>
|
34 |
-
<?php _e( 'Widget Animations', 'widget-options' );?>
|
35 |
-
</li>
|
36 |
-
<li>
|
37 |
-
<?php _e( 'Custom Columns Display', 'widget-options' );?>
|
38 |
-
</li>
|
39 |
-
<li>
|
40 |
-
<?php _e( 'Shortcodes', 'widget-options' );?>
|
41 |
-
</li>
|
42 |
-
<li>
|
43 |
-
<?php _e( 'Taxonomies and Custom Post Types Support', 'widget-options' );?>
|
44 |
-
</li>
|
45 |
-
<li>
|
46 |
-
<?php _e( 'Fixed Sticky Widgets', 'widget-options' );?>
|
47 |
-
</li>
|
48 |
-
<li>
|
49 |
-
<?php _e( 'Widget Caching', 'widget-options' );?>
|
50 |
-
</li>
|
51 |
-
<li>
|
52 |
-
<?php _e( 'Clone Widgets', 'widget-options' );?>
|
53 |
-
</li>
|
54 |
-
<li>
|
55 |
-
<?php _e( 'and more pro-only features', 'widget-options' );?>
|
56 |
-
</li>
|
57 |
-
</ul>
|
58 |
-
<p>
|
59 |
-
<a class="button-primary" href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsprocta');?>" target="_blank"><?php _e( 'Get Extended Widget Options', 'widget-options' );?></a>
|
60 |
-
</p>
|
61 |
-
</div>
|
62 |
-
</div>
|
63 |
-
<?php
|
64 |
-
}
|
65 |
-
add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_upgrade_pro', 10 );
|
66 |
-
endif;
|
67 |
-
|
68 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Purchase Key Validation Sidebar Metabox
|
4 |
+
* Settings > Widget Options
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 4.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Metabox for Purchase Validation
|
15 |
+
*
|
16 |
+
* @since 4.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_upgrade_pro' ) ):
|
20 |
+
function widgetopts_settings_upgrade_pro(){ ?>
|
21 |
+
<div id="widgetopts-sidebar-widget-support" class="postbox widgetopts-sidebar-widget" style="border-color: #ffb310; border-width: 3px;">
|
22 |
+
<h3 class="hndle ui-sortable-handle"><span><?php _e( 'Get Extended Widget Options', 'widget-options' );?></span></h3>
|
23 |
+
<div class="inside">
|
24 |
+
<p>
|
25 |
+
<?php
|
26 |
+
$site_url = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE));
|
27 |
+
_e( '<strong>Unlock all features!</strong> Get the world\'s most complete widget management and get best out of your widgets with <a href="'.$site_url.'" target="_blank">Extended Widget Options</a> including: ', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
<ul style="list-style: outside; padding-left: 15px;">
|
30 |
+
<li>
|
31 |
+
<?php _e( 'Custom Styling', 'widget-options' );?>
|
32 |
+
</li>
|
33 |
+
<li>
|
34 |
+
<?php _e( 'Widget Animations', 'widget-options' );?>
|
35 |
+
</li>
|
36 |
+
<li>
|
37 |
+
<?php _e( 'Custom Columns Display', 'widget-options' );?>
|
38 |
+
</li>
|
39 |
+
<li>
|
40 |
+
<?php _e( 'Shortcodes', 'widget-options' );?>
|
41 |
+
</li>
|
42 |
+
<li>
|
43 |
+
<?php _e( 'Taxonomies and Custom Post Types Support', 'widget-options' );?>
|
44 |
+
</li>
|
45 |
+
<li>
|
46 |
+
<?php _e( 'Fixed Sticky Widgets', 'widget-options' );?>
|
47 |
+
</li>
|
48 |
+
<li>
|
49 |
+
<?php _e( 'Widget Caching', 'widget-options' );?>
|
50 |
+
</li>
|
51 |
+
<li>
|
52 |
+
<?php _e( 'Clone Widgets', 'widget-options' );?>
|
53 |
+
</li>
|
54 |
+
<li>
|
55 |
+
<?php _e( 'and more pro-only features', 'widget-options' );?>
|
56 |
+
</li>
|
57 |
+
</ul>
|
58 |
+
<p>
|
59 |
+
<a class="button-primary" href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widget&utm_campaign=widgetoptsprocta');?>" target="_blank"><?php _e( 'Get Extended Widget Options', 'widget-options' );?></a>
|
60 |
+
</p>
|
61 |
+
</div>
|
62 |
+
</div>
|
63 |
+
<?php
|
64 |
+
}
|
65 |
+
add_action( 'widgetopts_module_sidebar', 'widgetopts_settings_upgrade_pro', 10 );
|
66 |
+
endif;
|
67 |
+
|
68 |
+
?>
|
includes/admin/settings/modules/sliding.php
CHANGED
@@ -1,43 +1,43 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Widgets on Menu Settings Module
|
4 |
-
* Settings > Widget Options :: Widgets on Menu
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 1.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Widgets on Menu Options
|
15 |
-
*
|
16 |
-
* @since 1.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_sliding_addon' ) ):
|
20 |
-
function widgetopts_settings_sliding_addon(){
|
21 |
-
|
22 |
-
if( !is_plugin_active( 'sliding-widget-options/plugin.php' ) ){ ?>
|
23 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="sliding">
|
24 |
-
<div class="widgetopts-module-card-content" style="border-color: #ffb310;">
|
25 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'modal-pop-up-and-sliding-widget-options/?utm_source=wordpressadmin&utm_campaign=modulecard');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
26 |
-
<h2><?php _e( 'Sliding Widgets Add-on', 'widget-options' );?></h2>
|
27 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-admin-plugins"></span></div>
|
28 |
-
<p class="widgetopts-module-desc">
|
29 |
-
<?php
|
30 |
-
_e( 'Premium add-on to transform any widgets into Modal Pop-up, Slide-ins and Sliding Panels.', 'widget-options' );
|
31 |
-
if( defined( 'ELEMENTOR_VERSION' ) ){
|
32 |
-
_e( '<br /><span class="dashicons dashicons-yes" style="color: #ffb310;"></span> Elementor Compatible', 'widget-options' );
|
33 |
-
}
|
34 |
-
?>
|
35 |
-
</p>
|
36 |
-
</div>
|
37 |
-
</li>
|
38 |
-
<?php
|
39 |
-
}
|
40 |
-
}
|
41 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_sliding_addon', 220 );
|
42 |
-
endif;
|
43 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Widgets on Menu Settings Module
|
4 |
+
* Settings > Widget Options :: Widgets on Menu
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 1.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Widgets on Menu Options
|
15 |
+
*
|
16 |
+
* @since 1.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_sliding_addon' ) ):
|
20 |
+
function widgetopts_settings_sliding_addon(){
|
21 |
+
|
22 |
+
if( !is_plugin_active( 'sliding-widget-options/plugin.php' ) ){ ?>
|
23 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="sliding">
|
24 |
+
<div class="widgetopts-module-card-content" style="border-color: #ffb310;">
|
25 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'modal-pop-up-and-sliding-widget-options/?utm_source=wordpressadmin&utm_campaign=modulecard');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
26 |
+
<h2><?php _e( 'Sliding Widgets Add-on', 'widget-options' );?></h2>
|
27 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-admin-plugins"></span></div>
|
28 |
+
<p class="widgetopts-module-desc">
|
29 |
+
<?php
|
30 |
+
_e( 'Premium add-on to transform any widgets into Modal Pop-up, Slide-ins and Sliding Panels.', 'widget-options' );
|
31 |
+
if( defined( 'ELEMENTOR_VERSION' ) ){
|
32 |
+
_e( '<br /><span class="dashicons dashicons-yes" style="color: #ffb310;"></span> Elementor Compatible', 'widget-options' );
|
33 |
+
}
|
34 |
+
?>
|
35 |
+
</p>
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<?php
|
39 |
+
}
|
40 |
+
}
|
41 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_sliding_addon', 220 );
|
42 |
+
endif;
|
43 |
+
?>
|
includes/admin/settings/modules/styling.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Styling Settings Module
|
4 |
-
* Settings > Widget Options :: Custom Styling
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Custom Styling Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_styling' ) ):
|
20 |
-
function widgetopts_settings_styling(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="styling">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widgets-styling/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Custom Styling', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Set custom widget colors and styling to make your widget stand-out more.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_styling', 120 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Styling Settings Module
|
4 |
+
* Settings > Widget Options :: Custom Styling
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Custom Styling Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_styling' ) ):
|
20 |
+
function widgetopts_settings_styling(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="styling">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/wordpress-widgets-styling/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Custom Styling', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Set custom widget colors and styling to make your widget stand-out more.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_styling', 120 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/taxonomies.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Extended Taxonomy Terms Settings Module
|
4 |
-
* Settings > Widget Options :: Extended Taxonomy Terms
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Extended Taxonomy Terms Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_taxonomies' ) ):
|
20 |
-
function widgetopts_settings_taxonomies(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="taxonomies">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/post-types-taxonomies-widget-visibility/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'Extended Taxonomy Terms', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Extend each widget visibility for custom post types taxonomies and terms.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_taxonomies', 140 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extended Taxonomy Terms Settings Module
|
4 |
+
* Settings > Widget Options :: Extended Taxonomy Terms
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Extended Taxonomy Terms Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_taxonomies' ) ):
|
20 |
+
function widgetopts_settings_taxonomies(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="taxonomies">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/post-types-taxonomies-widget-visibility/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'Extended Taxonomy Terms', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Extend each widget visibility for custom post types taxonomies and terms.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_taxonomies', 140 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/modules/urls.php
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Links Settings Module
|
4 |
-
* Settings > Widget Options :: Link Widget
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
-
* @since 3.0
|
8 |
-
*/
|
9 |
-
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* Create Card Module for Custom Links Options
|
15 |
-
*
|
16 |
-
* @since 3.0
|
17 |
-
* @return void
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_settings_urls' ) ):
|
20 |
-
function widgetopts_settings_urls(){ ?>
|
21 |
-
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="urls">
|
22 |
-
<div class="widgetopts-module-card-content">
|
23 |
-
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/target-url-wildcards/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
-
<h2><?php _e( 'URL & Wildcards Restrictions', 'widget-options' );?></h2>
|
25 |
-
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
-
<p class="widgetopts-module-desc">
|
27 |
-
<?php _e( 'Show or hide widgets by URL and/or use <code>*</code> to create a URL wildcard restrictions.', 'widget-options' );?>
|
28 |
-
</p>
|
29 |
-
</div>
|
30 |
-
</li>
|
31 |
-
<?php
|
32 |
-
}
|
33 |
-
add_action( 'widgetopts_module_cards', 'widgetopts_settings_urls', 190 );
|
34 |
-
endif;
|
35 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Links Settings Module
|
4 |
+
* Settings > Widget Options :: Link Widget
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
7 |
+
* @since 3.0
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Create Card Module for Custom Links Options
|
15 |
+
*
|
16 |
+
* @since 3.0
|
17 |
+
* @return void
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_settings_urls' ) ):
|
20 |
+
function widgetopts_settings_urls(){ ?>
|
21 |
+
<li class="widgetopts-module-card widgetopts-module-type-pro" data-module-id="urls">
|
22 |
+
<div class="widgetopts-module-card-content">
|
23 |
+
<a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/target-url-wildcards/');?>" target="_blank" class="widgetopts-pro-upsell"></a>
|
24 |
+
<h2><?php _e( 'URL & Wildcards Restrictions', 'widget-options' );?></h2>
|
25 |
+
<div class="widgetopts-pro-label"><span class="dashicons dashicons-lock"></span></div>
|
26 |
+
<p class="widgetopts-module-desc">
|
27 |
+
<?php _e( 'Show or hide widgets by URL and/or use <code>*</code> to create a URL wildcard restrictions.', 'widget-options' );?>
|
28 |
+
</p>
|
29 |
+
</div>
|
30 |
+
</li>
|
31 |
+
<?php
|
32 |
+
}
|
33 |
+
add_action( 'widgetopts_module_cards', 'widgetopts_settings_urls', 190 );
|
34 |
+
endif;
|
35 |
+
?>
|
includes/admin/settings/register-settings.php
CHANGED
@@ -1,181 +1,181 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Register Settings
|
4 |
-
* @since 4.1
|
5 |
-
*/
|
6 |
-
|
7 |
-
// Exit if accessed directly
|
8 |
-
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Get an option
|
12 |
-
*
|
13 |
-
* Looks to see if the specified setting exists, returns default if not
|
14 |
-
*
|
15 |
-
* @since 4.1
|
16 |
-
* @global $widget_options Array of all the Widget Options
|
17 |
-
* @return mixed
|
18 |
-
*/
|
19 |
-
if( !function_exists( 'widgetopts_get_option' ) ):
|
20 |
-
function widgetopts_get_option( $key = '', $default = false ) {
|
21 |
-
global $widget_options;
|
22 |
-
|
23 |
-
$value = ! empty( $widget_options[ $key ] ) ? $widget_options[ $key ] : $default;
|
24 |
-
$value = apply_filters( 'widgetopts_get_option', $value, $key, $default );
|
25 |
-
|
26 |
-
return apply_filters( 'widgetopts_get_option_' . $key, $value, $key, $default );
|
27 |
-
}
|
28 |
-
endif;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* Update an option
|
32 |
-
*
|
33 |
-
* Updates an widgetopts setting value in both the db and the global variable.
|
34 |
-
* Warning: Passing in an empty, false or null string value will remove
|
35 |
-
* the key from the widget_options array.
|
36 |
-
*
|
37 |
-
* @since 4.1
|
38 |
-
* @param string $key The Key to update
|
39 |
-
* @param string|bool|int $value The value to set the key to
|
40 |
-
* @global $widget_options Array of all the Widget Options
|
41 |
-
* @return boolean True if updated, false if not.
|
42 |
-
*/
|
43 |
-
if( !function_exists( 'widgetopts_update_option' ) ):
|
44 |
-
function widgetopts_update_option( $key = '', $value = false ) {
|
45 |
-
|
46 |
-
// If no key, exit
|
47 |
-
if ( empty( $key ) ){
|
48 |
-
return false;
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( empty( $value ) ) {
|
52 |
-
$remove_option = widgetopts_delete_option( $key );
|
53 |
-
return $remove_option;
|
54 |
-
}
|
55 |
-
|
56 |
-
// First let's grab the current settings
|
57 |
-
$options = get_option( 'widgetopts_settings' );
|
58 |
-
|
59 |
-
// Let's let devs alter that value coming in
|
60 |
-
$value = apply_filters( 'widgetopts_update_option', $value, $key );
|
61 |
-
|
62 |
-
// Next let's try to update the value
|
63 |
-
$options[ $key ] = $value;
|
64 |
-
|
65 |
-
$did_update = update_option( 'widgetopts_settings', $options );
|
66 |
-
// If it updated, let's update the global variable
|
67 |
-
if ( $did_update ){
|
68 |
-
global $widget_options;
|
69 |
-
$widget_options[ $key ] = $value;
|
70 |
-
}
|
71 |
-
return $did_update;
|
72 |
-
}
|
73 |
-
endif;
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Remove an option
|
77 |
-
*
|
78 |
-
* Removes widget options setting value in both the db and the global variable.
|
79 |
-
*
|
80 |
-
* @since 4.1
|
81 |
-
* @param string $key The Key to delete
|
82 |
-
* @global $widget_options Array of all the Widget Options
|
83 |
-
* @return boolean True if removed, false if not.
|
84 |
-
*/
|
85 |
-
if( !function_exists( 'widgetopts_delete_option' ) ):
|
86 |
-
function widgetopts_delete_option( $key = '' ) {
|
87 |
-
// If no key, exit
|
88 |
-
if ( empty( $key ) ){
|
89 |
-
return false;
|
90 |
-
}
|
91 |
-
// First let's grab the current settings
|
92 |
-
$options = get_option( 'widgetopts_settings' );
|
93 |
-
|
94 |
-
// Next let's try to update the value
|
95 |
-
if( isset( $options[ $key ] ) ) {
|
96 |
-
unset( $options[ $key ] );
|
97 |
-
}
|
98 |
-
$did_update = update_option( 'widgetopts_settings', $options );
|
99 |
-
|
100 |
-
// If it updated, let's update the global variable
|
101 |
-
if ( $did_update ){
|
102 |
-
global $edd_options;
|
103 |
-
$edd_options = $options;
|
104 |
-
}
|
105 |
-
return $did_update;
|
106 |
-
}
|
107 |
-
endif;
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Get Settings
|
111 |
-
*
|
112 |
-
* Retrieves all plugin settings
|
113 |
-
*
|
114 |
-
* @since 4.1
|
115 |
-
* @return array WIDGETOPTS settings
|
116 |
-
*/
|
117 |
-
if( !function_exists( 'widgetopts_get_settings' ) ):
|
118 |
-
function widgetopts_get_settings() {
|
119 |
-
if (is_multisite()) {
|
120 |
-
$settings = get_blog_option(get_current_blog_id(), 'widgetopts_settings');
|
121 |
-
} else {
|
122 |
-
$settings = get_option( 'widgetopts_settings' );
|
123 |
-
}
|
124 |
-
|
125 |
-
if( empty( $settings ) ) {
|
126 |
-
|
127 |
-
$opts_settings = get_option( 'widgetopts_tabmodule-settings' );
|
128 |
-
//fallback to prevent error
|
129 |
-
if( is_serialized( $opts_settings ) ){
|
130 |
-
$opts_settings = maybe_unserialize( $opts_settings );
|
131 |
-
}
|
132 |
-
|
133 |
-
// Update old settings with new single option
|
134 |
-
$settings = !empty( $opts_settings ) ? $opts_settings : array();
|
135 |
-
$visibility = array( 'visibility' => get_option( 'widgetopts_tabmodule-visibility' ) );
|
136 |
-
$devices = array( 'devices' => get_option( 'widgetopts_tabmodule-devices' ) );
|
137 |
-
$alignment = array( 'alignment' => get_option( 'widgetopts_tabmodule-alignment' ) );
|
138 |
-
$hide_title = array( 'hide_title' => get_option( 'widgetopts_tabmodule-hide_title' ) );
|
139 |
-
$classes = array( 'classes' => get_option( 'widgetopts_tabmodule-classes' ) );
|
140 |
-
$logic = array( 'logic' => get_option( 'widgetopts_tabmodule-logic' ) );
|
141 |
-
$siteorigin = array( 'siteorigin' => get_option( 'widgetopts_tabmodule-siteorigin' ) );
|
142 |
-
$search = array( 'search' => get_option( 'widgetopts_tabmodule-search' ) );
|
143 |
-
$move = array( 'move' => get_option( 'widgetopts_tabmodule-move' ) );
|
144 |
-
$elementor = array( 'elementor' => get_option( 'widgetopts_tabmodule-elementor' ) );
|
145 |
-
$widget_area = array( 'widget_area' => get_option( 'widgetopts_tabmodule-widget_area' ) );
|
146 |
-
$import_export = array( 'import_export' => get_option( 'widgetopts_tabmodule-import_export' ) );
|
147 |
-
$beaver = array( 'beaver' => get_option( 'widgetopts_tabmodule-beaver' ) );
|
148 |
-
$acf = array( 'acf' => get_option( 'widgetopts_tabmodule-acf' ) );
|
149 |
-
$state = array( 'state' => get_option( 'widgetopts_tabmodule-state' ) );
|
150 |
-
$classic_widgets_screen = array( 'state' => get_option( 'widgetopts_tabmodule-classic_widgets_screen' ) );
|
151 |
-
/*
|
152 |
-
* Available only on Extended version
|
153 |
-
*/
|
154 |
-
// $columns = array( 'columns' => get_option( 'widgetopts_tabmodule-columns' ) );
|
155 |
-
// $dates = array( 'dates' => get_option( 'widgetopts_tabmodule-dates' ) );
|
156 |
-
// $styling = array( 'styling' => get_option( 'widgetopts_tabmodule-styling' ) );
|
157 |
-
// $roles = array( 'roles' => get_option( 'widgetopts_tabmodule-roles' ) );
|
158 |
-
// $links = array( 'links' => get_option( 'widgetopts_tabmodule-links' ) );
|
159 |
-
// $fixed = array( 'fixed' => get_option( 'widgetopts_tabmodule-fixed' ) );
|
160 |
-
// $taxonomies = array( 'taxonomies' => get_option( 'widgetopts_tabmodule-taxonomies' ) );
|
161 |
-
// $animation = array( 'animation' => get_option( 'widgetopts_tabmodule-animation' ) );
|
162 |
-
// $shortcodes = array( 'shortcodes' => get_option( 'widgetopts_tabmodule-shortcodes' ) );
|
163 |
-
// $cache = array( 'cache' => get_option( 'widgetopts_tabmodule-cache' ) );
|
164 |
-
// $disable_widgets = array( 'disable_widgets' => get_option( 'widgetopts_tabmodule-disable_widgets' ) );
|
165 |
-
// $permission = array( 'permission' => get_option( 'widgetopts_tabmodule-permission' ) );
|
166 |
-
|
167 |
-
$settings = array_merge( array( 'settings' => $settings ), $visibility, $devices, $alignment, $hide_title, $classes, $logic, $siteorigin, $search, $move, $elementor, $widget_area, $import_export, $beaver, $acf, $state,$classic_widgets_screen );
|
168 |
-
|
169 |
-
// Let's let devs alter that value coming in
|
170 |
-
$value = apply_filters( 'widgetopts_update_settings', $settings );
|
171 |
-
|
172 |
-
update_option( 'widgetopts_settings', $settings );
|
173 |
-
}
|
174 |
-
|
175 |
-
$default = array('settings' => array(), 'visibility' => '', 'devices' => '', 'alignment' => '', 'columns' => '', 'dates' => '', 'styling' => '', 'roles' => '', 'hide_title' => '', 'classes' => '', 'logic' => '', 'links' => '', 'fixed' => '', 'taxonomies' => '', 'animation' => '', 'shortcodes' => '', 'cache' => '', 'siteorigin' => '', 'search' => '', 'disable_widgets' => '', 'permission' => '', 'move' => '', 'clone' => '', 'elementor' => '', 'widget_area' => '', 'import_export' => '', 'urls' => '', 'beaver' => '', 'acf' => '', 'state' => '', 'sliding' => '','classic_widgets_screen'=>'activate');
|
176 |
-
$settings = shortcode_atts($default, $settings);
|
177 |
-
|
178 |
-
return apply_filters( 'widgetopts_get_settings', $settings );
|
179 |
-
}
|
180 |
-
endif;
|
181 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Register Settings
|
4 |
+
* @since 4.1
|
5 |
+
*/
|
6 |
+
|
7 |
+
// Exit if accessed directly
|
8 |
+
if ( !defined( 'ABSPATH' ) ) exit;
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Get an option
|
12 |
+
*
|
13 |
+
* Looks to see if the specified setting exists, returns default if not
|
14 |
+
*
|
15 |
+
* @since 4.1
|
16 |
+
* @global $widget_options Array of all the Widget Options
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
if( !function_exists( 'widgetopts_get_option' ) ):
|
20 |
+
function widgetopts_get_option( $key = '', $default = false ) {
|
21 |
+
global $widget_options;
|
22 |
+
|
23 |
+
$value = ! empty( $widget_options[ $key ] ) ? $widget_options[ $key ] : $default;
|
24 |
+
$value = apply_filters( 'widgetopts_get_option', $value, $key, $default );
|
25 |
+
|
26 |
+
return apply_filters( 'widgetopts_get_option_' . $key, $value, $key, $default );
|
27 |
+
}
|
28 |
+
endif;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Update an option
|
32 |
+
*
|
33 |
+
* Updates an widgetopts setting value in both the db and the global variable.
|
34 |
+
* Warning: Passing in an empty, false or null string value will remove
|
35 |
+
* the key from the widget_options array.
|
36 |
+
*
|
37 |
+
* @since 4.1
|
38 |
+
* @param string $key The Key to update
|
39 |
+
* @param string|bool|int $value The value to set the key to
|
40 |
+
* @global $widget_options Array of all the Widget Options
|
41 |
+
* @return boolean True if updated, false if not.
|
42 |
+
*/
|
43 |
+
if( !function_exists( 'widgetopts_update_option' ) ):
|
44 |
+
function widgetopts_update_option( $key = '', $value = false ) {
|
45 |
+
|
46 |
+
// If no key, exit
|
47 |
+
if ( empty( $key ) ){
|
48 |
+
return false;
|
49 |
+
}
|
50 |
+
|
51 |
+
if ( empty( $value ) ) {
|
52 |
+
$remove_option = widgetopts_delete_option( $key );
|
53 |
+
return $remove_option;
|
54 |
+
}
|
55 |
+
|
56 |
+
// First let's grab the current settings
|
57 |
+
$options = get_option( 'widgetopts_settings' );
|
58 |
+
|
59 |
+
// Let's let devs alter that value coming in
|
60 |
+
$value = apply_filters( 'widgetopts_update_option', $value, $key );
|
61 |
+
|
62 |
+
// Next let's try to update the value
|
63 |
+
$options[ $key ] = $value;
|
64 |
+
|
65 |
+
$did_update = update_option( 'widgetopts_settings', $options );
|
66 |
+
// If it updated, let's update the global variable
|
67 |
+
if ( $did_update ){
|
68 |
+
global $widget_options;
|
69 |
+
$widget_options[ $key ] = $value;
|
70 |
+
}
|
71 |
+
return $did_update;
|
72 |
+
}
|
73 |
+
endif;
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Remove an option
|
77 |
+
*
|
78 |
+
* Removes widget options setting value in both the db and the global variable.
|
79 |
+
*
|
80 |
+
* @since 4.1
|
81 |
+
* @param string $key The Key to delete
|
82 |
+
* @global $widget_options Array of all the Widget Options
|
83 |
+
* @return boolean True if removed, false if not.
|
84 |
+
*/
|
85 |
+
if( !function_exists( 'widgetopts_delete_option' ) ):
|
86 |
+
function widgetopts_delete_option( $key = '' ) {
|
87 |
+
// If no key, exit
|
88 |
+
if ( empty( $key ) ){
|
89 |
+
return false;
|
90 |
+
}
|
91 |
+
// First let's grab the current settings
|
92 |
+
$options = get_option( 'widgetopts_settings' );
|
93 |
+
|
94 |
+
// Next let's try to update the value
|
95 |
+
if( isset( $options[ $key ] ) ) {
|
96 |
+
unset( $options[ $key ] );
|
97 |
+
}
|
98 |
+
$did_update = update_option( 'widgetopts_settings', $options );
|
99 |
+
|
100 |
+
// If it updated, let's update the global variable
|
101 |
+
if ( $did_update ){
|
102 |
+
global $edd_options;
|
103 |
+
$edd_options = $options;
|
104 |
+
}
|
105 |
+
return $did_update;
|
106 |
+
}
|
107 |
+
endif;
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Get Settings
|
111 |
+
*
|
112 |
+
* Retrieves all plugin settings
|
113 |
+
*
|
114 |
+
* @since 4.1
|
115 |
+
* @return array WIDGETOPTS settings
|
116 |
+
*/
|
117 |
+
if( !function_exists( 'widgetopts_get_settings' ) ):
|
118 |
+
function widgetopts_get_settings() {
|
119 |
+
if (is_multisite()) {
|
120 |
+
$settings = get_blog_option(get_current_blog_id(), 'widgetopts_settings');
|
121 |
+
} else {
|
122 |
+
$settings = get_option( 'widgetopts_settings' );
|
123 |
+
}
|
124 |
+
|
125 |
+
if( empty( $settings ) ) {
|
126 |
+
|
127 |
+
$opts_settings = get_option( 'widgetopts_tabmodule-settings' );
|
128 |
+
//fallback to prevent error
|
129 |
+
if( is_serialized( $opts_settings ) ){
|
130 |
+
$opts_settings = maybe_unserialize( $opts_settings );
|
131 |
+
}
|
132 |
+
|
133 |
+
// Update old settings with new single option
|
134 |
+
$settings = !empty( $opts_settings ) ? $opts_settings : array();
|
135 |
+
$visibility = array( 'visibility' => get_option( 'widgetopts_tabmodule-visibility' ) );
|
136 |
+
$devices = array( 'devices' => get_option( 'widgetopts_tabmodule-devices' ) );
|
137 |
+
$alignment = array( 'alignment' => get_option( 'widgetopts_tabmodule-alignment' ) );
|
138 |
+
$hide_title = array( 'hide_title' => get_option( 'widgetopts_tabmodule-hide_title' ) );
|
139 |
+
$classes = array( 'classes' => get_option( 'widgetopts_tabmodule-classes' ) );
|
140 |
+
$logic = array( 'logic' => get_option( 'widgetopts_tabmodule-logic' ) );
|
141 |
+
$siteorigin = array( 'siteorigin' => get_option( 'widgetopts_tabmodule-siteorigin' ) );
|
142 |
+
$search = array( 'search' => get_option( 'widgetopts_tabmodule-search' ) );
|
143 |
+
$move = array( 'move' => get_option( 'widgetopts_tabmodule-move' ) );
|
144 |
+
$elementor = array( 'elementor' => get_option( 'widgetopts_tabmodule-elementor' ) );
|
145 |
+
$widget_area = array( 'widget_area' => get_option( 'widgetopts_tabmodule-widget_area' ) );
|
146 |
+
$import_export = array( 'import_export' => get_option( 'widgetopts_tabmodule-import_export' ) );
|
147 |
+
$beaver = array( 'beaver' => get_option( 'widgetopts_tabmodule-beaver' ) );
|
148 |
+
$acf = array( 'acf' => get_option( 'widgetopts_tabmodule-acf' ) );
|
149 |
+
$state = array( 'state' => get_option( 'widgetopts_tabmodule-state' ) );
|
150 |
+
$classic_widgets_screen = array( 'state' => get_option( 'widgetopts_tabmodule-classic_widgets_screen' ) );
|
151 |
+
/*
|
152 |
+
* Available only on Extended version
|
153 |
+
*/
|
154 |
+
// $columns = array( 'columns' => get_option( 'widgetopts_tabmodule-columns' ) );
|
155 |
+
// $dates = array( 'dates' => get_option( 'widgetopts_tabmodule-dates' ) );
|
156 |
+
// $styling = array( 'styling' => get_option( 'widgetopts_tabmodule-styling' ) );
|
157 |
+
// $roles = array( 'roles' => get_option( 'widgetopts_tabmodule-roles' ) );
|
158 |
+
// $links = array( 'links' => get_option( 'widgetopts_tabmodule-links' ) );
|
159 |
+
// $fixed = array( 'fixed' => get_option( 'widgetopts_tabmodule-fixed' ) );
|
160 |
+
// $taxonomies = array( 'taxonomies' => get_option( 'widgetopts_tabmodule-taxonomies' ) );
|
161 |
+
// $animation = array( 'animation' => get_option( 'widgetopts_tabmodule-animation' ) );
|
162 |
+
// $shortcodes = array( 'shortcodes' => get_option( 'widgetopts_tabmodule-shortcodes' ) );
|
163 |
+
// $cache = array( 'cache' => get_option( 'widgetopts_tabmodule-cache' ) );
|
164 |
+
// $disable_widgets = array( 'disable_widgets' => get_option( 'widgetopts_tabmodule-disable_widgets' ) );
|
165 |
+
// $permission = array( 'permission' => get_option( 'widgetopts_tabmodule-permission' ) );
|
166 |
+
|
167 |
+
$settings = array_merge( array( 'settings' => $settings ), $visibility, $devices, $alignment, $hide_title, $classes, $logic, $siteorigin, $search, $move, $elementor, $widget_area, $import_export, $beaver, $acf, $state,$classic_widgets_screen );
|
168 |
+
|
169 |
+
// Let's let devs alter that value coming in
|
170 |
+
$value = apply_filters( 'widgetopts_update_settings', $settings );
|
171 |
+
|
172 |
+
update_option( 'widgetopts_settings', $settings );
|
173 |
+
}
|
174 |
+
|
175 |
+
$default = array('settings' => array(), 'visibility' => '', 'devices' => '', 'alignment' => '', 'columns' => '', 'dates' => '', 'styling' => '', 'roles' => '', 'hide_title' => '', 'classes' => '', 'logic' => '', 'links' => '', 'fixed' => '', 'taxonomies' => '', 'animation' => '', 'shortcodes' => '', 'cache' => '', 'siteorigin' => '', 'search' => '', 'disable_widgets' => '', 'permission' => '', 'move' => '', 'clone' => '', 'elementor' => '', 'widget_area' => '', 'import_export' => '', 'urls' => '', 'beaver' => '', 'acf' => '', 'state' => '', 'sliding' => '','classic_widgets_screen'=>'activate');
|
176 |
+
$settings = shortcode_atts($default, $settings);
|
177 |
+
|
178 |
+
return apply_filters( 'widgetopts_get_settings', $settings );
|
179 |
+
}
|
180 |
+
endif;
|
181 |
+
?>
|
includes/admin/welcome.php
CHANGED
@@ -1,103 +1,103 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Welcome Page Class
|
4 |
-
*
|
5 |
-
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
-
* @since 1.0
|
7 |
-
*/
|
8 |
-
// Exit if accessed directly
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
-
/**
|
11 |
-
* WIDGETOPS_Welcome Class
|
12 |
-
*
|
13 |
-
* A general class for About and Credits page.
|
14 |
-
*
|
15 |
-
* @since 1.0
|
16 |
-
*/
|
17 |
-
|
18 |
-
if( !class_exists( 'WIDGETOPS_Welcome' ) ){
|
19 |
-
class WIDGETOPS_Welcome{
|
20 |
-
public function __construct() {
|
21 |
-
add_action( 'admin_enqueue_scripts', array($this, 'enqueue') );
|
22 |
-
add_action( 'admin_menu', array($this, 'screen_page') );
|
23 |
-
add_action( 'activated_plugin', array($this, 'redirect' ) );
|
24 |
-
add_action( 'admin_head', array($this, 'remove_menu' ) );
|
25 |
-
}
|
26 |
-
|
27 |
-
function enqueue(){
|
28 |
-
if ( !isset( $_GET['page'] ) || 'widget-opts-getting-started' != $_GET['page'] )
|
29 |
-
return;
|
30 |
-
|
31 |
-
wp_enqueue_style( 'extended-widget-opts-welcome', plugins_url( '../assets/css/welcome.css' , dirname(__FILE__) ) , array(), null );
|
32 |
-
}
|
33 |
-
|
34 |
-
function screen_page(){
|
35 |
-
add_dashboard_page(
|
36 |
-
__( 'Getting started with Widget Options', 'widget-options' ),
|
37 |
-
__( 'Getting started with Widget Options', 'widget-options' ),
|
38 |
-
apply_filters( 'widgetopts_welcome_cap', 'manage_options' ),
|
39 |
-
'widget-opts-getting-started',
|
40 |
-
array( $this, 'welcome_content' )
|
41 |
-
);
|
42 |
-
}
|
43 |
-
|
44 |
-
function welcome_head(){
|
45 |
-
$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'widget-opts-getting-started';
|
46 |
-
?>
|
47 |
-
<h1><?php _e( 'Welcome to Widget Options', 'widget-options' ); ?></h1>
|
48 |
-
<div class="about-text">
|
49 |
-
<?php _e( 'Congratulations! You\'ve just unlocked features on managing your widgets better.', 'widget-options' ); ?>
|
50 |
-
</div>
|
51 |
-
<div class="widgetopts-badge">
|
52 |
-
<span class="widgetopts-mascot"></span>
|
53 |
-
<span class="version"><?php _e( 'Version', 'widget-options' );?> <?php echo WIDGETOPTS_VERSION; ?></span>
|
54 |
-
</div>
|
55 |
-
<h2 class="nav-tab-wrapper">
|
56 |
-
<a class="nav-tab <?php echo $selected == 'widget-opts-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'widget-opts-getting-started' ), 'index.php' ) ) ); ?>">
|
57 |
-
<?php _e( 'Getting Started', 'widget-options' ); ?>
|
58 |
-
</a>
|
59 |
-
</h2>
|
60 |
-
<?php
|
61 |
-
}
|
62 |
-
|
63 |
-
function welcome_content(){ ?>
|
64 |
-
<div class="wrap about-wrap widgetopts-about-wrap">
|
65 |
-
<?php $this->welcome_head(); ?>
|
66 |
-
<p class="about-description">
|
67 |
-
<?php _e( 'Use the tips and instructions below to get started, then you will be up and running in no time. ', 'widget-options' ); ?>
|
68 |
-
</p>
|
69 |
-
|
70 |
-
<div class="feature-section two-col">
|
71 |
-
<div class="col">
|
72 |
-
<h3><?php _e( 'Take full control over your widgets!' , 'widget-options' ); ?></h3>
|
73 |
-
<p><?php printf( __( 'Widget Options is your all-in-on plugin to take over your widgets like it was built as WordPress core functionality. You can follow the tutorial on the right to see how the plugin works but in reality it\'s so easy and integrated elegantly on each widgets. <a href="%s" target="_blank">Expand your widgets here to view Widget Options</a>.', 'widget-options' ), esc_url( admin_url('widgets.php') ) ); ?>
|
74 |
-
</div>
|
75 |
-
<div class="col">
|
76 |
-
<div class="feature-video">
|
77 |
-
<iframe width="495" height="278" src="https://player.vimeo.com/video/190057410" frameborder="0" allowfullscreen></iframe>
|
78 |
-
</div>
|
79 |
-
</div>
|
80 |
-
</div>
|
81 |
-
|
82 |
-
<div class="feature-section two-col">
|
83 |
-
<h3><?php _e( 'Extend Plugin Features', 'widget-options' ); ?></h3>
|
84 |
-
<p><?php _e( 'Unlock more features by upgrading to Extended Widget Options to get the full plugin functionalities! We have tons of helpful features that will let you fully manage your widgets and extend functionalities.', 'widget-options' ); ?></p>
|
85 |
-
<p><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-features-button button button-primary"><?php _e( 'See all Features', 'widget-options' ); ?></a></p>
|
86 |
-
</div>
|
87 |
-
</div>
|
88 |
-
<?php }
|
89 |
-
|
90 |
-
function redirect($plugin){
|
91 |
-
if( $plugin=='widget-options/plugin.php' && !isset( $_GET['activate-multi'] ) ) {
|
92 |
-
wp_redirect(admin_url('index.php?page=widget-opts-getting-started'));
|
93 |
-
die();
|
94 |
-
}
|
95 |
-
}
|
96 |
-
function remove_menu(){
|
97 |
-
remove_submenu_page( 'index.php', 'widget-opts-getting-started' );
|
98 |
-
}
|
99 |
-
}
|
100 |
-
new WIDGETOPS_Welcome();
|
101 |
-
}
|
102 |
-
|
103 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Welcome Page Class
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
+
* @since 1.0
|
7 |
+
*/
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
/**
|
11 |
+
* WIDGETOPS_Welcome Class
|
12 |
+
*
|
13 |
+
* A general class for About and Credits page.
|
14 |
+
*
|
15 |
+
* @since 1.0
|
16 |
+
*/
|
17 |
+
|
18 |
+
if( !class_exists( 'WIDGETOPS_Welcome' ) ){
|
19 |
+
class WIDGETOPS_Welcome{
|
20 |
+
public function __construct() {
|
21 |
+
add_action( 'admin_enqueue_scripts', array($this, 'enqueue') );
|
22 |
+
add_action( 'admin_menu', array($this, 'screen_page') );
|
23 |
+
add_action( 'activated_plugin', array($this, 'redirect' ) );
|
24 |
+
add_action( 'admin_head', array($this, 'remove_menu' ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
function enqueue(){
|
28 |
+
if ( !isset( $_GET['page'] ) || 'widget-opts-getting-started' != $_GET['page'] )
|
29 |
+
return;
|
30 |
+
|
31 |
+
wp_enqueue_style( 'extended-widget-opts-welcome', plugins_url( '../assets/css/welcome.css' , dirname(__FILE__) ) , array(), null );
|
32 |
+
}
|
33 |
+
|
34 |
+
function screen_page(){
|
35 |
+
add_dashboard_page(
|
36 |
+
__( 'Getting started with Widget Options', 'widget-options' ),
|
37 |
+
__( 'Getting started with Widget Options', 'widget-options' ),
|
38 |
+
apply_filters( 'widgetopts_welcome_cap', 'manage_options' ),
|
39 |
+
'widget-opts-getting-started',
|
40 |
+
array( $this, 'welcome_content' )
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
function welcome_head(){
|
45 |
+
$selected = isset( $_GET['page'] ) ? $_GET['page'] : 'widget-opts-getting-started';
|
46 |
+
?>
|
47 |
+
<h1><?php _e( 'Welcome to Widget Options', 'widget-options' ); ?></h1>
|
48 |
+
<div class="about-text">
|
49 |
+
<?php _e( 'Congratulations! You\'ve just unlocked features on managing your widgets better.', 'widget-options' ); ?>
|
50 |
+
</div>
|
51 |
+
<div class="widgetopts-badge">
|
52 |
+
<span class="widgetopts-mascot"></span>
|
53 |
+
<span class="version"><?php _e( 'Version', 'widget-options' );?> <?php echo WIDGETOPTS_VERSION; ?></span>
|
54 |
+
</div>
|
55 |
+
<h2 class="nav-tab-wrapper">
|
56 |
+
<a class="nav-tab <?php echo $selected == 'widget-opts-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'widget-opts-getting-started' ), 'index.php' ) ) ); ?>">
|
57 |
+
<?php _e( 'Getting Started', 'widget-options' ); ?>
|
58 |
+
</a>
|
59 |
+
</h2>
|
60 |
+
<?php
|
61 |
+
}
|
62 |
+
|
63 |
+
function welcome_content(){ ?>
|
64 |
+
<div class="wrap about-wrap widgetopts-about-wrap">
|
65 |
+
<?php $this->welcome_head(); ?>
|
66 |
+
<p class="about-description">
|
67 |
+
<?php _e( 'Use the tips and instructions below to get started, then you will be up and running in no time. ', 'widget-options' ); ?>
|
68 |
+
</p>
|
69 |
+
|
70 |
+
<div class="feature-section two-col">
|
71 |
+
<div class="col">
|
72 |
+
<h3><?php _e( 'Take full control over your widgets!' , 'widget-options' ); ?></h3>
|
73 |
+
<p><?php printf( __( 'Widget Options is your all-in-on plugin to take over your widgets like it was built as WordPress core functionality. You can follow the tutorial on the right to see how the plugin works but in reality it\'s so easy and integrated elegantly on each widgets. <a href="%s" target="_blank">Expand your widgets here to view Widget Options</a>.', 'widget-options' ), esc_url( admin_url('widgets.php') ) ); ?>
|
74 |
+
</div>
|
75 |
+
<div class="col">
|
76 |
+
<div class="feature-video">
|
77 |
+
<iframe width="495" height="278" src="https://player.vimeo.com/video/190057410" frameborder="0" allowfullscreen></iframe>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
|
82 |
+
<div class="feature-section two-col">
|
83 |
+
<h3><?php _e( 'Extend Plugin Features', 'widget-options' ); ?></h3>
|
84 |
+
<p><?php _e( 'Unlock more features by upgrading to Extended Widget Options to get the full plugin functionalities! We have tons of helpful features that will let you fully manage your widgets and extend functionalities.', 'widget-options' ); ?></p>
|
85 |
+
<p><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'features/');?>" target="_blank" class="widgetopts-features-button button button-primary"><?php _e( 'See all Features', 'widget-options' ); ?></a></p>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
<?php }
|
89 |
+
|
90 |
+
function redirect($plugin){
|
91 |
+
if( $plugin=='widget-options/plugin.php' && !isset( $_GET['activate-multi'] ) ) {
|
92 |
+
wp_redirect(admin_url('index.php?page=widget-opts-getting-started'));
|
93 |
+
die();
|
94 |
+
}
|
95 |
+
}
|
96 |
+
function remove_menu(){
|
97 |
+
remove_submenu_page( 'index.php', 'widget-opts-getting-started' );
|
98 |
+
}
|
99 |
+
}
|
100 |
+
new WIDGETOPS_Welcome();
|
101 |
+
}
|
102 |
+
|
103 |
+
?>
|
includes/extras.php
CHANGED
@@ -1,186 +1,186 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Extra Functions
|
4 |
-
*
|
5 |
-
* Collections of extra functions to avoid repeatition
|
6 |
-
*
|
7 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
8 |
-
* @since 4.0
|
9 |
-
*/
|
10 |
-
|
11 |
-
function widgetopts_sanitize_array( &$array ) {
|
12 |
-
foreach ($array as &$value) {
|
13 |
-
if( !is_array($value) ) {
|
14 |
-
// sanitize if value is not an array
|
15 |
-
$value = sanitize_text_field( $value );
|
16 |
-
}else{
|
17 |
-
// go inside this function again
|
18 |
-
widgetopts_sanitize_array($value);
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
return $array;
|
23 |
-
}
|
24 |
-
|
25 |
-
function widgetopts_is_checked( $array, $key ){
|
26 |
-
return ( isset( $array[$key] ) && '1' == $array[$key] ) ? 'checked="checked"' : '';
|
27 |
-
}
|
28 |
-
|
29 |
-
/*
|
30 |
-
* Check if http or https available on link
|
31 |
-
*/
|
32 |
-
function widgetopts_addhttp($url) {
|
33 |
-
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
|
34 |
-
$url = "http://" . $url;
|
35 |
-
}
|
36 |
-
return $url;
|
37 |
-
}
|
38 |
-
|
39 |
-
|
40 |
-
/**
|
41 |
-
* Register Global Variables for easier access
|
42 |
-
*
|
43 |
-
*
|
44 |
-
* @since 5.0
|
45 |
-
* @return array
|
46 |
-
*/
|
47 |
-
function widgetopts_global_taxonomies() {
|
48 |
-
$taxonomies = get_option( 'widgetopts_global_taxonomies' );
|
49 |
-
|
50 |
-
if( empty( $taxonomies ) ) {
|
51 |
-
|
52 |
-
$tax_args = array(
|
53 |
-
'public' => true
|
54 |
-
);
|
55 |
-
$tax_output = 'objects'; // or objects
|
56 |
-
$tax_operator = 'and'; // 'and' or 'or'
|
57 |
-
$taxonomies = get_taxonomies( $tax_args, $tax_output, $tax_operator );
|
58 |
-
unset( $taxonomies['post_format'] );
|
59 |
-
|
60 |
-
// Let's let devs alter that value coming in
|
61 |
-
$taxonomies = apply_filters( 'widgetopts_update_global_taxonomies', $taxonomies );
|
62 |
-
update_option( 'widgetopts_global_taxonomies', $taxonomies );
|
63 |
-
|
64 |
-
}
|
65 |
-
|
66 |
-
return apply_filters( 'widgetopts_get_global_taxonomies', $taxonomies );
|
67 |
-
}
|
68 |
-
|
69 |
-
function widgetopts_global_types() {
|
70 |
-
/*$types = get_option( 'widgetopts_global_types' );
|
71 |
-
if( empty( $types ) ) {
|
72 |
-
$types = get_post_types( array(
|
73 |
-
'public' => true,
|
74 |
-
), 'object' );
|
75 |
-
// Let's let devs alter that value coming in
|
76 |
-
$types = apply_filters( 'widgetopts_update_global_types', $types );
|
77 |
-
update_option( 'widgetopts_global_types', $types );
|
78 |
-
}*/
|
79 |
-
|
80 |
-
$types = get_post_types(array('public' => true), 'object');
|
81 |
-
$types = apply_filters('widgetopts_update_global_types', $types);
|
82 |
-
|
83 |
-
return apply_filters( 'widgetopts_get_global_types', $types );
|
84 |
-
}
|
85 |
-
|
86 |
-
function widgetopts_global_pages() {
|
87 |
-
$pages = get_option( 'widgetopts_global_all_pages' );
|
88 |
-
|
89 |
-
//old pages object
|
90 |
-
// if( empty( $pages ) ) {
|
91 |
-
// $pages = get_posts( array(
|
92 |
-
// 'post_type' => 'page',
|
93 |
-
// 'post_status' => 'publish',
|
94 |
-
// 'numberposts' => -1,
|
95 |
-
// 'orderby' => 'title',
|
96 |
-
// 'order' => 'ASC',
|
97 |
-
// 'fields' => array('ID', 'name')
|
98 |
-
// ));
|
99 |
-
//
|
100 |
-
// // Let's let devs alter that value coming in
|
101 |
-
// $pages = apply_filters( 'widgetopts_update_global_pages', $pages );
|
102 |
-
// update_option( 'widgetopts_global_pages', $pages );
|
103 |
-
// }
|
104 |
-
|
105 |
-
//create new pages object
|
106 |
-
if( empty( $pages ) ) {
|
107 |
-
global $wpdb;
|
108 |
-
|
109 |
-
$pages = $wpdb->get_results("SELECT ID, post_title, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' ORDER BY post_title ASC ");
|
110 |
-
|
111 |
-
// Let's let devs alter that value coming in
|
112 |
-
$pages = apply_filters( 'widgetopts_update_global_pages', $pages );
|
113 |
-
update_option( 'widgetopts_global_all_pages', $pages );
|
114 |
-
}
|
115 |
-
|
116 |
-
return apply_filters( 'widgetopts_get_global_pages', $pages );
|
117 |
-
}
|
118 |
-
|
119 |
-
function widgetopts_global_categories(){
|
120 |
-
$categories = get_option( 'widgetopts_global_categories' );
|
121 |
-
|
122 |
-
if( empty( $categories ) ) {
|
123 |
-
$categories = get_categories( array(
|
124 |
-
'hide_empty' => false
|
125 |
-
) );
|
126 |
-
|
127 |
-
// Let's let devs alter that value coming in
|
128 |
-
$categories = apply_filters( 'widgetopts_update_global_categories', $categories );
|
129 |
-
update_option( 'widgetopts_global_categories', $categories );
|
130 |
-
}
|
131 |
-
|
132 |
-
return apply_filters( 'widgetopts_global_categories', $categories );
|
133 |
-
}
|
134 |
-
|
135 |
-
/*
|
136 |
-
Page Walker Class
|
137 |
-
*/
|
138 |
-
if( !class_exists( 'WidgetOpts_Pages_Checkboxes' ) ):
|
139 |
-
class WidgetOpts_Pages_Checkboxes extends Walker_Page {
|
140 |
-
|
141 |
-
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
142 |
-
$output .= "\n<div class='widgetopts-chldrn'>\n";
|
143 |
-
}
|
144 |
-
|
145 |
-
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
146 |
-
$output .= "</div>\n";
|
147 |
-
}
|
148 |
-
|
149 |
-
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
|
150 |
-
if ( $depth ){
|
151 |
-
$indent = str_repeat( '— ', $depth );
|
152 |
-
}else{
|
153 |
-
$indent = '';
|
154 |
-
}
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
if ( '' === $page->post_title ) {
|
159 |
-
$page->post_title = sprintf( __( '#%d (no title)', 'widget-options' ), $page->ID );
|
160 |
-
}
|
161 |
-
|
162 |
-
$pages_values = array();
|
163 |
-
if( isset( $args['params']['visibility']['pages'] ) ){
|
164 |
-
$pages_values = $args['params']['visibility']['pages'];
|
165 |
-
}
|
166 |
-
|
167 |
-
if( isset( $pages_values[ $page->ID ] ) && $pages_values[ $page->ID ] == '1' ){
|
168 |
-
$checked = 'checked="checked"';
|
169 |
-
}else{
|
170 |
-
$checked = '';
|
171 |
-
}
|
172 |
-
|
173 |
-
$output .= '<p>' . $indent;
|
174 |
-
|
175 |
-
$output .= '<input type="checkbox" name="'. $args['namespace'] .'[extended_widget_opts][visibility][pages]['. $page->ID .']" id="'. $args['id'] .'-opts-pages-'. $page->ID .'" value="1" '. $checked .'/>';
|
176 |
-
|
177 |
-
$output .= '<label for="'. $args['id'] .'-opts-pages-'. $page->ID .'">'. $page->post_title .'</label>';
|
178 |
-
}
|
179 |
-
|
180 |
-
function end_el( &$output, $page, $depth = 0, $args = array() ) {
|
181 |
-
$output .= "</p>\n";
|
182 |
-
}
|
183 |
-
|
184 |
-
}
|
185 |
-
endif;
|
186 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extra Functions
|
4 |
+
*
|
5 |
+
* Collections of extra functions to avoid repeatition
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
8 |
+
* @since 4.0
|
9 |
+
*/
|
10 |
+
|
11 |
+
function widgetopts_sanitize_array( &$array ) {
|
12 |
+
foreach ($array as &$value) {
|
13 |
+
if( !is_array($value) ) {
|
14 |
+
// sanitize if value is not an array
|
15 |
+
$value = sanitize_text_field( $value );
|
16 |
+
}else{
|
17 |
+
// go inside this function again
|
18 |
+
widgetopts_sanitize_array($value);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
return $array;
|
23 |
+
}
|
24 |
+
|
25 |
+
function widgetopts_is_checked( $array, $key ){
|
26 |
+
return ( isset( $array[$key] ) && '1' == $array[$key] ) ? 'checked="checked"' : '';
|
27 |
+
}
|
28 |
+
|
29 |
+
/*
|
30 |
+
* Check if http or https available on link
|
31 |
+
*/
|
32 |
+
function widgetopts_addhttp($url) {
|
33 |
+
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
|
34 |
+
$url = "http://" . $url;
|
35 |
+
}
|
36 |
+
return $url;
|
37 |
+
}
|
38 |
+
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Register Global Variables for easier access
|
42 |
+
*
|
43 |
+
*
|
44 |
+
* @since 5.0
|
45 |
+
* @return array
|
46 |
+
*/
|
47 |
+
function widgetopts_global_taxonomies() {
|
48 |
+
$taxonomies = get_option( 'widgetopts_global_taxonomies' );
|
49 |
+
|
50 |
+
if( empty( $taxonomies ) ) {
|
51 |
+
|
52 |
+
$tax_args = array(
|
53 |
+
'public' => true
|
54 |
+
);
|
55 |
+
$tax_output = 'objects'; // or objects
|
56 |
+
$tax_operator = 'and'; // 'and' or 'or'
|
57 |
+
$taxonomies = get_taxonomies( $tax_args, $tax_output, $tax_operator );
|
58 |
+
unset( $taxonomies['post_format'] );
|
59 |
+
|
60 |
+
// Let's let devs alter that value coming in
|
61 |
+
$taxonomies = apply_filters( 'widgetopts_update_global_taxonomies', $taxonomies );
|
62 |
+
update_option( 'widgetopts_global_taxonomies', $taxonomies );
|
63 |
+
|
64 |
+
}
|
65 |
+
|
66 |
+
return apply_filters( 'widgetopts_get_global_taxonomies', $taxonomies );
|
67 |
+
}
|
68 |
+
|
69 |
+
function widgetopts_global_types() {
|
70 |
+
/*$types = get_option( 'widgetopts_global_types' );
|
71 |
+
if( empty( $types ) ) {
|
72 |
+
$types = get_post_types( array(
|
73 |
+
'public' => true,
|
74 |
+
), 'object' );
|
75 |
+
// Let's let devs alter that value coming in
|
76 |
+
$types = apply_filters( 'widgetopts_update_global_types', $types );
|
77 |
+
update_option( 'widgetopts_global_types', $types );
|
78 |
+
}*/
|
79 |
+
|
80 |
+
$types = get_post_types(array('public' => true), 'object');
|
81 |
+
$types = apply_filters('widgetopts_update_global_types', $types);
|
82 |
+
|
83 |
+
return apply_filters( 'widgetopts_get_global_types', $types );
|
84 |
+
}
|
85 |
+
|
86 |
+
function widgetopts_global_pages() {
|
87 |
+
$pages = get_option( 'widgetopts_global_all_pages' );
|
88 |
+
|
89 |
+
//old pages object
|
90 |
+
// if( empty( $pages ) ) {
|
91 |
+
// $pages = get_posts( array(
|
92 |
+
// 'post_type' => 'page',
|
93 |
+
// 'post_status' => 'publish',
|
94 |
+
// 'numberposts' => -1,
|
95 |
+
// 'orderby' => 'title',
|
96 |
+
// 'order' => 'ASC',
|
97 |
+
// 'fields' => array('ID', 'name')
|
98 |
+
// ));
|
99 |
+
//
|
100 |
+
// // Let's let devs alter that value coming in
|
101 |
+
// $pages = apply_filters( 'widgetopts_update_global_pages', $pages );
|
102 |
+
// update_option( 'widgetopts_global_pages', $pages );
|
103 |
+
// }
|
104 |
+
|
105 |
+
//create new pages object
|
106 |
+
if( empty( $pages ) ) {
|
107 |
+
global $wpdb;
|
108 |
+
|
109 |
+
$pages = $wpdb->get_results("SELECT ID, post_title, post_parent FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' ORDER BY post_title ASC ");
|
110 |
+
|
111 |
+
// Let's let devs alter that value coming in
|
112 |
+
$pages = apply_filters( 'widgetopts_update_global_pages', $pages );
|
113 |
+
update_option( 'widgetopts_global_all_pages', $pages );
|
114 |
+
}
|
115 |
+
|
116 |
+
return apply_filters( 'widgetopts_get_global_pages', $pages );
|
117 |
+
}
|
118 |
+
|
119 |
+
function widgetopts_global_categories(){
|
120 |
+
$categories = get_option( 'widgetopts_global_categories' );
|
121 |
+
|
122 |
+
if( empty( $categories ) ) {
|
123 |
+
$categories = get_categories( array(
|
124 |
+
'hide_empty' => false
|
125 |
+
) );
|
126 |
+
|
127 |
+
// Let's let devs alter that value coming in
|
128 |
+
$categories = apply_filters( 'widgetopts_update_global_categories', $categories );
|
129 |
+
update_option( 'widgetopts_global_categories', $categories );
|
130 |
+
}
|
131 |
+
|
132 |
+
return apply_filters( 'widgetopts_global_categories', $categories );
|
133 |
+
}
|
134 |
+
|
135 |
+
/*
|
136 |
+
Page Walker Class
|
137 |
+
*/
|
138 |
+
if( !class_exists( 'WidgetOpts_Pages_Checkboxes' ) ):
|
139 |
+
class WidgetOpts_Pages_Checkboxes extends Walker_Page {
|
140 |
+
|
141 |
+
function start_lvl( &$output, $depth = 0, $args = array() ) {
|
142 |
+
$output .= "\n<div class='widgetopts-chldrn'>\n";
|
143 |
+
}
|
144 |
+
|
145 |
+
function end_lvl( &$output, $depth = 0, $args = array() ) {
|
146 |
+
$output .= "</div>\n";
|
147 |
+
}
|
148 |
+
|
149 |
+
function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {
|
150 |
+
if ( $depth ){
|
151 |
+
$indent = str_repeat( '— ', $depth );
|
152 |
+
}else{
|
153 |
+
$indent = '';
|
154 |
+
}
|
155 |
+
|
156 |
+
|
157 |
+
|
158 |
+
if ( '' === $page->post_title ) {
|
159 |
+
$page->post_title = sprintf( __( '#%d (no title)', 'widget-options' ), $page->ID );
|
160 |
+
}
|
161 |
+
|
162 |
+
$pages_values = array();
|
163 |
+
if( isset( $args['params']['visibility']['pages'] ) ){
|
164 |
+
$pages_values = $args['params']['visibility']['pages'];
|
165 |
+
}
|
166 |
+
|
167 |
+
if( isset( $pages_values[ $page->ID ] ) && $pages_values[ $page->ID ] == '1' ){
|
168 |
+
$checked = 'checked="checked"';
|
169 |
+
}else{
|
170 |
+
$checked = '';
|
171 |
+
}
|
172 |
+
|
173 |
+
$output .= '<p>' . $indent;
|
174 |
+
|
175 |
+
$output .= '<input type="checkbox" name="'. $args['namespace'] .'[extended_widget_opts][visibility][pages]['. $page->ID .']" id="'. $args['id'] .'-opts-pages-'. $page->ID .'" value="1" '. $checked .'/>';
|
176 |
+
|
177 |
+
$output .= '<label for="'. $args['id'] .'-opts-pages-'. $page->ID .'">'. $page->post_title .'</label>';
|
178 |
+
}
|
179 |
+
|
180 |
+
function end_el( &$output, $page, $depth = 0, $args = array() ) {
|
181 |
+
$output .= "</p>\n";
|
182 |
+
}
|
183 |
+
|
184 |
+
}
|
185 |
+
endif;
|
186 |
+
?>
|
includes/install.php
CHANGED
@@ -1,98 +1,98 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Install Function
|
4 |
-
*
|
5 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
6 |
-
* @since 3.0
|
7 |
-
*/
|
8 |
-
// Exit if accessed directly
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
-
|
11 |
-
//check if free version is activated
|
12 |
-
if( !function_exists( 'widgetopts_upgraded' ) ){
|
13 |
-
add_action( 'admin_notices', 'widgetopts_upgraded' );
|
14 |
-
function widgetopts_upgraded(){
|
15 |
-
if( is_plugin_active( 'widget-options/plugin.php' ) && is_plugin_active( 'extended-widget-options/plugin.php' ) ){ ?>
|
16 |
-
<div class="widgetopts_activated_notice notice-error notice" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
17 |
-
<p>
|
18 |
-
<?php _e( 'Please deactivate <strong>Widget Options</strong> Plugin, it may cause issue with the extended plugin version. Thanks!', 'widget-options' );?>
|
19 |
-
</p>
|
20 |
-
</div>
|
21 |
-
<?php }
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
//add settings link on plugin page
|
26 |
-
if( !function_exists( 'widgetopts_filter_plugin_actions' ) ){
|
27 |
-
add_action( 'plugin_action_links_' . plugin_basename( WIDGETOPTS_PLUGIN_FILE ) , 'widgetopts_filter_plugin_actions' );
|
28 |
-
function widgetopts_filter_plugin_actions($links){
|
29 |
-
|
30 |
-
if( !is_array( $links ) ){
|
31 |
-
$links = array();
|
32 |
-
}
|
33 |
-
|
34 |
-
$links[] = '<a href="'. esc_url( admin_url( 'options-general.php?page=widgetopts_plugin_settings' ) ) .'">' . __( 'Settings', 'widget-options' ) . '</a>';
|
35 |
-
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'pricing/?utm_source=upgradebtn&utm_medium=plugins&utm_campaign=widgetoptspluginlink');
|
36 |
-
$links[] = '<a href="'. esc_url($upgrade_link) .'" target="_blank" style="color: #3db634">' . __( 'Upgrade', 'widget-options' ) . '</a>';
|
37 |
-
return $links;
|
38 |
-
}
|
39 |
-
}
|
40 |
-
|
41 |
-
//register default values
|
42 |
-
if( !function_exists( 'widgetopts_register_defaults' ) ){
|
43 |
-
register_activation_hook( WIDGETOPTS_PLUGIN_FILE, 'widgetopts_register_defaults' );
|
44 |
-
add_action( 'plugins_loaded', 'widgetopts_register_defaults' );
|
45 |
-
function widgetopts_register_defaults(){
|
46 |
-
if( is_admin() ){
|
47 |
-
|
48 |
-
if( !get_option( 'widgetopts_installDate' ) ){
|
49 |
-
add_option( 'widgetopts_installDate', date( 'Y-m-d h:i:s' ) );
|
50 |
-
}
|
51 |
-
|
52 |
-
if( !get_option( '_widgetopts_default_registered_' ) ){
|
53 |
-
//activate free version modules
|
54 |
-
add_option( 'widgetopts_tabmodule-visibility', 'activate' );
|
55 |
-
add_option( 'widgetopts_tabmodule-devices', 'activate' );
|
56 |
-
add_option( 'widgetopts_tabmodule-alignment', 'activate' );
|
57 |
-
add_option( 'widgetopts_tabmodule-hide_title', 'activate' );
|
58 |
-
add_option( 'widgetopts_tabmodule-classes', 'activate' );
|
59 |
-
add_option( 'widgetopts_tabmodule-logic', 'activate' );
|
60 |
-
add_option( 'widgetopts_tabmodule-state', 'activate' );
|
61 |
-
add_option( 'widgetopts_tabmodule-classic_widgets_screen', 'activate' );
|
62 |
-
//add free version settings
|
63 |
-
$defaults = array(
|
64 |
-
'visibility' => array(
|
65 |
-
'post_type' => '1',
|
66 |
-
'taxonomies' => '1',
|
67 |
-
'misc' => '1'
|
68 |
-
),
|
69 |
-
'classes' => array(
|
70 |
-
'id' => '1',
|
71 |
-
'type' => 'both'
|
72 |
-
),
|
73 |
-
);
|
74 |
-
//upgraded settings from previous version
|
75 |
-
$options = get_option('extwopts_class_settings');
|
76 |
-
if( isset( $options['class_field'] ) ){
|
77 |
-
$defaults['classes']['type'] = $options['class_field'];
|
78 |
-
}
|
79 |
-
if( isset( $options['classlists'] ) ){
|
80 |
-
$defaults['classes']['classlists'] = $options['classlists'];
|
81 |
-
}
|
82 |
-
add_option( 'widgetopts_tabmodule-settings', serialize( $defaults ) );
|
83 |
-
add_option( '_widgetopts_default_registered_', '1' );
|
84 |
-
delete_transient( 'widgetopts_tabs_transient' ); //remove transient for settings
|
85 |
-
delete_option( 'widgetopts_settings' );
|
86 |
-
}
|
87 |
-
|
88 |
-
//make sure to delete previous pages cache
|
89 |
-
if( !get_option( 'widgetopts_removed_global_pages' ) ){
|
90 |
-
delete_option( 'widgetopts_global_pages' );
|
91 |
-
add_option( 'widgetopts_removed_global_pages', 1 );
|
92 |
-
}
|
93 |
-
|
94 |
-
}
|
95 |
-
}
|
96 |
-
}
|
97 |
-
|
98 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Install Function
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
6 |
+
* @since 3.0
|
7 |
+
*/
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
//check if free version is activated
|
12 |
+
if( !function_exists( 'widgetopts_upgraded' ) ){
|
13 |
+
add_action( 'admin_notices', 'widgetopts_upgraded' );
|
14 |
+
function widgetopts_upgraded(){
|
15 |
+
if( is_plugin_active( 'widget-options/plugin.php' ) && is_plugin_active( 'extended-widget-options/plugin.php' ) ){ ?>
|
16 |
+
<div class="widgetopts_activated_notice notice-error notice" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
17 |
+
<p>
|
18 |
+
<?php _e( 'Please deactivate <strong>Widget Options</strong> Plugin, it may cause issue with the extended plugin version. Thanks!', 'widget-options' );?>
|
19 |
+
</p>
|
20 |
+
</div>
|
21 |
+
<?php }
|
22 |
+
}
|
23 |
+
}
|
24 |
+
|
25 |
+
//add settings link on plugin page
|
26 |
+
if( !function_exists( 'widgetopts_filter_plugin_actions' ) ){
|
27 |
+
add_action( 'plugin_action_links_' . plugin_basename( WIDGETOPTS_PLUGIN_FILE ) , 'widgetopts_filter_plugin_actions' );
|
28 |
+
function widgetopts_filter_plugin_actions($links){
|
29 |
+
|
30 |
+
if( !is_array( $links ) ){
|
31 |
+
$links = array();
|
32 |
+
}
|
33 |
+
|
34 |
+
$links[] = '<a href="'. esc_url( admin_url( 'options-general.php?page=widgetopts_plugin_settings' ) ) .'">' . __( 'Settings', 'widget-options' ) . '</a>';
|
35 |
+
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'pricing/?utm_source=upgradebtn&utm_medium=plugins&utm_campaign=widgetoptspluginlink');
|
36 |
+
$links[] = '<a href="'. esc_url($upgrade_link) .'" target="_blank" style="color: #3db634">' . __( 'Upgrade', 'widget-options' ) . '</a>';
|
37 |
+
return $links;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
//register default values
|
42 |
+
if( !function_exists( 'widgetopts_register_defaults' ) ){
|
43 |
+
register_activation_hook( WIDGETOPTS_PLUGIN_FILE, 'widgetopts_register_defaults' );
|
44 |
+
add_action( 'plugins_loaded', 'widgetopts_register_defaults' );
|
45 |
+
function widgetopts_register_defaults(){
|
46 |
+
if( is_admin() ){
|
47 |
+
|
48 |
+
if( !get_option( 'widgetopts_installDate' ) ){
|
49 |
+
add_option( 'widgetopts_installDate', date( 'Y-m-d h:i:s' ) );
|
50 |
+
}
|
51 |
+
|
52 |
+
if( !get_option( '_widgetopts_default_registered_' ) ){
|
53 |
+
//activate free version modules
|
54 |
+
add_option( 'widgetopts_tabmodule-visibility', 'activate' );
|
55 |
+
add_option( 'widgetopts_tabmodule-devices', 'activate' );
|
56 |
+
add_option( 'widgetopts_tabmodule-alignment', 'activate' );
|
57 |
+
add_option( 'widgetopts_tabmodule-hide_title', 'activate' );
|
58 |
+
add_option( 'widgetopts_tabmodule-classes', 'activate' );
|
59 |
+
add_option( 'widgetopts_tabmodule-logic', 'activate' );
|
60 |
+
add_option( 'widgetopts_tabmodule-state', 'activate' );
|
61 |
+
add_option( 'widgetopts_tabmodule-classic_widgets_screen', 'activate' );
|
62 |
+
//add free version settings
|
63 |
+
$defaults = array(
|
64 |
+
'visibility' => array(
|
65 |
+
'post_type' => '1',
|
66 |
+
'taxonomies' => '1',
|
67 |
+
'misc' => '1'
|
68 |
+
),
|
69 |
+
'classes' => array(
|
70 |
+
'id' => '1',
|
71 |
+
'type' => 'both'
|
72 |
+
),
|
73 |
+
);
|
74 |
+
//upgraded settings from previous version
|
75 |
+
$options = get_option('extwopts_class_settings');
|
76 |
+
if( isset( $options['class_field'] ) ){
|
77 |
+
$defaults['classes']['type'] = $options['class_field'];
|
78 |
+
}
|
79 |
+
if( isset( $options['classlists'] ) ){
|
80 |
+
$defaults['classes']['classlists'] = $options['classlists'];
|
81 |
+
}
|
82 |
+
add_option( 'widgetopts_tabmodule-settings', serialize( $defaults ) );
|
83 |
+
add_option( '_widgetopts_default_registered_', '1' );
|
84 |
+
delete_transient( 'widgetopts_tabs_transient' ); //remove transient for settings
|
85 |
+
delete_option( 'widgetopts_settings' );
|
86 |
+
}
|
87 |
+
|
88 |
+
//make sure to delete previous pages cache
|
89 |
+
if( !get_option( 'widgetopts_removed_global_pages' ) ){
|
90 |
+
delete_option( 'widgetopts_global_pages' );
|
91 |
+
add_option( 'widgetopts_removed_global_pages', 1 );
|
92 |
+
}
|
93 |
+
|
94 |
+
}
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
?>
|
includes/pagebuilders/beaver/beaver.php
CHANGED
@@ -1,834 +1,834 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Widget Options for Beaver Builder
|
4 |
-
* Plugin URI: https://widget-options.com/
|
5 |
-
* Description: <strong>Requires <a href="https://wordpress.org/plugins/widget-options/" target="_blank">Widget Options Plugin</a></strong>! Extend functionalities to Beaver Builder for more visibility restriction options.
|
6 |
-
* Version: 1.0
|
7 |
-
* Author: Widget Options Team
|
8 |
-
* Author URI: https://widget-options.com/
|
9 |
-
* Text Domain: widget-options
|
10 |
-
* Domain Path: languages
|
11 |
-
*
|
12 |
-
* @category Widgets
|
13 |
-
* @author Widget Options Team
|
14 |
-
* @version 1.0
|
15 |
-
*/
|
16 |
-
// Exit if accessed directly.
|
17 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
18 |
-
if ( ! class_exists( 'WP_Widget_Options_Beaver' ) ) :
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Main WP_Widget_Options_Beaver Class.
|
22 |
-
*
|
23 |
-
* @since 1.0
|
24 |
-
*/
|
25 |
-
class WP_Widget_Options_Beaver {
|
26 |
-
|
27 |
-
public static function init() {
|
28 |
-
$class = __CLASS__;
|
29 |
-
new $class;
|
30 |
-
}
|
31 |
-
|
32 |
-
function __construct(){
|
33 |
-
global $widget_options;
|
34 |
-
|
35 |
-
add_filter( 'fl_builder_register_settings_form', array( &$this, 'widgetopts_beaver_settings' ), 10, 2 );
|
36 |
-
add_action( 'fl_builder_control_widgetopts-beaver-tabnav', array( &$this, 'fl_widgetopts_beaver_tabnav' ), 1, 4 );
|
37 |
-
add_action( 'wp_enqueue_scripts', array( &$this, 'fl_widgetopts_beaver_scripts' ));
|
38 |
-
add_action( 'fl_builder_control_widgetopts-select2', array( &$this, 'fl_widgetopts_beaver_select2' ), 1, 4 );
|
39 |
-
add_action( 'fl_builder_control_widgetopts-upgrade', array( &$this, 'fl_widgetopts_upgrade' ), 1, 4 );
|
40 |
-
// add_action( 'admin_notices', array( &$this, 'widgetopts_plugin_check' ) );
|
41 |
-
|
42 |
-
add_filter( 'fl_builder_is_node_visible', array( &$this, 'widgetopts_beaver_is_node_visible' ), 10, 2 );
|
43 |
-
}
|
44 |
-
|
45 |
-
function widgetopts_beaver_settings( $form, $id ){
|
46 |
-
if( !isset( $form['widgetopts'] ) && !is_admin() ){
|
47 |
-
//fix not registering global values
|
48 |
-
if( !function_exists( 'widgetopts_register_globals' ) ){
|
49 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/globals.php';
|
50 |
-
widgetopts_register_globals();
|
51 |
-
}
|
52 |
-
|
53 |
-
global $widget_options, $widgetopts_taxonomies, $widgetopts_types, $widgetopts_categories;
|
54 |
-
$widgetopts_pages = widgetopts_global_pages();
|
55 |
-
|
56 |
-
|
57 |
-
$sections = array();
|
58 |
-
$pages = ( !empty( $widgetopts_pages ) ) ? $widgetopts_pages : array();
|
59 |
-
$taxonomies = ( !empty( $widgetopts_taxonomies ) ) ? $widgetopts_taxonomies : array();
|
60 |
-
$types = ( !empty( $widgetopts_types ) ) ? $widgetopts_types : array();
|
61 |
-
$categories = ( !empty( $widgetopts_categories ) ) ? $widgetopts_categories : array();
|
62 |
-
|
63 |
-
$get_terms = array();
|
64 |
-
if( !empty( $widget_options['settings']['taxonomies'] ) && is_array( $widget_options['settings']['taxonomies'] ) ){
|
65 |
-
foreach ( $widget_options['settings']['taxonomies'] as $tax_opt => $vall ) {
|
66 |
-
$tax_name = 'widgetopts_taxonomy_'. str_replace( '-', '__', $tax_opt );
|
67 |
-
// global $$tax_name;
|
68 |
-
if( isset( $GLOBALS[ $tax_name ] ) ){
|
69 |
-
$get_terms[ $tax_opt ] = $GLOBALS[ $tax_name ];
|
70 |
-
}
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
// print_r( $pages ); die();
|
75 |
-
|
76 |
-
$sections[ 'widgetopts-fields' ] = array(
|
77 |
-
'fields' => array(
|
78 |
-
'widgetopts-tabnav' => array(
|
79 |
-
'type' => 'widgetopts-beaver-tabnav',
|
80 |
-
)
|
81 |
-
)
|
82 |
-
);
|
83 |
-
|
84 |
-
if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){
|
85 |
-
$visibility_fld = array();
|
86 |
-
|
87 |
-
$visibility_fld['widgetopts_visibility_show'] = array(
|
88 |
-
'type' => 'select',
|
89 |
-
'label' => __( 'Show or Hide', 'widget-options' ),
|
90 |
-
'options' => array(
|
91 |
-
'hide' => __( 'Hide on Selected Pages', 'widget-options' ),
|
92 |
-
'show' => __( 'Show on Selected Pages', 'widget-options' )
|
93 |
-
)
|
94 |
-
);
|
95 |
-
|
96 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) && '1' == $widget_options['settings']['visibility']['post_type'] ){
|
97 |
-
|
98 |
-
if( !empty( $pages ) ){
|
99 |
-
$pages_array = array();
|
100 |
-
foreach ( $pages as $page ) {
|
101 |
-
$pages_array[ $page->ID ] = $page->post_title;
|
102 |
-
}
|
103 |
-
|
104 |
-
$visibility_fld['widgetopts_visibility_pages'] = array(
|
105 |
-
'type' => 'widgetopts-select2',
|
106 |
-
'label' => __( 'Pages', 'widget-options' ),
|
107 |
-
'options' => $pages_array,
|
108 |
-
'multi-select' => true,
|
109 |
-
'description' => __( 'Click to search or select', 'widget-options' ),
|
110 |
-
);
|
111 |
-
}
|
112 |
-
|
113 |
-
if( !empty( $types ) ){
|
114 |
-
$types_array = array();
|
115 |
-
foreach ( $types as $ptype => $type ) {
|
116 |
-
$types_array[ $ptype ] = $type->labels->name;
|
117 |
-
}
|
118 |
-
|
119 |
-
$visibility_fld['widgetopts_visibility_types'] = array(
|
120 |
-
'type' => 'widgetopts-select2',
|
121 |
-
'label' => __( 'Post Types', 'widget-options' ),
|
122 |
-
'options' => $types_array,
|
123 |
-
'multi-select' => true,
|
124 |
-
'description' => __( 'Click to search or select', 'widget-options' )
|
125 |
-
);
|
126 |
-
}
|
127 |
-
}
|
128 |
-
|
129 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) && '1' == $widget_options['settings']['visibility']['taxonomies'] ){
|
130 |
-
// if( !empty( $widget_options['settings']['taxonomies'] ) && is_array( $widget_options['settings']['taxonomies'] ) ){
|
131 |
-
// foreach ( $widget_options['settings']['taxonomies'] as $tax_opt => $vallue ) {
|
132 |
-
// $term_array = array();
|
133 |
-
// // if( !empty( $get_terms ) ){
|
134 |
-
// foreach ( $get_terms[ $tax_opt ] as $get_term ) {
|
135 |
-
// $term_array[ $get_term->term_id ] = $get_term->name;
|
136 |
-
// }
|
137 |
-
|
138 |
-
// $visibility_fld['widgetopts_visibility_tax_'. $tax_opt] = array(
|
139 |
-
// 'type' => 'widgetopts-select2',
|
140 |
-
// 'label' => $taxonomies[ $tax_opt ]->label,
|
141 |
-
// 'options' => $term_array,
|
142 |
-
// 'multi-select' => true,
|
143 |
-
// 'description' => __( 'Click to search or select', 'widget-options' )
|
144 |
-
// );
|
145 |
-
// // }
|
146 |
-
// }
|
147 |
-
// }
|
148 |
-
|
149 |
-
if( !empty( $categories ) ){
|
150 |
-
$cat_array = array();
|
151 |
-
foreach ( $categories as $cat ) {
|
152 |
-
$cat_array[ $cat->cat_ID ] = $cat->cat_name;
|
153 |
-
}
|
154 |
-
|
155 |
-
$visibility_fld['widgetopts_visibility_tax_category'] = array(
|
156 |
-
'type' => 'widgetopts-select2',
|
157 |
-
'label' => __( 'Categories', 'widget-options' ),
|
158 |
-
'options' => $cat_array,
|
159 |
-
'multi-select' => true,
|
160 |
-
'description' => __( 'Click to search or select', 'widget-options' )
|
161 |
-
);
|
162 |
-
|
163 |
-
}
|
164 |
-
|
165 |
-
if( !empty( $taxonomies ) ){
|
166 |
-
$tax_array = array();
|
167 |
-
foreach ( $taxonomies as $taxonomy ) {
|
168 |
-
$tax_array[ $taxonomy->name ] = $taxonomy->label;
|
169 |
-
}
|
170 |
-
|
171 |
-
$visibility_fld['widgetopts_visibility_taxonomies'] = array(
|
172 |
-
'type' => 'widgetopts-select2',
|
173 |
-
'label' => __( 'Taxonomies', 'widget-options' ),
|
174 |
-
'options' => $tax_array,
|
175 |
-
'multi-select' => true,
|
176 |
-
'description' => __( 'Click to search or select', 'widget-options' )
|
177 |
-
);
|
178 |
-
}
|
179 |
-
}
|
180 |
-
|
181 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) && '1' == $widget_options['settings']['visibility']['misc'] ){
|
182 |
-
$visibility_fld['widgetopts_visibility_misc'] = array(
|
183 |
-
'type' => 'widgetopts-select2',
|
184 |
-
'label' => __( 'Miscellaneous', 'widget-options' ),
|
185 |
-
'options' => array(
|
186 |
-
'home' => __( 'Home/Front', 'widget-options' ),
|
187 |
-
'blog' => __( 'Blog', 'widget-options' ),
|
188 |
-
'archives' => __( 'Archives', 'widget-options' ),
|
189 |
-
'404' => __( '404', 'widget-options' ),
|
190 |
-
'search' => __( 'Search', 'widget-options' )
|
191 |
-
),
|
192 |
-
'multi-select' => true,
|
193 |
-
'description' => __( 'Click to search or select', 'widget-options' )
|
194 |
-
);
|
195 |
-
}
|
196 |
-
|
197 |
-
$sections[ 'widgetopts-visibility' ] = array(
|
198 |
-
'fields' => $visibility_fld
|
199 |
-
);
|
200 |
-
}
|
201 |
-
|
202 |
-
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ||
|
203 |
-
isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
204 |
-
$settings_fld = array();
|
205 |
-
|
206 |
-
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){
|
207 |
-
$settings_fld['widgetopts_settings_logic'] = array(
|
208 |
-
'type' => 'textarea',
|
209 |
-
'label' => __( 'Display Logic', 'widget-options' ),
|
210 |
-
'description' => __( '<small>PLEASE NOTE that the display logic you introduce is EVAL\'d directly. Anyone who has access to edit widget appearance will have the right to add any code, including malicious and possibly destructive functions. There is an optional filter "widget_options_logic_override" which you can use to bypass the EVAL with your own code if needed.</small>', 'widget-options' )
|
211 |
-
);
|
212 |
-
}
|
213 |
-
|
214 |
-
//ACF
|
215 |
-
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
216 |
-
$fields = array( '' => __( 'Select Field', 'widget-options' ) );
|
217 |
-
|
218 |
-
if ( function_exists( 'acf_get_field_groups' ) ) {
|
219 |
-
$groups = acf_get_field_groups();
|
220 |
-
if ( is_array( $groups ) ) {
|
221 |
-
foreach ( $groups as $group ) {
|
222 |
-
$fields_group = acf_get_fields( $group );
|
223 |
-
if( !empty( $fields_group ) ){
|
224 |
-
foreach ( $fields_group as $k => $fg ) {
|
225 |
-
$fields[ $fg['key'] ] = $fg['label'];
|
226 |
-
}
|
227 |
-
}
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}else{
|
231 |
-
$groups = apply_filters( 'acf/get_field_groups', array() );
|
232 |
-
if ( is_array( $groups ) ) {
|
233 |
-
foreach ( $groups as $group ) {
|
234 |
-
$fields_group = apply_filters( 'acf/field_group/get_fields', array(), $group['id'] );
|
235 |
-
if( !empty( $fields_group ) ){
|
236 |
-
foreach ( $fields_group as $k => $fg ) {
|
237 |
-
$fields[ $fg['key'] ] = $fg['label'];
|
238 |
-
}
|
239 |
-
}
|
240 |
-
}
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
$settings_fld['widgetopts_acf_visibility'] = array(
|
245 |
-
'type' => 'select',
|
246 |
-
'label' => __( 'Show or Hide based on Advanced Custom Field', 'widget-options' ),
|
247 |
-
'options' => array(
|
248 |
-
'hide' => __( 'Hide when Condition\'s Met', 'widget-options' ),
|
249 |
-
'show' => __( 'Show when Condition\'s Met', 'widget-options' )
|
250 |
-
)
|
251 |
-
);
|
252 |
-
|
253 |
-
$settings_fld['widgetopts_acf_field'] = array(
|
254 |
-
'type' => 'select',
|
255 |
-
'label' => __( 'Select ACF Field', 'widget-options' ),
|
256 |
-
'options' => $fields
|
257 |
-
);
|
258 |
-
|
259 |
-
$settings_fld['widgetopts_acf_condition'] = array(
|
260 |
-
'type' => 'select',
|
261 |
-
'label' => __( 'Select Condition', 'widget-options' ),
|
262 |
-
'options' => array(
|
263 |
-
'' => __( 'Select Condition', 'widget-options' ),
|
264 |
-
'equal' => __( 'Is Equal To', 'widget-options' ),
|
265 |
-
'not_equal' => __( 'Is Not Equal To', 'widget-options' ),
|
266 |
-
'contains' => __( 'Contains', 'widget-options' ),
|
267 |
-
'not_contains' => __( 'Does Not Contain', 'widget-options' ),
|
268 |
-
'empty' => __( 'Is Empty', 'widget-options' ),
|
269 |
-
'not_empty' => __( 'Is Not Empty', 'widget-options' )
|
270 |
-
)
|
271 |
-
);
|
272 |
-
$settings_fld['widgetopts_acf_value'] = array(
|
273 |
-
'type' => 'textarea',
|
274 |
-
'label' => __( 'Conditional Value', 'widget-options' ),
|
275 |
-
'description' => __( 'Add your Conditional Value here if you selected Equal to, Not Equal To or Contains on the selection above.', 'widget-options' )
|
276 |
-
);
|
277 |
-
}
|
278 |
-
|
279 |
-
$sections[ 'widgetopts-settings' ] = array(
|
280 |
-
'fields' => $settings_fld
|
281 |
-
);
|
282 |
-
}
|
283 |
-
|
284 |
-
$upgrade_fld = array();
|
285 |
-
$upgrade_fld['widgetopts_upgrade_section'] = array(
|
286 |
-
'type' => 'widgetopts-upgrade'
|
287 |
-
);
|
288 |
-
|
289 |
-
$sections[ 'widgetopts-upgrade' ] = array(
|
290 |
-
'fields' => $upgrade_fld
|
291 |
-
);
|
292 |
-
|
293 |
-
$form['widgetopts'] = array(
|
294 |
-
'title' => __( 'Widget Options', 'widget-options' ),
|
295 |
-
'sections' => $sections
|
296 |
-
);
|
297 |
-
}
|
298 |
-
|
299 |
-
return $form;
|
300 |
-
}
|
301 |
-
|
302 |
-
function fl_widgetopts_beaver_tabnav($name, $value, $field, $settings) {
|
303 |
-
global $widget_options;
|
304 |
-
?>
|
305 |
-
<div class="fl-builder-widgetopts-tab">
|
306 |
-
<?php if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){ ?>
|
307 |
-
<a href="#fl-builder-settings-section-widgetopts-visibility" class="widgetopts-s-active"><span class="dashicons dashicons-visibility"></span><?php _e( 'Visibility', 'widget-options' );?></a>
|
308 |
-
<?php } ?>
|
309 |
-
<?php if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){ ?>
|
310 |
-
<a href="#fl-builder-settings-section-widgetopts-settings" class="<?php echo ( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ) ? '' : 'widgetopts-s-active';?>"><span class="dashicons dashicons-admin-generic"></span><?php _e( 'Settings', 'widget-options' );?></a>
|
311 |
-
<?php } ?>
|
312 |
-
<a href="#fl-builder-settings-section-widgetopts-upgrade"><span class="dashicons dashicons-plus"></span><?php _e( 'More', 'widget-options' );?></a>
|
313 |
-
</div>
|
314 |
-
<?php }
|
315 |
-
|
316 |
-
function fl_widgetopts_beaver_scripts(){
|
317 |
-
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) {
|
318 |
-
$js_dir = WIDGETOPTS_PLUGIN_URL . 'assets/js/';
|
319 |
-
$css_dir = WIDGETOPTS_PLUGIN_URL . 'assets/css/';
|
320 |
-
|
321 |
-
// Use minified libraries if SCRIPT_DEBUG is turned off
|
322 |
-
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
323 |
-
|
324 |
-
wp_enqueue_style( 'widgetopts-beaver-css', $css_dir . 'beaver-widgetopts.css' , array(), null );
|
325 |
-
wp_enqueue_style( 'widgetopts-beaver-select2-css', $css_dir . 'select2.min.css' , array(), null );
|
326 |
-
|
327 |
-
wp_enqueue_script(
|
328 |
-
'beaver-widgetopts',
|
329 |
-
$js_dir .'jquery.widgetopts.beaver'. $suffix .'.js',
|
330 |
-
array( 'jquery' ),
|
331 |
-
'',
|
332 |
-
true
|
333 |
-
);
|
334 |
-
wp_enqueue_script(
|
335 |
-
'beaver-widgetopts-select2',
|
336 |
-
$js_dir .'select2.min.js',
|
337 |
-
array( 'jquery', 'beaver-widgetopts' ),
|
338 |
-
'',
|
339 |
-
true
|
340 |
-
);
|
341 |
-
wp_enqueue_script(
|
342 |
-
'beaver-widgetopts-s2',
|
343 |
-
$js_dir .'select2-settings'. $suffix .'.js',
|
344 |
-
array( 'jquery', 'beaver-widgetopts' ),
|
345 |
-
'',
|
346 |
-
true
|
347 |
-
);
|
348 |
-
}
|
349 |
-
}
|
350 |
-
|
351 |
-
function fl_widgetopts_beaver_get_fld_options($settings, $field, $options = array()) {
|
352 |
-
if(!is_object($settings) && !is_array($settings)) return $options;
|
353 |
-
|
354 |
-
foreach($settings as $key=>$val) {
|
355 |
-
if($key === $field) {
|
356 |
-
if(is_array($val)) {
|
357 |
-
foreach($val as $v) {
|
358 |
-
$options[$v] = $v;
|
359 |
-
}
|
360 |
-
} else {
|
361 |
-
$options[$val] = $val;
|
362 |
-
}
|
363 |
-
}else{
|
364 |
-
if(is_array($val) || is_object($val)){
|
365 |
-
$options = $this->fl_widgetopts_beaver_get_fld_options($val, $field, $options);
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
|
370 |
-
return array_unique($options);
|
371 |
-
}
|
372 |
-
|
373 |
-
function fl_widgetopts_beaver_select2( $name, $value, $field, $settings ) {
|
374 |
-
$options = ( $field['options'] ) ? $field['options'] : array();
|
375 |
-
|
376 |
-
if( isset( $field['options_from_field'] ) ) {
|
377 |
-
$options_field = $field['options_from_field'];
|
378 |
-
$post_data = FLBuilderModel::get_post_data();
|
379 |
-
$parent_settings = $post_data['node_settings'];
|
380 |
-
|
381 |
-
$options = $this->fl_widgetopts_beaver_get_fld_options($parent_settings, $options_field, $options);
|
382 |
-
}
|
383 |
-
|
384 |
-
// Create attributes
|
385 |
-
$attributes = '';
|
386 |
-
if( isset( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
|
387 |
-
foreach($field['attributes'] as $key=>$val) {
|
388 |
-
$attributes .= $key .'="'. $val .'" ';
|
389 |
-
}
|
390 |
-
}
|
391 |
-
|
392 |
-
if(!empty($options) && $value) {
|
393 |
-
uksort($options, function($key1, $key2) use ($value) {
|
394 |
-
return (array_search($key1, $value) > array_search($key2, $value));
|
395 |
-
});
|
396 |
-
}
|
397 |
-
if( !isset( $field['class'] ) ){
|
398 |
-
$field['class'] = '';
|
399 |
-
}
|
400 |
-
|
401 |
-
// Show the select field
|
402 |
-
?>
|
403 |
-
<select name="<?php echo $name; if( isset( $field['multi-select'] ) ) echo '[]'; ?>" class="widgetopts-select2 <?php echo $field['class']; ?>" <?php if( isset( $field['multi-select'] ) ) echo 'multiple '; echo $attributes; ?> placeholder="<?php _e( 'Click to search or select', 'widget-options' );?>" >
|
404 |
-
<option></option>
|
405 |
-
<?php
|
406 |
-
foreach ( $options as $option_key => $option_val ) :
|
407 |
-
|
408 |
-
if ( is_array( $option_val ) && isset( $option_val['premium' ] ) && $option_val['premium'] && true === FL_BUILDER_LITE ) {
|
409 |
-
continue;
|
410 |
-
}
|
411 |
-
|
412 |
-
$label = is_array( $option_val ) ? $option_val['label'] : $option_val;
|
413 |
-
|
414 |
-
if ( is_array( $value ) && in_array( $option_key, $value ) ) {
|
415 |
-
$selected = ' selected="selected"';
|
416 |
-
}else if ( ! is_array( $value ) && selected( $value, $option_key, true ) ) {
|
417 |
-
$selected = ' selected="selected"';
|
418 |
-
} else {
|
419 |
-
$selected = '';
|
420 |
-
}
|
421 |
-
|
422 |
-
?>
|
423 |
-
<option value="<?php echo $option_key; ?>" <?php echo $selected; ?>><?php echo $label; ?></option>
|
424 |
-
<?php endforeach; ?>
|
425 |
-
</select>
|
426 |
-
<?php }
|
427 |
-
|
428 |
-
function fl_widgetopts_upgrade( $name, $value, $field, $settings ) { ?>
|
429 |
-
<div class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-gopro">
|
430 |
-
<p class="widgetopts-unlock-features">
|
431 |
-
<span class="dashicons dashicons-lock"></span><?php _e( 'Unlock all Options', 'widget-options' );?>
|
432 |
-
</p>
|
433 |
-
<p>
|
434 |
-
<?php _e( 'Get the world\'s most complete widget management now with Beaver Builder integration! Upgrade to extended version to get:', 'widget-options' );?>
|
435 |
-
</p>
|
436 |
-
<ul>
|
437 |
-
<li>
|
438 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Animation Options', 'widget-options' );?>
|
439 |
-
</li>
|
440 |
-
<li>
|
441 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Custom Styling Options', 'widget-options' );?>
|
442 |
-
</li>
|
443 |
-
<li>
|
444 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Set Alignment per Devices', 'widget-options' );?>
|
445 |
-
</li>
|
446 |
-
<li>
|
447 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'User Roles Visibility Restriction', 'widget-options' );?>
|
448 |
-
</li>
|
449 |
-
<li>
|
450 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Fixed/Sticky Widget Options', 'widget-options' );?>
|
451 |
-
</li>
|
452 |
-
<li>
|
453 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Days and Date Range Restriction', 'widget-options' );?>
|
454 |
-
</li>
|
455 |
-
<li>
|
456 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Link Module Block Options', 'widget-options' );?>
|
457 |
-
</li>
|
458 |
-
<li>
|
459 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Extended Taxonomy and Post Types Support', 'widget-options' );?>
|
460 |
-
</li>
|
461 |
-
<li>
|
462 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Target URLs and Wildcard Restrictions', 'widget-options' );?>
|
463 |
-
</li>
|
464 |
-
<li>
|
465 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Beaver Builder Support', 'widget-options' );?>
|
466 |
-
</li>
|
467 |
-
</ul>
|
468 |
-
<p><strong><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=beaverbuilder&utm_medium=learnmore&utm_campaign=widgetoptsprotab');?>" class="button-primary" target="_blank"><?php _e( 'Learn More', 'widget-options' );?></a></strong></p>
|
469 |
-
</div>
|
470 |
-
<?php }
|
471 |
-
|
472 |
-
function widgetopts_beaver_is_node_visible( $is_visible, $node ){
|
473 |
-
|
474 |
-
//return if editing
|
475 |
-
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) {
|
476 |
-
return $is_visible;
|
477 |
-
}
|
478 |
-
|
479 |
-
global $widget_options;
|
480 |
-
|
481 |
-
$settings = $node->settings;
|
482 |
-
$hidden = false;
|
483 |
-
$visibility_opts = isset( $settings->widgetopts_visibility_show ) ? $settings->widgetopts_visibility_show : 'hide';
|
484 |
-
|
485 |
-
$tax_opts = ( isset( $widget_options['settings'] ) && isset( $widget_options['settings']['taxonomies_keys'] ) ) ? $widget_options['settings']['taxonomies_keys'] : array();
|
486 |
-
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
487 |
-
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
488 |
-
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
489 |
-
$is_inherit = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['inherit'] ) ) ? true : false;
|
490 |
-
|
491 |
-
// echo '<pre>';
|
492 |
-
// print_r( $settings );
|
493 |
-
// echo '</pre>';
|
494 |
-
|
495 |
-
//pages
|
496 |
-
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
497 |
-
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'home', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
498 |
-
$hidden = true; //hide if checked on hidden pages
|
499 |
-
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'home', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
500 |
-
$hidden = true; //hide if not checked on visible pages
|
501 |
-
}
|
502 |
-
|
503 |
-
//do return to bypass other conditions
|
504 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_home', $hidden );
|
505 |
-
if( $hidden ){
|
506 |
-
return false;
|
507 |
-
}
|
508 |
-
}elseif ( $is_misc && is_home() ) {
|
509 |
-
//NOT CHECKED YET
|
510 |
-
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'blog', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
511 |
-
$hidden = true; //hide if checked on hidden pages
|
512 |
-
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'blog', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
513 |
-
$hidden = true; //hide if not checked on visible pages
|
514 |
-
}
|
515 |
-
|
516 |
-
//do return to bypass other conditions
|
517 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_blog', $hidden );
|
518 |
-
if( $hidden ){
|
519 |
-
return false;
|
520 |
-
}
|
521 |
-
}elseif ( $is_tax && is_tag() ) {
|
522 |
-
|
523 |
-
if( !isset( $settings->widgetopts_visibility_taxonomies ) || ( isset( $settings->widgetopts_visibility_taxonomies ) && !is_array( $settings->widgetopts_visibility_taxonomies ) ) ){
|
524 |
-
$settings->widgetopts_visibility_taxonomies = array();
|
525 |
-
}
|
526 |
-
|
527 |
-
if( in_array( 'post_tag', $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'hide' ){
|
528 |
-
$hidden = true; //hide to all tags
|
529 |
-
}elseif( in_array( 'post_tag', $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'show' ){
|
530 |
-
$hidden = false; //hide to all tags
|
531 |
-
}
|
532 |
-
//
|
533 |
-
// //do return to bypass other conditions
|
534 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_tags', $hidden );
|
535 |
-
if( $hidden ){
|
536 |
-
return false;
|
537 |
-
}
|
538 |
-
}elseif ( $is_tax && is_tax() ) {
|
539 |
-
$term = get_queried_object();
|
540 |
-
//taxonomies page
|
541 |
-
if( !isset( $settings->widgetopts_visibility_taxonomies ) || ( isset( $settings->widgetopts_visibility_taxonomies ) && !is_array( $settings->widgetopts_visibility_taxonomies ) ) ){
|
542 |
-
$settings->widgetopts_visibility_taxonomies = array();
|
543 |
-
}
|
544 |
-
// print_r( $term_lists );
|
545 |
-
if( in_array( $term->taxonomy, $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'hide' ){
|
546 |
-
$hidden = true; //hide to all tags
|
547 |
-
}elseif( !in_array( $term->taxonomy, $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'show' ){
|
548 |
-
$hidden = true; //hide to all tags
|
549 |
-
}
|
550 |
-
|
551 |
-
//do return to bypass other conditions
|
552 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_taxonomies', $hidden );
|
553 |
-
if( $hidden ){
|
554 |
-
return false;
|
555 |
-
}
|
556 |
-
}elseif ( $is_misc && is_archive() ) {
|
557 |
-
//archives page
|
558 |
-
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'archives', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
559 |
-
$hidden = true; //hide if checked on hidden pages
|
560 |
-
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'archives', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
561 |
-
$hidden = true; //hide if not checked on visible pages
|
562 |
-
}
|
563 |
-
|
564 |
-
//do return to bypass other conditions
|
565 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_archives', $hidden );
|
566 |
-
if( $hidden ){
|
567 |
-
return false;
|
568 |
-
}
|
569 |
-
}elseif ( $is_misc && is_404() ) {
|
570 |
-
//404 page
|
571 |
-
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( '404', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
572 |
-
$hidden = true; //hide if checked on hidden pages
|
573 |
-
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( '404', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
574 |
-
$hidden = true; //hide if not checked on visible pages
|
575 |
-
}
|
576 |
-
|
577 |
-
//do return to bypass other conditions
|
578 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_404', $hidden );
|
579 |
-
if( $hidden ){
|
580 |
-
return false;
|
581 |
-
}
|
582 |
-
}elseif ( $is_misc && is_search() ) {
|
583 |
-
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'search', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
584 |
-
$hidden = true; //hide if checked on hidden pages
|
585 |
-
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'search', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
586 |
-
$hidden = true;
|
587 |
-
}
|
588 |
-
|
589 |
-
//do return to bypass other conditions
|
590 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_search', $hidden );
|
591 |
-
if( $hidden ){
|
592 |
-
return false;
|
593 |
-
}
|
594 |
-
}elseif ( is_single() && !is_page() ) {
|
595 |
-
global $wp_query;
|
596 |
-
$post = $wp_query->post;
|
597 |
-
|
598 |
-
if( !isset( $settings->widgetopts_visibility_types ) || ( $is_types && !isset( $settings->widgetopts_visibility_types ) ) || !is_array( $settings->widgetopts_visibility_types ) ){
|
599 |
-
$settings->widgetopts_visibility_types = array();
|
600 |
-
}
|
601 |
-
|
602 |
-
if( $visibility_opts == 'hide' && in_array( $post->post_type , $settings->widgetopts_visibility_types ) ){
|
603 |
-
$hidden = true; //hide if exists on hidden pages
|
604 |
-
}elseif( $visibility_opts == 'show' && !in_array( $post->post_type , $settings->widgetopts_visibility_types ) ){
|
605 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
606 |
-
}
|
607 |
-
|
608 |
-
// do return to bypass other conditions
|
609 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_single', $hidden );
|
610 |
-
|
611 |
-
|
612 |
-
// $taxonomy_names = get_post_taxonomies( $post->ID );
|
613 |
-
// $array_intersect = array_intersect( $tax_opts, $taxonomy_names );
|
614 |
-
|
615 |
-
if( !isset( $settings->widgetopts_visibility_tax_category ) ){
|
616 |
-
$settings->widgetopts_visibility_tax_category = array();
|
617 |
-
}
|
618 |
-
|
619 |
-
if( isset( $settings->widgetopts_visibility_tax_category ) && !empty( $settings->widgetopts_visibility_tax_category ) ){
|
620 |
-
$cats = wp_get_post_categories( $post->ID );
|
621 |
-
|
622 |
-
if( is_array( $cats ) && !empty( $cats ) ){
|
623 |
-
$checked_cats = $settings->widgetopts_visibility_tax_category;
|
624 |
-
$intersect = array_intersect( $cats , $checked_cats );
|
625 |
-
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
626 |
-
$hidden = true;
|
627 |
-
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
628 |
-
$hidden = false;
|
629 |
-
}
|
630 |
-
|
631 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_single_category', $hidden );
|
632 |
-
}
|
633 |
-
}
|
634 |
-
|
635 |
-
if( $hidden ){
|
636 |
-
return false;
|
637 |
-
}
|
638 |
-
}elseif ( $is_types && is_page() ) {
|
639 |
-
global $wp_query;
|
640 |
-
|
641 |
-
$post = $wp_query->post;
|
642 |
-
|
643 |
-
//do post type condition first
|
644 |
-
if( isset( $settings->widgetopts_visibility_types ) && is_array( $settings->widgetopts_visibility_types ) && in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
645 |
-
|
646 |
-
if( !is_array( $settings->widgetopts_visibility_types ) ){
|
647 |
-
$settings->widgetopts_visibility_types = array();
|
648 |
-
}
|
649 |
-
|
650 |
-
if( $visibility_opts == 'hide' && in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
651 |
-
$hidden = true; //hide if exists on hidden pages
|
652 |
-
}elseif( $visibility_opts == 'show' && !in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
653 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
654 |
-
}
|
655 |
-
}else{
|
656 |
-
// print_r( $settings['widgetopts_pages'] );
|
657 |
-
//do per pages condition
|
658 |
-
if( !isset( $settings->widgetopts_visibility_pages ) || ( isset( $settings->widgetopts_visibility_pages ) && !is_array( $settings->widgetopts_visibility_pages ) ) ){
|
659 |
-
$settings->widgetopts_visibility_pages = array();
|
660 |
-
}
|
661 |
-
|
662 |
-
if( $visibility_opts == 'hide' && in_array( $post->ID , $settings->widgetopts_visibility_pages ) ){
|
663 |
-
$hidden = true; //hide if exists on hidden pages
|
664 |
-
}elseif( $visibility_opts == 'show' && !in_array( $post->ID , $settings->widgetopts_visibility_pages ) ){
|
665 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
666 |
-
}
|
667 |
-
}
|
668 |
-
|
669 |
-
// //do return to bypass other conditions
|
670 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_page', $hidden );
|
671 |
-
if( $hidden ){
|
672 |
-
return false;
|
673 |
-
}
|
674 |
-
}
|
675 |
-
|
676 |
-
//ACF
|
677 |
-
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
678 |
-
if( isset( $settings->widgetopts_acf_field ) && !empty( $settings->widgetopts_acf_field ) ){
|
679 |
-
$acf = get_field_object( $settings->widgetopts_acf_field );
|
680 |
-
if( $acf && is_array( $acf ) ){
|
681 |
-
$acf_visibility = isset( $settings->widgetopts_acf_visibility ) ? $settings->widgetopts_acf_visibility : 'hide';
|
682 |
-
|
683 |
-
//handle repeater fields
|
684 |
-
if( isset( $acf['value'] ) ){
|
685 |
-
if( is_array( $acf['value'] ) ){
|
686 |
-
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
687 |
-
$acf_implode = '';
|
688 |
-
if( is_array( $acf_array_value ) ){
|
689 |
-
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
690 |
-
}
|
691 |
-
return $acf_implode;
|
692 |
-
}, $acf['value']));
|
693 |
-
}
|
694 |
-
}
|
695 |
-
|
696 |
-
switch ( $settings->widgetopts_acf_condition ) {
|
697 |
-
case 'equal':
|
698 |
-
if( isset( $acf['value'] ) ){
|
699 |
-
if( 'show' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
700 |
-
$hidden = false;
|
701 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
702 |
-
$hidden = true;
|
703 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
704 |
-
$hidden = true;
|
705 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
706 |
-
$hidden = false;
|
707 |
-
}
|
708 |
-
}
|
709 |
-
break;
|
710 |
-
|
711 |
-
case 'not_equal':
|
712 |
-
if( isset( $acf['value'] ) ){
|
713 |
-
if( 'show' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
714 |
-
$hidden = true;
|
715 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
716 |
-
$hidden = false;
|
717 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
718 |
-
$hidden = false;
|
719 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
720 |
-
$hidden = true;
|
721 |
-
}
|
722 |
-
}
|
723 |
-
break;
|
724 |
-
|
725 |
-
case 'contains':
|
726 |
-
if( isset( $acf['value'] ) ){
|
727 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
728 |
-
$hidden = false;
|
729 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
730 |
-
$hidden = true;
|
731 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
732 |
-
$hidden = true;
|
733 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
734 |
-
$hidden = false;
|
735 |
-
}
|
736 |
-
}
|
737 |
-
break;
|
738 |
-
|
739 |
-
case 'not_contains':
|
740 |
-
if( isset( $acf['value'] ) ){
|
741 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
742 |
-
$hidden = true;
|
743 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
744 |
-
$hidden = false;
|
745 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
746 |
-
$hidden = false;
|
747 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
748 |
-
$hidden = true;
|
749 |
-
}
|
750 |
-
}
|
751 |
-
break;
|
752 |
-
|
753 |
-
case 'empty':
|
754 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
755 |
-
$hidden = false;
|
756 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
757 |
-
$hidden = true;
|
758 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
759 |
-
$hidden = true;
|
760 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
761 |
-
$hidden = false;
|
762 |
-
}
|
763 |
-
break;
|
764 |
-
|
765 |
-
case 'not_empty':
|
766 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
767 |
-
$hidden = true;
|
768 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
769 |
-
$hidden = false;
|
770 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
771 |
-
$hidden = false;
|
772 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
773 |
-
$hidden = true;
|
774 |
-
}
|
775 |
-
break;
|
776 |
-
|
777 |
-
default:
|
778 |
-
# code...
|
779 |
-
break;
|
780 |
-
}
|
781 |
-
|
782 |
-
// //do return to bypass other conditions
|
783 |
-
$hidden = apply_filters( 'widgetopts_beaver_visibility_acf', $hidden );
|
784 |
-
if( $hidden ){
|
785 |
-
return false;
|
786 |
-
}
|
787 |
-
}
|
788 |
-
}
|
789 |
-
}
|
790 |
-
|
791 |
-
//widget logic
|
792 |
-
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){
|
793 |
-
if( isset( $settings->widgetopts_settings_logic ) && !empty( $settings->widgetopts_settings_logic ) ){
|
794 |
-
//do widget logic
|
795 |
-
$display_logic = stripslashes( trim( $settings->widgetopts_settings_logic ) );
|
796 |
-
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
797 |
-
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
798 |
-
if ( $display_logic === false ){
|
799 |
-
return false;
|
800 |
-
}
|
801 |
-
if ( $display_logic === true ){
|
802 |
-
return $content;
|
803 |
-
}
|
804 |
-
if ( stristr($display_logic,"return")===false ){
|
805 |
-
$display_logic="return (" . $display_logic . ");";
|
806 |
-
}
|
807 |
-
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
808 |
-
try {
|
809 |
-
if ( !eval( $display_logic ) ){
|
810 |
-
return false;
|
811 |
-
}
|
812 |
-
} catch (ParseError $e) {
|
813 |
-
return false;
|
814 |
-
}
|
815 |
-
}
|
816 |
-
}
|
817 |
-
|
818 |
-
return $is_visible;
|
819 |
-
}
|
820 |
-
function widgetopts_plugin_check(){
|
821 |
-
if ( ! defined( 'WIDGETOPTS_PLUGIN_NAME' ) ) { ?>
|
822 |
-
<div class="widgetopts_activated_notice notice-error notice" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
823 |
-
<p>
|
824 |
-
<?php _e( '<strong>Widget Options Plugin</strong> is required for the <em>Widget Options for Beaver Builder</em> to work properly. Please get the plugin <a href="https://wordpress.org/plugins/widget-options/" target="_blank">here</a>. Thanks!', 'widget-options' );?>
|
825 |
-
</p>
|
826 |
-
</div>
|
827 |
-
<?php }
|
828 |
-
}
|
829 |
-
}
|
830 |
-
|
831 |
-
add_action( 'plugins_loaded', array( 'WP_Widget_Options_Beaver', 'init' ));
|
832 |
-
// new WP_Widget_Options_Beaver();
|
833 |
-
|
834 |
-
endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Widget Options for Beaver Builder
|
4 |
+
* Plugin URI: https://widget-options.com/
|
5 |
+
* Description: <strong>Requires <a href="https://wordpress.org/plugins/widget-options/" target="_blank">Widget Options Plugin</a></strong>! Extend functionalities to Beaver Builder for more visibility restriction options.
|
6 |
+
* Version: 1.0
|
7 |
+
* Author: Widget Options Team
|
8 |
+
* Author URI: https://widget-options.com/
|
9 |
+
* Text Domain: widget-options
|
10 |
+
* Domain Path: languages
|
11 |
+
*
|
12 |
+
* @category Widgets
|
13 |
+
* @author Widget Options Team
|
14 |
+
* @version 1.0
|
15 |
+
*/
|
16 |
+
// Exit if accessed directly.
|
17 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
18 |
+
if ( ! class_exists( 'WP_Widget_Options_Beaver' ) ) :
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Main WP_Widget_Options_Beaver Class.
|
22 |
+
*
|
23 |
+
* @since 1.0
|
24 |
+
*/
|
25 |
+
class WP_Widget_Options_Beaver {
|
26 |
+
|
27 |
+
public static function init() {
|
28 |
+
$class = __CLASS__;
|
29 |
+
new $class;
|
30 |
+
}
|
31 |
+
|
32 |
+
function __construct(){
|
33 |
+
global $widget_options;
|
34 |
+
|
35 |
+
add_filter( 'fl_builder_register_settings_form', array( &$this, 'widgetopts_beaver_settings' ), 10, 2 );
|
36 |
+
add_action( 'fl_builder_control_widgetopts-beaver-tabnav', array( &$this, 'fl_widgetopts_beaver_tabnav' ), 1, 4 );
|
37 |
+
add_action( 'wp_enqueue_scripts', array( &$this, 'fl_widgetopts_beaver_scripts' ));
|
38 |
+
add_action( 'fl_builder_control_widgetopts-select2', array( &$this, 'fl_widgetopts_beaver_select2' ), 1, 4 );
|
39 |
+
add_action( 'fl_builder_control_widgetopts-upgrade', array( &$this, 'fl_widgetopts_upgrade' ), 1, 4 );
|
40 |
+
// add_action( 'admin_notices', array( &$this, 'widgetopts_plugin_check' ) );
|
41 |
+
|
42 |
+
add_filter( 'fl_builder_is_node_visible', array( &$this, 'widgetopts_beaver_is_node_visible' ), 10, 2 );
|
43 |
+
}
|
44 |
+
|
45 |
+
function widgetopts_beaver_settings( $form, $id ){
|
46 |
+
if( !isset( $form['widgetopts'] ) && !is_admin() ){
|
47 |
+
//fix not registering global values
|
48 |
+
if( !function_exists( 'widgetopts_register_globals' ) ){
|
49 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/globals.php';
|
50 |
+
widgetopts_register_globals();
|
51 |
+
}
|
52 |
+
|
53 |
+
global $widget_options, $widgetopts_taxonomies, $widgetopts_types, $widgetopts_categories;
|
54 |
+
$widgetopts_pages = widgetopts_global_pages();
|
55 |
+
|
56 |
+
|
57 |
+
$sections = array();
|
58 |
+
$pages = ( !empty( $widgetopts_pages ) ) ? $widgetopts_pages : array();
|
59 |
+
$taxonomies = ( !empty( $widgetopts_taxonomies ) ) ? $widgetopts_taxonomies : array();
|
60 |
+
$types = ( !empty( $widgetopts_types ) ) ? $widgetopts_types : array();
|
61 |
+
$categories = ( !empty( $widgetopts_categories ) ) ? $widgetopts_categories : array();
|
62 |
+
|
63 |
+
$get_terms = array();
|
64 |
+
if( !empty( $widget_options['settings']['taxonomies'] ) && is_array( $widget_options['settings']['taxonomies'] ) ){
|
65 |
+
foreach ( $widget_options['settings']['taxonomies'] as $tax_opt => $vall ) {
|
66 |
+
$tax_name = 'widgetopts_taxonomy_'. str_replace( '-', '__', $tax_opt );
|
67 |
+
// global $$tax_name;
|
68 |
+
if( isset( $GLOBALS[ $tax_name ] ) ){
|
69 |
+
$get_terms[ $tax_opt ] = $GLOBALS[ $tax_name ];
|
70 |
+
}
|
71 |
+
}
|
72 |
+
}
|
73 |
+
|
74 |
+
// print_r( $pages ); die();
|
75 |
+
|
76 |
+
$sections[ 'widgetopts-fields' ] = array(
|
77 |
+
'fields' => array(
|
78 |
+
'widgetopts-tabnav' => array(
|
79 |
+
'type' => 'widgetopts-beaver-tabnav',
|
80 |
+
)
|
81 |
+
)
|
82 |
+
);
|
83 |
+
|
84 |
+
if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){
|
85 |
+
$visibility_fld = array();
|
86 |
+
|
87 |
+
$visibility_fld['widgetopts_visibility_show'] = array(
|
88 |
+
'type' => 'select',
|
89 |
+
'label' => __( 'Show or Hide', 'widget-options' ),
|
90 |
+
'options' => array(
|
91 |
+
'hide' => __( 'Hide on Selected Pages', 'widget-options' ),
|
92 |
+
'show' => __( 'Show on Selected Pages', 'widget-options' )
|
93 |
+
)
|
94 |
+
);
|
95 |
+
|
96 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) && '1' == $widget_options['settings']['visibility']['post_type'] ){
|
97 |
+
|
98 |
+
if( !empty( $pages ) ){
|
99 |
+
$pages_array = array();
|
100 |
+
foreach ( $pages as $page ) {
|
101 |
+
$pages_array[ $page->ID ] = $page->post_title;
|
102 |
+
}
|
103 |
+
|
104 |
+
$visibility_fld['widgetopts_visibility_pages'] = array(
|
105 |
+
'type' => 'widgetopts-select2',
|
106 |
+
'label' => __( 'Pages', 'widget-options' ),
|
107 |
+
'options' => $pages_array,
|
108 |
+
'multi-select' => true,
|
109 |
+
'description' => __( 'Click to search or select', 'widget-options' ),
|
110 |
+
);
|
111 |
+
}
|
112 |
+
|
113 |
+
if( !empty( $types ) ){
|
114 |
+
$types_array = array();
|
115 |
+
foreach ( $types as $ptype => $type ) {
|
116 |
+
$types_array[ $ptype ] = $type->labels->name;
|
117 |
+
}
|
118 |
+
|
119 |
+
$visibility_fld['widgetopts_visibility_types'] = array(
|
120 |
+
'type' => 'widgetopts-select2',
|
121 |
+
'label' => __( 'Post Types', 'widget-options' ),
|
122 |
+
'options' => $types_array,
|
123 |
+
'multi-select' => true,
|
124 |
+
'description' => __( 'Click to search or select', 'widget-options' )
|
125 |
+
);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
|
129 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) && '1' == $widget_options['settings']['visibility']['taxonomies'] ){
|
130 |
+
// if( !empty( $widget_options['settings']['taxonomies'] ) && is_array( $widget_options['settings']['taxonomies'] ) ){
|
131 |
+
// foreach ( $widget_options['settings']['taxonomies'] as $tax_opt => $vallue ) {
|
132 |
+
// $term_array = array();
|
133 |
+
// // if( !empty( $get_terms ) ){
|
134 |
+
// foreach ( $get_terms[ $tax_opt ] as $get_term ) {
|
135 |
+
// $term_array[ $get_term->term_id ] = $get_term->name;
|
136 |
+
// }
|
137 |
+
|
138 |
+
// $visibility_fld['widgetopts_visibility_tax_'. $tax_opt] = array(
|
139 |
+
// 'type' => 'widgetopts-select2',
|
140 |
+
// 'label' => $taxonomies[ $tax_opt ]->label,
|
141 |
+
// 'options' => $term_array,
|
142 |
+
// 'multi-select' => true,
|
143 |
+
// 'description' => __( 'Click to search or select', 'widget-options' )
|
144 |
+
// );
|
145 |
+
// // }
|
146 |
+
// }
|
147 |
+
// }
|
148 |
+
|
149 |
+
if( !empty( $categories ) ){
|
150 |
+
$cat_array = array();
|
151 |
+
foreach ( $categories as $cat ) {
|
152 |
+
$cat_array[ $cat->cat_ID ] = $cat->cat_name;
|
153 |
+
}
|
154 |
+
|
155 |
+
$visibility_fld['widgetopts_visibility_tax_category'] = array(
|
156 |
+
'type' => 'widgetopts-select2',
|
157 |
+
'label' => __( 'Categories', 'widget-options' ),
|
158 |
+
'options' => $cat_array,
|
159 |
+
'multi-select' => true,
|
160 |
+
'description' => __( 'Click to search or select', 'widget-options' )
|
161 |
+
);
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
if( !empty( $taxonomies ) ){
|
166 |
+
$tax_array = array();
|
167 |
+
foreach ( $taxonomies as $taxonomy ) {
|
168 |
+
$tax_array[ $taxonomy->name ] = $taxonomy->label;
|
169 |
+
}
|
170 |
+
|
171 |
+
$visibility_fld['widgetopts_visibility_taxonomies'] = array(
|
172 |
+
'type' => 'widgetopts-select2',
|
173 |
+
'label' => __( 'Taxonomies', 'widget-options' ),
|
174 |
+
'options' => $tax_array,
|
175 |
+
'multi-select' => true,
|
176 |
+
'description' => __( 'Click to search or select', 'widget-options' )
|
177 |
+
);
|
178 |
+
}
|
179 |
+
}
|
180 |
+
|
181 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) && '1' == $widget_options['settings']['visibility']['misc'] ){
|
182 |
+
$visibility_fld['widgetopts_visibility_misc'] = array(
|
183 |
+
'type' => 'widgetopts-select2',
|
184 |
+
'label' => __( 'Miscellaneous', 'widget-options' ),
|
185 |
+
'options' => array(
|
186 |
+
'home' => __( 'Home/Front', 'widget-options' ),
|
187 |
+
'blog' => __( 'Blog', 'widget-options' ),
|
188 |
+
'archives' => __( 'Archives', 'widget-options' ),
|
189 |
+
'404' => __( '404', 'widget-options' ),
|
190 |
+
'search' => __( 'Search', 'widget-options' )
|
191 |
+
),
|
192 |
+
'multi-select' => true,
|
193 |
+
'description' => __( 'Click to search or select', 'widget-options' )
|
194 |
+
);
|
195 |
+
}
|
196 |
+
|
197 |
+
$sections[ 'widgetopts-visibility' ] = array(
|
198 |
+
'fields' => $visibility_fld
|
199 |
+
);
|
200 |
+
}
|
201 |
+
|
202 |
+
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ||
|
203 |
+
isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
204 |
+
$settings_fld = array();
|
205 |
+
|
206 |
+
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){
|
207 |
+
$settings_fld['widgetopts_settings_logic'] = array(
|
208 |
+
'type' => 'textarea',
|
209 |
+
'label' => __( 'Display Logic', 'widget-options' ),
|
210 |
+
'description' => __( '<small>PLEASE NOTE that the display logic you introduce is EVAL\'d directly. Anyone who has access to edit widget appearance will have the right to add any code, including malicious and possibly destructive functions. There is an optional filter "widget_options_logic_override" which you can use to bypass the EVAL with your own code if needed.</small>', 'widget-options' )
|
211 |
+
);
|
212 |
+
}
|
213 |
+
|
214 |
+
//ACF
|
215 |
+
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
216 |
+
$fields = array( '' => __( 'Select Field', 'widget-options' ) );
|
217 |
+
|
218 |
+
if ( function_exists( 'acf_get_field_groups' ) ) {
|
219 |
+
$groups = acf_get_field_groups();
|
220 |
+
if ( is_array( $groups ) ) {
|
221 |
+
foreach ( $groups as $group ) {
|
222 |
+
$fields_group = acf_get_fields( $group );
|
223 |
+
if( !empty( $fields_group ) ){
|
224 |
+
foreach ( $fields_group as $k => $fg ) {
|
225 |
+
$fields[ $fg['key'] ] = $fg['label'];
|
226 |
+
}
|
227 |
+
}
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}else{
|
231 |
+
$groups = apply_filters( 'acf/get_field_groups', array() );
|
232 |
+
if ( is_array( $groups ) ) {
|
233 |
+
foreach ( $groups as $group ) {
|
234 |
+
$fields_group = apply_filters( 'acf/field_group/get_fields', array(), $group['id'] );
|
235 |
+
if( !empty( $fields_group ) ){
|
236 |
+
foreach ( $fields_group as $k => $fg ) {
|
237 |
+
$fields[ $fg['key'] ] = $fg['label'];
|
238 |
+
}
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
}
|
243 |
+
|
244 |
+
$settings_fld['widgetopts_acf_visibility'] = array(
|
245 |
+
'type' => 'select',
|
246 |
+
'label' => __( 'Show or Hide based on Advanced Custom Field', 'widget-options' ),
|
247 |
+
'options' => array(
|
248 |
+
'hide' => __( 'Hide when Condition\'s Met', 'widget-options' ),
|
249 |
+
'show' => __( 'Show when Condition\'s Met', 'widget-options' )
|
250 |
+
)
|
251 |
+
);
|
252 |
+
|
253 |
+
$settings_fld['widgetopts_acf_field'] = array(
|
254 |
+
'type' => 'select',
|
255 |
+
'label' => __( 'Select ACF Field', 'widget-options' ),
|
256 |
+
'options' => $fields
|
257 |
+
);
|
258 |
+
|
259 |
+
$settings_fld['widgetopts_acf_condition'] = array(
|
260 |
+
'type' => 'select',
|
261 |
+
'label' => __( 'Select Condition', 'widget-options' ),
|
262 |
+
'options' => array(
|
263 |
+
'' => __( 'Select Condition', 'widget-options' ),
|
264 |
+
'equal' => __( 'Is Equal To', 'widget-options' ),
|
265 |
+
'not_equal' => __( 'Is Not Equal To', 'widget-options' ),
|
266 |
+
'contains' => __( 'Contains', 'widget-options' ),
|
267 |
+
'not_contains' => __( 'Does Not Contain', 'widget-options' ),
|
268 |
+
'empty' => __( 'Is Empty', 'widget-options' ),
|
269 |
+
'not_empty' => __( 'Is Not Empty', 'widget-options' )
|
270 |
+
)
|
271 |
+
);
|
272 |
+
$settings_fld['widgetopts_acf_value'] = array(
|
273 |
+
'type' => 'textarea',
|
274 |
+
'label' => __( 'Conditional Value', 'widget-options' ),
|
275 |
+
'description' => __( 'Add your Conditional Value here if you selected Equal to, Not Equal To or Contains on the selection above.', 'widget-options' )
|
276 |
+
);
|
277 |
+
}
|
278 |
+
|
279 |
+
$sections[ 'widgetopts-settings' ] = array(
|
280 |
+
'fields' => $settings_fld
|
281 |
+
);
|
282 |
+
}
|
283 |
+
|
284 |
+
$upgrade_fld = array();
|
285 |
+
$upgrade_fld['widgetopts_upgrade_section'] = array(
|
286 |
+
'type' => 'widgetopts-upgrade'
|
287 |
+
);
|
288 |
+
|
289 |
+
$sections[ 'widgetopts-upgrade' ] = array(
|
290 |
+
'fields' => $upgrade_fld
|
291 |
+
);
|
292 |
+
|
293 |
+
$form['widgetopts'] = array(
|
294 |
+
'title' => __( 'Widget Options', 'widget-options' ),
|
295 |
+
'sections' => $sections
|
296 |
+
);
|
297 |
+
}
|
298 |
+
|
299 |
+
return $form;
|
300 |
+
}
|
301 |
+
|
302 |
+
function fl_widgetopts_beaver_tabnav($name, $value, $field, $settings) {
|
303 |
+
global $widget_options;
|
304 |
+
?>
|
305 |
+
<div class="fl-builder-widgetopts-tab">
|
306 |
+
<?php if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){ ?>
|
307 |
+
<a href="#fl-builder-settings-section-widgetopts-visibility" class="widgetopts-s-active"><span class="dashicons dashicons-visibility"></span><?php _e( 'Visibility', 'widget-options' );?></a>
|
308 |
+
<?php } ?>
|
309 |
+
<?php if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){ ?>
|
310 |
+
<a href="#fl-builder-settings-section-widgetopts-settings" class="<?php echo ( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ) ? '' : 'widgetopts-s-active';?>"><span class="dashicons dashicons-admin-generic"></span><?php _e( 'Settings', 'widget-options' );?></a>
|
311 |
+
<?php } ?>
|
312 |
+
<a href="#fl-builder-settings-section-widgetopts-upgrade"><span class="dashicons dashicons-plus"></span><?php _e( 'More', 'widget-options' );?></a>
|
313 |
+
</div>
|
314 |
+
<?php }
|
315 |
+
|
316 |
+
function fl_widgetopts_beaver_scripts(){
|
317 |
+
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) {
|
318 |
+
$js_dir = WIDGETOPTS_PLUGIN_URL . 'assets/js/';
|
319 |
+
$css_dir = WIDGETOPTS_PLUGIN_URL . 'assets/css/';
|
320 |
+
|
321 |
+
// Use minified libraries if SCRIPT_DEBUG is turned off
|
322 |
+
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
323 |
+
|
324 |
+
wp_enqueue_style( 'widgetopts-beaver-css', $css_dir . 'beaver-widgetopts.css' , array(), null );
|
325 |
+
wp_enqueue_style( 'widgetopts-beaver-select2-css', $css_dir . 'select2.min.css' , array(), null );
|
326 |
+
|
327 |
+
wp_enqueue_script(
|
328 |
+
'beaver-widgetopts',
|
329 |
+
$js_dir .'jquery.widgetopts.beaver'. $suffix .'.js',
|
330 |
+
array( 'jquery' ),
|
331 |
+
'',
|
332 |
+
true
|
333 |
+
);
|
334 |
+
wp_enqueue_script(
|
335 |
+
'beaver-widgetopts-select2',
|
336 |
+
$js_dir .'select2.min.js',
|
337 |
+
array( 'jquery', 'beaver-widgetopts' ),
|
338 |
+
'',
|
339 |
+
true
|
340 |
+
);
|
341 |
+
wp_enqueue_script(
|
342 |
+
'beaver-widgetopts-s2',
|
343 |
+
$js_dir .'select2-settings'. $suffix .'.js',
|
344 |
+
array( 'jquery', 'beaver-widgetopts' ),
|
345 |
+
'',
|
346 |
+
true
|
347 |
+
);
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
function fl_widgetopts_beaver_get_fld_options($settings, $field, $options = array()) {
|
352 |
+
if(!is_object($settings) && !is_array($settings)) return $options;
|
353 |
+
|
354 |
+
foreach($settings as $key=>$val) {
|
355 |
+
if($key === $field) {
|
356 |
+
if(is_array($val)) {
|
357 |
+
foreach($val as $v) {
|
358 |
+
$options[$v] = $v;
|
359 |
+
}
|
360 |
+
} else {
|
361 |
+
$options[$val] = $val;
|
362 |
+
}
|
363 |
+
}else{
|
364 |
+
if(is_array($val) || is_object($val)){
|
365 |
+
$options = $this->fl_widgetopts_beaver_get_fld_options($val, $field, $options);
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
|
370 |
+
return array_unique($options);
|
371 |
+
}
|
372 |
+
|
373 |
+
function fl_widgetopts_beaver_select2( $name, $value, $field, $settings ) {
|
374 |
+
$options = ( $field['options'] ) ? $field['options'] : array();
|
375 |
+
|
376 |
+
if( isset( $field['options_from_field'] ) ) {
|
377 |
+
$options_field = $field['options_from_field'];
|
378 |
+
$post_data = FLBuilderModel::get_post_data();
|
379 |
+
$parent_settings = $post_data['node_settings'];
|
380 |
+
|
381 |
+
$options = $this->fl_widgetopts_beaver_get_fld_options($parent_settings, $options_field, $options);
|
382 |
+
}
|
383 |
+
|
384 |
+
// Create attributes
|
385 |
+
$attributes = '';
|
386 |
+
if( isset( $field['attributes'] ) && is_array( $field['attributes'] ) ) {
|
387 |
+
foreach($field['attributes'] as $key=>$val) {
|
388 |
+
$attributes .= $key .'="'. $val .'" ';
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
if(!empty($options) && $value) {
|
393 |
+
uksort($options, function($key1, $key2) use ($value) {
|
394 |
+
return (array_search($key1, $value) > array_search($key2, $value));
|
395 |
+
});
|
396 |
+
}
|
397 |
+
if( !isset( $field['class'] ) ){
|
398 |
+
$field['class'] = '';
|
399 |
+
}
|
400 |
+
|
401 |
+
// Show the select field
|
402 |
+
?>
|
403 |
+
<select name="<?php echo $name; if( isset( $field['multi-select'] ) ) echo '[]'; ?>" class="widgetopts-select2 <?php echo $field['class']; ?>" <?php if( isset( $field['multi-select'] ) ) echo 'multiple '; echo $attributes; ?> placeholder="<?php _e( 'Click to search or select', 'widget-options' );?>" >
|
404 |
+
<option></option>
|
405 |
+
<?php
|
406 |
+
foreach ( $options as $option_key => $option_val ) :
|
407 |
+
|
408 |
+
if ( is_array( $option_val ) && isset( $option_val['premium' ] ) && $option_val['premium'] && true === FL_BUILDER_LITE ) {
|
409 |
+
continue;
|
410 |
+
}
|
411 |
+
|
412 |
+
$label = is_array( $option_val ) ? $option_val['label'] : $option_val;
|
413 |
+
|
414 |
+
if ( is_array( $value ) && in_array( $option_key, $value ) ) {
|
415 |
+
$selected = ' selected="selected"';
|
416 |
+
}else if ( ! is_array( $value ) && selected( $value, $option_key, true ) ) {
|
417 |
+
$selected = ' selected="selected"';
|
418 |
+
} else {
|
419 |
+
$selected = '';
|
420 |
+
}
|
421 |
+
|
422 |
+
?>
|
423 |
+
<option value="<?php echo $option_key; ?>" <?php echo $selected; ?>><?php echo $label; ?></option>
|
424 |
+
<?php endforeach; ?>
|
425 |
+
</select>
|
426 |
+
<?php }
|
427 |
+
|
428 |
+
function fl_widgetopts_upgrade( $name, $value, $field, $settings ) { ?>
|
429 |
+
<div class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-gopro">
|
430 |
+
<p class="widgetopts-unlock-features">
|
431 |
+
<span class="dashicons dashicons-lock"></span><?php _e( 'Unlock all Options', 'widget-options' );?>
|
432 |
+
</p>
|
433 |
+
<p>
|
434 |
+
<?php _e( 'Get the world\'s most complete widget management now with Beaver Builder integration! Upgrade to extended version to get:', 'widget-options' );?>
|
435 |
+
</p>
|
436 |
+
<ul>
|
437 |
+
<li>
|
438 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Animation Options', 'widget-options' );?>
|
439 |
+
</li>
|
440 |
+
<li>
|
441 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Custom Styling Options', 'widget-options' );?>
|
442 |
+
</li>
|
443 |
+
<li>
|
444 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Set Alignment per Devices', 'widget-options' );?>
|
445 |
+
</li>
|
446 |
+
<li>
|
447 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'User Roles Visibility Restriction', 'widget-options' );?>
|
448 |
+
</li>
|
449 |
+
<li>
|
450 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Fixed/Sticky Widget Options', 'widget-options' );?>
|
451 |
+
</li>
|
452 |
+
<li>
|
453 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Days and Date Range Restriction', 'widget-options' );?>
|
454 |
+
</li>
|
455 |
+
<li>
|
456 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Link Module Block Options', 'widget-options' );?>
|
457 |
+
</li>
|
458 |
+
<li>
|
459 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Extended Taxonomy and Post Types Support', 'widget-options' );?>
|
460 |
+
</li>
|
461 |
+
<li>
|
462 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Target URLs and Wildcard Restrictions', 'widget-options' );?>
|
463 |
+
</li>
|
464 |
+
<li>
|
465 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Beaver Builder Support', 'widget-options' );?>
|
466 |
+
</li>
|
467 |
+
</ul>
|
468 |
+
<p><strong><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=beaverbuilder&utm_medium=learnmore&utm_campaign=widgetoptsprotab');?>" class="button-primary" target="_blank"><?php _e( 'Learn More', 'widget-options' );?></a></strong></p>
|
469 |
+
</div>
|
470 |
+
<?php }
|
471 |
+
|
472 |
+
function widgetopts_beaver_is_node_visible( $is_visible, $node ){
|
473 |
+
|
474 |
+
//return if editing
|
475 |
+
if ( class_exists( 'FLBuilderModel' ) && FLBuilderModel::is_builder_active() ) {
|
476 |
+
return $is_visible;
|
477 |
+
}
|
478 |
+
|
479 |
+
global $widget_options;
|
480 |
+
|
481 |
+
$settings = $node->settings;
|
482 |
+
$hidden = false;
|
483 |
+
$visibility_opts = isset( $settings->widgetopts_visibility_show ) ? $settings->widgetopts_visibility_show : 'hide';
|
484 |
+
|
485 |
+
$tax_opts = ( isset( $widget_options['settings'] ) && isset( $widget_options['settings']['taxonomies_keys'] ) ) ? $widget_options['settings']['taxonomies_keys'] : array();
|
486 |
+
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
487 |
+
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
488 |
+
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
489 |
+
$is_inherit = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['inherit'] ) ) ? true : false;
|
490 |
+
|
491 |
+
// echo '<pre>';
|
492 |
+
// print_r( $settings );
|
493 |
+
// echo '</pre>';
|
494 |
+
|
495 |
+
//pages
|
496 |
+
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
497 |
+
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'home', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
498 |
+
$hidden = true; //hide if checked on hidden pages
|
499 |
+
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'home', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
500 |
+
$hidden = true; //hide if not checked on visible pages
|
501 |
+
}
|
502 |
+
|
503 |
+
//do return to bypass other conditions
|
504 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_home', $hidden );
|
505 |
+
if( $hidden ){
|
506 |
+
return false;
|
507 |
+
}
|
508 |
+
}elseif ( $is_misc && is_home() ) {
|
509 |
+
//NOT CHECKED YET
|
510 |
+
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'blog', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
511 |
+
$hidden = true; //hide if checked on hidden pages
|
512 |
+
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'blog', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
513 |
+
$hidden = true; //hide if not checked on visible pages
|
514 |
+
}
|
515 |
+
|
516 |
+
//do return to bypass other conditions
|
517 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_blog', $hidden );
|
518 |
+
if( $hidden ){
|
519 |
+
return false;
|
520 |
+
}
|
521 |
+
}elseif ( $is_tax && is_tag() ) {
|
522 |
+
|
523 |
+
if( !isset( $settings->widgetopts_visibility_taxonomies ) || ( isset( $settings->widgetopts_visibility_taxonomies ) && !is_array( $settings->widgetopts_visibility_taxonomies ) ) ){
|
524 |
+
$settings->widgetopts_visibility_taxonomies = array();
|
525 |
+
}
|
526 |
+
|
527 |
+
if( in_array( 'post_tag', $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'hide' ){
|
528 |
+
$hidden = true; //hide to all tags
|
529 |
+
}elseif( in_array( 'post_tag', $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'show' ){
|
530 |
+
$hidden = false; //hide to all tags
|
531 |
+
}
|
532 |
+
//
|
533 |
+
// //do return to bypass other conditions
|
534 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_tags', $hidden );
|
535 |
+
if( $hidden ){
|
536 |
+
return false;
|
537 |
+
}
|
538 |
+
}elseif ( $is_tax && is_tax() ) {
|
539 |
+
$term = get_queried_object();
|
540 |
+
//taxonomies page
|
541 |
+
if( !isset( $settings->widgetopts_visibility_taxonomies ) || ( isset( $settings->widgetopts_visibility_taxonomies ) && !is_array( $settings->widgetopts_visibility_taxonomies ) ) ){
|
542 |
+
$settings->widgetopts_visibility_taxonomies = array();
|
543 |
+
}
|
544 |
+
// print_r( $term_lists );
|
545 |
+
if( in_array( $term->taxonomy, $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'hide' ){
|
546 |
+
$hidden = true; //hide to all tags
|
547 |
+
}elseif( !in_array( $term->taxonomy, $settings->widgetopts_visibility_taxonomies ) && $visibility_opts == 'show' ){
|
548 |
+
$hidden = true; //hide to all tags
|
549 |
+
}
|
550 |
+
|
551 |
+
//do return to bypass other conditions
|
552 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_taxonomies', $hidden );
|
553 |
+
if( $hidden ){
|
554 |
+
return false;
|
555 |
+
}
|
556 |
+
}elseif ( $is_misc && is_archive() ) {
|
557 |
+
//archives page
|
558 |
+
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'archives', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
559 |
+
$hidden = true; //hide if checked on hidden pages
|
560 |
+
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'archives', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
561 |
+
$hidden = true; //hide if not checked on visible pages
|
562 |
+
}
|
563 |
+
|
564 |
+
//do return to bypass other conditions
|
565 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_archives', $hidden );
|
566 |
+
if( $hidden ){
|
567 |
+
return false;
|
568 |
+
}
|
569 |
+
}elseif ( $is_misc && is_404() ) {
|
570 |
+
//404 page
|
571 |
+
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( '404', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
572 |
+
$hidden = true; //hide if checked on hidden pages
|
573 |
+
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( '404', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
574 |
+
$hidden = true; //hide if not checked on visible pages
|
575 |
+
}
|
576 |
+
|
577 |
+
//do return to bypass other conditions
|
578 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_404', $hidden );
|
579 |
+
if( $hidden ){
|
580 |
+
return false;
|
581 |
+
}
|
582 |
+
}elseif ( $is_misc && is_search() ) {
|
583 |
+
if( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && in_array( 'search', $settings->widgetopts_visibility_misc ) && $visibility_opts == 'hide' ){
|
584 |
+
$hidden = true; //hide if checked on hidden pages
|
585 |
+
}elseif( ( !isset( $settings->widgetopts_visibility_misc ) || ( isset( $settings->widgetopts_visibility_misc ) && is_array( $settings->widgetopts_visibility_misc ) && !in_array( 'search', $settings->widgetopts_visibility_misc ) ) ) && $visibility_opts == 'show' ){
|
586 |
+
$hidden = true;
|
587 |
+
}
|
588 |
+
|
589 |
+
//do return to bypass other conditions
|
590 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_search', $hidden );
|
591 |
+
if( $hidden ){
|
592 |
+
return false;
|
593 |
+
}
|
594 |
+
}elseif ( is_single() && !is_page() ) {
|
595 |
+
global $wp_query;
|
596 |
+
$post = $wp_query->post;
|
597 |
+
|
598 |
+
if( !isset( $settings->widgetopts_visibility_types ) || ( $is_types && !isset( $settings->widgetopts_visibility_types ) ) || !is_array( $settings->widgetopts_visibility_types ) ){
|
599 |
+
$settings->widgetopts_visibility_types = array();
|
600 |
+
}
|
601 |
+
|
602 |
+
if( $visibility_opts == 'hide' && in_array( $post->post_type , $settings->widgetopts_visibility_types ) ){
|
603 |
+
$hidden = true; //hide if exists on hidden pages
|
604 |
+
}elseif( $visibility_opts == 'show' && !in_array( $post->post_type , $settings->widgetopts_visibility_types ) ){
|
605 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
606 |
+
}
|
607 |
+
|
608 |
+
// do return to bypass other conditions
|
609 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_single', $hidden );
|
610 |
+
|
611 |
+
|
612 |
+
// $taxonomy_names = get_post_taxonomies( $post->ID );
|
613 |
+
// $array_intersect = array_intersect( $tax_opts, $taxonomy_names );
|
614 |
+
|
615 |
+
if( !isset( $settings->widgetopts_visibility_tax_category ) ){
|
616 |
+
$settings->widgetopts_visibility_tax_category = array();
|
617 |
+
}
|
618 |
+
|
619 |
+
if( isset( $settings->widgetopts_visibility_tax_category ) && !empty( $settings->widgetopts_visibility_tax_category ) ){
|
620 |
+
$cats = wp_get_post_categories( $post->ID );
|
621 |
+
|
622 |
+
if( is_array( $cats ) && !empty( $cats ) ){
|
623 |
+
$checked_cats = $settings->widgetopts_visibility_tax_category;
|
624 |
+
$intersect = array_intersect( $cats , $checked_cats );
|
625 |
+
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
626 |
+
$hidden = true;
|
627 |
+
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
628 |
+
$hidden = false;
|
629 |
+
}
|
630 |
+
|
631 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_single_category', $hidden );
|
632 |
+
}
|
633 |
+
}
|
634 |
+
|
635 |
+
if( $hidden ){
|
636 |
+
return false;
|
637 |
+
}
|
638 |
+
}elseif ( $is_types && is_page() ) {
|
639 |
+
global $wp_query;
|
640 |
+
|
641 |
+
$post = $wp_query->post;
|
642 |
+
|
643 |
+
//do post type condition first
|
644 |
+
if( isset( $settings->widgetopts_visibility_types ) && is_array( $settings->widgetopts_visibility_types ) && in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
645 |
+
|
646 |
+
if( !is_array( $settings->widgetopts_visibility_types ) ){
|
647 |
+
$settings->widgetopts_visibility_types = array();
|
648 |
+
}
|
649 |
+
|
650 |
+
if( $visibility_opts == 'hide' && in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
651 |
+
$hidden = true; //hide if exists on hidden pages
|
652 |
+
}elseif( $visibility_opts == 'show' && !in_array( 'page', $settings->widgetopts_visibility_types ) ){
|
653 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
654 |
+
}
|
655 |
+
}else{
|
656 |
+
// print_r( $settings['widgetopts_pages'] );
|
657 |
+
//do per pages condition
|
658 |
+
if( !isset( $settings->widgetopts_visibility_pages ) || ( isset( $settings->widgetopts_visibility_pages ) && !is_array( $settings->widgetopts_visibility_pages ) ) ){
|
659 |
+
$settings->widgetopts_visibility_pages = array();
|
660 |
+
}
|
661 |
+
|
662 |
+
if( $visibility_opts == 'hide' && in_array( $post->ID , $settings->widgetopts_visibility_pages ) ){
|
663 |
+
$hidden = true; //hide if exists on hidden pages
|
664 |
+
}elseif( $visibility_opts == 'show' && !in_array( $post->ID , $settings->widgetopts_visibility_pages ) ){
|
665 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
666 |
+
}
|
667 |
+
}
|
668 |
+
|
669 |
+
// //do return to bypass other conditions
|
670 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_page', $hidden );
|
671 |
+
if( $hidden ){
|
672 |
+
return false;
|
673 |
+
}
|
674 |
+
}
|
675 |
+
|
676 |
+
//ACF
|
677 |
+
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
678 |
+
if( isset( $settings->widgetopts_acf_field ) && !empty( $settings->widgetopts_acf_field ) ){
|
679 |
+
$acf = get_field_object( $settings->widgetopts_acf_field );
|
680 |
+
if( $acf && is_array( $acf ) ){
|
681 |
+
$acf_visibility = isset( $settings->widgetopts_acf_visibility ) ? $settings->widgetopts_acf_visibility : 'hide';
|
682 |
+
|
683 |
+
//handle repeater fields
|
684 |
+
if( isset( $acf['value'] ) ){
|
685 |
+
if( is_array( $acf['value'] ) ){
|
686 |
+
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
687 |
+
$acf_implode = '';
|
688 |
+
if( is_array( $acf_array_value ) ){
|
689 |
+
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
690 |
+
}
|
691 |
+
return $acf_implode;
|
692 |
+
}, $acf['value']));
|
693 |
+
}
|
694 |
+
}
|
695 |
+
|
696 |
+
switch ( $settings->widgetopts_acf_condition ) {
|
697 |
+
case 'equal':
|
698 |
+
if( isset( $acf['value'] ) ){
|
699 |
+
if( 'show' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
700 |
+
$hidden = false;
|
701 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
702 |
+
$hidden = true;
|
703 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
704 |
+
$hidden = true;
|
705 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
706 |
+
$hidden = false;
|
707 |
+
}
|
708 |
+
}
|
709 |
+
break;
|
710 |
+
|
711 |
+
case 'not_equal':
|
712 |
+
if( isset( $acf['value'] ) ){
|
713 |
+
if( 'show' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
714 |
+
$hidden = true;
|
715 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
716 |
+
$hidden = false;
|
717 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings->widgetopts_acf_value ){
|
718 |
+
$hidden = false;
|
719 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings->widgetopts_acf_value ){
|
720 |
+
$hidden = true;
|
721 |
+
}
|
722 |
+
}
|
723 |
+
break;
|
724 |
+
|
725 |
+
case 'contains':
|
726 |
+
if( isset( $acf['value'] ) ){
|
727 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
728 |
+
$hidden = false;
|
729 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
730 |
+
$hidden = true;
|
731 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
732 |
+
$hidden = true;
|
733 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
734 |
+
$hidden = false;
|
735 |
+
}
|
736 |
+
}
|
737 |
+
break;
|
738 |
+
|
739 |
+
case 'not_contains':
|
740 |
+
if( isset( $acf['value'] ) ){
|
741 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
742 |
+
$hidden = true;
|
743 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
744 |
+
$hidden = false;
|
745 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) !== false ){
|
746 |
+
$hidden = false;
|
747 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings->widgetopts_acf_value ) === false ){
|
748 |
+
$hidden = true;
|
749 |
+
}
|
750 |
+
}
|
751 |
+
break;
|
752 |
+
|
753 |
+
case 'empty':
|
754 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
755 |
+
$hidden = false;
|
756 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
757 |
+
$hidden = true;
|
758 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
759 |
+
$hidden = true;
|
760 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
761 |
+
$hidden = false;
|
762 |
+
}
|
763 |
+
break;
|
764 |
+
|
765 |
+
case 'not_empty':
|
766 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
767 |
+
$hidden = true;
|
768 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
769 |
+
$hidden = false;
|
770 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
771 |
+
$hidden = false;
|
772 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
773 |
+
$hidden = true;
|
774 |
+
}
|
775 |
+
break;
|
776 |
+
|
777 |
+
default:
|
778 |
+
# code...
|
779 |
+
break;
|
780 |
+
}
|
781 |
+
|
782 |
+
// //do return to bypass other conditions
|
783 |
+
$hidden = apply_filters( 'widgetopts_beaver_visibility_acf', $hidden );
|
784 |
+
if( $hidden ){
|
785 |
+
return false;
|
786 |
+
}
|
787 |
+
}
|
788 |
+
}
|
789 |
+
}
|
790 |
+
|
791 |
+
//widget logic
|
792 |
+
if( isset( $widget_options['logic'] ) && 'activate' == $widget_options['logic'] ){
|
793 |
+
if( isset( $settings->widgetopts_settings_logic ) && !empty( $settings->widgetopts_settings_logic ) ){
|
794 |
+
//do widget logic
|
795 |
+
$display_logic = stripslashes( trim( $settings->widgetopts_settings_logic ) );
|
796 |
+
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
797 |
+
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
798 |
+
if ( $display_logic === false ){
|
799 |
+
return false;
|
800 |
+
}
|
801 |
+
if ( $display_logic === true ){
|
802 |
+
return $content;
|
803 |
+
}
|
804 |
+
if ( stristr($display_logic,"return")===false ){
|
805 |
+
$display_logic="return (" . $display_logic . ");";
|
806 |
+
}
|
807 |
+
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
808 |
+
try {
|
809 |
+
if ( !eval( $display_logic ) ){
|
810 |
+
return false;
|
811 |
+
}
|
812 |
+
} catch (ParseError $e) {
|
813 |
+
return false;
|
814 |
+
}
|
815 |
+
}
|
816 |
+
}
|
817 |
+
|
818 |
+
return $is_visible;
|
819 |
+
}
|
820 |
+
function widgetopts_plugin_check(){
|
821 |
+
if ( ! defined( 'WIDGETOPTS_PLUGIN_NAME' ) ) { ?>
|
822 |
+
<div class="widgetopts_activated_notice notice-error notice" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
|
823 |
+
<p>
|
824 |
+
<?php _e( '<strong>Widget Options Plugin</strong> is required for the <em>Widget Options for Beaver Builder</em> to work properly. Please get the plugin <a href="https://wordpress.org/plugins/widget-options/" target="_blank">here</a>. Thanks!', 'widget-options' );?>
|
825 |
+
</p>
|
826 |
+
</div>
|
827 |
+
<?php }
|
828 |
+
}
|
829 |
+
}
|
830 |
+
|
831 |
+
add_action( 'plugins_loaded', array( 'WP_Widget_Options_Beaver', 'init' ));
|
832 |
+
// new WP_Widget_Options_Beaver();
|
833 |
+
|
834 |
+
endif;
|
includes/pagebuilders/elementor/elementor.php
CHANGED
@@ -1,502 +1,502 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Extends funtionality to Elementor Pagebuilder
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 4.3
|
8 |
-
*/
|
9 |
-
// Exit if accessed directly
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
|
12 |
-
if( !function_exists( 'widgetopts_elementor_section' ) ){
|
13 |
-
//Add "Widget Options" section to every Elementor Widgets
|
14 |
-
add_action( 'elementor/element/after_section_end', 'widgetopts_elementor_section', 10, 3 );
|
15 |
-
function widgetopts_elementor_section( $element, $section_id, $args ){
|
16 |
-
if ( Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
17 |
-
global $widget_options;
|
18 |
-
|
19 |
-
//filter the elements first to avoid conflicts that can cause pagebuilder not to load
|
20 |
-
if ( !in_array( $element->get_name(), array( 'global-settings', 'section', 'page-settings', 'oew-blog-grid' ) ) ) {
|
21 |
-
|
22 |
-
//create array of section_id to set Widget Options Section to single section to avoid issues
|
23 |
-
$widgetopts_elementor_section_id = apply_filters( 'widgetopts_elementor_section_id', array(
|
24 |
-
'section_image',
|
25 |
-
'section_advanced',
|
26 |
-
'section_title',
|
27 |
-
'section_editor',
|
28 |
-
'section_video',
|
29 |
-
'section_button',
|
30 |
-
'section_divider',
|
31 |
-
'section_spacer',
|
32 |
-
'section_map',
|
33 |
-
'section_icon',
|
34 |
-
'section_gallery',
|
35 |
-
'section_image_carousel',
|
36 |
-
'section_icon_list',
|
37 |
-
'section_counter',
|
38 |
-
'section_testimonial',
|
39 |
-
'section_tabs',
|
40 |
-
'section_toggle',
|
41 |
-
'section_social_icon',
|
42 |
-
'section_alert',
|
43 |
-
'section_audio',
|
44 |
-
'section_shortcode',
|
45 |
-
'section_anchor',
|
46 |
-
'section_sidebar',
|
47 |
-
'section_layout',
|
48 |
-
'section_slides',
|
49 |
-
'section_form_fields',
|
50 |
-
'section_list',
|
51 |
-
'section_header',
|
52 |
-
'section_pricing',
|
53 |
-
'section_countdown',
|
54 |
-
'section_buttons_content',
|
55 |
-
'section_blockquote_content',
|
56 |
-
'section_content',
|
57 |
-
'section_login_content',
|
58 |
-
'text_elements',
|
59 |
-
'section_side_a_content',
|
60 |
-
'section_side_b_content',
|
61 |
-
'_section_style'
|
62 |
-
)
|
63 |
-
);
|
64 |
-
|
65 |
-
//filter by the section_ids above
|
66 |
-
if( in_array( $section_id, $widgetopts_elementor_section_id ) ){
|
67 |
-
$element->start_controls_section(
|
68 |
-
'widgetopts_section',
|
69 |
-
[
|
70 |
-
'tab' => Elementor\Controls_Manager::TAB_ADVANCED,
|
71 |
-
'label' => __( 'Widget Options', 'widget-options' ),
|
72 |
-
],
|
73 |
-
[
|
74 |
-
'overwrite' => true
|
75 |
-
]
|
76 |
-
);
|
77 |
-
|
78 |
-
$element->start_controls_tabs( 'widgetopts_content_tabs',[
|
79 |
-
'overwrite' => true
|
80 |
-
] );
|
81 |
-
|
82 |
-
if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){
|
83 |
-
widgetopts_elementor_tab_visibility( $element, $section_id, $args );
|
84 |
-
}
|
85 |
-
|
86 |
-
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] ){
|
87 |
-
widgetopts_elementor_tab_state( $element, $section_id, $args );
|
88 |
-
}
|
89 |
-
|
90 |
-
if( 'activate' == $widget_options['logic'] || ( isset( $widget_options['sliding'] ) && 'activate' == $widget_options['sliding'] && in_array( $element->get_name(), array( 'button', 'button_plus', 'eael-creative-button', 'cta' ) ) ) ){
|
91 |
-
widgetopts_elementor_tab_settings( $element, $section_id, $args );
|
92 |
-
}
|
93 |
-
|
94 |
-
//upsell pro
|
95 |
-
if( !is_plugin_active( 'extended-widget-options/plugin.php' ) ){
|
96 |
-
$element->start_controls_tab(
|
97 |
-
'widgetopts_tab_upsell',
|
98 |
-
[
|
99 |
-
'label' => __( '<i class="
|
100 |
-
],
|
101 |
-
[
|
102 |
-
'overwrite' => true
|
103 |
-
]
|
104 |
-
);
|
105 |
-
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=elementor&utm_medium=upgrade&utm_campaign=upgradebtn');
|
106 |
-
$element->add_control(
|
107 |
-
'widgetopts_pro',
|
108 |
-
[
|
109 |
-
'type' => Elementor\Controls_Manager::RAW_HTML,
|
110 |
-
'raw' => '<div class="elementor-panel-nerd-box">
|
111 |
-
|
112 |
-
<div class="elementor-panel-nerd-box-title">' .
|
113 |
-
__( 'Unlock All Widget Options', 'widget-options' ) .
|
114 |
-
'</div>
|
115 |
-
<div class="elementor-panel-nerd-box-message">' .
|
116 |
-
__( 'Upgrade to Extended Widget Options to unlock all options to easily control and manage each Elementor widget.', 'widget-options' ) .
|
117 |
-
'</div>
|
118 |
-
<a href="'.$upgrade_link.'" class="elementor-panel-nerd-box-link elementor-button elementor-button-default elementor-go-pro" target="_blank">' .
|
119 |
-
__( 'Upgrade Now!', 'widget-options' ) .
|
120 |
-
'</a>
|
121 |
-
</div>',
|
122 |
-
],
|
123 |
-
[
|
124 |
-
'overwrite' => true
|
125 |
-
]
|
126 |
-
);
|
127 |
-
$element->end_controls_tab();
|
128 |
-
}
|
129 |
-
$element->end_controls_tabs();
|
130 |
-
|
131 |
-
$element->end_controls_section();
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
if( !function_exists( 'widgetopts_elementor_tab_visibility' ) ){
|
139 |
-
function widgetopts_elementor_tab_visibility( $element, $section_id, $args ){
|
140 |
-
global $widget_options, $widgetopts_taxonomies, $widgetopts_pages, $widgetopts_types, $widgetopts_categories;
|
141 |
-
|
142 |
-
$pages = ( !empty( $widgetopts_pages ) ) ? $widgetopts_pages : array();
|
143 |
-
$taxonomies = ( !empty( $widgetopts_taxonomies ) ) ? $widgetopts_taxonomies : array();
|
144 |
-
$types = ( !empty( $widgetopts_types ) ) ? $widgetopts_types : array();
|
145 |
-
$categories = ( !empty( $widgetopts_categories ) ) ? $widgetopts_categories : array();
|
146 |
-
|
147 |
-
// print_r( $get_terms['community-category'] );
|
148 |
-
|
149 |
-
$element->start_controls_tab(
|
150 |
-
'widgetopts_tab_visibility',
|
151 |
-
[
|
152 |
-
'label' => __( '<
|
153 |
-
],
|
154 |
-
[
|
155 |
-
'overwrite' => true
|
156 |
-
]
|
157 |
-
);
|
158 |
-
|
159 |
-
$element->add_control(
|
160 |
-
'widgetopts_visibility',
|
161 |
-
[
|
162 |
-
'label' => __( 'Show/Hide', 'widget-options' ),
|
163 |
-
'type' => Elementor\Controls_Manager::SELECT,
|
164 |
-
'default' => 'hide',
|
165 |
-
'options' => [
|
166 |
-
'show' => __( 'Show on Selected Pages' ),
|
167 |
-
'hide' => __( 'Hide on Selected Pages' )
|
168 |
-
],
|
169 |
-
// 'separator' => 'none'
|
170 |
-
],
|
171 |
-
[
|
172 |
-
'overwrite' => true
|
173 |
-
]
|
174 |
-
);
|
175 |
-
|
176 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) && '1' == $widget_options['settings']['visibility']['post_type'] ){
|
177 |
-
$pages_array = array();
|
178 |
-
if( !empty( $pages ) ){
|
179 |
-
foreach ( $pages as $page ) {
|
180 |
-
$pages_array[ $page->ID ] = $page->post_title;
|
181 |
-
}
|
182 |
-
|
183 |
-
$element->add_control(
|
184 |
-
'widgetopts_pages',
|
185 |
-
[
|
186 |
-
'label' => __( 'Pages', 'widget-options' ),
|
187 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
188 |
-
'multiple' => true,
|
189 |
-
'label_block' => true,
|
190 |
-
'separator' => 'before',
|
191 |
-
'options' => $pages_array,
|
192 |
-
'render_type' => 'none',
|
193 |
-
'description' => __( 'Click on the field to search and select pages', 'widget-options' )
|
194 |
-
],
|
195 |
-
[
|
196 |
-
'overwrite' => true
|
197 |
-
]
|
198 |
-
);
|
199 |
-
}
|
200 |
-
|
201 |
-
if( !empty( $types ) ){
|
202 |
-
$types_array = array();
|
203 |
-
foreach ( $types as $ptype => $type ) {
|
204 |
-
$types_array[ $ptype ] = $type->labels->name;
|
205 |
-
}
|
206 |
-
|
207 |
-
$element->add_control(
|
208 |
-
'widgetopts_types',
|
209 |
-
[
|
210 |
-
'label' => __( 'Post Types', 'widget-options' ),
|
211 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
212 |
-
'multiple' => true,
|
213 |
-
'label_block' => true,
|
214 |
-
'separator' => 'before',
|
215 |
-
'options' => $types_array,
|
216 |
-
'render_type' => 'none',
|
217 |
-
'description' => __( 'Click on the field to search and select custom post types', 'widget-options' )
|
218 |
-
],
|
219 |
-
[
|
220 |
-
'overwrite' => true
|
221 |
-
]
|
222 |
-
);
|
223 |
-
}
|
224 |
-
}
|
225 |
-
|
226 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) && '1' == $widget_options['settings']['visibility']['taxonomies'] ){
|
227 |
-
|
228 |
-
if( !empty( $categories ) ){
|
229 |
-
$cat_array = array();
|
230 |
-
foreach ( $categories as $cat ) {
|
231 |
-
$cat_array[ $cat->cat_ID ] = $cat->cat_name;
|
232 |
-
}
|
233 |
-
|
234 |
-
$element->add_control(
|
235 |
-
'widgetopts_tax_category',
|
236 |
-
[
|
237 |
-
'label' => __( 'Categories', 'widget-options' ),
|
238 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
239 |
-
'multiple' => true,
|
240 |
-
'label_block' => true,
|
241 |
-
'separator' => 'before',
|
242 |
-
'options' => $cat_array,
|
243 |
-
'render_type' => 'none',
|
244 |
-
'description' => __( 'Click on the field to search and select categories', 'widget-options' )
|
245 |
-
],
|
246 |
-
[
|
247 |
-
'overwrite' => true
|
248 |
-
]
|
249 |
-
);
|
250 |
-
}
|
251 |
-
|
252 |
-
if( !empty( $taxonomies ) ){
|
253 |
-
$tax_array = array();
|
254 |
-
foreach ( $taxonomies as $taxonomy ) {
|
255 |
-
$tax_array[ $taxonomy->name ] = $taxonomy->label;
|
256 |
-
}
|
257 |
-
|
258 |
-
$element->add_control(
|
259 |
-
'widgetopts_taxonomies',
|
260 |
-
[
|
261 |
-
'label' => __( 'Taxonomies', 'widget-options' ),
|
262 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
263 |
-
'multiple' => true,
|
264 |
-
'label_block' => true,
|
265 |
-
'separator' => 'before',
|
266 |
-
'options' => $tax_array,
|
267 |
-
'render_type' => 'none',
|
268 |
-
'description' => __( 'Click on the field to search and select taxonomies', 'widget-options' )
|
269 |
-
],
|
270 |
-
[
|
271 |
-
'overwrite' => true
|
272 |
-
]
|
273 |
-
);
|
274 |
-
}
|
275 |
-
}
|
276 |
-
|
277 |
-
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) && '1' == $widget_options['settings']['visibility']['misc'] ){
|
278 |
-
$element->add_control(
|
279 |
-
'widgetopts_misc',
|
280 |
-
[
|
281 |
-
'label' => __( 'Miscellaneous', 'widget-options' ),
|
282 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
283 |
-
'multiple' => true,
|
284 |
-
'label_block' => true,
|
285 |
-
'separator' => 'before',
|
286 |
-
'options' => [
|
287 |
-
'home' => __( 'Home/Front', 'widget-options' ),
|
288 |
-
'blog' => __( 'Blog', 'widget-options' ),
|
289 |
-
'archives' => __( 'Archives', 'widget-options' ),
|
290 |
-
'404' => __( '404', 'widget-options' ),
|
291 |
-
'search' => __( 'Search', 'widget-options' )
|
292 |
-
],
|
293 |
-
'render_type' => 'none',
|
294 |
-
'description' => __( 'Click on the field to search and select miscellaneous pages', 'widget-options' )
|
295 |
-
],
|
296 |
-
[
|
297 |
-
'overwrite' => true
|
298 |
-
]
|
299 |
-
);
|
300 |
-
}
|
301 |
-
$element->end_controls_tab();
|
302 |
-
}
|
303 |
-
}
|
304 |
-
|
305 |
-
if( !function_exists( 'widgetopts_elementor_tab_state' ) ){
|
306 |
-
function widgetopts_elementor_tab_state( $element, $section_id, $args ){
|
307 |
-
global $widget_options;
|
308 |
-
|
309 |
-
$element->start_controls_tab(
|
310 |
-
'widgetopts_tab_state',
|
311 |
-
[
|
312 |
-
|
313 |
-
],
|
314 |
-
[
|
315 |
-
'overwrite' => true
|
316 |
-
]
|
317 |
-
);
|
318 |
-
|
319 |
-
$element->add_control(
|
320 |
-
'widgetopts_roles_state',
|
321 |
-
[
|
322 |
-
'label' => __( 'User Login State', 'widget-options' ),
|
323 |
-
'type' => Elementor\Controls_Manager::SELECT,
|
324 |
-
'default' => 'hide',
|
325 |
-
'options' => [
|
326 |
-
'' => __( 'Select Visibility Option' ),
|
327 |
-
'in' => __( 'Show only for Logged-in Users' ),
|
328 |
-
'out' => __( 'Show only for Logged-out Users' )
|
329 |
-
],
|
330 |
-
'description' => __( 'Restrict widget visibility for logged-in and logged-out users.', 'widget-options' )
|
331 |
-
],
|
332 |
-
[
|
333 |
-
'overwrite' => true
|
334 |
-
]
|
335 |
-
);
|
336 |
-
|
337 |
-
$element->end_controls_tab();
|
338 |
-
}
|
339 |
-
}
|
340 |
-
|
341 |
-
if( !function_exists( 'widgetopts_elementor_tab_settings' ) ){
|
342 |
-
function widgetopts_elementor_tab_settings( $element, $section_id, $args ){
|
343 |
-
global $widget_options;
|
344 |
-
|
345 |
-
$element->start_controls_tab(
|
346 |
-
'widgetopts_tab_settings',
|
347 |
-
[
|
348 |
-
'label' => __( '<
|
349 |
-
],
|
350 |
-
[
|
351 |
-
'overwrite' => true
|
352 |
-
]
|
353 |
-
);
|
354 |
-
|
355 |
-
if( is_plugin_active( 'sliding-widget-options/plugin.php' ) && 'activate' == $widget_options['sliding'] && in_array( $element->get_name(), array( 'button', 'button_plus', 'eael-creative-button', 'cta' ) ) ){
|
356 |
-
$element->add_control(
|
357 |
-
'widgetopts_open_sliding',
|
358 |
-
[
|
359 |
-
'label' => __( 'Open Pop-up or Sliding Widgets', 'widget-options' ),
|
360 |
-
'type' => Elementor\Controls_Manager::SWITCHER,
|
361 |
-
'return_value' => 'on',
|
362 |
-
'default' => '',
|
363 |
-
'separator' => 'none'
|
364 |
-
],
|
365 |
-
[
|
366 |
-
'overwrite' => true
|
367 |
-
]
|
368 |
-
);
|
369 |
-
}
|
370 |
-
|
371 |
-
if( 'activate' == $widget_options['logic'] ){
|
372 |
-
|
373 |
-
$element->add_control(
|
374 |
-
'widgetopts_logic',
|
375 |
-
[
|
376 |
-
'type' => Elementor\Controls_Manager::TEXTAREA,
|
377 |
-
'label' => __( 'Display Widget Logic', 'widget-options' ),
|
378 |
-
'description' => __( 'Add your PHP Conditional Tags. Please note that this will be EVAL\'d directly.', 'widget-options' ),
|
379 |
-
// 'separator' => 'none',
|
380 |
-
],
|
381 |
-
[
|
382 |
-
'overwrite' => true
|
383 |
-
]
|
384 |
-
);
|
385 |
-
}
|
386 |
-
|
387 |
-
|
388 |
-
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
389 |
-
$fields = array();
|
390 |
-
|
391 |
-
if ( function_exists( 'acf_get_field_groups' ) ) {
|
392 |
-
$groups = acf_get_field_groups();
|
393 |
-
if ( is_array( $groups ) ) {
|
394 |
-
foreach ( $groups as $group ) {
|
395 |
-
$fields_group = acf_get_fields( $group );
|
396 |
-
if( !empty( $fields_group ) ){
|
397 |
-
foreach ( $fields_group as $k => $fg ) {
|
398 |
-
$fields[ $fg['key'] ] = $fg['label'];
|
399 |
-
}
|
400 |
-
}
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}else{
|
404 |
-
$groups = apply_filters( 'acf/get_field_groups', array() );
|
405 |
-
if ( is_array( $groups ) ) {
|
406 |
-
foreach ( $groups as $group ) {
|
407 |
-
$fields_group = apply_filters( 'acf/field_group/get_fields', array(), $group['id'] );
|
408 |
-
if( !empty( $fields_group ) ){
|
409 |
-
foreach ( $fields_group as $k => $fg ) {
|
410 |
-
$fields[ $fg['key'] ] = $fg['label'];
|
411 |
-
}
|
412 |
-
}
|
413 |
-
}
|
414 |
-
}
|
415 |
-
}
|
416 |
-
|
417 |
-
$element->add_control(
|
418 |
-
'widgetopts_acf_title',
|
419 |
-
[
|
420 |
-
'type' => Elementor\Controls_Manager::RAW_HTML,
|
421 |
-
'separator' => 'before',
|
422 |
-
'raw' => '<h3>'. __( 'Advanced Custom Fields', 'widget-options' ) .'</h3>',
|
423 |
-
],
|
424 |
-
[
|
425 |
-
'overwrite' => true
|
426 |
-
]
|
427 |
-
);
|
428 |
-
|
429 |
-
$element->add_control(
|
430 |
-
'widgetopts_acf_visibility',
|
431 |
-
[
|
432 |
-
'label' => __( 'Show/Hide', 'widget-options' ),
|
433 |
-
'type' => Elementor\Controls_Manager::SELECT,
|
434 |
-
'default' => 'hide',
|
435 |
-
'options' => [
|
436 |
-
'show' => __( 'Show when Condition\'s Met' ),
|
437 |
-
'hide' => __( 'Hide when Condition\'s Met' )
|
438 |
-
],
|
439 |
-
'separator' => 'before',
|
440 |
-
],
|
441 |
-
[
|
442 |
-
'overwrite' => true
|
443 |
-
]
|
444 |
-
);
|
445 |
-
|
446 |
-
$element->add_control(
|
447 |
-
'widgetopts_acf_field',
|
448 |
-
[
|
449 |
-
'label' => __( 'Select ACF Field', 'widget-options' ),
|
450 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
451 |
-
'multiple' => false,
|
452 |
-
'label_block' => true,
|
453 |
-
'options' => $fields,
|
454 |
-
'render_type' => 'none',
|
455 |
-
'description' => __( 'Select ACF field.', 'widget-options' )
|
456 |
-
],
|
457 |
-
[
|
458 |
-
'overwrite' => true
|
459 |
-
]
|
460 |
-
);
|
461 |
-
|
462 |
-
$element->add_control(
|
463 |
-
'widgetopts_acf_condition',
|
464 |
-
[
|
465 |
-
'label' => __( 'Condition', 'widget-options' ),
|
466 |
-
'type' => Elementor\Controls_Manager::SELECT2,
|
467 |
-
'multiple' => false,
|
468 |
-
'label_block' => true,
|
469 |
-
'options' => [
|
470 |
-
'equal' => __( 'Is Equal To', 'widget-options' ),
|
471 |
-
'not_equal' => __( 'Is Not Equal To', 'widget-options' ),
|
472 |
-
'contains' => __( 'Contains', 'widget-options' ),
|
473 |
-
'not_contains' => __( 'Does Not Contain', 'widget-options' ),
|
474 |
-
'empty' => __( 'Is Empty', 'widget-options' ),
|
475 |
-
'not_empty' => __( 'Is Not Empty', 'widget-options' )
|
476 |
-
],
|
477 |
-
'render_type' => 'none',
|
478 |
-
'description' => __( 'Select your condition for this widget visibility.', 'widget-options' )
|
479 |
-
],
|
480 |
-
[
|
481 |
-
'overwrite' => true
|
482 |
-
]
|
483 |
-
);
|
484 |
-
$element->add_control(
|
485 |
-
'widgetopts_acf',
|
486 |
-
[
|
487 |
-
'type' => Elementor\Controls_Manager::TEXTAREA,
|
488 |
-
'label' => __( 'Conditional Value', 'widget-options' ),
|
489 |
-
'description' => __( 'Add your Conditional Value here if you selected Equal to, Not Equal To or Contains on the selection above.', 'widget-options' ),
|
490 |
-
// 'separator' => 'none',
|
491 |
-
],
|
492 |
-
[
|
493 |
-
'overwrite' => true
|
494 |
-
]
|
495 |
-
);
|
496 |
-
}
|
497 |
-
|
498 |
-
$element->end_controls_tab();
|
499 |
-
}
|
500 |
-
}
|
501 |
-
|
502 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extends funtionality to Elementor Pagebuilder
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 4.3
|
8 |
+
*/
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if( !function_exists( 'widgetopts_elementor_section' ) ){
|
13 |
+
//Add "Widget Options" section to every Elementor Widgets
|
14 |
+
add_action( 'elementor/element/after_section_end', 'widgetopts_elementor_section', 10, 3 );
|
15 |
+
function widgetopts_elementor_section( $element, $section_id, $args ){
|
16 |
+
if ( Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
17 |
+
global $widget_options;
|
18 |
+
|
19 |
+
//filter the elements first to avoid conflicts that can cause pagebuilder not to load
|
20 |
+
if ( !in_array( $element->get_name(), array( 'global-settings', 'section', 'page-settings', 'oew-blog-grid' ) ) ) {
|
21 |
+
|
22 |
+
//create array of section_id to set Widget Options Section to single section to avoid issues
|
23 |
+
$widgetopts_elementor_section_id = apply_filters( 'widgetopts_elementor_section_id', array(
|
24 |
+
'section_image',
|
25 |
+
'section_advanced',
|
26 |
+
'section_title',
|
27 |
+
'section_editor',
|
28 |
+
'section_video',
|
29 |
+
'section_button',
|
30 |
+
'section_divider',
|
31 |
+
'section_spacer',
|
32 |
+
'section_map',
|
33 |
+
'section_icon',
|
34 |
+
'section_gallery',
|
35 |
+
'section_image_carousel',
|
36 |
+
'section_icon_list',
|
37 |
+
'section_counter',
|
38 |
+
'section_testimonial',
|
39 |
+
'section_tabs',
|
40 |
+
'section_toggle',
|
41 |
+
'section_social_icon',
|
42 |
+
'section_alert',
|
43 |
+
'section_audio',
|
44 |
+
'section_shortcode',
|
45 |
+
'section_anchor',
|
46 |
+
'section_sidebar',
|
47 |
+
'section_layout',
|
48 |
+
'section_slides',
|
49 |
+
'section_form_fields',
|
50 |
+
'section_list',
|
51 |
+
'section_header',
|
52 |
+
'section_pricing',
|
53 |
+
'section_countdown',
|
54 |
+
'section_buttons_content',
|
55 |
+
'section_blockquote_content',
|
56 |
+
'section_content',
|
57 |
+
'section_login_content',
|
58 |
+
'text_elements',
|
59 |
+
'section_side_a_content',
|
60 |
+
'section_side_b_content',
|
61 |
+
'_section_style'
|
62 |
+
)
|
63 |
+
);
|
64 |
+
|
65 |
+
//filter by the section_ids above
|
66 |
+
if( in_array( $section_id, $widgetopts_elementor_section_id ) ){
|
67 |
+
$element->start_controls_section(
|
68 |
+
'widgetopts_section',
|
69 |
+
[
|
70 |
+
'tab' => Elementor\Controls_Manager::TAB_ADVANCED,
|
71 |
+
'label' => __( 'Widget Options', 'widget-options' ),
|
72 |
+
],
|
73 |
+
[
|
74 |
+
'overwrite' => true
|
75 |
+
]
|
76 |
+
);
|
77 |
+
|
78 |
+
$element->start_controls_tabs( 'widgetopts_content_tabs',[
|
79 |
+
'overwrite' => true
|
80 |
+
] );
|
81 |
+
|
82 |
+
if( isset( $widget_options['visibility'] ) && 'activate' == $widget_options['visibility'] ){
|
83 |
+
widgetopts_elementor_tab_visibility( $element, $section_id, $args );
|
84 |
+
}
|
85 |
+
|
86 |
+
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] ){
|
87 |
+
widgetopts_elementor_tab_state( $element, $section_id, $args );
|
88 |
+
}
|
89 |
+
|
90 |
+
if( 'activate' == $widget_options['logic'] || ( isset( $widget_options['sliding'] ) && 'activate' == $widget_options['sliding'] && in_array( $element->get_name(), array( 'button', 'button_plus', 'eael-creative-button', 'cta' ) ) ) ){
|
91 |
+
widgetopts_elementor_tab_settings( $element, $section_id, $args );
|
92 |
+
}
|
93 |
+
|
94 |
+
//upsell pro
|
95 |
+
if( !is_plugin_active( 'extended-widget-options/plugin.php' ) ){
|
96 |
+
$element->start_controls_tab(
|
97 |
+
'widgetopts_tab_upsell',
|
98 |
+
[
|
99 |
+
'label' => __( '<i class="dashicons dashicons-plus"></i>', 'widget-options' )
|
100 |
+
],
|
101 |
+
[
|
102 |
+
'overwrite' => true
|
103 |
+
]
|
104 |
+
);
|
105 |
+
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=elementor&utm_medium=upgrade&utm_campaign=upgradebtn');
|
106 |
+
$element->add_control(
|
107 |
+
'widgetopts_pro',
|
108 |
+
[
|
109 |
+
'type' => Elementor\Controls_Manager::RAW_HTML,
|
110 |
+
'raw' => '<div class="elementor-panel-nerd-box">
|
111 |
+
<i class="elementor-panel-nerd-box-icon dashicons dashicons-lock"></i>
|
112 |
+
<div class="elementor-panel-nerd-box-title">' .
|
113 |
+
__( 'Unlock All Widget Options', 'widget-options' ) .
|
114 |
+
'</div>
|
115 |
+
<div class="elementor-panel-nerd-box-message">' .
|
116 |
+
__( 'Upgrade to Extended Widget Options to unlock all options to easily control and manage each Elementor widget.', 'widget-options' ) .
|
117 |
+
'</div>
|
118 |
+
<a href="'.$upgrade_link.'" class="elementor-panel-nerd-box-link elementor-button elementor-button-default elementor-go-pro" target="_blank">' .
|
119 |
+
__( 'Upgrade Now!', 'widget-options' ) .
|
120 |
+
'</a>
|
121 |
+
</div>',
|
122 |
+
],
|
123 |
+
[
|
124 |
+
'overwrite' => true
|
125 |
+
]
|
126 |
+
);
|
127 |
+
$element->end_controls_tab();
|
128 |
+
}
|
129 |
+
$element->end_controls_tabs();
|
130 |
+
|
131 |
+
$element->end_controls_section();
|
132 |
+
}
|
133 |
+
}
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
if( !function_exists( 'widgetopts_elementor_tab_visibility' ) ){
|
139 |
+
function widgetopts_elementor_tab_visibility( $element, $section_id, $args ){
|
140 |
+
global $widget_options, $widgetopts_taxonomies, $widgetopts_pages, $widgetopts_types, $widgetopts_categories;
|
141 |
+
|
142 |
+
$pages = ( !empty( $widgetopts_pages ) ) ? $widgetopts_pages : array();
|
143 |
+
$taxonomies = ( !empty( $widgetopts_taxonomies ) ) ? $widgetopts_taxonomies : array();
|
144 |
+
$types = ( !empty( $widgetopts_types ) ) ? $widgetopts_types : array();
|
145 |
+
$categories = ( !empty( $widgetopts_categories ) ) ? $widgetopts_categories : array();
|
146 |
+
|
147 |
+
// print_r( $get_terms['community-category'] );
|
148 |
+
|
149 |
+
$element->start_controls_tab(
|
150 |
+
'widgetopts_tab_visibility',
|
151 |
+
[
|
152 |
+
'label' => __( '<span class="dashicons dashicons-visibility"></span>', 'widget-options' )
|
153 |
+
],
|
154 |
+
[
|
155 |
+
'overwrite' => true
|
156 |
+
]
|
157 |
+
);
|
158 |
+
|
159 |
+
$element->add_control(
|
160 |
+
'widgetopts_visibility',
|
161 |
+
[
|
162 |
+
'label' => __( 'Show/Hide', 'widget-options' ),
|
163 |
+
'type' => Elementor\Controls_Manager::SELECT,
|
164 |
+
'default' => 'hide',
|
165 |
+
'options' => [
|
166 |
+
'show' => __( 'Show on Selected Pages' ),
|
167 |
+
'hide' => __( 'Hide on Selected Pages' )
|
168 |
+
],
|
169 |
+
// 'separator' => 'none'
|
170 |
+
],
|
171 |
+
[
|
172 |
+
'overwrite' => true
|
173 |
+
]
|
174 |
+
);
|
175 |
+
|
176 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) && '1' == $widget_options['settings']['visibility']['post_type'] ){
|
177 |
+
$pages_array = array();
|
178 |
+
if( !empty( $pages ) ){
|
179 |
+
foreach ( $pages as $page ) {
|
180 |
+
$pages_array[ $page->ID ] = $page->post_title;
|
181 |
+
}
|
182 |
+
|
183 |
+
$element->add_control(
|
184 |
+
'widgetopts_pages',
|
185 |
+
[
|
186 |
+
'label' => __( 'Pages', 'widget-options' ),
|
187 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
188 |
+
'multiple' => true,
|
189 |
+
'label_block' => true,
|
190 |
+
'separator' => 'before',
|
191 |
+
'options' => $pages_array,
|
192 |
+
'render_type' => 'none',
|
193 |
+
'description' => __( 'Click on the field to search and select pages', 'widget-options' )
|
194 |
+
],
|
195 |
+
[
|
196 |
+
'overwrite' => true
|
197 |
+
]
|
198 |
+
);
|
199 |
+
}
|
200 |
+
|
201 |
+
if( !empty( $types ) ){
|
202 |
+
$types_array = array();
|
203 |
+
foreach ( $types as $ptype => $type ) {
|
204 |
+
$types_array[ $ptype ] = $type->labels->name;
|
205 |
+
}
|
206 |
+
|
207 |
+
$element->add_control(
|
208 |
+
'widgetopts_types',
|
209 |
+
[
|
210 |
+
'label' => __( 'Post Types', 'widget-options' ),
|
211 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
212 |
+
'multiple' => true,
|
213 |
+
'label_block' => true,
|
214 |
+
'separator' => 'before',
|
215 |
+
'options' => $types_array,
|
216 |
+
'render_type' => 'none',
|
217 |
+
'description' => __( 'Click on the field to search and select custom post types', 'widget-options' )
|
218 |
+
],
|
219 |
+
[
|
220 |
+
'overwrite' => true
|
221 |
+
]
|
222 |
+
);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) && '1' == $widget_options['settings']['visibility']['taxonomies'] ){
|
227 |
+
|
228 |
+
if( !empty( $categories ) ){
|
229 |
+
$cat_array = array();
|
230 |
+
foreach ( $categories as $cat ) {
|
231 |
+
$cat_array[ $cat->cat_ID ] = $cat->cat_name;
|
232 |
+
}
|
233 |
+
|
234 |
+
$element->add_control(
|
235 |
+
'widgetopts_tax_category',
|
236 |
+
[
|
237 |
+
'label' => __( 'Categories', 'widget-options' ),
|
238 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
239 |
+
'multiple' => true,
|
240 |
+
'label_block' => true,
|
241 |
+
'separator' => 'before',
|
242 |
+
'options' => $cat_array,
|
243 |
+
'render_type' => 'none',
|
244 |
+
'description' => __( 'Click on the field to search and select categories', 'widget-options' )
|
245 |
+
],
|
246 |
+
[
|
247 |
+
'overwrite' => true
|
248 |
+
]
|
249 |
+
);
|
250 |
+
}
|
251 |
+
|
252 |
+
if( !empty( $taxonomies ) ){
|
253 |
+
$tax_array = array();
|
254 |
+
foreach ( $taxonomies as $taxonomy ) {
|
255 |
+
$tax_array[ $taxonomy->name ] = $taxonomy->label;
|
256 |
+
}
|
257 |
+
|
258 |
+
$element->add_control(
|
259 |
+
'widgetopts_taxonomies',
|
260 |
+
[
|
261 |
+
'label' => __( 'Taxonomies', 'widget-options' ),
|
262 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
263 |
+
'multiple' => true,
|
264 |
+
'label_block' => true,
|
265 |
+
'separator' => 'before',
|
266 |
+
'options' => $tax_array,
|
267 |
+
'render_type' => 'none',
|
268 |
+
'description' => __( 'Click on the field to search and select taxonomies', 'widget-options' )
|
269 |
+
],
|
270 |
+
[
|
271 |
+
'overwrite' => true
|
272 |
+
]
|
273 |
+
);
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
if( isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) && '1' == $widget_options['settings']['visibility']['misc'] ){
|
278 |
+
$element->add_control(
|
279 |
+
'widgetopts_misc',
|
280 |
+
[
|
281 |
+
'label' => __( 'Miscellaneous', 'widget-options' ),
|
282 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
283 |
+
'multiple' => true,
|
284 |
+
'label_block' => true,
|
285 |
+
'separator' => 'before',
|
286 |
+
'options' => [
|
287 |
+
'home' => __( 'Home/Front', 'widget-options' ),
|
288 |
+
'blog' => __( 'Blog', 'widget-options' ),
|
289 |
+
'archives' => __( 'Archives', 'widget-options' ),
|
290 |
+
'404' => __( '404', 'widget-options' ),
|
291 |
+
'search' => __( 'Search', 'widget-options' )
|
292 |
+
],
|
293 |
+
'render_type' => 'none',
|
294 |
+
'description' => __( 'Click on the field to search and select miscellaneous pages', 'widget-options' )
|
295 |
+
],
|
296 |
+
[
|
297 |
+
'overwrite' => true
|
298 |
+
]
|
299 |
+
);
|
300 |
+
}
|
301 |
+
$element->end_controls_tab();
|
302 |
+
}
|
303 |
+
}
|
304 |
+
|
305 |
+
if( !function_exists( 'widgetopts_elementor_tab_state' ) ){
|
306 |
+
function widgetopts_elementor_tab_state( $element, $section_id, $args ){
|
307 |
+
global $widget_options;
|
308 |
+
|
309 |
+
$element->start_controls_tab(
|
310 |
+
'widgetopts_tab_state',
|
311 |
+
[
|
312 |
+
'label' => __( '<span class="dashicons dashicons-admin-users"></span>', 'widget-options' )
|
313 |
+
],
|
314 |
+
[
|
315 |
+
'overwrite' => true
|
316 |
+
]
|
317 |
+
);
|
318 |
+
|
319 |
+
$element->add_control(
|
320 |
+
'widgetopts_roles_state',
|
321 |
+
[
|
322 |
+
'label' => __( 'User Login State', 'widget-options' ),
|
323 |
+
'type' => Elementor\Controls_Manager::SELECT,
|
324 |
+
'default' => 'hide',
|
325 |
+
'options' => [
|
326 |
+
'' => __( 'Select Visibility Option' ),
|
327 |
+
'in' => __( 'Show only for Logged-in Users' ),
|
328 |
+
'out' => __( 'Show only for Logged-out Users' )
|
329 |
+
],
|
330 |
+
'description' => __( 'Restrict widget visibility for logged-in and logged-out users.', 'widget-options' )
|
331 |
+
],
|
332 |
+
[
|
333 |
+
'overwrite' => true
|
334 |
+
]
|
335 |
+
);
|
336 |
+
|
337 |
+
$element->end_controls_tab();
|
338 |
+
}
|
339 |
+
}
|
340 |
+
|
341 |
+
if( !function_exists( 'widgetopts_elementor_tab_settings' ) ){
|
342 |
+
function widgetopts_elementor_tab_settings( $element, $section_id, $args ){
|
343 |
+
global $widget_options;
|
344 |
+
|
345 |
+
$element->start_controls_tab(
|
346 |
+
'widgetopts_tab_settings',
|
347 |
+
[
|
348 |
+
'label' => __( '<span class="dashicons dashicons-admin-generic"></span>', 'widget-options' )
|
349 |
+
],
|
350 |
+
[
|
351 |
+
'overwrite' => true
|
352 |
+
]
|
353 |
+
);
|
354 |
+
|
355 |
+
if( is_plugin_active( 'sliding-widget-options/plugin.php' ) && 'activate' == $widget_options['sliding'] && in_array( $element->get_name(), array( 'button', 'button_plus', 'eael-creative-button', 'cta' ) ) ){
|
356 |
+
$element->add_control(
|
357 |
+
'widgetopts_open_sliding',
|
358 |
+
[
|
359 |
+
'label' => __( 'Open Pop-up or Sliding Widgets', 'widget-options' ),
|
360 |
+
'type' => Elementor\Controls_Manager::SWITCHER,
|
361 |
+
'return_value' => 'on',
|
362 |
+
'default' => '',
|
363 |
+
'separator' => 'none'
|
364 |
+
],
|
365 |
+
[
|
366 |
+
'overwrite' => true
|
367 |
+
]
|
368 |
+
);
|
369 |
+
}
|
370 |
+
|
371 |
+
if( 'activate' == $widget_options['logic'] ){
|
372 |
+
|
373 |
+
$element->add_control(
|
374 |
+
'widgetopts_logic',
|
375 |
+
[
|
376 |
+
'type' => Elementor\Controls_Manager::TEXTAREA,
|
377 |
+
'label' => __( 'Display Widget Logic', 'widget-options' ),
|
378 |
+
'description' => __( 'Add your PHP Conditional Tags. Please note that this will be EVAL\'d directly.', 'widget-options' ),
|
379 |
+
// 'separator' => 'none',
|
380 |
+
],
|
381 |
+
[
|
382 |
+
'overwrite' => true
|
383 |
+
]
|
384 |
+
);
|
385 |
+
}
|
386 |
+
|
387 |
+
|
388 |
+
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
389 |
+
$fields = array();
|
390 |
+
|
391 |
+
if ( function_exists( 'acf_get_field_groups' ) ) {
|
392 |
+
$groups = acf_get_field_groups();
|
393 |
+
if ( is_array( $groups ) ) {
|
394 |
+
foreach ( $groups as $group ) {
|
395 |
+
$fields_group = acf_get_fields( $group );
|
396 |
+
if( !empty( $fields_group ) ){
|
397 |
+
foreach ( $fields_group as $k => $fg ) {
|
398 |
+
$fields[ $fg['key'] ] = $fg['label'];
|
399 |
+
}
|
400 |
+
}
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}else{
|
404 |
+
$groups = apply_filters( 'acf/get_field_groups', array() );
|
405 |
+
if ( is_array( $groups ) ) {
|
406 |
+
foreach ( $groups as $group ) {
|
407 |
+
$fields_group = apply_filters( 'acf/field_group/get_fields', array(), $group['id'] );
|
408 |
+
if( !empty( $fields_group ) ){
|
409 |
+
foreach ( $fields_group as $k => $fg ) {
|
410 |
+
$fields[ $fg['key'] ] = $fg['label'];
|
411 |
+
}
|
412 |
+
}
|
413 |
+
}
|
414 |
+
}
|
415 |
+
}
|
416 |
+
|
417 |
+
$element->add_control(
|
418 |
+
'widgetopts_acf_title',
|
419 |
+
[
|
420 |
+
'type' => Elementor\Controls_Manager::RAW_HTML,
|
421 |
+
'separator' => 'before',
|
422 |
+
'raw' => '<h3>'. __( 'Advanced Custom Fields', 'widget-options' ) .'</h3>',
|
423 |
+
],
|
424 |
+
[
|
425 |
+
'overwrite' => true
|
426 |
+
]
|
427 |
+
);
|
428 |
+
|
429 |
+
$element->add_control(
|
430 |
+
'widgetopts_acf_visibility',
|
431 |
+
[
|
432 |
+
'label' => __( 'Show/Hide', 'widget-options' ),
|
433 |
+
'type' => Elementor\Controls_Manager::SELECT,
|
434 |
+
'default' => 'hide',
|
435 |
+
'options' => [
|
436 |
+
'show' => __( 'Show when Condition\'s Met' ),
|
437 |
+
'hide' => __( 'Hide when Condition\'s Met' )
|
438 |
+
],
|
439 |
+
'separator' => 'before',
|
440 |
+
],
|
441 |
+
[
|
442 |
+
'overwrite' => true
|
443 |
+
]
|
444 |
+
);
|
445 |
+
|
446 |
+
$element->add_control(
|
447 |
+
'widgetopts_acf_field',
|
448 |
+
[
|
449 |
+
'label' => __( 'Select ACF Field', 'widget-options' ),
|
450 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
451 |
+
'multiple' => false,
|
452 |
+
'label_block' => true,
|
453 |
+
'options' => $fields,
|
454 |
+
'render_type' => 'none',
|
455 |
+
'description' => __( 'Select ACF field.', 'widget-options' )
|
456 |
+
],
|
457 |
+
[
|
458 |
+
'overwrite' => true
|
459 |
+
]
|
460 |
+
);
|
461 |
+
|
462 |
+
$element->add_control(
|
463 |
+
'widgetopts_acf_condition',
|
464 |
+
[
|
465 |
+
'label' => __( 'Condition', 'widget-options' ),
|
466 |
+
'type' => Elementor\Controls_Manager::SELECT2,
|
467 |
+
'multiple' => false,
|
468 |
+
'label_block' => true,
|
469 |
+
'options' => [
|
470 |
+
'equal' => __( 'Is Equal To', 'widget-options' ),
|
471 |
+
'not_equal' => __( 'Is Not Equal To', 'widget-options' ),
|
472 |
+
'contains' => __( 'Contains', 'widget-options' ),
|
473 |
+
'not_contains' => __( 'Does Not Contain', 'widget-options' ),
|
474 |
+
'empty' => __( 'Is Empty', 'widget-options' ),
|
475 |
+
'not_empty' => __( 'Is Not Empty', 'widget-options' )
|
476 |
+
],
|
477 |
+
'render_type' => 'none',
|
478 |
+
'description' => __( 'Select your condition for this widget visibility.', 'widget-options' )
|
479 |
+
],
|
480 |
+
[
|
481 |
+
'overwrite' => true
|
482 |
+
]
|
483 |
+
);
|
484 |
+
$element->add_control(
|
485 |
+
'widgetopts_acf',
|
486 |
+
[
|
487 |
+
'type' => Elementor\Controls_Manager::TEXTAREA,
|
488 |
+
'label' => __( 'Conditional Value', 'widget-options' ),
|
489 |
+
'description' => __( 'Add your Conditional Value here if you selected Equal to, Not Equal To or Contains on the selection above.', 'widget-options' ),
|
490 |
+
// 'separator' => 'none',
|
491 |
+
],
|
492 |
+
[
|
493 |
+
'overwrite' => true
|
494 |
+
]
|
495 |
+
);
|
496 |
+
}
|
497 |
+
|
498 |
+
$element->end_controls_tab();
|
499 |
+
}
|
500 |
+
}
|
501 |
+
|
502 |
+
?>
|
includes/pagebuilders/elementor/render.php
CHANGED
@@ -1,448 +1,448 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Extends funtionality to Elementor Pagebuilder
|
4 |
-
*
|
5 |
-
*
|
6 |
-
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
-
* @since 4.3
|
8 |
-
*/
|
9 |
-
// Exit if accessed directly
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
|
12 |
-
if( !function_exists( 'widgetopts_elementor_render' ) ){
|
13 |
-
add_action( 'elementor/widget/render_content', 'widgetopts_elementor_render', 10, 2 );
|
14 |
-
function widgetopts_elementor_render( $content, $widget ){
|
15 |
-
if ( !Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
16 |
-
global $widget_options;
|
17 |
-
$settings = $widget->get_settings();
|
18 |
-
|
19 |
-
$hidden = false;
|
20 |
-
$placeholder = '<div class="widgetopts-placeholder-e"></div>';
|
21 |
-
$visibility_opts = isset( $settings['widgetopts_visibility'] ) ? $settings['widgetopts_visibility'] : 'hide';
|
22 |
-
|
23 |
-
$tax_opts = ( isset( $widget_options['settings'] ) && isset( $widget_options['settings']['taxonomies_keys'] ) ) ? $widget_options['settings']['taxonomies_keys'] : array();
|
24 |
-
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
25 |
-
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
26 |
-
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
27 |
-
|
28 |
-
//pages
|
29 |
-
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
30 |
-
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'home', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
31 |
-
$hidden = true; //hide if checked on hidden pages
|
32 |
-
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'home', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
33 |
-
$hidden = true; //hide if not checked on visible pages
|
34 |
-
}
|
35 |
-
|
36 |
-
//do return to bypass other conditions
|
37 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_home', $hidden );
|
38 |
-
if( $hidden ){
|
39 |
-
return $placeholder;
|
40 |
-
}
|
41 |
-
}elseif ( $is_misc && is_home() ) {
|
42 |
-
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'blog', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
43 |
-
$hidden = true; //hide if checked on hidden pages
|
44 |
-
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'blog', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
45 |
-
$hidden = true; //hide if not checked on visible pages
|
46 |
-
}
|
47 |
-
|
48 |
-
//do return to bypass other conditions
|
49 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_blog', $hidden );
|
50 |
-
if( $hidden ){
|
51 |
-
return $placeholder;
|
52 |
-
}
|
53 |
-
}elseif ( $is_tax && is_category() ) {
|
54 |
-
//category page
|
55 |
-
if( !isset( $settings['widgetopts_tax_category'] ) ){
|
56 |
-
$settings['widgetopts_tax_category'] = array();
|
57 |
-
}
|
58 |
-
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
59 |
-
$settings['widgetopts_taxonomies'] = array();
|
60 |
-
}
|
61 |
-
|
62 |
-
$cat_lists = $settings['widgetopts_tax_category'];
|
63 |
-
if( !in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' && in_array( get_query_var('cat') , $cat_lists ) ){
|
64 |
-
$hidden = true; //hide if exists on hidden pages
|
65 |
-
}elseif( !in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' && !in_array( get_query_var('cat') , $cat_lists ) ){
|
66 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
67 |
-
}elseif( in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
68 |
-
$hidden = true; //hide to all categories
|
69 |
-
}elseif( in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
70 |
-
$hidden = false; //hide to all categories
|
71 |
-
}
|
72 |
-
//
|
73 |
-
// //do return to bypass other conditions
|
74 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_categories', $hidden );
|
75 |
-
if( $hidden ){
|
76 |
-
return $placeholder;
|
77 |
-
}
|
78 |
-
}elseif ( $is_tax && is_tag() ) {
|
79 |
-
if( !isset( $settings['widgetopts_tax_post_tag'] ) ){
|
80 |
-
$settings['widgetopts_tax_post_tag'] = array();
|
81 |
-
}
|
82 |
-
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
83 |
-
$settings['widgetopts_taxonomies'] = array();
|
84 |
-
}
|
85 |
-
|
86 |
-
if( in_array( 'post_tag', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
87 |
-
$hidden = true; //hide to all tags
|
88 |
-
}elseif( in_array( 'post_tag', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
89 |
-
$hidden = false; //hide to all tags
|
90 |
-
}
|
91 |
-
//
|
92 |
-
// //do return to bypass other conditions
|
93 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_tags', $hidden );
|
94 |
-
if( $hidden ){
|
95 |
-
return $placeholder;
|
96 |
-
}
|
97 |
-
}elseif ( $is_tax && is_tax() ) {
|
98 |
-
$term = get_queried_object();
|
99 |
-
|
100 |
-
//taxonomies page
|
101 |
-
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
102 |
-
$settings['widgetopts_taxonomies'] = array();
|
103 |
-
}
|
104 |
-
// print_r( $term_lists );
|
105 |
-
if( in_array( $term->taxonomy, $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
106 |
-
$hidden = true; //hide to all tags
|
107 |
-
}elseif( !in_array( $term->taxonomy, $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
108 |
-
$hidden = true; //hide to all tags
|
109 |
-
}
|
110 |
-
|
111 |
-
//do return to bypass other conditions
|
112 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_taxonomies', $hidden );
|
113 |
-
if( $hidden ){
|
114 |
-
return $placeholder;
|
115 |
-
}
|
116 |
-
}elseif ( $is_misc && is_archive() ) {
|
117 |
-
//archives page
|
118 |
-
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'archives', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
119 |
-
$hidden = true; //hide if checked on hidden pages
|
120 |
-
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'archives', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
121 |
-
$hidden = true; //hide if not checked on visible pages
|
122 |
-
}
|
123 |
-
|
124 |
-
//do return to bypass other conditions
|
125 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_archives', $hidden );
|
126 |
-
if( $hidden ){
|
127 |
-
return $placeholder;
|
128 |
-
}
|
129 |
-
}elseif ( $is_misc && is_404() ) {
|
130 |
-
//404 page
|
131 |
-
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( '404', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
132 |
-
$hidden = true; //hide if checked on hidden pages
|
133 |
-
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( '404', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
134 |
-
$hidden = true; //hide if not checked on visible pages
|
135 |
-
}
|
136 |
-
|
137 |
-
//do return to bypass other conditions
|
138 |
-
$hidden = apply_filters( 'widget_options_visibility_404', $hidden );
|
139 |
-
if( $hidden ){
|
140 |
-
return $placeholder;
|
141 |
-
}
|
142 |
-
}elseif ( $is_misc && is_search() ) {
|
143 |
-
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'search', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
144 |
-
$hidden = true; //hide if checked on hidden pages
|
145 |
-
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'search', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
146 |
-
$hidden = true;
|
147 |
-
}
|
148 |
-
|
149 |
-
//do return to bypass other conditions
|
150 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_search', $hidden );
|
151 |
-
if( $hidden ){
|
152 |
-
return $placeholder;
|
153 |
-
}
|
154 |
-
}elseif ( is_single() && !is_page() ) {
|
155 |
-
global $wp_query;
|
156 |
-
$post = $wp_query->post;
|
157 |
-
|
158 |
-
if( !isset( $settings['widgetopts_types'] ) || ( $is_types && !isset( $settings['widgetopts_types'] ) ) ){
|
159 |
-
$settings['widgetopts_types'] = array();
|
160 |
-
}
|
161 |
-
|
162 |
-
if( $visibility_opts == 'hide' && in_array( $post->post_type , $settings['widgetopts_types']) ){
|
163 |
-
$hidden = true; //hide if exists on hidden pages
|
164 |
-
}elseif( $visibility_opts == 'show' && !in_array( $post->post_type , $settings['widgetopts_types']) ){
|
165 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
166 |
-
}
|
167 |
-
|
168 |
-
// do return to bypass other conditions
|
169 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_single', $hidden );
|
170 |
-
|
171 |
-
|
172 |
-
// $taxonomy_names = get_post_taxonomies( $post->ID );
|
173 |
-
// $array_intersect = array_intersect( $tax_opts, $taxonomy_names );
|
174 |
-
|
175 |
-
if( !isset( $settings['widgetopts_tax_category'] ) ){
|
176 |
-
$settings['widgetopts_tax_category'] = array();
|
177 |
-
}
|
178 |
-
|
179 |
-
if( isset( $settings['widgetopts_tax_category'] ) && !empty( $settings['widgetopts_tax_category'] ) ){
|
180 |
-
$cats = wp_get_post_categories( $post->ID );
|
181 |
-
|
182 |
-
if( is_array( $cats ) && !empty( $cats ) ){
|
183 |
-
$checked_cats = $settings['widgetopts_tax_category'];
|
184 |
-
$intersect = array_intersect( $cats , $checked_cats );
|
185 |
-
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
186 |
-
$hidden = true;
|
187 |
-
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
188 |
-
$hidden = false;
|
189 |
-
}
|
190 |
-
|
191 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_single_category', $hidden );
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
if( $hidden ){
|
196 |
-
return $placeholder;
|
197 |
-
}
|
198 |
-
}elseif ( $is_types && is_page() ) {
|
199 |
-
global $wp_query;
|
200 |
-
|
201 |
-
$post = $wp_query->post;
|
202 |
-
|
203 |
-
//do post type condition first
|
204 |
-
if( isset( $settings['widgetopts_types'] ) ){
|
205 |
-
if( $visibility_opts == 'hide' && in_array( 'page', $settings['widgetopts_types'] ) ){
|
206 |
-
$hidden = true; //hide if exists on hidden pages
|
207 |
-
}elseif( $visibility_opts == 'show' && !in_array( 'page', $settings['widgetopts_types'] ) ){
|
208 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
209 |
-
}
|
210 |
-
}else{
|
211 |
-
// print_r( $settings['widgetopts_pages'] );
|
212 |
-
//do per pages condition
|
213 |
-
if( !isset( $settings['widgetopts_pages'] ) ){
|
214 |
-
$settings['widgetopts_pages'] = array();
|
215 |
-
}
|
216 |
-
|
217 |
-
if( $visibility_opts == 'hide' && in_array( $post->ID , $settings['widgetopts_pages'] ) ){
|
218 |
-
$hidden = true; //hide if exists on hidden pages
|
219 |
-
}elseif( $visibility_opts == 'show' && !in_array( $post->ID , $settings['widgetopts_pages'] ) ){
|
220 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
221 |
-
}
|
222 |
-
}
|
223 |
-
|
224 |
-
// //do return to bypass other conditions
|
225 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_page', $hidden );
|
226 |
-
if( $hidden ){
|
227 |
-
return $placeholder;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
|
231 |
-
//ACF
|
232 |
-
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
233 |
-
if( isset( $settings['widgetopts_acf_field'] ) && !empty( $settings['widgetopts_acf_field'] ) ){
|
234 |
-
$acf = get_field_object( $settings['widgetopts_acf_field'] );
|
235 |
-
if( $acf && is_array( $acf ) ){
|
236 |
-
$acf_visibility = isset( $settings['widgetopts_acf_visibility'] ) ? $settings['widgetopts_acf_visibility'] : 'hide';
|
237 |
-
|
238 |
-
//handle repeater fields
|
239 |
-
if( isset( $acf['value'] ) ){
|
240 |
-
if( is_array( $acf['value'] ) ){
|
241 |
-
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
242 |
-
$acf_implode = '';
|
243 |
-
if( is_array( $acf_array_value ) ){
|
244 |
-
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
245 |
-
}
|
246 |
-
return $acf_implode;
|
247 |
-
}, $acf['value']));
|
248 |
-
}
|
249 |
-
}
|
250 |
-
switch ( $settings['widgetopts_acf_condition'] ) {
|
251 |
-
case 'equal':
|
252 |
-
if( isset( $acf['value'] ) ){
|
253 |
-
if( 'show' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
254 |
-
$hidden = false;
|
255 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
256 |
-
$hidden = true;
|
257 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
258 |
-
$hidden = true;
|
259 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
260 |
-
$hidden = false;
|
261 |
-
}
|
262 |
-
}
|
263 |
-
break;
|
264 |
-
|
265 |
-
case 'not_equal':
|
266 |
-
if( isset( $acf['value'] ) ){
|
267 |
-
if( 'show' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
268 |
-
$hidden = true;
|
269 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
270 |
-
$hidden = false;
|
271 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
272 |
-
$hidden = false;
|
273 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
274 |
-
$hidden = true;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
break;
|
278 |
-
|
279 |
-
case 'contains':
|
280 |
-
if( isset( $acf['value'] ) ){
|
281 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
282 |
-
$hidden = false;
|
283 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
284 |
-
$hidden = true;
|
285 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
286 |
-
$hidden = true;
|
287 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
288 |
-
$hidden = false;
|
289 |
-
}
|
290 |
-
}
|
291 |
-
break;
|
292 |
-
|
293 |
-
case 'not_contains':
|
294 |
-
if( isset( $acf['value'] ) ){
|
295 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
296 |
-
$hidden = true;
|
297 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
298 |
-
$hidden = false;
|
299 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
300 |
-
$hidden = false;
|
301 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
302 |
-
$hidden = true;
|
303 |
-
}
|
304 |
-
}
|
305 |
-
break;
|
306 |
-
|
307 |
-
case 'empty':
|
308 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
309 |
-
$hidden = false;
|
310 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
311 |
-
$hidden = true;
|
312 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
313 |
-
$hidden = true;
|
314 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
315 |
-
$hidden = false;
|
316 |
-
}
|
317 |
-
break;
|
318 |
-
|
319 |
-
case 'not_empty':
|
320 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
321 |
-
$hidden = true;
|
322 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
323 |
-
$hidden = false;
|
324 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
325 |
-
$hidden = false;
|
326 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
327 |
-
$hidden = true;
|
328 |
-
}
|
329 |
-
break;
|
330 |
-
|
331 |
-
default:
|
332 |
-
# code...
|
333 |
-
break;
|
334 |
-
}
|
335 |
-
|
336 |
-
// //do return to bypass other conditions
|
337 |
-
$hidden = apply_filters( 'widgetopts_elementor_visibility_acf', $hidden );
|
338 |
-
if( $hidden ){
|
339 |
-
return $placeholder;
|
340 |
-
}
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
//widget logic
|
346 |
-
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] ){
|
347 |
-
if( isset( $settings['widgetopts_roles_state'] ) && !empty( $settings['widgetopts_roles_state'] ) ){
|
348 |
-
//do state action here
|
349 |
-
if( $settings['widgetopts_roles_state'] == 'out' && is_user_logged_in() ){
|
350 |
-
return $placeholder;
|
351 |
-
}else if( $settings['widgetopts_roles_state'] == 'in' && !is_user_logged_in() ){
|
352 |
-
return $placeholder;
|
353 |
-
}
|
354 |
-
}
|
355 |
-
}
|
356 |
-
|
357 |
-
//widget logic
|
358 |
-
if( 'activate' == $widget_options['logic'] ){
|
359 |
-
if( isset( $settings['widgetopts_logic'] ) && !empty( $settings['widgetopts_logic'] ) ){
|
360 |
-
//do widget logic
|
361 |
-
$display_logic = stripslashes( trim( $settings['widgetopts_logic'] ) );
|
362 |
-
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
363 |
-
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
364 |
-
if ( $display_logic === false ){
|
365 |
-
return $placeholder;
|
366 |
-
}
|
367 |
-
if ( $display_logic === true ){
|
368 |
-
return $content;
|
369 |
-
}
|
370 |
-
if ( stristr($display_logic,"return")===false ){
|
371 |
-
$display_logic="return (" . $display_logic . ");";
|
372 |
-
}
|
373 |
-
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
374 |
-
try {
|
375 |
-
if ( !eval( $display_logic ) ){
|
376 |
-
return $placeholder;
|
377 |
-
}
|
378 |
-
} catch (ParseError $e) {
|
379 |
-
return $placeholder;
|
380 |
-
}
|
381 |
-
}
|
382 |
-
}
|
383 |
-
}
|
384 |
-
|
385 |
-
return $content;
|
386 |
-
}
|
387 |
-
}
|
388 |
-
|
389 |
-
if( !function_exists( 'widgetopts_elementor_before_render' ) ){
|
390 |
-
add_action( 'elementor/frontend/widget/before_render', 'widgetopts_elementor_before_render', 10, 2 );
|
391 |
-
function widgetopts_elementor_before_render( $element ){
|
392 |
-
$enabled = array( 'button', 'button_plus', 'eael-creative-button', 'cta' );
|
393 |
-
if ( in_array( $element->get_name(), $enabled ) ) {
|
394 |
-
global $widget_options;
|
395 |
-
if( 'activate' == $widget_options['sliding'] ){
|
396 |
-
$settings = $element->get_settings();
|
397 |
-
if( isset( $settings['widgetopts_open_sliding'] ) && 'on' == $settings['widgetopts_open_sliding'] ){
|
398 |
-
$element->add_render_attribute( 'button', 'class', 'sl-widgetopts-open' );
|
399 |
-
}
|
400 |
-
}
|
401 |
-
}
|
402 |
-
}
|
403 |
-
}
|
404 |
-
|
405 |
-
if( !function_exists( 'widgetopts_elementor_extra_js' ) ){
|
406 |
-
add_action( 'wp_footer', 'widgetopts_elementor_extra_js' );
|
407 |
-
function widgetopts_elementor_extra_js(){ ?>
|
408 |
-
<script type="text/javascript">
|
409 |
-
(function( $, window, document, undefined ) {
|
410 |
-
if( jQuery('.widgetopts-placeholder-e').length > 0 ){
|
411 |
-
// jQuery('.elementor-column-wrap:has(.widgetopts-placeholder-e)').hide();
|
412 |
-
|
413 |
-
jQuery('.elementor-section:has(.widgetopts-placeholder-e)').each( function(){
|
414 |
-
var pTop = jQuery( this ).find('.elementor-element-populated').css('padding-top');
|
415 |
-
var pBot = jQuery( this ).find('.elementor-element-populated').css('padding-bottom');
|
416 |
-
var pHeight = jQuery( this ).find('.elementor-element-populated').innerHeight();
|
417 |
-
var vert = pHeight - ( parseFloat( pTop ) + parseFloat( pBot ) );
|
418 |
-
|
419 |
-
if( typeof vert !== 'undefined' && vert < 5 ){
|
420 |
-
jQuery( this ).hide();
|
421 |
-
}else{
|
422 |
-
jQuery( this ).find( '.widgetopts-placeholder-e' ).each(function(){
|
423 |
-
jQuery( this ).closest( '.elementor-element' ).hide();
|
424 |
-
|
425 |
-
var countEl = jQuery( this ).closest( '.elementor-column' ).find('.elementor-element').length;
|
426 |
-
var countHolder = jQuery( this ).closest( '.elementor-column' ).find('.widgetopts-placeholder-e').length;
|
427 |
-
if( countEl == countHolder ){
|
428 |
-
jQuery( this ).closest( '.elementor-column' ).hide();
|
429 |
-
}
|
430 |
-
}).promise().done( function(){
|
431 |
-
var sTop = jQuery( this ).closest('.elementor-section').css('padding-top');
|
432 |
-
var sBot = jQuery( this ).closest('.elementor-section').css('padding-bottom');
|
433 |
-
var sHeight = jQuery( this ).closest('.elementor-section').innerHeight();
|
434 |
-
var svert = sHeight - ( parseFloat( sTop ) + parseFloat( sBot ) );
|
435 |
-
|
436 |
-
if( typeof svert !== 'undefined' && svert < 5 ){
|
437 |
-
jQuery( this ).closest('.elementor-section').hide();
|
438 |
-
}
|
439 |
-
});
|
440 |
-
}
|
441 |
-
|
442 |
-
} );
|
443 |
-
}
|
444 |
-
})( jQuery, window, document );
|
445 |
-
</script>
|
446 |
-
<?php }
|
447 |
-
}
|
448 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Extends funtionality to Elementor Pagebuilder
|
4 |
+
*
|
5 |
+
*
|
6 |
+
* @copyright Copyright (c) 2017, Jeffrey Carandang
|
7 |
+
* @since 4.3
|
8 |
+
*/
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
if( !function_exists( 'widgetopts_elementor_render' ) ){
|
13 |
+
add_action( 'elementor/widget/render_content', 'widgetopts_elementor_render', 10, 2 );
|
14 |
+
function widgetopts_elementor_render( $content, $widget ){
|
15 |
+
if ( !Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
16 |
+
global $widget_options;
|
17 |
+
$settings = $widget->get_settings();
|
18 |
+
|
19 |
+
$hidden = false;
|
20 |
+
$placeholder = '<div class="widgetopts-placeholder-e"></div>';
|
21 |
+
$visibility_opts = isset( $settings['widgetopts_visibility'] ) ? $settings['widgetopts_visibility'] : 'hide';
|
22 |
+
|
23 |
+
$tax_opts = ( isset( $widget_options['settings'] ) && isset( $widget_options['settings']['taxonomies_keys'] ) ) ? $widget_options['settings']['taxonomies_keys'] : array();
|
24 |
+
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
25 |
+
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
26 |
+
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
27 |
+
|
28 |
+
//pages
|
29 |
+
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
30 |
+
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'home', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
31 |
+
$hidden = true; //hide if checked on hidden pages
|
32 |
+
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'home', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
33 |
+
$hidden = true; //hide if not checked on visible pages
|
34 |
+
}
|
35 |
+
|
36 |
+
//do return to bypass other conditions
|
37 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_home', $hidden );
|
38 |
+
if( $hidden ){
|
39 |
+
return $placeholder;
|
40 |
+
}
|
41 |
+
}elseif ( $is_misc && is_home() ) {
|
42 |
+
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'blog', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
43 |
+
$hidden = true; //hide if checked on hidden pages
|
44 |
+
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'blog', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
45 |
+
$hidden = true; //hide if not checked on visible pages
|
46 |
+
}
|
47 |
+
|
48 |
+
//do return to bypass other conditions
|
49 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_blog', $hidden );
|
50 |
+
if( $hidden ){
|
51 |
+
return $placeholder;
|
52 |
+
}
|
53 |
+
}elseif ( $is_tax && is_category() ) {
|
54 |
+
//category page
|
55 |
+
if( !isset( $settings['widgetopts_tax_category'] ) ){
|
56 |
+
$settings['widgetopts_tax_category'] = array();
|
57 |
+
}
|
58 |
+
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
59 |
+
$settings['widgetopts_taxonomies'] = array();
|
60 |
+
}
|
61 |
+
|
62 |
+
$cat_lists = $settings['widgetopts_tax_category'];
|
63 |
+
if( !in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' && in_array( get_query_var('cat') , $cat_lists ) ){
|
64 |
+
$hidden = true; //hide if exists on hidden pages
|
65 |
+
}elseif( !in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' && !in_array( get_query_var('cat') , $cat_lists ) ){
|
66 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
67 |
+
}elseif( in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
68 |
+
$hidden = true; //hide to all categories
|
69 |
+
}elseif( in_array( 'category', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
70 |
+
$hidden = false; //hide to all categories
|
71 |
+
}
|
72 |
+
//
|
73 |
+
// //do return to bypass other conditions
|
74 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_categories', $hidden );
|
75 |
+
if( $hidden ){
|
76 |
+
return $placeholder;
|
77 |
+
}
|
78 |
+
}elseif ( $is_tax && is_tag() ) {
|
79 |
+
if( !isset( $settings['widgetopts_tax_post_tag'] ) ){
|
80 |
+
$settings['widgetopts_tax_post_tag'] = array();
|
81 |
+
}
|
82 |
+
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
83 |
+
$settings['widgetopts_taxonomies'] = array();
|
84 |
+
}
|
85 |
+
|
86 |
+
if( in_array( 'post_tag', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
87 |
+
$hidden = true; //hide to all tags
|
88 |
+
}elseif( in_array( 'post_tag', $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
89 |
+
$hidden = false; //hide to all tags
|
90 |
+
}
|
91 |
+
//
|
92 |
+
// //do return to bypass other conditions
|
93 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_tags', $hidden );
|
94 |
+
if( $hidden ){
|
95 |
+
return $placeholder;
|
96 |
+
}
|
97 |
+
}elseif ( $is_tax && is_tax() ) {
|
98 |
+
$term = get_queried_object();
|
99 |
+
|
100 |
+
//taxonomies page
|
101 |
+
if( !isset( $settings['widgetopts_taxonomies'] ) ){
|
102 |
+
$settings['widgetopts_taxonomies'] = array();
|
103 |
+
}
|
104 |
+
// print_r( $term_lists );
|
105 |
+
if( in_array( $term->taxonomy, $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'hide' ){
|
106 |
+
$hidden = true; //hide to all tags
|
107 |
+
}elseif( !in_array( $term->taxonomy, $settings['widgetopts_taxonomies'] ) && $visibility_opts == 'show' ){
|
108 |
+
$hidden = true; //hide to all tags
|
109 |
+
}
|
110 |
+
|
111 |
+
//do return to bypass other conditions
|
112 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_taxonomies', $hidden );
|
113 |
+
if( $hidden ){
|
114 |
+
return $placeholder;
|
115 |
+
}
|
116 |
+
}elseif ( $is_misc && is_archive() ) {
|
117 |
+
//archives page
|
118 |
+
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'archives', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
119 |
+
$hidden = true; //hide if checked on hidden pages
|
120 |
+
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'archives', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
121 |
+
$hidden = true; //hide if not checked on visible pages
|
122 |
+
}
|
123 |
+
|
124 |
+
//do return to bypass other conditions
|
125 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_archives', $hidden );
|
126 |
+
if( $hidden ){
|
127 |
+
return $placeholder;
|
128 |
+
}
|
129 |
+
}elseif ( $is_misc && is_404() ) {
|
130 |
+
//404 page
|
131 |
+
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( '404', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
132 |
+
$hidden = true; //hide if checked on hidden pages
|
133 |
+
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( '404', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
134 |
+
$hidden = true; //hide if not checked on visible pages
|
135 |
+
}
|
136 |
+
|
137 |
+
//do return to bypass other conditions
|
138 |
+
$hidden = apply_filters( 'widget_options_visibility_404', $hidden );
|
139 |
+
if( $hidden ){
|
140 |
+
return $placeholder;
|
141 |
+
}
|
142 |
+
}elseif ( $is_misc && is_search() ) {
|
143 |
+
if( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && in_array( 'search', $settings['widgetopts_misc'] ) && $visibility_opts == 'hide' ){
|
144 |
+
$hidden = true; //hide if checked on hidden pages
|
145 |
+
}elseif( ( !isset( $settings['widgetopts_misc'] ) || ( isset( $settings['widgetopts_misc'] ) && is_array( $settings['widgetopts_misc'] ) && !in_array( 'search', $settings['widgetopts_misc'] ) ) ) && $visibility_opts == 'show' ){
|
146 |
+
$hidden = true;
|
147 |
+
}
|
148 |
+
|
149 |
+
//do return to bypass other conditions
|
150 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_search', $hidden );
|
151 |
+
if( $hidden ){
|
152 |
+
return $placeholder;
|
153 |
+
}
|
154 |
+
}elseif ( is_single() && !is_page() ) {
|
155 |
+
global $wp_query;
|
156 |
+
$post = $wp_query->post;
|
157 |
+
|
158 |
+
if( !isset( $settings['widgetopts_types'] ) || ( $is_types && !isset( $settings['widgetopts_types'] ) ) ){
|
159 |
+
$settings['widgetopts_types'] = array();
|
160 |
+
}
|
161 |
+
|
162 |
+
if( $visibility_opts == 'hide' && in_array( $post->post_type , $settings['widgetopts_types']) ){
|
163 |
+
$hidden = true; //hide if exists on hidden pages
|
164 |
+
}elseif( $visibility_opts == 'show' && !in_array( $post->post_type , $settings['widgetopts_types']) ){
|
165 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
166 |
+
}
|
167 |
+
|
168 |
+
// do return to bypass other conditions
|
169 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_single', $hidden );
|
170 |
+
|
171 |
+
|
172 |
+
// $taxonomy_names = get_post_taxonomies( $post->ID );
|
173 |
+
// $array_intersect = array_intersect( $tax_opts, $taxonomy_names );
|
174 |
+
|
175 |
+
if( !isset( $settings['widgetopts_tax_category'] ) ){
|
176 |
+
$settings['widgetopts_tax_category'] = array();
|
177 |
+
}
|
178 |
+
|
179 |
+
if( isset( $settings['widgetopts_tax_category'] ) && !empty( $settings['widgetopts_tax_category'] ) ){
|
180 |
+
$cats = wp_get_post_categories( $post->ID );
|
181 |
+
|
182 |
+
if( is_array( $cats ) && !empty( $cats ) ){
|
183 |
+
$checked_cats = $settings['widgetopts_tax_category'];
|
184 |
+
$intersect = array_intersect( $cats , $checked_cats );
|
185 |
+
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
186 |
+
$hidden = true;
|
187 |
+
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
188 |
+
$hidden = false;
|
189 |
+
}
|
190 |
+
|
191 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_single_category', $hidden );
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
if( $hidden ){
|
196 |
+
return $placeholder;
|
197 |
+
}
|
198 |
+
}elseif ( $is_types && is_page() ) {
|
199 |
+
global $wp_query;
|
200 |
+
|
201 |
+
$post = $wp_query->post;
|
202 |
+
|
203 |
+
//do post type condition first
|
204 |
+
if( isset( $settings['widgetopts_types'] ) ){
|
205 |
+
if( $visibility_opts == 'hide' && in_array( 'page', $settings['widgetopts_types'] ) ){
|
206 |
+
$hidden = true; //hide if exists on hidden pages
|
207 |
+
}elseif( $visibility_opts == 'show' && !in_array( 'page', $settings['widgetopts_types'] ) ){
|
208 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
209 |
+
}
|
210 |
+
}else{
|
211 |
+
// print_r( $settings['widgetopts_pages'] );
|
212 |
+
//do per pages condition
|
213 |
+
if( !isset( $settings['widgetopts_pages'] ) ){
|
214 |
+
$settings['widgetopts_pages'] = array();
|
215 |
+
}
|
216 |
+
|
217 |
+
if( $visibility_opts == 'hide' && in_array( $post->ID , $settings['widgetopts_pages'] ) ){
|
218 |
+
$hidden = true; //hide if exists on hidden pages
|
219 |
+
}elseif( $visibility_opts == 'show' && !in_array( $post->ID , $settings['widgetopts_pages'] ) ){
|
220 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
// //do return to bypass other conditions
|
225 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_page', $hidden );
|
226 |
+
if( $hidden ){
|
227 |
+
return $placeholder;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
|
231 |
+
//ACF
|
232 |
+
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
233 |
+
if( isset( $settings['widgetopts_acf_field'] ) && !empty( $settings['widgetopts_acf_field'] ) ){
|
234 |
+
$acf = get_field_object( $settings['widgetopts_acf_field'] );
|
235 |
+
if( $acf && is_array( $acf ) ){
|
236 |
+
$acf_visibility = isset( $settings['widgetopts_acf_visibility'] ) ? $settings['widgetopts_acf_visibility'] : 'hide';
|
237 |
+
|
238 |
+
//handle repeater fields
|
239 |
+
if( isset( $acf['value'] ) ){
|
240 |
+
if( is_array( $acf['value'] ) ){
|
241 |
+
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
242 |
+
$acf_implode = '';
|
243 |
+
if( is_array( $acf_array_value ) ){
|
244 |
+
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
245 |
+
}
|
246 |
+
return $acf_implode;
|
247 |
+
}, $acf['value']));
|
248 |
+
}
|
249 |
+
}
|
250 |
+
switch ( $settings['widgetopts_acf_condition'] ) {
|
251 |
+
case 'equal':
|
252 |
+
if( isset( $acf['value'] ) ){
|
253 |
+
if( 'show' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
254 |
+
$hidden = false;
|
255 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
256 |
+
$hidden = true;
|
257 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
258 |
+
$hidden = true;
|
259 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
260 |
+
$hidden = false;
|
261 |
+
}
|
262 |
+
}
|
263 |
+
break;
|
264 |
+
|
265 |
+
case 'not_equal':
|
266 |
+
if( isset( $acf['value'] ) ){
|
267 |
+
if( 'show' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
268 |
+
$hidden = true;
|
269 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
270 |
+
$hidden = false;
|
271 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $settings['widgetopts_acf'] ){
|
272 |
+
$hidden = false;
|
273 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $settings['widgetopts_acf'] ){
|
274 |
+
$hidden = true;
|
275 |
+
}
|
276 |
+
}
|
277 |
+
break;
|
278 |
+
|
279 |
+
case 'contains':
|
280 |
+
if( isset( $acf['value'] ) ){
|
281 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
282 |
+
$hidden = false;
|
283 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
284 |
+
$hidden = true;
|
285 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
286 |
+
$hidden = true;
|
287 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
288 |
+
$hidden = false;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
break;
|
292 |
+
|
293 |
+
case 'not_contains':
|
294 |
+
if( isset( $acf['value'] ) ){
|
295 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
296 |
+
$hidden = true;
|
297 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
298 |
+
$hidden = false;
|
299 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) !== false ){
|
300 |
+
$hidden = false;
|
301 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $settings['widgetopts_acf'] ) === false ){
|
302 |
+
$hidden = true;
|
303 |
+
}
|
304 |
+
}
|
305 |
+
break;
|
306 |
+
|
307 |
+
case 'empty':
|
308 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
309 |
+
$hidden = false;
|
310 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
311 |
+
$hidden = true;
|
312 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
313 |
+
$hidden = true;
|
314 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
315 |
+
$hidden = false;
|
316 |
+
}
|
317 |
+
break;
|
318 |
+
|
319 |
+
case 'not_empty':
|
320 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
321 |
+
$hidden = true;
|
322 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
323 |
+
$hidden = false;
|
324 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
325 |
+
$hidden = false;
|
326 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
327 |
+
$hidden = true;
|
328 |
+
}
|
329 |
+
break;
|
330 |
+
|
331 |
+
default:
|
332 |
+
# code...
|
333 |
+
break;
|
334 |
+
}
|
335 |
+
|
336 |
+
// //do return to bypass other conditions
|
337 |
+
$hidden = apply_filters( 'widgetopts_elementor_visibility_acf', $hidden );
|
338 |
+
if( $hidden ){
|
339 |
+
return $placeholder;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
//widget logic
|
346 |
+
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] ){
|
347 |
+
if( isset( $settings['widgetopts_roles_state'] ) && !empty( $settings['widgetopts_roles_state'] ) ){
|
348 |
+
//do state action here
|
349 |
+
if( $settings['widgetopts_roles_state'] == 'out' && is_user_logged_in() ){
|
350 |
+
return $placeholder;
|
351 |
+
}else if( $settings['widgetopts_roles_state'] == 'in' && !is_user_logged_in() ){
|
352 |
+
return $placeholder;
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
//widget logic
|
358 |
+
if( 'activate' == $widget_options['logic'] ){
|
359 |
+
if( isset( $settings['widgetopts_logic'] ) && !empty( $settings['widgetopts_logic'] ) ){
|
360 |
+
//do widget logic
|
361 |
+
$display_logic = stripslashes( trim( $settings['widgetopts_logic'] ) );
|
362 |
+
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
363 |
+
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
364 |
+
if ( $display_logic === false ){
|
365 |
+
return $placeholder;
|
366 |
+
}
|
367 |
+
if ( $display_logic === true ){
|
368 |
+
return $content;
|
369 |
+
}
|
370 |
+
if ( stristr($display_logic,"return")===false ){
|
371 |
+
$display_logic="return (" . $display_logic . ");";
|
372 |
+
}
|
373 |
+
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
374 |
+
try {
|
375 |
+
if ( !eval( $display_logic ) ){
|
376 |
+
return $placeholder;
|
377 |
+
}
|
378 |
+
} catch (ParseError $e) {
|
379 |
+
return $placeholder;
|
380 |
+
}
|
381 |
+
}
|
382 |
+
}
|
383 |
+
}
|
384 |
+
|
385 |
+
return $content;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
|
389 |
+
if( !function_exists( 'widgetopts_elementor_before_render' ) ){
|
390 |
+
add_action( 'elementor/frontend/widget/before_render', 'widgetopts_elementor_before_render', 10, 2 );
|
391 |
+
function widgetopts_elementor_before_render( $element ){
|
392 |
+
$enabled = array( 'button', 'button_plus', 'eael-creative-button', 'cta' );
|
393 |
+
if ( in_array( $element->get_name(), $enabled ) ) {
|
394 |
+
global $widget_options;
|
395 |
+
if( 'activate' == $widget_options['sliding'] ){
|
396 |
+
$settings = $element->get_settings();
|
397 |
+
if( isset( $settings['widgetopts_open_sliding'] ) && 'on' == $settings['widgetopts_open_sliding'] ){
|
398 |
+
$element->add_render_attribute( 'button', 'class', 'sl-widgetopts-open' );
|
399 |
+
}
|
400 |
+
}
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
if( !function_exists( 'widgetopts_elementor_extra_js' ) ){
|
406 |
+
add_action( 'wp_footer', 'widgetopts_elementor_extra_js' );
|
407 |
+
function widgetopts_elementor_extra_js(){ ?>
|
408 |
+
<script type="text/javascript">
|
409 |
+
(function( $, window, document, undefined ) {
|
410 |
+
if( jQuery('.widgetopts-placeholder-e').length > 0 ){
|
411 |
+
// jQuery('.elementor-column-wrap:has(.widgetopts-placeholder-e)').hide();
|
412 |
+
|
413 |
+
jQuery('.elementor-section:has(.widgetopts-placeholder-e)').each( function(){
|
414 |
+
var pTop = jQuery( this ).find('.elementor-element-populated').css('padding-top');
|
415 |
+
var pBot = jQuery( this ).find('.elementor-element-populated').css('padding-bottom');
|
416 |
+
var pHeight = jQuery( this ).find('.elementor-element-populated').innerHeight();
|
417 |
+
var vert = pHeight - ( parseFloat( pTop ) + parseFloat( pBot ) );
|
418 |
+
|
419 |
+
if( typeof vert !== 'undefined' && vert < 5 ){
|
420 |
+
jQuery( this ).hide();
|
421 |
+
}else{
|
422 |
+
jQuery( this ).find( '.widgetopts-placeholder-e' ).each(function(){
|
423 |
+
jQuery( this ).closest( '.elementor-element' ).hide();
|
424 |
+
|
425 |
+
var countEl = jQuery( this ).closest( '.elementor-column' ).find('.elementor-element').length;
|
426 |
+
var countHolder = jQuery( this ).closest( '.elementor-column' ).find('.widgetopts-placeholder-e').length;
|
427 |
+
if( countEl == countHolder ){
|
428 |
+
jQuery( this ).closest( '.elementor-column' ).hide();
|
429 |
+
}
|
430 |
+
}).promise().done( function(){
|
431 |
+
var sTop = jQuery( this ).closest('.elementor-section').css('padding-top');
|
432 |
+
var sBot = jQuery( this ).closest('.elementor-section').css('padding-bottom');
|
433 |
+
var sHeight = jQuery( this ).closest('.elementor-section').innerHeight();
|
434 |
+
var svert = sHeight - ( parseFloat( sTop ) + parseFloat( sBot ) );
|
435 |
+
|
436 |
+
if( typeof svert !== 'undefined' && svert < 5 ){
|
437 |
+
jQuery( this ).closest('.elementor-section').hide();
|
438 |
+
}
|
439 |
+
});
|
440 |
+
}
|
441 |
+
|
442 |
+
} );
|
443 |
+
}
|
444 |
+
})( jQuery, window, document );
|
445 |
+
</script>
|
446 |
+
<?php }
|
447 |
+
}
|
448 |
+
?>
|
includes/pagebuilders/siteorigin.php
CHANGED
@@ -1,75 +1,75 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Handle compatibility with Pagebuilder by SiteOrigin Plugin
|
4 |
-
*
|
5 |
-
* Process AJAX actions.
|
6 |
-
*
|
7 |
-
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
8 |
-
* @since 3.0
|
9 |
-
*/
|
10 |
-
// Exit if accessed directly
|
11 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
-
|
13 |
-
if( !function_exists( 'widgetopts_siteorigin_panels_data' ) ){
|
14 |
-
add_filter( 'siteorigin_panels_data', 'widgetopts_siteorigin_panels_data', 10, 4 );
|
15 |
-
function widgetopts_siteorigin_panels_data( $panels_data, $post_id ){
|
16 |
-
global $widget_options;
|
17 |
-
if( !is_admin() ){
|
18 |
-
if( isset( $panels_data['widgets'] ) && !empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ){
|
19 |
-
|
20 |
-
global $current_user;
|
21 |
-
|
22 |
-
foreach ( $panels_data['widgets'] as $key => $widgets ) {
|
23 |
-
if( isset( $widgets['extended_widget_opts'] ) && !empty( $widgets['extended_widget_opts'] ) ){
|
24 |
-
|
25 |
-
if( isset( $panels_data['widgets'][$key] ) && 'activate' == $widget_options['logic'] ){
|
26 |
-
// display widget logic
|
27 |
-
if( isset( $widgets['extended_widget_opts']['class'] ) && isset( $widgets['extended_widget_opts']['class']['logic'] ) && !empty( $widgets['extended_widget_opts']['class']['logic'] ) ){
|
28 |
-
$display_logic = stripslashes( trim( $widgets['extended_widget_opts']['class']['logic'] ) );
|
29 |
-
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
30 |
-
if ( $display_logic === false ){
|
31 |
-
unset( $panels_data['widgets'][$key]);
|
32 |
-
}
|
33 |
-
if ( $display_logic === true ){
|
34 |
-
// return true;
|
35 |
-
}
|
36 |
-
if ( stristr($display_logic,"return")===false ){
|
37 |
-
$display_logic="return (" . $display_logic . ");";
|
38 |
-
}
|
39 |
-
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
40 |
-
try {
|
41 |
-
if (!eval($display_logic)) {
|
42 |
-
unset($panels_data['widgets'][$key]);
|
43 |
-
}
|
44 |
-
} catch (ParseError $e) {
|
45 |
-
unset($panels_data['widgets'][$key]);
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
}
|
51 |
-
}
|
52 |
-
}
|
53 |
-
}
|
54 |
-
return $panels_data;
|
55 |
-
|
56 |
-
}
|
57 |
-
}
|
58 |
-
|
59 |
-
if( !function_exists( 'widgetopts_siteorigin_panels_widget_classes' ) ){
|
60 |
-
add_filter( 'siteorigin_panels_widget_classes', 'widgetopts_siteorigin_panels_widget_classes', 10, 4 );
|
61 |
-
function widgetopts_siteorigin_panels_widget_classes( $classes, $widget, $instance, $widget_info ){
|
62 |
-
if( isset( $instance['extended_widget_opts'] ) ){
|
63 |
-
global $widget_options;
|
64 |
-
|
65 |
-
$get_classes = widgetopts_classes_generator( $instance['extended_widget_opts'], $widget_options, $widget_options['settings'], true );
|
66 |
-
$get_classes[] = 'widgetopts-SO';
|
67 |
-
|
68 |
-
$classes = apply_filters( 'widgetopts_siteorigin_panels_widget_classes', array_merge( $classes, $get_classes ), $widget_info );
|
69 |
-
}
|
70 |
-
|
71 |
-
return $classes;
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handle compatibility with Pagebuilder by SiteOrigin Plugin
|
4 |
+
*
|
5 |
+
* Process AJAX actions.
|
6 |
+
*
|
7 |
+
* @copyright Copyright (c) 2016, Jeffrey Carandang
|
8 |
+
* @since 3.0
|
9 |
+
*/
|
10 |
+
// Exit if accessed directly
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
12 |
+
|
13 |
+
if( !function_exists( 'widgetopts_siteorigin_panels_data' ) ){
|
14 |
+
add_filter( 'siteorigin_panels_data', 'widgetopts_siteorigin_panels_data', 10, 4 );
|
15 |
+
function widgetopts_siteorigin_panels_data( $panels_data, $post_id ){
|
16 |
+
global $widget_options;
|
17 |
+
if( !is_admin() ){
|
18 |
+
if( isset( $panels_data['widgets'] ) && !empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ){
|
19 |
+
|
20 |
+
global $current_user;
|
21 |
+
|
22 |
+
foreach ( $panels_data['widgets'] as $key => $widgets ) {
|
23 |
+
if( isset( $widgets['extended_widget_opts'] ) && !empty( $widgets['extended_widget_opts'] ) ){
|
24 |
+
|
25 |
+
if( isset( $panels_data['widgets'][$key] ) && 'activate' == $widget_options['logic'] ){
|
26 |
+
// display widget logic
|
27 |
+
if( isset( $widgets['extended_widget_opts']['class'] ) && isset( $widgets['extended_widget_opts']['class']['logic'] ) && !empty( $widgets['extended_widget_opts']['class']['logic'] ) ){
|
28 |
+
$display_logic = stripslashes( trim( $widgets['extended_widget_opts']['class']['logic'] ) );
|
29 |
+
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
30 |
+
if ( $display_logic === false ){
|
31 |
+
unset( $panels_data['widgets'][$key]);
|
32 |
+
}
|
33 |
+
if ( $display_logic === true ){
|
34 |
+
// return true;
|
35 |
+
}
|
36 |
+
if ( stristr($display_logic,"return")===false ){
|
37 |
+
$display_logic="return (" . $display_logic . ");";
|
38 |
+
}
|
39 |
+
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
40 |
+
try {
|
41 |
+
if (!eval($display_logic)) {
|
42 |
+
unset($panels_data['widgets'][$key]);
|
43 |
+
}
|
44 |
+
} catch (ParseError $e) {
|
45 |
+
unset($panels_data['widgets'][$key]);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
return $panels_data;
|
55 |
+
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
+
if( !function_exists( 'widgetopts_siteorigin_panels_widget_classes' ) ){
|
60 |
+
add_filter( 'siteorigin_panels_widget_classes', 'widgetopts_siteorigin_panels_widget_classes', 10, 4 );
|
61 |
+
function widgetopts_siteorigin_panels_widget_classes( $classes, $widget, $instance, $widget_info ){
|
62 |
+
if( isset( $instance['extended_widget_opts'] ) ){
|
63 |
+
global $widget_options;
|
64 |
+
|
65 |
+
$get_classes = widgetopts_classes_generator( $instance['extended_widget_opts'], $widget_options, $widget_options['settings'], true );
|
66 |
+
$get_classes[] = 'widgetopts-SO';
|
67 |
+
|
68 |
+
$classes = apply_filters( 'widgetopts_siteorigin_panels_widget_classes', array_merge( $classes, $get_classes ), $widget_info );
|
69 |
+
}
|
70 |
+
|
71 |
+
return $classes;
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
?>
|
includes/widgets/display.php
CHANGED
@@ -1,480 +1,480 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Handles Front-end Display
|
4 |
-
*
|
5 |
-
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
-
* @since 1.0
|
7 |
-
*/
|
8 |
-
// Exit if accessed directly
|
9 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Handles widget_display_callback filter
|
13 |
-
*
|
14 |
-
* @since 1.0
|
15 |
-
* @global $widget_options
|
16 |
-
* @return $instance
|
17 |
-
*/
|
18 |
-
|
19 |
-
//check if function exists
|
20 |
-
if( !function_exists( 'widgetopts_display_callback' ) ):
|
21 |
-
function widgetopts_display_callback( $instance, $widget, $args ){
|
22 |
-
global $widget_options, $current_user;
|
23 |
-
|
24 |
-
$hidden = false;
|
25 |
-
$opts = ( isset( $instance[ 'extended_widget_opts-'. $widget->id ] ) ) ? $instance[ 'extended_widget_opts-'. $widget->id ] : array();
|
26 |
-
$visibility = array( 'show' => array(), 'hide' => array() );
|
27 |
-
|
28 |
-
//wordpress pages
|
29 |
-
$visibility = isset( $opts['visibility'] ) ? $opts['visibility'] : array();
|
30 |
-
$visibility_opts = isset( $opts['visibility']['options'] ) ? $opts['visibility']['options'] : 'hide';
|
31 |
-
|
32 |
-
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
33 |
-
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
34 |
-
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
35 |
-
|
36 |
-
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
37 |
-
if( isset( $visibility['misc']['home'] ) && $visibility_opts == 'hide' ){
|
38 |
-
$hidden = true; //hide if checked on hidden pages
|
39 |
-
}elseif( !isset( $visibility['misc']['home'] ) && $visibility_opts == 'show' ){
|
40 |
-
$hidden = true; //hide if not checked on visible pages
|
41 |
-
}
|
42 |
-
|
43 |
-
//do return to bypass other conditions
|
44 |
-
$hidden = apply_filters( 'widget_options_visibility_home', $hidden );
|
45 |
-
if( $hidden ){
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
}elseif ( $is_misc && is_home() ) { //filter for blog page
|
49 |
-
if( isset( $visibility['misc']['blog'] ) && $visibility_opts == 'hide' ){
|
50 |
-
$hidden = true; //hide if checked on hidden pages
|
51 |
-
}elseif( !isset( $visibility['misc']['blog'] ) && $visibility_opts == 'show' ){
|
52 |
-
$hidden = true; //hide if not checked on visible pages
|
53 |
-
}
|
54 |
-
|
55 |
-
//do return to bypass other conditions
|
56 |
-
$hidden = apply_filters( 'widget_options_visibility_blog', $hidden );
|
57 |
-
if( $hidden ){
|
58 |
-
return false;
|
59 |
-
}
|
60 |
-
|
61 |
-
}elseif ( $is_tax && is_category() ) {
|
62 |
-
if( !isset( $visibility['categories'] ) ){
|
63 |
-
$visibility['categories'] = array();
|
64 |
-
}
|
65 |
-
|
66 |
-
if( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' && array_key_exists( get_query_var('cat') , $visibility['categories']) ){
|
67 |
-
$hidden = true; //hide if exists on hidden pages
|
68 |
-
}elseif( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' && !array_key_exists( get_query_var('cat') , $visibility['categories']) ){
|
69 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
70 |
-
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
|
71 |
-
$hidden = true; //hide to all categories
|
72 |
-
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' ){
|
73 |
-
$hidden = false; //hide to all categories
|
74 |
-
}
|
75 |
-
|
76 |
-
//do return to bypass other conditions
|
77 |
-
$hidden = apply_filters( 'widget_options_visibility_categories', $hidden );
|
78 |
-
if( $hidden ){
|
79 |
-
return false;
|
80 |
-
}
|
81 |
-
}elseif ( $is_tax && is_tag() ) {
|
82 |
-
if( !isset( $visibility['tags'] ) ){
|
83 |
-
$visibility['tags'] = array();
|
84 |
-
}
|
85 |
-
|
86 |
-
if( ( isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'hide' ) ||
|
87 |
-
( !isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'show' )
|
88 |
-
){
|
89 |
-
$hidden = true; //hide to all tags
|
90 |
-
}elseif( isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'show' ){
|
91 |
-
$hidden = false; //hide to all tags
|
92 |
-
}
|
93 |
-
|
94 |
-
//do return to bypass other conditions
|
95 |
-
$hidden = apply_filters( 'widget_options_visibility_tags', $hidden );
|
96 |
-
if( $hidden ){
|
97 |
-
return false;
|
98 |
-
}
|
99 |
-
}elseif ( $is_tax && is_tax() ) {
|
100 |
-
$term = get_queried_object();
|
101 |
-
if( !isset( $visibility['taxonomies'] ) ){
|
102 |
-
$visibility['taxonomies'] = array();
|
103 |
-
}
|
104 |
-
|
105 |
-
if( $visibility_opts == 'hide' && array_key_exists( $term->taxonomy , $visibility['taxonomies']) ){
|
106 |
-
$hidden = true; //hide if exists on hidden pages
|
107 |
-
}elseif( $visibility_opts == 'show' && !array_key_exists( $term->taxonomy , $visibility['taxonomies']) ){
|
108 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
109 |
-
}
|
110 |
-
|
111 |
-
//do return to bypass other conditions
|
112 |
-
$hidden = apply_filters( 'widget_options_visibility_taxonomies', $hidden );
|
113 |
-
if( $hidden ){
|
114 |
-
return false;
|
115 |
-
}
|
116 |
-
}elseif ( $is_misc && is_archive() ) {
|
117 |
-
if( isset( $visibility['misc']['archives'] ) && $visibility_opts == 'hide' ){
|
118 |
-
$hidden = true; //hide if checked on hidden pages
|
119 |
-
}elseif( !isset( $visibility['misc']['archives'] ) && $visibility_opts == 'show' ){
|
120 |
-
$hidden = true; //hide if not checked on visible pages
|
121 |
-
}
|
122 |
-
|
123 |
-
//do return to bypass other conditions
|
124 |
-
$hidden = apply_filters( 'widget_options_visibility_archives', $hidden );
|
125 |
-
if( $hidden ){
|
126 |
-
return false;
|
127 |
-
}
|
128 |
-
}elseif ( $is_misc && is_404() ) {
|
129 |
-
if( isset( $visibility['misc']['404'] ) && $visibility_opts == 'hide' ){
|
130 |
-
$hidden = true; //hide if checked on hidden pages
|
131 |
-
}elseif( !isset( $visibility['misc']['404'] ) && $visibility_opts == 'show' ){
|
132 |
-
$hidden = true; //hide if not checked on visible pages
|
133 |
-
}
|
134 |
-
|
135 |
-
//do return to bypass other conditions
|
136 |
-
$hidden = apply_filters( 'widget_options_visibility_404', $hidden );
|
137 |
-
if( $hidden ){
|
138 |
-
return false;
|
139 |
-
}
|
140 |
-
}elseif ( $is_misc && is_search() ) {
|
141 |
-
if( isset( $visibility['misc']['search'] ) && $visibility_opts == 'hide' ){
|
142 |
-
$hidden = true; //hide if checked on hidden pages
|
143 |
-
}elseif( !isset( $visibility['misc']['search'] ) && $visibility_opts == 'show' ){
|
144 |
-
$hidden = true; //hide if not checked on visible pages
|
145 |
-
}
|
146 |
-
|
147 |
-
//do return to bypass other conditions
|
148 |
-
$hidden = apply_filters( 'widget_options_visibility_search', $hidden );
|
149 |
-
if( $hidden ){
|
150 |
-
return false;
|
151 |
-
}
|
152 |
-
}elseif ( is_single() && !is_page() ) {
|
153 |
-
global $post;
|
154 |
-
$type = $post->post_type;
|
155 |
-
|
156 |
-
if( !isset( $visibility['types'] ) ){
|
157 |
-
$visibility['types'] = array();
|
158 |
-
}
|
159 |
-
if( $visibility_opts == 'hide' && array_key_exists( $type , $visibility['types']) ){
|
160 |
-
$hidden = true; //hide if exists on hidden pages
|
161 |
-
}elseif( $visibility_opts == 'show' && !array_key_exists( $type , $visibility['types']) ){
|
162 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
163 |
-
}
|
164 |
-
// do return to bypass other conditions
|
165 |
-
$hidden = apply_filters( 'widget_options_visibility_types', $hidden );
|
166 |
-
//hide posts assign on category
|
167 |
-
if( !isset( $visibility['categories'] ) ){
|
168 |
-
$visibility['categories'] = array();
|
169 |
-
}
|
170 |
-
if( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
|
171 |
-
$hidden = true; //hide to all categories
|
172 |
-
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' ){
|
173 |
-
$hidden = false; //hide to all categories
|
174 |
-
}elseif( !isset( $visibility['categories']['all_categories'] ) && !empty( $visibility['categories'] ) ) {
|
175 |
-
$cats = wp_get_post_categories( get_the_ID() );
|
176 |
-
if( is_array( $cats ) && !empty( $cats ) ){
|
177 |
-
$checked_cats = array_keys( $visibility['categories'] );
|
178 |
-
$intersect = array_intersect( $cats , $checked_cats );
|
179 |
-
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
180 |
-
$hidden = true;
|
181 |
-
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
182 |
-
$hidden = false;
|
183 |
-
}
|
184 |
-
}
|
185 |
-
}
|
186 |
-
// do return to bypass other conditions
|
187 |
-
$hidden = apply_filters( 'widget_options_visibility_post_category', $hidden );
|
188 |
-
if( $hidden ){
|
189 |
-
return false;
|
190 |
-
}
|
191 |
-
// echo $type;
|
192 |
-
}elseif ( $is_types && is_page() ) {
|
193 |
-
global $post;
|
194 |
-
//do post type condition first
|
195 |
-
if( isset( $visibility['types'] ) && isset( $visibility['types']['page'] ) ){
|
196 |
-
if( $visibility_opts == 'hide' && array_key_exists( 'page' , $visibility['types']) ){
|
197 |
-
$hidden = true; //hide if exists on hidden pages
|
198 |
-
}elseif( $visibility_opts == 'show' && !array_key_exists( 'page' , $visibility['types']) ){
|
199 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
200 |
-
}
|
201 |
-
}else{
|
202 |
-
//do per pages condition
|
203 |
-
if( !isset( $visibility['pages'] ) ){
|
204 |
-
$visibility['pages'] = array();
|
205 |
-
}
|
206 |
-
if( $visibility_opts == 'hide' && array_key_exists( $post->ID , $visibility['pages']) ){
|
207 |
-
$hidden = true; //hide if exists on hidden pages
|
208 |
-
}elseif( $visibility_opts == 'show' && !array_key_exists( $post->ID , $visibility['pages']) ){
|
209 |
-
$hidden = true; //hide if doesn't exists on visible pages
|
210 |
-
}
|
211 |
-
}
|
212 |
-
//do return to bypass other conditions
|
213 |
-
$hidden = apply_filters( 'widget_options_visibility_page', $hidden );
|
214 |
-
if( $hidden ){
|
215 |
-
return false;
|
216 |
-
}
|
217 |
-
}
|
218 |
-
|
219 |
-
//end wordpress pages
|
220 |
-
|
221 |
-
//ACF
|
222 |
-
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
223 |
-
if( isset( $visibility['acf']['field'] ) && !empty( $visibility['acf']['field'] ) ){
|
224 |
-
$acf = get_field_object( $visibility['acf']['field'] );
|
225 |
-
if( $acf && is_array( $acf ) ){
|
226 |
-
$acf_visibility = ( isset( $visibility['acf'] ) && isset( $visibility['acf']['visibility'] ) ) ? $visibility['acf']['visibility'] : 'hide';
|
227 |
-
|
228 |
-
//handle repeater fields
|
229 |
-
if( isset( $acf['value'] ) ){
|
230 |
-
if( is_array( $acf['value'] ) ){
|
231 |
-
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
232 |
-
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
233 |
-
return $acf_implode;
|
234 |
-
}, $acf['value']));
|
235 |
-
}
|
236 |
-
}
|
237 |
-
|
238 |
-
switch ( $visibility['acf']['condition'] ) {
|
239 |
-
case 'equal':
|
240 |
-
if( isset( $acf['value'] ) ){
|
241 |
-
if( 'show' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
242 |
-
$hidden = false;
|
243 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
244 |
-
$hidden = true;
|
245 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
246 |
-
$hidden = true;
|
247 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
248 |
-
$hidden = false;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
break;
|
252 |
-
|
253 |
-
case 'not_equal':
|
254 |
-
if( isset( $acf['value'] ) ){
|
255 |
-
if( 'show' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
256 |
-
$hidden = true;
|
257 |
-
}else if( 'show' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
258 |
-
$hidden = false;
|
259 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
260 |
-
$hidden = false;
|
261 |
-
}else if( 'hide' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
262 |
-
$hidden = true;
|
263 |
-
}
|
264 |
-
}
|
265 |
-
break;
|
266 |
-
|
267 |
-
case 'contains':
|
268 |
-
if( isset( $acf['value'] ) ){
|
269 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
270 |
-
$hidden = false;
|
271 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
272 |
-
$hidden = true;
|
273 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
274 |
-
$hidden = true;
|
275 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
276 |
-
$hidden = false;
|
277 |
-
}
|
278 |
-
}
|
279 |
-
break;
|
280 |
-
|
281 |
-
case 'not_contains':
|
282 |
-
if( isset( $acf['value'] ) ){
|
283 |
-
if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
284 |
-
$hidden = true;
|
285 |
-
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
286 |
-
$hidden = false;
|
287 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
288 |
-
$hidden = false;
|
289 |
-
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
290 |
-
$hidden = true;
|
291 |
-
}
|
292 |
-
}
|
293 |
-
break;
|
294 |
-
|
295 |
-
case 'empty':
|
296 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
297 |
-
$hidden = false;
|
298 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
299 |
-
$hidden = true;
|
300 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
301 |
-
$hidden = true;
|
302 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
303 |
-
$hidden = false;
|
304 |
-
}
|
305 |
-
break;
|
306 |
-
|
307 |
-
case 'not_empty':
|
308 |
-
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
309 |
-
$hidden = true;
|
310 |
-
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
311 |
-
$hidden = false;
|
312 |
-
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
313 |
-
$hidden = false;
|
314 |
-
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
315 |
-
$hidden = true;
|
316 |
-
}
|
317 |
-
break;
|
318 |
-
|
319 |
-
default:
|
320 |
-
# code...
|
321 |
-
break;
|
322 |
-
}
|
323 |
-
|
324 |
-
// //do return to bypass other conditions
|
325 |
-
$hidden = apply_filters( 'widget_options_visibility_acf', $hidden );
|
326 |
-
if( $hidden ){
|
327 |
-
return false;
|
328 |
-
}
|
329 |
-
}
|
330 |
-
}
|
331 |
-
}
|
332 |
-
|
333 |
-
//login state
|
334 |
-
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] && isset( $opts['roles'] ) ){
|
335 |
-
if( isset( $opts['roles']['state'] ) && !empty( $opts['roles']['state'] ) ){
|
336 |
-
//do state action here
|
337 |
-
if( $opts['roles']['state'] == 'out' && is_user_logged_in() ){
|
338 |
-
return false;
|
339 |
-
}else if( $opts['roles']['state'] == 'in' && !is_user_logged_in() ){
|
340 |
-
return false;
|
341 |
-
}
|
342 |
-
}
|
343 |
-
}
|
344 |
-
|
345 |
-
if( 'activate' == $widget_options['logic'] ){
|
346 |
-
// display widget logic
|
347 |
-
if( isset( $opts['class'] ) && isset( $opts['class']['logic'] ) && !empty( $opts['class']['logic'] ) ){
|
348 |
-
$display_logic = stripslashes( trim( $opts['class']['logic'] ) );
|
349 |
-
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
350 |
-
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
351 |
-
if ( $display_logic === false ){
|
352 |
-
return false;
|
353 |
-
}
|
354 |
-
if ( $display_logic === true ){
|
355 |
-
return true;
|
356 |
-
}
|
357 |
-
if ( stristr($display_logic,"return")===false ){
|
358 |
-
$display_logic="return (" . $display_logic . ");";
|
359 |
-
}
|
360 |
-
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
361 |
-
try {
|
362 |
-
if ( !eval( $display_logic ) ){
|
363 |
-
return false;
|
364 |
-
}
|
365 |
-
} catch (ParseError $e) {
|
366 |
-
return false;
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
-
|
371 |
-
if( 'activate' == $widget_options['hide_title'] ){
|
372 |
-
//hide widget title
|
373 |
-
if( isset( $instance['title'] ) && isset( $opts['class'] ) && isset( $opts['class']['title'] ) && '1' == $opts['class']['title'] ){
|
374 |
-
$instance['title'] = '';
|
375 |
-
}
|
376 |
-
}
|
377 |
-
|
378 |
-
return $instance;
|
379 |
-
}
|
380 |
-
add_filter( 'widget_display_callback', 'widgetopts_display_callback', 50, 3 );
|
381 |
-
endif;
|
382 |
-
|
383 |
-
//Don't show widget title
|
384 |
-
if( !function_exists( 'widgetopts_remove_title' ) ):
|
385 |
-
function widgetopts_remove_title( $widget_title, $instance = array(), $widget_id = '' ){
|
386 |
-
global $widget_options;
|
387 |
-
if ( 'activate' == $widget_options['hide_title'] && is_array( $instance ) && !empty( $instance ) ){
|
388 |
-
foreach ( $instance as $key => $value) {
|
389 |
-
if( substr( $key, 0, 20 ) == 'extended_widget_opts' ){
|
390 |
-
$opts = ( isset( $instance[ $key ] ) ) ? $instance[ $key ] : array();
|
391 |
-
|
392 |
-
if( isset( $opts['class'] ) && isset( $opts['class']['title'] ) && '1' == $opts['class']['title'] ){
|
393 |
-
return;
|
394 |
-
}
|
395 |
-
|
396 |
-
break;
|
397 |
-
}
|
398 |
-
}
|
399 |
-
return $widget_title;
|
400 |
-
}else{
|
401 |
-
return ( $widget_title );
|
402 |
-
}
|
403 |
-
}
|
404 |
-
add_filter( 'widget_title', 'widgetopts_remove_title', 10, 4 );
|
405 |
-
endif;
|
406 |
-
|
407 |
-
/*
|
408 |
-
* Add custom classes on dynamic_sidebar_params filter
|
409 |
-
*/
|
410 |
-
if( !function_exists( 'widgetopts_add_classes' ) ):
|
411 |
-
function widgetopts_add_classes( $params ){
|
412 |
-
global $widget_options, $wp_registered_widget_controls;
|
413 |
-
$classe_to_add = '';
|
414 |
-
$id_base = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['id_base'];
|
415 |
-
$instance = get_option( 'widget_' . $id_base );
|
416 |
-
|
417 |
-
$num = substr( $params[0]['widget_id'], -1 );
|
418 |
-
if( isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'] ) ){
|
419 |
-
$num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'];
|
420 |
-
} elseif( isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback']) && is_array($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'])){
|
421 |
-
if (isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]) && isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number)) {
|
422 |
-
$num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number;
|
423 |
-
}
|
424 |
-
}
|
425 |
-
if( isset( $instance[ $num ] ) ){
|
426 |
-
$opts = ( isset( $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] ) ) ? $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] : array();
|
427 |
-
}else{
|
428 |
-
$opts = array();
|
429 |
-
}
|
430 |
-
|
431 |
-
$custom_class = isset( $opts['class'] ) ? $opts['class'] : '';
|
432 |
-
$widget_id_set = $params[0]['widget_id'];
|
433 |
-
|
434 |
-
if( 'activate' == $widget_options['classes'] && isset( $widget_options['settings']['classes'] ) ){
|
435 |
-
//don't add the IDs when the setting is set to NO
|
436 |
-
if( isset( $widget_options['settings']['classes']['id'] ) ){
|
437 |
-
if( is_array( $custom_class ) && isset( $custom_class['id'] ) && !empty( $custom_class['id'] ) ){
|
438 |
-
$params[0]['before_widget'] = preg_replace( '/id="[^"]*/', "id=\"{$custom_class['id']}", $params[0]['before_widget'], 1 );
|
439 |
-
$widget_id_set = $custom_class['id'];
|
440 |
-
}
|
441 |
-
}
|
442 |
-
|
443 |
-
}
|
444 |
-
|
445 |
-
$get_classes = widgetopts_classes_generator( $opts, $widget_options, $widget_options['settings'] );
|
446 |
-
|
447 |
-
//double check array
|
448 |
-
if( !is_array( $get_classes ) ){
|
449 |
-
$get_classes = array();
|
450 |
-
}
|
451 |
-
|
452 |
-
if( 'activate' == $widget_options['classes'] ){
|
453 |
-
if( isset( $widget_options['settings']['classes']['auto'] ) ){
|
454 |
-
//do nothing
|
455 |
-
}else{
|
456 |
-
//check if widget class exists
|
457 |
-
if ( ( strpos( $params[0]['before_widget'], '"widget ' ) !== false ) ||
|
458 |
-
( strpos( $params[0]['before_widget'], ' widget ' ) !== false ) ||
|
459 |
-
( strpos( $params[0]['before_widget'], ' widget"' ) !== false)
|
460 |
-
) {
|
461 |
-
//do nothing
|
462 |
-
}else{
|
463 |
-
$get_classes[] = 'widget';
|
464 |
-
}
|
465 |
-
}
|
466 |
-
}
|
467 |
-
|
468 |
-
if( !empty( $get_classes ) ){
|
469 |
-
$classes = 'class="'. ( implode( ' ', $get_classes ) ) . ' ';
|
470 |
-
$params[0]['before_widget'] = str_replace('class="', $classes, $params[0]['before_widget']);
|
471 |
-
}
|
472 |
-
|
473 |
-
// $params[0]['before_widget'] = str_replace('class="', ' data-animation="asdf" class="', $params[0]['before_widget']);
|
474 |
-
|
475 |
-
return $params;
|
476 |
-
}
|
477 |
-
add_filter( 'dynamic_sidebar_params', 'widgetopts_add_classes' );
|
478 |
-
endif;
|
479 |
-
|
480 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Handles Front-end Display
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
+
* @since 1.0
|
7 |
+
*/
|
8 |
+
// Exit if accessed directly
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Handles widget_display_callback filter
|
13 |
+
*
|
14 |
+
* @since 1.0
|
15 |
+
* @global $widget_options
|
16 |
+
* @return $instance
|
17 |
+
*/
|
18 |
+
|
19 |
+
//check if function exists
|
20 |
+
if( !function_exists( 'widgetopts_display_callback' ) ):
|
21 |
+
function widgetopts_display_callback( $instance, $widget, $args ){
|
22 |
+
global $widget_options, $current_user;
|
23 |
+
|
24 |
+
$hidden = false;
|
25 |
+
$opts = ( isset( $instance[ 'extended_widget_opts-'. $widget->id ] ) ) ? $instance[ 'extended_widget_opts-'. $widget->id ] : array();
|
26 |
+
$visibility = array( 'show' => array(), 'hide' => array() );
|
27 |
+
|
28 |
+
//wordpress pages
|
29 |
+
$visibility = isset( $opts['visibility'] ) ? $opts['visibility'] : array();
|
30 |
+
$visibility_opts = isset( $opts['visibility']['options'] ) ? $opts['visibility']['options'] : 'hide';
|
31 |
+
|
32 |
+
$is_misc = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['misc'] ) ) ? true : false;
|
33 |
+
$is_types = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['post_type'] ) ) ? true : false;
|
34 |
+
$is_tax = ( 'activate' == $widget_options['visibility'] && isset( $widget_options['settings']['visibility'] ) && isset( $widget_options['settings']['visibility']['taxonomies'] ) ) ? true : false;
|
35 |
+
|
36 |
+
if ( $is_misc && ( ( is_home() && is_front_page() ) || is_front_page() ) ) {
|
37 |
+
if( isset( $visibility['misc']['home'] ) && $visibility_opts == 'hide' ){
|
38 |
+
$hidden = true; //hide if checked on hidden pages
|
39 |
+
}elseif( !isset( $visibility['misc']['home'] ) && $visibility_opts == 'show' ){
|
40 |
+
$hidden = true; //hide if not checked on visible pages
|
41 |
+
}
|
42 |
+
|
43 |
+
//do return to bypass other conditions
|
44 |
+
$hidden = apply_filters( 'widget_options_visibility_home', $hidden );
|
45 |
+
if( $hidden ){
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
}elseif ( $is_misc && is_home() ) { //filter for blog page
|
49 |
+
if( isset( $visibility['misc']['blog'] ) && $visibility_opts == 'hide' ){
|
50 |
+
$hidden = true; //hide if checked on hidden pages
|
51 |
+
}elseif( !isset( $visibility['misc']['blog'] ) && $visibility_opts == 'show' ){
|
52 |
+
$hidden = true; //hide if not checked on visible pages
|
53 |
+
}
|
54 |
+
|
55 |
+
//do return to bypass other conditions
|
56 |
+
$hidden = apply_filters( 'widget_options_visibility_blog', $hidden );
|
57 |
+
if( $hidden ){
|
58 |
+
return false;
|
59 |
+
}
|
60 |
+
|
61 |
+
}elseif ( $is_tax && is_category() ) {
|
62 |
+
if( !isset( $visibility['categories'] ) ){
|
63 |
+
$visibility['categories'] = array();
|
64 |
+
}
|
65 |
+
|
66 |
+
if( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' && array_key_exists( get_query_var('cat') , $visibility['categories']) ){
|
67 |
+
$hidden = true; //hide if exists on hidden pages
|
68 |
+
}elseif( !isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' && !array_key_exists( get_query_var('cat') , $visibility['categories']) ){
|
69 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
70 |
+
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
|
71 |
+
$hidden = true; //hide to all categories
|
72 |
+
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' ){
|
73 |
+
$hidden = false; //hide to all categories
|
74 |
+
}
|
75 |
+
|
76 |
+
//do return to bypass other conditions
|
77 |
+
$hidden = apply_filters( 'widget_options_visibility_categories', $hidden );
|
78 |
+
if( $hidden ){
|
79 |
+
return false;
|
80 |
+
}
|
81 |
+
}elseif ( $is_tax && is_tag() ) {
|
82 |
+
if( !isset( $visibility['tags'] ) ){
|
83 |
+
$visibility['tags'] = array();
|
84 |
+
}
|
85 |
+
|
86 |
+
if( ( isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'hide' ) ||
|
87 |
+
( !isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'show' )
|
88 |
+
){
|
89 |
+
$hidden = true; //hide to all tags
|
90 |
+
}elseif( isset( $visibility['taxonomies']['post_tag'] ) && $visibility_opts == 'show' ){
|
91 |
+
$hidden = false; //hide to all tags
|
92 |
+
}
|
93 |
+
|
94 |
+
//do return to bypass other conditions
|
95 |
+
$hidden = apply_filters( 'widget_options_visibility_tags', $hidden );
|
96 |
+
if( $hidden ){
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
}elseif ( $is_tax && is_tax() ) {
|
100 |
+
$term = get_queried_object();
|
101 |
+
if( !isset( $visibility['taxonomies'] ) ){
|
102 |
+
$visibility['taxonomies'] = array();
|
103 |
+
}
|
104 |
+
|
105 |
+
if( $visibility_opts == 'hide' && array_key_exists( $term->taxonomy , $visibility['taxonomies']) ){
|
106 |
+
$hidden = true; //hide if exists on hidden pages
|
107 |
+
}elseif( $visibility_opts == 'show' && !array_key_exists( $term->taxonomy , $visibility['taxonomies']) ){
|
108 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
109 |
+
}
|
110 |
+
|
111 |
+
//do return to bypass other conditions
|
112 |
+
$hidden = apply_filters( 'widget_options_visibility_taxonomies', $hidden );
|
113 |
+
if( $hidden ){
|
114 |
+
return false;
|
115 |
+
}
|
116 |
+
}elseif ( $is_misc && is_archive() ) {
|
117 |
+
if( isset( $visibility['misc']['archives'] ) && $visibility_opts == 'hide' ){
|
118 |
+
$hidden = true; //hide if checked on hidden pages
|
119 |
+
}elseif( !isset( $visibility['misc']['archives'] ) && $visibility_opts == 'show' ){
|
120 |
+
$hidden = true; //hide if not checked on visible pages
|
121 |
+
}
|
122 |
+
|
123 |
+
//do return to bypass other conditions
|
124 |
+
$hidden = apply_filters( 'widget_options_visibility_archives', $hidden );
|
125 |
+
if( $hidden ){
|
126 |
+
return false;
|
127 |
+
}
|
128 |
+
}elseif ( $is_misc && is_404() ) {
|
129 |
+
if( isset( $visibility['misc']['404'] ) && $visibility_opts == 'hide' ){
|
130 |
+
$hidden = true; //hide if checked on hidden pages
|
131 |
+
}elseif( !isset( $visibility['misc']['404'] ) && $visibility_opts == 'show' ){
|
132 |
+
$hidden = true; //hide if not checked on visible pages
|
133 |
+
}
|
134 |
+
|
135 |
+
//do return to bypass other conditions
|
136 |
+
$hidden = apply_filters( 'widget_options_visibility_404', $hidden );
|
137 |
+
if( $hidden ){
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
}elseif ( $is_misc && is_search() ) {
|
141 |
+
if( isset( $visibility['misc']['search'] ) && $visibility_opts == 'hide' ){
|
142 |
+
$hidden = true; //hide if checked on hidden pages
|
143 |
+
}elseif( !isset( $visibility['misc']['search'] ) && $visibility_opts == 'show' ){
|
144 |
+
$hidden = true; //hide if not checked on visible pages
|
145 |
+
}
|
146 |
+
|
147 |
+
//do return to bypass other conditions
|
148 |
+
$hidden = apply_filters( 'widget_options_visibility_search', $hidden );
|
149 |
+
if( $hidden ){
|
150 |
+
return false;
|
151 |
+
}
|
152 |
+
}elseif ( is_single() && !is_page() ) {
|
153 |
+
global $post;
|
154 |
+
$type = $post->post_type;
|
155 |
+
|
156 |
+
if( !isset( $visibility['types'] ) ){
|
157 |
+
$visibility['types'] = array();
|
158 |
+
}
|
159 |
+
if( $visibility_opts == 'hide' && array_key_exists( $type , $visibility['types']) ){
|
160 |
+
$hidden = true; //hide if exists on hidden pages
|
161 |
+
}elseif( $visibility_opts == 'show' && !array_key_exists( $type , $visibility['types']) ){
|
162 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
163 |
+
}
|
164 |
+
// do return to bypass other conditions
|
165 |
+
$hidden = apply_filters( 'widget_options_visibility_types', $hidden );
|
166 |
+
//hide posts assign on category
|
167 |
+
if( !isset( $visibility['categories'] ) ){
|
168 |
+
$visibility['categories'] = array();
|
169 |
+
}
|
170 |
+
if( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'hide' ){
|
171 |
+
$hidden = true; //hide to all categories
|
172 |
+
}elseif( isset( $visibility['categories']['all_categories'] ) && $visibility_opts == 'show' ){
|
173 |
+
$hidden = false; //hide to all categories
|
174 |
+
}elseif( !isset( $visibility['categories']['all_categories'] ) && !empty( $visibility['categories'] ) ) {
|
175 |
+
$cats = wp_get_post_categories( get_the_ID() );
|
176 |
+
if( is_array( $cats ) && !empty( $cats ) ){
|
177 |
+
$checked_cats = array_keys( $visibility['categories'] );
|
178 |
+
$intersect = array_intersect( $cats , $checked_cats );
|
179 |
+
if( !empty( $intersect ) && $visibility_opts == 'hide' ){
|
180 |
+
$hidden = true;
|
181 |
+
}elseif( !empty( $intersect ) && $visibility_opts == 'show' ){
|
182 |
+
$hidden = false;
|
183 |
+
}
|
184 |
+
}
|
185 |
+
}
|
186 |
+
// do return to bypass other conditions
|
187 |
+
$hidden = apply_filters( 'widget_options_visibility_post_category', $hidden );
|
188 |
+
if( $hidden ){
|
189 |
+
return false;
|
190 |
+
}
|
191 |
+
// echo $type;
|
192 |
+
}elseif ( $is_types && is_page() ) {
|
193 |
+
global $post;
|
194 |
+
//do post type condition first
|
195 |
+
if( isset( $visibility['types'] ) && isset( $visibility['types']['page'] ) ){
|
196 |
+
if( $visibility_opts == 'hide' && array_key_exists( 'page' , $visibility['types']) ){
|
197 |
+
$hidden = true; //hide if exists on hidden pages
|
198 |
+
}elseif( $visibility_opts == 'show' && !array_key_exists( 'page' , $visibility['types']) ){
|
199 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
200 |
+
}
|
201 |
+
}else{
|
202 |
+
//do per pages condition
|
203 |
+
if( !isset( $visibility['pages'] ) ){
|
204 |
+
$visibility['pages'] = array();
|
205 |
+
}
|
206 |
+
if( $visibility_opts == 'hide' && array_key_exists( $post->ID , $visibility['pages']) ){
|
207 |
+
$hidden = true; //hide if exists on hidden pages
|
208 |
+
}elseif( $visibility_opts == 'show' && !array_key_exists( $post->ID , $visibility['pages']) ){
|
209 |
+
$hidden = true; //hide if doesn't exists on visible pages
|
210 |
+
}
|
211 |
+
}
|
212 |
+
//do return to bypass other conditions
|
213 |
+
$hidden = apply_filters( 'widget_options_visibility_page', $hidden );
|
214 |
+
if( $hidden ){
|
215 |
+
return false;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
//end wordpress pages
|
220 |
+
|
221 |
+
//ACF
|
222 |
+
if( isset( $widget_options['acf'] ) && 'activate' == $widget_options['acf'] ){
|
223 |
+
if( isset( $visibility['acf']['field'] ) && !empty( $visibility['acf']['field'] ) ){
|
224 |
+
$acf = get_field_object( $visibility['acf']['field'] );
|
225 |
+
if( $acf && is_array( $acf ) ){
|
226 |
+
$acf_visibility = ( isset( $visibility['acf'] ) && isset( $visibility['acf']['visibility'] ) ) ? $visibility['acf']['visibility'] : 'hide';
|
227 |
+
|
228 |
+
//handle repeater fields
|
229 |
+
if( isset( $acf['value'] ) ){
|
230 |
+
if( is_array( $acf['value'] ) ){
|
231 |
+
$acf['value'] = implode(', ', array_map(function ( $acf_array_value ) {
|
232 |
+
$acf_implode = implode( ',', array_filter($acf_array_value) );
|
233 |
+
return $acf_implode;
|
234 |
+
}, $acf['value']));
|
235 |
+
}
|
236 |
+
}
|
237 |
+
|
238 |
+
switch ( $visibility['acf']['condition'] ) {
|
239 |
+
case 'equal':
|
240 |
+
if( isset( $acf['value'] ) ){
|
241 |
+
if( 'show' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
242 |
+
$hidden = false;
|
243 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
244 |
+
$hidden = true;
|
245 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
246 |
+
$hidden = true;
|
247 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
248 |
+
$hidden = false;
|
249 |
+
}
|
250 |
+
}
|
251 |
+
break;
|
252 |
+
|
253 |
+
case 'not_equal':
|
254 |
+
if( isset( $acf['value'] ) ){
|
255 |
+
if( 'show' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
256 |
+
$hidden = true;
|
257 |
+
}else if( 'show' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
258 |
+
$hidden = false;
|
259 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] == $visibility['acf']['value'] ){
|
260 |
+
$hidden = false;
|
261 |
+
}else if( 'hide' == $acf_visibility && $acf['value'] != $visibility['acf']['value'] ){
|
262 |
+
$hidden = true;
|
263 |
+
}
|
264 |
+
}
|
265 |
+
break;
|
266 |
+
|
267 |
+
case 'contains':
|
268 |
+
if( isset( $acf['value'] ) ){
|
269 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
270 |
+
$hidden = false;
|
271 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
272 |
+
$hidden = true;
|
273 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
274 |
+
$hidden = true;
|
275 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
276 |
+
$hidden = false;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
break;
|
280 |
+
|
281 |
+
case 'not_contains':
|
282 |
+
if( isset( $acf['value'] ) ){
|
283 |
+
if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
284 |
+
$hidden = true;
|
285 |
+
}else if( 'show' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
286 |
+
$hidden = false;
|
287 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) !== false ){
|
288 |
+
$hidden = false;
|
289 |
+
}else if( 'hide' == $acf_visibility && strpos( $acf['value'], $visibility['acf']['value'] ) === false ){
|
290 |
+
$hidden = true;
|
291 |
+
}
|
292 |
+
}
|
293 |
+
break;
|
294 |
+
|
295 |
+
case 'empty':
|
296 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
297 |
+
$hidden = false;
|
298 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
299 |
+
$hidden = true;
|
300 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
301 |
+
$hidden = true;
|
302 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
303 |
+
$hidden = false;
|
304 |
+
}
|
305 |
+
break;
|
306 |
+
|
307 |
+
case 'not_empty':
|
308 |
+
if( 'show' == $acf_visibility && empty( $acf['value'] ) ){
|
309 |
+
$hidden = true;
|
310 |
+
}else if( 'show' == $acf_visibility && !empty( $acf['value'] ) ){
|
311 |
+
$hidden = false;
|
312 |
+
}elseif( 'hide' == $acf_visibility && empty( $acf['value'] ) ){
|
313 |
+
$hidden = false;
|
314 |
+
}else if( 'hide' == $acf_visibility && !empty( $acf['value'] ) ){
|
315 |
+
$hidden = true;
|
316 |
+
}
|
317 |
+
break;
|
318 |
+
|
319 |
+
default:
|
320 |
+
# code...
|
321 |
+
break;
|
322 |
+
}
|
323 |
+
|
324 |
+
// //do return to bypass other conditions
|
325 |
+
$hidden = apply_filters( 'widget_options_visibility_acf', $hidden );
|
326 |
+
if( $hidden ){
|
327 |
+
return false;
|
328 |
+
}
|
329 |
+
}
|
330 |
+
}
|
331 |
+
}
|
332 |
+
|
333 |
+
//login state
|
334 |
+
if( isset( $widget_options['state'] ) && 'activate' == $widget_options['state'] && isset( $opts['roles'] ) ){
|
335 |
+
if( isset( $opts['roles']['state'] ) && !empty( $opts['roles']['state'] ) ){
|
336 |
+
//do state action here
|
337 |
+
if( $opts['roles']['state'] == 'out' && is_user_logged_in() ){
|
338 |
+
return false;
|
339 |
+
}else if( $opts['roles']['state'] == 'in' && !is_user_logged_in() ){
|
340 |
+
return false;
|
341 |
+
}
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
if( 'activate' == $widget_options['logic'] ){
|
346 |
+
// display widget logic
|
347 |
+
if( isset( $opts['class'] ) && isset( $opts['class']['logic'] ) && !empty( $opts['class']['logic'] ) ){
|
348 |
+
$display_logic = stripslashes( trim( $opts['class']['logic'] ) );
|
349 |
+
$display_logic = apply_filters( 'widget_options_logic_override', $display_logic );
|
350 |
+
$display_logic = apply_filters( 'extended_widget_options_logic_override', $display_logic );
|
351 |
+
if ( $display_logic === false ){
|
352 |
+
return false;
|
353 |
+
}
|
354 |
+
if ( $display_logic === true ){
|
355 |
+
return true;
|
356 |
+
}
|
357 |
+
if ( stristr($display_logic,"return")===false ){
|
358 |
+
$display_logic="return (" . $display_logic . ");";
|
359 |
+
}
|
360 |
+
$display_logic = htmlspecialchars_decode($display_logic, ENT_QUOTES);
|
361 |
+
try {
|
362 |
+
if ( !eval( $display_logic ) ){
|
363 |
+
return false;
|
364 |
+
}
|
365 |
+
} catch (ParseError $e) {
|
366 |
+
return false;
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
|
371 |
+
if( 'activate' == $widget_options['hide_title'] ){
|
372 |
+
//hide widget title
|
373 |
+
if( isset( $instance['title'] ) && isset( $opts['class'] ) && isset( $opts['class']['title'] ) && '1' == $opts['class']['title'] ){
|
374 |
+
$instance['title'] = '';
|
375 |
+
}
|
376 |
+
}
|
377 |
+
|
378 |
+
return $instance;
|
379 |
+
}
|
380 |
+
add_filter( 'widget_display_callback', 'widgetopts_display_callback', 50, 3 );
|
381 |
+
endif;
|
382 |
+
|
383 |
+
//Don't show widget title
|
384 |
+
if( !function_exists( 'widgetopts_remove_title' ) ):
|
385 |
+
function widgetopts_remove_title( $widget_title, $instance = array(), $widget_id = '' ){
|
386 |
+
global $widget_options;
|
387 |
+
if ( 'activate' == $widget_options['hide_title'] && is_array( $instance ) && !empty( $instance ) ){
|
388 |
+
foreach ( $instance as $key => $value) {
|
389 |
+
if( substr( $key, 0, 20 ) == 'extended_widget_opts' ){
|
390 |
+
$opts = ( isset( $instance[ $key ] ) ) ? $instance[ $key ] : array();
|
391 |
+
|
392 |
+
if( isset( $opts['class'] ) && isset( $opts['class']['title'] ) && '1' == $opts['class']['title'] ){
|
393 |
+
return;
|
394 |
+
}
|
395 |
+
|
396 |
+
break;
|
397 |
+
}
|
398 |
+
}
|
399 |
+
return $widget_title;
|
400 |
+
}else{
|
401 |
+
return ( $widget_title );
|
402 |
+
}
|
403 |
+
}
|
404 |
+
add_filter( 'widget_title', 'widgetopts_remove_title', 10, 4 );
|
405 |
+
endif;
|
406 |
+
|
407 |
+
/*
|
408 |
+
* Add custom classes on dynamic_sidebar_params filter
|
409 |
+
*/
|
410 |
+
if( !function_exists( 'widgetopts_add_classes' ) ):
|
411 |
+
function widgetopts_add_classes( $params ){
|
412 |
+
global $widget_options, $wp_registered_widget_controls;
|
413 |
+
$classe_to_add = '';
|
414 |
+
$id_base = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['id_base'];
|
415 |
+
$instance = get_option( 'widget_' . $id_base );
|
416 |
+
|
417 |
+
$num = substr( $params[0]['widget_id'], -1 );
|
418 |
+
if( isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'] ) ){
|
419 |
+
$num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['params'][0]['number'];
|
420 |
+
} elseif( isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback']) && is_array($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'])){
|
421 |
+
if (isset($wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]) && isset( $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number)) {
|
422 |
+
$num = $wp_registered_widget_controls[ $params[0]['widget_id'] ]['callback'][0]->number;
|
423 |
+
}
|
424 |
+
}
|
425 |
+
if( isset( $instance[ $num ] ) ){
|
426 |
+
$opts = ( isset( $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] ) ) ? $instance[ $num ][ 'extended_widget_opts-'. $params[0]['widget_id'] ] : array();
|
427 |
+
}else{
|
428 |
+
$opts = array();
|
429 |
+
}
|
430 |
+
|
431 |
+
$custom_class = isset( $opts['class'] ) ? $opts['class'] : '';
|
432 |
+
$widget_id_set = $params[0]['widget_id'];
|
433 |
+
|
434 |
+
if( 'activate' == $widget_options['classes'] && isset( $widget_options['settings']['classes'] ) ){
|
435 |
+
//don't add the IDs when the setting is set to NO
|
436 |
+
if( isset( $widget_options['settings']['classes']['id'] ) ){
|
437 |
+
if( is_array( $custom_class ) && isset( $custom_class['id'] ) && !empty( $custom_class['id'] ) ){
|
438 |
+
$params[0]['before_widget'] = preg_replace( '/id="[^"]*/', "id=\"{$custom_class['id']}", $params[0]['before_widget'], 1 );
|
439 |
+
$widget_id_set = $custom_class['id'];
|
440 |
+
}
|
441 |
+
}
|
442 |
+
|
443 |
+
}
|
444 |
+
|
445 |
+
$get_classes = widgetopts_classes_generator( $opts, $widget_options, $widget_options['settings'] );
|
446 |
+
|
447 |
+
//double check array
|
448 |
+
if( !is_array( $get_classes ) ){
|
449 |
+
$get_classes = array();
|
450 |
+
}
|
451 |
+
|
452 |
+
if( 'activate' == $widget_options['classes'] ){
|
453 |
+
if( isset( $widget_options['settings']['classes']['auto'] ) ){
|
454 |
+
//do nothing
|
455 |
+
}else{
|
456 |
+
//check if widget class exists
|
457 |
+
if ( ( strpos( $params[0]['before_widget'], '"widget ' ) !== false ) ||
|
458 |
+
( strpos( $params[0]['before_widget'], ' widget ' ) !== false ) ||
|
459 |
+
( strpos( $params[0]['before_widget'], ' widget"' ) !== false)
|
460 |
+
) {
|
461 |
+
//do nothing
|
462 |
+
}else{
|
463 |
+
$get_classes[] = 'widget';
|
464 |
+
}
|
465 |
+
}
|
466 |
+
}
|
467 |
+
|
468 |
+
if( !empty( $get_classes ) ){
|
469 |
+
$classes = 'class="'. ( implode( ' ', $get_classes ) ) . ' ';
|
470 |
+
$params[0]['before_widget'] = str_replace('class="', $classes, $params[0]['before_widget']);
|
471 |
+
}
|
472 |
+
|
473 |
+
// $params[0]['before_widget'] = str_replace('class="', ' data-animation="asdf" class="', $params[0]['before_widget']);
|
474 |
+
|
475 |
+
return $params;
|
476 |
+
}
|
477 |
+
add_filter( 'dynamic_sidebar_params', 'widgetopts_add_classes' );
|
478 |
+
endif;
|
479 |
+
|
480 |
+
?>
|
includes/widgets/option-tabs/alignment.php
CHANGED
@@ -1,71 +1,71 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Alignment Widget Options
|
4 |
-
*
|
5 |
-
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
-
* @since 1.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
// Exit if accessed directly
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Add Alignment Widget Options Tab
|
14 |
-
*
|
15 |
-
* @since 1.0
|
16 |
-
* @return void
|
17 |
-
*/
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Called on 'extended_widget_opts_tabs'
|
21 |
-
* create new tab navigation for alignment options
|
22 |
-
*/
|
23 |
-
function widgetopts_tab_alignment( $args ){ ?>
|
24 |
-
<li class="extended-widget-opts-tab-alignment">
|
25 |
-
<a href="#extended-widget-opts-tab-<?php echo $args['id'];?>-alignment" title="<?php _e( 'Alignment', 'widget-options' );?>" ><span class="dashicons dashicons-editor-aligncenter"></span> <span class="tabtitle"><?php _e( 'Alignment', 'widget-options' );?></span></a>
|
26 |
-
</li>
|
27 |
-
<?php
|
28 |
-
}
|
29 |
-
add_action( 'extended_widget_opts_tabs', 'widgetopts_tab_alignment' );
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Called on 'extended_widget_opts_tabcontent'
|
33 |
-
* create new tab content options for alignment options
|
34 |
-
*/
|
35 |
-
function widgetopts_tabcontent_alignment( $args ){
|
36 |
-
$desktop = '';
|
37 |
-
if( isset( $args['params'] ) && isset( $args['params']['alignment'] ) ){
|
38 |
-
if( isset( $args['params']['alignment']['desktop'] ) ){
|
39 |
-
$desktop = $args['params']['alignment']['desktop'];
|
40 |
-
}
|
41 |
-
}
|
42 |
-
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE));
|
43 |
-
?>
|
44 |
-
<div id="extended-widget-opts-tab-<?php echo $args['id'];?>-alignment" class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-alignment">
|
45 |
-
<table class="form-table">
|
46 |
-
<tbody>
|
47 |
-
<tr valign="top">
|
48 |
-
<td scope="row"><strong><?php _e( 'Devices', 'widget-options' );?></strong></td>
|
49 |
-
<td><strong><?php _e( 'Alignment', 'widget-options' );?></strong></td>
|
50 |
-
</tr>
|
51 |
-
<tr valign="top">
|
52 |
-
<td scope="row"><span class="dashicons dashicons-desktop"></span> <?php _e( 'All Devices', 'widget-options' );?></td>
|
53 |
-
<td>
|
54 |
-
<select class="widefat" name="<?php echo $args['namespace'];?>[extended_widget_opts][alignment][desktop]">
|
55 |
-
<option value="default"><?php _e( 'Default', 'widget-options' );?></option>
|
56 |
-
<option value="center" <?php if( $desktop == 'center' ){ echo 'selected="selected"'; }?> ><?php _e( 'Center', 'widget-options' );?></option>
|
57 |
-
<option value="left" <?php if( $desktop == 'left' ){ echo 'selected="selected"'; }?>><?php _e( 'Left', 'widget-options' );?></option>
|
58 |
-
<option value="right" <?php if( $desktop == 'right' ){ echo 'selected="selected"'; }?>><?php _e( 'Right', 'widget-options' );?></option>
|
59 |
-
<option value="justify" <?php if( $desktop == 'justify' ){ echo 'selected="selected"'; }?>><?php _e( 'Justify', 'widget-options' );?></option>
|
60 |
-
</select>
|
61 |
-
</td>
|
62 |
-
</tr>
|
63 |
-
<tr valign="top" class="widgetopts-topro">
|
64 |
-
<td colspan="2"><small><?php _e( '<em>Upgrade to <a href="'.$upgrade_link.'" target="_blank">Pro Version</a> for Multiple Devices Alignment and Additional Widget Options.</em>', 'widget-options' );?></small></td>
|
65 |
-
</tr>
|
66 |
-
</tbody>
|
67 |
-
</table>
|
68 |
-
</div>
|
69 |
-
<?php
|
70 |
-
}
|
71 |
-
add_action( 'extended_widget_opts_tabcontent', 'widgetopts_tabcontent_alignment'); ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Alignment Widget Options
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
+
* @since 1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add Alignment Widget Options Tab
|
14 |
+
*
|
15 |
+
* @since 1.0
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Called on 'extended_widget_opts_tabs'
|
21 |
+
* create new tab navigation for alignment options
|
22 |
+
*/
|
23 |
+
function widgetopts_tab_alignment( $args ){ ?>
|
24 |
+
<li class="extended-widget-opts-tab-alignment">
|
25 |
+
<a href="#extended-widget-opts-tab-<?php echo $args['id'];?>-alignment" title="<?php _e( 'Alignment', 'widget-options' );?>" ><span class="dashicons dashicons-editor-aligncenter"></span> <span class="tabtitle"><?php _e( 'Alignment', 'widget-options' );?></span></a>
|
26 |
+
</li>
|
27 |
+
<?php
|
28 |
+
}
|
29 |
+
add_action( 'extended_widget_opts_tabs', 'widgetopts_tab_alignment' );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Called on 'extended_widget_opts_tabcontent'
|
33 |
+
* create new tab content options for alignment options
|
34 |
+
*/
|
35 |
+
function widgetopts_tabcontent_alignment( $args ){
|
36 |
+
$desktop = '';
|
37 |
+
if( isset( $args['params'] ) && isset( $args['params']['alignment'] ) ){
|
38 |
+
if( isset( $args['params']['alignment']['desktop'] ) ){
|
39 |
+
$desktop = $args['params']['alignment']['desktop'];
|
40 |
+
}
|
41 |
+
}
|
42 |
+
$upgrade_link = apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE));
|
43 |
+
?>
|
44 |
+
<div id="extended-widget-opts-tab-<?php echo $args['id'];?>-alignment" class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-alignment">
|
45 |
+
<table class="form-table">
|
46 |
+
<tbody>
|
47 |
+
<tr valign="top">
|
48 |
+
<td scope="row"><strong><?php _e( 'Devices', 'widget-options' );?></strong></td>
|
49 |
+
<td><strong><?php _e( 'Alignment', 'widget-options' );?></strong></td>
|
50 |
+
</tr>
|
51 |
+
<tr valign="top">
|
52 |
+
<td scope="row"><span class="dashicons dashicons-desktop"></span> <?php _e( 'All Devices', 'widget-options' );?></td>
|
53 |
+
<td>
|
54 |
+
<select class="widefat" name="<?php echo $args['namespace'];?>[extended_widget_opts][alignment][desktop]">
|
55 |
+
<option value="default"><?php _e( 'Default', 'widget-options' );?></option>
|
56 |
+
<option value="center" <?php if( $desktop == 'center' ){ echo 'selected="selected"'; }?> ><?php _e( 'Center', 'widget-options' );?></option>
|
57 |
+
<option value="left" <?php if( $desktop == 'left' ){ echo 'selected="selected"'; }?>><?php _e( 'Left', 'widget-options' );?></option>
|
58 |
+
<option value="right" <?php if( $desktop == 'right' ){ echo 'selected="selected"'; }?>><?php _e( 'Right', 'widget-options' );?></option>
|
59 |
+
<option value="justify" <?php if( $desktop == 'justify' ){ echo 'selected="selected"'; }?>><?php _e( 'Justify', 'widget-options' );?></option>
|
60 |
+
</select>
|
61 |
+
</td>
|
62 |
+
</tr>
|
63 |
+
<tr valign="top" class="widgetopts-topro">
|
64 |
+
<td colspan="2"><small><?php _e( '<em>Upgrade to <a href="'.$upgrade_link.'" target="_blank">Pro Version</a> for Multiple Devices Alignment and Additional Widget Options.</em>', 'widget-options' );?></small></td>
|
65 |
+
</tr>
|
66 |
+
</tbody>
|
67 |
+
</table>
|
68 |
+
</div>
|
69 |
+
<?php
|
70 |
+
}
|
71 |
+
add_action( 'extended_widget_opts_tabcontent', 'widgetopts_tabcontent_alignment'); ?>
|
includes/widgets/option-tabs/upsell.php
CHANGED
@@ -1,91 +1,91 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Upsell Extended Version Widget Options
|
4 |
-
*
|
5 |
-
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
-
* @since 1.0
|
7 |
-
*/
|
8 |
-
|
9 |
-
// Exit if accessed directly
|
10 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
-
|
12 |
-
/**
|
13 |
-
* Add Upgrade to Pro Widget Options Tab
|
14 |
-
*
|
15 |
-
* @since 1.0
|
16 |
-
* @return void
|
17 |
-
*/
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Called on 'extended_widget_opts_tabs'
|
21 |
-
* create new tab navigation for alignment options
|
22 |
-
*/
|
23 |
-
function widgetopts_tab_gopro( $args ){ ?>
|
24 |
-
<li class="extended-widget-gopro-tab-alignment">
|
25 |
-
<a href="#extended-widget-opts-tab-<?php echo $args['id'];?>-gopro">+</a>
|
26 |
-
</li>
|
27 |
-
<?php
|
28 |
-
}
|
29 |
-
add_action( 'extended_widget_opts_tabs', 'widgetopts_tab_gopro', 100 );
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Called on 'extended_widget_opts_tabcontent'
|
33 |
-
* create new tab content options for alignment options
|
34 |
-
*/
|
35 |
-
function widgetopts_tabcontent_gopro( $args ){ ?>
|
36 |
-
<div id="extended-widget-opts-tab-<?php echo $args['id'];?>-gopro" class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-gopro">
|
37 |
-
<p class="widgetopts-unlock-features">
|
38 |
-
<span class="dashicons dashicons-lock"></span><?php _e( 'Unlock all Options', 'widget-options' );?>
|
39 |
-
</p>
|
40 |
-
<p>
|
41 |
-
<?php _e( 'Get the world\'s most complete widget management and get the best out of your widgets! Upgrade to extended version to get:', 'widget-options' );?>
|
42 |
-
</p>
|
43 |
-
<ul>
|
44 |
-
<li>
|
45 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Animation Options', 'widget-options' );?>
|
46 |
-
</li>
|
47 |
-
<li>
|
48 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Custom Styling Options', 'widget-options' );?>
|
49 |
-
</li>
|
50 |
-
<li>
|
51 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Column Display', 'widget-options' );?>
|
52 |
-
</li>
|
53 |
-
<li>
|
54 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'User Roles Visibility Restriction', 'widget-options' );?>
|
55 |
-
</li>
|
56 |
-
<li>
|
57 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Fixed/Sticky Widget Options', 'widget-options' );?>
|
58 |
-
</li>
|
59 |
-
<li>
|
60 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Days and Date Range Restriction', 'widget-options' );?>
|
61 |
-
</li>
|
62 |
-
<li>
|
63 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Link Widget Options', 'widget-options' );?>
|
64 |
-
</li>
|
65 |
-
<li>
|
66 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Clone Widget Options', 'widget-options' );?>
|
67 |
-
</li>
|
68 |
-
<li>
|
69 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Widget Caching Options', 'widget-options' );?>
|
70 |
-
</li>
|
71 |
-
<li>
|
72 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Shortcodes Options', 'widget-options' );?>
|
73 |
-
</li>
|
74 |
-
<li>
|
75 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Extended Taxonomy and Post Types Support', 'widget-options' );?>
|
76 |
-
</li>
|
77 |
-
<li>
|
78 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Disable Widgets and Permissions', 'widget-options' );?>
|
79 |
-
</li>
|
80 |
-
<li>
|
81 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Target URLs and Wildcard Restrictions', 'widget-options' );?>
|
82 |
-
</li>
|
83 |
-
<li>
|
84 |
-
<span class="dashicons dashicons-lock"></span> <?php _e( 'Pagebuilder by SiteOrigin Support', 'widget-options' );?>
|
85 |
-
</li>
|
86 |
-
</ul>
|
87 |
-
<p><strong><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widgettabs&utm_campaign=widgetoptsprotab');?>" class="button-primary" target="_blank"><?php _e( 'Learn More', 'widget-options' );?></a></strong></p>
|
88 |
-
</div>
|
89 |
-
<?php
|
90 |
-
}
|
91 |
-
add_action( 'extended_widget_opts_tabcontent', 'widgetopts_tabcontent_gopro'); ?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Upsell Extended Version Widget Options
|
4 |
+
*
|
5 |
+
* @copyright Copyright (c) 2015, Jeffrey Carandang
|
6 |
+
* @since 1.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
// Exit if accessed directly
|
10 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add Upgrade to Pro Widget Options Tab
|
14 |
+
*
|
15 |
+
* @since 1.0
|
16 |
+
* @return void
|
17 |
+
*/
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Called on 'extended_widget_opts_tabs'
|
21 |
+
* create new tab navigation for alignment options
|
22 |
+
*/
|
23 |
+
function widgetopts_tab_gopro( $args ){ ?>
|
24 |
+
<li class="extended-widget-gopro-tab-alignment">
|
25 |
+
<a href="#extended-widget-opts-tab-<?php echo $args['id'];?>-gopro">+</a>
|
26 |
+
</li>
|
27 |
+
<?php
|
28 |
+
}
|
29 |
+
add_action( 'extended_widget_opts_tabs', 'widgetopts_tab_gopro', 100 );
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Called on 'extended_widget_opts_tabcontent'
|
33 |
+
* create new tab content options for alignment options
|
34 |
+
*/
|
35 |
+
function widgetopts_tabcontent_gopro( $args ){ ?>
|
36 |
+
<div id="extended-widget-opts-tab-<?php echo $args['id'];?>-gopro" class="extended-widget-opts-tabcontent extended-widget-opts-tabcontent-gopro">
|
37 |
+
<p class="widgetopts-unlock-features">
|
38 |
+
<span class="dashicons dashicons-lock"></span><?php _e( 'Unlock all Options', 'widget-options' );?>
|
39 |
+
</p>
|
40 |
+
<p>
|
41 |
+
<?php _e( 'Get the world\'s most complete widget management and get the best out of your widgets! Upgrade to extended version to get:', 'widget-options' );?>
|
42 |
+
</p>
|
43 |
+
<ul>
|
44 |
+
<li>
|
45 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Animation Options', 'widget-options' );?>
|
46 |
+
</li>
|
47 |
+
<li>
|
48 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Custom Styling Options', 'widget-options' );?>
|
49 |
+
</li>
|
50 |
+
<li>
|
51 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Column Display', 'widget-options' );?>
|
52 |
+
</li>
|
53 |
+
<li>
|
54 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'User Roles Visibility Restriction', 'widget-options' );?>
|
55 |
+
</li>
|
56 |
+
<li>
|
57 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Fixed/Sticky Widget Options', 'widget-options' );?>
|
58 |
+
</li>
|
59 |
+
<li>
|
60 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Days and Date Range Restriction', 'widget-options' );?>
|
61 |
+
</li>
|
62 |
+
<li>
|
63 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Link Widget Options', 'widget-options' );?>
|
64 |
+
</li>
|
65 |
+
<li>
|
66 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Clone Widget Options', 'widget-options' );?>
|
67 |
+
</li>
|
68 |
+
<li>
|
69 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Widget Caching Options', 'widget-options' );?>
|
70 |
+
</li>
|
71 |
+
<li>
|
72 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Shortcodes Options', 'widget-options' );?>
|
73 |
+
</li>
|
74 |
+
<li>
|
75 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Extended Taxonomy and Post Types Support', 'widget-options' );?>
|
76 |
+
</li>
|
77 |
+
<li>
|
78 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Disable Widgets and Permissions', 'widget-options' );?>
|
79 |
+
</li>
|
80 |
+
<li>
|
81 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Target URLs and Wildcard Restrictions', 'widget-options' );?>
|
82 |
+
</li>
|
83 |
+
<li>
|
84 |
+
<span class="dashicons dashicons-lock"></span> <?php _e( 'Pagebuilder by SiteOrigin Support', 'widget-options' );?>
|
85 |
+
</li>
|
86 |
+
</ul>
|
87 |
+
<p><strong><a href="<?php echo apply_filters('widget_options_site_url', trailingslashit(WIDGETOPTS_PLUGIN_WEBSITE).'?utm_source=wordpressadmin&utm_medium=widgettabs&utm_campaign=widgetoptsprotab');?>" class="button-primary" target="_blank"><?php _e( 'Learn More', 'widget-options' );?></a></strong></p>
|
88 |
+
</div>
|
89 |
+
<?php
|
90 |
+
}
|
91 |
+
add_action( 'extended_widget_opts_tabcontent', 'widgetopts_tabcontent_gopro'); ?>
|
plugin.php
CHANGED
@@ -1,269 +1,269 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Widget Options
|
4 |
-
* Plugin URI: https://widget-options.com/
|
5 |
-
* Description: Additional Widget options for better widget control. Get <strong><a href="http://widget-options.com/" target="_blank" >Extended Widget Options for WordPress</a></strong> for complete widget controls. Thanks!
|
6 |
-
* Version: 3.7.
|
7 |
-
* Author: Widget Options Team
|
8 |
-
* Author URI: https://widget-options.com/
|
9 |
-
* Text Domain: widget-options
|
10 |
-
* Domain Path: languages
|
11 |
-
*
|
12 |
-
* @category Widgets
|
13 |
-
* @author Widget Options Team
|
14 |
-
*/
|
15 |
-
// Exit if accessed directly.
|
16 |
-
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
-
if ( ! class_exists( 'WP_Widget_Options' ) ) :
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Main WP_Widget_Options Class.
|
21 |
-
*
|
22 |
-
* @since 3.2
|
23 |
-
*/
|
24 |
-
final class WP_Widget_Options {
|
25 |
-
/**
|
26 |
-
* @var WP_Widget_Options The one true WP_Widget_Options
|
27 |
-
* @since 3.2
|
28 |
-
*/
|
29 |
-
private static $instance;
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Main WP_Widget_Options Instance.
|
33 |
-
*
|
34 |
-
* Insures that only one instance of WP_Widget_Options exists in memory at any one
|
35 |
-
* time. Also prevents needing to define globals all over the place.
|
36 |
-
*
|
37 |
-
* @since 3.2
|
38 |
-
* @static
|
39 |
-
* @staticvar array $instance
|
40 |
-
* @uses WP_Widget_Options::setup_constants() Setup the constants needed.
|
41 |
-
* @uses WP_Widget_Options::includes() Include the required files.
|
42 |
-
* @uses WP_Widget_Options::load_textdomain() load the language files.
|
43 |
-
* @see WIDGETOPTS()
|
44 |
-
* @return object|WP_Widget_Options The one true WP_Widget_Options
|
45 |
-
*/
|
46 |
-
public static function instance() {
|
47 |
-
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Widget_Options ) ) {
|
48 |
-
self::$instance = new WP_Widget_Options;
|
49 |
-
self::$instance->setup_constants();
|
50 |
-
|
51 |
-
// add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
52 |
-
|
53 |
-
self::$instance->includes();
|
54 |
-
// self::$instance->roles = new WIDGETOPTS_Roles();
|
55 |
-
add_filter( 'use_widgets_block_editor', array(self::$instance,'widget_options_use_widgets_block_editor') );
|
56 |
-
}
|
57 |
-
return self::$instance;
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* REVERT classic widgets screen
|
62 |
-
*/
|
63 |
-
public function widget_options_use_widgets_block_editor( $use_widgets_block_editor ) {
|
64 |
-
global $widget_options;
|
65 |
-
if(!empty($widget_options['classic_widgets_screen']) && $widget_options['classic_widgets_screen'] == 'activate' ){
|
66 |
-
return false;
|
67 |
-
}else{
|
68 |
-
return true;
|
69 |
-
}
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Setup plugin constants.
|
74 |
-
*
|
75 |
-
* @access private
|
76 |
-
* @since 4.1
|
77 |
-
* @return void
|
78 |
-
*/
|
79 |
-
private function setup_constants() {
|
80 |
-
|
81 |
-
// Plugin version.
|
82 |
-
if ( ! defined( 'WIDGETOPTS_PLUGIN_NAME' ) ) {
|
83 |
-
define( 'WIDGETOPTS_PLUGIN_NAME', 'Widget Options' );
|
84 |
-
}
|
85 |
-
|
86 |
-
// Plugin version.
|
87 |
-
if ( ! defined( 'WIDGETOPTS_VERSION' ) ) {
|
88 |
-
define( 'WIDGETOPTS_VERSION', '
|
89 |
-
}
|
90 |
-
|
91 |
-
// Plugin Folder Path.
|
92 |
-
if ( ! defined( 'WIDGETOPTS_PLUGIN_DIR' ) ) {
|
93 |
-
define( 'WIDGETOPTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
94 |
-
}
|
95 |
-
|
96 |
-
// Plugin Folder URL.
|
97 |
-
if ( ! defined( 'WIDGETOPTS_PLUGIN_URL' ) ) {
|
98 |
-
define( 'WIDGETOPTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
99 |
-
}
|
100 |
-
|
101 |
-
// Plugin Root File.
|
102 |
-
if ( ! defined( 'WIDGETOPTS_PLUGIN_FILE' ) ) {
|
103 |
-
define( 'WIDGETOPTS_PLUGIN_FILE', __FILE__ );
|
104 |
-
}
|
105 |
-
|
106 |
-
// Plugin Root File.
|
107 |
-
if (!defined('WIDGETOPTS_PLUGIN_WEBSITE')) {
|
108 |
-
define('WIDGETOPTS_PLUGIN_WEBSITE', 'https://widget-options.com');
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
-
/**
|
113 |
-
* Include required files.
|
114 |
-
*
|
115 |
-
* @access private
|
116 |
-
* @since 4.1
|
117 |
-
* @return void
|
118 |
-
*/
|
119 |
-
private function includes() {
|
120 |
-
global $widget_options, $extended_license, $widgetopts_taxonomies, $widgetopts_pages, $widgetopts_types, $widgetopts_categories, $pagenow;
|
121 |
-
|
122 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
123 |
-
$widget_options = widgetopts_get_settings();
|
124 |
-
|
125 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/extras.php';
|
126 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/scripts.php';
|
127 |
-
|
128 |
-
//call admin only resources
|
129 |
-
if ( is_admin() ) {
|
130 |
-
|
131 |
-
//other global variables to prevent duplicate and faster calls
|
132 |
-
$widgetopts_pages = widgetopts_global_pages();
|
133 |
-
|
134 |
-
//admin settings
|
135 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/globals.php';
|
136 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/welcome.php';
|
137 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
138 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/transient.php';
|
139 |
-
|
140 |
-
if( in_array( $pagenow, array( 'options-general.php' ) ) ){
|
141 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/classic-widgets-screen.php';
|
142 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/visibility.php';
|
143 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/devices.php';
|
144 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/alignment.php';
|
145 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/title.php';
|
146 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/classes.php';
|
147 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/logic.php';
|
148 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/links.php';
|
149 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/fixed.php';
|
150 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/columns.php';
|
151 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/roles.php';
|
152 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/dates.php';
|
153 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/styling.php';
|
154 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/animation.php';
|
155 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/taxonomies.php';
|
156 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/disable_widgets.php';
|
157 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/permission.php';
|
158 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/shortcodes.php';
|
159 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/cache.php';
|
160 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/siteorigin.php';
|
161 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-upsell_pro.php';
|
162 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-opt_in.php';
|
163 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-more_plugins.php';
|
164 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-support_box.php';
|
165 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/search.php';
|
166 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sliding.php';
|
167 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/move.php';
|
168 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/clone.php';
|
169 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/elementor.php';
|
170 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/import-export.php';
|
171 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/widget-area.php';
|
172 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/urls.php';
|
173 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/beaver_builder.php';
|
174 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/acf.php';
|
175 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/state.php';
|
176 |
-
}
|
177 |
-
|
178 |
-
// if( in_array( $pagenow, array( 'widgets.php' ) ) ){
|
179 |
-
//widget callbacks
|
180 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/widgets.php';
|
181 |
-
|
182 |
-
//add visibility tab if activated
|
183 |
-
if( $widget_options['visibility'] == 'activate' ){
|
184 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/visibility.php';
|
185 |
-
}
|
186 |
-
//add devices tab if activated
|
187 |
-
if( $widget_options['devices'] == 'activate' ){
|
188 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/devices.php';
|
189 |
-
}
|
190 |
-
|
191 |
-
//add alignment tab if activated
|
192 |
-
if( $widget_options['alignment'] == 'activate' ){
|
193 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/alignment.php';
|
194 |
-
}
|
195 |
-
|
196 |
-
//add alignment tab if activated
|
197 |
-
if( isset( $widget_options['state'] ) && $widget_options['state'] == 'activate' ){
|
198 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/state.php';
|
199 |
-
}
|
200 |
-
|
201 |
-
//add settings tab if activated
|
202 |
-
if( 'activate' == $widget_options['hide_title'] ||
|
203 |
-
'activate' == $widget_options['classes'] ||
|
204 |
-
'activate' == $widget_options['logic'] ){
|
205 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/settings.php';
|
206 |
-
}
|
207 |
-
|
208 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/upsell.php';
|
209 |
-
|
210 |
-
if( ( isset( $widget_options['import_export'] ) && 'activate' == $widget_options['import_export'] ) ||
|
211 |
-
( isset( $widget_options['widget_area'] ) && 'activate' == $widget_options['widget_area'] )
|
212 |
-
){
|
213 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/import-export.php';
|
214 |
-
}
|
215 |
-
// }
|
216 |
-
|
217 |
-
//admin notices
|
218 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/notices.php';
|
219 |
-
|
220 |
-
} //end is_admin condition
|
221 |
-
|
222 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/extras.php';
|
223 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/display.php';
|
224 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/ajax-functions.php';
|
225 |
-
|
226 |
-
//pagebuilders support
|
227 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/siteorigin.php';
|
228 |
-
if( defined( 'ELEMENTOR_VERSION' ) && isset( $widget_options['elementor'] ) && 'activate' == $widget_options['elementor'] ){
|
229 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/elementor/elementor.php';
|
230 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/elementor/render.php';
|
231 |
-
}
|
232 |
-
if( class_exists( 'FLBuilderLoader' ) && isset( $widget_options['beaver'] ) && 'activate' == $widget_options['beaver'] ){
|
233 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/beaver/beaver.php';
|
234 |
-
}
|
235 |
-
|
236 |
-
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/install.php';
|
237 |
-
}
|
238 |
-
|
239 |
-
}
|
240 |
-
|
241 |
-
endif; // End if class_exists check.
|
242 |
-
|
243 |
-
|
244 |
-
/**
|
245 |
-
* The main function for that returns WP_Widget_Options
|
246 |
-
*
|
247 |
-
* The main function responsible for returning the one true WP_Widget_Options
|
248 |
-
* Instance to functions everywhere.
|
249 |
-
*
|
250 |
-
* Use this function like you would a global variable, except without needing
|
251 |
-
* to declare the global.
|
252 |
-
*
|
253 |
-
* Example: <?php $widgetopts = WP_Widget_Options(); ?>
|
254 |
-
*
|
255 |
-
* @since 3.2
|
256 |
-
* @return object|WP_Widget_Options The one true WP_Widget_Options Instance.
|
257 |
-
*/
|
258 |
-
if( !function_exists( 'WIDGETOPTS' ) ){
|
259 |
-
function WIDGETOPTS() {
|
260 |
-
return WP_Widget_Options::instance();
|
261 |
-
}
|
262 |
-
// Get Plugin Running.
|
263 |
-
if( function_exists( 'is_multisite' ) && is_multisite() ){
|
264 |
-
//loads on plugins_loaded action to avoid issue on multisite
|
265 |
-
add_action( 'plugins_loaded', 'WIDGETOPTS', apply_filters( 'widgetopts_priority', 90 ) );
|
266 |
-
}else{
|
267 |
-
WIDGETOPTS();
|
268 |
-
}
|
269 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Widget Options
|
4 |
+
* Plugin URI: https://widget-options.com/
|
5 |
+
* Description: Additional Widget options for better widget control. Get <strong><a href="http://widget-options.com/" target="_blank" >Extended Widget Options for WordPress</a></strong> for complete widget controls. Thanks!
|
6 |
+
* Version: 3.7.10
|
7 |
+
* Author: Widget Options Team
|
8 |
+
* Author URI: https://widget-options.com/
|
9 |
+
* Text Domain: widget-options
|
10 |
+
* Domain Path: languages
|
11 |
+
*
|
12 |
+
* @category Widgets
|
13 |
+
* @author Widget Options Team
|
14 |
+
*/
|
15 |
+
// Exit if accessed directly.
|
16 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
17 |
+
if ( ! class_exists( 'WP_Widget_Options' ) ) :
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Main WP_Widget_Options Class.
|
21 |
+
*
|
22 |
+
* @since 3.2
|
23 |
+
*/
|
24 |
+
final class WP_Widget_Options {
|
25 |
+
/**
|
26 |
+
* @var WP_Widget_Options The one true WP_Widget_Options
|
27 |
+
* @since 3.2
|
28 |
+
*/
|
29 |
+
private static $instance;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Main WP_Widget_Options Instance.
|
33 |
+
*
|
34 |
+
* Insures that only one instance of WP_Widget_Options exists in memory at any one
|
35 |
+
* time. Also prevents needing to define globals all over the place.
|
36 |
+
*
|
37 |
+
* @since 3.2
|
38 |
+
* @static
|
39 |
+
* @staticvar array $instance
|
40 |
+
* @uses WP_Widget_Options::setup_constants() Setup the constants needed.
|
41 |
+
* @uses WP_Widget_Options::includes() Include the required files.
|
42 |
+
* @uses WP_Widget_Options::load_textdomain() load the language files.
|
43 |
+
* @see WIDGETOPTS()
|
44 |
+
* @return object|WP_Widget_Options The one true WP_Widget_Options
|
45 |
+
*/
|
46 |
+
public static function instance() {
|
47 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WP_Widget_Options ) ) {
|
48 |
+
self::$instance = new WP_Widget_Options;
|
49 |
+
self::$instance->setup_constants();
|
50 |
+
|
51 |
+
// add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
52 |
+
|
53 |
+
self::$instance->includes();
|
54 |
+
// self::$instance->roles = new WIDGETOPTS_Roles();
|
55 |
+
add_filter( 'use_widgets_block_editor', array(self::$instance,'widget_options_use_widgets_block_editor') );
|
56 |
+
}
|
57 |
+
return self::$instance;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* REVERT classic widgets screen
|
62 |
+
*/
|
63 |
+
public function widget_options_use_widgets_block_editor( $use_widgets_block_editor ) {
|
64 |
+
global $widget_options;
|
65 |
+
if(!empty($widget_options['classic_widgets_screen']) && $widget_options['classic_widgets_screen'] == 'activate' ){
|
66 |
+
return false;
|
67 |
+
}else{
|
68 |
+
return true;
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Setup plugin constants.
|
74 |
+
*
|
75 |
+
* @access private
|
76 |
+
* @since 4.1
|
77 |
+
* @return void
|
78 |
+
*/
|
79 |
+
private function setup_constants() {
|
80 |
+
|
81 |
+
// Plugin version.
|
82 |
+
if ( ! defined( 'WIDGETOPTS_PLUGIN_NAME' ) ) {
|
83 |
+
define( 'WIDGETOPTS_PLUGIN_NAME', 'Widget Options' );
|
84 |
+
}
|
85 |
+
|
86 |
+
// Plugin version.
|
87 |
+
if ( ! defined( 'WIDGETOPTS_VERSION' ) ) {
|
88 |
+
define( 'WIDGETOPTS_VERSION', '10' );
|
89 |
+
}
|
90 |
+
|
91 |
+
// Plugin Folder Path.
|
92 |
+
if ( ! defined( 'WIDGETOPTS_PLUGIN_DIR' ) ) {
|
93 |
+
define( 'WIDGETOPTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
94 |
+
}
|
95 |
+
|
96 |
+
// Plugin Folder URL.
|
97 |
+
if ( ! defined( 'WIDGETOPTS_PLUGIN_URL' ) ) {
|
98 |
+
define( 'WIDGETOPTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
99 |
+
}
|
100 |
+
|
101 |
+
// Plugin Root File.
|
102 |
+
if ( ! defined( 'WIDGETOPTS_PLUGIN_FILE' ) ) {
|
103 |
+
define( 'WIDGETOPTS_PLUGIN_FILE', __FILE__ );
|
104 |
+
}
|
105 |
+
|
106 |
+
// Plugin Root File.
|
107 |
+
if (!defined('WIDGETOPTS_PLUGIN_WEBSITE')) {
|
108 |
+
define('WIDGETOPTS_PLUGIN_WEBSITE', 'https://widget-options.com');
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Include required files.
|
114 |
+
*
|
115 |
+
* @access private
|
116 |
+
* @since 4.1
|
117 |
+
* @return void
|
118 |
+
*/
|
119 |
+
private function includes() {
|
120 |
+
global $widget_options, $extended_license, $widgetopts_taxonomies, $widgetopts_pages, $widgetopts_types, $widgetopts_categories, $pagenow;
|
121 |
+
|
122 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/register-settings.php';
|
123 |
+
$widget_options = widgetopts_get_settings();
|
124 |
+
|
125 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/extras.php';
|
126 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/scripts.php';
|
127 |
+
|
128 |
+
//call admin only resources
|
129 |
+
if ( is_admin() ) {
|
130 |
+
|
131 |
+
//other global variables to prevent duplicate and faster calls
|
132 |
+
$widgetopts_pages = widgetopts_global_pages();
|
133 |
+
|
134 |
+
//admin settings
|
135 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/globals.php';
|
136 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/welcome.php';
|
137 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/display-settings.php';
|
138 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/transient.php';
|
139 |
+
|
140 |
+
if( in_array( $pagenow, array( 'options-general.php' ) ) ){
|
141 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/classic-widgets-screen.php';
|
142 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/visibility.php';
|
143 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/devices.php';
|
144 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/alignment.php';
|
145 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/title.php';
|
146 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/classes.php';
|
147 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/logic.php';
|
148 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/links.php';
|
149 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/fixed.php';
|
150 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/columns.php';
|
151 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/roles.php';
|
152 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/dates.php';
|
153 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/styling.php';
|
154 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/animation.php';
|
155 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/taxonomies.php';
|
156 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/disable_widgets.php';
|
157 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/permission.php';
|
158 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/shortcodes.php';
|
159 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/cache.php';
|
160 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/siteorigin.php';
|
161 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-upsell_pro.php';
|
162 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-opt_in.php';
|
163 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-more_plugins.php';
|
164 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sidebar-support_box.php';
|
165 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/search.php';
|
166 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/sliding.php';
|
167 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/move.php';
|
168 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/clone.php';
|
169 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/elementor.php';
|
170 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/import-export.php';
|
171 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/widget-area.php';
|
172 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/urls.php';
|
173 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/beaver_builder.php';
|
174 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/acf.php';
|
175 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/settings/modules/state.php';
|
176 |
+
}
|
177 |
+
|
178 |
+
// if( in_array( $pagenow, array( 'widgets.php' ) ) ){
|
179 |
+
//widget callbacks
|
180 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/widgets.php';
|
181 |
+
|
182 |
+
//add visibility tab if activated
|
183 |
+
if( $widget_options['visibility'] == 'activate' ){
|
184 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/visibility.php';
|
185 |
+
}
|
186 |
+
//add devices tab if activated
|
187 |
+
if( $widget_options['devices'] == 'activate' ){
|
188 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/devices.php';
|
189 |
+
}
|
190 |
+
|
191 |
+
//add alignment tab if activated
|
192 |
+
if( $widget_options['alignment'] == 'activate' ){
|
193 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/alignment.php';
|
194 |
+
}
|
195 |
+
|
196 |
+
//add alignment tab if activated
|
197 |
+
if( isset( $widget_options['state'] ) && $widget_options['state'] == 'activate' ){
|
198 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/state.php';
|
199 |
+
}
|
200 |
+
|
201 |
+
//add settings tab if activated
|
202 |
+
if( 'activate' == $widget_options['hide_title'] ||
|
203 |
+
'activate' == $widget_options['classes'] ||
|
204 |
+
'activate' == $widget_options['logic'] ){
|
205 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/settings.php';
|
206 |
+
}
|
207 |
+
|
208 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/option-tabs/upsell.php';
|
209 |
+
|
210 |
+
if( ( isset( $widget_options['import_export'] ) && 'activate' == $widget_options['import_export'] ) ||
|
211 |
+
( isset( $widget_options['widget_area'] ) && 'activate' == $widget_options['widget_area'] )
|
212 |
+
){
|
213 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/import-export.php';
|
214 |
+
}
|
215 |
+
// }
|
216 |
+
|
217 |
+
//admin notices
|
218 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/admin/notices.php';
|
219 |
+
|
220 |
+
} //end is_admin condition
|
221 |
+
|
222 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/extras.php';
|
223 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/widgets/display.php';
|
224 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/ajax-functions.php';
|
225 |
+
|
226 |
+
//pagebuilders support
|
227 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/siteorigin.php';
|
228 |
+
if( defined( 'ELEMENTOR_VERSION' ) && isset( $widget_options['elementor'] ) && 'activate' == $widget_options['elementor'] ){
|
229 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/elementor/elementor.php';
|
230 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/elementor/render.php';
|
231 |
+
}
|
232 |
+
if( class_exists( 'FLBuilderLoader' ) && isset( $widget_options['beaver'] ) && 'activate' == $widget_options['beaver'] ){
|
233 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/pagebuilders/beaver/beaver.php';
|
234 |
+
}
|
235 |
+
|
236 |
+
require_once WIDGETOPTS_PLUGIN_DIR . 'includes/install.php';
|
237 |
+
}
|
238 |
+
|
239 |
+
}
|
240 |
+
|
241 |
+
endif; // End if class_exists check.
|
242 |
+
|
243 |
+
|
244 |
+
/**
|
245 |
+
* The main function for that returns WP_Widget_Options
|
246 |
+
*
|
247 |
+
* The main function responsible for returning the one true WP_Widget_Options
|
248 |
+
* Instance to functions everywhere.
|
249 |
+
*
|
250 |
+
* Use this function like you would a global variable, except without needing
|
251 |
+
* to declare the global.
|
252 |
+
*
|
253 |
+
* Example: <?php $widgetopts = WP_Widget_Options(); ?>
|
254 |
+
*
|
255 |
+
* @since 3.2
|
256 |
+
* @return object|WP_Widget_Options The one true WP_Widget_Options Instance.
|
257 |
+
*/
|
258 |
+
if( !function_exists( 'WIDGETOPTS' ) ){
|
259 |
+
function WIDGETOPTS() {
|
260 |
+
return WP_Widget_Options::instance();
|
261 |
+
}
|
262 |
+
// Get Plugin Running.
|
263 |
+
if( function_exists( 'is_multisite' ) && is_multisite() ){
|
264 |
+
//loads on plugins_loaded action to avoid issue on multisite
|
265 |
+
add_action( 'plugins_loaded', 'WIDGETOPTS', apply_filters( 'widgetopts_priority', 90 ) );
|
266 |
+
}else{
|
267 |
+
WIDGETOPTS();
|
268 |
+
}
|
269 |
+
}
|
readme.md
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
-
# [WordPress Widget Options](https://widget-options.com/) #
|
2 |
-
|
3 |
-
![Plugin Version](https://img.shields.io/wordpress/plugin/v/widget-options.svg?maxAge=2592000) ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/widget-options.svg?maxAge=2592000) ![Plugin Rating](https://img.shields.io/wordpress/plugin/r/widget-options.svg?maxAge=2592000) ![WordPress Compatibility](https://img.shields.io/wordpress/v/widget-options.svg?maxAge=2592000) [![License](https://img.shields.io/badge/license-GPL--2.0%2B-red.svg)](https://github.com/WidgetOptions/widget-options/blob/master/LICENSE)
|
4 |
-
|
5 |
-
### Welcome to our GitHub Repository
|
6 |
-
|
7 |
-
Widget Options for WordPress provide extensive options for better widget management. This plugin will give you complete freedom on handling each of your widgets.
|
8 |
-
|
9 |
-
More information can be found at [widget-options.com](https://widget-options.com/).
|
10 |
-
|
11 |
-
## Installation ##
|
12 |
-
|
13 |
-
For detailed setup instructions, visit the plugin [Installation](https://wordpress.org/plugins/widget-options/installation/) page.
|
14 |
-
|
15 |
-
## Bugs ##
|
16 |
-
If you find an issue, let us know [here](https://github.com/WidgetOptions/widget-options/issues)!
|
17 |
-
|
18 |
-
## Support ##
|
19 |
-
This is a developer's portal for Widget Options and should _not_ be used for support. Please visit the [support page](https://widget-options.com/contact/) if you need to submit a support request.
|
20 |
-
|
21 |
-
## Contributions ##
|
22 |
-
There are various ways you can contribute:
|
23 |
-
|
24 |
-
1. Raise an [Issue](https://github.com/WidgetOptions/widget-options/issues) on GitHub
|
25 |
-
2. Send us a Pull Request with your bug fixes and/or new features
|
26 |
-
3. Translate Widget Options into different languages
|
27 |
-
4. Provide feedback and suggestions on [enhancements](https://github.com/WidgetOptions/widget-options/issues)
|
1 |
+
# [WordPress Widget Options](https://widget-options.com/) #
|
2 |
+
|
3 |
+
![Plugin Version](https://img.shields.io/wordpress/plugin/v/widget-options.svg?maxAge=2592000) ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/widget-options.svg?maxAge=2592000) ![Plugin Rating](https://img.shields.io/wordpress/plugin/r/widget-options.svg?maxAge=2592000) ![WordPress Compatibility](https://img.shields.io/wordpress/v/widget-options.svg?maxAge=2592000) [![License](https://img.shields.io/badge/license-GPL--2.0%2B-red.svg)](https://github.com/WidgetOptions/widget-options/blob/master/LICENSE)
|
4 |
+
|
5 |
+
### Welcome to our GitHub Repository
|
6 |
+
|
7 |
+
Widget Options for WordPress provide extensive options for better widget management. This plugin will give you complete freedom on handling each of your widgets.
|
8 |
+
|
9 |
+
More information can be found at [widget-options.com](https://widget-options.com/).
|
10 |
+
|
11 |
+
## Installation ##
|
12 |
+
|
13 |
+
For detailed setup instructions, visit the plugin [Installation](https://wordpress.org/plugins/widget-options/installation/) page.
|
14 |
+
|
15 |
+
## Bugs ##
|
16 |
+
If you find an issue, let us know [here](https://github.com/WidgetOptions/widget-options/issues)!
|
17 |
+
|
18 |
+
## Support ##
|
19 |
+
This is a developer's portal for Widget Options and should _not_ be used for support. Please visit the [support page](https://widget-options.com/contact/) if you need to submit a support request.
|
20 |
+
|
21 |
+
## Contributions ##
|
22 |
+
There are various ways you can contribute:
|
23 |
+
|
24 |
+
1. Raise an [Issue](https://github.com/WidgetOptions/widget-options/issues) on GitHub
|
25 |
+
2. Send us a Pull Request with your bug fixes and/or new features
|
26 |
+
3. Translate Widget Options into different languages
|
27 |
+
4. Provide feedback and suggestions on [enhancements](https://github.com/WidgetOptions/widget-options/issues)
|
readme.txt
CHANGED
@@ -1,299 +1,303 @@
|
|
1 |
-
=== Widget Options - Add Context To WordPress Widgets ===
|
2 |
-
Contributors: marketingfire, phpbits, flowdee
|
3 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FMKC2SLPTULP8
|
4 |
-
Tags: widgets, restrict widgets, display widgets, widget logic, hide widgets, hide widget, sidebar, widget content, display widget, widget options, widget option, widget, widget css, CSS, widget classes, widget styling, widget ID, widget custom class, widget visibility, widget ninja, jetpack visibility, siteorigin, siteorigin pagebuilder, pagebuilder by siteorigin
|
5 |
-
Requires at least: 4.0
|
6 |
-
Tested up to: 5.8
|
7 |
-
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.7.
|
9 |
-
License: GPLv2 or later
|
10 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
|
12 |
-
Get Better Control over your WordPress Widgets. Easily show or hide WordPress widgets on specific pages, for specific user roles, taxonomy or devices. Elementor supported.
|
13 |
-
|
14 |
-
== Description ==
|
15 |
-
|
16 |
-
<strong>Control your sidebar widgets more!</strong> Assign different contents on your sidebars, footer and any sidebar widgets.
|
17 |
-
|
18 |
-
With over <strong>1,060,000+ downloads</strong> and an <strong>average rating of 4.9 stars</strong>, there are no doubts that Widget Options is the perfect solution for you to take better control of your widgets.
|
19 |
-
|
20 |
-
<strong>Widget Options</strong> adds elegant and feature-packed tabbed options below each widget to completely manage and control each widgets visibility and appearance.
|
21 |
-
|
22 |
-
Built with seamlessly integration with WordPress, Widget Options is the world's most complete widget management plugin solution yet.
|
23 |
-
|
24 |
-
[youtube https://www.youtube.com/watch?v=GNawoUZ_t18]
|
25 |
-
|
26 |
-
<h4>Show or hide widgets on specific WordPress pages</h4>
|
27 |
-
With Widget Options Plugin, you can easily assign pages visibility and restrict each widgets on different pages, posts, custom post types, categories, tags and custom taxonomies.
|
28 |
-
|
29 |
-
<h4>Show or hide widgets on mobile devices, desktop and/or tablet screen sizes</h4>
|
30 |
-
Display less widgets on your mobile devices for easier website navigation without affecting your desktop and tablet versions. Maximizing this feature you can show different sidebar widget contents for each devices for better user content targeting.
|
31 |
-
|
32 |
-
<h4>Custom WordPress widget alignments</h4>
|
33 |
-
Change your widget alignment to look better on your site. Comes with <strong>center, left, right and justified alignment</strong> options.
|
34 |
-
|
35 |
-
<h4>Custom Widget ID & Classes</h4>
|
36 |
-
Create predefined classes on the plugin's setting page and use them later for each widgets. You can also add custom widget ID and additional classes for styling or javascript purposes.
|
37 |
-
|
38 |
-
<h4>Display Widget Logic</h4>
|
39 |
-
Use <a href="http://codex.wordpress.org/Conditional_Tags">WordPress Conditional tags</a> to manage and restrict your widgets using display widget logic option if you're geeky enough to use PHP conditions and in need of custom restrictions.
|
40 |
-
|
41 |
-
<h4>Hide Widget Title</h4>
|
42 |
-
Easily hide widget title on front-end display while retaining them on the backend dashboard for labelling.
|
43 |
-
|
44 |
-
<h4>Enable / Disable Options</h4>
|
45 |
-
Use only the features you want and disable any other widget options easily using the brand new settings page.
|
46 |
-
|
47 |
-
<h4>Live Widget Search Filter</h4>
|
48 |
-
Increase administrator widget management by enabling live widget search box on your widget dashboard to locate any widgets easier rather than scrolling the page.
|
49 |
-
|
50 |
-
<h4>Easily Move WordPress Widgets without dragging</h4>
|
51 |
-
Increase productivity and widgets management by moving any widgets easily by clicking a link and selecting the sidebar widget area instead of drag and drop! Elegant option specially on smaller screen devices such as mobile.
|
52 |
-
|
53 |
-
<h4>Import & Export Widgets and Widget Area Backup</h4>
|
54 |
-
You can now import and export WordPress widgets easily and create any backup of specific sidebar widget areas. Move widgets to another websites at ease.
|
55 |
-
|
56 |
-
<h4>View your changes live!</h4>
|
57 |
-
This plugin is customizer ready for easier customization. View your changes live before saving it, <strong>not just better control but a time saver plugin!</strong>
|
58 |
-
|
59 |
-
<h3>Pagebuilder by SiteOrigin Plugin Compatible</h3>
|
60 |
-
Extend your SiteOrigin Pagebuilder powered website's widget panels control and management using Widget Options! Restrict devices visibility, change alignments, hide widget panel title, add custom classes and control visibility using display widget logic option! <br /><strong>Pagebuilder by SiteOrigin Plugin + Widget Options = Total Freedom!</strong>
|
61 |
-
|
62 |
-
<h3>Elementor Pagebuilder Ready!</h3>
|
63 |
-
Extend Widget Options visibility restrictions to elementor widgets! You can now have same widget management feature available to your Elementor powered websites.
|
64 |
-
|
65 |
-
<h3>Beaver Builder Plugin Ready!</h3>
|
66 |
-
Now with Beaver Builder plugin integration! You can fully manage each modules on many ways you want it too! Integrated smoothly to upgrade your website building workflow.
|
67 |
-
|
68 |
-
<h3>Advanced Custom Fields (ACF) Support!</h3>
|
69 |
-
Easily show or hide any widgets using your ACF fields and conditions. You can restric widget with the following conditions:
|
70 |
-
|
71 |
-
* Equal To
|
72 |
-
* Not Equal To
|
73 |
-
* Contains
|
74 |
-
* Does Not Contain
|
75 |
-
* Is Empty
|
76 |
-
* Is Not Empty
|
77 |
-
|
78 |
-
ACF integration is also available on Elementor and Beaver Builder integration.
|
79 |
-
|
80 |
-
<blockquote>
|
81 |
-
<p><strong>Upgrade to Extended Widget Options</strong><br />
|
82 |
-
For more widgets management and restriction options, upgrade to <a href="http://widget-options.com/pricing/">Extended Widget Options today!</a></p>
|
83 |
-
</blockquote>
|
84 |
-
|
85 |
-
<h4>Premium Features</h4>
|
86 |
-
|
87 |
-
* Custom WordPress Widget Styling
|
88 |
-
* Widget Animations on scroll and page load
|
89 |
-
* Sticky / Fixed WordPress Widgets
|
90 |
-
* Custom Widget Links
|
91 |
-
* Widget Cache
|
92 |
-
* Custom Widget Columns Display
|
93 |
-
* Restrict Widget Visibility per User Roles
|
94 |
-
* Widget Visibility per Days and Date Range
|
95 |
-
* Extended Taxonomy and Terms Support
|
96 |
-
* Display Sidebars and Widgets using Shortcodes
|
97 |
-
* Disable any WordPress Widgets
|
98 |
-
* Permission Options
|
99 |
-
* Target URLs and Wildcard Restrictions
|
100 |
-
* Option for child page to inherit parent widget visibilities
|
101 |
-
|
102 |
-
Check full <a href="http://widget-options.com/features/">Extended Widget Options features</a>.
|
103 |
-
|
104 |
-
<h4>Add-ons</h4>
|
105 |
-
|
106 |
-
In need of <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">WordPress Sliding Panel</a> for your widgets? Check out <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">Sliding Widget Options</a> add-on and transform any of your widgets to modal pop-up, slide in and/or sliding widget panel; and increase your website's user engagement!
|
107 |
-
|
108 |
-
If you like to contribute, report issue or have suggestions, you can find the development version on <a href="https://github.com/WidgetOptions/widget-options" target="_blank">Github</a>.
|
109 |
-
|
110 |
-
<strong>More information</strong>
|
111 |
-
|
112 |
-
* Follow the developer <a href="https://twitter.com/WidgetOptions" target="_blank">@Twitter</a>
|
113 |
-
* <a href="https://www.facebook.com/WidgetOptions/" target="_blank">Join Facebook Community Group</a>
|
114 |
-
* <a href="https://www.youtube.com/channel/UCgKC5IAqoz4Q7nW0WzueQFw" target="_blank">Youtube Channel</a>
|
115 |
-
|
116 |
-
== Installation ==
|
117 |
-
|
118 |
-
This section describes how to install the plugin and get it working.
|
119 |
-
|
120 |
-
e.g.
|
121 |
-
|
122 |
-
1. Upload the full directory into your wp-content/plugins directory
|
123 |
-
2. Activate the plugin at the plugin administration page
|
124 |
-
3. Go to Settings > Widget Options and add predefined Classes if you need to
|
125 |
-
4. When you drag or open any widgets you'll see the Widget Options below
|
126 |
-
5. I hope you'll love this plugin :)
|
127 |
-
|
128 |
-
== Frequently Asked Questions ==
|
129 |
-
|
130 |
-
= How do I begin working with this plugin? =
|
131 |
-
After Widget Options plugin activation you'll get welcome message with detailed video instructions to get started. Then go to <strong>Settings > Widget Options</strong> to enable/disable the features you want. Then go to <strong>Appearance > Widgets</strong> and start optimising your widgets!
|
132 |
-
|
133 |
-
= How do I add set of predefined custom CSS classes for widgets? =
|
134 |
-
Easy! Simply go to <strong>Settings > Widget Options</strong> and on <em>Classes & ID</em> module click Configure Settings then you can add your predefined CSS classes for your widgets.
|
135 |
-
|
136 |
-
= What widgets are supported? =
|
137 |
-
All of them! Yes, we haven't come across any single non-working widgets yet.
|
138 |
-
|
139 |
-
= How's the speed and loading time compare to other plugins? =
|
140 |
-
Widget Options is a featured pack fully lightweight plugin. Using Query Monitor plugin you'll find that the plugin doesn't load too much queries and doesn't affect your website's loading time. You can check more information how optimized Widget Options is <a href="https://widget-options.com/new-improved-widget-options-wordpress/">here</a>.
|
141 |
-
|
142 |
-
== Screenshots ==
|
143 |
-
|
144 |
-
1. Widgets Visibility Options
|
145 |
-
2. Device Visibility Options
|
146 |
-
3. Widgets Custom Alignment
|
147 |
-
4. Widget CSS ID & Classes
|
148 |
-
5. Display Widget Logic
|
149 |
-
6. Pagebuilder by SiteOrigin Plugin Widget Options
|
150 |
-
7. Widget Importer & Exporter Feature
|
151 |
-
8. Beaver Builder Integration
|
152 |
-
9. Elementor Pagebuilder Integration
|
153 |
-
10. Advanced Custom Fields ( ACF ) Support
|
154 |
-
|
155 |
-
== Changelog ==
|
156 |
-
|
157 |
-
= 3.7.
|
158 |
-
*
|
159 |
-
*
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
*
|
164 |
-
*
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
*
|
170 |
-
* Fixed
|
171 |
-
|
172 |
-
|
173 |
-
*
|
174 |
-
*
|
175 |
-
*
|
176 |
-
|
177 |
-
|
178 |
-
*
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
*
|
183 |
-
|
184 |
-
= 3.7.
|
185 |
-
*
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
*
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
* Fix
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
*
|
201 |
-
|
202 |
-
|
203 |
-
*
|
204 |
-
*
|
205 |
-
|
206 |
-
|
207 |
-
*
|
208 |
-
* Fixes and other improvements
|
209 |
-
|
210 |
-
= 3.
|
211 |
-
* Go to
|
212 |
-
*
|
213 |
-
|
214 |
-
|
215 |
-
*
|
216 |
-
*
|
217 |
-
* Add
|
218 |
-
*
|
219 |
-
|
220 |
-
|
221 |
-
* Add
|
222 |
-
*
|
223 |
-
|
224 |
-
|
225 |
-
*
|
226 |
-
* Add
|
227 |
-
* Add
|
228 |
-
*
|
229 |
-
|
230 |
-
=
|
231 |
-
*
|
232 |
-
*
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
*
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
*
|
245 |
-
|
246 |
-
= 3.2 =
|
247 |
-
*
|
248 |
-
*
|
249 |
-
|
250 |
-
= 3.
|
251 |
-
*
|
252 |
-
*
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
*
|
257 |
-
*
|
258 |
-
|
259 |
-
= 3.0.
|
260 |
-
* Fix reported issue : https://github.com/WidgetOptions/widget-options/issues/
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
*
|
265 |
-
|
266 |
-
|
267 |
-
*
|
268 |
-
|
269 |
-
|
270 |
-
*
|
271 |
-
*
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
*
|
276 |
-
*
|
277 |
-
|
278 |
-
= 1.
|
279 |
-
*
|
280 |
-
*
|
281 |
-
|
282 |
-
= 1.
|
283 |
-
*
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== Widget Options - Add Context To WordPress Widgets ===
|
2 |
+
Contributors: marketingfire, phpbits, flowdee
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FMKC2SLPTULP8
|
4 |
+
Tags: widgets, restrict widgets, display widgets, widget logic, hide widgets, hide widget, sidebar, widget content, display widget, widget options, widget option, widget, widget css, CSS, widget classes, widget styling, widget ID, widget custom class, widget visibility, widget ninja, jetpack visibility, siteorigin, siteorigin pagebuilder, pagebuilder by siteorigin
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 5.8
|
7 |
+
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.7.10
|
9 |
+
License: GPLv2 or later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
Get Better Control over your WordPress Widgets. Easily show or hide WordPress widgets on specific pages, for specific user roles, taxonomy or devices. Elementor supported.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
<strong>Control your sidebar widgets more!</strong> Assign different contents on your sidebars, footer and any sidebar widgets.
|
17 |
+
|
18 |
+
With over <strong>1,060,000+ downloads</strong> and an <strong>average rating of 4.9 stars</strong>, there are no doubts that Widget Options is the perfect solution for you to take better control of your widgets.
|
19 |
+
|
20 |
+
<strong>Widget Options</strong> adds elegant and feature-packed tabbed options below each widget to completely manage and control each widgets visibility and appearance.
|
21 |
+
|
22 |
+
Built with seamlessly integration with WordPress, Widget Options is the world's most complete widget management plugin solution yet.
|
23 |
+
|
24 |
+
[youtube https://www.youtube.com/watch?v=GNawoUZ_t18]
|
25 |
+
|
26 |
+
<h4>Show or hide widgets on specific WordPress pages</h4>
|
27 |
+
With Widget Options Plugin, you can easily assign pages visibility and restrict each widgets on different pages, posts, custom post types, categories, tags and custom taxonomies.
|
28 |
+
|
29 |
+
<h4>Show or hide widgets on mobile devices, desktop and/or tablet screen sizes</h4>
|
30 |
+
Display less widgets on your mobile devices for easier website navigation without affecting your desktop and tablet versions. Maximizing this feature you can show different sidebar widget contents for each devices for better user content targeting.
|
31 |
+
|
32 |
+
<h4>Custom WordPress widget alignments</h4>
|
33 |
+
Change your widget alignment to look better on your site. Comes with <strong>center, left, right and justified alignment</strong> options.
|
34 |
+
|
35 |
+
<h4>Custom Widget ID & Classes</h4>
|
36 |
+
Create predefined classes on the plugin's setting page and use them later for each widgets. You can also add custom widget ID and additional classes for styling or javascript purposes.
|
37 |
+
|
38 |
+
<h4>Display Widget Logic</h4>
|
39 |
+
Use <a href="http://codex.wordpress.org/Conditional_Tags">WordPress Conditional tags</a> to manage and restrict your widgets using display widget logic option if you're geeky enough to use PHP conditions and in need of custom restrictions.
|
40 |
+
|
41 |
+
<h4>Hide Widget Title</h4>
|
42 |
+
Easily hide widget title on front-end display while retaining them on the backend dashboard for labelling.
|
43 |
+
|
44 |
+
<h4>Enable / Disable Options</h4>
|
45 |
+
Use only the features you want and disable any other widget options easily using the brand new settings page.
|
46 |
+
|
47 |
+
<h4>Live Widget Search Filter</h4>
|
48 |
+
Increase administrator widget management by enabling live widget search box on your widget dashboard to locate any widgets easier rather than scrolling the page.
|
49 |
+
|
50 |
+
<h4>Easily Move WordPress Widgets without dragging</h4>
|
51 |
+
Increase productivity and widgets management by moving any widgets easily by clicking a link and selecting the sidebar widget area instead of drag and drop! Elegant option specially on smaller screen devices such as mobile.
|
52 |
+
|
53 |
+
<h4>Import & Export Widgets and Widget Area Backup</h4>
|
54 |
+
You can now import and export WordPress widgets easily and create any backup of specific sidebar widget areas. Move widgets to another websites at ease.
|
55 |
+
|
56 |
+
<h4>View your changes live!</h4>
|
57 |
+
This plugin is customizer ready for easier customization. View your changes live before saving it, <strong>not just better control but a time saver plugin!</strong>
|
58 |
+
|
59 |
+
<h3>Pagebuilder by SiteOrigin Plugin Compatible</h3>
|
60 |
+
Extend your SiteOrigin Pagebuilder powered website's widget panels control and management using Widget Options! Restrict devices visibility, change alignments, hide widget panel title, add custom classes and control visibility using display widget logic option! <br /><strong>Pagebuilder by SiteOrigin Plugin + Widget Options = Total Freedom!</strong>
|
61 |
+
|
62 |
+
<h3>Elementor Pagebuilder Ready!</h3>
|
63 |
+
Extend Widget Options visibility restrictions to elementor widgets! You can now have same widget management feature available to your Elementor powered websites.
|
64 |
+
|
65 |
+
<h3>Beaver Builder Plugin Ready!</h3>
|
66 |
+
Now with Beaver Builder plugin integration! You can fully manage each modules on many ways you want it too! Integrated smoothly to upgrade your website building workflow.
|
67 |
+
|
68 |
+
<h3>Advanced Custom Fields (ACF) Support!</h3>
|
69 |
+
Easily show or hide any widgets using your ACF fields and conditions. You can restric widget with the following conditions:
|
70 |
+
|
71 |
+
* Equal To
|
72 |
+
* Not Equal To
|
73 |
+
* Contains
|
74 |
+
* Does Not Contain
|
75 |
+
* Is Empty
|
76 |
+
* Is Not Empty
|
77 |
+
|
78 |
+
ACF integration is also available on Elementor and Beaver Builder integration.
|
79 |
+
|
80 |
+
<blockquote>
|
81 |
+
<p><strong>Upgrade to Extended Widget Options</strong><br />
|
82 |
+
For more widgets management and restriction options, upgrade to <a href="http://widget-options.com/pricing/">Extended Widget Options today!</a></p>
|
83 |
+
</blockquote>
|
84 |
+
|
85 |
+
<h4>Premium Features</h4>
|
86 |
+
|
87 |
+
* Custom WordPress Widget Styling
|
88 |
+
* Widget Animations on scroll and page load
|
89 |
+
* Sticky / Fixed WordPress Widgets
|
90 |
+
* Custom Widget Links
|
91 |
+
* Widget Cache
|
92 |
+
* Custom Widget Columns Display
|
93 |
+
* Restrict Widget Visibility per User Roles
|
94 |
+
* Widget Visibility per Days and Date Range
|
95 |
+
* Extended Taxonomy and Terms Support
|
96 |
+
* Display Sidebars and Widgets using Shortcodes
|
97 |
+
* Disable any WordPress Widgets
|
98 |
+
* Permission Options
|
99 |
+
* Target URLs and Wildcard Restrictions
|
100 |
+
* Option for child page to inherit parent widget visibilities
|
101 |
+
|
102 |
+
Check full <a href="http://widget-options.com/features/">Extended Widget Options features</a>.
|
103 |
+
|
104 |
+
<h4>Add-ons</h4>
|
105 |
+
|
106 |
+
In need of <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">WordPress Sliding Panel</a> for your widgets? Check out <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">Sliding Widget Options</a> add-on and transform any of your widgets to modal pop-up, slide in and/or sliding widget panel; and increase your website's user engagement!
|
107 |
+
|
108 |
+
If you like to contribute, report issue or have suggestions, you can find the development version on <a href="https://github.com/WidgetOptions/widget-options" target="_blank">Github</a>.
|
109 |
+
|
110 |
+
<strong>More information</strong>
|
111 |
+
|
112 |
+
* Follow the developer <a href="https://twitter.com/WidgetOptions" target="_blank">@Twitter</a>
|
113 |
+
* <a href="https://www.facebook.com/WidgetOptions/" target="_blank">Join Facebook Community Group</a>
|
114 |
+
* <a href="https://www.youtube.com/channel/UCgKC5IAqoz4Q7nW0WzueQFw" target="_blank">Youtube Channel</a>
|
115 |
+
|
116 |
+
== Installation ==
|
117 |
+
|
118 |
+
This section describes how to install the plugin and get it working.
|
119 |
+
|
120 |
+
e.g.
|
121 |
+
|
122 |
+
1. Upload the full directory into your wp-content/plugins directory
|
123 |
+
2. Activate the plugin at the plugin administration page
|
124 |
+
3. Go to Settings > Widget Options and add predefined Classes if you need to
|
125 |
+
4. When you drag or open any widgets you'll see the Widget Options below
|
126 |
+
5. I hope you'll love this plugin :)
|
127 |
+
|
128 |
+
== Frequently Asked Questions ==
|
129 |
+
|
130 |
+
= How do I begin working with this plugin? =
|
131 |
+
After Widget Options plugin activation you'll get welcome message with detailed video instructions to get started. Then go to <strong>Settings > Widget Options</strong> to enable/disable the features you want. Then go to <strong>Appearance > Widgets</strong> and start optimising your widgets!
|
132 |
+
|
133 |
+
= How do I add set of predefined custom CSS classes for widgets? =
|
134 |
+
Easy! Simply go to <strong>Settings > Widget Options</strong> and on <em>Classes & ID</em> module click Configure Settings then you can add your predefined CSS classes for your widgets.
|
135 |
+
|
136 |
+
= What widgets are supported? =
|
137 |
+
All of them! Yes, we haven't come across any single non-working widgets yet.
|
138 |
+
|
139 |
+
= How's the speed and loading time compare to other plugins? =
|
140 |
+
Widget Options is a featured pack fully lightweight plugin. Using Query Monitor plugin you'll find that the plugin doesn't load too much queries and doesn't affect your website's loading time. You can check more information how optimized Widget Options is <a href="https://widget-options.com/new-improved-widget-options-wordpress/">here</a>.
|
141 |
+
|
142 |
+
== Screenshots ==
|
143 |
+
|
144 |
+
1. Widgets Visibility Options
|
145 |
+
2. Device Visibility Options
|
146 |
+
3. Widgets Custom Alignment
|
147 |
+
4. Widget CSS ID & Classes
|
148 |
+
5. Display Widget Logic
|
149 |
+
6. Pagebuilder by SiteOrigin Plugin Widget Options
|
150 |
+
7. Widget Importer & Exporter Feature
|
151 |
+
8. Beaver Builder Integration
|
152 |
+
9. Elementor Pagebuilder Integration
|
153 |
+
10. Advanced Custom Fields ( ACF ) Support
|
154 |
+
|
155 |
+
== Changelog ==
|
156 |
+
|
157 |
+
= 3.7.10 =
|
158 |
+
* Fixed CSS issue with other plugins.
|
159 |
+
* Fixed missing icons on Elementor page builder.
|
160 |
+
|
161 |
+
= 3.7.9 =
|
162 |
+
* Compatible with Latest WordPress.
|
163 |
+
* Added option to revert Classic Widgets Screen.
|
164 |
+
* Fixed admin notices.
|
165 |
+
|
166 |
+
= 3.7.8 =
|
167 |
+
* Compatible with Latest WordPress.
|
168 |
+
* Updated dependency security vulnerability.
|
169 |
+
* Fixed Multisite warning issues.
|
170 |
+
* Fixed custom post type list in display condition.
|
171 |
+
|
172 |
+
= 3.7.7 =
|
173 |
+
* Compatible with Latest WordPress.
|
174 |
+
* Fixed deprecated jQuery functions.
|
175 |
+
* Fixed Logic option issue.
|
176 |
+
* Fixed Mobile restrictions issues.
|
177 |
+
* Update plugin page descriptions.
|
178 |
+
* Updated admin options page details.
|
179 |
+
* Added affiliate URL support via hooks.
|
180 |
+
|
181 |
+
= 3.7.6 =
|
182 |
+
* Fix blank page issue in admin widget page.
|
183 |
+
|
184 |
+
= 3.7.5 =
|
185 |
+
* Compatible with Latest WordPress.
|
186 |
+
* Other improvements.
|
187 |
+
|
188 |
+
= 3.7.4 =
|
189 |
+
* Update readme and plugin info.
|
190 |
+
|
191 |
+
= 3.7.3 =
|
192 |
+
* Fix import and export invalid file error
|
193 |
+
* Fix several instances of widget lock up issue
|
194 |
+
* Other improvements
|
195 |
+
|
196 |
+
= 3.7.2 =
|
197 |
+
* Fix issue with latest ACF version
|
198 |
+
|
199 |
+
= 3.7.1 =
|
200 |
+
* Add fixes for https://wordpress.org/support/topic/php-errors-after-upgrade-to-3-7/
|
201 |
+
|
202 |
+
= 3.7 =
|
203 |
+
* Add <strong>Advanced Custom Fields ( ACF )</strong> support
|
204 |
+
* Integrate ACF conditions on Elementor and Beaver Builder integration too
|
205 |
+
* Add <strong>User Logged-in State</strong> feature to easily restrict widget on loggedin or loggedout users
|
206 |
+
* Add <strong>User Logged-in State</strong> to Elementor integration as well
|
207 |
+
* Show rating notice on widget dashboard and Widget Options settings page only
|
208 |
+
* Fixes and other improvements
|
209 |
+
|
210 |
+
= 3.6 =
|
211 |
+
* Add <strong>Beaver Builder Plugin Integration</strong>. Go to Settings > Widget Options to enable this brand new feature.
|
212 |
+
* Fixes and other improvements
|
213 |
+
|
214 |
+
= 3.5 =
|
215 |
+
* Go to <strong>Settings > Widget Options</strong> to enable the brand new features below. Thanks!
|
216 |
+
* Add <strong>Widget Importer & Exporter Feature</strong>
|
217 |
+
* Add <strong>Specific Widget Area Backup</strong> Downloader
|
218 |
+
* Improve pages list and indent child pages
|
219 |
+
* Option to remove all widgets assigned on widget area
|
220 |
+
* Fix issues with Elementor and OceanWP integration
|
221 |
+
* Add Target URLs and Wildcard Restrictions module upgrade on settings page
|
222 |
+
* Improvements for the upcoming Beaver Builder integration
|
223 |
+
|
224 |
+
= 3.4 =
|
225 |
+
* Add <strong>Move WordPress Widgets</strong> Feature
|
226 |
+
* Add <strong>Elementor Pagebuilder Support</strong> Beta Feature
|
227 |
+
* Add option to disable automatic addition of .widget class
|
228 |
+
* Fixes and support for is_active_sidebar
|
229 |
+
* Update subscription sidebar and add free e-book download
|
230 |
+
* Add module card for <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">WordPress Sliding Panel</a> add-on
|
231 |
+
* Add module card for <a href="https://widget-options.com/features/clone-wordpress-widgets/" target="_blank">Clone WordPress Widgets</a> premium feature
|
232 |
+
* Improvements for better speed on admin widgets dashboard
|
233 |
+
|
234 |
+
= 3.3.2 =
|
235 |
+
* Use better Global pages items to prevent issues with site with lots of pages
|
236 |
+
* Fix Multisite Issue when Network Activated
|
237 |
+
* Add 'widget' class to fix issue with Elegant Themes that using 'et_widget' as base class
|
238 |
+
* Add support for <a href="https://widget-options.com/features/modal-pop-up-and-sliding-widget-options/" target="_blank">Sliding Widgets</a> add-on
|
239 |
+
|
240 |
+
= 3.3.1 =
|
241 |
+
* Fix PHP 7.0 Global variables issue
|
242 |
+
|
243 |
+
= 3.3 =
|
244 |
+
* Add Widget Live Search option on widgets.php admin dashboard
|
245 |
+
|
246 |
+
= 3.2.1 =
|
247 |
+
* Fix Categories not updating when new one added
|
248 |
+
* Re-add review/rating admin notice from version 3.1
|
249 |
+
|
250 |
+
= 3.2 =
|
251 |
+
* Improve Plugin Loading and Performance
|
252 |
+
* Fix issues reported on github
|
253 |
+
|
254 |
+
= 3.1 =
|
255 |
+
* Add Pagebuilder by SiteOrigin Plugin Widgets Compatibility
|
256 |
+
* Fixes for https://github.com/WidgetOptions/widget-options/issues/6
|
257 |
+
* Performance enhancement
|
258 |
+
|
259 |
+
= 3.0.2 =
|
260 |
+
* Fix reported issue : https://github.com/WidgetOptions/widget-options/issues/7
|
261 |
+
* Fix DIVI jQuery UI styling issues
|
262 |
+
|
263 |
+
= 3.0.1 =
|
264 |
+
* Fix reported issue : https://github.com/WidgetOptions/widget-options/issues/4
|
265 |
+
|
266 |
+
= 3.0 =
|
267 |
+
* Improve settings page and add modular options inspired by iThemes Security Plugin
|
268 |
+
* Add user selection for features
|
269 |
+
* Add Hide Widget Title option
|
270 |
+
* Revamp saving options
|
271 |
+
* other minor improvements
|
272 |
+
|
273 |
+
= 2.0 =
|
274 |
+
* Add Widget Display Logic Options
|
275 |
+
* Improve Tab UI for better navigation
|
276 |
+
* other minor improvements
|
277 |
+
|
278 |
+
= 1.3 =
|
279 |
+
* Apply Category Widgets Visibility Selection to associated posts
|
280 |
+
* Update pro tabs with additional features added on Extended Widget Options 2.0
|
281 |
+
|
282 |
+
= 1.2 =
|
283 |
+
* Add Widget CSS ID and Classes tab options. <a href="https://widget-options.com/blog/add-wordpress-widget-css-classes-id/">Learn more about this update</a>
|
284 |
+
* Add Blog Page Visibility for Widgets as per @cfabrice & @fljdave request
|
285 |
+
|
286 |
+
= 1.1.1 =
|
287 |
+
* Reduce Transient to 5 minutes
|
288 |
+
|
289 |
+
= 1.1 =
|
290 |
+
* Set Transient for queries to reduce loading time
|
291 |
+
|
292 |
+
= 1.0 =
|
293 |
+
* Initial Plugin release
|
294 |
+
|
295 |
+
== Upgrade Notice ==
|
296 |
+
|
297 |
+
= 1.0 =
|
298 |
+
|
299 |
+
* Initial Plugin release
|
300 |
+
|
301 |
+
== Contact and Credits ==
|
302 |
+
|
303 |
+
Widget Options for WordPress is maintained and developed by <a href="https://widget-options.com/">Widget Options Team</a>.
|