Admin Columns - Version 2.4.10

Version Description

  • [Fixed] Data:image sources for images are supported in labels
  • [Fixed] Cloned columns no longer has the wrong options when stored
  • [Fixed] Created deprecated function for is_columns_screen()
  • [Fixed] The method get_current_storage_model returns the first occurrence instead of running the entire array of storage modals
  • [Fixed] The storage_model object should have the init_manage_columns method to properly load the columns heading and values
  • [Fixed] The storage_model object can now be used within sub pages
Download this release

Release Info

Developer tschutter
Plugin Icon 128x128 Admin Columns
Version 2.4.10
Comparing to
See all releases

Code changes from version 2.4.9 to 2.4.10

assets/js/admin-settings.js CHANGED
@@ -22,7 +22,6 @@ jQuery(document).ready(function() {
22
cpac_add_column();
23
cpac_importexport();
24
cpac_sidebar_feedback();
25
- //cpac_sidebar_scroll();
26
27
// we start by binding the toggle and remove events.
28
jQuery('.cpac-column').each( function( i, col ) {
@@ -357,12 +356,6 @@ jQuery.fn.column_clone = function() {
357
358
if ( typeof column.attr( 'data-clone' ) === 'undefined' ) {
359
var message = cpac_i18n.clone.replace( '%s', '<strong>' + column.find( '.column_label .toggle' ).text() + '</strong>' );
360
- /*var el_message = jQuery( '<div class="cpac_message error"><p>' + message + '</p></div>' );
361
-
362
- container.find( '.cpac-boxes' ).before( el_message );
363
- el_message.hide().slideDown().delay( 2500 ).slideUp( function() {
364
- jQuery( this ).remove();
365
- } );*/
366
367
column.addClass( 'opened' ).find( '.column-form' ).slideDown( 150 );
368
column.find( '.msg' ).html( message ).show();
@@ -409,10 +402,6 @@ jQuery.fn.cpac_update_clone_id = function( storage_model ) {
409
var all_columns = jQuery( '.columns-container[data-type="' + storage_model + '"]').find( '.cpac-columns' );
410
var columns = jQuery( all_columns ).find( '*[data-type="' + type + '"]' ).not( el );
411
412
- /* var type = el.attr( 'data-type' );
413
- var all_columns = el.closest( '.cpac-boxes' ).find( '.cpac-columns' );
414
- var columns = jQuery( all_columns ).find( '*[data-type="' + type + '"]' ).not( el );*/
415
-
416
// get clone ID
417
var ids = jQuery.map( columns, function( e, i ) {
418
if ( jQuery(e).attr('data-clone') ){
@@ -420,16 +409,18 @@ jQuery.fn.cpac_update_clone_id = function( storage_model ) {
420
}
421
return 0;
422
});
423
ids.sort();
424
var max_id = Math.max.apply( null, ids ) + 1;
425
for ( var id=0; id<=max_id; id++ ) {
426
- if ( -1 === jQuery.inArray( id, ids ) )
427
- break;
428
}
429
430
// only increment when needed
431
- if ( 0 === id )
432
- return;
433
434
// get original clone ID
435
var clone_id = el.attr( 'data-clone' );
@@ -544,40 +535,6 @@ function cpac_sidebar_feedback() {
544
} );
545
}
546
547
- /*
548
- * Sidebar Scroll
549
- *
550
- * @since 1.5
551
- */
552
- /*function cpac_sidebar_scroll() {
553
-
554
- if ( jQuery('.columns-right-inside').length === 0 ) {
555
- return;
556
- }
557
-
558
- if ( jQuery('.columns-right-inside:visible').offset() ) {
559
- var sidebar = jQuery('.columns-right-inside:visible');
560
- var top = sidebar.offset().top - parseFloat( sidebar.css('margin-top').replace(/auto/, 0) ) - 70;
561
- var viewport_height = jQuery(window).height();
562
- var sidebar_height = sidebar.height();
563
-
564
- jQuery(window).scroll(function (event) {
565
- var y = jQuery(this).scrollTop();
566
-
567
- // top position of div#cpac is calculated everytime incase of an opened help screen
568
- var offset = jQuery('#cpac').offset().top - parseFloat( jQuery('#cpac').css('margin-top').replace(/auto/, 0) );
569
- var sidebar_fits_on_screen = sidebar_height < ( viewport_height - 32 ); // adminbar
570
-
571
- // whether that's below
572
- if ( ( y >= top + offset ) && sidebar_fits_on_screen ) {
573
- jQuery('.columns-right-inside:visible').addClass('fixed');
574
- } else {
575
- jQuery('.columns-right-inside:visible').removeClass('fixed');
576
- }
577
- });
578
- }
579
- }*/
580
-
581
/*
582
* Clear Input Defaults
583
*
22
cpac_add_column();
23
cpac_importexport();
24
cpac_sidebar_feedback();
25
26
// we start by binding the toggle and remove events.
27
jQuery('.cpac-column').each( function( i, col ) {
356
357
if ( typeof column.attr( 'data-clone' ) === 'undefined' ) {
358
var message = cpac_i18n.clone.replace( '%s', '<strong>' + column.find( '.column_label .toggle' ).text() + '</strong>' );
359
360
column.addClass( 'opened' ).find( '.column-form' ).slideDown( 150 );
361
column.find( '.msg' ).html( message ).show();
402
var all_columns = jQuery( '.columns-container[data-type="' + storage_model + '"]').find( '.cpac-columns' );
403
var columns = jQuery( all_columns ).find( '*[data-type="' + type + '"]' ).not( el );
404
405
// get clone ID
406
var ids = jQuery.map( columns, function( e, i ) {
407
if ( jQuery(e).attr('data-clone') ){
409
}
410
return 0;
411
});
412
+
413
ids.sort();
414
var max_id = Math.max.apply( null, ids ) + 1;
415
for ( var id=0; id<=max_id; id++ ) {
416
+ if ( -1 === jQuery.inArray( id, ids ) ) {
417
+ break;
418
+ }
419
}
420
421
// only increment when needed
422
+ //if ( 0 === id )
423
+ // return;
424
425
// get original clone ID
426
var clone_id = el.attr( 'data-clone' );
535
} );
536
}
537
538
/*
539
* Clear Input Defaults
540
*
assets/js/admin-settings.min.js CHANGED
@@ -1 +1 @@
1
- function cpac_importexport(){jQuery("#php-export-results textarea").on("focus, mouseup",function(){jQuery(this).select()}).select().focus()}function cpac_submit_form(){jQuery(".form-update a.submit-update").click(function(e){e.preventDefault(),jQuery(this).closest(".columns-container").find(".cpac-columns form").submit()})}function cpac_create_column(e){var n=jQuery(".for-cloning-only .cpac-column",e).first().clone(),t=e.attr("data-type");return n.length>0&&(n.cpac_update_clone_id(t),jQuery(".cpac-columns form",e).append(n),n.column_bind_toggle(),n.column_bind_remove(),n.column_bind_clone(),n.column_bind_events(),cpac_sortable(),jQuery(document).trigger("column_add",n)),n}function cpac_add_column(){jQuery("#cpac .add_column").click(function(e){var n=jQuery(this).closest(".columns-container"),t=cpac_create_column(n);t.addClass("opened").find(".column-form").slideDown(150,function(){jQuery("html, body").animate({scrollTop:t.offset().top-58},300)}),e.preventDefault()})}function cpac_sidebar_feedback(){jQuery(function(e){var n=e(".sidebox#direct-feedback");n.find("#feedback-choice a.no").click(function(e){e.preventDefault(),n.find("#feedback-choice").slideUp(),n.find("#feedback-support").slideDown()}),n.find("#feedback-choice a.yes").click(function(e){e.preventDefault(),n.find("#feedback-choice").slideUp(),n.find("#feedback-rate").slideDown()})})}function cpac_clear_input_defaults(){jQuery.fn.cleardefault=function(){return this.focus(function(){this.value==this.defaultValue&&(this.value="")}).blur(function(){this.value.length||(this.value=this.defaultValue)})},jQuery("#cpac-box-plugin_settings .addons input").cleardefault()}function cpac_help(){jQuery("#cpac a.help").click(function(e){e.preventDefault();var n=jQuery("#contextual-help-wrap");n.parent().show(),jQuery('a[href="#tab-panel-cpac-'+jQuery(this).attr("data-help")+'"]',n).trigger("click"),n.slideDown("fast",function(){n.focus()})})}function cpac_pointer(){jQuery(".cpac-pointer").each(function(){var e=jQuery(this),n=e.attr("rel"),t=e.attr("data-pos"),i={at:"left top",my:"right top",edge:"right",offset:"0 0"};"right"==t&&(i={at:"right middle",my:"left middle",edge:"left"}),e.pointer({content:jQuery("#"+n).html(),position:i,pointerWidth:250,close:function(){e.removeClass("open")},pointerClass:"wp-pointer wp-pointer-"+i.edge}),e.click(function(){e.hasClass("open")?e.removeClass("open"):e.addClass("open")}),e.hover(function(){jQuery(this).pointer("open")},function(){e.hasClass("open")||jQuery(this).pointer("close")})})}function cpac_sortable(){jQuery("div.cpac-columns").each(function(){jQuery(this).hasClass("ui-sortable")?jQuery(this).sortable("refresh"):jQuery(this).sortable({items:".cpac-column"})})}function cpac_menu(){var e=jQuery("#cpac div.cpac-menu");e.find("a").click(function(e,n){var t=jQuery(this).attr("href");if(t){var i=t.replace("#cpac-box-","");jQuery(".cpac-menu a").removeClass("current"),jQuery(".columns-container").hide(),jQuery(this).addClass("current");var c=jQuery('.columns-container[data-type="'+i+'"]').show(),a=c.find(".cpac-columns");jQuery(document).trigger("cac_menu_change",a)}e.preventDefault()}),e.find("a.current").trigger("click")}jQuery(document).ready(function(){return 0===jQuery("#cpac").length?!1:(cpac_pointer(),cpac_submit_form(),cpac_clear_input_defaults(),cpac_sortable(),cpac_menu(),cpac_help(),cpac_add_column(),cpac_importexport(),cpac_sidebar_feedback(),void jQuery(".cpac-column").each(function(e,n){jQuery(n).column_bind_toggle(),jQuery(n).column_bind_remove(),jQuery(n).column_bind_clone(),jQuery(n).cpac_bind_container_addon_events()}))}),jQuery.fn.column_bind_toggle=function(){var e=jQuery(this);e.find("td.column_type a, td.column_edit, td.column_label a.toggle, td.column_label .edit-button").click(function(n){n.preventDefault(),e.toggleClass("opened").find(".column-form").slideToggle(150),e.hasClass("events-binded")||e.column_bind_events(),e.addClass("events-binded"),jQuery(document).trigger("column_init",e)})},jQuery.fn.column_bind_remove=function(){jQuery(this).find(".remove-button").click(function(e){jQuery(this).closest(".cpac-column").column_remove(),e.preventDefault()})},jQuery.fn.column_bind_clone=function(){jQuery(this).find(".clone-button").click(function(e){var n,t;e.preventDefault(),n=jQuery(this).closest(".cpac-column"),t=n.column_clone(),"undefined"!=typeof t&&t.removeClass("loading").hide().slideDown()})},jQuery.fn.cpac_column_refresh=function(){var e=jQuery(this);e.addClass("loading"),e.find(".column-form").prepend('<span class="spinner" />'),jQuery.post(ajaxurl,{plugin_id:"cpac",action:"cpac_column_refresh",column:jQuery(this).find("input.column-name").val(),formdata:jQuery(this).parents("form").serialize()},function(n){var t=jQuery("<div>"+n+"</div>").children();e.replaceWith(t),e=t,e.column_bind_toggle(),e.column_bind_remove(),e.column_bind_clone(),e.column_bind_events(),e.removeClass("loading").addClass("opened").find(".column-form").show(),jQuery(document).trigger("column_change",e)})},jQuery.fn.column_bind_events=function(){var e=jQuery(this),n=e.closest(".columns-container "),t=n.attr("data-type"),i=e.find(".column_type select option:selected").val();e.find(".column_type select").change(function(){var c=jQuery("optgroup",this).children(":selected"),a=c.val(),o=c.text(),r=jQuery(this).next(".msg").hide(),u=n.find('.for-cloning-only .cpac-column[data-type="'+a+'"]');if(u.length)if(u.find(".is-disabled").length)r.html(u.find(".is-disabled").html()).show(),jQuery(this).find("option").removeAttr("selected"),jQuery(this).find('option[value="'+i+'"]').attr("selected","selected");else{if("undefined"==typeof u.attr("data-clone")&&jQuery(".cpac-columns",n).find('[data-type="'+a+'"]').length)return r.html(cpac_i18n.clone.replace("%s","<strong>"+o+"</strong>")).show(),jQuery(this).find("option").removeAttr("selected"),void jQuery(this).find('option[value="'+i+'"]').attr("selected","selected");var l=u.clone();l.addClass("opened").find(".column-form").show(),l.find(".column-meta").replaceWith(e.find(".column-meta")),l.find(".column-form").replaceWith(e.find(".column-form")),l.cpac_update_clone_id(t),e.replaceWith(l),l.cpac_column_refresh()}}),e.find(".column_label .input input").bind("keyup change",function(){var e=jQuery(this).val();jQuery(this).closest(".cpac-column").find("td.column_label .inner > a.toggle").text(e)}),e.column_width_slider();var c=e.find(".column-meta span.width");c.on("update",function(){var n=e.find("input.width").val(),t=e.find("input.unit").filter(":checked").val();n>0?jQuery(this).text(n+t):jQuery(this).text("")});var a=e.find(".column_width .unit-select label");a.on("click",function(){e.find("span.unit").text(jQuery(this).find("input").val()),e.column_width_slider(),c.trigger("update")});var o=e.find("input.width").on("keyup",function(){e.column_width_slider(),jQuery(this).trigger("validate"),c.trigger("update")}).on("validate",function(){var e=o.val(),n=jQuery.trim(e);jQuery.isNumeric(n)||(n=n.replace(/\D/g,"")),n.length>3&&(n=n.substring(0,3)),0>=n&&(n=""),n!==e&&o.val(n)});e.find(".column_image_size label.custom-size").click(function(){var e=jQuery(this).closest(".input");jQuery(this).hasClass("image-size-custom")?(jQuery(".custom-size-w",e).removeClass("hidden"),jQuery(".custom-size-h",e).removeClass("hidden")):(jQuery(".custom-size-w",e).addClass("hidden"),jQuery(".custom-size-h",e).addClass("hidden"))}),e.find(".column-form .label label, .column-form .label .info").hover(function(){jQuery(this).parents(".label").find("p.description").show()},function(){jQuery(this).parents(".label").find("p.description").hide()}),e.find('[data-refresh="1"] select').change(function(){e.cpac_column_refresh()})},jQuery.fn.column_remove=function(){jQuery(this).addClass("deleting").animate({opacity:0,height:0},350,function(e){jQuery(this).remove()})},jQuery.fn.column_width_slider=function(){var e=jQuery(this).find(".column_width"),n=e.find("input.width"),t=e.find("input.unit"),i=t.filter(":checked").val(),c=n.val(),a=e.find(".width-slider"),o=jQuery(this).find(".column-meta span.width");"%"==i&&c>100&&(c=100),n.val(c),a.slider({range:"min",min:0,max:"%"==i?100:500,value:c,slide:function(e,t){n.val(t.value),o.trigger("update"),n.trigger("validate")}})},jQuery.fn.column_clone=function(){var e=jQuery(this).closest(".columns-container"),n=jQuery(this);if("undefined"==typeof n.attr("data-clone")){var t=cpac_i18n.clone.replace("%s","<strong>"+n.find(".column_label .toggle").text()+"</strong>");return n.addClass("opened").find(".column-form").slideDown(150),void n.find(".msg").html(t).show()}var i=jQuery(this).clone();return i.cpac_update_clone_id(e.attr("data-type")),jQuery(this).after(i),i.column_bind_toggle(),i.column_bind_remove(),i.column_bind_clone(),i.column_bind_events(),cpac_sortable(),jQuery(document).trigger("column_add",i),i},jQuery.fn.cpac_update_clone_id=function(e){var n=jQuery(this),t=n.attr("data-type"),i=jQuery('.columns-container[data-type="'+e+'"]').find(".cpac-columns"),c=jQuery(i).find('*[data-type="'+t+'"]').not(n),a=jQuery.map(c,function(e,n){return jQuery(e).attr("data-clone")?parseInt(jQuery(e).attr("data-clone"),10):0});a.sort();for(var o=Math.max.apply(null,a)+1,r=0;o>=r&&-1!==jQuery.inArray(r,a);r++);if(0!==r){var u=n.attr("data-clone"),l="";u&&(l="-"+u),n.attr("data-clone",r),n.find("input.clone").val(r),n.find("input.column-name").val(t+"-"+r);var d=n.find("input, select, label");jQuery(d).each(function(e,n){var i=t+"-"+r;jQuery(n).attr("name")&&jQuery(n).attr("name",jQuery(n).attr("name").replace(t+l,i)),jQuery(n).attr("for")&&jQuery(n).attr("for",jQuery(n).attr("for").replace(t+l,i)),jQuery(n).attr("id")&&jQuery(n).attr("id",jQuery(n).attr("id").replace(t+l,i))})}},jQuery(document).bind("column_init column_change column_add",function(e,n){jQuery(n).cpac_bind_column_addon_events(),jQuery(n).cpac_bind_container_addon_events()}),jQuery.fn.cpac_bind_column_addon_events=function(){var e=jQuery(this),n=e.find("[data-toggle-id] label");n.on("click",function(){var n=jQuery(this).closest("td.input").data("toggle-id"),t=jQuery("input",this).val(),i=e.find('[data-indicator-id="'+n+'"]').removeClass("on");"on"==t&&i.addClass("on");var c=e.find('[data-additional-option-id="'+n+'"]').addClass("hide");"on"==t&&c.removeClass("hide")}),e.find("[data-toggle-id]").each(function(){var n=e.find('[data-additional-option-id="'+jQuery(this).data("toggle-id")+'"]').addClass("hide");"on"==jQuery("input:checked",this).val()&&n.removeClass("hide")})},jQuery.fn.cpac_bind_container_addon_events=function(){var e=jQuery(this),n=e.find("[data-indicator-id]");n.unbind("click").click(function(){var n=jQuery(this).data("indicator-id"),t=e.find('[data-toggle-id="'+n+'"] input');jQuery(this).hasClass("on")?(jQuery(this).removeClass("on").addClass("off"),t.filter("[value=off]").prop("checked",!0)):(jQuery(this).removeClass("off").addClass("on"),t.filter("[value=on]").prop("checked",!0))})};
1
+ function cpac_importexport(){jQuery("#php-export-results textarea").on("focus, mouseup",function(){jQuery(this).select()}).select().focus()}function cpac_submit_form(){jQuery(".form-update a.submit-update").click(function(e){e.preventDefault(),jQuery(this).closest(".columns-container").find(".cpac-columns form").submit()})}function cpac_create_column(e){var n=jQuery(".for-cloning-only .cpac-column",e).first().clone(),t=e.attr("data-type");return n.length>0&&(n.cpac_update_clone_id(t),jQuery(".cpac-columns form",e).append(n),n.column_bind_toggle(),n.column_bind_remove(),n.column_bind_clone(),n.column_bind_events(),cpac_sortable(),jQuery(document).trigger("column_add",n)),n}function cpac_add_column(){jQuery("#cpac .add_column").click(function(e){var n=jQuery(this).closest(".columns-container"),t=cpac_create_column(n);t.addClass("opened").find(".column-form").slideDown(150,function(){jQuery("html, body").animate({scrollTop:t.offset().top-58},300)}),e.preventDefault()})}function cpac_sidebar_feedback(){jQuery(function(e){var n=e(".sidebox#direct-feedback");n.find("#feedback-choice a.no").click(function(e){e.preventDefault(),n.find("#feedback-choice").slideUp(),n.find("#feedback-support").slideDown()}),n.find("#feedback-choice a.yes").click(function(e){e.preventDefault(),n.find("#feedback-choice").slideUp(),n.find("#feedback-rate").slideDown()})})}function cpac_clear_input_defaults(){jQuery.fn.cleardefault=function(){return this.focus(function(){this.value==this.defaultValue&&(this.value="")}).blur(function(){this.value.length||(this.value=this.defaultValue)})},jQuery("#cpac-box-plugin_settings .addons input").cleardefault()}function cpac_help(){jQuery("#cpac a.help").click(function(e){e.preventDefault();var n=jQuery("#contextual-help-wrap");n.parent().show(),jQuery('a[href="#tab-panel-cpac-'+jQuery(this).attr("data-help")+'"]',n).trigger("click"),n.slideDown("fast",function(){n.focus()})})}function cpac_pointer(){jQuery(".cpac-pointer").each(function(){var e=jQuery(this),n=e.attr("rel"),t=e.attr("data-pos"),i={at:"left top",my:"right top",edge:"right",offset:"0 0"};"right"==t&&(i={at:"right middle",my:"left middle",edge:"left"}),e.pointer({content:jQuery("#"+n).html(),position:i,pointerWidth:250,close:function(){e.removeClass("open")},pointerClass:"wp-pointer wp-pointer-"+i.edge}),e.click(function(){e.hasClass("open")?e.removeClass("open"):e.addClass("open")}),e.hover(function(){jQuery(this).pointer("open")},function(){e.hasClass("open")||jQuery(this).pointer("close")})})}function cpac_sortable(){jQuery("div.cpac-columns").each(function(){jQuery(this).hasClass("ui-sortable")?jQuery(this).sortable("refresh"):jQuery(this).sortable({items:".cpac-column"})})}function cpac_menu(){var e=jQuery("#cpac div.cpac-menu");e.find("a").click(function(e,n){var t=jQuery(this).attr("href");if(t){var i=t.replace("#cpac-box-","");jQuery(".cpac-menu a").removeClass("current"),jQuery(".columns-container").hide(),jQuery(this).addClass("current");var c=jQuery('.columns-container[data-type="'+i+'"]').show(),a=c.find(".cpac-columns");jQuery(document).trigger("cac_menu_change",a)}e.preventDefault()}),e.find("a.current").trigger("click")}jQuery(document).ready(function(){return 0===jQuery("#cpac").length?!1:(cpac_pointer(),cpac_submit_form(),cpac_clear_input_defaults(),cpac_sortable(),cpac_menu(),cpac_help(),cpac_add_column(),cpac_importexport(),cpac_sidebar_feedback(),void jQuery(".cpac-column").each(function(e,n){jQuery(n).column_bind_toggle(),jQuery(n).column_bind_remove(),jQuery(n).column_bind_clone(),jQuery(n).cpac_bind_container_addon_events()}))}),jQuery.fn.column_bind_toggle=function(){var e=jQuery(this);e.find("td.column_type a, td.column_edit, td.column_label a.toggle, td.column_label .edit-button").click(function(n){n.preventDefault(),e.toggleClass("opened").find(".column-form").slideToggle(150),e.hasClass("events-binded")||e.column_bind_events(),e.addClass("events-binded"),jQuery(document).trigger("column_init",e)})},jQuery.fn.column_bind_remove=function(){jQuery(this).find(".remove-button").click(function(e){jQuery(this).closest(".cpac-column").column_remove(),e.preventDefault()})},jQuery.fn.column_bind_clone=function(){jQuery(this).find(".clone-button").click(function(e){var n,t;e.preventDefault(),n=jQuery(this).closest(".cpac-column"),t=n.column_clone(),"undefined"!=typeof t&&t.removeClass("loading").hide().slideDown()})},jQuery.fn.cpac_column_refresh=function(){var e=jQuery(this);e.addClass("loading"),e.find(".column-form").prepend('<span class="spinner" />'),jQuery.post(ajaxurl,{plugin_id:"cpac",action:"cpac_column_refresh",column:jQuery(this).find("input.column-name").val(),formdata:jQuery(this).parents("form").serialize()},function(n){var t=jQuery("<div>"+n+"</div>").children();e.replaceWith(t),e=t,e.column_bind_toggle(),e.column_bind_remove(),e.column_bind_clone(),e.column_bind_events(),e.removeClass("loading").addClass("opened").find(".column-form").show(),jQuery(document).trigger("column_change",e)})},jQuery.fn.column_bind_events=function(){var e=jQuery(this),n=e.closest(".columns-container "),t=n.attr("data-type"),i=e.find(".column_type select option:selected").val();e.find(".column_type select").change(function(){var c=jQuery("optgroup",this).children(":selected"),a=c.val(),o=c.text(),r=jQuery(this).next(".msg").hide(),u=n.find('.for-cloning-only .cpac-column[data-type="'+a+'"]');if(u.length)if(u.find(".is-disabled").length)r.html(u.find(".is-disabled").html()).show(),jQuery(this).find("option").removeAttr("selected"),jQuery(this).find('option[value="'+i+'"]').attr("selected","selected");else{if("undefined"==typeof u.attr("data-clone")&&jQuery(".cpac-columns",n).find('[data-type="'+a+'"]').length)return r.html(cpac_i18n.clone.replace("%s","<strong>"+o+"</strong>")).show(),jQuery(this).find("option").removeAttr("selected"),void jQuery(this).find('option[value="'+i+'"]').attr("selected","selected");var l=u.clone();l.addClass("opened").find(".column-form").show(),l.find(".column-meta").replaceWith(e.find(".column-meta")),l.find(".column-form").replaceWith(e.find(".column-form")),l.cpac_update_clone_id(t),e.replaceWith(l),l.cpac_column_refresh()}}),e.find(".column_label .input input").bind("keyup change",function(){var e=jQuery(this).val();jQuery(this).closest(".cpac-column").find("td.column_label .inner > a.toggle").text(e)}),e.column_width_slider();var c=e.find(".column-meta span.width");c.on("update",function(){var n=e.find("input.width").val(),t=e.find("input.unit").filter(":checked").val();n>0?jQuery(this).text(n+t):jQuery(this).text("")});var a=e.find(".column_width .unit-select label");a.on("click",function(){e.find("span.unit").text(jQuery(this).find("input").val()),e.column_width_slider(),c.trigger("update")});var o=e.find("input.width").on("keyup",function(){e.column_width_slider(),jQuery(this).trigger("validate"),c.trigger("update")}).on("validate",function(){var e=o.val(),n=jQuery.trim(e);jQuery.isNumeric(n)||(n=n.replace(/\D/g,"")),n.length>3&&(n=n.substring(0,3)),0>=n&&(n=""),n!==e&&o.val(n)});e.find(".column_image_size label.custom-size").click(function(){var e=jQuery(this).closest(".input");jQuery(this).hasClass("image-size-custom")?(jQuery(".custom-size-w",e).removeClass("hidden"),jQuery(".custom-size-h",e).removeClass("hidden")):(jQuery(".custom-size-w",e).addClass("hidden"),jQuery(".custom-size-h",e).addClass("hidden"))}),e.find(".column-form .label label, .column-form .label .info").hover(function(){jQuery(this).parents(".label").find("p.description").show()},function(){jQuery(this).parents(".label").find("p.description").hide()}),e.find('[data-refresh="1"] select').change(function(){e.cpac_column_refresh()})},jQuery.fn.column_remove=function(){jQuery(this).addClass("deleting").animate({opacity:0,height:0},350,function(e){jQuery(this).remove()})},jQuery.fn.column_width_slider=function(){var e=jQuery(this).find(".column_width"),n=e.find("input.width"),t=e.find("input.unit"),i=t.filter(":checked").val(),c=n.val(),a=e.find(".width-slider"),o=jQuery(this).find(".column-meta span.width");"%"==i&&c>100&&(c=100),n.val(c),a.slider({range:"min",min:0,max:"%"==i?100:500,value:c,slide:function(e,t){n.val(t.value),o.trigger("update"),n.trigger("validate")}})},jQuery.fn.column_clone=function(){var e=jQuery(this).closest(".columns-container"),n=jQuery(this);if("undefined"==typeof n.attr("data-clone")){var t=cpac_i18n.clone.replace("%s","<strong>"+n.find(".column_label .toggle").text()+"</strong>");return n.addClass("opened").find(".column-form").slideDown(150),void n.find(".msg").html(t).show()}var i=jQuery(this).clone();return i.cpac_update_clone_id(e.attr("data-type")),jQuery(this).after(i),i.column_bind_toggle(),i.column_bind_remove(),i.column_bind_clone(),i.column_bind_events(),cpac_sortable(),jQuery(document).trigger("column_add",i),i},jQuery.fn.cpac_update_clone_id=function(e){var n=jQuery(this),t=n.attr("data-type"),i=jQuery('.columns-container[data-type="'+e+'"]').find(".cpac-columns"),c=jQuery(i).find('*[data-type="'+t+'"]').not(n),a=jQuery.map(c,function(e,n){return jQuery(e).attr("data-clone")?parseInt(jQuery(e).attr("data-clone"),10):0});a.sort();for(var o=Math.max.apply(null,a)+1,r=0;o>=r&&-1!==jQuery.inArray(r,a);r++);var u=n.attr("data-clone"),l="";u&&(l="-"+u),n.attr("data-clone",r),n.find("input.clone").val(r),n.find("input.column-name").val(t+"-"+r);var d=n.find("input, select, label");jQuery(d).each(function(e,n){var i=t+"-"+r;jQuery(n).attr("name")&&jQuery(n).attr("name",jQuery(n).attr("name").replace(t+l,i)),jQuery(n).attr("for")&&jQuery(n).attr("for",jQuery(n).attr("for").replace(t+l,i)),jQuery(n).attr("id")&&jQuery(n).attr("id",jQuery(n).attr("id").replace(t+l,i))})},jQuery(document).bind("column_init column_change column_add",function(e,n){jQuery(n).cpac_bind_column_addon_events(),jQuery(n).cpac_bind_container_addon_events()}),jQuery.fn.cpac_bind_column_addon_events=function(){var e=jQuery(this),n=e.find("[data-toggle-id] label");n.on("click",function(){var n=jQuery(this).closest("td.input").data("toggle-id"),t=jQuery("input",this).val(),i=e.find('[data-indicator-id="'+n+'"]').removeClass("on");"on"==t&&i.addClass("on");var c=e.find('[data-additional-option-id="'+n+'"]').addClass("hide");"on"==t&&c.removeClass("hide")}),e.find("[data-toggle-id]").each(function(){var n=e.find('[data-additional-option-id="'+jQuery(this).data("toggle-id")+'"]').addClass("hide");"on"==jQuery("input:checked",this).val()&&n.removeClass("hide")})},jQuery.fn.cpac_bind_container_addon_events=function(){var e=jQuery(this),n=e.find("[data-indicator-id]");n.unbind("click").click(function(){var n=jQuery(this).data("indicator-id"),t=e.find('[data-toggle-id="'+n+'"] input');jQuery(this).hasClass("on")?(jQuery(this).removeClass("on").addClass("off"),t.filter("[value=off]").prop("checked",!0)):(jQuery(this).removeClass("off").addClass("on"),t.filter("[value=on]").prop("checked",!0))})};
classes/column.php CHANGED
@@ -242,29 +242,12 @@ class CPAC_Column {
242
$this->options = (object) $this->options;
243
$this->properties = (object) $this->properties;
244
245
- // Read options from database
246
- $this->populate_options();
247
-
248
- $this->sanitize_label();
249
-
250
// Filters
251
foreach ( $this->properties as $name => $value ) {
252
$this->properties->{$name} = apply_filters( "cac/column/properties/{$name}", $value, $this );
253
}
254
}
255
256
- /**
257
- * Populate Options
258
- * Added $options parameter in 2.2
259
- *
260
- * @since 2.0
261
- *
262
- * @param array $options Optional. Options to populate the storage model with. Defaults to options from database.
263
- */
264
- public function populate_options( $options = null ) {
265
- $this->options = (object) array_merge( (array) $this->options, is_array( $options ) ? $options : $this->read() );
266
- }
267
-
268
/**
269
* @param string $property
270
*
@@ -486,20 +469,6 @@ class CPAC_Column {
486
echo $this->get_attr_id( $field_name );
487
}
488
489
- /**
490
- * @since 2.0
491
- * @return array Column options
492
- */
493
- public function read() {
494
- $options = (array) $this->storage_model->get_database_columns();
495
-
496
- if ( empty( $options[ $this->properties->name ] ) ) {
497
- return array();
498
- }
499
-
500
- return $options[ $this->properties->name ];
501
- }
502
-
503
/**
504
* @since 2.0
505
*/
@@ -531,6 +500,7 @@ class CPAC_Column {
531
}
532
533
if ( ! empty( $options['label'] ) ) {
534
535
// Label can not contains the character ":"" and "'", because
536
// CPAC_Column::get_sanitized_label() will return an empty string
@@ -539,6 +509,7 @@ class CPAC_Column {
539
$options['label'] = str_replace( ':', '', $options['label'] );
540
$options['label'] = str_replace( "'", '', $options['label'] );
541
}
542
}
543
544
// used by child classes for additional sanitizing
@@ -1188,7 +1159,7 @@ class CPAC_Column {
1188
<tr class="column_<?php echo $field_key; ?>">
1189
<?php $this->label_view( $label, $description, $field_key ); ?>
1190
<td class="input">
1191
- <input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->options->date_format; ?>" placeholder="<?php _e( 'Example:', 'codepress-admin-columns' ); ?> d M Y H:i"/>
1192
1193
<p class="description">
1194
<?php printf( __( "Leave empty for WordPress date format, change your <a href='%s'>default date format here</a>.", 'codepress-admin-columns' ), admin_url( 'options-general.php' ) . '#date_format_custom_radio' ); ?>
242
$this->options = (object) $this->options;
243
$this->properties = (object) $this->properties;
244
245
// Filters
246
foreach ( $this->properties as $name => $value ) {
247
$this->properties->{$name} = apply_filters( "cac/column/properties/{$name}", $value, $this );
248
}
249
}
250
251
/**
252
* @param string $property
253
*
469
echo $this->get_attr_id( $field_name );
470
}
471
472
/**
473
* @since 2.0
474
*/
500
}
501
502
if ( ! empty( $options['label'] ) ) {
503
+ $options['label'] = str_replace( 'data:', '%%data%%', $options['label'] ); // Temporary replace data: urls for image sources. Replace it back later
504
505
// Label can not contains the character ":"" and "'", because
506
// CPAC_Column::get_sanitized_label() will return an empty string
509
$options['label'] = str_replace( ':', '', $options['label'] );
510
$options['label'] = str_replace( "'", '', $options['label'] );
511
}
512
+ $options['label'] = str_replace( '%%data%%', 'data:', $options['label'] ); // Enable data:image url's
513
}
514
515
// used by child classes for additional sanitizing
1159
<tr class="column_<?php echo $field_key; ?>">
1160
<?php $this->label_view( $label, $description, $field_key ); ?>
1161
<td class="input">
1162
+ <input type="text" name="<?php $this->attr_name( $field_key ); ?>" id="<?php $this->attr_id( $field_key ); ?>" value="<?php echo $this->get_option( 'date_format' ); ?>" placeholder="<?php _e( 'Example:', 'codepress-admin-columns' ); ?> d M Y H:i"/>
1163
1164
<p class="description">
1165
<?php printf( __( "Leave empty for WordPress date format, change your <a href='%s'>default date format here</a>.", 'codepress-admin-columns' ), admin_url( 'options-general.php' ) . '#date_format_custom_radio' ); ?>
classes/column/custom-field.php CHANGED
@@ -41,7 +41,6 @@ class CPAC_Column_Custom_Field extends CPAC_Column {
41
$this->options['link_label'] = '';
42
43
$this->options['date_format'] = '';
44
- $this->options['date_save_format'] = '';
45
}
46
47
/**
41
$this->options['link_label'] = '';
42
43
$this->options['date_format'] = '';
44
}
45
46
/**
classes/storage_model.php CHANGED
@@ -56,6 +56,12 @@ abstract class CPAC_Storage_Model {
56
*/
57
public $page;
58
59
/**
60
* Uses PHP export to display settings
61
*
@@ -126,6 +132,22 @@ abstract class CPAC_Storage_Model {
126
$this->set_columns_filepath();
127
}
128
129
/**
130
* Set menutype
131
*
@@ -528,9 +550,10 @@ abstract class CPAC_Storage_Model {
528
*/
529
public function get_stored_columns() {
530
531
- $columns = $this->stored_columns;
532
-
533
- if ( $this->stored_columns === null ) {
534
$columns = $this->get_database_columns();
535
}
536
@@ -555,9 +578,6 @@ abstract class CPAC_Storage_Model {
555
*/
556
public function set_stored_columns( $columns ) {
557
$this->stored_columns = $columns;
558
-
559
- // columns settings are set by external plugin
560
- $this->php_export = true;
561
}
562
563
/**
@@ -569,6 +589,13 @@ abstract class CPAC_Storage_Model {
569
return $this->php_export;
570
}
571
572
/**
573
* @since 2.1.1
574
*/
@@ -686,26 +713,18 @@ abstract class CPAC_Storage_Model {
686
687
$columns = array();
688
689
- // get columns
690
if ( ! $this->default_wp_columns ) {
691
$this->default_wp_columns = $this->get_default_columns();
692
}
693
-
694
- $default_columns = $this->default_wp_columns;
695
-
696
- // TODO check if this solves the issue with not displaying value when using "manage_{$post_type}_posts_columns" at CPAC_Storage_Model_Post
697
$registered_columns = $this->get_registered_columns();
698
699
if ( $stored_columns = $this->get_stored_columns() ) {
700
- $stored_names = array();
701
702
foreach ( $stored_columns as $name => $options ) {
703
if ( ! isset( $options['type'] ) ) {
704
continue;
705
}
706
707
- $stored_names[] = $name;
708
-
709
// In case of a disabled plugin, we will skip column.
710
// This means the stored column type is not available anymore.
711
if ( ! in_array( $options['type'], array_keys( $registered_columns ) ) ) {
@@ -716,11 +735,8 @@ abstract class CPAC_Storage_Model {
716
$column = clone $registered_columns[ $options['type'] ];
717
$column->set_clone( $options['clone'] );
718
719
- // preload options when php export is being used
720
- $preload = $this->is_using_php_export() ? $options : false;
721
-
722
- // repopulate the options, so they contains the right stored options
723
- $column->populate_options( $preload );
724
725
$column->sanitize_label();
726
@@ -729,10 +745,10 @@ abstract class CPAC_Storage_Model {
729
730
// In case of an enabled plugin, we will add that column.
731
// When $diff contains items, it means a default column has not been stored.
732
- if ( $diff = array_diff( array_keys( $default_columns ), $this->get_default_stored_columns() ) ) {
733
foreach ( $diff as $name ) {
734
// because of the filter "manage_{$post_type}_posts_columns" the columns
735
- // that are being added by CPAC will also appear in the $default_columns.
736
// this will filter out those columns.
737
if ( isset( $columns[ $name ] ) ) {
738
continue;
@@ -748,13 +764,13 @@ abstract class CPAC_Storage_Model {
748
}
749
} // When nothing has been saved yet, we return the default WP columns.
750
else {
751
- foreach ( array_keys( $default_columns ) as $name ) {
752
if ( isset( $registered_columns[ $name ] ) ) {
753
$columns[ $name ] = clone $registered_columns[ $name ];
754
}
755
}
756
757
- /**
758
* Filter the columns that should be loaded if there were no stored columns
759
*
760
* @since 2.2.4
@@ -865,44 +881,13 @@ abstract class CPAC_Storage_Model {
865
return add_query_arg( array( 'page' => 'codepress-admin-columns', 'cpac_key' => $this->key ), admin_url( 'options-general.php' ) );
866
}
867
868
/**
869
- * @since 2.0.3
870
- * @global string $pagenow
871
- * @global object $current_screen
872
- * @return boolean
873
*/
874
- public function is_current_screen() {
875
-
876
- global $pagenow;
877
-
878
- if ( $this->page . '.php' != $pagenow ) {
879
- return false;
880
- }
881
-
882
- // posttypes
883
- if ( 'post' == $this->type ) {
884
- $post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : $this->type;
885
-
886
- if ( $this->key != $post_type ) {
887
- return false;
888
- }
889
- }
890
-
891
- // taxonomy
892
- if ( 'taxonomy' == $this->type ) {
893
- $taxonomy = isset( $_GET['taxonomy'] ) ? $_GET['taxonomy'] : '';
894
-
895
- if ( $this->taxonomy != $taxonomy ) {
896
- return false;
897
- }
898
- }
899
-
900
- // users
901
- if ( 'wp-users' == $this->key && is_network_admin() ) {
902
- return false;
903
- }
904
-
905
- return true;
906
}
907
908
/**
56
*/
57
public $page;
58
59
+ /**
60
+ * @since 2.4.10
61
+ * @var string
62
+ */
63
+ public $subpage;
64
+
65
/**
66
* Uses PHP export to display settings
67
*
132
$this->set_columns_filepath();
133
}
134
135
+ /**
136
+ * initialize callback for managing the headers and values for columns
137
+ * @since 2.4.10
138
+ *
139
+ */
140
+ public function init_manage_columns(){}
141
+
142
+ /**
143
+ * @since 2.0.3
144
+ * @return boolean
145
+ */
146
+ public function is_current_screen() {
147
+ global $pagenow;
148
+ return $this->page . '.php' === $pagenow && $this->subpage == filter_input( INPUT_GET, 'page' );
149
+ }
150
+
151
/**
152
* Set menutype
153
*
550
*/
551
public function get_stored_columns() {
552
553
+ if ( $this->is_using_php_export() ) {
554
+ $columns = $this->stored_columns;
555
+ }
556
+ else {
557
$columns = $this->get_database_columns();
558
}
559
578
*/
579
public function set_stored_columns( $columns ) {
580
$this->stored_columns = $columns;
581
}
582
583
/**
589
return $this->php_export;
590
}
591
592
+ /**
593
+ * @since 2.4.10
594
+ */
595
+ public function enable_php_export() {
596
+ $this->php_export = true;
597
+ }
598
+
599
/**
600
* @since 2.1.1
601
*/
713
714
$columns = array();
715
716
if ( ! $this->default_wp_columns ) {
717
$this->default_wp_columns = $this->get_default_columns();
718
}
719
$registered_columns = $this->get_registered_columns();
720
721
if ( $stored_columns = $this->get_stored_columns() ) {
722
723
foreach ( $stored_columns as $name => $options ) {
724
if ( ! isset( $options['type'] ) ) {
725
continue;
726
}
727
728
// In case of a disabled plugin, we will skip column.
729
// This means the stored column type is not available anymore.
730
if ( ! in_array( $options['type'], array_keys( $registered_columns ) ) ) {
735
$column = clone $registered_columns[ $options['type'] ];
736
$column->set_clone( $options['clone'] );
737
738
+ // merge default options with stored
739
+ $column->options = (object) array_merge( (array) $column->options, $options );
740
741
$column->sanitize_label();
742
745
746
// In case of an enabled plugin, we will add that column.
747
// When $diff contains items, it means a default column has not been stored.
748
+ if ( $diff = array_diff( array_keys( $this->default_wp_columns ), $this->get_default_stored_columns() ) ) {
749
foreach ( $diff as $name ) {
750
// because of the filter "manage_{$post_type}_posts_columns" the columns
751
+ // that are being added by CPAC will also appear in the $this->default_wp_columns.
752
// this will filter out those columns.
753
if ( isset( $columns[ $name ] ) ) {
754
continue;
764
}
765
} // When nothing has been saved yet, we return the default WP columns.
766
else {
767
+ foreach ( array_keys( $this->default_wp_columns ) as $name ) {
768
if ( isset( $registered_columns[ $name ] ) ) {
769
$columns[ $name ] = clone $registered_columns[ $name ];
770
}
771
}
772
773
+ /**te
774
* Filter the columns that should be loaded if there were no stored columns
775
*
776
* @since 2.2.4
881
return add_query_arg( array( 'page' => 'codepress-admin-columns', 'cpac_key' => $this->key ), admin_url( 'options-general.php' ) );
882
}
883
884
+
885
/**
886
+ * @deprecated deprecated since version 2.4.9
887
*/
888
+ public function is_columns_screen(){
889
+ _deprecated_function( 'is_columns_screen', '2.4.9', 'is_current_screen' );
890
+ return $this->is_current_screen();
891
}
892
893
/**
classes/storage_model/comment.php CHANGED
@@ -7,13 +7,13 @@ class CPAC_Storage_Model_Comment extends CPAC_Storage_Model {
7
8
public function __construct() {
9
10
- $this->key = 'wp-comments';
11
- $this->label = __( 'Comments' );
12
$this->singular_label = __( 'Comment' );
13
- $this->type = 'comment';
14
- $this->meta_type = 'comment';
15
- $this->page = 'edit-comments';
16
- $this->menu_type = 'other';
17
18
parent::__construct();
19
}
@@ -27,17 +27,6 @@ class CPAC_Storage_Model_Comment extends CPAC_Storage_Model {
27
add_action( 'manage_comments_custom_column', array( $this, 'manage_value' ), 100, 2 );
28
}
29
30
- public function is_current_screen() {
31
- $is_current_screen = parent::is_current_screen();
32
- if ( ! $is_current_screen ) {
33
- if ( ! empty( $_REQUEST['_ajax_nonce-replyto-comment'] ) && wp_verify_nonce( $_REQUEST['_ajax_nonce-replyto-comment'], 'replyto-comment' ) ) {
34
- $is_current_screen = true;
35
- }
36
- }
37
-
38
- return $is_current_screen;
39
- }
40
-
41
public function get_default_column_names() {
42
return array( 'cb', 'author', 'comment', 'response' );
43
}
7
8
public function __construct() {
9
10
+ $this->key = 'wp-comments';
11
+ $this->label = __( 'Comments' );
12
$this->singular_label = __( 'Comment' );
13
+ $this->type = 'comment';
14
+ $this->meta_type = 'comment';
15
+ $this->page = 'edit-comments';
16
+ $this->menu_type = 'other';
17
18
parent::__construct();
19
}
27
add_action( 'manage_comments_custom_column', array( $this, 'manage_value' ), 100, 2 );
28
}
29
30
public function get_default_column_names() {
31
return array( 'cb', 'author', 'comment', 'response' );
32
}
classes/storage_model/post.php CHANGED
@@ -4,23 +4,20 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
4
5
public $post_type;
6
7
- private $post_type_object;
8
-
9
/**
10
* @since 2.0
11
*/
12
public function __construct( $post_type ) {
13
14
- $this->set_post_type( $post_type );
15
-
16
- $this->key = $this->post_type;
17
- $this->label = $this->post_type_object->labels->name;
18
- $this->singular_label = $this->post_type_object->labels->singular_name;
19
$this->type = 'post';
20
$this->meta_type = 'post';
21
$this->page = 'edit';
22
$this->menu_type = 'post';
23
24
parent::__construct();
25
}
26
@@ -67,11 +64,12 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
67
}
68
69
/**
70
- * @since 2.3.5
71
*/
72
- private function set_post_type( $post_type ) {
73
- $this->post_type = $post_type;
74
- $this->post_type_object = get_post_type_object( $post_type );
75
}
76
77
/**
@@ -93,7 +91,8 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
93
// Run WordPress native actions to display column content
94
if ( is_post_type_hierarchical( $this->post_type ) ) {
95
do_action( 'manage_pages_custom_column', $column, $id );
96
- } else {
97
do_action( 'manage_posts_custom_column', $column, $id );
98
}
99
@@ -151,16 +150,9 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
151
* @since 2.2
152
*/
153
public function is_current_screen() {
154
155
- $is_current_screen = parent::is_current_screen();
156
-
157
- if ( ! $is_current_screen ) {
158
- if ( ! empty( $_REQUEST['_inline_edit'] ) && wp_verify_nonce( $_REQUEST['_inline_edit'], 'inlineeditnonce' ) ) {
159
- $is_current_screen = true;
160
- }
161
- }
162
-
163
- return $is_current_screen;
164
}
165
166
/**
@@ -244,7 +236,8 @@ class CPAC_Storage_Model_Post extends CPAC_Storage_Model {
244
ob_start();
245
$this->manage_value( $column_name, $post_id );
246
ob_end_clean();
247
- } else {
248
$this->manage_value( $column_name, $post_id );
249
}
250
}
4
5
public $post_type;
6
7
/**
8
* @since 2.0
9
*/
10
public function __construct( $post_type ) {
11
12
+ $this->key = $post_type;
13
+ $this->post_type = $post_type;
14
$this->type = 'post';
15
$this->meta_type = 'post';
16
$this->page = 'edit';
17
$this->menu_type = 'post';
18
19
+ $this->set_labels();
20
+
21
parent::__construct();
22
}
23
64
}
65
66
/**
67
+ * @since 2.7.2
68
*/
69
+ private function set_labels() {
70
+ $post_type_object = get_post_type_object( $this->post_type );
71
+ $this->label = $post_type_object->labels->name;
72
+ $this->singular_label = $post_type_object->labels->singular_name;
73
}
74
75
/**
91
// Run WordPress native actions to display column content
92
if ( is_post_type_hierarchical( $this->post_type ) ) {
93
do_action( 'manage_pages_custom_column', $column, $id );
94
+ }
95
+ else {
96
do_action( 'manage_posts_custom_column', $column, $id );
97
}
98
150
* @since 2.2
151
*/
152
public function is_current_screen() {
153
+ $post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post';
154
155
+ return ( $this->post_type === $post_type ) && parent::is_current_screen();
156
}
157
158
/**
236
ob_start();
237
$this->manage_value( $column_name, $post_id );
238
ob_end_clean();
239
+ }
240
+ else {
241
$this->manage_value( $column_name, $post_id );
242
}
243
}
classes/storage_model/user.php CHANGED
@@ -7,13 +7,13 @@ class CPAC_Storage_Model_User extends CPAC_Storage_Model {
7
*/
8
public function __construct() {
9
10
- $this->key = 'wp-users';
11
- $this->label = __( 'Users' );
12
$this->singular_label = __( 'User' );
13
- $this->type = 'user';
14
- $this->meta_type = 'user';
15
- $this->page = 'users';
16
- $this->menu_type = 'other';
17
18
parent::__construct();
19
}
@@ -27,6 +27,13 @@ class CPAC_Storage_Model_User extends CPAC_Storage_Model {
27
add_filter( 'manage_users_custom_column', array( $this, 'manage_value_callback' ), 100, 3 );
28
}
29
30
/**
31
* @since 2.4.7
32
*/
@@ -55,7 +62,7 @@ class CPAC_Storage_Model_User extends CPAC_Storage_Model {
55
do_action( "cac/columns/default/storage_key={$this->key}" );
56
57
// get columns
58
- $table = _get_list_table( 'WP_Users_List_Table', array( 'screen' => 'users' ) );
59
$columns = (array) $table->get_columns();
60
61
if ( cac_is_setting_screen() ) {
7
*/
8
public function __construct() {
9
10
+ $this->key = 'wp-users';
11
+ $this->label = __( 'Users' );
12
$this->singular_label = __( 'User' );
13
+ $this->type = 'user';
14
+ $this->meta_type = 'user';
15
+ $this->page = 'users';
16
+ $this->menu_type = 'other';
17
18
parent::__construct();
19
}
27
add_filter( 'manage_users_custom_column', array( $this, 'manage_value_callback' ), 100, 3 );
28
}
29
30
+ /**
31
+ * @since 2.4.10
32
+ */
33
+ public function is_current_screen() {
34
+ return ! is_network_admin() && parent::is_current_screen();
35
+ }
36
+
37
/**
38
* @since 2.4.7
39
*/
62
do_action( "cac/columns/default/storage_key={$this->key}" );
63
64
// get columns
65
+ $table = _get_list_table( 'WP_Users_List_Table', array( 'screen' => 'users' ) );
66
$columns = (array) $table->get_columns();
67
68
if ( cac_is_setting_screen() ) {
codepress-admin-columns.php CHANGED
@@ -1,7 +1,7 @@
1
<?php
2
/*
3
Plugin Name: Admin Columns
4
- Version: 2.4.9
5
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
Author: AdminColumns.com
7
Author URI: https://www.admincolumns.com
@@ -10,7 +10,7 @@ Text Domain: codepress-admin-columns
10
Domain Path: /languages
11
License: GPLv2
12
13
- Copyright 2011-2015 AdminColumns.com info@admincolumns.com
14
15
This program is free software; you can redistribute it and/or modify
16
it under the terms of the GNU General Public License version 2 as published by
@@ -32,7 +32,7 @@ if ( ! defined( 'ABSPATH' ) ) {
32
}
33
34
// Plugin information
35
- define( 'CPAC_VERSION', '2.4.9' ); // Current plugin version
36
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
@@ -215,6 +215,7 @@ class CPAC {
215
foreach ( $this->exported_columns as $model => $columns ) {
216
if ( $storage_model = $this->get_storage_model( $model ) ) {
217
$storage_model->set_stored_columns( $columns );
218
}
219
}
220
}
@@ -336,6 +337,7 @@ class CPAC {
336
foreach ( $this->storage_models as $storage_model ) {
337
if ( $storage_model->is_current_screen() ) {
338
$this->current_storage_model = $storage_model;
339
}
340
}
341
}
1
<?php
2
/*
3
Plugin Name: Admin Columns
4
+ Version: 2.4.10
5
Description: Customize columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
6
Author: AdminColumns.com
7
Author URI: https://www.admincolumns.com
10
Domain Path: /languages
11
License: GPLv2
12
13
+ Copyright 2011-2016 AdminColumns.com info@admincolumns.com
14
15
This program is free software; you can redistribute it and/or modify
16
it under the terms of the GNU General Public License version 2 as published by
32
}
33
34
// Plugin information
35
+ define( 'CPAC_VERSION', '2.4.10' ); // Current plugin version
36
define( 'CPAC_UPGRADE_VERSION', '2.0.0' ); // Latest version which requires an upgrade
37
define( 'CPAC_URL', plugin_dir_url( __FILE__ ) );
38
define( 'CPAC_DIR', plugin_dir_path( __FILE__ ) );
215
foreach ( $this->exported_columns as $model => $columns ) {
216
if ( $storage_model = $this->get_storage_model( $model ) ) {
217
$storage_model->set_stored_columns( $columns );
218
+ $storage_model->enable_php_export();
219
}
220
}
221
}
337
foreach ( $this->storage_models as $storage_model ) {
338
if ( $storage_model->is_current_screen() ) {
339
$this->current_storage_model = $storage_model;
340
+ break;
341
}
342
}
343
}
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: codepress, tschutter, davidmosterd, engelen, dungengronovius
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
4
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
Requires at least: 3.5
6
- Tested up to: 4.4.1
7
- Stable tag: 2.4.9
8
9
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
@@ -67,25 +67,29 @@ Admin Columns can change your post (posts, pages and custom post types), user, c
67
* Comment Count
68
* Comment Status
69
* Comments
70
* Custom Field
71
- * Date
72
* Excerpt
73
* Featured Image
74
* ID
75
* Modified
76
* Order
77
* Page Template
78
* Parent
79
* Permalink
80
* Ping Status
81
* Post Format
82
* Roles
83
* Slug
84
* Status
85
* Sticky
86
- * Tags
87
* Taxonomy
88
- * Title
89
* Word Count
90
91
= User columns =
@@ -101,7 +105,6 @@ Admin Columns can change your post (posts, pages and custom post types), user, c
101
* Name
102
* Nickname
103
* Post Count
104
- * Posts
105
* Registered Date
106
* Role
107
* URL
@@ -111,11 +114,10 @@ Admin Columns can change your post (posts, pages and custom post types), user, c
111
112
* Actions
113
* Alternate Text
114
- * Author
115
* Caption
116
- * Comments
117
* Custom Field
118
- * Date
119
* Description
120
* Dimensions
121
* EXIF Data
@@ -124,36 +126,32 @@ Admin Columns can change your post (posts, pages and custom post types), user, c
124
* File Size
125
* Full Path
126
* Height
127
- * Icon
128
* ID
129
* Mime Type
130
* Taxonomy
131
- * Uploaded To
132
* Width
133
134
= Comment columns =
135
136
* Actions
137
- * Alternate Text
138
* Author
139
- * Caption
140
- * Comments
141
* Custom Field
142
* Date
143
- * Description
144
- * Dimensions
145
- * EXIF Data
146
- * File
147
- * File Name
148
- * File Size
149
- * Full Path
150
- * Height
151
- * Icon
152
* ID
153
- * Mime Type
154
- * Taxonomy
155
- * Uploaded To
156
- * Width
157
158
= Docs & Support =
159
Is this the first time you're using Admin Columns? Check out our Getting Started guide.
@@ -212,6 +210,14 @@ You can find a list of the available actions and filters (and examples on how to
212
213
== Changelog ==
214
215
= 2.4.9 =
216
* [Added] Display format Url added to Custom Fields
217
* [Added] Allow the use of before and after fields for all columns. Use add_filter( 'cac/column/properties/use_before_after', '__return_true' ).
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ZDZRSYLQ4Z76J
4
Tags: plugins, wordpress, admin, column, columns, custom columns, custom fields, image, dashboard, sortable, filters, posts, media, users, pages, posttypes, manage columns, wp-admin
5
Requires at least: 3.5
6
+ Tested up to: 4.4.2
7
+ Stable tag: 2.4.10
8
9
Customise columns on the administration screens for post(types), pages, media, comments, links and users with an easy to use drag-and-drop interface.
10
67
* Comment Count
68
* Comment Status
69
* Comments
70
+ * Content
71
* Custom Field
72
+ * Date Published
73
+ * Page Depth
74
+ * Estimated Reading Time
75
* Excerpt
76
* Featured Image
77
+ * Formats
78
* ID
79
* Modified
80
* Order
81
* Page Template
82
* Parent
83
+ * Path
84
* Permalink
85
* Ping Status
86
* Post Format
87
* Roles
88
+ * Shortcodes
89
* Slug
90
* Status
91
* Sticky
92
* Taxonomy
93
* Word Count
94
95
= User columns =
105
* Name
106
* Nickname
107
* Post Count
108
* Registered Date
109
* Role
110
* URL
114
115
* Actions
116
* Alternate Text
117
+ * Attached To
118
+ * Available Sizes
119
* Caption
120
* Custom Field
121
* Description
122
* Dimensions
123
* EXIF Data
126
* File Size
127
* Full Path
128
* Height
129
* ID
130
* Mime Type
131
* Taxonomy
132
* Width
133
134
= Comment columns =
135
136
* Actions
137
+ * Agent
138
+ * Approved
139
* Author
140
+ * Avatar
141
* Custom Field
142
+ * Email
143
+ * IP
144
+ * Name
145
+ * URL
146
* Date
147
+ * Date GMT
148
+ * Excerpt
149
* ID
150
+ * Post
151
+ * Reply To
152
+ * Type
153
+ * User
154
+ * Word Count
155
156
= Docs & Support =
157
Is this the first time you're using Admin Columns? Check out our Getting Started guide.
210
211
== Changelog ==
212
213
+ = 2.4.10 =
214
+ * [Fixed] Data:image sources for images are supported in labels
215
+ * [Fixed] Cloned columns no longer has the wrong options when stored
216
+ * [Fixed] Created deprecated function for is_columns_screen()
217
+ * [Fixed] The method get_current_storage_model returns the first occurrence instead of running the entire array of storage modals
218
+ * [Fixed] The storage_model object should have the init_manage_columns method to properly load the columns heading and values
219
+ * [Fixed] The storage_model object can now be used within sub pages
220
+
221
= 2.4.9 =
222
* [Added] Display format Url added to Custom Fields
223
* [Added] Allow the use of before and after fields for all columns. Use add_filter( 'cac/column/properties/use_before_after', '__return_true' ).