Custom Sidebars – Dynamic Widget Area Manager - Version 3.1.5

Version Description

  • Fixed a problem with saving an entry sidebars replacement.
  • Added ability to allow change sidebars by an entry author.
Download this release

Release Info

Developer iworks
Plugin Icon 128x128 Custom Sidebars – Dynamic Widget Area Manager
Version 3.1.5
Comparing to
See all releases

Code changes from version 3.1.4 to 3.1.5

assets/css/cs-cloning.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/css/cs-scan.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/css/cs-visibility.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/css/cs.min.css CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/js/cs-cloning.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global jQuery:false */
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global jQuery:false */
assets/js/cs-cloning.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/js/cs-visibility.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global jQuery:false */
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global jQuery:false */
assets/js/cs-visibility.min.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
 
assets/js/cs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global window:false */
@@ -1605,6 +1605,22 @@ jQuery.fn.sortElements = (function(){
1605
  })();
1606
 
1607
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1608
  /*global console:false */
1609
  /*global document:false */
1610
  /*global ajaxurl:false */
@@ -1615,13 +1631,13 @@ jQuery.fn.sortElements = (function(){
1615
  */
1616
  (function($){
1617
  jQuery(document).ready( function($) {
1618
- $('#screen-options-wrap .cs-roles input[type=checkbox]').on( 'change', function() {
1619
  var data = {
1620
- 'action': 'custom_sidebars_metabox_roles',
1621
- '_wpnonce': $('#custom_sidebars_metabox_roles').val(),
1622
  'fields': {}
1623
  };
1624
- $('#screen-options-wrap .cs-roles input[type=checkbox]').each( function() {
1625
  data.fields[$(this).val()] = this.checked;
1626
  });
1627
  $.post( ajaxurl, data );
@@ -1639,13 +1655,13 @@ jQuery.fn.sortElements = (function(){
1639
  */
1640
  (function($){
1641
  jQuery(document).ready( function($) {
1642
- $('#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]').on( 'change', function() {
1643
  var data = {
1644
- 'action': 'custom_sidebars_metabox_custom_taxonomies',
1645
- '_wpnonce': $('#custom_sidebars_custom_taxonomies').val(),
1646
  'fields': {}
1647
  };
1648
- $('#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]').each( function() {
1649
  data.fields[$(this).val()] = this.checked;
1650
  });
1651
  $.post( ajaxurl, data );
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * Licensed GPLv2+ */
4
  /*global window:false */
1605
  })();
1606
 
1607
 
1608
+ /*global console:false */
1609
+ /*global document:false */
1610
+ /*global ajaxurl:false */
1611
+ (function($){
1612
+ jQuery(document).ready( function($) {
1613
+ $('#screen-options-wrap .cs-allow-author input[type=checkbox]').on( 'change', function() {
1614
+ var data = {
1615
+ 'action': 'custom_sidebars_allow_author',
1616
+ '_wpnonce': $('#custom_sidebars_allow_author').val(),
1617
+ 'value': this.checked
1618
+ };
1619
+ $.post( ajaxurl, data );
1620
+ });
1621
+ });
1622
+ })(jQuery);
1623
+
1624
  /*global console:false */
1625
  /*global document:false */
1626
  /*global ajaxurl:false */
1631
  */
1632
  (function($){
1633
  jQuery(document).ready( function($) {
1634
+ $('#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]').on( 'change', function() {
1635
  var data = {
1636
+ 'action': 'custom_sidebars_metabox_custom_taxonomies',
1637
+ '_wpnonce': $('#custom_sidebars_custom_taxonomies').val(),
1638
  'fields': {}
1639
  };
1640
+ $('#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]').each( function() {
1641
  data.fields[$(this).val()] = this.checked;
1642
  });
1643
  $.post( ajaxurl, data );
1655
  */
1656
  (function($){
1657
  jQuery(document).ready( function($) {
1658
+ $('#screen-options-wrap .cs-roles input[type=checkbox]').on( 'change', function() {
1659
  var data = {
1660
+ 'action': 'custom_sidebars_metabox_roles',
1661
+ '_wpnonce': $('#custom_sidebars_metabox_roles').val(),
1662
  'fields': {}
1663
  };
1664
+ $('#screen-options-wrap .cs-roles input[type=checkbox]').each( function() {
1665
  data.fields[$(this).val()] = this.checked;
1666
  });
1667
  $.post( ajaxurl, data );
assets/js/cs.min.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! Custom Sidebars - v3.1.4
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * 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),a.button&&i.$().find(".btn-save").text(a.button),void(a.advance&&(i.$().find("#csb-more").prop("checked",!0),d()))):(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 0<i.$("#csb-more:checked").length&&jQuery("<input>").attr({type:"hidden",value:"show",name:"advance"}).appendTo(a),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,_wpnonce:csSidebarsData._wpnonce_get}).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(b){function c(b,c,d){function e(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function f(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===k?(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 h,i,j;if(g.loading(!1),!c)return g.destroy(),void csSidebars.showAjaxError(b);g.$().find(".sb-name").text(b.sidebar.name);var k=b.sidebar.id;g.$().find(".message.no-sidebars").hide();var l=0,m=g.$().find(".cs-replaceable");m.hide(),b.replaceable=wpmUi.obj(b.replaceable);for(var n in b.replaceable)b.replaceable.hasOwnProperty(n)&&(m.filter("."+b.replaceable[n]).show(),l++);0===l&&(g.$().find(".wpmui-box, .message, .button-primary").hide(),g.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var o=g.$().find(".cs-datalist.cs-cat"),p=g.$().find(".cs-datalist.cs-arc-cat"),q=b.categories;p.empty(),o.empty();for(var r in q)e(q[r],p,r),e(q[r],o,r);for(var s in q){if(q[s].single)for(h in q[s].single)f(q[s].single[h],h,s,o);if(q[s].archive)for(h in q[s].archive)f(q[s].archive[h],h,s,p)}var t=g.$().find(".cs-datalist.cs-pt"),u=b.posttypes;t.empty();for(var v in u)i=jQuery("<option></option>"),j=u[v].name,i.attr("value",v).text(j),t.append(i);for(var w in u)if(u[w].single)for(h in u[w].single)f(u[w].single[h],h,w,t);var x=g.$().find(".cs-datalist.cs-arc"),y=b.archives;x.empty();for(var z in y)i=jQuery("<option></option>"),j=y[z].name,i.attr("value",z).text(j),x.append(i);for(var A in y)if(y[A].archive)for(h in y[A].archive)f(y[A].archive[h],h,A,x);var B=g.$().find(".cs-datalist.cs-arc-aut"),C=b.authors;B.empty();for(var D in C)i=jQuery("<option></option>"),j=C[D].name,i.attr("value",D).text(j),B.append(i);for(var E in C)if(C[E].archive)for(h in C[E].archive)f(C[E].archive[h],h,E,B);g.$().find(".cs-3rd-part .cs-datalist").each(function(){var c=b[a(this).data("id")];a(this).empty();for(var d in c)i=jQuery("<option></option>"),j=c[d].name,i.attr("value",d).text(j),a(this).append(i);for(var e in c)if(c[e].archive)for(h in c[e].archive)f(c[e].archive[h],h,e,a(this))}),g.$().find(".cf-custom-taxonomies .cs-datalist").each(function(){var c=b[a(this).data("id")];a(this).empty();for(var d in c)i=jQuery("<option></option>"),j=c[d].name,i.attr("value",d).text(j),a(this).append(i);for(var e in c)if(c[e].single)for(h in c[e].single)f(c[e].single[h],h,e,a(this))})}function d(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 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||(d.type="err"),wpmUi.message(d)}function f(){g.loading(!0),h.reset().data(i).ondone(e).load_json()}var g=null,h=null,i=null,j=b.getID();return g=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),g.loading(!0),i=g.$().find(".frm-location"),i.find(".sb-id").val(j),h=wpmUi.ajax(null,"cs-ajax"),h.reset().data({do:"get-location",sb:j}).ondone(c).load_json(),g.$().on("click",".detail-toggle",d),g.$().on("click",".btn-save",f),g.$().on("click",".btn-cancel",g.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))})}}(),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-roles input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_roles",_wpnonce:a("#custom_sidebars_metabox_roles").val(),fields:{}};a("#screen-options-wrap .cs-roles input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_custom_taxonomies",_wpnonce:a("#custom_sidebars_custom_taxonomies").val(),fields:{}};a("#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery);
1
+ /*! Custom Sidebars - v3.1.5-beta.1
2
  * https://premium.wpmudev.org/project/custom-sidebars-pro/
3
  * Copyright (c) 2018; * 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),a.button&&i.$().find(".btn-save").text(a.button),void(a.advance&&(i.$().find("#csb-more").prop("checked",!0),d()))):(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 0<i.$("#csb-more:checked").length&&jQuery("<input>").attr({type:"hidden",value:"show",name:"advance"}).appendTo(a),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,_wpnonce:csSidebarsData._wpnonce_get}).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(b){function c(b,c,d){function e(a,b,c){var d=jQuery("<option></option>");d.attr("value",c).text(a.name),b.append(d)}function f(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===k?(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 h,i,j;if(g.loading(!1),!c)return g.destroy(),void csSidebars.showAjaxError(b);g.$().find(".sb-name").text(b.sidebar.name);var k=b.sidebar.id;g.$().find(".message.no-sidebars").hide();var l=0,m=g.$().find(".cs-replaceable");m.hide(),b.replaceable=wpmUi.obj(b.replaceable);for(var n in b.replaceable)b.replaceable.hasOwnProperty(n)&&(m.filter("."+b.replaceable[n]).show(),l++);0===l&&(g.$().find(".wpmui-box, .message, .button-primary").hide(),g.$().find(".message.no-sidebars").show().parent().addClass("notice notice-error").removeClass("hidden"));var o=g.$().find(".cs-datalist.cs-cat"),p=g.$().find(".cs-datalist.cs-arc-cat"),q=b.categories;p.empty(),o.empty();for(var r in q)e(q[r],p,r),e(q[r],o,r);for(var s in q){if(q[s].single)for(h in q[s].single)f(q[s].single[h],h,s,o);if(q[s].archive)for(h in q[s].archive)f(q[s].archive[h],h,s,p)}var t=g.$().find(".cs-datalist.cs-pt"),u=b.posttypes;t.empty();for(var v in u)i=jQuery("<option></option>"),j=u[v].name,i.attr("value",v).text(j),t.append(i);for(var w in u)if(u[w].single)for(h in u[w].single)f(u[w].single[h],h,w,t);var x=g.$().find(".cs-datalist.cs-arc"),y=b.archives;x.empty();for(var z in y)i=jQuery("<option></option>"),j=y[z].name,i.attr("value",z).text(j),x.append(i);for(var A in y)if(y[A].archive)for(h in y[A].archive)f(y[A].archive[h],h,A,x);var B=g.$().find(".cs-datalist.cs-arc-aut"),C=b.authors;B.empty();for(var D in C)i=jQuery("<option></option>"),j=C[D].name,i.attr("value",D).text(j),B.append(i);for(var E in C)if(C[E].archive)for(h in C[E].archive)f(C[E].archive[h],h,E,B);g.$().find(".cs-3rd-part .cs-datalist").each(function(){var c=b[a(this).data("id")];a(this).empty();for(var d in c)i=jQuery("<option></option>"),j=c[d].name,i.attr("value",d).text(j),a(this).append(i);for(var e in c)if(c[e].archive)for(h in c[e].archive)f(c[e].archive[h],h,e,a(this))}),g.$().find(".cf-custom-taxonomies .cs-datalist").each(function(){var c=b[a(this).data("id")];a(this).empty();for(var d in c)i=jQuery("<option></option>"),j=c[d].name,i.attr("value",d).text(j),a(this).append(i);for(var e in c)if(c[e].single)for(h in c[e].single)f(c[e].single[h],h,e,a(this))})}function d(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 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||(d.type="err"),wpmUi.message(d)}function f(){g.loading(!0),h.reset().data(i).ondone(e).load_json()}var g=null,h=null,i=null,j=b.getID();return g=wpmUi.popup().modal(!0).size(782,560).title(csSidebarsData.title_location).content(csSidebars.location_form).show(),g.loading(!0),i=g.$().find(".frm-location"),i.find(".sb-id").val(j),h=wpmUi.ajax(null,"cs-ajax"),h.reset().data({do:"get-location",sb:j}).ondone(c).load_json(),g.$().on("click",".detail-toggle",d),g.$().on("click",".btn-save",f),g.$().on("click",".btn-cancel",g.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))})}}(),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-allow-author input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_allow_author",_wpnonce:a("#custom_sidebars_allow_author").val(),value:this.checked};a.post(ajaxurl,b)})})}(jQuery),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_custom_taxonomies",_wpnonce:a("#custom_sidebars_custom_taxonomies").val(),fields:{}};a("#screen-options-wrap .cs-custom-taxonomies input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery),function(a){jQuery(document).ready(function(a){a("#screen-options-wrap .cs-roles input[type=checkbox]").on("change",function(){var b={action:"custom_sidebars_metabox_roles",_wpnonce:a("#custom_sidebars_metabox_roles").val(),fields:{}};a("#screen-options-wrap .cs-roles input[type=checkbox]").each(function(){b.fields[a(this).val()]=this.checked}),a.post(ajaxurl,b)})})}(jQuery);
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.1.4
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.1.5
7
  * Author: WPMU DEV
8
  * Author URI: http://premium.wpmudev.org/
9
  * Textdomain: custom-sidebars
inc/class-custom-sidebars-editor.php CHANGED
@@ -9,6 +9,13 @@ class CustomSidebarsEditor extends CustomSidebars {
9
 
10
  private $modifiable = null;
11
 
 
 
 
 
 
 
 
12
  /**
13
  * Metabox roles name
14
  *
@@ -23,6 +30,13 @@ class CustomSidebarsEditor extends CustomSidebars {
23
  */
24
  private $custom_taxonomies_name = 'custom_sidebars_custom_taxonomies';
25
 
 
 
 
 
 
 
 
26
  /**
27
  * Returns the singleton object.
28
  *
@@ -46,23 +60,11 @@ class CustomSidebarsEditor extends CustomSidebars {
46
  return;
47
  }
48
  // Add the sidebar metabox to posts.
49
- add_action(
50
- 'add_meta_boxes',
51
- array( $this, 'add_meta_box' )
52
- );
53
-
54
  // Save the options from the sidebars-metabox.
55
- add_action(
56
- 'save_post',
57
- array( $this, 'store_replacements' )
58
- );
59
-
60
  // Handle ajax requests.
61
- add_action(
62
- 'cs_ajax_request',
63
- array( $this, 'handle_ajax' )
64
- );
65
-
66
  add_action( 'admin_init', array( $this, 'settings' ) );
67
  }
68
 
@@ -78,47 +80,32 @@ class CustomSidebarsEditor extends CustomSidebars {
78
  add_filter( 'screen_settings', array( $this, 'add_capabilities_select_box' ), 10, 2 );
79
  add_action( 'wp_ajax_custom_sidebars_metabox_roles', array( $this, 'update_custom_sidebars_metabox_roles' ) );
80
  add_action( 'wp_ajax_custom_sidebars_metabox_custom_taxonomies', array( $this, 'update_custom_sidebars_metabox_custom_taxonomies' ) );
81
-
82
  /**
83
  * Check user privileges
84
  */
85
  $user_can_save = $this->current_user_can_update_custom_sidebars();
86
-
87
  if ( ! $user_can_save ) {
88
  return;
89
  }
90
  // Add a custom column to post list.
91
  $posttypes = self::get_post_types( 'objects' );
92
  foreach ( $posttypes as $pt ) {
93
- add_filter(
94
- 'manage_' . $pt->name . '_posts_columns',
95
- array( $this, 'post_columns' )
96
- );
97
-
98
- add_action(
99
- 'manage_' . $pt->name . '_posts_custom_column',
100
- array( $this, 'post_column_content' ),
101
- 10, 2
102
  );
103
  }
104
  /** This action is documented in wp-admin/includes/screen.php */
105
  add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 );
106
-
107
  add_action( 'quick_edit_custom_box', array( $this, 'post_quick_edit' ), 10, 2 );
108
  add_action( 'bulk_edit_custom_box', array( $this, 'post_bulk_edit' ), 10, 2 );
109
-
110
- add_action(
111
- 'admin_footer',
112
- array( $this, 'post_quick_edit_js' )
113
- );
114
-
115
  /**
116
  * Bulk Edit save
117
  *
118
  * @since 3.0.8
119
  */
120
  add_action( 'save_post', array( $this, 'bulk_edit_save' ) );
121
-
122
  }
123
 
124
  /**
@@ -132,11 +119,9 @@ class CustomSidebarsEditor extends CustomSidebars {
132
  $handle_it = false;
133
  $view_file = '';
134
  $sb_id = '';
135
-
136
  if ( isset( $_POST['sb'] ) ) {
137
  $sb_id = $_POST['sb'];
138
  }
139
-
140
  switch ( $action ) {
141
  case 'get':
142
  case 'save':
@@ -150,14 +135,11 @@ class CustomSidebarsEditor extends CustomSidebars {
150
  $req->id = $sb_id;
151
  break;
152
  }
153
-
154
  // The ajax request was not meant for us...
155
  if ( ! $handle_it ) {
156
  return false;
157
  }
158
-
159
  $sb_data = self::get_sidebar( $sb_id );
160
-
161
  if ( ! current_user_can( self::$cap_required ) ) {
162
  $req = self::req_err(
163
  $req,
@@ -190,37 +172,31 @@ class CustomSidebarsEditor extends CustomSidebars {
190
  $req->sidebar = $sb_data;
191
  }
192
  break;
193
-
194
  // Save or insert the specified sidebar.
195
  case 'save':
196
  $req = $this->save_item( $req, $_POST );
197
  break;
198
-
199
  // Delete the specified sidebar.
200
  case 'delete':
201
  $req->sidebar = $sb_data;
202
  $req = $this->delete_item( $req, $_POST );
203
  break;
204
-
205
  // Get the location data.
206
  case 'get-location':
207
  $req->sidebar = $sb_data;
208
  $req = $this->get_location_data( $req );
209
  break;
210
-
211
  // Update the location data.
212
  case 'set-location':
213
  $req->sidebar = $sb_data;
214
  $req = $this->set_location_data( $req );
215
  break;
216
-
217
  // Toggle theme sidebar replaceable-flag.
218
  case 'replaceable':
219
  $req = $this->set_replaceable( $req );
220
  break;
221
  }
222
  }
223
-
224
  // Make the ajax response either as JSON or plain text.
225
  if ( $is_json ) {
226
  self::json_response( $req );
@@ -228,7 +204,6 @@ class CustomSidebarsEditor extends CustomSidebars {
228
  ob_start();
229
  include CSB_VIEWS_DIR . $view_file;
230
  $resp = ob_get_clean();
231
-
232
  self::plain_response( $resp );
233
  }
234
  }
@@ -256,30 +231,24 @@ class CustomSidebarsEditor extends CustomSidebars {
256
  __( 'You have no permission to do this operation.', 'custom-sidebars' )
257
  );
258
  }
259
-
260
  $sidebars = self::get_custom_sidebars();
261
  $sb_id = $req->id;
262
-
263
  $sb_desc = '';
264
  if ( isset( $data['description'] ) ) {
265
  $sb_desc = stripslashes( trim( $data['description'] ) );
266
  }
267
-
268
  $sb_name = isset( $data['name'] )? $data['name']:'';
269
-
270
  if ( function_exists( 'mb_substr' ) ) {
271
  $sb_name = mb_substr( stripslashes( trim( $sb_name ) ), 0, 40 );
272
  } else {
273
  $sb_name = substr( stripslashes( trim( $sb_name ) ), 0, 40 );
274
  }
275
-
276
  if ( empty( $sb_name ) ) {
277
  return self::req_err(
278
  $req,
279
  __( 'Sidebar-name cannot be empty', 'custom-sidebars' )
280
  );
281
  }
282
-
283
  if ( empty( $sb_id ) ) {
284
  // Create a new sidebar.
285
  $action = 'insert';
@@ -288,7 +257,6 @@ class CustomSidebarsEditor extends CustomSidebars {
288
  $num += 1;
289
  $sb_id = self::$sidebar_prefix . $num;
290
  } while ( self::get_sidebar( $sb_id, 'cust' ) );
291
-
292
  $sidebar = array(
293
  'id' => $sb_id,
294
  );
@@ -296,7 +264,6 @@ class CustomSidebarsEditor extends CustomSidebars {
296
  // Update existing sidebar
297
  $action = 'update';
298
  $sidebar = self::get_sidebar( $sb_id, 'cust' );
299
-
300
  if ( ! $sidebar ) {
301
  return self::req_err(
302
  $req,
@@ -304,7 +271,6 @@ class CustomSidebarsEditor extends CustomSidebars {
304
  );
305
  }
306
  }
307
-
308
  if ( function_exists( 'mb_strlen' ) ) {
309
  if ( mb_strlen( $sb_desc ) > 200 ) {
310
  $sb_desc = mb_substr( $sb_desc, 0, 200 );
@@ -314,7 +280,6 @@ class CustomSidebarsEditor extends CustomSidebars {
314
  $sb_desc = substr( $sb_desc, 0, 200 );
315
  }
316
  }
317
-
318
  // Populate the sidebar object.
319
  if ( 'insert' == $action || self::wpml_is_default_lang() ) {
320
  $sidebar['name'] = $sb_name;
@@ -323,7 +288,6 @@ class CustomSidebarsEditor extends CustomSidebars {
323
  $sidebar['name_lang'] = $sb_name;
324
  $sidebar['description_lang'] = $sb_desc;
325
  }
326
-
327
  foreach ( array( 'before', 'after' ) as $prefix ) {
328
  foreach ( array( 'widget', 'title' ) as $sufix ) {
329
  $name = sprintf( '%s_%s', $prefix, $sufix );
@@ -333,7 +297,6 @@ class CustomSidebarsEditor extends CustomSidebars {
333
  }
334
  }
335
  }
336
-
337
  if ( 'insert' == $action ) {
338
  $sidebars[] = $sidebar;
339
  $req->message = sprintf(
@@ -360,18 +323,14 @@ class CustomSidebarsEditor extends CustomSidebars {
360
  );
361
  }
362
  }
363
-
364
  // Save the changes.
365
  self::set_custom_sidebars( $sidebars );
366
  self::refresh_sidebar_widgets();
367
-
368
  $req->data = $sidebar;
369
  $req->action = $action;
370
-
371
  // Allow user to translate sidebar name/description via WPML.
372
  self::wpml_update( $sidebars );
373
  $req->data = self::wpml_translate( $sidebar );
374
-
375
  /**
376
  * save user preferences (advance).
377
  *
@@ -386,7 +345,6 @@ class CustomSidebarsEditor extends CustomSidebars {
386
  $advance[ $req->data['id'] ] = isset( $_POST['advance'] ) && 'show' === $_POST['advance'];
387
  update_user_option( $user_id, 'custom-sidebars-editor-advance', $advance );
388
  }
389
-
390
  return $req;
391
  }
392
 
@@ -415,14 +373,12 @@ class CustomSidebarsEditor extends CustomSidebars {
415
  }
416
  $sidebars = self::get_custom_sidebars();
417
  $sidebar = self::get_sidebar( $req->id, 'cust' );
418
-
419
  if ( ! $sidebar ) {
420
  return self::req_err(
421
  $req,
422
  __( 'The sidebar does not exist', 'custom-sidebars' )
423
  );
424
  }
425
-
426
  $found = false;
427
  foreach ( $sidebars as $ind => $item ) {
428
  if ( $item['id'] == $req->id ) {
@@ -435,18 +391,15 @@ class CustomSidebarsEditor extends CustomSidebars {
435
  break;
436
  }
437
  }
438
-
439
  if ( ! $found ) {
440
  return self::req_err(
441
  $req,
442
  __( 'The sidebar was not found', 'custom-sidebars' )
443
  );
444
  }
445
-
446
  // Save the changes.
447
  self::set_custom_sidebars( $sidebars );
448
  self::refresh_sidebar_widgets();
449
-
450
  return $req;
451
  }
452
 
@@ -477,7 +430,6 @@ class CustomSidebarsEditor extends CustomSidebars {
477
  $options['modifiable'] = array_values( $options['modifiable'] );
478
  self::set_options( $options );
479
  $req->replaceable = (object) $options['modifiable'];
480
-
481
  return $req;
482
  }
483
 
@@ -498,7 +450,6 @@ class CustomSidebarsEditor extends CustomSidebars {
498
  '_builtin' => self::get_taxonomies( 'objects', true ),
499
  'custom' => self::get_taxonomies( 'objects', false ),
500
  );
501
-
502
  $archive_type = array(
503
  '_blog' => __( 'Front Page', 'custom-sidebars' ),
504
  '_search' => __( 'Search Results', 'custom-sidebars' ),
@@ -506,7 +457,6 @@ class CustomSidebarsEditor extends CustomSidebars {
506
  '_authors' => __( 'Any Author Archive', 'custom-sidebars' ),
507
  '_date' => __( 'Date Archives', 'custom-sidebars' ),
508
  );
509
-
510
  /**
511
  * taxonomies
512
  *
@@ -529,7 +479,6 @@ class CustomSidebarsEditor extends CustomSidebars {
529
  break;
530
  }
531
  }
532
-
533
  foreach ( $raw_taxonomies['custom'] as $taxonomy ) {
534
  if ( in_array( $taxonomy->labels->singular_name, $default_taxonomies ) ) {
535
  $archive_type[ '_taxonomy_'.$taxonomy->name ] = sprintf( __( '%s Archives', 'custom-sidebars' ), ucfirst( $taxonomy->name ) );
@@ -537,12 +486,10 @@ class CustomSidebarsEditor extends CustomSidebars {
537
  $archive_type[ '_taxonomy_'.$taxonomy->name ] = sprintf( __( '%s Archives', 'custom-sidebars' ), $taxonomy->labels->singular_name );
538
  }
539
  }
540
-
541
  /**
542
  * sort array by values
543
  */
544
  asort( $archive_type );
545
-
546
  $raw_authors = array();
547
  $raw_authors = get_users(
548
  array(
@@ -551,24 +498,20 @@ class CustomSidebarsEditor extends CustomSidebars {
551
  'who' => 'authors',
552
  )
553
  );
554
-
555
  // Collect required data for all posttypes.
556
  $posttypes = array();
557
  foreach ( $raw_posttype as $item ) {
558
  $sel_single = @$defaults['post_type_single'][ $item->name ];
559
-
560
  $posttypes[ $item->name ] = array(
561
  'name' => $item->labels->name,
562
  'single' => self::get_array( $sel_single ),
563
  );
564
  }
565
-
566
  // Extract the data from categories list that we need.
567
  $categories = array();
568
  foreach ( $raw_cat as $item ) {
569
  $sel_single = @$defaults['category_single'][ $item->term_id ];
570
  $sel_archive = @$defaults['category_archive'][ $item->term_id ];
571
-
572
  $categories[ $item->term_id ] = array(
573
  'name' => $item->name,
574
  'count' => $item->count,
@@ -576,7 +519,6 @@ class CustomSidebarsEditor extends CustomSidebars {
576
  'archive' => self::get_array( $sel_archive ),
577
  );
578
  }
579
-
580
  // Build a list of archive types.
581
  $archives = array(); // Start with a copy of the posttype list.
582
  foreach ( $raw_posttype as $item ) {
@@ -589,24 +531,19 @@ class CustomSidebarsEditor extends CustomSidebars {
589
  $item->labels->singular_name
590
  );
591
  }
592
-
593
  $sel_archive = @$defaults['post_type_archive'][ $item->name ];
594
-
595
  $archives[ $item->name ] = array(
596
  'name' => $label,
597
  'archive' => self::get_array( $sel_archive ),
598
  );
599
  }
600
-
601
  foreach ( $archive_type as $key => $name ) {
602
  $sel_archive = @$defaults[ substr( $key, 1 ) ];
603
-
604
  $archives[ $key ] = array(
605
  'name' => $name,
606
  'archive' => self::get_array( $sel_archive ),
607
  );
608
  }
609
-
610
  /**
611
  * Custom taxonomies archive
612
  *
@@ -630,7 +567,6 @@ class CustomSidebarsEditor extends CustomSidebars {
630
  );
631
  }
632
  }
633
-
634
  /**
635
  * Custom taxonomies taxes
636
  *
@@ -681,7 +617,6 @@ class CustomSidebarsEditor extends CustomSidebars {
681
  }
682
  }
683
  }
684
-
685
  // Build a list of authors.
686
  $authors = array();
687
  foreach ( $raw_authors as $user ) {
@@ -692,7 +627,6 @@ class CustomSidebarsEditor extends CustomSidebars {
692
  );
693
  }
694
  $req->authors = $authors;
695
-
696
  $req->replaceable = $defaults['modifiable'];
697
  $req->posttypes = $posttypes;
698
  $req->categories = $categories;
@@ -738,18 +672,15 @@ class CustomSidebarsEditor extends CustomSidebars {
738
  $raw_taxonomies = array(
739
  'custom' => self::get_taxonomies( 'names', false ),
740
  );
741
-
742
  foreach ( $_POST as $key => $value ) {
743
  if ( strlen( $key ) > 8 && '___cs___' == substr( $key, 0, 8 ) ) {
744
  list( $prefix, $id ) = explode( '___', substr( $key, 8 ) );
745
-
746
  if ( ! isset( $data[ $prefix ] ) ) {
747
  $data[ $prefix ] = array();
748
  }
749
  $data[ $prefix ][ $id ] = $value;
750
  }
751
  }
752
-
753
  $special_arc = array(
754
  'blog',
755
  '404',
@@ -758,7 +689,6 @@ class CustomSidebarsEditor extends CustomSidebars {
758
  'search',
759
  'date',
760
  );
761
-
762
  $raw_authors = array();
763
  $raw_authors = get_users(
764
  array(
@@ -783,7 +713,6 @@ class CustomSidebarsEditor extends CustomSidebars {
783
  ) {
784
  unset( $options['post_type_single'][ $pt ][ $sb_id ] );
785
  }
786
-
787
  if (
788
  is_array( @$data['arc'][ $sb_id ] ) &&
789
  in_array( $pt, $data['arc'][ $sb_id ] )
@@ -796,7 +725,6 @@ class CustomSidebarsEditor extends CustomSidebars {
796
  unset( $options['post_type_archive'][ $pt ][ $sb_id ] );
797
  }
798
  }
799
-
800
  // Category settings.
801
  foreach ( $raw_cat as $item ) {
802
  $cat = $item->term_id;
@@ -811,7 +739,6 @@ class CustomSidebarsEditor extends CustomSidebars {
811
  ) {
812
  unset( $options['category_single'][ $cat ][ $sb_id ] );
813
  }
814
-
815
  if (
816
  is_array( @$data['arc-cat'][ $sb_id ] ) &&
817
  in_array( $cat, $data['arc-cat'][ $sb_id ] )
@@ -824,7 +751,6 @@ class CustomSidebarsEditor extends CustomSidebars {
824
  unset( $options['category_archive'][ $cat ][ $sb_id ] );
825
  }
826
  }
827
-
828
  foreach ( $special_arc as $key ) {
829
  if (
830
  is_array( @$data['arc'][ $sb_id ] ) &&
@@ -838,7 +764,6 @@ class CustomSidebarsEditor extends CustomSidebars {
838
  unset( $options[ $key ][ $sb_id ] );
839
  }
840
  }
841
-
842
  // Author settings.
843
  foreach ( $raw_authors as $user ) {
844
  $key = $user->ID;
@@ -854,7 +779,6 @@ class CustomSidebarsEditor extends CustomSidebars {
854
  unset( $options['author_archive'][ $key ][ $sb_id ] );
855
  }
856
  }
857
-
858
  /**
859
  * Custom taxonomies
860
  *
@@ -899,7 +823,6 @@ class CustomSidebarsEditor extends CustomSidebars {
899
  }
900
  }
901
  }
902
-
903
  /**
904
  * category Archive
905
  *
@@ -918,7 +841,6 @@ class CustomSidebarsEditor extends CustomSidebars {
918
  unset( $options['category_archive'][ $sb_id ] );
919
  }
920
  }
921
-
922
  $req->message = sprintf(
923
  __( 'Updated sidebar <strong>%1$s</strong> settings.', 'custom-sidebars' ),
924
  esc_html( $req->sidebar['name'] )
@@ -943,11 +865,20 @@ class CustomSidebarsEditor extends CustomSidebars {
943
  */
944
  public function add_meta_box() {
945
  global $post;
946
-
 
 
 
 
 
 
947
  $post_type = get_post_type( $post );
948
- if ( ! $post_type ) { return false; }
949
- if ( ! self::supported_post_type( $post_type ) ) { return false; }
950
-
 
 
 
951
  /**
952
  * Option that can be set in wp-config.php to remove the custom sidebar
953
  * meta box for certain post types.
@@ -962,12 +893,6 @@ class CustomSidebarsEditor extends CustomSidebars {
962
  ) {
963
  return false;
964
  }
965
-
966
- $show_meta_box = $this->current_user_can_update_custom_sidebars();
967
- if ( ! $show_meta_box ) {
968
- return false;
969
- }
970
-
971
  $pt_obj = get_post_type_object( $post_type );
972
  if ( $pt_obj->publicly_queryable || $pt_obj->public ) {
973
  add_meta_box(
@@ -1003,13 +928,12 @@ class CustomSidebarsEditor extends CustomSidebars {
1003
  */
1004
  protected function print_sidebars_form( $post_id, $type = 'metabox' ) {
1005
  /**
1006
- * Check settings
1007
  */
1008
- $user_can_save = $this->current_user_can_update_custom_sidebars();
1009
- if ( ! $user_can_save ) {
1010
  return;
1011
  }
1012
-
1013
  global $wp_registered_sidebars;
1014
  $available = CustomSidebars::sort_sidebars_by_name( $wp_registered_sidebars );
1015
  $replacements = self::get_replacements( $post_id );
@@ -1024,23 +948,19 @@ class CustomSidebarsEditor extends CustomSidebars {
1024
  }
1025
  }
1026
  }
1027
-
1028
  switch ( $type ) {
1029
  case 'col-sidebars':
1030
  include CSB_VIEWS_DIR . 'col-sidebars.php';
1031
  break;
1032
-
1033
  case 'quick-edit':
1034
  include CSB_VIEWS_DIR . 'quick-edit.php';
1035
  break;
1036
-
1037
  case 'bulk-edit':
1038
  /**
1039
  * @since 3.0.8
1040
  */
1041
  include CSB_VIEWS_DIR . 'bulk-edit.php';
1042
  break;
1043
-
1044
  default:
1045
  include CSB_VIEWS_DIR . 'metabox.php';
1046
  break;
@@ -1049,11 +969,13 @@ class CustomSidebarsEditor extends CustomSidebars {
1049
 
1050
  public function store_replacements( $post_id ) {
1051
  global $action;
1052
-
1053
- if ( ! current_user_can( self::$cap_required ) ) {
 
 
 
1054
  return;
1055
  }
1056
-
1057
  /*
1058
  * Verify if this is an auto save routine. If it is our form has not
1059
  * been submitted, so we dont want to do anything
@@ -1062,7 +984,6 @@ class CustomSidebarsEditor extends CustomSidebars {
1062
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
1063
  return $post_id;
1064
  }
1065
-
1066
  /*
1067
  * 'editpost' .. Saved from full Post-Editor screen.
1068
  * 'inline-save' .. Saved via the quick-edit form.
@@ -1070,20 +991,10 @@ class CustomSidebarsEditor extends CustomSidebars {
1070
  if ( ( isset( $_REQUEST['action'] ) && 'inline-save' != $_REQUEST['action'] ) && 'editpost' != $action ) {
1071
  return $post_id;
1072
  }
1073
-
1074
- /**
1075
- * Check settings
1076
- */
1077
- $user_can_save = $this->current_user_can_update_custom_sidebars();
1078
- if ( ! $user_can_save ) {
1079
- return $post_id;
1080
- }
1081
-
1082
  // Make sure meta is added to the post, not a revision.
1083
  if ( $the_post = wp_is_post_revision( $post_id ) ) {
1084
  $post_id = $the_post;
1085
  }
1086
-
1087
  $sidebars = self::get_options( 'modifiable' );
1088
  $data = array();
1089
  if ( ! empty( $sidebars ) ) {
@@ -1096,12 +1007,10 @@ class CustomSidebarsEditor extends CustomSidebars {
1096
  }
1097
  }
1098
  }
1099
-
1100
  self::set_post_meta( $post_id, $data );
1101
  }
1102
 
1103
  // ========== WPML support.
1104
-
1105
  /**
1106
  * Updates the WPML string register with the current sidebar string so the
1107
  * user can translate the sidebar details using the WPML string translation.
@@ -1111,19 +1020,15 @@ class CustomSidebarsEditor extends CustomSidebars {
1111
  */
1112
  static protected function wpml_update( $custom_sidebars ) {
1113
  if ( ! function_exists( 'icl_register_string' ) ) { return false; }
1114
-
1115
  $theme_sidebars = self::get_sidebars();
1116
-
1117
  // This is used to identify the sidebar-translations by WPML.
1118
  $context = 'Sidebar';
1119
-
1120
  // First do the theme sidebars, so they will be displayed in the
1121
  // *bottom* of the translations list.
1122
  foreach ( $theme_sidebars as $fields ) {
1123
  self::wpml_update_field( $context, $fields['id'] . '-name', @$fields['name'], false );
1124
  self::wpml_update_field( $context, $fields['id'] . '-description', @$fields['description'], false );
1125
  }
1126
-
1127
  foreach ( $custom_sidebars as $fields ) {
1128
  $name = isset( $fields['name_lang'] ) ? $fields['name_lang'] : $fields['name'];
1129
  $description = isset( $fields['description_lang'] ) ? $fields['description_lang'] : $fields['description'];
@@ -1144,34 +1049,26 @@ class CustomSidebarsEditor extends CustomSidebars {
1144
  */
1145
  static protected function wpml_update_field( $context, $field, $value, $update_string = true ) {
1146
  global $sitepress, $sitepress_settings;
1147
-
1148
  if ( empty( $sitepress ) || empty( $sitepress_settings ) ) { return false; }
1149
  if ( ! function_exists( 'icl_t' ) ) { return false; }
1150
-
1151
  if ( ! icl_st_is_registered_string( $context, $field ) ) {
1152
  // Register the field if it does not exist.
1153
  icl_register_string( $context, $field, $value, false );
1154
-
1155
  $active_languages = $sitepress->get_active_languages();
1156
-
1157
  foreach ( $active_languages as $lang => $data ) {
1158
  icl_update_string_translation( $field, $lang, $value, ICL_STRING_TRANSLATION_COMPLETE );
1159
  }
1160
-
1161
  $default_language = ! empty( $sitepress_settings['st']['strings_language'] )
1162
  ? $sitepress_settings['st']['strings_language']
1163
  : $sitepress->get_default_language();
1164
  icl_update_string_translation( $field, $default_language, $value, ICL_STRING_TRANSLATION_COMPLETE );
1165
-
1166
  } else if ( $update_string ) {
1167
-
1168
  // Add translation.
1169
  if ( defined( 'DOING_AJAX' ) ) {
1170
  $current_language = $sitepress->get_language_cookie();
1171
  } else {
1172
  $current_language = $sitepress->get_current_language();
1173
  }
1174
-
1175
  icl_update_string_translation( $field, $current_language, $value, ICL_STRING_TRANSLATION_COMPLETE );
1176
  }
1177
  }
@@ -1186,17 +1083,14 @@ class CustomSidebarsEditor extends CustomSidebars {
1186
  global $sitepress, $sitepress_settings;
1187
  if ( empty( $sitepress ) || empty( $sitepress_settings ) ) { return true; }
1188
  if ( ! function_exists( 'icl_t' ) ) { return true; }
1189
-
1190
  if ( defined( 'DOING_AJAX' ) ) {
1191
  $current_language = $sitepress->get_language_cookie();
1192
  } else {
1193
  $current_language = $sitepress->get_current_language();
1194
  }
1195
-
1196
  $default_language = ! empty( $sitepress_settings['st']['strings_language'] )
1197
  ? $sitepress_settings['st']['strings_language']
1198
  : $sitepress->get_default_language();
1199
-
1200
  return $default_language == $current_language;
1201
  }
1202
 
@@ -1223,7 +1117,6 @@ class CustomSidebarsEditor extends CustomSidebars {
1223
  } else {
1224
  $sidebar['description'] = icl_t( $context, $sidebar['id'] . '-description', $sidebar['description'] );
1225
  }
1226
-
1227
  return $sidebar;
1228
  }
1229
 
@@ -1231,7 +1124,6 @@ class CustomSidebarsEditor extends CustomSidebars {
1231
  // ========== Custom column an Quick-Edit fields for post list.
1232
  // http://shibashake.com/wordpress-theme/expand-the-wordpress-quick-edit-menu
1233
  //
1234
-
1235
  /**
1236
  * Adds a custom column to post-types that support custom sidebars.
1237
  *
@@ -1244,17 +1136,14 @@ class CustomSidebarsEditor extends CustomSidebars {
1244
  $insert = array(
1245
  'cs_replacement' => _x( 'Custom Sidebars', 'Column name on entries list.', 'custom-sidebars' ),
1246
  );
1247
-
1248
  // Column is added after column 'title'.
1249
  $insert_after = 'title';
1250
-
1251
  $pos = array_search( $insert_after, array_keys( $columns ) ) + 1;
1252
  $columns = array_merge(
1253
  array_slice( $columns, 0, $pos ),
1254
  $insert,
1255
  array_slice( $columns, $pos )
1256
  );
1257
-
1258
  return $columns;
1259
  }
1260
 
@@ -1282,7 +1171,6 @@ class CustomSidebarsEditor extends CustomSidebars {
1282
  */
1283
  public function post_quick_edit( $column_name, $post_type ) {
1284
  if ( ! self::supported_post_type( $post_type ) ) { return false; }
1285
-
1286
  switch ( $column_name ) {
1287
  case 'cs_replacement':
1288
  $this->print_metabox_quick();
@@ -1301,46 +1189,35 @@ class CustomSidebarsEditor extends CustomSidebars {
1301
  */
1302
  public function post_quick_edit_js() {
1303
  global $current_screen;
1304
-
1305
  if ( ( $current_screen->base != 'edit' ) ) { return false; }
1306
  if ( ! self::supported_post_type( $current_screen->post_type ) ) { return false; }
1307
-
1308
  ?>
1309
  <script type="text/javascript">
1310
  <!--
1311
  jQuery(function() {
1312
  // we create a copy of the WP inline edit post function
1313
  var wp_inline_edit = inlineEditPost.edit;
1314
-
1315
  // and then we overwrite the function with our own code
1316
  inlineEditPost.edit = function( id ) {
1317
-
1318
  // "call" the original WP edit function
1319
  // we don't want to leave WordPress hanging
1320
  wp_inline_edit.apply( this, arguments );
1321
-
1322
  // now we take care of our business.
1323
-
1324
  // get the post ID
1325
  var post_id = 0;
1326
  if ( typeof( id ) == 'object' ) {
1327
  post_id = parseInt( this.getId( id ) );
1328
  }
1329
-
1330
  if ( post_id > 0 ) {
1331
-
1332
  // define the edit row
1333
  var edit_row = jQuery( '#edit-' + post_id );
1334
  var post_row = jQuery( '#post-' + post_id );
1335
-
1336
  // Our custom column
1337
  var sidebar_col = post_row.find( '.cs_replacement' );
1338
-
1339
  sidebar_col.find( '[data-sidebar]' ).each(function() {
1340
  var key = jQuery( this ).attr( 'data-sidebar' ),
1341
  val = jQuery( this ).attr( 'data-replaced' ),
1342
  hide = 'yes' === jQuery( this ).attr( 'data-cshide' );
1343
-
1344
  if ( hide ) {
1345
  edit_row.find( '.cs-replacement-field.' + key ).val( val ).parent().hide();
1346
  } else {
@@ -1460,6 +1337,20 @@ class CustomSidebarsEditor extends CustomSidebars {
1460
  }
1461
  }
1462
  $screen_settings .= '</fieldset>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1463
  /**
1464
  * Custom taxonomies
1465
  */
@@ -1534,6 +1425,31 @@ class CustomSidebarsEditor extends CustomSidebars {
1534
  wp_send_json_success();
1535
  }
1536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1537
  /**
1538
  * Check ability to save sidebars
1539
  *
@@ -1567,4 +1483,23 @@ class CustomSidebarsEditor extends CustomSidebars {
1567
  }
1568
  return $value;
1569
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1570
  };
9
 
10
  private $modifiable = null;
11
 
12
+ /**
13
+ * Capability required to use *any* of the plugin features. If user does not
14
+ * have this capability then he will not see any change on admin dashboard.
15
+ * @var string
16
+ */
17
+ static protected $cap_required = 'edit_theme_options';
18
+
19
  /**
20
  * Metabox roles name
21
  *
30
  */
31
  private $custom_taxonomies_name = 'custom_sidebars_custom_taxonomies';
32
 
33
+ /**
34
+ * Allow author to change sidebars
35
+ *
36
+ * @since 3.1.5
37
+ */
38
+ private $allow_author_name = 'custom_sidebars_allow_author';
39
+
40
  /**
41
  * Returns the singleton object.
42
  *
60
  return;
61
  }
62
  // Add the sidebar metabox to posts.
63
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ) );
 
 
 
 
64
  // Save the options from the sidebars-metabox.
65
+ add_action( 'save_post', array( $this, 'store_replacements' ) );
 
 
 
 
66
  // Handle ajax requests.
67
+ add_action( 'cs_ajax_request', array( $this, 'handle_ajax' ) );
 
 
 
 
68
  add_action( 'admin_init', array( $this, 'settings' ) );
69
  }
70
 
80
  add_filter( 'screen_settings', array( $this, 'add_capabilities_select_box' ), 10, 2 );
81
  add_action( 'wp_ajax_custom_sidebars_metabox_roles', array( $this, 'update_custom_sidebars_metabox_roles' ) );
82
  add_action( 'wp_ajax_custom_sidebars_metabox_custom_taxonomies', array( $this, 'update_custom_sidebars_metabox_custom_taxonomies' ) );
83
+ add_action( 'wp_ajax_custom_sidebars_allow_author', array( $this, 'update_custom_sidebars_allow_author' ) );
84
  /**
85
  * Check user privileges
86
  */
87
  $user_can_save = $this->current_user_can_update_custom_sidebars();
 
88
  if ( ! $user_can_save ) {
89
  return;
90
  }
91
  // Add a custom column to post list.
92
  $posttypes = self::get_post_types( 'objects' );
93
  foreach ( $posttypes as $pt ) {
94
+ add_filter( 'manage_' . $pt->name . '_posts_columns', array( $this, 'post_columns' ));
95
+ add_action( 'manage_' . $pt->name . '_posts_custom_column', array( $this, 'post_column_content' ), 10, 2
 
 
 
 
 
 
 
96
  );
97
  }
98
  /** This action is documented in wp-admin/includes/screen.php */
99
  add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 );
 
100
  add_action( 'quick_edit_custom_box', array( $this, 'post_quick_edit' ), 10, 2 );
101
  add_action( 'bulk_edit_custom_box', array( $this, 'post_bulk_edit' ), 10, 2 );
102
+ add_action( 'admin_footer', array( $this, 'post_quick_edit_js' ));
 
 
 
 
 
103
  /**
104
  * Bulk Edit save
105
  *
106
  * @since 3.0.8
107
  */
108
  add_action( 'save_post', array( $this, 'bulk_edit_save' ) );
 
109
  }
110
 
111
  /**
119
  $handle_it = false;
120
  $view_file = '';
121
  $sb_id = '';
 
122
  if ( isset( $_POST['sb'] ) ) {
123
  $sb_id = $_POST['sb'];
124
  }
 
125
  switch ( $action ) {
126
  case 'get':
127
  case 'save':
135
  $req->id = $sb_id;
136
  break;
137
  }
 
138
  // The ajax request was not meant for us...
139
  if ( ! $handle_it ) {
140
  return false;
141
  }
 
142
  $sb_data = self::get_sidebar( $sb_id );
 
143
  if ( ! current_user_can( self::$cap_required ) ) {
144
  $req = self::req_err(
145
  $req,
172
  $req->sidebar = $sb_data;
173
  }
174
  break;
 
175
  // Save or insert the specified sidebar.
176
  case 'save':
177
  $req = $this->save_item( $req, $_POST );
178
  break;
 
179
  // Delete the specified sidebar.
180
  case 'delete':
181
  $req->sidebar = $sb_data;
182
  $req = $this->delete_item( $req, $_POST );
183
  break;
 
184
  // Get the location data.
185
  case 'get-location':
186
  $req->sidebar = $sb_data;
187
  $req = $this->get_location_data( $req );
188
  break;
 
189
  // Update the location data.
190
  case 'set-location':
191
  $req->sidebar = $sb_data;
192
  $req = $this->set_location_data( $req );
193
  break;
 
194
  // Toggle theme sidebar replaceable-flag.
195
  case 'replaceable':
196
  $req = $this->set_replaceable( $req );
197
  break;
198
  }
199
  }
 
200
  // Make the ajax response either as JSON or plain text.
201
  if ( $is_json ) {
202
  self::json_response( $req );
204
  ob_start();
205
  include CSB_VIEWS_DIR . $view_file;
206
  $resp = ob_get_clean();
 
207
  self::plain_response( $resp );
208
  }
209
  }
231
  __( 'You have no permission to do this operation.', 'custom-sidebars' )
232
  );
233
  }
 
234
  $sidebars = self::get_custom_sidebars();
235
  $sb_id = $req->id;
 
236
  $sb_desc = '';
237
  if ( isset( $data['description'] ) ) {
238
  $sb_desc = stripslashes( trim( $data['description'] ) );
239
  }
 
240
  $sb_name = isset( $data['name'] )? $data['name']:'';
 
241
  if ( function_exists( 'mb_substr' ) ) {
242
  $sb_name = mb_substr( stripslashes( trim( $sb_name ) ), 0, 40 );
243
  } else {
244
  $sb_name = substr( stripslashes( trim( $sb_name ) ), 0, 40 );
245
  }
 
246
  if ( empty( $sb_name ) ) {
247
  return self::req_err(
248
  $req,
249
  __( 'Sidebar-name cannot be empty', 'custom-sidebars' )
250
  );
251
  }
 
252
  if ( empty( $sb_id ) ) {
253
  // Create a new sidebar.
254
  $action = 'insert';
257
  $num += 1;
258
  $sb_id = self::$sidebar_prefix . $num;
259
  } while ( self::get_sidebar( $sb_id, 'cust' ) );
 
260
  $sidebar = array(
261
  'id' => $sb_id,
262
  );
264
  // Update existing sidebar
265
  $action = 'update';
266
  $sidebar = self::get_sidebar( $sb_id, 'cust' );
 
267
  if ( ! $sidebar ) {
268
  return self::req_err(
269
  $req,
271
  );
272
  }
273
  }
 
274
  if ( function_exists( 'mb_strlen' ) ) {
275
  if ( mb_strlen( $sb_desc ) > 200 ) {
276
  $sb_desc = mb_substr( $sb_desc, 0, 200 );
280
  $sb_desc = substr( $sb_desc, 0, 200 );
281
  }
282
  }
 
283
  // Populate the sidebar object.
284
  if ( 'insert' == $action || self::wpml_is_default_lang() ) {
285
  $sidebar['name'] = $sb_name;
288
  $sidebar['name_lang'] = $sb_name;
289
  $sidebar['description_lang'] = $sb_desc;
290
  }
 
291
  foreach ( array( 'before', 'after' ) as $prefix ) {
292
  foreach ( array( 'widget', 'title' ) as $sufix ) {
293
  $name = sprintf( '%s_%s', $prefix, $sufix );
297
  }
298
  }
299
  }
 
300
  if ( 'insert' == $action ) {
301
  $sidebars[] = $sidebar;
302
  $req->message = sprintf(
323
  );
324
  }
325
  }
 
326
  // Save the changes.
327
  self::set_custom_sidebars( $sidebars );
328
  self::refresh_sidebar_widgets();
 
329
  $req->data = $sidebar;
330
  $req->action = $action;
 
331
  // Allow user to translate sidebar name/description via WPML.
332
  self::wpml_update( $sidebars );
333
  $req->data = self::wpml_translate( $sidebar );
 
334
  /**
335
  * save user preferences (advance).
336
  *
345
  $advance[ $req->data['id'] ] = isset( $_POST['advance'] ) && 'show' === $_POST['advance'];
346
  update_user_option( $user_id, 'custom-sidebars-editor-advance', $advance );
347
  }
 
348
  return $req;
349
  }
350
 
373
  }
374
  $sidebars = self::get_custom_sidebars();
375
  $sidebar = self::get_sidebar( $req->id, 'cust' );
 
376
  if ( ! $sidebar ) {
377
  return self::req_err(
378
  $req,
379
  __( 'The sidebar does not exist', 'custom-sidebars' )
380
  );
381
  }
 
382
  $found = false;
383
  foreach ( $sidebars as $ind => $item ) {
384
  if ( $item['id'] == $req->id ) {
391
  break;
392
  }
393
  }
 
394
  if ( ! $found ) {
395
  return self::req_err(
396
  $req,
397
  __( 'The sidebar was not found', 'custom-sidebars' )
398
  );
399
  }
 
400
  // Save the changes.
401
  self::set_custom_sidebars( $sidebars );
402
  self::refresh_sidebar_widgets();
 
403
  return $req;
404
  }
405
 
430
  $options['modifiable'] = array_values( $options['modifiable'] );
431
  self::set_options( $options );
432
  $req->replaceable = (object) $options['modifiable'];
 
433
  return $req;
434
  }
435
 
450
  '_builtin' => self::get_taxonomies( 'objects', true ),
451
  'custom' => self::get_taxonomies( 'objects', false ),
452
  );
 
453
  $archive_type = array(
454
  '_blog' => __( 'Front Page', 'custom-sidebars' ),
455
  '_search' => __( 'Search Results', 'custom-sidebars' ),
457
  '_authors' => __( 'Any Author Archive', 'custom-sidebars' ),
458
  '_date' => __( 'Date Archives', 'custom-sidebars' ),
459
  );
 
460
  /**
461
  * taxonomies
462
  *
479
  break;
480
  }
481
  }
 
482
  foreach ( $raw_taxonomies['custom'] as $taxonomy ) {
483
  if ( in_array( $taxonomy->labels->singular_name, $default_taxonomies ) ) {
484
  $archive_type[ '_taxonomy_'.$taxonomy->name ] = sprintf( __( '%s Archives', 'custom-sidebars' ), ucfirst( $taxonomy->name ) );
486
  $archive_type[ '_taxonomy_'.$taxonomy->name ] = sprintf( __( '%s Archives', 'custom-sidebars' ), $taxonomy->labels->singular_name );
487
  }
488
  }
 
489
  /**
490
  * sort array by values
491
  */
492
  asort( $archive_type );
 
493
  $raw_authors = array();
494
  $raw_authors = get_users(
495
  array(
498
  'who' => 'authors',
499
  )
500
  );
 
501
  // Collect required data for all posttypes.
502
  $posttypes = array();
503
  foreach ( $raw_posttype as $item ) {
504
  $sel_single = @$defaults['post_type_single'][ $item->name ];
 
505
  $posttypes[ $item->name ] = array(
506
  'name' => $item->labels->name,
507
  'single' => self::get_array( $sel_single ),
508
  );
509
  }
 
510
  // Extract the data from categories list that we need.
511
  $categories = array();
512
  foreach ( $raw_cat as $item ) {
513
  $sel_single = @$defaults['category_single'][ $item->term_id ];
514
  $sel_archive = @$defaults['category_archive'][ $item->term_id ];
 
515
  $categories[ $item->term_id ] = array(
516
  'name' => $item->name,
517
  'count' => $item->count,
519
  'archive' => self::get_array( $sel_archive ),
520
  );
521
  }
 
522
  // Build a list of archive types.
523
  $archives = array(); // Start with a copy of the posttype list.
524
  foreach ( $raw_posttype as $item ) {
531
  $item->labels->singular_name
532
  );
533
  }
 
534
  $sel_archive = @$defaults['post_type_archive'][ $item->name ];
 
535
  $archives[ $item->name ] = array(
536
  'name' => $label,
537
  'archive' => self::get_array( $sel_archive ),
538
  );
539
  }
 
540
  foreach ( $archive_type as $key => $name ) {
541
  $sel_archive = @$defaults[ substr( $key, 1 ) ];
 
542
  $archives[ $key ] = array(
543
  'name' => $name,
544
  'archive' => self::get_array( $sel_archive ),
545
  );
546
  }
 
547
  /**
548
  * Custom taxonomies archive
549
  *
567
  );
568
  }
569
  }
 
570
  /**
571
  * Custom taxonomies taxes
572
  *
617
  }
618
  }
619
  }
 
620
  // Build a list of authors.
621
  $authors = array();
622
  foreach ( $raw_authors as $user ) {
627
  );
628
  }
629
  $req->authors = $authors;
 
630
  $req->replaceable = $defaults['modifiable'];
631
  $req->posttypes = $posttypes;
632
  $req->categories = $categories;
672
  $raw_taxonomies = array(
673
  'custom' => self::get_taxonomies( 'names', false ),
674
  );
 
675
  foreach ( $_POST as $key => $value ) {
676
  if ( strlen( $key ) > 8 && '___cs___' == substr( $key, 0, 8 ) ) {
677
  list( $prefix, $id ) = explode( '___', substr( $key, 8 ) );
 
678
  if ( ! isset( $data[ $prefix ] ) ) {
679
  $data[ $prefix ] = array();
680
  }
681
  $data[ $prefix ][ $id ] = $value;
682
  }
683
  }
 
684
  $special_arc = array(
685
  'blog',
686
  '404',
689
  'search',
690
  'date',
691
  );
 
692
  $raw_authors = array();
693
  $raw_authors = get_users(
694
  array(
713
  ) {
714
  unset( $options['post_type_single'][ $pt ][ $sb_id ] );
715
  }
 
716
  if (
717
  is_array( @$data['arc'][ $sb_id ] ) &&
718
  in_array( $pt, $data['arc'][ $sb_id ] )
725
  unset( $options['post_type_archive'][ $pt ][ $sb_id ] );
726
  }
727
  }
 
728
  // Category settings.
729
  foreach ( $raw_cat as $item ) {
730
  $cat = $item->term_id;
739
  ) {
740
  unset( $options['category_single'][ $cat ][ $sb_id ] );
741
  }
 
742
  if (
743
  is_array( @$data['arc-cat'][ $sb_id ] ) &&
744
  in_array( $cat, $data['arc-cat'][ $sb_id ] )
751
  unset( $options['category_archive'][ $cat ][ $sb_id ] );
752
  }
753
  }
 
754
  foreach ( $special_arc as $key ) {
755
  if (
756
  is_array( @$data['arc'][ $sb_id ] ) &&
764
  unset( $options[ $key ][ $sb_id ] );
765
  }
766
  }
 
767
  // Author settings.
768
  foreach ( $raw_authors as $user ) {
769
  $key = $user->ID;
779
  unset( $options['author_archive'][ $key ][ $sb_id ] );
780
  }
781
  }
 
782
  /**
783
  * Custom taxonomies
784
  *
823
  }
824
  }
825
  }
 
826
  /**
827
  * category Archive
828
  *
841
  unset( $options['category_archive'][ $sb_id ] );
842
  }
843
  }
 
844
  $req->message = sprintf(
845
  __( 'Updated sidebar <strong>%1$s</strong> settings.', 'custom-sidebars' ),
846
  esc_html( $req->sidebar['name'] )
865
  */
866
  public function add_meta_box() {
867
  global $post;
868
+ /**
869
+ * check capabilities
870
+ */
871
+ $user_can_change_sidebars = $this->check_author_ability_to_replace();
872
+ if ( ! $user_can_change_sidebars ) {
873
+ return;
874
+ }
875
  $post_type = get_post_type( $post );
876
+ if ( ! $post_type ) {
877
+ return false;
878
+ }
879
+ if ( ! self::supported_post_type( $post_type ) ) {
880
+ return false;
881
+ }
882
  /**
883
  * Option that can be set in wp-config.php to remove the custom sidebar
884
  * meta box for certain post types.
893
  ) {
894
  return false;
895
  }
 
 
 
 
 
 
896
  $pt_obj = get_post_type_object( $post_type );
897
  if ( $pt_obj->publicly_queryable || $pt_obj->public ) {
898
  add_meta_box(
928
  */
929
  protected function print_sidebars_form( $post_id, $type = 'metabox' ) {
930
  /**
931
+ * check capabilities
932
  */
933
+ $user_can_change_sidebars = $this->check_author_ability_to_replace();
934
+ if ( ! $user_can_change_sidebars ) {
935
  return;
936
  }
 
937
  global $wp_registered_sidebars;
938
  $available = CustomSidebars::sort_sidebars_by_name( $wp_registered_sidebars );
939
  $replacements = self::get_replacements( $post_id );
948
  }
949
  }
950
  }
 
951
  switch ( $type ) {
952
  case 'col-sidebars':
953
  include CSB_VIEWS_DIR . 'col-sidebars.php';
954
  break;
 
955
  case 'quick-edit':
956
  include CSB_VIEWS_DIR . 'quick-edit.php';
957
  break;
 
958
  case 'bulk-edit':
959
  /**
960
  * @since 3.0.8
961
  */
962
  include CSB_VIEWS_DIR . 'bulk-edit.php';
963
  break;
 
964
  default:
965
  include CSB_VIEWS_DIR . 'metabox.php';
966
  break;
969
 
970
  public function store_replacements( $post_id ) {
971
  global $action;
972
+ /**
973
+ * check capabilities
974
+ */
975
+ $user_can_change_sidebars = $this->check_author_ability_to_replace();
976
+ if ( ! $user_can_change_sidebars ) {
977
  return;
978
  }
 
979
  /*
980
  * Verify if this is an auto save routine. If it is our form has not
981
  * been submitted, so we dont want to do anything
984
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
985
  return $post_id;
986
  }
 
987
  /*
988
  * 'editpost' .. Saved from full Post-Editor screen.
989
  * 'inline-save' .. Saved via the quick-edit form.
991
  if ( ( isset( $_REQUEST['action'] ) && 'inline-save' != $_REQUEST['action'] ) && 'editpost' != $action ) {
992
  return $post_id;
993
  }
 
 
 
 
 
 
 
 
 
994
  // Make sure meta is added to the post, not a revision.
995
  if ( $the_post = wp_is_post_revision( $post_id ) ) {
996
  $post_id = $the_post;
997
  }
 
998
  $sidebars = self::get_options( 'modifiable' );
999
  $data = array();
1000
  if ( ! empty( $sidebars ) ) {
1007
  }
1008
  }
1009
  }
 
1010
  self::set_post_meta( $post_id, $data );
1011
  }
1012
 
1013
  // ========== WPML support.
 
1014
  /**
1015
  * Updates the WPML string register with the current sidebar string so the
1016
  * user can translate the sidebar details using the WPML string translation.
1020
  */
1021
  static protected function wpml_update( $custom_sidebars ) {
1022
  if ( ! function_exists( 'icl_register_string' ) ) { return false; }
 
1023
  $theme_sidebars = self::get_sidebars();
 
1024
  // This is used to identify the sidebar-translations by WPML.
1025
  $context = 'Sidebar';
 
1026
  // First do the theme sidebars, so they will be displayed in the
1027
  // *bottom* of the translations list.
1028
  foreach ( $theme_sidebars as $fields ) {
1029
  self::wpml_update_field( $context, $fields['id'] . '-name', @$fields['name'], false );
1030
  self::wpml_update_field( $context, $fields['id'] . '-description', @$fields['description'], false );
1031
  }
 
1032
  foreach ( $custom_sidebars as $fields ) {
1033
  $name = isset( $fields['name_lang'] ) ? $fields['name_lang'] : $fields['name'];
1034
  $description = isset( $fields['description_lang'] ) ? $fields['description_lang'] : $fields['description'];
1049
  */
1050
  static protected function wpml_update_field( $context, $field, $value, $update_string = true ) {
1051
  global $sitepress, $sitepress_settings;
 
1052
  if ( empty( $sitepress ) || empty( $sitepress_settings ) ) { return false; }
1053
  if ( ! function_exists( 'icl_t' ) ) { return false; }
 
1054
  if ( ! icl_st_is_registered_string( $context, $field ) ) {
1055
  // Register the field if it does not exist.
1056
  icl_register_string( $context, $field, $value, false );
 
1057
  $active_languages = $sitepress->get_active_languages();
 
1058
  foreach ( $active_languages as $lang => $data ) {
1059
  icl_update_string_translation( $field, $lang, $value, ICL_STRING_TRANSLATION_COMPLETE );
1060
  }
 
1061
  $default_language = ! empty( $sitepress_settings['st']['strings_language'] )
1062
  ? $sitepress_settings['st']['strings_language']
1063
  : $sitepress->get_default_language();
1064
  icl_update_string_translation( $field, $default_language, $value, ICL_STRING_TRANSLATION_COMPLETE );
 
1065
  } else if ( $update_string ) {
 
1066
  // Add translation.
1067
  if ( defined( 'DOING_AJAX' ) ) {
1068
  $current_language = $sitepress->get_language_cookie();
1069
  } else {
1070
  $current_language = $sitepress->get_current_language();
1071
  }
 
1072
  icl_update_string_translation( $field, $current_language, $value, ICL_STRING_TRANSLATION_COMPLETE );
1073
  }
1074
  }
1083
  global $sitepress, $sitepress_settings;
1084
  if ( empty( $sitepress ) || empty( $sitepress_settings ) ) { return true; }
1085
  if ( ! function_exists( 'icl_t' ) ) { return true; }
 
1086
  if ( defined( 'DOING_AJAX' ) ) {
1087
  $current_language = $sitepress->get_language_cookie();
1088
  } else {
1089
  $current_language = $sitepress->get_current_language();
1090
  }
 
1091
  $default_language = ! empty( $sitepress_settings['st']['strings_language'] )
1092
  ? $sitepress_settings['st']['strings_language']
1093
  : $sitepress->get_default_language();
 
1094
  return $default_language == $current_language;
1095
  }
1096
 
1117
  } else {
1118
  $sidebar['description'] = icl_t( $context, $sidebar['id'] . '-description', $sidebar['description'] );
1119
  }
 
1120
  return $sidebar;
1121
  }
1122
 
1124
  // ========== Custom column an Quick-Edit fields for post list.
1125
  // http://shibashake.com/wordpress-theme/expand-the-wordpress-quick-edit-menu
1126
  //
 
1127
  /**
1128
  * Adds a custom column to post-types that support custom sidebars.
1129
  *
1136
  $insert = array(
1137
  'cs_replacement' => _x( 'Custom Sidebars', 'Column name on entries list.', 'custom-sidebars' ),
1138
  );
 
1139
  // Column is added after column 'title'.
1140
  $insert_after = 'title';
 
1141
  $pos = array_search( $insert_after, array_keys( $columns ) ) + 1;
1142
  $columns = array_merge(
1143
  array_slice( $columns, 0, $pos ),
1144
  $insert,
1145
  array_slice( $columns, $pos )
1146
  );
 
1147
  return $columns;
1148
  }
1149
 
1171
  */
1172
  public function post_quick_edit( $column_name, $post_type ) {
1173
  if ( ! self::supported_post_type( $post_type ) ) { return false; }
 
1174
  switch ( $column_name ) {
1175
  case 'cs_replacement':
1176
  $this->print_metabox_quick();
1189
  */
1190
  public function post_quick_edit_js() {
1191
  global $current_screen;
 
1192
  if ( ( $current_screen->base != 'edit' ) ) { return false; }
1193
  if ( ! self::supported_post_type( $current_screen->post_type ) ) { return false; }
 
1194
  ?>
1195
  <script type="text/javascript">
1196
  <!--
1197
  jQuery(function() {
1198
  // we create a copy of the WP inline edit post function
1199
  var wp_inline_edit = inlineEditPost.edit;
 
1200
  // and then we overwrite the function with our own code
1201
  inlineEditPost.edit = function( id ) {
 
1202
  // "call" the original WP edit function
1203
  // we don't want to leave WordPress hanging
1204
  wp_inline_edit.apply( this, arguments );
 
1205
  // now we take care of our business.
 
1206
  // get the post ID
1207
  var post_id = 0;
1208
  if ( typeof( id ) == 'object' ) {
1209
  post_id = parseInt( this.getId( id ) );
1210
  }
 
1211
  if ( post_id > 0 ) {
 
1212
  // define the edit row
1213
  var edit_row = jQuery( '#edit-' + post_id );
1214
  var post_row = jQuery( '#post-' + post_id );
 
1215
  // Our custom column
1216
  var sidebar_col = post_row.find( '.cs_replacement' );
 
1217
  sidebar_col.find( '[data-sidebar]' ).each(function() {
1218
  var key = jQuery( this ).attr( 'data-sidebar' ),
1219
  val = jQuery( this ).attr( 'data-replaced' ),
1220
  hide = 'yes' === jQuery( this ).attr( 'data-cshide' );
 
1221
  if ( hide ) {
1222
  edit_row.find( '.cs-replacement-field.' + key ).val( val ).parent().hide();
1223
  } else {
1337
  }
1338
  }
1339
  $screen_settings .= '</fieldset>';
1340
+ /**
1341
+ * allow author to edit custom sidebars
1342
+ */
1343
+ $screen_settings .= '<fieldset class="metabox-prefs cs-allow-author">';
1344
+ $screen_settings .= wp_nonce_field( $this->allow_author_name, $this->allow_author_name, false, false );
1345
+ $screen_settings .= sprintf( '<legend>%s</legend>', __( 'Allowed to replace sidebars:', 'custom-sidebars' ) );
1346
+ $checked = get_option( $this->allow_author_name, false );
1347
+ $screen_settings .= sprintf(
1348
+ '<label><input type="checkbox" name="cs-allow-author" value="%s" %s /> %s</label>',
1349
+ esc_attr( $role ),
1350
+ checked( $checked, true, false ),
1351
+ esc_html__( 'Allow entry author to change sidebars', 'custom-sidebars' )
1352
+ );
1353
+ $screen_settings .= '</fieldset>';
1354
  /**
1355
  * Custom taxonomies
1356
  */
1425
  wp_send_json_success();
1426
  }
1427
 
1428
+ /**
1429
+ * Update entry author is allowed to change custom sidebars.
1430
+ *
1431
+ * @since 3.1.5
1432
+ */
1433
+ public function update_custom_sidebars_allow_author() {
1434
+ /**
1435
+ * check required data
1436
+ */
1437
+ if ( ! isset( $_REQUEST['_wpnonce'] ) ) {
1438
+ wp_send_json_error();
1439
+ }
1440
+ /**
1441
+ * check nonce value
1442
+ */
1443
+ if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], $this->allow_author_name ) ) {
1444
+ wp_send_json_error();
1445
+ }
1446
+ $value = isset( $_REQUEST['value'] )? 'true' === $_REQUEST['value'] : false;
1447
+ $status = add_option( $this->allow_author_name, $value, '', 'no' );
1448
+ if ( ! $status ) {
1449
+ update_option( $this->allow_author_name, $value );
1450
+ }
1451
+ wp_send_json_success();
1452
+ }
1453
  /**
1454
  * Check ability to save sidebars
1455
  *
1483
  }
1484
  return $value;
1485
  }
1486
+
1487
+ /**
1488
+ * Check author ability to change sidebars during entry edit
1489
+ *
1490
+ * @since 3.1.5
1491
+ */
1492
+ private function check_author_ability_to_replace() {
1493
+ global $post;
1494
+ if ( current_user_can( self::$cap_required ) ) {
1495
+ return true;
1496
+ }
1497
+ $checked = get_option( $this->allow_author_name, false );
1498
+ if ( $checked ) {
1499
+ if ( current_user_can( 'edit_posts', $post->ID ) ) {
1500
+ return true;
1501
+ }
1502
+ }
1503
+ return false;
1504
+ }
1505
  };
inc/class-custom-sidebars.php CHANGED
@@ -90,7 +90,7 @@ class CustomSidebars {
90
  */
91
  public function wp_enqueue_add_version( $version, $handle ) {
92
  if ( preg_match( '/^wpmu\-cs\-/', $handle ) ) {
93
- return '3.1.4';
94
  }
95
  return $version;
96
  }
90
  */
91
  public function wp_enqueue_add_version( $version, $handle ) {
92
  if ( preg_match( '/^wpmu\-cs\-/', $handle ) ) {
93
+ return '3.1.5';
94
  }
95
  return $version;
96
  }
languages/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: 2018-05-02 05:33:09+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -60,102 +60,110 @@ msgstr ""
60
  msgid "Clone"
61
  msgstr ""
62
 
63
- #: inc/class-custom-sidebars-editor.php:164
64
- #: inc/class-custom-sidebars-editor.php:179
65
  #: inc/class-custom-sidebars-export.php:98
66
  msgid "You do not have permission for this"
67
  msgstr ""
68
 
69
- #: inc/class-custom-sidebars-editor.php:256
70
- #: inc/class-custom-sidebars-editor.php:413
71
- #: inc/class-custom-sidebars-editor.php:730
72
  msgid "You have no permission to do this operation."
73
  msgstr ""
74
 
75
- #: inc/class-custom-sidebars-editor.php:279
76
  msgid "Sidebar-name cannot be empty"
77
  msgstr ""
78
 
79
- #: inc/class-custom-sidebars-editor.php:303
80
- #: inc/class-custom-sidebars-editor.php:422
81
  msgid "The sidebar does not exist"
82
  msgstr ""
83
 
84
- #: inc/class-custom-sidebars-editor.php:340
85
  msgid "Created new sidebar <strong>%1$s</strong>"
86
  msgstr ""
87
 
88
- #: inc/class-custom-sidebars-editor.php:348
89
  msgid "Updated sidebar <strong>%1$s</strong>"
90
  msgstr ""
91
 
92
- #: inc/class-custom-sidebars-editor.php:359
93
- #: inc/class-custom-sidebars-editor.php:442
94
  msgid "The sidebar was not found"
95
  msgstr ""
96
 
97
- #: inc/class-custom-sidebars-editor.php:431
98
  msgid "Deleted sidebar <strong>%1$s</strong>"
99
  msgstr ""
100
 
101
- #: inc/class-custom-sidebars-editor.php:503
102
  #: inc/class-custom-sidebars-visibility.php:156
103
  msgid "Front Page"
104
  msgstr ""
105
 
106
- #: inc/class-custom-sidebars-editor.php:504
107
  msgid "Search Results"
108
  msgstr ""
109
 
110
- #: inc/class-custom-sidebars-editor.php:505
111
  #: inc/class-custom-sidebars-visibility.php:162
112
  msgid "Not found (404)"
113
  msgstr ""
114
 
115
- #: inc/class-custom-sidebars-editor.php:506
116
  msgid "Any Author Archive"
117
  msgstr ""
118
 
119
- #: inc/class-custom-sidebars-editor.php:507
120
  msgid "Date Archives"
121
  msgstr ""
122
 
123
- #: inc/class-custom-sidebars-editor.php:525
124
- #: inc/class-custom-sidebars-editor.php:528
125
- #: inc/class-custom-sidebars-editor.php:535
126
- #: inc/class-custom-sidebars-editor.php:537
127
- #: inc/class-custom-sidebars-editor.php:621
128
- #: inc/class-custom-sidebars-editor.php:623
129
- #: inc/class-custom-sidebars-editor.php:678
130
  msgid "%s Archives"
131
  msgstr ""
132
 
133
- #: inc/class-custom-sidebars-editor.php:584
134
  #: inc/class-custom-sidebars-visibility.php:157
135
  msgid "Post Index"
136
  msgstr ""
137
 
138
- #: inc/class-custom-sidebars-editor.php:588
139
  msgid "%1$s Archives"
140
  msgstr ""
141
 
142
- #: inc/class-custom-sidebars-editor.php:923
143
  msgid "Updated sidebar <strong>%1$s</strong> settings."
144
  msgstr ""
145
 
146
- #: inc/class-custom-sidebars-editor.php:975 views/widgets.php:17
147
  msgid "Sidebars"
148
  msgstr ""
149
 
150
- #: inc/class-custom-sidebars-editor.php:1445
151
  msgid "Custom sidebars configuration is allowed for:"
152
  msgstr ""
153
 
154
- #: inc/class-custom-sidebars-editor.php:1471
 
 
 
 
 
 
 
 
155
  msgid "Allow Custom Taxonomies in Sidebar Location:"
156
  msgstr ""
157
 
158
- #: inc/class-custom-sidebars-editor.php:1482
159
  msgid ""
160
  "After turn on any Custom Taxonomy you need to reload this screen to be able "
161
  "choose it in Sidebar Location."
@@ -749,7 +757,7 @@ msgstr ""
749
  msgid "http://premium.wpmudev.org/"
750
  msgstr ""
751
 
752
- #: inc/class-custom-sidebars-editor.php:1245
753
  msgctxt "Column name on entries list."
754
  msgid "Custom Sidebars"
755
  msgstr ""
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: 2018-05-07 07:48:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
60
  msgid "Clone"
61
  msgstr ""
62
 
63
+ #: inc/class-custom-sidebars-editor.php:146
64
+ #: inc/class-custom-sidebars-editor.php:161
65
  #: inc/class-custom-sidebars-export.php:98
66
  msgid "You do not have permission for this"
67
  msgstr ""
68
 
69
+ #: inc/class-custom-sidebars-editor.php:231
70
+ #: inc/class-custom-sidebars-editor.php:371
71
+ #: inc/class-custom-sidebars-editor.php:664
72
  msgid "You have no permission to do this operation."
73
  msgstr ""
74
 
75
+ #: inc/class-custom-sidebars-editor.php:249
76
  msgid "Sidebar-name cannot be empty"
77
  msgstr ""
78
 
79
+ #: inc/class-custom-sidebars-editor.php:270
80
+ #: inc/class-custom-sidebars-editor.php:379
81
  msgid "The sidebar does not exist"
82
  msgstr ""
83
 
84
+ #: inc/class-custom-sidebars-editor.php:303
85
  msgid "Created new sidebar <strong>%1$s</strong>"
86
  msgstr ""
87
 
88
+ #: inc/class-custom-sidebars-editor.php:311
89
  msgid "Updated sidebar <strong>%1$s</strong>"
90
  msgstr ""
91
 
92
+ #: inc/class-custom-sidebars-editor.php:322
93
+ #: inc/class-custom-sidebars-editor.php:397
94
  msgid "The sidebar was not found"
95
  msgstr ""
96
 
97
+ #: inc/class-custom-sidebars-editor.php:387
98
  msgid "Deleted sidebar <strong>%1$s</strong>"
99
  msgstr ""
100
 
101
+ #: inc/class-custom-sidebars-editor.php:454
102
  #: inc/class-custom-sidebars-visibility.php:156
103
  msgid "Front Page"
104
  msgstr ""
105
 
106
+ #: inc/class-custom-sidebars-editor.php:455
107
  msgid "Search Results"
108
  msgstr ""
109
 
110
+ #: inc/class-custom-sidebars-editor.php:456
111
  #: inc/class-custom-sidebars-visibility.php:162
112
  msgid "Not found (404)"
113
  msgstr ""
114
 
115
+ #: inc/class-custom-sidebars-editor.php:457
116
  msgid "Any Author Archive"
117
  msgstr ""
118
 
119
+ #: inc/class-custom-sidebars-editor.php:458
120
  msgid "Date Archives"
121
  msgstr ""
122
 
123
+ #: inc/class-custom-sidebars-editor.php:475
124
+ #: inc/class-custom-sidebars-editor.php:478
125
+ #: inc/class-custom-sidebars-editor.php:484
126
+ #: inc/class-custom-sidebars-editor.php:486
127
+ #: inc/class-custom-sidebars-editor.php:558
128
+ #: inc/class-custom-sidebars-editor.php:560
129
+ #: inc/class-custom-sidebars-editor.php:614
130
  msgid "%s Archives"
131
  msgstr ""
132
 
133
+ #: inc/class-custom-sidebars-editor.php:526
134
  #: inc/class-custom-sidebars-visibility.php:157
135
  msgid "Post Index"
136
  msgstr ""
137
 
138
+ #: inc/class-custom-sidebars-editor.php:530
139
  msgid "%1$s Archives"
140
  msgstr ""
141
 
142
+ #: inc/class-custom-sidebars-editor.php:845
143
  msgid "Updated sidebar <strong>%1$s</strong> settings."
144
  msgstr ""
145
 
146
+ #: inc/class-custom-sidebars-editor.php:900 views/widgets.php:17
147
  msgid "Sidebars"
148
  msgstr ""
149
 
150
+ #: inc/class-custom-sidebars-editor.php:1322
151
  msgid "Custom sidebars configuration is allowed for:"
152
  msgstr ""
153
 
154
+ #: inc/class-custom-sidebars-editor.php:1345
155
+ msgid "Allowed to replace sidebars:"
156
+ msgstr ""
157
+
158
+ #: inc/class-custom-sidebars-editor.php:1351
159
+ msgid "Allow entry author to change sidebars"
160
+ msgstr ""
161
+
162
+ #: inc/class-custom-sidebars-editor.php:1362
163
  msgid "Allow Custom Taxonomies in Sidebar Location:"
164
  msgstr ""
165
 
166
+ #: inc/class-custom-sidebars-editor.php:1373
167
  msgid ""
168
  "After turn on any Custom Taxonomy you need to reload this screen to be able "
169
  "choose it in Sidebar Location."
757
  msgid "http://premium.wpmudev.org/"
758
  msgstr ""
759
 
760
+ #: inc/class-custom-sidebars-editor.php:1137
761
  msgctxt "Column name on entries list."
762
  msgid "Custom Sidebars"
763
  msgstr ""
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Custom Sidebars - Dynamic Widget Area Manager ===
2
  Contributors: WPMUDEV, marquex, WPMUDEV-Support2, WPMUDEV-Support1, WPMUDEV-Support6, WPMUDEV-Support4, iworks
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.9.5
6
- Stable tag: 3.1.4
7
 
8
  Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
9
 
@@ -114,12 +114,12 @@ Any user that can switch themes, can create sidebars. Switch_themes is the capab
114
 
115
  Custom Sidebars has the same license as WordPress, so you can use it wherever you want for free. Yay!
116
 
117
- = I like the plugin, but what can I do if my website is based in a WP version older than 3.3 =
118
-
119
- If you are running a earlier version of WordPress download Custom Sidebars 0.8.2.
120
-
121
  == Changelog ==
122
 
 
 
 
 
123
  = 3.1.4 =
124
  * Fixed a problem with widgets display on IE11.
125
  * Handle custom taxonomies.
@@ -134,7 +134,7 @@ If you are running a earlier version of WordPress download Custom Sidebars 0.8.2
134
  = 3.1.2 =
135
  * Added integration with Polylang - now you can choose sidebar depend on Polylang language.
136
  * Added integration with WPML - now you can choose sidebar depend on WPML language.
137
- * Added check to avoid warnigs when user delete term which is assigned to "Sidebar Location".
138
  * Updated "WPMU Dev code library" to version 3.0.5.
139
 
140
  = 3.1.1 =
@@ -210,7 +210,7 @@ If you are running a earlier version of WordPress download Custom Sidebars 0.8.2
210
  * Show advertising for "WP Checkup" in the whole admin area.
211
 
212
  = 3.0.0.1 =
213
- * Fixed a problem with wp_enqueue_script which was called too early.
214
  * Fixed a problem with advertising, which should stay close when you close it.
215
 
216
  = 3.0.0.0 =
@@ -248,7 +248,7 @@ If you are running a earlier version of WordPress download Custom Sidebars 0.8.2
248
  * Fixed problem with sorting and filtering.
249
 
250
  = 2.1.1.3 =
251
- * Added check if there the function "mb_strtolower".
252
 
253
  = 2.1.1.2 =
254
  * Sidebars are now sorted by name.
1
  === Custom Sidebars - Dynamic Widget Area Manager ===
2
  Contributors: WPMUDEV, marquex, WPMUDEV-Support2, WPMUDEV-Support1, WPMUDEV-Support6, WPMUDEV-Support4, iworks
3
  Tags: sidebar, widget, footer, custom, flexible layout, dynamic widgets, manage sidebars, replace widgets, custom widget area
4
+ Requires at least: 3.7
5
  Tested up to: 4.9.5
6
+ Stable tag: 3.1.5
7
 
8
  Flexible sidebars for custom widget configurations on every page, post and custom post type on your site.
9
 
114
 
115
  Custom Sidebars has the same license as WordPress, so you can use it wherever you want for free. Yay!
116
 
 
 
 
 
117
  == Changelog ==
118
 
119
+ = 3.1.5 =
120
+ * Fixed a problem with saving an entry sidebars replacement.
121
+ * Added ability to allow change sidebars by an entry author.
122
+
123
  = 3.1.4 =
124
  * Fixed a problem with widgets display on IE11.
125
  * Handle custom taxonomies.
134
  = 3.1.2 =
135
  * Added integration with Polylang - now you can choose sidebar depend on Polylang language.
136
  * Added integration with WPML - now you can choose sidebar depend on WPML language.
137
+ * Added check to avoid warnings when user delete term which is assigned to "Sidebar Location".
138
  * Updated "WPMU Dev code library" to version 3.0.5.
139
 
140
  = 3.1.1 =
210
  * Show advertising for "WP Checkup" in the whole admin area.
211
 
212
  = 3.0.0.1 =
213
+ * Fixed a problem with `wp_enqueue_script()` which was called too early.
214
  * Fixed a problem with advertising, which should stay close when you close it.
215
 
216
  = 3.0.0.0 =
248
  * Fixed problem with sorting and filtering.
249
 
250
  = 2.1.1.3 =
251
+ * Added check if there the function `mb_strtolower()`.
252
 
253
  = 2.1.1.2 =
254
  * Sidebars are now sorted by name.