Version Description
- Fixed CSRF vulnerability. Props for qasuar
Download this release
Release Info
Developer | iworks |
Plugin | Custom Sidebars – Dynamic Widget Area Manager |
Version | 3.0.8.1 |
Comparing to | |
See all releases |
Code changes from version 3.0.8 to 3.0.8.1
- css/cs-cloning.min.css +1 -1
- css/cs-scan.min.css +1 -1
- css/cs-visibility.min.css +1 -1
- css/cs.min.css +1 -1
- customsidebars.php +1 -1
- inc/class-custom-sidebars-editor.php +26 -2
- js/cs-cloning.js +1 -1
- js/cs-cloning.min.js +1 -1
- js/cs-visibility.js +1 -1
- js/cs-visibility.min.js +1 -1
- js/cs.js +3 -2
- js/cs.min.js +2 -2
- lang/custom-sidebars.pot +44 -39
- readme.txt +4 -1
- views/widgets-delete.php +1 -0
- views/widgets-editor.php +1 -0
css/cs-cloning.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
css/cs-scan.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
css/cs-visibility.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
css/cs.min.css
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
customsidebars.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Custom Sidebars
|
4 |
* Plugin URI: https://wordpress.org/plugins/custom-sidebars/
|
5 |
* Description: Allows you to create widgetized areas and custom sidebars. Replace whole sidebars or single widgets for specific posts and pages.
|
6 |
-
* Version: 3.0.8
|
7 |
* Author: WPMU DEV
|
8 |
* Author URI: http://premium.wpmudev.org/
|
9 |
* Textdomain: custom-sidebars
|
3 |
* Plugin Name: Custom Sidebars
|
4 |
* Plugin URI: https://wordpress.org/plugins/custom-sidebars/
|
5 |
* Description: Allows you to create widgetized areas and custom sidebars. Replace whole sidebars or single widgets for specific posts and pages.
|
6 |
+
* Version: 3.0.8.1
|
7 |
* Author: WPMU DEV
|
8 |
* Author URI: http://premium.wpmudev.org/
|
9 |
* Textdomain: custom-sidebars
|
inc/class-custom-sidebars-editor.php
CHANGED
@@ -141,7 +141,7 @@ class CustomSidebarsEditor extends CustomSidebars {
|
|
141 |
// Delete the specified sidebar.
|
142 |
case 'delete':
|
143 |
$req->sidebar = $sb_data;
|
144 |
-
$req = $this->delete_item( $req );
|
145 |
break;
|
146 |
|
147 |
// Get the location data.
|
@@ -186,6 +186,18 @@ class CustomSidebarsEditor extends CustomSidebars {
|
|
186 |
* @return object Updated response object.
|
187 |
*/
|
188 |
private function save_item( $req, $data ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
$sidebars = self::get_custom_sidebars();
|
190 |
$sb_id = $req->id;
|
191 |
$sb_desc = stripslashes( trim( @$_POST['description'] ) );
|
@@ -299,7 +311,19 @@ class CustomSidebarsEditor extends CustomSidebars {
|
|
299 |
* @param object $req Initial response object.
|
300 |
* @return object Updated response object.
|
301 |
*/
|
302 |
-
private function delete_item( $req ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
$sidebars = self::get_custom_sidebars();
|
304 |
$sidebar = self::get_sidebar( $req->id, 'cust' );
|
305 |
|
141 |
// Delete the specified sidebar.
|
142 |
case 'delete':
|
143 |
$req->sidebar = $sb_data;
|
144 |
+
$req = $this->delete_item( $req, $_POST );
|
145 |
break;
|
146 |
|
147 |
// Get the location data.
|
186 |
* @return object Updated response object.
|
187 |
*/
|
188 |
private function save_item( $req, $data ) {
|
189 |
+
/**
|
190 |
+
* check nonce
|
191 |
+
*/
|
192 |
+
if (
|
193 |
+
! isset( $data['_wpnonce'] )
|
194 |
+
|| ! wp_verify_nonce( $data['_wpnonce'], 'custom-sidebars-edit-sidebar' )
|
195 |
+
) {
|
196 |
+
return self::req_err(
|
197 |
+
$req,
|
198 |
+
__( 'You have no permission to do this operation.', 'custom-sidebars' )
|
199 |
+
);
|
200 |
+
}
|
201 |
$sidebars = self::get_custom_sidebars();
|
202 |
$sb_id = $req->id;
|
203 |
$sb_desc = stripslashes( trim( @$_POST['description'] ) );
|
311 |
* @param object $req Initial response object.
|
312 |
* @return object Updated response object.
|
313 |
*/
|
314 |
+
private function delete_item( $req, $data ) {
|
315 |
+
/**
|
316 |
+
* check nonce
|
317 |
+
*/
|
318 |
+
if (
|
319 |
+
! isset( $data['_wpnonce'] )
|
320 |
+
|| ! wp_verify_nonce( $data['_wpnonce'], 'custom-sidebars-delete-sidebar' )
|
321 |
+
) {
|
322 |
+
return self::req_err(
|
323 |
+
$req,
|
324 |
+
__( 'You have no permission to do this operation.', 'custom-sidebars' )
|
325 |
+
);
|
326 |
+
}
|
327 |
$sidebars = self::get_custom_sidebars();
|
328 |
$sidebar = self::get_sidebar( $req->id, 'cust' );
|
329 |
|
js/cs-cloning.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global jQuery:false */
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global jQuery:false */
|
js/cs-cloning.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
js/cs-visibility.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global jQuery:false */
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global jQuery:false */
|
js/cs-visibility.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
js/cs.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global window:false */
|
@@ -936,7 +936,8 @@ window.csSidebars = null;
|
|
936 |
ajax.reset()
|
937 |
.data({
|
938 |
'do': 'delete',
|
939 |
-
'sb': id
|
|
|
940 |
})
|
941 |
.ondone( handle_done )
|
942 |
.load_json();
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
/*global window:false */
|
936 |
ajax.reset()
|
937 |
.data({
|
938 |
'do': 'delete',
|
939 |
+
'sb': id,
|
940 |
+
'_wpnonce': $('#_wp_nonce_cs_delete_sidebar').val()
|
941 |
})
|
942 |
.ondone( handle_done )
|
943 |
.load_json();
|
js/cs.min.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
/*! Custom Sidebars - v3.0.8
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
5 |
-
function trim(a){a=a.replace(/^\s\s*/,"");for(var b=a.length-1;b>=0;b--)if(/\S/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a}function CsSidebar(a,b){var c;this.id=a.split("%").join("\\%"),this.type=b,this.sb=jQuery("#"+this.id),this.widgets="",this.name=trim(this.sb.find(".sidebar-name h2").text()),this.description=trim(this.sb.find(".sidebar-description").text()),c="custom"===b?window.csSidebars.extras.find(".cs-custom-sidebar").clone():window.csSidebars.extras.find(".cs-theme-sidebar").clone(),this.sb.parent().append(c),c.find("label").each(function(){var b=jQuery(this);window.csSidebars.addIdToLabel(b,a)})}CsSidebar.prototype.getID=function(){return this.id.split("\\").join("")},window.csSidebars=null,function(a){window.csSidebars={sidebars:[],sidebar_prefix:"cs-",edit_form:null,delete_form:null,export_form:null,location_form:null,right:null,extras:null,action_handlers:{},init:function(){"undefined"!=typeof csSidebarsData&&csSidebars.initControls().initTopTools().initSidebars().initToolbars().initColumns()},initControls:function(){return csSidebars.right=jQuery("#widgets-right"),csSidebars.extras=jQuery("#cs-widgets-extra"),null===csSidebars.edit_form&&(csSidebars.edit_form=csSidebars.extras.find(".cs-editor").clone(),csSidebars.extras.find(".cs-editor").remove()),null===csSidebars.delete_form&&(csSidebars.delete_form=csSidebars.extras.find(".cs-delete").clone(),csSidebars.extras.find(".cs-delete").remove()),null===csSidebars.export_form&&(csSidebars.export_form=csSidebars.extras.find(".cs-export").clone(),csSidebars.extras.find(".cs-export").remove()),null===csSidebars.location_form&&(csSidebars.location_form=csSidebars.extras.find(".cs-location").clone(),csSidebars.extras.find(".cs-location").remove()),jQuery("#cs-title-options").detach().prependTo(csSidebars.right),csSidebars},initColumns:function(){function a(){var a=jQuery(this),b=a.closest(".sidebars-column-1, .sidebars-column-2"),c=b.data("sort-dir");c="asc"===c?"desc":"asc",csSidebars.sort_sidebars(b,c)}var b=csSidebars.right.find(".sidebars-column-1"),c=csSidebars.right.find(".sidebars-column-2"),d=jQuery('<div class="cs-title"><h2></h2></div>'),e=csSidebars.right.find(".widgets-holder-wrap");c.length||(c=jQuery('<div class="sidebars-column-2"></div>'),c.appendTo(csSidebars.right)),d.find("h2").append('<span class="cs-title-val"></span><i class="cs-icon dashicons dashicons-sort"></i>').css({cursor:"pointer"}),d.clone().prependTo(b).click(a).find(".cs-title-val").text(csSidebarsData.custom_sidebars),d.clone().prependTo(c).click(a).find(".cs-title-val").text(csSidebarsData.theme_sidebars),b=jQuery('<div class="inner"></div>').appendTo(b),c=jQuery('<div class="inner"></div>').appendTo(c),e.each(function(){var a=jQuery(this),d=a.find(".widgets-sortables");csSidebars.isCustomSidebar(d)?a.appendTo(b):a.appendTo(c)})},initSidebars:function(){return csSidebars.right.find(".widgets-sortables").each(function(){var a,b,c=!1,d=jQuery(this),e=d.attr("id");if(!0!==d.data("cs-init"))if(d.data("cs-init",!0),csSidebars.isCustomSidebar(this))b=csSidebars.add(e,"custom");else{b=csSidebars.add(e,"theme");for(a in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(a)&&csSidebarsData.replaceable[a]===e){c=!0;break}csSidebars.setReplaceable(b,c,!1)}}),csSidebars},initTopTools:function(){var a=jQuery(".btn-create-sidebar"),b=jQuery(".btn-export"),c=jQuery(".cs-options"),d=jQuery('<input type="search" class="cs-filter" />'),e={};return a.click(function(){e.id="",e.title=csSidebarsData.title_new,e.button=csSidebarsData.btn_new,e.description="",e.name="",csSidebars.showEditor(e)}),b.click(csSidebars.showExport),d.appendTo(c).attr("placeholder",csSidebarsData.filter).keyup(csSidebars.filter_sidebars).on("search",csSidebars.filter_sidebars),csSidebars},initToolbars:function(){function a(a){var b=jQuery(a.target).closest(".cs-tool"),c=b.data("action"),d=csSidebars.getIdFromEditbar(b),e=csSidebars.find(d);return!csSidebars.handleAction(c,e)}return csSidebars.registerAction("edit",csSidebars.showEditor),csSidebars.registerAction("location",csSidebars.showLocations),csSidebars.registerAction("delete",csSidebars.showRemove),csSidebars.registerAction("replaceable",csSidebars.setReplaceable),csSidebars.right.on("click",".cs-tool",a),csSidebars},handleAction:function(a,b){return"function"==typeof csSidebars.action_handlers[a]&&!!csSidebars.action_handlers[a](b)},registerAction:function(a,b){csSidebars.action_handlers[a]=b},showAjaxError:function(a){var b={};b.message=csSidebarsData.ajax_error,b.details=a,b.parent="#widgets-right",b.insert_after="#cs-title-options",b.id="editor",b.type="err",wpmUi.message(b)},sort_sidebars:function(a,b){var c=a.find(".widgets-holder-wrap"),d=a.find(".cs-title .cs-icon");c.sortElements(function(a,c){var d=jQuery(a).find(".sidebar-name h2").text(),e=jQuery(c).find(".sidebar-name h2").text();return"asc"===b?d>e?1:-1:d<e?1:-1}),a.data("sort-dir",b),"asc"===b?d.removeClass("dashicons-arrow-down dashicons-sort").addClass("dashicons-arrow-up"):d.removeClass("dashicons-arrow-up dashicons-sort").addClass("dashicons-arrow-down")},filter_sidebars:function(a){var b=jQuery("input.cs-filter").val().toLowerCase();csSidebars.right.find(".widgets-holder-wrap").each(function(){var a=jQuery(this);-1!==a.find(".sidebar-name h2").text().toLowerCase().indexOf(b)?a.show():a.hide()}),jQuery(window).trigger("cs-resize")},showEditor:function(b){function c(){i.$().removeClass("csb-has-more"),i.size(782,215)}function d(){i.$().addClass("csb-has-more"),i.size(782,545)}function e(){jQuery(this).prop("checked")?d():c()}function f(a,b,c){return i.loading(!1),!!a&&(b?(a.sidebar&&(a=a.sidebar),a.id&&i.$().find("#csb-id").val(a.id),a.name&&i.$().find("#csb-name").val(a.name),a.description&&i.$().find("#csb-description").val(a.description),a.before_title&&i.$().find("#csb-before-title").val(a.before_title),a.after_title&&i.$().find("#csb-after-title").val(a.after_title),a.before_widget&&i.$().find("#csb-before-widget").val(a.before_widget),a.after_widget&&i.$().find("#csb-after-widget").val(a.after_widget),void(a.button&&i.$().find(".btn-save").text(a.button))):(i.destroy(),csSidebars.showAjaxError(a),!1))}function g(b,c,d){var e,f={};i.loading(!1),i.destroy(),f.message=b.message,f.parent="#widgets-right",f.insert_after="#cs-title-options",f.id="editor",c?"update"===b.action?(e=csSidebars.find(b.data.id),csSidebars.updateSidebar(e,b.data)):"insert"===b.action&&(csSidebars.insertSidebar(b.data),a(".cs-wrap .custom-sidebars-add-new").detach()):f.type="err",wpmUi.message(f)}function h(){var a=i.$().find("form");return i.loading(!0),j.reset().data(a).ondone(g).load_json(),!1}var i=null,j=null;return b instanceof CsSidebar&&(b={id:b.getID(),title:csSidebarsData.title_edit.replace("[Sidebar]",b.name),button:csSidebarsData.btn_edit}),i=wpmUi.popup().modal(!0).title(b.title).onshow(c).content(csSidebars.edit_form),c(),f(b,!0,null),j=wpmUi.ajax(null,"cs-ajax"),b.id&&(i.loading(!0),j.reset().data({do:"get",sb:b.id}).ondone(f).load_json()),i.show(),i.$().find("#csb-name").focus(),i.$().on("keypress","#csb-name",function(b){13===b.keyCode&&0<a(this).val().length&&a("#csb-description").focus()}),i.$().on("keypress","#csb-description",function(a){13===a.keyCode&&i.$(".btn-save").click()}),i.$().on("click","#csb-more",e),i.$().on("click",".btn-save",h),i.$().on("click",".btn-cancel",i.destroy),!0},updateSidebar:function(a,b){return a.sb.find(".sidebar-name h2").text(b.name),a.sb.find(".sidebar-description").html('<p class="description"></p>').find(".description").text(b.description),csSidebars},insertSidebar:function(a){var b=jQuery('<div class="widgets-holder-wrap"></div>'),c=jQuery('<div class="widgets-sortables ui-sortable"></div>'),d=jQuery('<div class="sidebar-name"><div class="sidebar-name-arrow"><br></div><h2></h2></div>'),e=jQuery('<div class="sidebar-description"></div>'),f=csSidebars.right.find(".sidebars-column-1 > .inner:first");return c.attr("id",a.id),d.find("h2").text(a.name),e.html('<p class="description"></p>').find(".description").text(a.description),d.appendTo(c),e.appendTo(c),c.appendTo(b),b.prependTo(f),jQuery("#widgets-right .sidebar-name").unbind("click"),jQuery("#widgets-left .sidebar-name").unbind("click"),jQuery(document.body).unbind("click.widgets-toggle"),jQuery(".widgets-chooser").off("click.widgets-chooser").off("keyup.widgets-chooser"),jQuery("#available-widgets .widget .widget-title").off("click.widgets-chooser"),jQuery(".widgets-chooser-sidebars").empty(),window.wpWidgets.init(),csSidebars.initSidebars(),csSidebars},showExport:function(){function a(a){var b=jQuery(this).closest("form");return h.reset().data(b).load_http(),g.destroy(),a.preventDefault(),!1}function b(a,b,c){var d={};g.loading(!1),b?g.size(900,600).content(a.html):(d.message=a.message,d.parent=g.$().find(".wpmui-wnd-content"),d.insert_after=!1,d.id="export",d.class="wpmui-wnd-err",d.type="err",wpmUi.message(d))}function c(a){var c=jQuery(this).closest("form");return g.loading(!0),h.reset().data(c).ondone(b).load_json("cs-ajax"),a.preventDefault(),!1}function d(){var a=jQuery(this),b=a.prop("checked"),c=g.$().find(".column-widgets, .import-widgets");b?c.show():c.hide()}function e(){g.size(782,480),g.content(csSidebars.export_form)}function f(){var a=g.$().find(".frm-import");g.loading(!0),h.reset().data(a).load_http("_self")}var g=null,h=null;return g=wpmUi.popup().modal(!0).size(782,480).title(csSidebarsData.title_export).content(csSidebars.export_form).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("submit",".frm-export",a),g.$().on("submit",".frm-preview-import",c),g.$().on("change","#import-widgets",d),g.$().on("click",".btn-cancel",e),g.$().on("click",".btn-import",f),!0},showRemove:function(a){function b(a){a.find(".name").text(i)}function c(){f.loading(!1),f.destroy()}function d(a,b,c){var d={};f.loading(!1),f.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b?(csSidebars.right.find("#"+h).closest(".widgets-holder-wrap").remove(),csSidebars.remove(h),"delete"===a.action&&window.csSidebars.showGetStartedBox()):d.type="err",wpmUi.message(d)}function e(){f.loading(!0),g.reset().data({do:"delete",sb:h}).ondone(d).load_json()}var f=null,g=null,h=a.getID(),i=a.name;return f=wpmUi.popup().modal(!0).size(560,160).title(csSidebarsData.title_delete).content(csSidebars.delete_form).onshow(b).show(),g=wpmUi.ajax(null,"cs-ajax"),f.$().on("click",".btn-cancel",c),f.$().on("click",".btn-delete",e),!0},showLocations:function(a){function b(a,b,c){function d(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function e(a,b,c,d){var e=d.closest(".cs-replaceable").filter("."+b),f=e.find('option[value="'+c+'"]'),g=e.find("optgroup.used"),h=e.find(".detail-toggle");a===j?(f.prop("selected",!0),!0!==h.prop("checked")&&(h.prop("checked",!0),e.addClass("open"),wpmUi.upgrade_multiselect(e))):(g.length||(g=jQuery('<optgroup class="used">').attr("label",e.data("lbl-used")).appendTo(e.find(".details select"))),f.detach().appendTo(g))}var g,h,i;if(f.loading(!1),!b)return f.destroy(),void csSidebars.showAjaxError(a);f.$().find(".sb-name").text(a.sidebar.name);var j=a.sidebar.id;f.$().find(".message.no-sidebars").hide();var k=0,l=f.$().find(".cs-replaceable");l.hide(),a.replaceable=wpmUi.obj(a.replaceable);for(var m in a.replaceable)a.replaceable.hasOwnProperty(m)&&(l.filter("."+a.replaceable[m]).show(),k++);0===k&&(f.$().find(".wpmui-box, .message, .button-primary").hide(),f.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var n=f.$().find(".cs-datalist.cs-cat"),o=f.$().find(".cs-datalist.cs-arc-cat"),p=a.categories;o.empty(),n.empty();for(var q in p)d(p[q],o,q),d(p[q],n,q);for(var r in p){if(p[r].single)for(g in p[r].single)e(p[r].single[g],g,r,n);if(p[r].archive)for(g in p[r].archive)e(p[r].archive[g],g,r,o)}var s=f.$().find(".cs-datalist.cs-pt"),t=a.posttypes;s.empty();for(var u in t)h=jQuery("<option></option>"),i=t[u].name,h.attr("value",u).text(i),s.append(h);for(var v in t)if(t[v].single)for(g in t[v].single)e(t[v].single[g],g,v,s);var w=f.$().find(".cs-datalist.cs-arc"),x=a.archives;w.empty();for(var y in x)h=jQuery("<option></option>"),i=x[y].name,h.attr("value",y).text(i),w.append(h);for(var z in x)if(x[z].archive)for(g in x[z].archive)e(x[z].archive[g],g,z,w);var A=f.$().find(".cs-datalist.cs-arc-aut"),B=a.authors;A.empty();for(var C in B)h=jQuery("<option></option>"),i=B[C].name,h.attr("value",C).text(i),A.append(h);for(var D in B)if(B[D].archive)for(g in B[D].archive)e(B[D].archive[g],g,D,A)}function c(a){var b=jQuery(this),c=b.closest(".cs-replaceable"),d=c.find("select");b.prop("checked")?(c.addClass("open"),wpmUi.upgrade_multiselect(c),d.trigger("change.select2")):(c.removeClass("open"),d.val([]))}function d(a,b,c){var d={};f.loading(!1),f.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b||(d.type="err"),wpmUi.message(d)}function e(){f.loading(!0),g.reset().data(h).ondone(d).load_json()}var f=null,g=null,h=null,i=a.getID();return f=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),f.loading(!0),h=f.$().find(".frm-location"),h.find(".sb-id").val(i),g=wpmUi.ajax(null,"cs-ajax"),g.reset().data({do:"get-location",sb:i}).ondone(b).load_json(),f.$().on("click",".detail-toggle",c),f.$().on("click",".btn-save",e),f.$().on("click",".btn-cancel",f.destroy),!0},setReplaceable:function(a,b,c){function d(a,b,c){a instanceof Object&&"object"==typeof a.replaceable&&(csSidebarsData.replaceable=wpmUi.obj(a.replaceable),f.find(".widgets-sortables").each(function(){var a=!1,b=jQuery(this),c=b.attr("id"),d=csSidebars.find(c);for(var e in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(e)&&csSidebarsData.replaceable[e]===c){a=!0;break}csSidebars.setReplaceable(d,a,!1)})),f.find(".cs-toolbar .chk-replaceable").prop("disabled",!1),f.find(".cs-toolbar .btn-replaceable").removeClass("wpmui-loading")}var e,f=csSidebars.right.find(".sidebars-column-2 .widgets-holder-wrap"),g=jQuery(a.sb).closest(".widgets-holder-wrap"),h=g.find(".cs-toolbar .chk-replaceable"),i=g.find(".replace-marker");g.find(".cs-toolbar .btn-replaceable");return void 0===b&&(b=h.prop("checked")),void 0===c&&(c=!0),h.data("active")!==b&&(h.data("active",b),h.prop("checked",b),b?(i.length||jQuery("<div></div>").appendTo(g).attr("data-label",csSidebarsData.lbl_replaceable).addClass("replace-marker"),g.addClass("replaceable")):(i.remove(),g.removeClass("replaceable")),c&&(f.find(".cs-toolbar .chk-replaceable").prop("disabled",!0),f.find(".cs-toolbar .btn-replaceable").addClass("wpmui-loading"),e=wpmUi.ajax(null,"cs-ajax"),e.reset().data({do:"replaceable",state:b,sb:a.getID()}).ondone(d).load_json()),!1)},find:function(a){return csSidebars.sidebars[a]},add:function(a,b){return csSidebars.sidebars[a]=new CsSidebar(a,b),csSidebars.sidebars[a]},remove:function(a){delete csSidebars.sidebars[a]},isCustomSidebar:function(a){return jQuery(a).attr("id").substr(0,csSidebars.sidebar_prefix.length)===csSidebars.sidebar_prefix},addIdToLabel:function(a,b){if(!0!==a.data("label-done")){var c=a.attr("for");a.attr("for",c+b),a.find(".has-label").attr("id",c+b),a.data("label-done",!0)}},getIdFromEditbar:function(a){return a.closest(".widgets-holder-wrap").find(".widgets-sortables:first").attr("id")},showGetStartedBox:function(){if(0===a(".sidebars-column-1 .inner .widgets-holder-wrap").length){var b=wp.template("custom-sidebars-new");a(".sidebars-column-1 .inner").before(b()),a(".custom-sidebars-add-new").on("click",function(){a("button.btn-create-sidebar").click()})}}},jQuery(function(a){a("#csfooter").hide(),a("#widgets-right").length>0&&csSidebars.init(),a(".defaultsContainer").hide(),a("#widgets-right .widgets-sortables").on("sort",function(b,c){a("#widgets-right").top;c.position.top=-a("#widgets-right").css("top")})}),jQuery(document).ready(function(a){window.setTimeout(function(){window.csSidebars.showGetStartedBox()},1e3)})}(jQuery),jQuery.fn.sortElements=function(){var a=[].sort;return function(b,c){c=c||function(){return this};var d=this.map(function(){var a=c.call(this),b=a.parentNode,d=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,d),b.removeChild(d)}});return a.call(this,b).each(function(a){d[a].call(c.call(this))})}}();
|
1 |
+
/*! Custom Sidebars - v3.0.8.1
|
2 |
* https://premium.wpmudev.org/project/custom-sidebars-pro/
|
3 |
* Copyright (c) 2017; * Licensed GPLv2+ */
|
4 |
|
5 |
+
function trim(a){a=a.replace(/^\s\s*/,"");for(var b=a.length-1;b>=0;b--)if(/\S/.test(a.charAt(b))){a=a.substring(0,b+1);break}return a}function CsSidebar(a,b){var c;this.id=a.split("%").join("\\%"),this.type=b,this.sb=jQuery("#"+this.id),this.widgets="",this.name=trim(this.sb.find(".sidebar-name h2").text()),this.description=trim(this.sb.find(".sidebar-description").text()),c="custom"===b?window.csSidebars.extras.find(".cs-custom-sidebar").clone():window.csSidebars.extras.find(".cs-theme-sidebar").clone(),this.sb.parent().append(c),c.find("label").each(function(){var b=jQuery(this);window.csSidebars.addIdToLabel(b,a)})}CsSidebar.prototype.getID=function(){return this.id.split("\\").join("")},window.csSidebars=null,function(a){window.csSidebars={sidebars:[],sidebar_prefix:"cs-",edit_form:null,delete_form:null,export_form:null,location_form:null,right:null,extras:null,action_handlers:{},init:function(){"undefined"!=typeof csSidebarsData&&csSidebars.initControls().initTopTools().initSidebars().initToolbars().initColumns()},initControls:function(){return csSidebars.right=jQuery("#widgets-right"),csSidebars.extras=jQuery("#cs-widgets-extra"),null===csSidebars.edit_form&&(csSidebars.edit_form=csSidebars.extras.find(".cs-editor").clone(),csSidebars.extras.find(".cs-editor").remove()),null===csSidebars.delete_form&&(csSidebars.delete_form=csSidebars.extras.find(".cs-delete").clone(),csSidebars.extras.find(".cs-delete").remove()),null===csSidebars.export_form&&(csSidebars.export_form=csSidebars.extras.find(".cs-export").clone(),csSidebars.extras.find(".cs-export").remove()),null===csSidebars.location_form&&(csSidebars.location_form=csSidebars.extras.find(".cs-location").clone(),csSidebars.extras.find(".cs-location").remove()),jQuery("#cs-title-options").detach().prependTo(csSidebars.right),csSidebars},initColumns:function(){function a(){var a=jQuery(this),b=a.closest(".sidebars-column-1, .sidebars-column-2"),c=b.data("sort-dir");c="asc"===c?"desc":"asc",csSidebars.sort_sidebars(b,c)}var b=csSidebars.right.find(".sidebars-column-1"),c=csSidebars.right.find(".sidebars-column-2"),d=jQuery('<div class="cs-title"><h2></h2></div>'),e=csSidebars.right.find(".widgets-holder-wrap");c.length||(c=jQuery('<div class="sidebars-column-2"></div>'),c.appendTo(csSidebars.right)),d.find("h2").append('<span class="cs-title-val"></span><i class="cs-icon dashicons dashicons-sort"></i>').css({cursor:"pointer"}),d.clone().prependTo(b).click(a).find(".cs-title-val").text(csSidebarsData.custom_sidebars),d.clone().prependTo(c).click(a).find(".cs-title-val").text(csSidebarsData.theme_sidebars),b=jQuery('<div class="inner"></div>').appendTo(b),c=jQuery('<div class="inner"></div>').appendTo(c),e.each(function(){var a=jQuery(this),d=a.find(".widgets-sortables");csSidebars.isCustomSidebar(d)?a.appendTo(b):a.appendTo(c)})},initSidebars:function(){return csSidebars.right.find(".widgets-sortables").each(function(){var a,b,c=!1,d=jQuery(this),e=d.attr("id");if(!0!==d.data("cs-init"))if(d.data("cs-init",!0),csSidebars.isCustomSidebar(this))b=csSidebars.add(e,"custom");else{b=csSidebars.add(e,"theme");for(a in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(a)&&csSidebarsData.replaceable[a]===e){c=!0;break}csSidebars.setReplaceable(b,c,!1)}}),csSidebars},initTopTools:function(){var a=jQuery(".btn-create-sidebar"),b=jQuery(".btn-export"),c=jQuery(".cs-options"),d=jQuery('<input type="search" class="cs-filter" />'),e={};return a.click(function(){e.id="",e.title=csSidebarsData.title_new,e.button=csSidebarsData.btn_new,e.description="",e.name="",csSidebars.showEditor(e)}),b.click(csSidebars.showExport),d.appendTo(c).attr("placeholder",csSidebarsData.filter).keyup(csSidebars.filter_sidebars).on("search",csSidebars.filter_sidebars),csSidebars},initToolbars:function(){function a(a){var b=jQuery(a.target).closest(".cs-tool"),c=b.data("action"),d=csSidebars.getIdFromEditbar(b),e=csSidebars.find(d);return!csSidebars.handleAction(c,e)}return csSidebars.registerAction("edit",csSidebars.showEditor),csSidebars.registerAction("location",csSidebars.showLocations),csSidebars.registerAction("delete",csSidebars.showRemove),csSidebars.registerAction("replaceable",csSidebars.setReplaceable),csSidebars.right.on("click",".cs-tool",a),csSidebars},handleAction:function(a,b){return"function"==typeof csSidebars.action_handlers[a]&&!!csSidebars.action_handlers[a](b)},registerAction:function(a,b){csSidebars.action_handlers[a]=b},showAjaxError:function(a){var b={};b.message=csSidebarsData.ajax_error,b.details=a,b.parent="#widgets-right",b.insert_after="#cs-title-options",b.id="editor",b.type="err",wpmUi.message(b)},sort_sidebars:function(a,b){var c=a.find(".widgets-holder-wrap"),d=a.find(".cs-title .cs-icon");c.sortElements(function(a,c){var d=jQuery(a).find(".sidebar-name h2").text(),e=jQuery(c).find(".sidebar-name h2").text();return"asc"===b?d>e?1:-1:d<e?1:-1}),a.data("sort-dir",b),"asc"===b?d.removeClass("dashicons-arrow-down dashicons-sort").addClass("dashicons-arrow-up"):d.removeClass("dashicons-arrow-up dashicons-sort").addClass("dashicons-arrow-down")},filter_sidebars:function(a){var b=jQuery("input.cs-filter").val().toLowerCase();csSidebars.right.find(".widgets-holder-wrap").each(function(){var a=jQuery(this);-1!==a.find(".sidebar-name h2").text().toLowerCase().indexOf(b)?a.show():a.hide()}),jQuery(window).trigger("cs-resize")},showEditor:function(b){function c(){i.$().removeClass("csb-has-more"),i.size(782,215)}function d(){i.$().addClass("csb-has-more"),i.size(782,545)}function e(){jQuery(this).prop("checked")?d():c()}function f(a,b,c){return i.loading(!1),!!a&&(b?(a.sidebar&&(a=a.sidebar),a.id&&i.$().find("#csb-id").val(a.id),a.name&&i.$().find("#csb-name").val(a.name),a.description&&i.$().find("#csb-description").val(a.description),a.before_title&&i.$().find("#csb-before-title").val(a.before_title),a.after_title&&i.$().find("#csb-after-title").val(a.after_title),a.before_widget&&i.$().find("#csb-before-widget").val(a.before_widget),a.after_widget&&i.$().find("#csb-after-widget").val(a.after_widget),void(a.button&&i.$().find(".btn-save").text(a.button))):(i.destroy(),csSidebars.showAjaxError(a),!1))}function g(b,c,d){var e,f={};i.loading(!1),i.destroy(),f.message=b.message,f.parent="#widgets-right",f.insert_after="#cs-title-options",f.id="editor",c?"update"===b.action?(e=csSidebars.find(b.data.id),csSidebars.updateSidebar(e,b.data)):"insert"===b.action&&(csSidebars.insertSidebar(b.data),a(".cs-wrap .custom-sidebars-add-new").detach()):f.type="err",wpmUi.message(f)}function h(){var a=i.$().find("form");return i.loading(!0),j.reset().data(a).ondone(g).load_json(),!1}var i=null,j=null;return b instanceof CsSidebar&&(b={id:b.getID(),title:csSidebarsData.title_edit.replace("[Sidebar]",b.name),button:csSidebarsData.btn_edit}),i=wpmUi.popup().modal(!0).title(b.title).onshow(c).content(csSidebars.edit_form),c(),f(b,!0,null),j=wpmUi.ajax(null,"cs-ajax"),b.id&&(i.loading(!0),j.reset().data({do:"get",sb:b.id}).ondone(f).load_json()),i.show(),i.$().find("#csb-name").focus(),i.$().on("keypress","#csb-name",function(b){13===b.keyCode&&0<a(this).val().length&&a("#csb-description").focus()}),i.$().on("keypress","#csb-description",function(a){13===a.keyCode&&i.$(".btn-save").click()}),i.$().on("click","#csb-more",e),i.$().on("click",".btn-save",h),i.$().on("click",".btn-cancel",i.destroy),!0},updateSidebar:function(a,b){return a.sb.find(".sidebar-name h2").text(b.name),a.sb.find(".sidebar-description").html('<p class="description"></p>').find(".description").text(b.description),csSidebars},insertSidebar:function(a){var b=jQuery('<div class="widgets-holder-wrap"></div>'),c=jQuery('<div class="widgets-sortables ui-sortable"></div>'),d=jQuery('<div class="sidebar-name"><div class="sidebar-name-arrow"><br></div><h2></h2></div>'),e=jQuery('<div class="sidebar-description"></div>'),f=csSidebars.right.find(".sidebars-column-1 > .inner:first");return c.attr("id",a.id),d.find("h2").text(a.name),e.html('<p class="description"></p>').find(".description").text(a.description),d.appendTo(c),e.appendTo(c),c.appendTo(b),b.prependTo(f),jQuery("#widgets-right .sidebar-name").unbind("click"),jQuery("#widgets-left .sidebar-name").unbind("click"),jQuery(document.body).unbind("click.widgets-toggle"),jQuery(".widgets-chooser").off("click.widgets-chooser").off("keyup.widgets-chooser"),jQuery("#available-widgets .widget .widget-title").off("click.widgets-chooser"),jQuery(".widgets-chooser-sidebars").empty(),window.wpWidgets.init(),csSidebars.initSidebars(),csSidebars},showExport:function(){function a(a){var b=jQuery(this).closest("form");return h.reset().data(b).load_http(),g.destroy(),a.preventDefault(),!1}function b(a,b,c){var d={};g.loading(!1),b?g.size(900,600).content(a.html):(d.message=a.message,d.parent=g.$().find(".wpmui-wnd-content"),d.insert_after=!1,d.id="export",d.class="wpmui-wnd-err",d.type="err",wpmUi.message(d))}function c(a){var c=jQuery(this).closest("form");return g.loading(!0),h.reset().data(c).ondone(b).load_json("cs-ajax"),a.preventDefault(),!1}function d(){var a=jQuery(this),b=a.prop("checked"),c=g.$().find(".column-widgets, .import-widgets");b?c.show():c.hide()}function e(){g.size(782,480),g.content(csSidebars.export_form)}function f(){var a=g.$().find(".frm-import");g.loading(!0),h.reset().data(a).load_http("_self")}var g=null,h=null;return g=wpmUi.popup().modal(!0).size(782,480).title(csSidebarsData.title_export).content(csSidebars.export_form).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("submit",".frm-export",a),g.$().on("submit",".frm-preview-import",c),g.$().on("change","#import-widgets",d),g.$().on("click",".btn-cancel",e),g.$().on("click",".btn-import",f),!0},showRemove:function(b){function c(a){a.find(".name").text(j)}function d(){g.loading(!1),g.destroy()}function e(a,b,c){var d={};g.loading(!1),g.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b?(csSidebars.right.find("#"+i).closest(".widgets-holder-wrap").remove(),csSidebars.remove(i),"delete"===a.action&&window.csSidebars.showGetStartedBox()):d.type="err",wpmUi.message(d)}function f(){g.loading(!0),h.reset().data({do:"delete",sb:i,_wpnonce:a("#_wp_nonce_cs_delete_sidebar").val()}).ondone(e).load_json()}var g=null,h=null,i=b.getID(),j=b.name;return g=wpmUi.popup().modal(!0).size(560,160).title(csSidebarsData.title_delete).content(csSidebars.delete_form).onshow(c).show(),h=wpmUi.ajax(null,"cs-ajax"),g.$().on("click",".btn-cancel",d),g.$().on("click",".btn-delete",f),!0},showLocations:function(a){function b(a,b,c){function d(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function e(a,b,c,d){var e=d.closest(".cs-replaceable").filter("."+b),f=e.find('option[value="'+c+'"]'),g=e.find("optgroup.used"),h=e.find(".detail-toggle");a===j?(f.prop("selected",!0),!0!==h.prop("checked")&&(h.prop("checked",!0),e.addClass("open"),wpmUi.upgrade_multiselect(e))):(g.length||(g=jQuery('<optgroup class="used">').attr("label",e.data("lbl-used")).appendTo(e.find(".details select"))),f.detach().appendTo(g))}var g,h,i;if(f.loading(!1),!b)return f.destroy(),void csSidebars.showAjaxError(a);f.$().find(".sb-name").text(a.sidebar.name);var j=a.sidebar.id;f.$().find(".message.no-sidebars").hide();var k=0,l=f.$().find(".cs-replaceable");l.hide(),a.replaceable=wpmUi.obj(a.replaceable);for(var m in a.replaceable)a.replaceable.hasOwnProperty(m)&&(l.filter("."+a.replaceable[m]).show(),k++);0===k&&(f.$().find(".wpmui-box, .message, .button-primary").hide(),f.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var n=f.$().find(".cs-datalist.cs-cat"),o=f.$().find(".cs-datalist.cs-arc-cat"),p=a.categories;o.empty(),n.empty();for(var q in p)d(p[q],o,q),d(p[q],n,q);for(var r in p){if(p[r].single)for(g in p[r].single)e(p[r].single[g],g,r,n);if(p[r].archive)for(g in p[r].archive)e(p[r].archive[g],g,r,o)}var s=f.$().find(".cs-datalist.cs-pt"),t=a.posttypes;s.empty();for(var u in t)h=jQuery("<option></option>"),i=t[u].name,h.attr("value",u).text(i),s.append(h);for(var v in t)if(t[v].single)for(g in t[v].single)e(t[v].single[g],g,v,s);var w=f.$().find(".cs-datalist.cs-arc"),x=a.archives;w.empty();for(var y in x)h=jQuery("<option></option>"),i=x[y].name,h.attr("value",y).text(i),w.append(h);for(var z in x)if(x[z].archive)for(g in x[z].archive)e(x[z].archive[g],g,z,w);var A=f.$().find(".cs-datalist.cs-arc-aut"),B=a.authors;A.empty();for(var C in B)h=jQuery("<option></option>"),i=B[C].name,h.attr("value",C).text(i),A.append(h);for(var D in B)if(B[D].archive)for(g in B[D].archive)e(B[D].archive[g],g,D,A)}function c(a){var b=jQuery(this),c=b.closest(".cs-replaceable"),d=c.find("select");b.prop("checked")?(c.addClass("open"),wpmUi.upgrade_multiselect(c),d.trigger("change.select2")):(c.removeClass("open"),d.val([]))}function d(a,b,c){var d={};f.loading(!1),f.destroy(),d.message=a.message,d.parent="#widgets-right",d.insert_after="#cs-title-options",d.id="editor",b||(d.type="err"),wpmUi.message(d)}function e(){f.loading(!0),g.reset().data(h).ondone(d).load_json()}var f=null,g=null,h=null,i=a.getID();return f=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),f.loading(!0),h=f.$().find(".frm-location"),h.find(".sb-id").val(i),g=wpmUi.ajax(null,"cs-ajax"),g.reset().data({do:"get-location",sb:i}).ondone(b).load_json(),f.$().on("click",".detail-toggle",c),f.$().on("click",".btn-save",e),f.$().on("click",".btn-cancel",f.destroy),!0},setReplaceable:function(a,b,c){function d(a,b,c){a instanceof Object&&"object"==typeof a.replaceable&&(csSidebarsData.replaceable=wpmUi.obj(a.replaceable),f.find(".widgets-sortables").each(function(){var a=!1,b=jQuery(this),c=b.attr("id"),d=csSidebars.find(c);for(var e in csSidebarsData.replaceable)if(csSidebarsData.replaceable.hasOwnProperty(e)&&csSidebarsData.replaceable[e]===c){a=!0;break}csSidebars.setReplaceable(d,a,!1)})),f.find(".cs-toolbar .chk-replaceable").prop("disabled",!1),f.find(".cs-toolbar .btn-replaceable").removeClass("wpmui-loading")}var e,f=csSidebars.right.find(".sidebars-column-2 .widgets-holder-wrap"),g=jQuery(a.sb).closest(".widgets-holder-wrap"),h=g.find(".cs-toolbar .chk-replaceable"),i=g.find(".replace-marker");g.find(".cs-toolbar .btn-replaceable");return void 0===b&&(b=h.prop("checked")),void 0===c&&(c=!0),h.data("active")!==b&&(h.data("active",b),h.prop("checked",b),b?(i.length||jQuery("<div></div>").appendTo(g).attr("data-label",csSidebarsData.lbl_replaceable).addClass("replace-marker"),g.addClass("replaceable")):(i.remove(),g.removeClass("replaceable")),c&&(f.find(".cs-toolbar .chk-replaceable").prop("disabled",!0),f.find(".cs-toolbar .btn-replaceable").addClass("wpmui-loading"),e=wpmUi.ajax(null,"cs-ajax"),e.reset().data({do:"replaceable",state:b,sb:a.getID()}).ondone(d).load_json()),!1)},find:function(a){return csSidebars.sidebars[a]},add:function(a,b){return csSidebars.sidebars[a]=new CsSidebar(a,b),csSidebars.sidebars[a]},remove:function(a){delete csSidebars.sidebars[a]},isCustomSidebar:function(a){return jQuery(a).attr("id").substr(0,csSidebars.sidebar_prefix.length)===csSidebars.sidebar_prefix},addIdToLabel:function(a,b){if(!0!==a.data("label-done")){var c=a.attr("for");a.attr("for",c+b),a.find(".has-label").attr("id",c+b),a.data("label-done",!0)}},getIdFromEditbar:function(a){return a.closest(".widgets-holder-wrap").find(".widgets-sortables:first").attr("id")},showGetStartedBox:function(){if(0===a(".sidebars-column-1 .inner .widgets-holder-wrap").length){var b=wp.template("custom-sidebars-new");a(".sidebars-column-1 .inner").before(b()),a(".custom-sidebars-add-new").on("click",function(){a("button.btn-create-sidebar").click()})}}},jQuery(function(a){a("#csfooter").hide(),a("#widgets-right").length>0&&csSidebars.init(),a(".defaultsContainer").hide(),a("#widgets-right .widgets-sortables").on("sort",function(b,c){a("#widgets-right").top;c.position.top=-a("#widgets-right").css("top")})}),jQuery(document).ready(function(a){window.setTimeout(function(){window.csSidebars.showGetStartedBox()},1e3)})}(jQuery),jQuery.fn.sortElements=function(){var a=[].sort;return function(b,c){c=c||function(){return this};var d=this.map(function(){var a=c.call(this),b=a.parentNode,d=b.insertBefore(document.createTextNode(""),a.nextSibling);return function(){if(b===this)throw new Error("You can't sort elements if any one is a descendant of another.");b.insertBefore(this,d),b.removeChild(d)}});return a.call(this,b).each(function(a){d[a].call(c.call(this))})}}();
|
lang/custom-sidebars.pot
CHANGED
@@ -4,7 +4,7 @@ msgid ""
|
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Custom Sidebars Pro PLUGIN_VERSION\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customsidebars\n"
|
7 |
-
"POT-Creation-Date: 2017-06-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -65,81 +65,86 @@ msgstr ""
|
|
65 |
msgid "You do not have permission for this"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: inc/class-custom-sidebars-editor.php:
|
|
|
|
|
|
|
|
|
|
|
69 |
msgid "Sidebar-name cannot be empty"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: inc/class-custom-sidebars-editor.php:
|
73 |
-
#: inc/class-custom-sidebars-editor.php:
|
74 |
msgid "The sidebar does not exist"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: inc/class-custom-sidebars-editor.php:
|
78 |
msgid "Created new sidebar <strong>%1$s</strong>"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: inc/class-custom-sidebars-editor.php:
|
82 |
msgid "Updated sidebar <strong>%1$s</strong>"
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: inc/class-custom-sidebars-editor.php:
|
86 |
-
#: inc/class-custom-sidebars-editor.php:
|
87 |
msgid "The sidebar was not found"
|
88 |
msgstr ""
|
89 |
|
90 |
-
#: inc/class-custom-sidebars-editor.php:
|
91 |
msgid "Deleted sidebar <strong>%1$s</strong>"
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: inc/class-custom-sidebars-editor.php:
|
95 |
msgid "Front Page"
|
96 |
msgstr ""
|
97 |
|
98 |
-
#: inc/class-custom-sidebars-editor.php:
|
99 |
msgid "Search Results"
|
100 |
msgstr ""
|
101 |
|
102 |
-
#: inc/class-custom-sidebars-editor.php:
|
103 |
#: inc/class-custom-sidebars-visibility.php:158
|
104 |
msgid "Not found (404)"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: inc/class-custom-sidebars-editor.php:
|
108 |
msgid "Any Author Archive"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: inc/class-custom-sidebars-editor.php:
|
112 |
msgid "Date Archives"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: inc/class-custom-sidebars-editor.php:
|
116 |
-
#: inc/class-custom-sidebars-editor.php:
|
117 |
-
#: inc/class-custom-sidebars-editor.php:
|
118 |
-
#: inc/class-custom-sidebars-editor.php:
|
119 |
-
#: inc/class-custom-sidebars-editor.php:
|
120 |
-
#: inc/class-custom-sidebars-editor.php:
|
121 |
-
#: inc/class-custom-sidebars-editor.php:
|
122 |
msgid "%s Archives"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: inc/class-custom-sidebars-editor.php:
|
126 |
#: inc/class-custom-sidebars-visibility.php:153
|
127 |
msgid "Post Index"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: inc/class-custom-sidebars-editor.php:
|
131 |
msgid "%1$s Archives"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: inc/class-custom-sidebars-editor.php:
|
135 |
msgid "Updated sidebar <strong>%1$s</strong> settings."
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: inc/class-custom-sidebars-editor.php:
|
139 |
msgid "Sidebars"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: inc/class-custom-sidebars-editor.php:
|
143 |
#: views/import.php:123 views/widgets.php:47
|
144 |
msgid "Custom Sidebars"
|
145 |
msgstr ""
|
@@ -392,11 +397,11 @@ msgstr ""
|
|
392 |
msgid "Also import all widgets of the selected sidebars."
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: views/import.php:137 views/widgets-editor.php:
|
396 |
msgid "Name"
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: views/import.php:138 views/widgets-editor.php:
|
400 |
msgid "Description"
|
401 |
msgstr ""
|
402 |
|
@@ -474,7 +479,7 @@ msgid ""
|
|
474 |
"class=\"name\"></strong>."
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: views/widgets-delete.php:16 views/widgets-editor.php:
|
478 |
#: views/widgets-location.php:189
|
479 |
msgid "Cancel"
|
480 |
msgstr ""
|
@@ -483,43 +488,43 @@ msgstr ""
|
|
483 |
msgid "Yes, delete it"
|
484 |
msgstr ""
|
485 |
|
486 |
-
#: views/widgets-editor.php:
|
487 |
msgid "Sidebar name here..."
|
488 |
msgstr ""
|
489 |
|
490 |
-
#: views/widgets-editor.php:
|
491 |
msgid "The name must be unique."
|
492 |
msgstr ""
|
493 |
|
494 |
-
#: views/widgets-editor.php:
|
495 |
msgid "Sidebar description here..."
|
496 |
msgstr ""
|
497 |
|
498 |
-
#: views/widgets-editor.php:
|
499 |
msgid "Caution:"
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: views/widgets-editor.php:
|
503 |
msgid "Before Title"
|
504 |
msgstr ""
|
505 |
|
506 |
-
#: views/widgets-editor.php:
|
507 |
msgid "After Title"
|
508 |
msgstr ""
|
509 |
|
510 |
-
#: views/widgets-editor.php:
|
511 |
msgid "Before Widget"
|
512 |
msgstr ""
|
513 |
|
514 |
-
#: views/widgets-editor.php:
|
515 |
msgid "After Widget"
|
516 |
msgstr ""
|
517 |
|
518 |
-
#: views/widgets-editor.php:
|
519 |
msgid "Advanced - Edit custom wrapper code"
|
520 |
msgstr ""
|
521 |
|
522 |
-
#: views/widgets-editor.php:
|
523 |
msgid "Create Sidebar"
|
524 |
msgstr ""
|
525 |
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Custom Sidebars Pro PLUGIN_VERSION\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/customsidebars\n"
|
7 |
+
"POT-Creation-Date: 2017-06-29 16:35:36+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
65 |
msgid "You do not have permission for this"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: inc/class-custom-sidebars-editor.php:198
|
69 |
+
#: inc/class-custom-sidebars-editor.php:324
|
70 |
+
msgid "You have no permission to do this operation."
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: inc/class-custom-sidebars-editor.php:214
|
74 |
msgid "Sidebar-name cannot be empty"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: inc/class-custom-sidebars-editor.php:238
|
78 |
+
#: inc/class-custom-sidebars-editor.php:333
|
79 |
msgid "The sidebar does not exist"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: inc/class-custom-sidebars-editor.php:269
|
83 |
msgid "Created new sidebar <strong>%1$s</strong>"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: inc/class-custom-sidebars-editor.php:277
|
87 |
msgid "Updated sidebar <strong>%1$s</strong>"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: inc/class-custom-sidebars-editor.php:288
|
91 |
+
#: inc/class-custom-sidebars-editor.php:353
|
92 |
msgid "The sidebar was not found"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: inc/class-custom-sidebars-editor.php:342
|
96 |
msgid "Deleted sidebar <strong>%1$s</strong>"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: inc/class-custom-sidebars-editor.php:415
|
100 |
msgid "Front Page"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: inc/class-custom-sidebars-editor.php:416
|
104 |
msgid "Search Results"
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: inc/class-custom-sidebars-editor.php:417
|
108 |
#: inc/class-custom-sidebars-visibility.php:158
|
109 |
msgid "Not found (404)"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: inc/class-custom-sidebars-editor.php:418
|
113 |
msgid "Any Author Archive"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: inc/class-custom-sidebars-editor.php:419
|
117 |
msgid "Date Archives"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: inc/class-custom-sidebars-editor.php:437
|
121 |
+
#: inc/class-custom-sidebars-editor.php:440
|
122 |
+
#: inc/class-custom-sidebars-editor.php:446
|
123 |
+
#: inc/class-custom-sidebars-editor.php:448
|
124 |
+
#: inc/class-custom-sidebars-editor.php:532
|
125 |
+
#: inc/class-custom-sidebars-editor.php:534
|
126 |
+
#: inc/class-custom-sidebars-editor.php:553
|
127 |
msgid "%s Archives"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: inc/class-custom-sidebars-editor.php:495
|
131 |
#: inc/class-custom-sidebars-visibility.php:153
|
132 |
msgid "Post Index"
|
133 |
msgstr ""
|
134 |
|
135 |
+
#: inc/class-custom-sidebars-editor.php:499
|
136 |
msgid "%1$s Archives"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: inc/class-custom-sidebars-editor.php:754
|
140 |
msgid "Updated sidebar <strong>%1$s</strong> settings."
|
141 |
msgstr ""
|
142 |
|
143 |
+
#: inc/class-custom-sidebars-editor.php:790 views/widgets.php:17
|
144 |
msgid "Sidebars"
|
145 |
msgstr ""
|
146 |
|
147 |
+
#: inc/class-custom-sidebars-editor.php:1049 views/bulk-edit.php:23
|
148 |
#: views/import.php:123 views/widgets.php:47
|
149 |
msgid "Custom Sidebars"
|
150 |
msgstr ""
|
397 |
msgid "Also import all widgets of the selected sidebars."
|
398 |
msgstr ""
|
399 |
|
400 |
+
#: views/import.php:137 views/widgets-editor.php:16
|
401 |
msgid "Name"
|
402 |
msgstr ""
|
403 |
|
404 |
+
#: views/import.php:138 views/widgets-editor.php:21
|
405 |
msgid "Description"
|
406 |
msgstr ""
|
407 |
|
479 |
"class=\"name\"></strong>."
|
480 |
msgstr ""
|
481 |
|
482 |
+
#: views/widgets-delete.php:16 views/widgets-editor.php:64
|
483 |
#: views/widgets-location.php:189
|
484 |
msgid "Cancel"
|
485 |
msgstr ""
|
488 |
msgid "Yes, delete it"
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: views/widgets-editor.php:17
|
492 |
msgid "Sidebar name here..."
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: views/widgets-editor.php:18
|
496 |
msgid "The name must be unique."
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: views/widgets-editor.php:22
|
500 |
msgid "Sidebar description here..."
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: views/widgets-editor.php:28
|
504 |
msgid "Caution:"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: views/widgets-editor.php:40
|
508 |
msgid "Before Title"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: views/widgets-editor.php:44
|
512 |
msgid "After Title"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: views/widgets-editor.php:50
|
516 |
msgid "Before Widget"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: views/widgets-editor.php:54
|
520 |
msgid "After Widget"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: views/widgets-editor.php:61
|
524 |
msgid "Advanced - Edit custom wrapper code"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: views/widgets-editor.php:65 views/widgets.php:43
|
528 |
msgid "Create Sidebar"
|
529 |
msgstr ""
|
530 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: WPMUDEV, marquex, WPMUDEV-Support2, WPMUDEV-Support1, WPMUDEV-Supp
|
|
3 |
Tags: sidebar, widget, footer, custom, flexible layout, dynamic widgets, manage sidebars, replace widgets, custom widget area
|
4 |
Requires at least: 3.6
|
5 |
Tested up to: 4.8
|
6 |
-
Stable tag: 3.0.8
|
7 |
|
8 |
Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
|
9 |
|
@@ -120,6 +120,9 @@ If you are running a earlier version of WordPress download Custom Sidebars 0.8.2
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
123 |
= 3.0.8 =
|
124 |
* Added bulk sidebars edit.
|
125 |
* Fixed category archive and entry in category replaceable.
|
3 |
Tags: sidebar, widget, footer, custom, flexible layout, dynamic widgets, manage sidebars, replace widgets, custom widget area
|
4 |
Requires at least: 3.6
|
5 |
Tested up to: 4.8
|
6 |
+
Stable tag: 3.0.8.1
|
7 |
|
8 |
Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
|
9 |
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 3.0.8.1 =
|
124 |
+
* Fixed CSRF vulnerability. Props for [qasuar](https://wordpress.org/support/users/qasuar/)
|
125 |
+
|
126 |
= 3.0.8 =
|
127 |
* Added bulk sidebars edit.
|
128 |
* Fixed category archive and entry in category replaceable.
|
views/widgets-delete.php
CHANGED
@@ -15,5 +15,6 @@
|
|
15 |
<div class="buttons">
|
16 |
<button type="button" class="button-link btn-cancel"><?php _e( 'Cancel', 'custom-sidebars' ); ?></button>
|
17 |
<button type="button" class="button-primary btn-delete"><?php _e( 'Yes, delete it', 'custom-sidebars' ); ?></button>
|
|
|
18 |
</div>
|
19 |
</div>
|
15 |
<div class="buttons">
|
16 |
<button type="button" class="button-link btn-cancel"><?php _e( 'Cancel', 'custom-sidebars' ); ?></button>
|
17 |
<button type="button" class="button-primary btn-delete"><?php _e( 'Yes, delete it', 'custom-sidebars' ); ?></button>
|
18 |
+
<?php wp_nonce_field( 'custom-sidebars-delete-sidebar', '_wp_nonce_cs_delete_sidebar' ); ?>
|
19 |
</div>
|
20 |
</div>
|
views/widgets-editor.php
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
<form class="wpmui-form">
|
10 |
<input type="hidden" name="do" value="save" />
|
11 |
<input type="hidden" name="sb" id="csb-id" value="" />
|
|
|
12 |
|
13 |
<div class="wpmui-grid-8 no-pad-top">
|
14 |
<div class="col-3">
|
9 |
<form class="wpmui-form">
|
10 |
<input type="hidden" name="do" value="save" />
|
11 |
<input type="hidden" name="sb" id="csb-id" value="" />
|
12 |
+
<?php wp_nonce_field( 'custom-sidebars-edit-sidebar' ); ?>
|
13 |
|
14 |
<div class="wpmui-grid-8 no-pad-top">
|
15 |
<div class="col-3">
|