TablePress - Version 1.9.2

Version Description

This update is a stability, maintenance, and compatibility release. Updating is recommended.

Download this release

Release Info

Developer TobiasBg
Plugin Icon 128x128 TablePress
Version 1.9.2
Comparing to
See all releases

Code changes from version 1.9.1 to 1.9.2

admin/css/edit.css CHANGED
@@ -25,7 +25,8 @@ body.wait * {
25
  /* Allow wide tables to scroll sideways, only on "Edit" screen */
26
  body,
27
  #wpwrap,
28
- #wpbody-content {
 
29
  overflow: visible !important; /* !important is necessary to override an inline style that postboxes.js sets via JS */
30
  }
31
 
25
  /* Allow wide tables to scroll sideways, only on "Edit" screen */
26
  body,
27
  #wpwrap,
28
+ #wpbody-content,
29
+ div#post-body.metabox-holder.columns-1 {
30
  overflow: visible !important; /* !important is necessary to override an inline style that postboxes.js sets via JS */
31
  }
32
 
admin/css/edit.min.css CHANGED
@@ -1 +1 @@
1
- body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#wpbody-content,#wpwrap,body{overflow:visible!important}#TB_HideSelect{z-index:301099}#TB_overlay,.media-modal{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}body #wp-link-backdrop{z-index:100103}#table-preview-iframe{width:100%;height:100%}#table-preview{height:100%;margin:-2px -15px -15px -15px}#advanced-editor{padding:5px}#advanced-editor .wp-editor-container{border:none}#advanced-editor .submitbox{padding:5px 5px 0;font-size:12px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:30px}.spinner.animation-preview,.spinner.animation-saving{float:none;margin:0 0 0 6px}#tablepress-page div.ajax-alert{margin:-10px 0 15px}#tablepress-page div.ajax-alert p{font-weight:700}#tablepress-page div.ajax-alert pre{margin:-6px 0 .5em 2px}#tablepress-page div.ajax-alert pre+p{display:none}#tablepress-page #tablepress_edit-table-data{display:inline-block;min-width:99.9%}#tablepress-page #tablepress_edit-table-data.hide-if-js{display:none}#tablepress-page .small-text{width:65px;padding:3px 5px}#tablepress-page #table-new-id{width:120px}#table-information-shortcode,#tablepress-page .button{vertical-align:middle}#edit-form-body td{padding:2px 1px;height:32px}#edit-form-body .focus td,.no-js #edit-form-body td{height:70px}#edit-form-body .odd{background-color:#f1f1f1}#edit-form-body textarea{display:block;min-width:150px;width:100%;width:auto\0/IE;height:100%;resize:both}#edit-form-body textarea:focus{border-color:#333}#tablepress-page input[type=text],#tablepress-page select,#tablepress-page textarea{-webkit-box-shadow:none;box-shadow:none;-webkit-transition:none;transition:none}#edit-form-foot input[type=checkbox]{margin:6px 0 3px}#edit-form{border-collapse:collapse}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;text-align:center;font-weight:700}.js #edit-form .move-handle{cursor:move}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:64px}#edit-form-body .foot-row,#edit-form-body .head-row{background-color:#d9edf7}#edit-form-head .sort-control{float:right;height:18px;cursor:pointer;margin-right:2px}#edit-form-head .sorting-indicator{visibility:visible}#edit-form-head .sort-asc .sorting-indicator:before{content:'\f142'}#edit-form-head .sort-desc .sorting-indicator:before{content:'\f140'}#edit-form .column-hidden,#edit-form .column-hidden textarea,#edit-form .row-hidden td,#edit-form .row-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation .column-1{width:45%}#tablepress_edit-table-manipulation .column-2{width:55%}.checkbox-left{padding-left:24px}
1
+ body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#wpbody-content,#wpwrap,body,div#post-body.metabox-holder.columns-1{overflow:visible!important}#TB_HideSelect{z-index:301099}#TB_overlay,.media-modal{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}body #wp-link-backdrop{z-index:100103}#table-preview-iframe{width:100%;height:100%}#table-preview{height:100%;margin:-2px -15px -15px -15px}#advanced-editor{padding:5px}#advanced-editor .wp-editor-container{border:none}#advanced-editor .submitbox{padding:5px 5px 0;font-size:12px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:30px}.spinner.animation-preview,.spinner.animation-saving{float:none;margin:0 0 0 6px}#tablepress-page div.ajax-alert{margin:-10px 0 15px}#tablepress-page div.ajax-alert p{font-weight:700}#tablepress-page div.ajax-alert pre{margin:-6px 0 .5em 2px}#tablepress-page div.ajax-alert pre+p{display:none}#tablepress-page #tablepress_edit-table-data{display:inline-block;min-width:99.9%}#tablepress-page #tablepress_edit-table-data.hide-if-js{display:none}#tablepress-page .small-text{width:65px;padding:3px 5px}#tablepress-page #table-new-id{width:120px}#table-information-shortcode,#tablepress-page .button{vertical-align:middle}#edit-form-body td{padding:2px 1px;height:32px}#edit-form-body .focus td,.no-js #edit-form-body td{height:70px}#edit-form-body .odd{background-color:#f1f1f1}#edit-form-body textarea{display:block;min-width:150px;width:100%;width:auto\0/IE;height:100%;resize:both}#edit-form-body textarea:focus{border-color:#333}#tablepress-page input[type=text],#tablepress-page select,#tablepress-page textarea{-webkit-box-shadow:none;box-shadow:none;-webkit-transition:none;transition:none}#edit-form-foot input[type=checkbox]{margin:6px 0 3px}#edit-form{border-collapse:collapse}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;text-align:center;font-weight:700}.js #edit-form .move-handle{cursor:move}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:64px}#edit-form-body .foot-row,#edit-form-body .head-row{background-color:#d9edf7}#edit-form-head .sort-control{float:right;height:18px;cursor:pointer;margin-right:2px}#edit-form-head .sorting-indicator{visibility:visible}#edit-form-head .sort-asc .sorting-indicator:before{content:'\f142'}#edit-form-head .sort-desc .sorting-indicator:before{content:'\f140'}#edit-form .column-hidden,#edit-form .column-hidden textarea,#edit-form .row-hidden td,#edit-form .row-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation .column-1{width:45%}#tablepress_edit-table-manipulation .column-2{width:55%}.checkbox-left{padding-left:24px}
admin/js/edit.min.js CHANGED
@@ -1 +1 @@
1
- window.tp=window.tp||{},jQuery(document).ready(function(i){"use strict";var l=function(e){return i(document.getElementById(e))};tp.made_changes=!1,tp.table={id:l("table-id").val(),new_id:l("table-new-id").val(),rows:parseInt(l("number-rows").val(),10),columns:parseInt(l("number-columns").val(),10),head:l("option-table-head").prop("checked"),foot:l("option-table-foot").prop("checked"),no_data_columns_pre:2,no_data_columns_post:1,body_cells_pre:'<tr><td><span class="move-handle"></span></td><td><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][rows][]" value="1" /></td>',body_cells_post:'<td><span class="move-handle"></span></td></tr>',body_cell:'<td><textarea rows="1"></textarea></td>',head_cell:'<th class="head"><span class="sort-control sort-desc" title="'+tablepress_strings.sort_desc+'"><span class="sorting-indicator"></span></span><span class="sort-control sort-asc" title="'+tablepress_strings.sort_asc+'"><span class="sorting-indicator"></span></span><span class="move-handle"></span></th>',foot_cell:'<th><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][columns][]" value="1" /></th>',set_table_changed:function(){tp.made_changes=!0},unset_table_changed:function(){tp.made_changes=!1,l("edit-form-body").one("change","textarea",tp.table.set_table_changed),i("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){return""===i.trim(l("table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),void l("table-new-id").val(tp.table.new_id).focus().select()):"0"===i.trim(l("table-new-id").val())?(alert(tablepress_strings.table_id_not_zero),void l("table-new-id").val(tp.table.new_id).focus().select()):void(this.value!==tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)?(tp.table.new_id=this.value,i(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):i(this).val(tp.table.new_id)))},change_table_head:function(){tp.table.head=i(this).prop("checked"),l("option-use-datatables").prop("disabled",!tp.table.head).change(),l("notice-datatables-head-row").toggle(!tp.table.head),tp.rows.stripe()},change_table_foot:function(){tp.table.foot=i(this).prop("checked"),tp.rows.stripe()},change_print_name_description:function(){l(this.id+"-position").prop("disabled",!i(this).prop("checked"))},change_datatables:function(){var e=l("option-use-datatables"),t=!(e.prop("checked")&&!e.prop("disabled"));e.closest("tbody").find("input").not(e).prop("disabled",t),tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var e=l("option-datatables-paginate"),t=e.prop("checked")&&!e.prop("disabled");l("option-datatables-lengthchange").prop("disabled",!t),l("option-datatables-paginate_entries").prop("disabled",!t)},prepare_ajax_request:function(e,t){var a,n=l("edit-form-body"),o=[],s={rows:tp.table.rows,columns:tp.table.columns,hidden_rows:0,hidden_columns:0},r={rows:[],columns:[]};return n.children().each(function(e,t){o[e]=i(t).find("textarea").map(function(){return i(this).val()}).get()}),o=JSON.stringify(o),a={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:l("option-alternating-row-colors").prop("checked"),row_hover:l("option-row-hover").prop("checked"),print_name:l("option-print-name").prop("checked"),print_description:l("option-print-description").prop("checked"),print_name_position:l("option-print-name-position").val(),print_description_position:l("option-print-description-position").val(),extra_css_classes:l("option-extra-css-classes").val(),use_datatables:l("option-use-datatables").prop("checked"),datatables_sort:l("option-datatables-sort").prop("checked"),datatables_filter:l("option-datatables-filter").prop("checked"),datatables_paginate:l("option-datatables-paginate").prop("checked"),datatables_lengthchange:l("option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:l("option-datatables-paginate_entries").val(),datatables_info:l("option-datatables-info").prop("checked"),datatables_scrollx:l("option-datatables-scrollx").prop("checked"),datatables_custom_commands:l("option-datatables-custom-commands").val()},a=JSON.stringify(a),r.rows=n.find('input[type="hidden"]').map(function(){return"1"===i(this).val()?1:(s.hidden_rows+=1,0)}).get(),r.columns=l("edit-form-foot").find('input[type="hidden"]').map(function(){return"1"===i(this).val()?1:(s.hidden_columns+=1,0)}).get(),r=JSON.stringify(r),{action:e,_ajax_nonce:i(t).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:l("table-name").val(),description:l("table-description").val(),number:s,data:o,options:a,visibility:r}}},preview:{trigger:function(){return tp.made_changes?l("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(l("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void l("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(l("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void l("option-extra-css-classes").focus().select()):(i(this).closest("p").append('<span class="animation-preview spinner is-active" title="'+tablepress_strings.preparing_preview+'"/>'),i("body").addClass("wait"),l("table-preview").empty(),i.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),success:tp.table.preview.ajax_success,error:tp.table.preview.ajax_error,dataType:"json"}),!1):(tp.table.preview.show(i(this).attr("href")+"&TB_iframe=true"),!1)},ajax_success:function(e,t){void 0===t||"success"!==t?tp.table.preview.error("AJAX call successful, but unclear status."):null==e||"-1"===e||void 0===e.success||!0!==e.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(e)},ajax_error:function(e,t,a){tp.table.preview.error("AJAX call failed: "+t+" - "+a)},success:function(t){l("table-preview").empty(),i('<iframe id="table-preview-iframe" />').load(function(){var e=i(this).contents();e.find("head").append(t.head_html),e.find("body").append(t.body_html)}).appendTo("#table-preview"),i(".animation-preview").remove(),i("body").removeClass("wait"),tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(e){i(".animation-preview").closest("p").after('<div class="ajax-alert preview-error error"><p>'+tablepress_strings.preview_error+": "+e+"</p></div>"),i(".animation-preview").remove(),i(".preview-error").delay(6e3).fadeOut(2e3,function(){i(this).remove()}),i("body").removeClass("wait")},show:function(e){var t=i(window).width()-120,a=i(window).height()-120;i("#wpadminbar").length&&(a-=parseInt(i("#wpadminbar").css("height"),10)),tb_show(i(".show-preview-button").first().text(),e+"&height="+a+"&width="+t,!1)}}},tp.rows={create:function(e){var t,a,n,o="";for(t=0;t<e;t++){for(o+=tp.table.body_cells_pre,a=0;a<tp.table.columns;a++)o+=tp.table.body_cell;o+=tp.table.body_cells_post}return n=l("edit-form-foot").find(".column-hidden").map(function(){return i(this).index()}).get(),i(o).each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,n)}).addClass("column-hidden")})},append:function(){var e=l("rows-append-number").val();if(!/^[1-9][0-9]{0,4}$/.test(e))return alert(tablepress_strings.append_num_rows_invalid),void l("rows-append-number").focus().select();l("edit-form-body").append(tp.rows.create(e)),tp.rows.stripe(),tp.reindex()},insert:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},duplicate:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.each(function(e,t){var a=i(t),n=a.find("textarea"),o=a.clone();o.find("textarea").removeAttr("id").each(function(e,t){i(t).val(n.eq(e).val())}),a.after(o)}),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},hide:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},unhide:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},remove:function(){var e,t=l("edit-form-body").find("input:checked").closest("tr");0!==t.length?tp.table.rows!==t.length?(e=1===t.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(e)&&(t.remove(),tp.rows.stripe(),tp.reindex())):alert(tablepress_strings.no_remove_all_rows):alert(tablepress_strings.no_rows_selected)},move:{start:function(e,t){i(t.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>'),i(t.helper).removeClass("odd head-row foot-row")},change:function(e,t){tp.rows.stripe(t.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var a=i(this).parent().index(),n=i(this).hasClass("sort-asc")?1:-1,e=i("#edit-form-body"),t=e.find(".head-row").prevAll().addBack(),o=e.find(".foot-row").nextAll().addBack(),s=e.children().not(t).not(o).get();i.each(s,function(e,t){t.sort_key=(""+i(t).children().eq(a).find("textarea").val()).toLowerCase()}),s.sort(function(e,t){return n*function(e,t){var a,n,o=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,s=/^\s+|\s+$/g,r=/\s+/g,i=/^0x[0-9a-f]+$/i,l=/^0/,c=e.replace(s,"")||"",d=t.replace(s,"")||"",p=c.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),u=d.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(c.match(i),16)||1!==p.length&&Date.parse(c),_=parseInt(d.match(i),16)||h&&d.match(/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/)&&Date.parse(d)||null,m=function(e,t){return(!e.match(l)||1===t)&&parseFloat(e)||e.replace(r," ").replace(s,"")||0};if(_){if(h<_)return-1;if(_<h)return 1}for(var b=0,f=p.length,v=u.length,g=Math.max(f,v);b<g;b++){if(a=m(p[b]||"",f),n=m(u[b]||"",v),isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(/[^\x00-\x80]/.test(a+n)&&a.localeCompare){var w=a.localeCompare(n);return w/Math.abs(w)}if(a<n)return-1;if(n<a)return 1}}(e.sort_key,t.sort_key)}),i.each(s,function(e,t){t.sort_key=null}),e.append(t),e.append(s),e.append(o),tp.rows.stripe(),tp.reindex()},stripe:function(e){void 0===e&&(e=null),e=i(e);var t=l("edit-form-body").children().removeClass("odd head-row foot-row").not(e);t.filter(":even").addClass("odd"),t=t.not(".row-hidden"),e.hasClass("row-hidden")&&(t=t.not(".ui-sortable-placeholder")),tp.table.head&&t.first().addClass("head-row"),tp.table.foot&&t.last().addClass("foot-row")}},tp.columns={append:function(){var e,t=l("columns-append-number").val(),a="",n="",o="";if(!/^[1-9][0-9]{0,4}$/.test(t))return alert(tablepress_strings.append_num_columns_invalid),void l("columns-append-number").focus().select();for(e=0;e<t;e++)n+=tp.table.body_cell,a+=tp.table.head_cell,o+=tp.table.foot_cell;l("edit-form-body").children().each(function(e,t){i(t).children().slice(-tp.table.no_data_columns_post).before(n)}),l("edit-form-head").children().slice(-tp.table.no_data_columns_post).before(a),l("edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(o),tp.reindex()},insert:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).before(tp.table.body_cell)}),l("edit-form-head").children().filter(function(e){return-1!==i.inArray(e,a)}).before(tp.table.head_cell),t.before(tp.table.foot_cell),tp.reindex()):alert(tablepress_strings.no_columns_selected)},duplicate:function(e){var o,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(o=t.map(function(){return i(this).index()}).get(),l("edit-form").find("tr").each(function(e,t){i(t).children().each(function(e,t){if(-1!==i.inArray(e,o)){var a=i(t),n=a.clone();n.find("textarea").removeAttr("id").val(a.find("textarea").val()),a.after(n)}})}),tp.reindex()):alert(tablepress_strings.no_columns_selected)},hide:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).addClass("column-hidden")}),t.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},unhide:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).removeClass("column-hidden")}),t.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},remove:function(){var a,e,t=l("edit-form-foot").find("input:checked").closest("th");0!==t.length?tp.table.columns!==t.length?(e=1===t.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(e)&&(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).remove()}),t.remove(),tp.reindex())):alert(tablepress_strings.no_remove_all_columns):alert(tablepress_strings.no_columns_selected)},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(e,t){var a,n=i(t.item);tp.columns.move.source_idx=n.index(),tp.columns.move.$rows=l("edit-form-body").children().add("#edit-form-foot"),tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=i(this),i('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell),tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide(),tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"),a=tp.columns.move.$helper.eq(1).width(),tp.columns.move.$helper.eq(0).width(a),tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder"),tp.columns.move.$placeholder.find("div").width(a)},change:function(e,t){tp.columns.move.target_idx=i(t.placeholder).index(),tp.columns.move.target_idx-tp.columns.move.source_idx==1?tp.columns.move.target_idx+=1:tp.columns.move.target_idx===tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=i(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))}),tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(e,t){tp.columns.move.$helper.css("left",t.position.left)},stop:function(){tp.columns.move.$helper.remove(),tp.columns.move.$cells.each(function(){tp.columns.move.$cell=i(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(),tp.columns.move.$placeholder.remove(),tp.columns.move.source_idx=tp.columns.move.target_idx=-1,tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null,tp.reindex()}},number_to_letter:function(e){for(var t="";0<e;)t=String.fromCharCode(65+(e-1)%26)+t,e=Math.floor((e-1)/26);return t}},tp.cells={$focus:i(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus"),tp.cells.$focus=i(this).closest("tr").addClass("focus")},advanced_editor:{prompt_shown:!1,keyopen:function(e){if(e.shiftKey){var t=l("advanced-editor-content");tp.cells.$textarea=i(this).blur(),t.val(tp.cells.$textarea.val()),l("advanced-editor").wpdialog("open"),t.get(0).selectionStart=t.get(0).selectionEnd=t.val().length,t.focus()}},buttonopen:function(){(tp.cells.advanced_editor.prompt_shown||confirm(tablepress_strings.advanced_editor_open))&&(tp.cells.advanced_editor.prompt_shown=!0,l("edit-form-body").one("click","textarea",function(){var e=l("advanced-editor-content");tp.cells.$textarea=i(this).blur(),e.val(tp.cells.$textarea.val()),l("advanced-editor").wpdialog("open"),e.get(0).selectionStart=e.get(0).selectionEnd=e.val().length,e.focus()}))},save:function(){var e=l("advanced-editor-content").blur().val();tp.cells.$textarea.val()!==e&&(tp.cells.$textarea.val(e),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed()),tp.cells.$textarea.focus(),tp.cells.advanced_editor.close()},close:function(){return l("advanced-editor").wpdialog("close"),!1}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(e){if("undefined"===e.shiftKey)return!0;if(e.shiftKey){if(!tp.cells.checkboxes.last_clicked[e.data.parent])return!0;var t=i(e.data.parent).find(":checkbox"),a=t.index(tp.cells.checkboxes.last_clicked[e.data.parent]),n=t.index(this);a!==n&&t.slice(Math.min(a,n),Math.max(a,n)).prop("checked",i(this).prop("checked"))}return tp.cells.checkboxes.last_clicked[e.data.parent]=this,!0}}},tp.content={link:{prompt_shown:!1,add:function(){(tp.content.link.prompt_shown||confirm(tablepress_strings.link_add))&&(tp.content.link.prompt_shown=!0,l("edit-form-body").one("mousedown","textarea",function(){var e=this.id;i(document).one("mouseup",function(){"undefined"!=typeof wpLink&&(wpLink.open(e),tp.table.set_table_changed())})}))}},image:{prompt_shown:!1,add:function(){(tp.content.image.prompt_shown||confirm(tablepress_strings.image_add))&&(tp.content.image.prompt_shown=!0,l("edit-form-body").one("click","textarea",function(){var e=this.id,t={frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0};this.selectionStart=this.selectionEnd=this.value.length,i(this).blur(),wp.media.editor.open(e,t),tp.table.set_table_changed()}))}},span:{prompt_shown:!1,add:function(n){var e="#rowspan#"===n?tablepress_strings.rowspan_add:tablepress_strings.colspan_add;if(!1===tp.content.span.prompt_shown&&(tp.content.span.prompt_shown={},tp.content.span.prompt_shown["#rowspan#"]=tp.content.span.prompt_shown["#colspan#"]=!1),l("option-use-datatables").prop("checked")){if(!confirm(tablepress_strings.span_add_datatables_warning))return;l("option-use-datatables").prop("checked",!1).change()}(tp.content.span.prompt_shown[n]||confirm(e))&&(tp.content.span.prompt_shown[n]=!0,l("edit-form-body").one("click","textarea",function(){var e=i(this),t=e.parent().index(),a=e.closest("tr").index();if("#rowspan#"===n){if(0===a)return void alert(tablepress_strings.no_rowspan_first_row);if(tp.table.head&&1===a)return void alert(tablepress_strings.no_rowspan_table_head);if(tp.table.foot&&tp.table.rows-1===a)return void alert(tablepress_strings.no_rowspan_table_foot)}else if("#colspan#"===n&&tp.table.no_data_columns_pre===t)return void alert(tablepress_strings.no_colspan_first_col);e.val(n),tp.table.set_table_changed()}))}}},tp.check={table_id:function(e){if(37!==e.which&&39!==e.which){var t=i(this);t.val(t.val().replace(/[^0-9a-zA-Z-_]/g,""))}},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},tp.reindex=function(){var a,n,e=l("edit-form-body").children(),o={};tp.table.rows=e.length,0<tp.table.rows?tp.table.columns=e.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:tp.table.columns=0,e.each(function(t,e){(a=i(e)).find("textarea").val(function(e,t){return""===t||"="!==t.charAt(0)?t:t.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(e,t,a){return o.hasOwnProperty(t)||((n=l("cell-"+t)).length?o[t]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):o[t]=t),e=o[t],void 0!==a&&""!==a&&(o.hasOwnProperty(a)||((n=l("cell-"+a)).length?o[a]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):o[a]=a),e+=":"+o[a]),e})}).attr("name",function(e){return"table[data]["+t+"]["+e+"]"}),a.find(".move-handle").html(t+1)}).each(function(t,e){i(e).find("textarea").attr("id",function(e){return"cell-"+tp.columns.number_to_letter(e+1)+(t+1)})}),l("edit-form-head").find(".move-handle").html(function(e){return tp.columns.number_to_letter(e+1)}),l("number-rows").val(tp.table.rows),l("number-columns").val(tp.table.columns),tp.table.set_table_changed()},tp.save_changes={trigger:function(e){return l("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(l("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void l("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(l("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void l("option-extra-css-classes").focus().select()):e.shiftKey?(tp.made_changes=!1,void l("tablepress-page").find("form").submit()):(i(this).closest("p").append('<span class="animation-saving spinner is-active" title="'+tablepress_strings.saving_changes+'"/>'),i(".save-changes-button").prop("disabled",!0),i("body").addClass("wait"),void i.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),success:tp.save_changes.ajax_success,error:tp.save_changes.ajax_error,dataType:"json"}))},ajax_success:function(e,t){if(void 0===t||"success"!==t)tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key.");else if(null==e||"-1"===e||void 0===e.success)tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key.");else if(!0!==e.success){var a="";void 0!==e.error_details&&tablepress_options.print_debug_output&&(a="</p><p>These errors were encountered:</p><pre>"+e.error_details+"</pre><p>"),tp.save_changes.error("AJAX call successful, internal saving process failed. Try again while holding down the &#8220;Shift&#8221; key."+a)}else tp.save_changes.success(e)},ajax_error:function(e,t,a){tp.save_changes.error("AJAX call failed: "+t+" - "+a+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(e){tp.table.id!==e.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+e.table_id)),l("edit-form").removeClass("tablepress-edit-screen-id-"+tp.table.id).addClass("tablepress-edit-screen-id-"+e.table_id),tp.table.id=tp.table.new_id=e.table_id,l("table-id").val(tp.table.id),l("table-new-id").val(tp.table.new_id),i(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]"),l("nonce-edit-table").val(e.new_edit_nonce),l("nonce-preview-table").val(e.new_preview_nonce);var t=i(".show-preview-button");t.length&&t.attr("href",t.first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+e.table_id).replace(/&_wpnonce=[a-z0-9]+/gi,"&_wpnonce="+e.new_preview_nonce)),l("last-modified").text(e.last_modified),l("last-editor").text(e.last_editor),tp.table.unset_table_changed(),tp.save_changes.after_saving_dialog("success",tablepress_strings[e.message])},error:function(e){tp.save_changes.after_saving_dialog("error",e)},after_saving_dialog:function(e,t){t=void 0===t?"":": "+t;var a,n="save-changes-"+e;"success"===e?(n+=" notice notice-success",a=3e3):(n+=" notice notice-error",a=6e3),i(".animation-saving").closest("p").after('<div class="ajax-alert '+n+'"><p>'+tablepress_strings["save_changes_"+e]+t+"</p></div>"),i(".animation-saving").remove(),i(".save-changes-"+e).delay(a).fadeOut(2e3,function(){i(this).remove()}),i(".save-changes-button").prop("disabled",!1),i("body").removeClass("wait")}},tp.init=function(){var e={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-duplicate":tp.rows.duplicate,"#columns-duplicate":tp.columns.duplicate,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide,"#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")},"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){i(this).next().wpdialog({title:i(this).attr("title"),height:470,width:320,modal:!0,dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables,"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},t=l("edit-form-body");i.each(e,function(a,e){i.each(e,function(e,t){i(e).on(a,t)})}),i(window).on("beforeunload",tp.check.changes_saved),l("option-table-head").change(),l("option-print-name").change(tp.table.change_print_name_description).change(),l("option-print-description").change(tp.table.change_print_name_description).change(),t.one("change","textarea",tp.table.set_table_changed),i("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed),tablepress_options.cells_advanced_editor?(t.on("click","textarea",tp.cells.advanced_editor.keyopen),l("advanced-editor-open").on("click",tp.cells.advanced_editor.buttonopen),l("advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),l("advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),l("advanced-editor").wpdialog({autoOpen:!1,title:l("advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1}),l("wp-link").on("focus","input",function(e){e.stopPropagation()})):l("advanced-editor-open").hide(),i("body").on("focus",".media-modal .media-frame-content input, .media-modal .media-frame-content textarea",function(e){e.stopPropagation()}),tablepress_options.cells_auto_grow&&t.on("focus","textarea",tp.cells.autogrow),l("edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"},tp.cells.checkboxes.multi_select),l("edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select),l("edit-form-head").on("click",".sort-control",tp.rows.sort),l("tablepress-page").find("form").on("submit",function(){i(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)}),t.sortable({axis:"y",containment:l("edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop,update:tp.reindex}),l("edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()},tp.init()});
1
+ window.tp=window.tp||{},jQuery(document).ready(function(i){"use strict";var l=function(e){return i(document.getElementById(e))};tp.made_changes=!1,tp.table={id:l("table-id").val(),new_id:l("table-new-id").val(),rows:parseInt(l("number-rows").val(),10),columns:parseInt(l("number-columns").val(),10),head:l("option-table-head").prop("checked"),foot:l("option-table-foot").prop("checked"),no_data_columns_pre:2,no_data_columns_post:1,body_cells_pre:'<tr><td><span class="move-handle"></span></td><td><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][rows][]" value="1" /></td>',body_cells_post:'<td><span class="move-handle"></span></td></tr>',body_cell:'<td><textarea rows="1"></textarea></td>',head_cell:'<th class="head"><span class="sort-control sort-desc" title="'+tablepress_strings.sort_desc+'"><span class="sorting-indicator"></span></span><span class="sort-control sort-asc" title="'+tablepress_strings.sort_asc+'"><span class="sorting-indicator"></span></span><span class="move-handle"></span></th>',foot_cell:'<th><input type="checkbox" /><input type="hidden" class="visibility" name="table[visibility][columns][]" value="1" /></th>',set_table_changed:function(){tp.made_changes=!0},unset_table_changed:function(){tp.made_changes=!1,l("edit-form-body").one("change","textarea",tp.table.set_table_changed),i("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed)},change_id:function(){return""===i.trim(l("table-new-id").val())?(alert(tablepress_strings.table_id_not_empty),void l("table-new-id").val(tp.table.new_id).focus().select()):"0"===i.trim(l("table-new-id").val())?(alert(tablepress_strings.table_id_not_zero),void l("table-new-id").val(tp.table.new_id).focus().select()):void(this.value!==tp.table.new_id&&(confirm(tablepress_strings.ays_change_table_id)?(tp.table.new_id=this.value,i(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]").click(),tp.table.set_table_changed()):i(this).val(tp.table.new_id)))},change_table_head:function(){tp.table.head=i(this).prop("checked"),l("option-use-datatables").prop("disabled",!tp.table.head).change(),l("notice-datatables-head-row").toggle(!tp.table.head),tp.rows.stripe()},change_table_foot:function(){tp.table.foot=i(this).prop("checked"),tp.rows.stripe()},change_print_name_description:function(){l(this.id+"-position").prop("disabled",!i(this).prop("checked"))},change_datatables:function(){var e=l("option-use-datatables"),t=!(e.prop("checked")&&!e.prop("disabled"));e.closest("tbody").find("input").not(e).prop("disabled",t),tp.table.change_datatables_pagination()},change_datatables_pagination:function(){var e=l("option-datatables-paginate"),t=e.prop("checked")&&!e.prop("disabled");l("option-datatables-lengthchange").prop("disabled",!t),l("option-datatables-paginate_entries").prop("disabled",!t)},prepare_ajax_request:function(e,t){var a,n=l("edit-form-body"),o=[],s={rows:tp.table.rows,columns:tp.table.columns,hidden_rows:0,hidden_columns:0},r={rows:[],columns:[]};return n.children().each(function(e,t){o[e]=i(t).find("textarea").map(function(){return i(this).val()}).get()}),o=JSON.stringify(o),a={table_head:tp.table.head,table_foot:tp.table.foot,alternating_row_colors:l("option-alternating-row-colors").prop("checked"),row_hover:l("option-row-hover").prop("checked"),print_name:l("option-print-name").prop("checked"),print_description:l("option-print-description").prop("checked"),print_name_position:l("option-print-name-position").val(),print_description_position:l("option-print-description-position").val(),extra_css_classes:l("option-extra-css-classes").val(),use_datatables:l("option-use-datatables").prop("checked"),datatables_sort:l("option-datatables-sort").prop("checked"),datatables_filter:l("option-datatables-filter").prop("checked"),datatables_paginate:l("option-datatables-paginate").prop("checked"),datatables_lengthchange:l("option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:l("option-datatables-paginate_entries").val(),datatables_info:l("option-datatables-info").prop("checked"),datatables_scrollx:l("option-datatables-scrollx").prop("checked"),datatables_custom_commands:l("option-datatables-custom-commands").val()},a=JSON.stringify(a),r.rows=n.find('input[type="hidden"]').map(function(){return"1"===i(this).val()?1:(s.hidden_rows+=1,0)}).get(),r.columns=l("edit-form-foot").find('input[type="hidden"]').map(function(){return"1"===i(this).val()?1:(s.hidden_columns+=1,0)}).get(),r=JSON.stringify(r),{action:e,_ajax_nonce:i(t).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:l("table-name").val(),description:l("table-description").val(),number:s,data:o,options:a,visibility:r}}},preview:{trigger:function(){return tp.made_changes?l("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(l("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void l("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(l("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void l("option-extra-css-classes").focus().select()):(i(this).closest("p").append('<span class="animation-preview spinner is-active" title="'+tablepress_strings.preparing_preview+'"/>'),i("body").addClass("wait"),l("table-preview").empty(),i.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),success:tp.table.preview.ajax_success,error:tp.table.preview.ajax_error,dataType:"json"}),!1):(tp.table.preview.show(i(this).attr("href")+"&TB_iframe=true"),!1)},ajax_success:function(e,t){void 0===t||"success"!==t?tp.table.preview.error("AJAX call successful, but unclear status."):null==e||"-1"===e||void 0===e.success||!0!==e.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(e)},ajax_error:function(e,t,a){tp.table.preview.error("AJAX call failed: "+t+" - "+a)},success:function(t){l("table-preview").empty(),i('<iframe id="table-preview-iframe" />').load(function(){var e=i(this).contents();e.find("head").append(t.head_html),e.find("body").append(t.body_html)}).appendTo("#table-preview"),i(".animation-preview").remove(),i("body").removeClass("wait"),tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(e){i(".animation-preview").closest("p").after('<div class="ajax-alert preview-error error"><p>'+tablepress_strings.preview_error+": "+e+"</p></div>"),i(".animation-preview").remove(),i(".preview-error").delay(6e3).fadeOut(2e3,function(){i(this).remove()}),i("body").removeClass("wait")},show:function(e){var t=i(window).width()-120,a=i(window).height()-120;i("#wpadminbar").length&&(a-=parseInt(i("#wpadminbar").css("height"),10)),tb_show(i(".show-preview-button").first().text(),e+"&height="+a+"&width="+t,!1)}}},tp.rows={create:function(e){var t,a,n,o="";for(t=0;t<e;t++){for(o+=tp.table.body_cells_pre,a=0;a<tp.table.columns;a++)o+=tp.table.body_cell;o+=tp.table.body_cells_post}return n=l("edit-form-foot").find(".column-hidden").map(function(){return i(this).index()}).get(),i(o).each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,n)}).addClass("column-hidden")})},append:function(){var e=l("rows-append-number").val();if(!/^[1-9][0-9]{0,4}$/.test(e))return alert(tablepress_strings.append_num_rows_invalid),void l("rows-append-number").focus().select();l("edit-form-body").append(tp.rows.create(e)),tp.rows.stripe(),tp.reindex()},insert:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},duplicate:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.each(function(e,t){var a=i(t),n=a.find("textarea"),o=a.clone();o.find("textarea").removeAttr("id").each(function(e,t){i(t).val(n.eq(e).val())}),a.after(o)}),tp.rows.stripe(),tp.reindex()):alert(tablepress_strings.no_rows_selected)},hide:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},unhide:function(e){var t=l("edit-form-body").find("input:checked").prop("checked",e.shiftKey).closest("tr");0!==t.length?(t.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed()):alert(tablepress_strings.no_rows_selected)},remove:function(){var e,t=l("edit-form-body").find("input:checked").closest("tr");0!==t.length?tp.table.rows!==t.length?(e=1===t.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(e)&&(t.remove(),tp.rows.stripe(),tp.reindex())):alert(tablepress_strings.no_remove_all_rows):alert(tablepress_strings.no_rows_selected)},move:{start:function(e,t){i(t.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>'),i(t.helper).removeClass("odd head-row foot-row")},change:function(e,t){tp.rows.stripe(t.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var a=i(this).parent().index(),n=i(this).hasClass("sort-asc")?1:-1,e=i("#edit-form-body"),t=e.find(".head-row").prevAll().addBack(),o=e.find(".foot-row").nextAll().addBack(),s=e.children().not(t).not(o).get();i.each(s,function(e,t){t.sort_key=(""+i(t).children().eq(a).find("textarea").val()).toLowerCase()}),s.sort(function(e,t){return n*function(e,t){var a,n,o=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,s=/^\s+|\s+$/g,r=/\s+/g,i=/^0x[0-9a-f]+$/i,l=/^0/,c=e.replace(s,"")||"",d=t.replace(s,"")||"",p=c.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),u=d.replace(o,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=parseInt(c.match(i),16)||1!==p.length&&Date.parse(c),_=parseInt(d.match(i),16)||h&&d.match(/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/)&&Date.parse(d)||null,m=function(e,t){return(!e.match(l)||1===t)&&parseFloat(e)||e.replace(r," ").replace(s,"")||0};if(_){if(h<_)return-1;if(_<h)return 1}for(var b=0,f=p.length,v=u.length,g=Math.max(f,v);b<g;b++){if(a=m(p[b]||"",f),n=m(u[b]||"",v),isNaN(a)!==isNaN(n))return isNaN(a)?1:-1;if(/[^\x00-\x80]/.test(a+n)&&a.localeCompare){var w=a.localeCompare(n);return w/Math.abs(w)}if(a<n)return-1;if(n<a)return 1}}(e.sort_key,t.sort_key)}),i.each(s,function(e,t){t.sort_key=null}),e.append(t),e.append(s),e.append(o),tp.rows.stripe(),tp.reindex()},stripe:function(e){void 0===e&&(e=null),e=i(e);var t=l("edit-form-body").children().removeClass("odd head-row foot-row").not(e);t.filter(":even").addClass("odd"),t=t.not(".row-hidden"),e.hasClass("row-hidden")&&(t=t.not(".ui-sortable-placeholder")),tp.table.head&&t.first().addClass("head-row"),tp.table.foot&&t.last().addClass("foot-row")}},tp.columns={append:function(){var e,t=l("columns-append-number").val(),a="",n="",o="";if(!/^[1-9][0-9]{0,4}$/.test(t))return alert(tablepress_strings.append_num_columns_invalid),void l("columns-append-number").focus().select();for(e=0;e<t;e++)n+=tp.table.body_cell,a+=tp.table.head_cell,o+=tp.table.foot_cell;l("edit-form-body").children().each(function(e,t){i(t).children().slice(-tp.table.no_data_columns_post).before(n)}),l("edit-form-head").children().slice(-tp.table.no_data_columns_post).before(a),l("edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(o),tp.reindex()},insert:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).before(tp.table.body_cell)}),l("edit-form-head").children().filter(function(e){return-1!==i.inArray(e,a)}).before(tp.table.head_cell),t.before(tp.table.foot_cell),tp.reindex()):alert(tablepress_strings.no_columns_selected)},duplicate:function(e){var o,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(o=t.map(function(){return i(this).index()}).get(),l("edit-form").find("tr").each(function(e,t){i(t).children().each(function(e,t){if(-1!==i.inArray(e,o)){var a=i(t),n=a.clone();n.find("textarea").removeAttr("id").val(a.find("textarea").val()),a.after(n)}})}),tp.reindex()):alert(tablepress_strings.no_columns_selected)},hide:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).addClass("column-hidden")}),t.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},unhide:function(e){var a,t=l("edit-form-foot").find("input:checked").prop("checked",e.shiftKey).closest("th");0!==t.length?(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).removeClass("column-hidden")}),t.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed()):alert(tablepress_strings.no_columns_selected)},remove:function(){var a,e,t=l("edit-form-foot").find("input:checked").closest("th");0!==t.length?tp.table.columns!==t.length?(e=1===t.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(e)&&(a=t.map(function(){return i(this).index()}).get(),l("edit-form-body").children().add("#edit-form-head").each(function(e,t){i(t).children().filter(function(e){return-1!==i.inArray(e,a)}).remove()}),t.remove(),tp.reindex())):alert(tablepress_strings.no_remove_all_columns):alert(tablepress_strings.no_columns_selected)},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(e,t){var a,n=i(t.item);tp.columns.move.source_idx=n.index(),tp.columns.move.$rows=l("edit-form-body").children().add("#edit-form-foot"),tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=i(this),i('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell),tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide(),tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"),a=tp.columns.move.$helper.eq(1).width(),tp.columns.move.$helper.eq(0).width(a),tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder"),tp.columns.move.$placeholder.find("div").width(a)},change:function(e,t){tp.columns.move.target_idx=i(t.placeholder).index(),tp.columns.move.target_idx-tp.columns.move.source_idx==1?tp.columns.move.target_idx+=1:tp.columns.move.target_idx===tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=i(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))}),tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1),tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(e,t){tp.columns.move.$helper.css("left",t.position.left)},stop:function(){tp.columns.move.$helper.remove(),tp.columns.move.$cells.each(function(){tp.columns.move.$cell=i(this),tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(),tp.columns.move.$placeholder.remove(),tp.columns.move.source_idx=tp.columns.move.target_idx=-1,tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null,tp.reindex()}},number_to_letter:function(e){for(var t="";0<e;)t=String.fromCharCode(65+(e-1)%26)+t,e=Math.floor((e-1)/26);return t}},tp.cells={$focus:i(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus"),tp.cells.$focus=i(this).closest("tr").addClass("focus")},advanced_editor:{prompt_shown:!1,keyopen:function(e){if(e.shiftKey){var t=l("advanced-editor-content");tp.cells.$textarea=i(this).blur(),t.val(tp.cells.$textarea.val()),l("advanced-editor").wpdialog("open"),t.get(0).selectionStart=t.get(0).selectionEnd=t.val().length,t.focus()}},buttonopen:function(){(tp.cells.advanced_editor.prompt_shown||confirm(tablepress_strings.advanced_editor_open))&&(tp.cells.advanced_editor.prompt_shown=!0,l("edit-form-body").one("click","textarea",function(){var e=l("advanced-editor-content");tp.cells.$textarea=i(this).blur(),e.val(tp.cells.$textarea.val()),l("advanced-editor").wpdialog("open"),e.get(0).selectionStart=e.get(0).selectionEnd=e.val().length,e.focus()}))},save:function(){var e=l("advanced-editor-content").blur().val();tp.cells.$textarea.val()!==e&&(tp.cells.$textarea.val(e),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed()),tp.cells.$textarea.focus(),tp.cells.advanced_editor.close()},close:function(){return l("advanced-editor").wpdialog("close"),!1}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(e){if("undefined"===e.shiftKey)return!0;if(e.shiftKey){if(!tp.cells.checkboxes.last_clicked[e.data.parent])return!0;var t=i(e.data.parent).find(":checkbox"),a=t.index(tp.cells.checkboxes.last_clicked[e.data.parent]),n=t.index(this);a!==n&&t.slice(Math.min(a,n),Math.max(a,n)).prop("checked",i(this).prop("checked"))}return tp.cells.checkboxes.last_clicked[e.data.parent]=this,!0}}},tp.content={link:{prompt_shown:!1,add:function(){(tp.content.link.prompt_shown||confirm(tablepress_strings.link_add))&&(tp.content.link.prompt_shown=!0,l("edit-form-body").one("mousedown","textarea",function(){var e=this.id;i(document).one("mouseup",function(){"undefined"!=typeof wpLink&&(wpLink.open(e),tp.table.set_table_changed())})}))}},image:{prompt_shown:!1,add:function(){(tp.content.image.prompt_shown||confirm(tablepress_strings.image_add))&&(tp.content.image.prompt_shown=!0,l("edit-form-body").one("click","textarea",function(){var e=this.id,t={frame:"post",state:"insert",title:wp.media.view.l10n.addMedia,multiple:!0};this.selectionStart=this.selectionEnd=this.value.length,i(this).blur(),wp.media.editor.open(e,t),tp.table.set_table_changed()}))}},span:{prompt_shown:!1,add:function(n){var e="#rowspan#"===n?tablepress_strings.rowspan_add:tablepress_strings.colspan_add;if(!1===tp.content.span.prompt_shown&&(tp.content.span.prompt_shown={},tp.content.span.prompt_shown["#rowspan#"]=tp.content.span.prompt_shown["#colspan#"]=!1),l("option-use-datatables").prop("checked")){if(!confirm(tablepress_strings.span_add_datatables_warning))return;l("option-use-datatables").prop("checked",!1).change()}(tp.content.span.prompt_shown[n]||confirm(e))&&(tp.content.span.prompt_shown[n]=!0,l("edit-form-body").one("click","textarea",function(){var e=i(this),t=e.parent().index(),a=e.closest("tr").index();if("#rowspan#"===n){if(0===a)return void alert(tablepress_strings.no_rowspan_first_row);if(tp.table.head&&1===a)return void alert(tablepress_strings.no_rowspan_table_head);if(tp.table.foot&&tp.table.rows-1===a)return void alert(tablepress_strings.no_rowspan_table_foot)}else if("#colspan#"===n&&tp.table.no_data_columns_pre===t)return void alert(tablepress_strings.no_colspan_first_col);e.val(n),tp.table.set_table_changed()}))}}},tp.check={table_id:function(e){if(37!==e.which&&39!==e.which){var t=i(this);t.val(t.val().replace(/[^0-9a-zA-Z-_]/g,""))}},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},tp.reindex=function(){var a,n,e=l("edit-form-body").children(),o={};tp.table.rows=e.length,0<tp.table.rows?tp.table.columns=e.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:tp.table.columns=0,e.each(function(t,e){(a=i(e)).find("textarea").val(function(e,t){return""===t||"="!==t.charAt(0)?t:t.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(e,t,a){return o.hasOwnProperty(t)||((n=l("cell-"+t)).length?o[t]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):o[t]=t),e=o[t],void 0!==a&&""!==a&&(o.hasOwnProperty(a)||((n=l("cell-"+a)).length?o[a]=tp.columns.number_to_letter(n.parent().index()-tp.table.no_data_columns_pre+1)+(n.closest("tr").index()+1):o[a]=a),e+=":"+o[a]),e})}).attr("name",function(e){return"table[data]["+t+"]["+e+"]"}),a.find(".move-handle").html(t+1)}).each(function(t,e){i(e).find("textarea").attr("id",function(e){return"cell-"+tp.columns.number_to_letter(e+1)+(t+1)})}),l("edit-form-head").find(".move-handle").html(function(e){return tp.columns.number_to_letter(e+1)}),l("number-rows").val(tp.table.rows),l("number-columns").val(tp.table.columns),tp.table.set_table_changed()},tp.save_changes={trigger:function(e){return l("option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(l("option-datatables-paginate_entries").val())?(alert(tablepress_strings.num_pagination_entries_invalid),void l("option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(l("option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),void l("option-extra-css-classes").focus().select()):e.shiftKey?(tp.made_changes=!1,void l("tablepress-page").find("form").submit()):(i(this).closest("p").append('<span class="animation-saving spinner is-active" title="'+tablepress_strings.saving_changes+'"/>'),i(".save-changes-button").prop("disabled",!0),i("body").addClass("wait"),void i.ajax({type:"POST",url:ajaxurl,data:tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),success:tp.save_changes.ajax_success,error:tp.save_changes.ajax_error,dataType:"json"}))},ajax_success:function(e,t){if(void 0===t||"success"!==t)tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key.");else if(null==e||"-1"===e||void 0===e.success)tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key.");else if(!0!==e.success){var a="";void 0!==e.error_details&&tablepress_options.print_debug_output&&(a="</p><p>These errors were encountered:</p><pre>"+e.error_details+"</pre><p>"),tp.save_changes.error("AJAX call successful, internal saving process failed. Try again while holding down the &#8220;Shift&#8221; key."+a)}else tp.save_changes.success(e)},ajax_error:function(e,t,a){tp.save_changes.error("AJAX call failed: "+t+" - "+a+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(e){tp.table.id!==e.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+e.table_id)),l("edit-form").removeClass("tablepress-edit-screen-id-"+tp.table.id).addClass("tablepress-edit-screen-id-"+e.table_id),tp.table.id=tp.table.new_id=e.table_id,l("table-id").val(tp.table.id),l("table-new-id").val(tp.table.new_id),i(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]"),l("nonce-edit-table").val(e.new_edit_nonce),l("nonce-preview-table").val(e.new_preview_nonce);var t=i(".show-preview-button");t.length&&t.attr("href",t.first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+e.table_id).replace(/&_wpnonce=[a-z0-9]+/gi,"&_wpnonce="+e.new_preview_nonce)),l("last-modified").text(e.last_modified),l("last-editor").text(e.last_editor),tp.table.unset_table_changed(),tp.save_changes.after_saving_dialog("success",tablepress_strings[e.message])},error:function(e){tp.save_changes.after_saving_dialog("error",e)},after_saving_dialog:function(e,t){t=void 0===t?"":": "+t;var a,n="save-changes-"+e;a="success"===e?(n+=" notice notice-success",3e3):(n+=" notice notice-error",6e3),i(".animation-saving").closest("p").after('<div class="ajax-alert '+n+'"><p>'+tablepress_strings["save_changes_"+e]+t+"</p></div>"),i(".animation-saving").remove(),i(".save-changes-"+e).delay(a).fadeOut(2e3,function(){i(this).remove()}),i(".save-changes-button").prop("disabled",!1),i("body").removeClass("wait")}},tp.init=function(){var e={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-duplicate":tp.rows.duplicate,"#columns-duplicate":tp.columns.duplicate,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide,"#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")},"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){i(this).next().wpdialog({title:i(this).attr("title"),height:470,width:320,modal:!0,dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables,"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},t=l("edit-form-body");i.each(e,function(a,e){i.each(e,function(e,t){i(e).on(a,t)})}),i(window).on("beforeunload",tp.check.changes_saved),l("option-table-head").change(),l("option-print-name").change(tp.table.change_print_name_description).change(),l("option-print-description").change(tp.table.change_print_name_description).change(),t.one("change","textarea",tp.table.set_table_changed),i("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed),tablepress_options.cells_advanced_editor?(t.on("click","textarea",tp.cells.advanced_editor.keyopen),l("advanced-editor-open").on("click",tp.cells.advanced_editor.buttonopen),l("advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),l("advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),l("advanced-editor").wpdialog({autoOpen:!1,title:l("advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1}),l("wp-link").on("focus","input",function(e){e.stopPropagation()})):l("advanced-editor-open").hide(),i("body").on("focus",".media-modal .media-frame-content input, .media-modal .media-frame-content textarea",function(e){e.stopPropagation()}),tablepress_options.cells_auto_grow&&t.on("focus","textarea",tp.cells.autogrow),l("edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"},tp.cells.checkboxes.multi_select),l("edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select),l("edit-form-head").on("click",".sort-control",tp.rows.sort),l("tablepress-page").find("form").on("submit",function(){i(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)}),t.sortable({axis:"y",containment:l("edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop,update:tp.reindex}),l("edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()},tp.init()});
classes/class-tablepress.php CHANGED
@@ -26,7 +26,7 @@ abstract class TablePress {
26
  * @since 1.0.0
27
  * @const string
28
  */
29
- const version = '1.9.1';
30
 
31
  /**
32
  * TablePress internal plugin version ("options scheme" version).
@@ -36,7 +36,7 @@ abstract class TablePress {
36
  * @since 1.0.0
37
  * @const int
38
  */
39
- const db_version = 37;
40
 
41
  /**
42
  * TablePress "table scheme" (data format structure) version.
26
  * @since 1.0.0
27
  * @const string
28
  */
29
+ const version = '1.9.2';
30
 
31
  /**
32
  * TablePress internal plugin version ("options scheme" version).
36
  * @since 1.0.0
37
  * @const int
38
  */
39
+ const db_version = 38;
40
 
41
  /**
42
  * TablePress "table scheme" (data format structure) version.
controllers/controller-frontend.php CHANGED
@@ -378,7 +378,7 @@ class TablePress_Frontend_Controller extends TablePress_Controller {
378
  *
379
  * @since 1.0.0
380
  *
381
- * @param array $commands The JS commands for the DataTables JS library.
382
  */
383
  $commands = apply_filters( 'tablepress_all_datatables_commands', $commands );
384
  if ( empty( $commands ) ) {
378
  *
379
  * @since 1.0.0
380
  *
381
+ * @param string $commands The JS commands for the DataTables JS library.
382
  */
383
  $commands = apply_filters( 'tablepress_all_datatables_commands', $commands );
384
  if ( empty( $commands ) ) {
libraries/csstidy/class.csstidy.php CHANGED
@@ -1001,7 +1001,7 @@ class TablePress_CSSTidy {
1001
  $this->str_char[] = ( '(' === $string[ $i ] ) ? ')' : $string[ $i ];
1002
  $this->from[] = 'instr';
1003
  $this->quoted_string[] = ( ')' === $_str_char && '(' !== $string[ $i ] && '(' === trim( $_cur_string ) ) ? $_quoted_string : ( '(' !== $string[ $i ] );
1004
- continue;
1005
  }
1006
 
1007
  if ( ')' !== $_str_char && ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && ! ( '\\' === $string[ $i - 1 ] && ! $this->escaped( $string, $i - 1 ) ) ) {
1001
  $this->str_char[] = ( '(' === $string[ $i ] ) ? ')' : $string[ $i ];
1002
  $this->from[] = 'instr';
1003
  $this->quoted_string[] = ( ')' === $_str_char && '(' !== $string[ $i ] && '(' === trim( $_cur_string ) ) ? $_quoted_string : ( '(' !== $string[ $i ] );
1004
+ continue 2;
1005
  }
1006
 
1007
  if ( ')' !== $_str_char && ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) && ! ( '\\' === $string[ $i - 1 ] && ! $this->escaped( $string, $i - 1 ) ) ) {
models/model-post.php CHANGED
@@ -108,19 +108,29 @@ class TablePress_Post_Model extends TablePress_Model {
108
  remove_filter( 'content_save_pre', 'balanceTags', 50 );
109
  remove_filter( 'excerpt_save_pre', 'balanceTags', 50 );
110
  /*
111
- * Remove possible KSES filtering here, as it can destroy the JSON when messing with HTML.
112
  * KSES filtering is done to table cells individually, when saving.
113
  */
114
- remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
 
 
 
 
 
 
 
 
115
 
116
  $post_id = wp_insert_post( $post, true );
117
 
118
- // Re-add balanceTags() to sanitize_post().
119
  add_filter( 'content_save_pre', 'balanceTags', 50 );
120
  add_filter( 'excerpt_save_pre', 'balanceTags', 50 );
121
- // Re-add KSES filtering, if necessary.
122
- if ( ! current_user_can( 'unfiltered_html' ) ) {
123
- add_filter( 'content_save_pre', 'wp_filter_post_kses' );
 
 
124
  }
125
 
126
  return $post_id;
@@ -158,19 +168,29 @@ class TablePress_Post_Model extends TablePress_Model {
158
  remove_filter( 'content_save_pre', 'balanceTags', 50 );
159
  remove_filter( 'excerpt_save_pre', 'balanceTags', 50 );
160
  /*
161
- * Remove possible KSES filtering here, as it can destroy the JSON when messing with HTML
162
  * KSES filtering is done to table cells individually, when saving.
163
  */
164
- remove_filter( 'content_save_pre', 'wp_filter_post_kses' );
 
 
 
 
 
 
 
 
165
 
166
  $post_id = wp_update_post( $post, true );
167
 
168
- // Re-add balanceTags() to sanitize_post().
169
  add_filter( 'content_save_pre', 'balanceTags', 50 );
170
  add_filter( 'excerpt_save_pre', 'balanceTags', 50 );
171
- // Re-add KSES filtering, if necessary.
172
- if ( ! current_user_can( 'unfiltered_html' ) ) {
173
- add_filter( 'content_save_pre', 'wp_filter_post_kses' );
 
 
174
  }
175
 
176
  return $post_id;
108
  remove_filter( 'content_save_pre', 'balanceTags', 50 );
109
  remove_filter( 'excerpt_save_pre', 'balanceTags', 50 );
110
  /*
111
+ * Remove possible KSES filtering, as it can destroy the JSON when messing with HTML.
112
  * KSES filtering is done to table cells individually, when saving.
113
  */
114
+ $has_kses = ( false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ) );
115
+ if ( $has_kses ) {
116
+ kses_remove_filters();
117
+ }
118
+ // Remove filter that adds `rel="noopener noreferrer" to <a> HTML tags, but destroys JSON code. See https://core.trac.wordpress.org/ticket/46316.
119
+ $has_targeted_link_rel_filters = ( false !== has_filter( 'content_save_pre', 'wp_targeted_link_rel' ) );
120
+ if ( $has_targeted_link_rel_filters ) {
121
+ wp_remove_targeted_link_rel_filters();
122
+ }
123
 
124
  $post_id = wp_insert_post( $post, true );
125
 
126
+ // Restore removed content filters.
127
  add_filter( 'content_save_pre', 'balanceTags', 50 );
128
  add_filter( 'excerpt_save_pre', 'balanceTags', 50 );
129
+ if ( $has_kses ) {
130
+ kses_init_filters();
131
+ }
132
+ if ( $has_targeted_link_rel_filters ) {
133
+ wp_init_targeted_link_rel_filters();
134
  }
135
 
136
  return $post_id;
168
  remove_filter( 'content_save_pre', 'balanceTags', 50 );
169
  remove_filter( 'excerpt_save_pre', 'balanceTags', 50 );
170
  /*
171
+ * Remove possible KSES filtering, as it can destroy the JSON when messing with HTML.
172
  * KSES filtering is done to table cells individually, when saving.
173
  */
174
+ $has_kses = ( false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ) );
175
+ if ( $has_kses ) {
176
+ kses_remove_filters();
177
+ }
178
+ // Remove filter that adds `rel="noopener noreferrer" to <a> HTML tags, but destroys JSON code. See https://core.trac.wordpress.org/ticket/46316.
179
+ $has_targeted_link_rel_filters = ( false !== has_filter( 'content_save_pre', 'wp_targeted_link_rel' ) );
180
+ if ( $has_targeted_link_rel_filters ) {
181
+ wp_remove_targeted_link_rel_filters();
182
+ }
183
 
184
  $post_id = wp_update_post( $post, true );
185
 
186
+ // Restore removed content filters.
187
  add_filter( 'content_save_pre', 'balanceTags', 50 );
188
  add_filter( 'excerpt_save_pre', 'balanceTags', 50 );
189
+ if ( $has_kses ) {
190
+ kses_init_filters();
191
+ }
192
+ if ( $has_targeted_link_rel_filters ) {
193
+ wp_init_targeted_link_rel_filters();
194
  }
195
 
196
  return $post_id;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: TobiasBg
3
  Donate link: https://tablepress.org/donate/
4
  Tags: table,data,html,csv,excel
5
  Requires at least: 4.9.1
6
- Tested up to: 4.9.8
7
- Stable tag: 1.9.1
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,7 +12,7 @@ Embed beautiful and feature-rich tables into your posts and pages, without havin
12
 
13
  == Description ==
14
 
15
- TablePress allows you to easily create and manage beautiful tables. You can embed the tables into posts, pages, or text widgets with a simple Shortcode. Table data can be edited in a speadsheet-like interface, so no coding is necessary. Tables can contain any type of data, even formulas that will be evaluated. An additional JavaScript library adds features like sorting, pagination, filtering, and more for site visitors. Tables can be imported and exported from/to Excel, CSV, HTML, and JSON files.
16
 
17
  = More information =
18
  Please visit the plugin website at https://tablepress.org/ for more information or a [demo](https://tablepress.org/demo/)).
@@ -99,6 +99,11 @@ You may use it free of charge for any purpose.
99
 
100
  == Changelog ==
101
 
 
 
 
 
 
102
  = Version 1.9.1 =
103
  * Enhancement: Improve accessibility on several admin screens (thanks to Boone Gorges).
104
  * Enhancement: Update list of allowed CSS properties in "Custom CSS".
@@ -262,6 +267,9 @@ Initial version where most features are ready and pretty stable.
262
 
263
  == Upgrade Notice ==
264
 
 
 
 
265
  = 1.9.1 =
266
  This update is a stability, maintenance, and compatibility release. Updating is recommended.
267
 
3
  Donate link: https://tablepress.org/donate/
4
  Tags: table,data,html,csv,excel
5
  Requires at least: 4.9.1
6
+ Tested up to: 5.1
7
+ Stable tag: 1.9.2
8
  License: GPLv2
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ TablePress allows you to easily create and manage beautiful tables. You can embed the tables into posts, pages, or text widgets with a simple Shortcode. Table data can be edited in a spreadsheet-like interface, so no coding is necessary. Tables can contain any type of data, even formulas that will be evaluated. An additional JavaScript library adds features like sorting, pagination, filtering, and more for site visitors. Tables can be imported and exported from/to Excel, CSV, HTML, and JSON files.
16
 
17
  = More information =
18
  Please visit the plugin website at https://tablepress.org/ for more information or a [demo](https://tablepress.org/demo/)).
99
 
100
  == Changelog ==
101
 
102
+ = Version 1.9.2 =
103
+ * Compatibility with WordPress 5.1
104
+ * Enhancement: Make the save process more robust against data corruption.
105
+ * Minor internal changes on CSS and typos in the documentation.
106
+
107
  = Version 1.9.1 =
108
  * Enhancement: Improve accessibility on several admin screens (thanks to Boone Gorges).
109
  * Enhancement: Update list of allowed CSS properties in "Custom CSS".
267
 
268
  == Upgrade Notice ==
269
 
270
+ = 1.9.2 =
271
+ This update is a stability, maintenance, and compatibility release. Updating is recommended.
272
+
273
  = 1.9.1 =
274
  This update is a stability, maintenance, and compatibility release. Updating is recommended.
275
 
tablepress.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @package TablePress
6
  * @author Tobias Bäthge
7
- * @version 1.9.1
8
  */
9
 
10
  /*
11
  Plugin Name: TablePress
12
  Plugin URI: https://tablepress.org/
13
  Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code.
14
- Version: 1.9.1
15
  Author: Tobias Bäthge
16
  Author URI: https://tobias.baethge.com/
17
  Author email: wordpress@tobias.baethge.com
@@ -21,7 +21,7 @@ License: GPL 2
21
  Donate URI: https://tablepress.org/donate/
22
  */
23
 
24
- /* Copyright 2012-2018 Tobias Bäthge
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License, version 2, as
4
  *
5
  * @package TablePress
6
  * @author Tobias Bäthge
7
+ * @version 1.9.2
8
  */
9
 
10
  /*
11
  Plugin Name: TablePress
12
  Plugin URI: https://tablepress.org/
13
  Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code.
14
+ Version: 1.9.2
15
  Author: Tobias Bäthge
16
  Author URI: https://tobias.baethge.com/
17
  Author email: wordpress@tobias.baethge.com
21
  Donate URI: https://tablepress.org/donate/
22
  */
23
 
24
+ /* Copyright 2012-2019 Tobias Bäthge
25
 
26
  This program is free software; you can redistribute it and/or modify
27
  it under the terms of the GNU General Public License, version 2, as