Version Description
This update is a stability, maintenance, and compatibility release. Updating is recommended.
Download this release
Release Info
Developer | TobiasBg |
Plugin | TablePress |
Version | 1.10 |
Comparing to | |
See all releases |
Code changes from version 1.9.2 to 1.10
- admin/css/codemirror.css +0 -16
- admin/css/codemirror.min.css +1 -1
- admin/css/common.css +11 -15
- admin/css/common.min.css +1 -1
- admin/css/edit.css +8 -8
- admin/css/edit.min.css +1 -1
- admin/js/add.js +1 -16
- admin/js/add.min.js +1 -1
- admin/js/common.js +0 -19
- admin/js/common.min.js +1 -1
- admin/js/edit.js +1 -1
- admin/js/edit.min.js +1 -1
- admin/js/import.js +23 -53
- admin/js/import.min.js +1 -1
- classes/class-css.php +6 -2
- classes/class-tablepress.php +4 -4
- classes/class-view.php +3 -3
- controllers/controller-admin.php +55 -429
- controllers/controller-admin_ajax.php +0 -3
- controllers/controller-frontend.php +1 -1
- i18n/datatables/lang-de_AT.json +24 -0
- i18n/datatables/lang-de_CH.json +24 -0
- i18n/datatables/lang-de_CH_informal.json +24 -0
- i18n/datatables/warning.txt +25 -25
- i18n/translating-tablepress.txt +2 -9
- js/jquery.datatables.min.js +167 -163
- libraries/csstidy/class.csstidy.php +125 -83
- libraries/csstidy/class.csstidy_optimise.php +20 -14
- libraries/csstidy/class.csstidy_print.php +41 -11
- libraries/csstidy/data.inc.php +4 -3
- libraries/evalmath.class.php +29 -22
- libraries/excel-reader.class.php +7 -7
- libraries/simplexlsx.class.php +769 -772
- models/model-options.php +1 -2
- models/model-table.php +43 -2
- readme.txt +32 -226
- tablepress.php +34 -35
- views/view-about.php +9 -10
- views/view-add.php +2 -2
- views/view-edit.php +2 -7
- views/view-editor_button_thickbox.php +2 -28
- views/view-import.php +5 -120
- views/view-list.php +5 -13
- views/view-options.php +4 -14
admin/css/codemirror.css
CHANGED
@@ -6,14 +6,8 @@
|
|
6 |
height: 500px;
|
7 |
}
|
8 |
#tablepress-page .CodeMirror-scroll {
|
9 |
-
background-color: #fff;
|
10 |
border: 1px solid #ddd;
|
11 |
-
-webkit-box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
|
12 |
-
box-shadow: inset 0 1px 2px rgba( 0, 0, 0, 0.07 );
|
13 |
-
-webkit-transition: 0.05s border-color ease-in-out;
|
14 |
-
transition: 0.05s border-color ease-in-out;
|
15 |
height: 100%; /* Fallback for browsers that don't support calc() */
|
16 |
-
height: -webkit-calc( 100% - 2px );
|
17 |
height: calc( 100% - 2px );
|
18 |
padding-bottom: 0;
|
19 |
margin-right: 0;
|
@@ -24,15 +18,6 @@
|
|
24 |
#tablepress-page .CodeMirror.disabled .CodeMirror-scroll {
|
25 |
background-color: #eeeeee;
|
26 |
}
|
27 |
-
#tablepress-page .CodeMirror-focused {
|
28 |
-
-webkit-box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
|
29 |
-
box-shadow: 0 0 2px rgba( 30, 140, 190, 0.8 );
|
30 |
-
}
|
31 |
-
#tablepress-page .CodeMirror-focused .CodeMirror-scroll {
|
32 |
-
-webkit-box-shadow: none;
|
33 |
-
box-shadow: none;
|
34 |
-
border-color: #5b9dd9;
|
35 |
-
}
|
36 |
|
37 |
/* jQuery UI resizable styles, for the resizable CodeMirror instance */
|
38 |
.ui-resizable {
|
@@ -42,7 +27,6 @@
|
|
42 |
position: absolute;
|
43 |
font-size: 0.1px;
|
44 |
display: block;
|
45 |
-
-ms-touch-action: none;
|
46 |
touch-action: none;
|
47 |
}
|
48 |
.ui-resizable-s {
|
6 |
height: 500px;
|
7 |
}
|
8 |
#tablepress-page .CodeMirror-scroll {
|
|
|
9 |
border: 1px solid #ddd;
|
|
|
|
|
|
|
|
|
10 |
height: 100%; /* Fallback for browsers that don't support calc() */
|
|
|
11 |
height: calc( 100% - 2px );
|
12 |
padding-bottom: 0;
|
13 |
margin-right: 0;
|
18 |
#tablepress-page .CodeMirror.disabled .CodeMirror-scroll {
|
19 |
background-color: #eeeeee;
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
/* jQuery UI resizable styles, for the resizable CodeMirror instance */
|
23 |
.ui-resizable {
|
27 |
position: absolute;
|
28 |
font-size: 0.1px;
|
29 |
display: block;
|
|
|
30 |
touch-action: none;
|
31 |
}
|
32 |
.ui-resizable-s {
|
admin/css/codemirror.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#tablepress-page .CodeMirror{height:100px}#tablepress-page .CodeMirror.large{height:500px}#tablepress-page .CodeMirror-scroll{
|
1 |
+
#tablepress-page .CodeMirror{height:100px}#tablepress-page .CodeMirror.large{height:500px}#tablepress-page .CodeMirror-scroll{border:1px solid #ddd;height:100%;height:calc(100% - 2px);padding-bottom:0;margin-right:0}#tablepress-page .CodeMirror-scroll .CodeMirror-sizer{border-right-width:0!important}#tablepress-page .CodeMirror.disabled .CodeMirror-scroll{background-color:#eee}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:.1px;display:block;touch-action:none}.ui-resizable-s{cursor:s-resize;height:10px;width:100%;bottom:-5px;left:0}
|
admin/css/common.css
CHANGED
@@ -51,11 +51,6 @@
|
|
51 |
margin-right: 20px;
|
52 |
}
|
53 |
|
54 |
-
/* Placeholder fields in gray text color, but only if JS is enabled */
|
55 |
-
.js #tablepress-page .placeholder-active {
|
56 |
-
color: #bbbbbb;
|
57 |
-
}
|
58 |
-
|
59 |
/* Width of the columns on the "All Tables" list */
|
60 |
.tablepress-all-tables thead .column-table_id {
|
61 |
width: 50px;
|
@@ -92,24 +87,17 @@
|
|
92 |
background: transparent;
|
93 |
border: none;
|
94 |
color: #333333;
|
95 |
-
width:
|
96 |
margin: 0;
|
97 |
padding: 0;
|
98 |
font-weight: bold;
|
99 |
-
-webkit-box-shadow: none;
|
100 |
box-shadow: none;
|
101 |
text-align: center;
|
102 |
-
vertical-align: top;
|
103 |
-
}
|
104 |
-
#tablepress-page .table-shortcode {
|
105 |
-
cursor: text;
|
106 |
}
|
107 |
|
108 |
/* Table ID/name dropdown on "Export" screen */
|
109 |
#tablepress-page #tables-export {
|
110 |
width: 100%;
|
111 |
-
height: auto;
|
112 |
-
line-height: normal;
|
113 |
}
|
114 |
|
115 |
/* Red border for form fields that have invalid values */
|
@@ -154,8 +142,7 @@
|
|
154 |
padding-top: 6px;
|
155 |
}
|
156 |
/* Adjust positioning of labels in relation to checkboxes/radio buttons */
|
157 |
-
#tablepress_import-import-form .column-2 label
|
158 |
-
#tablepress_import-import-wp-table-reloaded .column-2 label {
|
159 |
margin-right: 20px; /* some margin on radio buttons */
|
160 |
}
|
161 |
/* Red color for the "Uninstall TablePress" button on the "Plugin Options" screen */
|
@@ -166,3 +153,12 @@
|
|
166 |
#tablepress-page select {
|
167 |
vertical-align: baseline;
|
168 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
margin-right: 20px;
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
/* Width of the columns on the "All Tables" list */
|
55 |
.tablepress-all-tables thead .column-table_id {
|
56 |
width: 50px;
|
87 |
background: transparent;
|
88 |
border: none;
|
89 |
color: #333333;
|
90 |
+
width: 120px;
|
91 |
margin: 0;
|
92 |
padding: 0;
|
93 |
font-weight: bold;
|
|
|
94 |
box-shadow: none;
|
95 |
text-align: center;
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
/* Table ID/name dropdown on "Export" screen */
|
99 |
#tablepress-page #tables-export {
|
100 |
width: 100%;
|
|
|
|
|
101 |
}
|
102 |
|
103 |
/* Red border for form fields that have invalid values */
|
142 |
padding-top: 6px;
|
143 |
}
|
144 |
/* Adjust positioning of labels in relation to checkboxes/radio buttons */
|
145 |
+
#tablepress_import-import-form .column-2 label {
|
|
|
146 |
margin-right: 20px; /* some margin on radio buttons */
|
147 |
}
|
148 |
/* Red color for the "Uninstall TablePress" button on the "Plugin Options" screen */
|
153 |
#tablepress-page select {
|
154 |
vertical-align: baseline;
|
155 |
}
|
156 |
+
/* Equal heights for UI elements */
|
157 |
+
#tablepress-page textarea,
|
158 |
+
.tablepress-postbox-table .button {
|
159 |
+
margin: 1px;
|
160 |
+
}
|
161 |
+
#tablepress-page .button,
|
162 |
+
#tablepress-page select {
|
163 |
+
min-height: 30px;
|
164 |
+
}
|
admin/css/common.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#tablepress-page div.notice{margin:10px 0 0}@media screen and (min-width:783px) and (max-width:1150px){#tablepress-nav{padding-top:30px}}@media screen and (max-width:700px){#tablepress-nav{border-bottom:0}#tablepress-nav .nav-tab{margin:0 0 10px .5em;border-bottom:1px solid #ccc}}#tablepress-nav .wp-heading-inline{float:left;padding:5px 0 0;line-height:inherit}#tablepress-nav .nav-tab-separator{margin-left:2em}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.
|
1 |
+
#tablepress-page div.notice{margin:10px 0 0}@media screen and (min-width:783px) and (max-width:1150px){#tablepress-nav{padding-top:30px}}@media screen and (max-width:700px){#tablepress-nav{border-bottom:0}#tablepress-nav .nav-tab{margin:0 0 10px .5em;border-bottom:1px solid #ccc}}#tablepress-nav .wp-heading-inline{float:left;padding:5px 0 0;line-height:inherit}#tablepress-nav .nav-tab-separator{margin-left:2em}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.tablepress-all-tables thead .column-table_id{width:50px}.tablepress-all-tables thead .column-table_name{width:30%}.tablepress-all-tables thead .column-table_author{width:12%}.tablepress-all-tables thead .column-table_last_modified{width:15%}.tablepress-all-tables tbody .column-table_id{font-weight:700}@media screen and (max-width:782px){.tablepress-all-tables .column-table_id{display:none!important;padding:3px 8px 3px 35%}}#tablepress-page .subtitle{float:left;padding-left:0}#tablepress-page .table-shortcode-inline{background:0 0;border:none;color:#333;width:120px;margin:0;padding:0;font-weight:700;box-shadow:none;text-align:center}#tablepress-page #tables-export{width:100%}#tablepress-page form .invalid,#tablepress-page form :invalid{border-color:#c00!important}.tablepress-postbox-table{border-spacing:0;max-width:1000px;width:100%}.tablepress-postbox-table .column-1{width:25%}.tablepress-postbox-table .column-2{width:75%}.tablepress-postbox-table th{text-align:left;font-weight:400}.tablepress-postbox-table td,.tablepress-postbox-table th{padding:2px;word-wrap:break-word}.tablepress-postbox-table .top-border td,.tablepress-postbox-table .top-border th{padding-top:6px}.tablepress-postbox-table .bottom-border td,.tablepress-postbox-table .bottom-border th{padding-bottom:6px;border-bottom:1px solid #eee}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:6px}#tablepress_import-import-form .column-2 label{margin-right:20px}#uninstall-tablepress{color:#bc0b0b}#tablepress-page select{vertical-align:baseline}#tablepress-page textarea,.tablepress-postbox-table .button{margin:1px}#tablepress-page .button,#tablepress-page select{min-height:30px}
|
admin/css/edit.css
CHANGED
@@ -109,19 +109,18 @@ body #wp-link-backdrop {
|
|
109 |
display: none;
|
110 |
}
|
111 |
|
112 |
-
#tablepress-page .small-text {
|
113 |
-
width: 65px;
|
114 |
-
padding: 3px 5px;
|
115 |
-
}
|
116 |
#tablepress-page #table-new-id {
|
117 |
width: 120px;
|
118 |
}
|
119 |
|
120 |
-
#table-information-shortcode
|
121 |
-
#tablepress-page .button {
|
122 |
vertical-align: middle;
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
125 |
/* Table cells */
|
126 |
#edit-form-body td {
|
127 |
padding: 2px 1px;
|
@@ -142,10 +141,13 @@ body #wp-link-backdrop {
|
|
142 |
#edit-form-body textarea {
|
143 |
display: block;
|
144 |
min-width: 150px;
|
|
|
|
|
145 |
width: 100%;
|
146 |
width: auto\0/IE; /* IE hack, as cells will otherwise shrink and overlap instead of horizontal scrolling kicking in */
|
147 |
height: 100%;
|
148 |
resize: both;
|
|
|
149 |
}
|
150 |
#edit-form-body textarea:focus {
|
151 |
border-color: #333333;
|
@@ -155,9 +157,7 @@ body #wp-link-backdrop {
|
|
155 |
#tablepress-page input[type="text"],
|
156 |
#tablepress-page textarea,
|
157 |
#tablepress-page select {
|
158 |
-
-webkit-box-shadow: none;
|
159 |
box-shadow: none;
|
160 |
-
-webkit-transition: none;
|
161 |
transition: none;
|
162 |
}
|
163 |
|
109 |
display: none;
|
110 |
}
|
111 |
|
|
|
|
|
|
|
|
|
112 |
#tablepress-page #table-new-id {
|
113 |
width: 120px;
|
114 |
}
|
115 |
|
116 |
+
#table-information-shortcode {
|
|
|
117 |
vertical-align: middle;
|
118 |
}
|
119 |
|
120 |
+
#tablepress-page .button {
|
121 |
+
vertical-align: baseline;
|
122 |
+
}
|
123 |
+
|
124 |
/* Table cells */
|
125 |
#edit-form-body td {
|
126 |
padding: 2px 1px;
|
141 |
#edit-form-body textarea {
|
142 |
display: block;
|
143 |
min-width: 150px;
|
144 |
+
border-color: #dddddd;
|
145 |
+
border-radius: 0;
|
146 |
width: 100%;
|
147 |
width: auto\0/IE; /* IE hack, as cells will otherwise shrink and overlap instead of horizontal scrolling kicking in */
|
148 |
height: 100%;
|
149 |
resize: both;
|
150 |
+
margin: 0;
|
151 |
}
|
152 |
#edit-form-body textarea:focus {
|
153 |
border-color: #333333;
|
157 |
#tablepress-page input[type="text"],
|
158 |
#tablepress-page textarea,
|
159 |
#tablepress-page select {
|
|
|
160 |
box-shadow: none;
|
|
|
161 |
transition: none;
|
162 |
}
|
163 |
|
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,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
|
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 #table-new-id{width:120px}#table-information-shortcode{vertical-align:middle}#tablepress-page .button{vertical-align:baseline}#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;border-color:#ddd;border-radius:0;width:100%;width:auto\0/IE;height:100%;resize:both;margin:0}#edit-form-body textarea:focus{border-color:#333}#tablepress-page input[type=text],#tablepress-page select,#tablepress-page textarea{box-shadow: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/add.js
CHANGED
@@ -21,14 +21,6 @@ jQuery( document ).ready( function( $ ) {
|
|
21 |
$( '#tablepress-page' ).find( 'form' ).on( 'submit', function( /* event */ ) {
|
22 |
var valid_form = true;
|
23 |
|
24 |
-
// remove default values from required placeholders, if no value was entered
|
25 |
-
$( '#tablepress-page' ).find( '.form-required' ).find( '.placeholder' ).each( function() {
|
26 |
-
if ( this.value === this.defaultValue ) {
|
27 |
-
this.value = '';
|
28 |
-
$(this).removeClass( 'placeholder-active' );
|
29 |
-
}
|
30 |
-
} );
|
31 |
-
|
32 |
// WordPress validation function, checks if required fields (.form-required) are non-empty
|
33 |
if ( ! validateForm( $(this) ) ) {
|
34 |
valid_form = false;
|
@@ -58,17 +50,10 @@ jQuery( document ).ready( function( $ ) {
|
|
58 |
valid_form = false;
|
59 |
} );
|
60 |
|
|
|
61 |
if ( ! valid_form ) {
|
62 |
return false;
|
63 |
}
|
64 |
-
// at this point, the form is valid and will be submitted
|
65 |
-
|
66 |
-
// remove the default values of optional fields, as we don't want to save those
|
67 |
-
$( '#tablepress-page' ).find( '.placeholder' ).each( function() {
|
68 |
-
if ( this.value === this.defaultValue ) {
|
69 |
-
this.value = '';
|
70 |
-
}
|
71 |
-
} );
|
72 |
} );
|
73 |
|
74 |
} );
|
21 |
$( '#tablepress-page' ).find( 'form' ).on( 'submit', function( /* event */ ) {
|
22 |
var valid_form = true;
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
// WordPress validation function, checks if required fields (.form-required) are non-empty
|
25 |
if ( ! validateForm( $(this) ) ) {
|
26 |
valid_form = false;
|
50 |
valid_form = false;
|
51 |
} );
|
52 |
|
53 |
+
// Don't submit the form if it's not valid.
|
54 |
if ( ! valid_form ) {
|
55 |
return false;
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
} );
|
58 |
|
59 |
} );
|
admin/js/add.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(i){"use strict";i("#tablepress-page").find("form").on("submit",function(){var t=!0;if(
|
1 |
+
jQuery(document).ready(function(i){"use strict";i("#tablepress-page").find("form").on("submit",function(){var t=!0;if(validateForm(i(this))||(t=!1),i("#tablepress-page").find(".form-field-numbers-only").find("input").each(function(){var e=i(this),n=parseInt(e.attr("maxlength"),10);isNaN(n)?n="":n+=-1,new RegExp("^[1-9][0-9]{0,"+n+"}$").test(e.val())||(e.one("change",function(){i(this).closest(".form-invalid").removeClass("form-invalid")}).focus().select().closest(".form-field").addClass("form-invalid"),t=!1)}),!t)return!1})});
|
admin/js/common.js
CHANGED
@@ -24,25 +24,6 @@ jQuery( document ).ready( function( $ ) {
|
|
24 |
*/
|
25 |
postboxes.add_postbox_toggles( pagenow );
|
26 |
|
27 |
-
/**
|
28 |
-
* Remove/add title to value on focus/blur of text fields "Table Name" and "Table Description" on "Add new Table" screen
|
29 |
-
*
|
30 |
-
* @since 1.0.0
|
31 |
-
*/
|
32 |
-
$( '#tablepress-page' )
|
33 |
-
.on( 'focus', '.placeholder', function() {
|
34 |
-
if ( this.value === this.defaultValue ) {
|
35 |
-
this.value = '';
|
36 |
-
$(this).removeClass( 'placeholder-active' );
|
37 |
-
}
|
38 |
-
} )
|
39 |
-
.on( 'blur', '.placeholder', function() {
|
40 |
-
if ( '' === this.value ) {
|
41 |
-
this.value = this.defaultValue;
|
42 |
-
$(this).addClass( 'placeholder-active' );
|
43 |
-
}
|
44 |
-
} );
|
45 |
-
|
46 |
/**
|
47 |
* Check that numerical fields (e.g. column/row number fields) only contain numbers
|
48 |
*
|
24 |
*/
|
25 |
postboxes.add_postbox_toggles( pagenow );
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
/**
|
28 |
* Check that numerical fields (e.g. column/row number fields) only contain numbers
|
29 |
*
|
admin/js/common.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
window.tp=window.tp||{},jQuery(document).ready(function(t){"use strict";postboxes.add_postbox_toggles(pagenow),t("#tablepress-page").on("
|
1 |
+
window.tp=window.tp||{},jQuery(document).ready(function(t){"use strict";postboxes.add_postbox_toggles(pagenow),t("#tablepress-page").on("blur",".numbers-only, .form-field-numbers-only input",function(){var e=t(this);e.val(e.val().replace(/[^0-9]/g,""))}),t("#tablepress-page").on("click",".delete-link",function(){if(!confirm(tablepress_common.ays_delete_single_table))return!1;tp.made_changes=!1}),t("#tablepress-page").on("click",".table-shortcode",function(){t(this).focus().select()})});
|
admin/js/edit.js
CHANGED
@@ -660,7 +660,7 @@ jQuery( document ).ready( function( $ ) {
|
|
660 |
tp.columns.move.$rows = $id( 'edit-form-body' ).children().add( '#edit-form-foot' );
|
661 |
|
662 |
tp.columns.move.$cells = tp.columns.move.$rows
|
663 |
-
.
|
664 |
.each( function() {
|
665 |
tp.columns.move.$cell = $(this);
|
666 |
$( '<td class="move-placeholder"><div/></td>' ).insertBefore( tp.columns.move.$cell );
|
660 |
tp.columns.move.$rows = $id( 'edit-form-body' ).children().add( '#edit-form-foot' );
|
661 |
|
662 |
tp.columns.move.$cells = tp.columns.move.$rows
|
663 |
+
.children( ':nth-child(' + ( tp.columns.move.source_idx + 1 ) + ')' )
|
664 |
.each( function() {
|
665 |
tp.columns.move.$cell = $(this);
|
666 |
$( '<td class="move-placeholder"><div/></td>' ).insertBefore( tp.columns.move.$cell );
|
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 “Shift” 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 “Shift” 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 “Shift” 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 “Shift” 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()});
|
1 |
+
window.tp=window.tp||{},jQuery(document).ready(function(i){"use strict";function l(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(){function a(e,t){function a(e,t){return(!e.match(c)||1===t)&&parseFloat(e)||e.replace(i," ").replace(r,"")||0}var n,o,s=/(^([+\-]?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?(?=\D|\s|$))|^0x[\da-fA-F]+$|\d+)/g,r=/^\s+|\s+$/g,i=/\s+/g,l=/^0x[0-9a-f]+$/i,c=/^0/,d=e.replace(r,"")||"",p=t.replace(r,"")||"",u=d.replace(s,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),h=p.replace(s,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),_=parseInt(d.match(l),16)||1!==u.length&&Date.parse(d),m=parseInt(p.match(l),16)||_&&p.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(p)||null;if(m){if(_<m)return-1;if(m<_)return 1}for(var b=0,f=u.length,v=h.length,g=Math.max(f,v);b<g;b++){if(n=a(u[b]||"",f),o=a(h[b]||"",v),isNaN(n)!==isNaN(o))return isNaN(n)?1:-1;if(/[^\x00-\x80]/.test(n+o)&&n.localeCompare){var w=n.localeCompare(o);return w/Math.abs(w)}if(n<o)return-1;if(o<n)return 1}}var n=i(this).parent().index(),o=i(this).hasClass("sort-asc")?1:-1,e=i("#edit-form-body"),t=e.find(".head-row").prevAll().addBack(),s=e.find(".foot-row").nextAll().addBack(),r=e.children().not(t).not(s).get();i.each(r,function(e,t){t.sort_key=(""+i(t).children().eq(n).find("textarea").val()).toLowerCase()}),r.sort(function(e,t){return o*a(e.sort_key,t.sort_key)}),i.each(r,function(e,t){t.sort_key=null}),e.append(t),e.append(r),e.append(s),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.children(":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 “Shift” 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 “Shift” 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 “Shift” 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 “Shift” 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()});
|
admin/js/import.js
CHANGED
@@ -7,24 +7,28 @@
|
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
|
10 |
-
/* global alert, tablepress_import */
|
11 |
-
|
12 |
jQuery( document ).ready( function( $ ) {
|
13 |
|
14 |
'use strict';
|
15 |
|
16 |
/**
|
17 |
-
*
|
|
|
|
|
|
|
|
|
|
|
18 |
*
|
19 |
* @since 1.0.0
|
20 |
*/
|
21 |
$( '#row-import-type' ).on( 'change', 'input', function() {
|
22 |
-
|
|
|
23 |
} )
|
24 |
.find( 'input:checked' ).change();
|
25 |
|
26 |
/**
|
27 |
-
* Show only the import source field that was selected with the radio button
|
28 |
*
|
29 |
* @since 1.0.0
|
30 |
*/
|
@@ -35,33 +39,22 @@ jQuery( document ).ready( function( $ ) {
|
|
35 |
.find( 'input:checked' ).change();
|
36 |
|
37 |
/**
|
38 |
-
*
|
39 |
-
*
|
40 |
-
* @since 1.0.0
|
41 |
-
*/
|
42 |
-
$( '#row-import-wp-table-reloaded-source' ).on( 'change', 'input', function() {
|
43 |
-
$( '#row-import-wp-table-reloaded-source-dump-file, #row-import-wp-table-reloaded-source-db' ).hide();
|
44 |
-
$( '#row-import-wp-table-reloaded-source-' + $(this).val() ).show();
|
45 |
-
} )
|
46 |
-
.find( 'input:checked' ).change();
|
47 |
-
|
48 |
-
/**
|
49 |
-
* Select correct value in import format dropdown on file select
|
50 |
*
|
51 |
* @since 1.0.0
|
52 |
*/
|
53 |
$( '#tables-import-file-upload, #tables-import-url, #tables-import-server' ).on( 'change', function( event ) {
|
54 |
var path = $(this).val(),
|
|
|
55 |
filename_start,
|
56 |
extension_start,
|
57 |
-
filename = path
|
58 |
-
extension = 'csv';
|
59 |
|
60 |
-
//
|
61 |
if ( 'tables-import-url' === event.target.id ) {
|
62 |
extension = 'html';
|
63 |
}
|
64 |
-
//
|
65 |
filename_start = path.lastIndexOf( '\\' );
|
66 |
if ( -1 !== filename_start ) { // Windows-based path
|
67 |
filename = path.substr( filename_start + 1 );
|
@@ -71,18 +64,20 @@ jQuery( document ).ready( function( $ ) {
|
|
71 |
filename = path.substr( filename_start + 1 );
|
72 |
}
|
73 |
}
|
74 |
-
//
|
75 |
extension_start = filename.lastIndexOf( '.' );
|
76 |
if ( -1 !== extension_start ) {
|
77 |
extension = filename.substr( extension_start + 1 ).toLowerCase();
|
78 |
}
|
79 |
|
80 |
-
//
|
81 |
if ( 'htm' === extension ) {
|
82 |
extension = 'html';
|
83 |
}
|
84 |
|
85 |
-
|
|
|
|
|
86 |
if ( 'zip' === extension ) {
|
87 |
return;
|
88 |
}
|
@@ -101,7 +96,7 @@ jQuery( document ).ready( function( $ ) {
|
|
101 |
valid_form = true,
|
102 |
import_type = $( '#row-import-type' ).find( 'input:checked' ).val();
|
103 |
|
104 |
-
|
105 |
if ( selected_import_source_field.defaultValue === selected_import_source_field.value ) {
|
106 |
$( selected_import_source_field )
|
107 |
.addClass( 'invalid' )
|
@@ -110,8 +105,8 @@ jQuery( document ).ready( function( $ ) {
|
|
110 |
valid_form = false;
|
111 |
}
|
112 |
|
113 |
-
|
114 |
-
if ( 'replace' === import_type || 'append' === import_type ) {
|
115 |
if ( '' === $( '#tables-import-existing-table' ).val() ) {
|
116 |
$( '#row-import-type' )
|
117 |
.one( 'change', 'input', function() { $( '#tables-import-existing-table' ).removeClass( 'invalid' ); } );
|
@@ -123,35 +118,10 @@ jQuery( document ).ready( function( $ ) {
|
|
123 |
}
|
124 |
}
|
125 |
|
|
|
126 |
if ( ! valid_form ) {
|
127 |
return false;
|
128 |
}
|
129 |
-
// at this point, the form is valid and will be submitted
|
130 |
-
} );
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Remove form validation check if "Import from WP-Table Reloaded" button is clicked
|
134 |
-
*
|
135 |
-
* @since 1.0.0
|
136 |
-
*/
|
137 |
-
$( '#tablepress-page' ).find( '#submit_wp_table_reloaded_import' ).on( 'click', function() {
|
138 |
-
$( '#tablepress-page' ).find( 'form' ).off( 'submit.tablepress' );
|
139 |
-
|
140 |
-
/* File upload must have a file, if Dump File is selected as the source */
|
141 |
-
if ( $( '#import-wp-table-reloaded-source-dump-file' ).prop( 'checked' ) && '' === $( '#tables-import-wp-table-reloaded-dump-file' ).val() ) {
|
142 |
-
$( '#tables-import-wp-table-reloaded-dump-file' )
|
143 |
-
.addClass( 'invalid' )
|
144 |
-
.one( 'change', function() { $(this).removeClass( 'invalid' ); } )
|
145 |
-
.focus().select();
|
146 |
-
return false;
|
147 |
-
}
|
148 |
-
|
149 |
-
/* At least one checkbox must be check, to have something imported */
|
150 |
-
if ( ! $( '#import-wp-table-reloaded-tables' ).prop( 'checked' ) && ! $( '#import-wp-table-reloaded-css' ).prop( 'checked' ) ) {
|
151 |
-
alert( tablepress_import.error_wp_table_reloaded_nothing_selected );
|
152 |
-
return false;
|
153 |
-
}
|
154 |
-
|
155 |
} );
|
156 |
|
157 |
} );
|
7 |
* @since 1.0.0
|
8 |
*/
|
9 |
|
|
|
|
|
10 |
jQuery( document ).ready( function( $ ) {
|
11 |
|
12 |
'use strict';
|
13 |
|
14 |
/**
|
15 |
+
* File extension of the file that is imported.
|
16 |
+
*/
|
17 |
+
var extension = 'csv';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Show select box for table to replace only if needed.
|
21 |
*
|
22 |
* @since 1.0.0
|
23 |
*/
|
24 |
$( '#row-import-type' ).on( 'change', 'input', function() {
|
25 |
+
var import_type = $( this ).val();
|
26 |
+
$( '#tables-import-existing-table' ).prop( 'disabled', ( ( 'replace' !== import_type && 'append' !== import_type ) || 'zip' === extension ) );
|
27 |
} )
|
28 |
.find( 'input:checked' ).change();
|
29 |
|
30 |
/**
|
31 |
+
* Show only the import source field that was selected with the radio button.
|
32 |
*
|
33 |
* @since 1.0.0
|
34 |
*/
|
39 |
.find( 'input:checked' ).change();
|
40 |
|
41 |
/**
|
42 |
+
* Select correct value in import format dropdown on file select.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
*
|
44 |
* @since 1.0.0
|
45 |
*/
|
46 |
$( '#tables-import-file-upload, #tables-import-url, #tables-import-server' ).on( 'change', function( event ) {
|
47 |
var path = $(this).val(),
|
48 |
+
import_type = $( '#row-import-type' ).find( 'input:checked' ).val(),
|
49 |
filename_start,
|
50 |
extension_start,
|
51 |
+
filename = path;
|
|
|
52 |
|
53 |
+
// Default extension: CSV for file upload and server, HTML for URL.
|
54 |
if ( 'tables-import-url' === event.target.id ) {
|
55 |
extension = 'html';
|
56 |
}
|
57 |
+
// Determine filename from full path.
|
58 |
filename_start = path.lastIndexOf( '\\' );
|
59 |
if ( -1 !== filename_start ) { // Windows-based path
|
60 |
filename = path.substr( filename_start + 1 );
|
64 |
filename = path.substr( filename_start + 1 );
|
65 |
}
|
66 |
}
|
67 |
+
// Determine extension from filename.
|
68 |
extension_start = filename.lastIndexOf( '.' );
|
69 |
if ( -1 !== extension_start ) {
|
70 |
extension = filename.substr( extension_start + 1 ).toLowerCase();
|
71 |
}
|
72 |
|
73 |
+
// Allow .htm for HTML as well.
|
74 |
if ( 'htm' === extension ) {
|
75 |
extension = 'html';
|
76 |
}
|
77 |
|
78 |
+
$( '#tables-import-existing-table' ).prop( 'disabled', ( ( 'replace' !== import_type && 'append' !== import_type ) || 'zip' === extension ) );
|
79 |
+
|
80 |
+
// Don't change the format for ZIP archives.
|
81 |
if ( 'zip' === extension ) {
|
82 |
return;
|
83 |
}
|
96 |
valid_form = true,
|
97 |
import_type = $( '#row-import-type' ).find( 'input:checked' ).val();
|
98 |
|
99 |
+
// Te value of the selected import source field must be set/changed from the default.
|
100 |
if ( selected_import_source_field.defaultValue === selected_import_source_field.value ) {
|
101 |
$( selected_import_source_field )
|
102 |
.addClass( 'invalid' )
|
105 |
valid_form = false;
|
106 |
}
|
107 |
|
108 |
+
// If replace or append is selected, a table must be selected - except for ZIP files.
|
109 |
+
if ( ( 'replace' === import_type || 'append' === import_type ) && 'zip' !== extension ) {
|
110 |
if ( '' === $( '#tables-import-existing-table' ).val() ) {
|
111 |
$( '#row-import-type' )
|
112 |
.one( 'change', 'input', function() { $( '#tables-import-existing-table' ).removeClass( 'invalid' ); } );
|
118 |
}
|
119 |
}
|
120 |
|
121 |
+
// Don't submit the form if it's not valid.
|
122 |
if ( ! valid_form ) {
|
123 |
return false;
|
124 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
} );
|
126 |
|
127 |
} );
|
admin/js/import.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(
|
1 |
+
jQuery(document).ready(function(s){"use strict";var n="csv";s("#row-import-type").on("change","input",function(){var e=s(this).val();s("#tables-import-existing-table").prop("disabled","replace"!==e&&"append"!==e||"zip"===n)}).find("input:checked").change(),s("#row-import-source").on("change","input",function(){s("#row-import-source-file-upload, #row-import-source-url, #row-import-source-server, #row-import-source-form-field").hide(),s("#row-import-source-"+s(this).val()).show()}).find("input:checked").change(),s("#tables-import-file-upload, #tables-import-url, #tables-import-server").on("change",function(e){var t,i,r=s(this).val(),a=s("#row-import-type").find("input:checked").val(),o=r;"tables-import-url"===e.target.id&&(n="html"),-1!==(t=r.lastIndexOf("\\"))?o=r.substr(t+1):-1!==(t=r.lastIndexOf("/"))&&(o=r.substr(t+1)),-1!==(i=o.lastIndexOf("."))&&(n=o.substr(i+1).toLowerCase()),"htm"===n&&(n="html"),s("#tables-import-existing-table").prop("disabled","replace"!==a&&"append"!==a||"zip"===n),"zip"!==n&&s("#tables-import-format").val(n)}),s("#tablepress-page").find("form").on("submit.tablepress",function(){var e=s("#row-import-source").find("input:checked").val(),t=s("#tables-import-"+e).get(0),i=!0,r=s("#row-import-type").find("input:checked").val();if(t.defaultValue===t.value&&(s(t).addClass("invalid").one("change",function(){s(this).removeClass("invalid")}).focus().select(),i=!1),"replace"!==r&&"append"!==r||"zip"===n||""===s("#tables-import-existing-table").val()&&(s("#row-import-type").one("change","input",function(){s("#tables-import-existing-table").removeClass("invalid")}),s("#tables-import-existing-table").addClass("invalid").one("change",function(){s(this).removeClass("invalid")}).focus().select(),i=!1),!i)return!1})});
|
classes/class-css.php
CHANGED
@@ -60,7 +60,7 @@ class TablePress_CSS {
|
|
60 |
$csstidy->set_cfg( 'css_level', 'CSS3.0' );
|
61 |
$csstidy->set_cfg( 'preserve_css', true );
|
62 |
$csstidy->set_cfg( 'timestamp', false );
|
63 |
-
$csstidy->set_cfg( 'template',
|
64 |
|
65 |
$csstidy->parse( $css );
|
66 |
return $csstidy->print->plain();
|
@@ -249,7 +249,7 @@ class TablePress_CSS {
|
|
249 |
/**
|
250 |
* Save "Custom CSS" to files, delete "Custom CSS" files, or return HTML for the credentials form.
|
251 |
*
|
252 |
-
* Only used from "Plugin Options" screen, save_custom_css_to_file() is used in cases where no form output/redirection is possible (plugin updates
|
253 |
*
|
254 |
* @since 1.0.0
|
255 |
*
|
@@ -437,6 +437,10 @@ class TablePress_CSS {
|
|
437 |
if ( function_exists( 'w3tc_minify_flush' ) ) {
|
438 |
w3tc_minify_flush();
|
439 |
}
|
|
|
|
|
|
|
|
|
440 |
}
|
441 |
|
442 |
} // class TablePress_CSS
|
60 |
$csstidy->set_cfg( 'css_level', 'CSS3.0' );
|
61 |
$csstidy->set_cfg( 'preserve_css', true );
|
62 |
$csstidy->set_cfg( 'timestamp', false );
|
63 |
+
$csstidy->set_cfg( 'template', TABLEPRESS__DIR__ . '/libraries/csstidy/tablepress-standard.tpl' );
|
64 |
|
65 |
$csstidy->parse( $css );
|
66 |
return $csstidy->print->plain();
|
249 |
/**
|
250 |
* Save "Custom CSS" to files, delete "Custom CSS" files, or return HTML for the credentials form.
|
251 |
*
|
252 |
+
* Only used from "Plugin Options" screen, save_custom_css_to_file() is used in cases where no form output/redirection is possible (e.g. during plugin updates).
|
253 |
*
|
254 |
* @since 1.0.0
|
255 |
*
|
437 |
if ( function_exists( 'w3tc_minify_flush' ) ) {
|
438 |
w3tc_minify_flush();
|
439 |
}
|
440 |
+
// WP Fastest Cache
|
441 |
+
if ( isset( $GLOBALS['wp_fastest_cache'] ) && method_exists( $GLOBALS['wp_fastest_cache'], 'deleteCache' ) ) {
|
442 |
+
$GLOBALS['wp_fastest_cache']->deleteCache( true );
|
443 |
+
}
|
444 |
}
|
445 |
|
446 |
} // class TablePress_CSS
|
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.
|
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 =
|
40 |
|
41 |
/**
|
42 |
* TablePress "table scheme" (data format structure) version.
|
@@ -113,9 +113,9 @@ abstract class TablePress {
|
|
113 |
return;
|
114 |
}
|
115 |
|
116 |
-
// Check if minimum requirements are fulfilled, currently WordPress
|
117 |
include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
|
118 |
-
if ( version_compare( str_replace( '-src', '', $wp_version ), '
|
119 |
// Show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work.
|
120 |
if ( current_user_can( 'update_plugins' ) ) {
|
121 |
add_action( 'admin_notices', array( 'TablePress', 'show_minimum_requirements_error_notice' ) );
|
26 |
* @since 1.0.0
|
27 |
* @const string
|
28 |
*/
|
29 |
+
const version = '1.10';
|
30 |
|
31 |
/**
|
32 |
* TablePress internal plugin version ("options scheme" version).
|
36 |
* @since 1.0.0
|
37 |
* @const int
|
38 |
*/
|
39 |
+
const db_version = 39;
|
40 |
|
41 |
/**
|
42 |
* TablePress "table scheme" (data format structure) version.
|
113 |
return;
|
114 |
}
|
115 |
|
116 |
+
// Check if minimum requirements are fulfilled, currently WordPress 5.3.
|
117 |
include( ABSPATH . WPINC . '/version.php' ); // Include an unmodified $wp_version.
|
118 |
+
if ( version_compare( str_replace( '-src', '', $wp_version ), '5.3', '<' ) ) {
|
119 |
// Show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work.
|
120 |
if ( current_user_can( 'update_plugins' ) ) {
|
121 |
add_action( 'admin_notices', array( 'TablePress', 'show_minimum_requirements_error_notice' ) );
|
classes/class-view.php
CHANGED
@@ -102,14 +102,14 @@ abstract class TablePress_View {
|
|
102 |
'id' => 'tablepress-help', // This should be unique for the screen.
|
103 |
'title' => __( 'TablePress Help', 'tablepress' ),
|
104 |
'content' => '<p>' . $this->help_tab_content() . '</p>'
|
105 |
-
. '<p>' . sprintf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin
|
106 |
-
. sprintf( __( 'For technical information, please see the <a href="%s">
|
107 |
. sprintf( __( '<a href="%1$s">Support</a> is provided through the <a href="%2$s">WordPress Support Forums</a>.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/tags/tablepress' ) . ' '
|
108 |
. sprintf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a>, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ) . '<br />'
|
109 |
. sprintf( __( 'If you like the plugin, <a href="%1$s"><strong>a donation</strong></a> is recommended.', 'tablepress' ), 'https://tablepress.org/donate/' ) . '</p>',
|
110 |
) );
|
111 |
// "sidebar" in the help tab.
|
112 |
-
$screen->set_help_sidebar( '<p><strong>' . __( 'For more information:', 'tablepress' ) . '</strong></p><p><a href="https://tablepress.org/"
|
113 |
}
|
114 |
|
115 |
/**
|
102 |
'id' => 'tablepress-help', // This should be unique for the screen.
|
103 |
'title' => __( 'TablePress Help', 'tablepress' ),
|
104 |
'content' => '<p>' . $this->help_tab_content() . '</p>'
|
105 |
+
. '<p>' . sprintf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin website</a> or on its page in the <a href="%2$s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ) . ' '
|
106 |
+
. sprintf( __( 'For technical information, please see the <a href="%s">Documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' ) . ' '
|
107 |
. sprintf( __( '<a href="%1$s">Support</a> is provided through the <a href="%2$s">WordPress Support Forums</a>.', 'tablepress' ), 'https://tablepress.org/support/', 'https://wordpress.org/tags/tablepress' ) . ' '
|
108 |
. sprintf( __( 'Before asking for support, please carefully read the <a href="%s">Frequently Asked Questions</a>, where you will find answers to the most common questions, and search through the forums.', 'tablepress' ), 'https://tablepress.org/faq/' ) . '<br />'
|
109 |
. sprintf( __( 'If you like the plugin, <a href="%1$s"><strong>a donation</strong></a> is recommended.', 'tablepress' ), 'https://tablepress.org/donate/' ) . '</p>',
|
110 |
) );
|
111 |
// "sidebar" in the help tab.
|
112 |
+
$screen->set_help_sidebar( '<p><strong>' . __( 'For more information:', 'tablepress' ) . '</strong></p><p><a href="https://tablepress.org/">TablePress Website</a></p><p><a href="https://tablepress.org/faq/">TablePress FAQ</a></p><p><a href="https://tablepress.org/documentation/">TablePress Documentation</a></p><p><a href="https://tablepress.org/support/">TablePress Support</a></p>' );
|
113 |
}
|
114 |
|
115 |
/**
|
controllers/controller-admin.php
CHANGED
@@ -37,14 +37,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
37 |
*/
|
38 |
protected $view_actions = array();
|
39 |
|
40 |
-
/**
|
41 |
-
* Whether language support has been loaded (to prevent doing it twice).
|
42 |
-
*
|
43 |
-
* @since 1.0.0
|
44 |
-
* @var bool
|
45 |
-
*/
|
46 |
-
protected $i18n_support_loaded = false;
|
47 |
-
|
48 |
/**
|
49 |
* Instance of the TablePress Admin View that is rendered.
|
50 |
*
|
@@ -111,12 +103,10 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
111 |
*/
|
112 |
$admin_menu_entry_name = apply_filters( 'tablepress_admin_menu_entry_name', 'TablePress' );
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
$this->init_i18n_support();
|
117 |
-
$this->init_view_actions(); // after init_i18n_support(), as it requires translation
|
118 |
-
$min_access_cap = $this->view_actions['list']['required_cap'];
|
119 |
|
|
|
120 |
$icon_url = 'dashicons-list-view';
|
121 |
switch ( $this->parent_page ) {
|
122 |
case 'top':
|
@@ -142,8 +132,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
142 |
$this->page_hooks[] = add_submenu_page( 'tablepress', sprintf( __( '%1$s ‹ %2$s', 'tablepress' ), $entry['page_title'], 'TablePress' ), $entry['admin_menu_title'], $entry['required_cap'], $slug, $callback );
|
143 |
}
|
144 |
} else {
|
145 |
-
$this->init_view_actions(); // no translation necessary here
|
146 |
-
$min_access_cap = $this->view_actions['list']['required_cap'];
|
147 |
$this->page_hooks[] = add_submenu_page( $this->parent_page, 'TablePress', $admin_menu_entry_name, $min_access_cap, 'tablepress', $callback );
|
148 |
}
|
149 |
}
|
@@ -179,7 +167,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
179 |
}
|
180 |
|
181 |
add_action( 'load-plugins.php', array( $this, 'plugins_page' ) );
|
182 |
-
add_action( 'admin_print_styles-media-upload-popup', array( $this, 'add_media_upload_thickbox_css' ) );
|
183 |
|
184 |
// Add filters and actions for the integration into the WP WXR exporter and importer.
|
185 |
add_action( 'wp_import_insert_post', array( TablePress::$model_table, 'add_table_id_on_wp_import' ), 10, 4 );
|
@@ -197,7 +184,14 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
197 |
return;
|
198 |
}
|
199 |
|
200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
add_thickbox(); // usually already loaded by media upload functions
|
202 |
$admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
|
203 |
$admin_page->enqueue_script( 'quicktags-button', array( 'quicktags', 'media-upload' ), array(
|
@@ -257,18 +251,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
257 |
echo '}</style>' . "\n";
|
258 |
}
|
259 |
|
260 |
-
/**
|
261 |
-
* Print some CSS in the Media Upload Thickbox to fix some positioning issues.
|
262 |
-
*
|
263 |
-
* These will most likely not be fixed in core, as the old media uploader is deprecated.
|
264 |
-
* They will be removed in TablePress, once the new media uploader is used.
|
265 |
-
*
|
266 |
-
* @since 1.4.0
|
267 |
-
*/
|
268 |
-
public function add_media_upload_thickbox_css() {
|
269 |
-
echo '<style type="text/css">#media-items,#media-upload #filter{width:auto!important}.media-item .describe input[type="text"],.media-item .describe textarea{width:100%!important}.media-item .image-editor input[type="text"]{width:3em!important}</style>' . "\n";
|
270 |
-
}
|
271 |
-
|
272 |
/**
|
273 |
* Add "TablePress Table" entry to "New" dropdown menu in the WP Admin Bar.
|
274 |
*
|
@@ -280,8 +262,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
280 |
if ( ! current_user_can( 'tablepress_add_tables' ) ) {
|
281 |
return;
|
282 |
}
|
283 |
-
|
284 |
-
// Might need $this->init_i18n_support(); here.
|
285 |
$wp_admin_bar->add_menu( array(
|
286 |
'parent' => 'new-content',
|
287 |
'id' => 'new-tablepress-table',
|
@@ -296,7 +277,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
296 |
* @since 1.0.0
|
297 |
*/
|
298 |
public function plugins_page() {
|
299 |
-
$this->init_i18n_support();
|
300 |
// Add additional links on Plugins page.
|
301 |
add_filter( 'plugin_action_links_' . TABLEPRESS_BASENAME, array( $this, 'add_plugin_action_links' ) );
|
302 |
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
|
@@ -349,15 +329,11 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
349 |
// Actions that are top-level entries, but don't have an action GET parameter (action is after last _ in string).
|
350 |
$action = substr( $_GET['page'], 11 ); // $_GET['page'] has the format 'tablepress_{$action}'
|
351 |
}
|
352 |
-
} else {
|
353 |
-
// Do this here in the else-part, instead of adding another if ( ! $this->is_top_level_page ) check.
|
354 |
-
$this->init_i18n_support(); // done here, as for sub menu admin pages this is the first time translated strings are needed.
|
355 |
-
$this->init_view_actions(); // for top-level menu entries, this has been done above, just like init_i18n_support().
|
356 |
}
|
357 |
|
358 |
// Check if action is a supported action, and whether the user is allowed to access this screen.
|
359 |
if ( ! isset( $this->view_actions[ $action ] ) || ! current_user_can( $this->view_actions[ $action ]['required_cap'] ) ) {
|
360 |
-
wp_die( __( '
|
361 |
}
|
362 |
|
363 |
// Changes current screen ID and pagenow variable in JS, to enable automatic meta box JS handling.
|
@@ -381,12 +357,8 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
381 |
// Prime the post meta cache for cached loading of last_editor.
|
382 |
$data['table_ids'] = TablePress::$model_table->load_all( true );
|
383 |
$data['messages']['first_visit'] = TablePress::$model_options->get( 'message_first_visit' );
|
384 |
-
if
|
385 |
-
|
386 |
-
$data['messages']['wp_table_reloaded_warning'] = is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' );
|
387 |
-
} else {
|
388 |
-
$data['messages']['wp_table_reloaded_warning'] = false;
|
389 |
-
}
|
390 |
$data['messages']['plugin_update_message'] = TablePress::$model_options->get( 'message_plugin_update' );
|
391 |
$data['messages']['donation_message'] = $this->maybe_show_donation_message();
|
392 |
$data['table_count'] = count( $data['table_ids'] );
|
@@ -434,7 +406,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
434 |
TablePress::redirect( array( 'action' => 'list', 'message' => 'error_load_table' ) );
|
435 |
}
|
436 |
if ( ! current_user_can( 'tablepress_edit_table', $_GET['table_id'] ) ) {
|
437 |
-
wp_die( __( '
|
438 |
}
|
439 |
} else {
|
440 |
TablePress::redirect( array( 'action' => 'list', 'message' => 'error_no_table' ) );
|
@@ -472,8 +444,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
472 |
$data['import_url'] = ( ! empty( $_GET['import_url'] ) ) ? wp_unslash( $_GET['import_url'] ) : 'http://';
|
473 |
$data['import_server'] = ( ! empty( $_GET['import_server'] ) ) ? wp_unslash( $_GET['import_server'] ) : ABSPATH;
|
474 |
$data['import_form_field'] = ( ! empty( $_GET['import_form_field'] ) ) ? wp_unslash( $_GET['import_form_field'] ) : '';
|
475 |
-
$data['wp_table_reloaded_installed'] = ( false !== get_option( 'wp_table_reloaded_options', false ) && false !== get_option( 'wp_table_reloaded_tables', false ) );
|
476 |
-
$data['import_wp_table_reloaded_source'] = ( ! empty( $_GET['import_wp_table_reloaded_source'] ) ) ? $_GET['import_wp_table_reloaded_source'] : ( $data['wp_table_reloaded_installed'] ? 'db' : 'dump-file' );
|
477 |
break;
|
478 |
}
|
479 |
|
@@ -500,19 +470,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
500 |
$this->view->render();
|
501 |
}
|
502 |
|
503 |
-
/**
|
504 |
-
* Initialize i18n support, load plugin's textdomain, to retrieve correct translations.
|
505 |
-
*
|
506 |
-
* @since 1.0.0
|
507 |
-
*/
|
508 |
-
protected function init_i18n_support() {
|
509 |
-
if ( $this->i18n_support_loaded ) {
|
510 |
-
return;
|
511 |
-
}
|
512 |
-
load_plugin_textdomain( 'tablepress', false, dirname( TABLEPRESS_BASENAME ) . '/i18n' );
|
513 |
-
$this->i18n_support_loaded = true;
|
514 |
-
}
|
515 |
-
|
516 |
/**
|
517 |
* Decide whether a donate message shall be shown on the "All Tables" screen, depending on passed days since installation and whether it was shown before.
|
518 |
*
|
@@ -637,7 +594,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
637 |
|
638 |
switch ( $bulk_action ) {
|
639 |
case 'copy':
|
640 |
-
$this->init_i18n_support(); // for the translation of "Copy of"
|
641 |
foreach ( $tables as $table_id ) {
|
642 |
if ( current_user_can( 'tablepress_copy_table', $table_id ) ) {
|
643 |
$copy_table_id = TablePress::$model_table->copy( $table_id );
|
@@ -708,7 +664,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
708 |
TablePress::check_nonce( 'edit', $edit_table['id'], 'nonce-edit-table' );
|
709 |
|
710 |
if ( ! current_user_can( 'tablepress_edit_table', $edit_table['id'] ) ) {
|
711 |
-
wp_die( __( '
|
712 |
}
|
713 |
|
714 |
// Options array must exist, so that checkboxes can be evaluated.
|
@@ -788,7 +744,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
788 |
TablePress::check_nonce( 'add' );
|
789 |
|
790 |
if ( ! current_user_can( 'tablepress_add_tables' ) ) {
|
791 |
-
wp_die( __( '
|
792 |
}
|
793 |
|
794 |
if ( empty( $_POST['table'] ) || ! is_array( $_POST['table'] ) ) {
|
@@ -844,7 +800,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
844 |
TablePress::check_nonce( 'options' );
|
845 |
|
846 |
if ( ! current_user_can( 'tablepress_access_options_screen' ) ) {
|
847 |
-
wp_die( __( '
|
848 |
}
|
849 |
|
850 |
if ( empty( $_POST['options'] ) || ! is_array( $_POST['options'] ) ) {
|
@@ -916,7 +872,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
916 |
TablePress::check_nonce( 'export' );
|
917 |
|
918 |
if ( ! current_user_can( 'tablepress_export_tables' ) ) {
|
919 |
-
wp_die( __( '
|
920 |
}
|
921 |
|
922 |
if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) {
|
@@ -956,7 +912,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
956 |
if ( ! $export_to_zip ) {
|
957 |
// This is only possible for one table, so take the first one.
|
958 |
if ( ! current_user_can( 'tablepress_export_table', $tables[0] ) ) {
|
959 |
-
wp_die( __( '
|
960 |
}
|
961 |
// Load table, with table data, options, and visibility settings.
|
962 |
$table = TablePress::$model_table->load( $tables[0], true, true );
|
@@ -1051,7 +1007,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1051 |
}
|
1052 |
|
1053 |
/**
|
1054 |
-
* Import data from
|
1055 |
*
|
1056 |
* @since 1.0.0
|
1057 |
*/
|
@@ -1059,7 +1015,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1059 |
TablePress::check_nonce( 'import' );
|
1060 |
|
1061 |
if ( ! current_user_can( 'tablepress_import_tables' ) ) {
|
1062 |
-
wp_die( __( '
|
1063 |
}
|
1064 |
|
1065 |
if ( empty( $_POST['import'] ) || ! is_array( $_POST['import'] ) ) {
|
@@ -1068,37 +1024,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1068 |
$import = wp_unslash( $_POST['import'] );
|
1069 |
}
|
1070 |
|
1071 |
-
// Determine if this is a regular import or an import from WP-Table Reloaded.
|
1072 |
-
if ( isset( $_POST['submit_wp_table_reloaded_import'] ) && isset( $import['wp_table_reloaded'] ) && isset( $import['wp_table_reloaded']['source'] ) ) {
|
1073 |
-
if ( ! current_user_can( 'tablepress_import_tables_wptr' ) ) {
|
1074 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.', 'default' ), 403 );
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
// Handle checkbox selections.
|
1078 |
-
$import_tables = ( isset( $import['wp_table_reloaded']['tables'] ) && 'true' === $import['wp_table_reloaded']['tables'] );
|
1079 |
-
$import_css = ( isset( $import['wp_table_reloaded']['css'] ) && 'true' === $import['wp_table_reloaded']['css'] );
|
1080 |
-
if ( ! $import_tables && ! $import_css ) {
|
1081 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_nothing_selected' ) );
|
1082 |
-
}
|
1083 |
-
|
1084 |
-
if ( 'db' === $import['wp_table_reloaded']['source'] ) {
|
1085 |
-
$this->_import_from_wp_table_reloaded_db( $import_tables, $import_css );
|
1086 |
-
} else {
|
1087 |
-
$this->_import_from_wp_table_reloaded_dump_file( $import_tables, $import_css );
|
1088 |
-
}
|
1089 |
-
} else {
|
1090 |
-
$this->_import_tablepress_regular( $import );
|
1091 |
-
}
|
1092 |
-
}
|
1093 |
-
|
1094 |
-
/**
|
1095 |
-
* Import data from existing source (Upload, URL, Server, Direct input).
|
1096 |
-
*
|
1097 |
-
* @since 1.0.0
|
1098 |
-
*
|
1099 |
-
* @param array $import Submitted form data.
|
1100 |
-
*/
|
1101 |
-
protected function _import_tablepress_regular( array $import ) {
|
1102 |
if ( ! isset( $import['type'] ) ) {
|
1103 |
$import['type'] = 'add';
|
1104 |
}
|
@@ -1109,11 +1034,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1109 |
$import['source'] = '';
|
1110 |
}
|
1111 |
|
1112 |
-
// Check if a table to replace or append to was selected.
|
1113 |
-
if ( in_array( $import['type'], array( 'replace', 'append' ), true ) && empty( $import['existing_table'] ) ) {
|
1114 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_no_existing_id', 'import_format' => $import['format'], 'import_type' => $import['type'], 'import_source' => $import['source'] ) );
|
1115 |
-
}
|
1116 |
-
|
1117 |
$import_error = true;
|
1118 |
$unlink_file = false;
|
1119 |
$import_data = array();
|
@@ -1180,20 +1100,25 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1180 |
|
1181 |
$this->importer = TablePress::load_class( 'TablePress_Import', 'class-import.php', 'classes' );
|
1182 |
|
1183 |
-
|
1184 |
-
|
1185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1186 |
if ( $unlink_file ) {
|
1187 |
@unlink( $import_data['file_location'] );
|
1188 |
}
|
1189 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => '
|
1190 |
}
|
1191 |
-
$import_zip = true;
|
1192 |
-
} else {
|
1193 |
-
$import_zip = false;
|
1194 |
-
}
|
1195 |
|
1196 |
-
if ( ! $import_zip ) {
|
1197 |
if ( ! isset( $import_data['data'] ) ) {
|
1198 |
$import_data['data'] = file_get_contents( $import_data['file_location'] );
|
1199 |
}
|
@@ -1247,8 +1172,8 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1247 |
|
1248 |
$name = $file_name;
|
1249 |
$description = $file_name;
|
1250 |
-
$existing_table_id = ( in_array( $import['type'], array( 'replace', 'append' ), true ) ) ? false : false; // @TODO: Find a way to extract the replace/append ID from the filename, maybe?
|
1251 |
-
$table_id = $this->_import_tablepress_table( $import['format'], $data, $name, $description, $existing_table_id, '
|
1252 |
if ( is_wp_error( $table_id ) ) {
|
1253 |
continue;
|
1254 |
} else {
|
@@ -1291,8 +1216,17 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1291 |
return new WP_Error( 'table_import_import_failed' );
|
1292 |
}
|
1293 |
|
|
|
|
|
|
|
|
|
|
|
1294 |
if ( false === $existing_table_id ) {
|
1295 |
-
$
|
|
|
|
|
|
|
|
|
1296 |
}
|
1297 |
|
1298 |
// To be able to replace or append to a table, editing that table must be allowed.
|
@@ -1300,16 +1234,10 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1300 |
return new WP_Error( 'table_import_replace_append_capability_check_failed' );
|
1301 |
}
|
1302 |
|
1303 |
-
// Full JSON format table can contain a table ID, try to keep that.
|
1304 |
-
$table_id_in_import = false;
|
1305 |
-
|
1306 |
switch ( $import_type ) {
|
1307 |
case 'add':
|
1308 |
$existing_table = TablePress::$model_table->get_table_template();
|
1309 |
// If name and description are imported from a new table, use those.
|
1310 |
-
if ( isset( $imported_table['id'] ) ) {
|
1311 |
-
$table_id_in_import = $imported_table['id'];
|
1312 |
-
}
|
1313 |
if ( ! isset( $imported_table['name'] ) ) {
|
1314 |
$imported_table['name'] = $name;
|
1315 |
}
|
@@ -1416,300 +1344,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1416 |
return $table_id;
|
1417 |
}
|
1418 |
|
1419 |
-
/**
|
1420 |
-
* Import data from WP-Table Reloaded from the WordPress database.
|
1421 |
-
*
|
1422 |
-
* @since 1.0.0
|
1423 |
-
*
|
1424 |
-
* @param bool $import_tables Whether tables shall be imported.
|
1425 |
-
* @param bool $import_css Whether Plugin Options (only CSS related right now) shall be imported.
|
1426 |
-
*/
|
1427 |
-
protected function _import_from_wp_table_reloaded_db( $import_tables, $import_css ) {
|
1428 |
-
if ( false === get_option( 'wp_table_reloaded_options', false ) || false === get_option( 'wp_table_reloaded_tables', false ) ) {
|
1429 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_not_installed' ) );
|
1430 |
-
}
|
1431 |
-
|
1432 |
-
$wp_table_reloaded_options = get_option( 'wp_table_reloaded_options', false );
|
1433 |
-
if ( empty( $wp_table_reloaded_options ) ) {
|
1434 |
-
$wp_table_reloaded_options = array();
|
1435 |
-
}
|
1436 |
-
|
1437 |
-
// Import WP-Table Reloaded tables.
|
1438 |
-
$not_imported_tables = $imported_tables = $imported_other_id_tables = array();
|
1439 |
-
if ( $import_tables ) {
|
1440 |
-
$wp_table_reloaded_tables_list = get_option( 'wp_table_reloaded_tables', array() );
|
1441 |
-
foreach ( $wp_table_reloaded_tables_list as $wptr_table_id => $table_option_name ) {
|
1442 |
-
$wptr_table = get_option( $table_option_name, array() );
|
1443 |
-
$import_status = $this->_import_wp_table_reloaded_table( $wptr_table, $wp_table_reloaded_options );
|
1444 |
-
switch ( $import_status ) {
|
1445 |
-
case 0:
|
1446 |
-
$not_imported_tables[] = $wptr_table_id;
|
1447 |
-
break;
|
1448 |
-
case 1:
|
1449 |
-
$imported_tables[] = $wptr_table_id;
|
1450 |
-
break;
|
1451 |
-
case 2:
|
1452 |
-
$imported_other_id_tables[] = $wptr_table_id;
|
1453 |
-
break;
|
1454 |
-
}
|
1455 |
-
}
|
1456 |
-
}
|
1457 |
-
|
1458 |
-
// Import WP-Table Reloaded Plugin Options (currently only CSS related options).
|
1459 |
-
$imported_css = false;
|
1460 |
-
if ( $import_css ) {
|
1461 |
-
$imported_css = $this->_import_wp_table_reloaded_plugin_options( $wp_table_reloaded_options );
|
1462 |
-
}
|
1463 |
-
|
1464 |
-
// @TODO: Better handling of the different cases of imported/imported-without-ID-change/not-imported tables.
|
1465 |
-
if ( count( $imported_tables ) > 1 ) {
|
1466 |
-
TablePress::redirect( array( 'action' => 'list', 'message' => 'success_import_wp_table_reloaded' ) );
|
1467 |
-
} elseif ( 1 === count( $imported_tables ) ) {
|
1468 |
-
TablePress::redirect( array( 'action' => 'edit', 'table_id' => $imported_tables[0], 'message' => 'success_import_wp_table_reloaded' ) );
|
1469 |
-
}
|
1470 |
-
if ( count( $imported_other_id_tables ) > 0 ) {
|
1471 |
-
TablePress::redirect( array( 'action' => 'list', 'message' => 'success_import_wp_table_reloaded' ) );
|
1472 |
-
} elseif ( $imported_css ) {
|
1473 |
-
TablePress::redirect( array( 'action' => 'options', 'message' => 'success_import_wp_table_reloaded' ) );
|
1474 |
-
} else {
|
1475 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_wp_table_reloaded' ) );
|
1476 |
-
}
|
1477 |
-
}
|
1478 |
-
|
1479 |
-
/**
|
1480 |
-
* Import data from WP-Table Reloaded from a WP-Table Reloaded Dump File.
|
1481 |
-
*
|
1482 |
-
* @since 1.0.0
|
1483 |
-
*
|
1484 |
-
* @param bool $import_tables Whether tables shall be imported.
|
1485 |
-
* @param bool $import_css Whether Plugin Options (only CSS related right now) shall be imported.
|
1486 |
-
*/
|
1487 |
-
protected function _import_from_wp_table_reloaded_dump_file( $import_tables, $import_css ) {
|
1488 |
-
if ( empty( $_FILES['import_wp_table_reloaded_file_upload'] ) || empty( $_FILES['import_wp_table_reloaded_file_upload']['tmp_name'] ) || UPLOAD_ERR_OK !== $_FILES['import_wp_table_reloaded_file_upload']['error'] ) {
|
1489 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_dump_file' ) );
|
1490 |
-
}
|
1491 |
-
|
1492 |
-
$dump_file = file_get_contents( $_FILES['import_wp_table_reloaded_file_upload']['tmp_name'] );
|
1493 |
-
$dump_file = unserialize( $dump_file );
|
1494 |
-
if ( empty( $dump_file ) ) {
|
1495 |
-
@unlink( $_FILES['import_wp_table_reloaded_file_upload']['tmp_name'] );
|
1496 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_wp_table_reloaded_dump_file' ) );
|
1497 |
-
}
|
1498 |
-
if ( empty( $dump_file['options'] ) || ! is_array( $dump_file['options'] ) ) {
|
1499 |
-
$dump_file['options'] = array();
|
1500 |
-
}
|
1501 |
-
|
1502 |
-
// Import WP-Table Reloaded tables.
|
1503 |
-
$not_imported_tables = $imported_tables = $imported_other_id_tables = array();
|
1504 |
-
if ( $import_tables && ! empty( $dump_file['tables'] ) ) {
|
1505 |
-
foreach ( $dump_file['tables'] as $wptr_table_id => $wptr_table ) {
|
1506 |
-
$import_status = $this->_import_wp_table_reloaded_table( $wptr_table, $dump_file['options'] );
|
1507 |
-
switch ( $import_status ) {
|
1508 |
-
case 0:
|
1509 |
-
$not_imported_tables[] = $wptr_table_id;
|
1510 |
-
break;
|
1511 |
-
case 1:
|
1512 |
-
$imported_tables[] = $wptr_table_id;
|
1513 |
-
break;
|
1514 |
-
case 2:
|
1515 |
-
$imported_other_id_tables[] = $wptr_table_id;
|
1516 |
-
break;
|
1517 |
-
}
|
1518 |
-
}
|
1519 |
-
}
|
1520 |
-
|
1521 |
-
// Import WP-Table Reloaded Plugin Options (currently only CSS related options).
|
1522 |
-
$imported_css = false;
|
1523 |
-
if ( $import_css ) {
|
1524 |
-
$imported_css = $this->_import_wp_table_reloaded_plugin_options( $dump_file['options'] );
|
1525 |
-
}
|
1526 |
-
|
1527 |
-
@unlink( $_FILES['import_wp_table_reloaded_file_upload']['tmp_name'] );
|
1528 |
-
// @TODO: Better handling of the different cases of imported/imported-without-ID-change/not-imported tables.
|
1529 |
-
if ( count( $imported_tables ) > 1 ) {
|
1530 |
-
TablePress::redirect( array( 'action' => 'list', 'message' => 'success_import_wp_table_reloaded' ) );
|
1531 |
-
} elseif ( 1 === count( $imported_tables ) ) {
|
1532 |
-
TablePress::redirect( array( 'action' => 'edit', 'table_id' => $imported_tables[0], 'message' => 'success_import_wp_table_reloaded' ) );
|
1533 |
-
}
|
1534 |
-
if ( count( $imported_other_id_tables ) > 0 ) {
|
1535 |
-
TablePress::redirect( array( 'action' => 'list', 'message' => 'success_import_wp_table_reloaded' ) );
|
1536 |
-
} elseif ( $imported_css ) {
|
1537 |
-
TablePress::redirect( array( 'action' => 'options', 'message' => 'success_import_wp_table_reloaded' ) );
|
1538 |
-
} else {
|
1539 |
-
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_wp_table_reloaded' ) );
|
1540 |
-
}
|
1541 |
-
}
|
1542 |
-
|
1543 |
-
/**
|
1544 |
-
* Import a WP-Table Reloaded table.
|
1545 |
-
*
|
1546 |
-
* @since 1.0.0
|
1547 |
-
*
|
1548 |
-
* @param array $wptr_table WP-Table Reloaded table.
|
1549 |
-
* @param array $wp_table_reloaded_options WP-Table Reloaded Plugin Options.
|
1550 |
-
* @return int Import status: 0=Import failed; 1=Imported with ID change; 2=Imported without ID change.
|
1551 |
-
*/
|
1552 |
-
protected function _import_wp_table_reloaded_table( array $wptr_table, array $wp_table_reloaded_options ) {
|
1553 |
-
if ( empty( $wptr_table ) ) {
|
1554 |
-
return 0; // 0 means Import failed.
|
1555 |
-
}
|
1556 |
-
|
1557 |
-
// Perform sanity checks of imported table.
|
1558 |
-
if ( ! isset( $wptr_table['name'] )
|
1559 |
-
|| ! isset( $wptr_table['description'] )
|
1560 |
-
|| empty( $wptr_table['data'] )
|
1561 |
-
|| empty( $wptr_table['options'] ) ) {
|
1562 |
-
return 0; // 0 means Import failed.
|
1563 |
-
}
|
1564 |
-
|
1565 |
-
// Data is slashed in WP-Table Reloaded.
|
1566 |
-
$wptr_table = wp_unslash( $wptr_table );
|
1567 |
-
|
1568 |
-
// Table was loaded, import the data, table options, and visibility.
|
1569 |
-
//
|
1570 |
-
// Create a new table array with information from the imported table.
|
1571 |
-
$new_table = array(
|
1572 |
-
'name' => $wptr_table['name'],
|
1573 |
-
'description' => $wptr_table['description'],
|
1574 |
-
'data' => $wptr_table['data'],
|
1575 |
-
'options' => array(),
|
1576 |
-
'visibility' => array(
|
1577 |
-
'rows' => array_fill( 0, count( $wptr_table['data'] ), 1 ),
|
1578 |
-
'columns' => array_fill( 0, count( $wptr_table['data'][0] ), 1 ),
|
1579 |
-
),
|
1580 |
-
);
|
1581 |
-
if ( isset( $wptr_table['last_modified'] ) ) {
|
1582 |
-
$new_table['last_modified'] = $wptr_table['last_modified'];
|
1583 |
-
}
|
1584 |
-
if ( isset( $wptr_table['last_editor_id'] ) ) {
|
1585 |
-
$new_table['author'] = $wptr_table['last_editor_id'];
|
1586 |
-
}
|
1587 |
-
if ( isset( $wptr_table['options']['last_editor_id'] ) ) {
|
1588 |
-
$new_table['options']['last_editor'] = $wptr_table['last_editor_id'];
|
1589 |
-
}
|
1590 |
-
if ( isset( $wptr_table['options']['first_row_th'] ) ) {
|
1591 |
-
$new_table['options']['table_head'] = $wptr_table['options']['first_row_th'];
|
1592 |
-
}
|
1593 |
-
if ( isset( $wptr_table['options']['table_footer'] ) ) {
|
1594 |
-
$new_table['options']['table_foot'] = $wptr_table['options']['table_footer'];
|
1595 |
-
}
|
1596 |
-
if ( isset( $wptr_table['options']['custom_css_class'] ) ) {
|
1597 |
-
$new_table['options']['extra_css_classes'] = $wptr_table['options']['custom_css_class'];
|
1598 |
-
}
|
1599 |
-
if ( isset( $wptr_table['options']['use_tablesorter'] ) && isset( $wp_table_reloaded_options['enable_tablesorter'] ) ) {
|
1600 |
-
if ( $wp_table_reloaded_options['enable_tablesorter'] ) {
|
1601 |
-
$new_table['options']['use_datatables'] = $wptr_table['options']['use_tablesorter'];
|
1602 |
-
} else {
|
1603 |
-
$new_table['options']['use_datatables'] = false;
|
1604 |
-
}
|
1605 |
-
}
|
1606 |
-
// Array key is the same in both plugins for the following options.
|
1607 |
-
foreach ( array(
|
1608 |
-
'alternating_row_colors',
|
1609 |
-
'row_hover',
|
1610 |
-
'print_name',
|
1611 |
-
'print_name_position',
|
1612 |
-
'print_description',
|
1613 |
-
'print_description_position',
|
1614 |
-
'datatables_sort',
|
1615 |
-
'datatables_filter',
|
1616 |
-
'datatables_paginate',
|
1617 |
-
'datatables_lengthchange',
|
1618 |
-
'datatables_paginate_entries',
|
1619 |
-
'datatables_info',
|
1620 |
-
) as $_option ) {
|
1621 |
-
if ( isset( $wptr_table['options'][ $_option ] ) ) {
|
1622 |
-
$new_table['options'][ $_option ] = $wptr_table['options'][ $_option ];
|
1623 |
-
}
|
1624 |
-
}
|
1625 |
-
if ( isset( $wptr_table['options']['datatables_customcommands'] ) && current_user_can( 'unfiltered_html' ) ) {
|
1626 |
-
$new_table['options']['datatables_custom_commands'] = $wptr_table['options']['datatables_customcommands'];
|
1627 |
-
}
|
1628 |
-
// Not imported: $wptr_table['options']['cache_table_output'].
|
1629 |
-
// Not imported: $wptr_table['custom_fields'].
|
1630 |
-
|
1631 |
-
// Fix visibility: WP-Table Reloaded uses 0 and 1 the other way around.
|
1632 |
-
foreach ( array_keys( $wptr_table['visibility']['rows'], true ) as $row_idx ) {
|
1633 |
-
$new_table['visibility']['rows'][ $row_idx ] = 0;
|
1634 |
-
}
|
1635 |
-
foreach ( array_keys( $wptr_table['visibility']['columns'], true ) as $column_idx ) {
|
1636 |
-
$new_table['visibility']['columns'][ $column_idx ] = 0;
|
1637 |
-
}
|
1638 |
-
|
1639 |
-
// Merge this data into an empty table template.
|
1640 |
-
$table = TablePress::$model_table->prepare_table( TablePress::$model_table->get_table_template(), $new_table, false );
|
1641 |
-
if ( is_wp_error( $table ) ) {
|
1642 |
-
return 0; // 0 means Import failed.
|
1643 |
-
}
|
1644 |
-
|
1645 |
-
// Add the new table (and get its first ID).
|
1646 |
-
$tp_table_id = TablePress::$model_table->add( $table );
|
1647 |
-
if ( is_wp_error( $tp_table_id ) ) {
|
1648 |
-
return 0; // 0 means Import failed.
|
1649 |
-
}
|
1650 |
-
|
1651 |
-
// Change table ID to the ID the table had in WP-Table Reloaded (except if that ID is already taken).
|
1652 |
-
$id_changed = TablePress::$model_table->change_table_id( $tp_table_id, $wptr_table['id'] );
|
1653 |
-
if ( is_wp_error( $id_changed ) ) {
|
1654 |
-
return 2; // 2 means Imported without ID change.
|
1655 |
-
}
|
1656 |
-
|
1657 |
-
return 1; // 1 means Imported with ID change.
|
1658 |
-
}
|
1659 |
-
|
1660 |
-
/**
|
1661 |
-
* Import WP-Table Reloaded Plugin Options (currently just CSS related options).
|
1662 |
-
*
|
1663 |
-
* @since 1.0.0
|
1664 |
-
*
|
1665 |
-
* @param array $wp_table_reloaded_options Plugin Options of WP-Table Reloaded that shall be imported.
|
1666 |
-
* @return bool Whether the import was successful or not (on at least on option).
|
1667 |
-
*/
|
1668 |
-
protected function _import_wp_table_reloaded_plugin_options( array $wp_table_reloaded_options ) {
|
1669 |
-
if ( ! current_user_can( 'tablepress_edit_options' ) ) {
|
1670 |
-
return false;
|
1671 |
-
}
|
1672 |
-
|
1673 |
-
$imported_options = array();
|
1674 |
-
$imported_options['use_custom_css'] = ( isset( $wp_table_reloaded_options['use_custom_css'] ) ) ? (bool) $wp_table_reloaded_options['use_custom_css'] : false;
|
1675 |
-
if ( isset( $wp_table_reloaded_options['custom_css'] ) ) {
|
1676 |
-
// Automatically convert WP-Table Reloaded Custom CSS to TablePress Custom CSS by search/replacing classes and IDs.
|
1677 |
-
$imported_options['custom_css'] = wp_unslash( $wp_table_reloaded_options['custom_css'] ); // Be careful when removing this, as it might break CSS comments from old Dump Files.
|
1678 |
-
$imported_options['custom_css'] = str_replace( '#wp-table-reloaded-id-', '#tablepress-', $imported_options['custom_css'] );
|
1679 |
-
$imported_options['custom_css'] = str_replace( '-no-1', '', $imported_options['custom_css'] );
|
1680 |
-
$imported_options['custom_css'] = str_replace( '.wp-table-reloaded-id-', '.tablepress-id-', $imported_options['custom_css'] );
|
1681 |
-
$imported_options['custom_css'] = str_replace( '.wp-table-reloaded', '.tablepress', $imported_options['custom_css'] );
|
1682 |
-
|
1683 |
-
$tablepress_css = TablePress::load_class( 'TablePress_CSS', 'class-css.php', 'classes' );
|
1684 |
-
// Sanitize and tidy up Custom CSS.
|
1685 |
-
$imported_options['custom_css'] = $tablepress_css->sanitize_css( $imported_options['custom_css'] );
|
1686 |
-
// Minify Custom CSS.
|
1687 |
-
$imported_options['custom_css_minified'] = $tablepress_css->minify_css( $imported_options['custom_css'] );
|
1688 |
-
|
1689 |
-
// Maybe update CSS files as well.
|
1690 |
-
//
|
1691 |
-
// Only write files, if "Custom CSS" is to be used, and if there is "Custom CSS"
|
1692 |
-
if ( $imported_options['use_custom_css'] && '' !== $imported_options['custom_css'] ) {
|
1693 |
-
$result = $tablepress_css->save_custom_css_to_file( $imported_options['custom_css'], $imported_options['custom_css_minified'] );
|
1694 |
-
// If saving was successful, use "Custom CSS" file.
|
1695 |
-
$imported_options['use_custom_css_file'] = $result;
|
1696 |
-
// If saving was successful, increase the "Custom CSS" version number for cache busting.
|
1697 |
-
if ( $result ) {
|
1698 |
-
$imported_options['custom_css_version'] = TablePress::$model_options->get( 'custom_css_version' ) + 1;
|
1699 |
-
}
|
1700 |
-
}
|
1701 |
-
}
|
1702 |
-
|
1703 |
-
// Save gathered imported options.
|
1704 |
-
if ( empty( $imported_options ) ) {
|
1705 |
-
return false;
|
1706 |
-
}
|
1707 |
-
|
1708 |
-
TablePress::$model_options->update( $imported_options );
|
1709 |
-
|
1710 |
-
return true;
|
1711 |
-
}
|
1712 |
-
|
1713 |
/*
|
1714 |
* Save GET actions.
|
1715 |
*/
|
@@ -1724,7 +1358,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1724 |
TablePress::check_nonce( 'hide_message', $message_item );
|
1725 |
|
1726 |
if ( ! current_user_can( 'tablepress_list_tables' ) ) {
|
1727 |
-
wp_die( __( '
|
1728 |
}
|
1729 |
|
1730 |
TablePress::$model_options->update( "message_{$message_item}", false );
|
@@ -1751,7 +1385,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1751 |
}
|
1752 |
|
1753 |
if ( ! current_user_can( 'tablepress_delete_table', $table_id ) ) {
|
1754 |
-
wp_die( __( '
|
1755 |
}
|
1756 |
|
1757 |
$deleted = TablePress::$model_table->delete( $table_id );
|
@@ -1792,11 +1426,9 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1792 |
}
|
1793 |
|
1794 |
if ( ! current_user_can( 'tablepress_copy_table', $table_id ) ) {
|
1795 |
-
wp_die( __( '
|
1796 |
}
|
1797 |
|
1798 |
-
$this->init_i18n_support(); // for the translation of "Copy of".
|
1799 |
-
|
1800 |
$copy_table_id = TablePress::$model_table->copy( $table_id );
|
1801 |
if ( is_wp_error( $copy_table_id ) ) {
|
1802 |
TablePress::redirect( array( 'action' => $return, 'message' => 'error_copy', 'table_id' => $return_item ) );
|
@@ -1828,15 +1460,13 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1828 |
$table_id = ( ! empty( $_GET['item'] ) ) ? $_GET['item'] : false;
|
1829 |
TablePress::check_nonce( 'preview_table', $table_id );
|
1830 |
|
1831 |
-
$this->init_i18n_support();
|
1832 |
-
|
1833 |
// Nonce check should actually catch this already.
|
1834 |
if ( false === $table_id ) {
|
1835 |
wp_die( __( 'The preview could not be loaded.', 'tablepress' ), __( 'Preview', 'tablepress' ) );
|
1836 |
}
|
1837 |
|
1838 |
if ( ! current_user_can( 'tablepress_preview_table', $table_id ) ) {
|
1839 |
-
wp_die( __( '
|
1840 |
}
|
1841 |
|
1842 |
// Load table, with table data, options, and visibility settings.
|
@@ -1883,11 +1513,9 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1883 |
TablePress::check_nonce( 'editor_button_thickbox' );
|
1884 |
|
1885 |
if ( ! current_user_can( 'tablepress_list_tables' ) ) {
|
1886 |
-
wp_die( __( '
|
1887 |
}
|
1888 |
|
1889 |
-
$this->init_i18n_support();
|
1890 |
-
|
1891 |
$view_data = array(
|
1892 |
// Load all table IDs without priming the post meta cache, as table options/visibility are not needed.
|
1893 |
'table_ids' => TablePress::$model_table->load_all( false ),
|
@@ -1911,7 +1539,7 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1911 |
$plugin = TABLEPRESS_BASENAME;
|
1912 |
|
1913 |
if ( ! current_user_can( 'deactivate_plugin', $plugin ) || ! current_user_can( 'tablepress_edit_options' ) || ! current_user_can( 'tablepress_delete_tables' ) || is_plugin_active_for_network( $plugin ) ) {
|
1914 |
-
wp_die( __( '
|
1915 |
}
|
1916 |
|
1917 |
// Deactivate TablePress for the site (but not for the network).
|
@@ -1927,8 +1555,6 @@ class TablePress_Admin_Controller extends TablePress_Controller {
|
|
1927 |
TablePress::$model_table->destroy();
|
1928 |
TablePress::$model_options->destroy();
|
1929 |
|
1930 |
-
$this->init_i18n_support();
|
1931 |
-
|
1932 |
$output = '<strong>' . __( 'TablePress was uninstalled successfully.', 'tablepress' ) . '</strong><br /><br />';
|
1933 |
$output .= __( 'All tables, data, and options were deleted.', 'tablepress' );
|
1934 |
if ( is_multisite() ) {
|
37 |
*/
|
38 |
protected $view_actions = array();
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Instance of the TablePress Admin View that is rendered.
|
42 |
*
|
103 |
*/
|
104 |
$admin_menu_entry_name = apply_filters( 'tablepress_admin_menu_entry_name', 'TablePress' );
|
105 |
|
106 |
+
$this->init_view_actions();
|
107 |
+
$min_access_cap = $this->view_actions['list']['required_cap'];
|
|
|
|
|
|
|
108 |
|
109 |
+
if ( $this->is_top_level_page ) {
|
110 |
$icon_url = 'dashicons-list-view';
|
111 |
switch ( $this->parent_page ) {
|
112 |
case 'top':
|
132 |
$this->page_hooks[] = add_submenu_page( 'tablepress', sprintf( __( '%1$s ‹ %2$s', 'tablepress' ), $entry['page_title'], 'TablePress' ), $entry['admin_menu_title'], $entry['required_cap'], $slug, $callback );
|
133 |
}
|
134 |
} else {
|
|
|
|
|
135 |
$this->page_hooks[] = add_submenu_page( $this->parent_page, 'TablePress', $admin_menu_entry_name, $min_access_cap, 'tablepress', $callback );
|
136 |
}
|
137 |
}
|
167 |
}
|
168 |
|
169 |
add_action( 'load-plugins.php', array( $this, 'plugins_page' ) );
|
|
|
170 |
|
171 |
// Add filters and actions for the integration into the WP WXR exporter and importer.
|
172 |
add_action( 'wp_import_insert_post', array( TablePress::$model_table, 'add_table_id_on_wp_import' ), 10, 4 );
|
184 |
return;
|
185 |
}
|
186 |
|
187 |
+
/*
|
188 |
+
* Only load the toolbar integration when the Classic Editor plugin (https://wordpress.org/plugins/classic-editor/) is activated.
|
189 |
+
* Without it, the Block Editor user interface is used, which can not directly use these buttons.
|
190 |
+
*/
|
191 |
+
if ( ! class_exists( 'Classic_Editor' ) ) {
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
add_thickbox(); // usually already loaded by media upload functions
|
196 |
$admin_page = TablePress::load_class( 'TablePress_Admin_Page', 'class-admin-page-helper.php', 'classes' );
|
197 |
$admin_page->enqueue_script( 'quicktags-button', array( 'quicktags', 'media-upload' ), array(
|
251 |
echo '}</style>' . "\n";
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
/**
|
255 |
* Add "TablePress Table" entry to "New" dropdown menu in the WP Admin Bar.
|
256 |
*
|
262 |
if ( ! current_user_can( 'tablepress_add_tables' ) ) {
|
263 |
return;
|
264 |
}
|
265 |
+
|
|
|
266 |
$wp_admin_bar->add_menu( array(
|
267 |
'parent' => 'new-content',
|
268 |
'id' => 'new-tablepress-table',
|
277 |
* @since 1.0.0
|
278 |
*/
|
279 |
public function plugins_page() {
|
|
|
280 |
// Add additional links on Plugins page.
|
281 |
add_filter( 'plugin_action_links_' . TABLEPRESS_BASENAME, array( $this, 'add_plugin_action_links' ) );
|
282 |
add_filter( 'plugin_row_meta', array( $this, 'add_plugin_row_meta' ), 10, 2 );
|
329 |
// Actions that are top-level entries, but don't have an action GET parameter (action is after last _ in string).
|
330 |
$action = substr( $_GET['page'], 11 ); // $_GET['page'] has the format 'tablepress_{$action}'
|
331 |
}
|
|
|
|
|
|
|
|
|
332 |
}
|
333 |
|
334 |
// Check if action is a supported action, and whether the user is allowed to access this screen.
|
335 |
if ( ! isset( $this->view_actions[ $action ] ) || ! current_user_can( $this->view_actions[ $action ]['required_cap'] ) ) {
|
336 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
337 |
}
|
338 |
|
339 |
// Changes current screen ID and pagenow variable in JS, to enable automatic meta box JS handling.
|
357 |
// Prime the post meta cache for cached loading of last_editor.
|
358 |
$data['table_ids'] = TablePress::$model_table->load_all( true );
|
359 |
$data['messages']['first_visit'] = TablePress::$model_options->get( 'message_first_visit' );
|
360 |
+
// Check if WP-Table Reloaded is activated and show a warning.
|
361 |
+
$data['messages']['wp_table_reloaded_warning'] = is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' );
|
|
|
|
|
|
|
|
|
362 |
$data['messages']['plugin_update_message'] = TablePress::$model_options->get( 'message_plugin_update' );
|
363 |
$data['messages']['donation_message'] = $this->maybe_show_donation_message();
|
364 |
$data['table_count'] = count( $data['table_ids'] );
|
406 |
TablePress::redirect( array( 'action' => 'list', 'message' => 'error_load_table' ) );
|
407 |
}
|
408 |
if ( ! current_user_can( 'tablepress_edit_table', $_GET['table_id'] ) ) {
|
409 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
410 |
}
|
411 |
} else {
|
412 |
TablePress::redirect( array( 'action' => 'list', 'message' => 'error_no_table' ) );
|
444 |
$data['import_url'] = ( ! empty( $_GET['import_url'] ) ) ? wp_unslash( $_GET['import_url'] ) : 'http://';
|
445 |
$data['import_server'] = ( ! empty( $_GET['import_server'] ) ) ? wp_unslash( $_GET['import_server'] ) : ABSPATH;
|
446 |
$data['import_form_field'] = ( ! empty( $_GET['import_form_field'] ) ) ? wp_unslash( $_GET['import_form_field'] ) : '';
|
|
|
|
|
447 |
break;
|
448 |
}
|
449 |
|
470 |
$this->view->render();
|
471 |
}
|
472 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
473 |
/**
|
474 |
* Decide whether a donate message shall be shown on the "All Tables" screen, depending on passed days since installation and whether it was shown before.
|
475 |
*
|
594 |
|
595 |
switch ( $bulk_action ) {
|
596 |
case 'copy':
|
|
|
597 |
foreach ( $tables as $table_id ) {
|
598 |
if ( current_user_can( 'tablepress_copy_table', $table_id ) ) {
|
599 |
$copy_table_id = TablePress::$model_table->copy( $table_id );
|
664 |
TablePress::check_nonce( 'edit', $edit_table['id'], 'nonce-edit-table' );
|
665 |
|
666 |
if ( ! current_user_can( 'tablepress_edit_table', $edit_table['id'] ) ) {
|
667 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
668 |
}
|
669 |
|
670 |
// Options array must exist, so that checkboxes can be evaluated.
|
744 |
TablePress::check_nonce( 'add' );
|
745 |
|
746 |
if ( ! current_user_can( 'tablepress_add_tables' ) ) {
|
747 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
748 |
}
|
749 |
|
750 |
if ( empty( $_POST['table'] ) || ! is_array( $_POST['table'] ) ) {
|
800 |
TablePress::check_nonce( 'options' );
|
801 |
|
802 |
if ( ! current_user_can( 'tablepress_access_options_screen' ) ) {
|
803 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
804 |
}
|
805 |
|
806 |
if ( empty( $_POST['options'] ) || ! is_array( $_POST['options'] ) ) {
|
872 |
TablePress::check_nonce( 'export' );
|
873 |
|
874 |
if ( ! current_user_can( 'tablepress_export_tables' ) ) {
|
875 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
876 |
}
|
877 |
|
878 |
if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) {
|
912 |
if ( ! $export_to_zip ) {
|
913 |
// This is only possible for one table, so take the first one.
|
914 |
if ( ! current_user_can( 'tablepress_export_table', $tables[0] ) ) {
|
915 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
916 |
}
|
917 |
// Load table, with table data, options, and visibility settings.
|
918 |
$table = TablePress::$model_table->load( $tables[0], true, true );
|
1007 |
}
|
1008 |
|
1009 |
/**
|
1010 |
+
* Import data from existing source (Upload, URL, Server, Direct input).
|
1011 |
*
|
1012 |
* @since 1.0.0
|
1013 |
*/
|
1015 |
TablePress::check_nonce( 'import' );
|
1016 |
|
1017 |
if ( ! current_user_can( 'tablepress_import_tables' ) ) {
|
1018 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1019 |
}
|
1020 |
|
1021 |
if ( empty( $_POST['import'] ) || ! is_array( $_POST['import'] ) ) {
|
1024 |
$import = wp_unslash( $_POST['import'] );
|
1025 |
}
|
1026 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1027 |
if ( ! isset( $import['type'] ) ) {
|
1028 |
$import['type'] = 'add';
|
1029 |
}
|
1034 |
$import['source'] = '';
|
1035 |
}
|
1036 |
|
|
|
|
|
|
|
|
|
|
|
1037 |
$import_error = true;
|
1038 |
$unlink_file = false;
|
1039 |
$import_data = array();
|
1100 |
|
1101 |
$this->importer = TablePress::load_class( 'TablePress_Import', 'class-import.php', 'classes' );
|
1102 |
|
1103 |
+
$import_zip = ( 'zip' === pathinfo( $import_data['file_name'], PATHINFO_EXTENSION ) );
|
1104 |
+
|
1105 |
+
// Determine if ZIP file support is available.
|
1106 |
+
if ( $import_zip && ! $this->importer->zip_support_available ) {
|
1107 |
+
if ( $unlink_file ) {
|
1108 |
+
@unlink( $import_data['file_location'] );
|
1109 |
+
}
|
1110 |
+
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_no_zip_import', 'import_format' => $import['format'], 'import_type' => $import['type'], 'import_existing_table' => $import['existing_table'], 'import_source' => $import['source'] ) );
|
1111 |
+
}
|
1112 |
+
|
1113 |
+
if ( ! $import_zip ) {
|
1114 |
+
// Check if a table to replace or append to was selected (which is only necessary for import from non-ZIP files).
|
1115 |
+
if ( in_array( $import['type'], array( 'replace', 'append' ), true ) && empty( $import['existing_table'] ) ) {
|
1116 |
if ( $unlink_file ) {
|
1117 |
@unlink( $import_data['file_location'] );
|
1118 |
}
|
1119 |
+
TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import_no_existing_id', 'import_format' => $import['format'], 'import_type' => $import['type'], 'import_source' => $import['source'] ) );
|
1120 |
}
|
|
|
|
|
|
|
|
|
1121 |
|
|
|
1122 |
if ( ! isset( $import_data['data'] ) ) {
|
1123 |
$import_data['data'] = file_get_contents( $import_data['file_location'] );
|
1124 |
}
|
1172 |
|
1173 |
$name = $file_name;
|
1174 |
$description = $file_name;
|
1175 |
+
$existing_table_id = ( in_array( $import['type'], array( 'replace', 'append' ), true ) ) ? false : false; // @TODO: Find a way to extract the replace/append ID from the filename, maybe? For the JSON format, a check is done after the import.
|
1176 |
+
$table_id = $this->_import_tablepress_table( $import['format'], $data, $name, $description, $existing_table_id, $import['type'] );
|
1177 |
if ( is_wp_error( $table_id ) ) {
|
1178 |
continue;
|
1179 |
} else {
|
1216 |
return new WP_Error( 'table_import_import_failed' );
|
1217 |
}
|
1218 |
|
1219 |
+
// Full JSON format table can contain a table ID, try to keep that.
|
1220 |
+
$table_id_in_import = isset( $imported_table['id'] ) ? $imported_table['id'] : false;
|
1221 |
+
|
1222 |
+
// If no ID for an existing table was specified in the import form, we add the imported table,
|
1223 |
+
// except for replacing and appending of JSON files in ZIP archives, where we try to use the imported table ID.
|
1224 |
if ( false === $existing_table_id ) {
|
1225 |
+
if ( false !== $table_id_in_import && TablePress::$model_table->table_exists( $table_id_in_import ) ) {
|
1226 |
+
$existing_table_id = $table_id_in_import;
|
1227 |
+
} else {
|
1228 |
+
$import_type = 'add';
|
1229 |
+
}
|
1230 |
}
|
1231 |
|
1232 |
// To be able to replace or append to a table, editing that table must be allowed.
|
1234 |
return new WP_Error( 'table_import_replace_append_capability_check_failed' );
|
1235 |
}
|
1236 |
|
|
|
|
|
|
|
1237 |
switch ( $import_type ) {
|
1238 |
case 'add':
|
1239 |
$existing_table = TablePress::$model_table->get_table_template();
|
1240 |
// If name and description are imported from a new table, use those.
|
|
|
|
|
|
|
1241 |
if ( ! isset( $imported_table['name'] ) ) {
|
1242 |
$imported_table['name'] = $name;
|
1243 |
}
|
1344 |
return $table_id;
|
1345 |
}
|
1346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1347 |
/*
|
1348 |
* Save GET actions.
|
1349 |
*/
|
1358 |
TablePress::check_nonce( 'hide_message', $message_item );
|
1359 |
|
1360 |
if ( ! current_user_can( 'tablepress_list_tables' ) ) {
|
1361 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1362 |
}
|
1363 |
|
1364 |
TablePress::$model_options->update( "message_{$message_item}", false );
|
1385 |
}
|
1386 |
|
1387 |
if ( ! current_user_can( 'tablepress_delete_table', $table_id ) ) {
|
1388 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1389 |
}
|
1390 |
|
1391 |
$deleted = TablePress::$model_table->delete( $table_id );
|
1426 |
}
|
1427 |
|
1428 |
if ( ! current_user_can( 'tablepress_copy_table', $table_id ) ) {
|
1429 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1430 |
}
|
1431 |
|
|
|
|
|
1432 |
$copy_table_id = TablePress::$model_table->copy( $table_id );
|
1433 |
if ( is_wp_error( $copy_table_id ) ) {
|
1434 |
TablePress::redirect( array( 'action' => $return, 'message' => 'error_copy', 'table_id' => $return_item ) );
|
1460 |
$table_id = ( ! empty( $_GET['item'] ) ) ? $_GET['item'] : false;
|
1461 |
TablePress::check_nonce( 'preview_table', $table_id );
|
1462 |
|
|
|
|
|
1463 |
// Nonce check should actually catch this already.
|
1464 |
if ( false === $table_id ) {
|
1465 |
wp_die( __( 'The preview could not be loaded.', 'tablepress' ), __( 'Preview', 'tablepress' ) );
|
1466 |
}
|
1467 |
|
1468 |
if ( ! current_user_can( 'tablepress_preview_table', $table_id ) ) {
|
1469 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1470 |
}
|
1471 |
|
1472 |
// Load table, with table data, options, and visibility settings.
|
1513 |
TablePress::check_nonce( 'editor_button_thickbox' );
|
1514 |
|
1515 |
if ( ! current_user_can( 'tablepress_list_tables' ) ) {
|
1516 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1517 |
}
|
1518 |
|
|
|
|
|
1519 |
$view_data = array(
|
1520 |
// Load all table IDs without priming the post meta cache, as table options/visibility are not needed.
|
1521 |
'table_ids' => TablePress::$model_table->load_all( false ),
|
1539 |
$plugin = TABLEPRESS_BASENAME;
|
1540 |
|
1541 |
if ( ! current_user_can( 'deactivate_plugin', $plugin ) || ! current_user_can( 'tablepress_edit_options' ) || ! current_user_can( 'tablepress_delete_tables' ) || is_plugin_active_for_network( $plugin ) ) {
|
1542 |
+
wp_die( __( 'Sorry, you are not allowed to access this page.', 'default' ), 403 );
|
1543 |
}
|
1544 |
|
1545 |
// Deactivate TablePress for the site (but not for the network).
|
1555 |
TablePress::$model_table->destroy();
|
1556 |
TablePress::$model_options->destroy();
|
1557 |
|
|
|
|
|
1558 |
$output = '<strong>' . __( 'TablePress was uninstalled successfully.', 'tablepress' ) . '</strong><br /><br />';
|
1559 |
$output .= __( 'All tables, data, and options were deleted.', 'tablepress' );
|
1560 |
if ( is_multisite() ) {
|
controllers/controller-admin_ajax.php
CHANGED
@@ -247,9 +247,6 @@ class TablePress_Admin_AJAX_Controller extends TablePress_Controller {
|
|
247 |
$success = true;
|
248 |
} while ( false ); // Do-while-loop through this exactly once, to be able to "break;" early.
|
249 |
|
250 |
-
// Initialize i18n support, load plugin's textdomain, to retrieve correct translations for the description of the preview.
|
251 |
-
load_plugin_textdomain( 'tablepress', false, dirname( TABLEPRESS_BASENAME ) . '/i18n' );
|
252 |
-
|
253 |
if ( $success ) {
|
254 |
// Create a render class instance.
|
255 |
$_render = TablePress::load_class( 'TablePress_Render', 'class-render.php', 'classes' );
|
247 |
$success = true;
|
248 |
} while ( false ); // Do-while-loop through this exactly once, to be able to "break;" early.
|
249 |
|
|
|
|
|
|
|
250 |
if ( $success ) {
|
251 |
// Create a render class instance.
|
252 |
$_render = TablePress::load_class( 'TablePress_Render', 'class-render.php', 'classes' );
|
controllers/controller-frontend.php
CHANGED
@@ -740,7 +740,7 @@ JS;
|
|
740 |
$time_diff = $current_timestamp - $modified_timestamp;
|
741 |
// Time difference is only shown up to one day.
|
742 |
if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
|
743 |
-
$output = sprintf( __( '%s ago', 'default' ), human_time_diff( $modified_timestamp, $current_timestamp ) );
|
744 |
} else {
|
745 |
$output = TablePress::format_datetime( $table['last_modified'], 'mysql', '<br />' );
|
746 |
}
|
740 |
$time_diff = $current_timestamp - $modified_timestamp;
|
741 |
// Time difference is only shown up to one day.
|
742 |
if ( $time_diff >= 0 && $time_diff < DAY_IN_SECONDS ) {
|
743 |
+
$output = sprintf( __( '%s ago', 'default' ), human_time_diff( $modified_timestamp, $current_timestamp ) );
|
744 |
} else {
|
745 |
$output = TablePress::format_datetime( $table['last_modified'], 'mysql', '<br />' );
|
746 |
}
|
i18n/datatables/lang-de_AT.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"emptyTable": "Keine Einträge vorhanden.",
|
3 |
+
"info": "_START_ bis _END_ von _TOTAL_ Einträgen",
|
4 |
+
"infoEmpty": "0 bis 0 von 0 Einträgen",
|
5 |
+
"infoFiltered": "(gefiltert von _MAX_ Einträgen)",
|
6 |
+
"infoPostFix": "",
|
7 |
+
"lengthMenu": "_MENU_ Einträge anzeigen",
|
8 |
+
"loadingRecords": "Lädt...",
|
9 |
+
"processing": "Bitte warten...",
|
10 |
+
"search": "Suchen:",
|
11 |
+
"zeroRecords": "Keine Einträge vorhanden.",
|
12 |
+
"paginate": {
|
13 |
+
"first": "Anfang",
|
14 |
+
"previous": "Zurück",
|
15 |
+
"next": "Weiter",
|
16 |
+
"last": "Ende"
|
17 |
+
},
|
18 |
+
"aria": {
|
19 |
+
"sortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
|
20 |
+
"sortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
|
21 |
+
},
|
22 |
+
"decimal": ",",
|
23 |
+
"thousands": "."
|
24 |
+
}
|
i18n/datatables/lang-de_CH.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"emptyTable": "Keine Einträge vorhanden.",
|
3 |
+
"info": "_START_ bis _END_ von _TOTAL_ Einträgen",
|
4 |
+
"infoEmpty": "0 bis 0 von 0 Einträgen",
|
5 |
+
"infoFiltered": "(gefiltert von _MAX_ Einträgen)",
|
6 |
+
"infoPostFix": "",
|
7 |
+
"lengthMenu": "_MENU_ Einträge anzeigen",
|
8 |
+
"loadingRecords": "Lädt...",
|
9 |
+
"processing": "Bitte warten Sie...",
|
10 |
+
"search": "Suchen:",
|
11 |
+
"zeroRecords": "Keine Einträge vorhanden.",
|
12 |
+
"paginate": {
|
13 |
+
"first": "Anfang",
|
14 |
+
"previous": "Zurück",
|
15 |
+
"next": "Weiter",
|
16 |
+
"last": "Ende"
|
17 |
+
},
|
18 |
+
"aria": {
|
19 |
+
"sortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
|
20 |
+
"sortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
|
21 |
+
},
|
22 |
+
"decimal": ",",
|
23 |
+
"thousands": "."
|
24 |
+
}
|
i18n/datatables/lang-de_CH_informal.json
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"emptyTable": "Keine Einträge vorhanden.",
|
3 |
+
"info": "_START_ bis _END_ von _TOTAL_ Einträgen",
|
4 |
+
"infoEmpty": "0 bis 0 von 0 Einträgen",
|
5 |
+
"infoFiltered": "(gefiltert von _MAX_ Einträgen)",
|
6 |
+
"infoPostFix": "",
|
7 |
+
"lengthMenu": "_MENU_ Einträge anzeigen",
|
8 |
+
"loadingRecords": "Lädt...",
|
9 |
+
"processing": "Bitte warten...",
|
10 |
+
"search": "Suchen:",
|
11 |
+
"zeroRecords": "Keine Einträge vorhanden.",
|
12 |
+
"paginate": {
|
13 |
+
"first": "Anfang",
|
14 |
+
"previous": "Zurück",
|
15 |
+
"next": "Weiter",
|
16 |
+
"last": "Ende"
|
17 |
+
},
|
18 |
+
"aria": {
|
19 |
+
"sortAscending": ": aktivieren, um Spalte aufsteigend zu sortieren",
|
20 |
+
"sortDescending": ": aktivieren, um Spalte absteigend zu sortieren"
|
21 |
+
},
|
22 |
+
"decimal": ",",
|
23 |
+
"thousands": "."
|
24 |
+
}
|
i18n/datatables/warning.txt
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
ATTENTION:
|
2 |
-
|
3 |
-
Do not edit or modify the files in this directory, as they might be changed in future plugin versions.
|
4 |
-
This would lead to a loss of your changes!
|
5 |
-
|
6 |
-
* If you want to make changes to your language's file, please see the TablePress Extension
|
7 |
-
"Change DataTables strings" at https://tablepress.org/extensions/change-datatables-strings/
|
8 |
-
for instructions on how to do this.
|
9 |
-
|
10 |
-
* If you just want to change to a different language file, you can override the locale by using the Shortcode
|
11 |
-
parameter "datatables_locale" or with the plugin filter hook `tablepress_datatables_locale`.
|
12 |
-
This Shortcode would change the used language to German for table 123:
|
13 |
-
[table id=123 datatables_locale="de_DE" /]
|
14 |
-
|
15 |
-
* If you want to translate the language file into your own language, copy the file "lang-en_US.json", rename the copy to
|
16 |
-
"lang-XX_XX.json", where `XX_XX` is the ISO code for your language
|
17 |
-
Then, you can translate that file. If you email the file to me, I'll gladly add it to the next release of the plugin.
|
18 |
-
|
19 |
-
Most languages in the folder are from https://www.datatables.net/plug-ins/i18n/#Translations.
|
20 |
-
You can also check that page, to see if your language has been added and tell me about it.
|
21 |
-
|
22 |
-
You can find example code for this in the FAQ at https://tablepress.org/faq/
|
23 |
-
or in the documentation at https://tablepress.org/documentation/.
|
24 |
-
|
25 |
-
Thank you!
|
1 |
+
ATTENTION:
|
2 |
+
|
3 |
+
Do not edit or modify the files in this directory, as they might be changed in future plugin versions.
|
4 |
+
This would lead to a loss of your changes!
|
5 |
+
|
6 |
+
* If you want to make changes to your language's file, please see the TablePress Extension
|
7 |
+
"Change DataTables strings" at https://tablepress.org/extensions/change-datatables-strings/
|
8 |
+
for instructions on how to do this.
|
9 |
+
|
10 |
+
* If you just want to change to a different language file, you can override the locale by using the Shortcode
|
11 |
+
parameter "datatables_locale" or with the plugin filter hook `tablepress_datatables_locale`.
|
12 |
+
This Shortcode would change the used language to German for table 123:
|
13 |
+
[table id=123 datatables_locale="de_DE" /]
|
14 |
+
|
15 |
+
* If you want to translate the language file into your own language, copy the file "lang-en_US.json", rename the copy to
|
16 |
+
"lang-XX_XX.json", where `XX_XX` is the ISO code for your language, which you also find on https://translate.wordpress.org/.
|
17 |
+
Then, you can translate that file. If you email the file to me, I'll gladly add it to the next release of the plugin.
|
18 |
+
|
19 |
+
Most languages in the folder are from https://www.datatables.net/plug-ins/i18n/#Translations.
|
20 |
+
You can also check that page, to see if your language has been added and tell me about it.
|
21 |
+
|
22 |
+
You can find example code for this in the FAQ at https://tablepress.org/faq/
|
23 |
+
or in the documentation at https://tablepress.org/documentation/.
|
24 |
+
|
25 |
+
Thank you!
|
i18n/translating-tablepress.txt
CHANGED
@@ -1,12 +1,5 @@
|
|
1 |
-
TablePress
|
2 |
-
|
3 |
-
automatically generated and shipped to plugin users.
|
4 |
-
|
5 |
-
It is therefore no longer necessary to generate and translate *.po and *.mo files manually.
|
6 |
-
Instead, just go to https://translate.wordpress.org/projects/wp-plugins/tablepress, log in
|
7 |
with a free wordpress.org account and start translating TablePress into your language.
|
8 |
|
9 |
-
If you want to become a Translation Editor for your language, who can confirm or reject
|
10 |
-
translation suggestions by other users, please get in touch.
|
11 |
-
|
12 |
Thank you!
|
1 |
+
TablePress uses the "Translate WordPress" platform at https://translate.wordpress.org/.
|
2 |
+
Just go to https://translate.wordpress.org/projects/wp-plugins/tablepress, log in
|
|
|
|
|
|
|
|
|
3 |
with a free wordpress.org account and start translating TablePress into your language.
|
4 |
|
|
|
|
|
|
|
5 |
Thank you!
|
js/jquery.datatables.min.js
CHANGED
@@ -1,166 +1,170 @@
|
|
1 |
/*!
|
2 |
-
DataTables 1.10.
|
3 |
-
©2008-
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
b
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
1)
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
g
|
42 |
-
|
43 |
-
|
44 |
-
d,e
|
45 |
-
|
46 |
-
|
47 |
-
b
|
48 |
-
c
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
function
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
"
|
59 |
-
"
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
"",
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
(
|
72 |
-
|
73 |
-
|
74 |
-
a.
|
75 |
-
|
76 |
-
function(){
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
(d
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
f
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
e
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
this.
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
a.
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
c)
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
this.
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
a.
|
142 |
-
|
143 |
-
|
144 |
-
a.
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
|
|
|
|
|
|
153 |
sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
|
154 |
-
sJUIHeader:"",sJUIFooter:""});var
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return
|
160 |
-
c.sSortingClass)}
|
161 |
-
|
162 |
-
a)+f+(e||"")}}},text:function(){return{display:
|
163 |
-
b){return b._DT_RowIndex!==
|
164 |
-
_fnFilterColumn:
|
165 |
-
_fnSortFlatten:
|
166 |
-
|
1 |
/*!
|
2 |
+
DataTables 1.10.20
|
3 |
+
©2008-2019 SpryMedia Ltd - datatables.net/license
|
4 |
*/
|
5 |
+
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(f,z,y){f instanceof String&&(f=String(f));for(var p=f.length,H=0;H<p;H++){var L=f[H];if(z.call(y,L,H,f))return{i:H,v:L}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
|
6 |
+
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(f,z,y){f!=Array.prototype&&f!=Object.prototype&&(f[z]=y.value)};$jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);
|
7 |
+
$jscomp.polyfill=function(f,z,y,p){if(z){y=$jscomp.global;f=f.split(".");for(p=0;p<f.length-1;p++){var H=f[p];H in y||(y[H]={});y=y[H]}f=f[f.length-1];p=y[f];z=z(p);z!=p&&null!=z&&$jscomp.defineProperty(y,f,{configurable:!0,writable:!0,value:z})}};$jscomp.polyfill("Array.prototype.find",function(f){return f?f:function(f,y){return $jscomp.findInternal(this,f,y).v}},"es6","es3");
|
8 |
+
(function(f){"function"===typeof define&&define.amd?define(["jquery"],function(z){return f(z,window,document)}):"object"===typeof exports?module.exports=function(z,y){z||(z=window);y||(y="undefined"!==typeof window?require("jquery"):require("jquery")(z));return f(y,z,z.document)}:f(jQuery,window,document)})(function(f,z,y,p){function H(a){var b,c,d={};f.each(a,function(e,h){(b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" ")&&(c=e.replace(b[0],b[2].toLowerCase()),
|
9 |
+
d[c]=e,"o"===b[1]&&H(a[e]))});a._hungarianMap=d}function L(a,b,c){a._hungarianMap||H(a);var d;f.each(b,function(e,h){d=a._hungarianMap[e];d===p||!c&&b[d]!==p||("o"===d.charAt(0)?(b[d]||(b[d]={}),f.extend(!0,b[d],b[e]),L(a[d],b[d],c)):b[d]=b[e])})}function Ga(a){var b=q.defaults.oLanguage,c=b.sDecimal;c&&Ha(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&d&&"No data available in table"===b.sEmptyTable&&M(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&d&&"Loading..."===b.sLoadingRecords&&M(a,a,
|
10 |
+
"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&c!==a&&Ha(a)}}function jb(a){F(a,"ordering","bSort");F(a,"orderMulti","bSortMulti");F(a,"orderClasses","bSortClasses");F(a,"orderCellsTop","bSortCellsTop");F(a,"order","aaSorting");F(a,"orderFixed","aaSortingFixed");F(a,"paging","bPaginate");F(a,"pagingType","sPaginationType");F(a,"pageLength","iDisplayLength");F(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":
|
11 |
+
"");"boolean"===typeof a.scrollX&&(a.scrollX=a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&L(q.models.oSearch,a[b])}function kb(a){F(a,"orderable","bSortable");F(a,"orderData","aDataSort");F(a,"orderSequence","asSorting");F(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"!==typeof b||f.isArray(b)||(a.aDataSort=[b])}function lb(a){if(!q.__browser){var b={};q.__browser=b;var c=f("<div/>").css({position:"fixed",top:0,left:-1*f(z).scrollLeft(),height:1,width:1,
|
12 |
+
overflow:"hidden"}).append(f("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(f("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}f.extend(a.oBrowser,q.__browser);a.oScroll.iBarWidth=q.__browser.barWidth}
|
13 |
+
function mb(a,b,c,d,e,h){var g=!1;if(c!==p){var k=c;g=!0}for(;d!==e;)a.hasOwnProperty(d)&&(k=g?b(k,a[d],d,a):a[d],g=!0,d+=h);return k}function Ia(a,b){var c=q.defaults.column,d=a.aoColumns.length;c=f.extend({},q.models.oColumn,c,{nTh:b?b:y.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=f.extend({},q.models.oSearch,c[d]);ma(a,d,f(b).data())}function ma(a,b,c){b=a.aoColumns[b];
|
14 |
+
var d=a.oClasses,e=f(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var h=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);h&&(b.sWidthOrig=h[1])}c!==p&&null!==c&&(kb(c),L(q.defaults.column,c,!0),c.mDataProp===p||c.mData||(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),f.extend(b,c),M(b,c,"sWidth","sWidthOrig"),c.iDataSort!==p&&(b.aDataSort=[c.iDataSort]),M(b,c,"aDataSort"));var g=b.mData,k=U(g),
|
15 |
+
l=b.mRender?U(b.mRender):null;c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=f.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=k(a,b,p,c);return l&&b?l(d,b,a,c):d};b.fnSetData=function(a,b,c){return Q(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==f.inArray("asc",b.asSorting);c=-1!==f.inArray("desc",b.asSorting);b.bSortable&&(a||c)?a&&!c?(b.sSortingClass=
|
16 |
+
d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI):(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI="")}function aa(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Ja(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;""===b.sY&&""===b.sX||na(a);A(a,null,"column-sizing",[a])}function ba(a,b){a=oa(a,"bVisible");return"number"===
|
17 |
+
typeof a[b]?a[b]:null}function ca(a,b){a=oa(a,"bVisible");b=f.inArray(b,a);return-1!==b?b:null}function W(a){var b=0;f.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==f(d.nTh).css("display")&&b++});return b}function oa(a,b){var c=[];f.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ka(a){var b=a.aoColumns,c=a.aoData,d=q.ext.type.detect,e,h,g;var k=0;for(e=b.length;k<e;k++){var f=b[k];var n=[];if(!f.sType&&f._sManualType)f.sType=f._sManualType;else if(!f.sType){var m=0;for(h=
|
18 |
+
d.length;m<h;m++){var w=0;for(g=c.length;w<g;w++){n[w]===p&&(n[w]=I(a,w,k,"type"));var u=d[m](n[w],a);if(!u&&m!==d.length-1)break;if("html"===u)break}if(u){f.sType=u;break}}f.sType||(f.sType="string")}}}function nb(a,b,c,d){var e,h,g,k=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){var l=b[e];var n=l.targets!==p?l.targets:l.aTargets;f.isArray(n)||(n=[n]);var m=0;for(h=n.length;m<h;m++)if("number"===typeof n[m]&&0<=n[m]){for(;k.length<=n[m];)Ia(a);d(n[m],l)}else if("number"===typeof n[m]&&0>n[m])d(k.length+
|
19 |
+
n[m],l);else if("string"===typeof n[m]){var w=0;for(g=k.length;w<g;w++)("_all"==n[m]||f(k[w].nTh).hasClass(n[m]))&&d(w,l)}}if(c)for(e=0,a=c.length;e<a;e++)d(e,c[e])}function R(a,b,c,d){var e=a.aoData.length,h=f.extend(!0,{},q.models.oRow,{src:c?"dom":"data",idx:e});h._aData=b;a.aoData.push(h);for(var g=a.aoColumns,k=0,l=g.length;k<l;k++)g[k].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==p&&(a.aIds[b]=h);!c&&a.oFeatures.bDeferRender||La(a,e,c,d);return e}function pa(a,b){var c;b instanceof
|
20 |
+
f||(b=f(b));return b.map(function(b,e){c=Ma(a,e);return R(a,c.data,e,c.cells)})}function I(a,b,c,d){var e=a.iDraw,h=a.aoColumns[c],g=a.aoData[b]._aData,k=h.sDefaultContent,f=h.fnGetData(g,d,{settings:a,row:b,col:c});if(f===p)return a.iDrawError!=e&&null===k&&(O(a,0,"Requested unknown parameter "+("function"==typeof h.mData?"{function}":"'"+h.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),k;if((f===g||null===f)&&null!==k&&d!==p)f=k;else if("function"===typeof f)return f.call(g);return null===
|
21 |
+
f&&"display"==d?"":f}function ob(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}function Na(a){return f.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function U(a){if(f.isPlainObject(a)){var b={};f.each(a,function(a,c){c&&(b[a]=U(c))});return function(a,c,h,g){var d=b[c]||b._;return d!==p?d(a,c,h,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,h,g){return a(b,c,h,g)};if("string"!==typeof a||
|
22 |
+
-1===a.indexOf(".")&&-1===a.indexOf("[")&&-1===a.indexOf("("))return function(b,c){return b[a]};var c=function(a,b,h){if(""!==h){var d=Na(h);for(var e=0,l=d.length;e<l;e++){h=d[e].match(da);var n=d[e].match(X);if(h){d[e]=d[e].replace(da,"");""!==d[e]&&(a=a[d[e]]);n=[];d.splice(0,e+1);d=d.join(".");if(f.isArray(a))for(e=0,l=a.length;e<l;e++)n.push(c(a[e],b,d));a=h[0].substring(1,h[0].length-1);a=""===a?n:n.join(a);break}else if(n){d[e]=d[e].replace(X,"");a=a[d[e]]();continue}if(null===a||a[d[e]]===
|
23 |
+
p)return p;a=a[d[e]]}}return a};return function(b,e){return c(b,e,a)}}function Q(a){if(f.isPlainObject(a))return Q(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"!==typeof a||-1===a.indexOf(".")&&-1===a.indexOf("[")&&-1===a.indexOf("("))return function(b,d){b[a]=d};var b=function(a,d,e){e=Na(e);var c=e[e.length-1];for(var g,k,l=0,n=e.length-1;l<n;l++){g=e[l].match(da);k=e[l].match(X);if(g){e[l]=e[l].replace(da,"");a[e[l]]=[];c=e.slice();
|
24 |
+
c.splice(0,l+1);g=c.join(".");if(f.isArray(d))for(k=0,n=d.length;k<n;k++)c={},b(c,d[k],g),a[e[l]].push(c);else a[e[l]]=d;return}k&&(e[l]=e[l].replace(X,""),a=a[e[l]](d));if(null===a[e[l]]||a[e[l]]===p)a[e[l]]={};a=a[e[l]]}if(c.match(X))a[c.replace(X,"")](d);else a[c.replace(da,"")]=d};return function(c,d){return b(c,d,a)}}function Oa(a){return J(a.aoData,"_aData")}function qa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function ra(a,b,c){for(var d=-1,e=0,h=a.length;e<
|
25 |
+
h;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===p&&a.splice(d,1)}function ea(a,b,c,d){var e=a.aoData[b],h,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=I(a,b,d,"display")};if("dom"!==c&&(c&&"auto"!==c||"dom"!==e.src)){var k=e.anCells;if(k)if(d!==p)g(k[d],d);else for(c=0,h=k.length;c<h;c++)g(k[c],c)}else e._aData=Ma(a,e,d,d===p?p:e._aData).data;e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==p)g[d].sType=null;else{c=0;for(h=g.length;c<h;c++)g[c].sType=null;
|
26 |
+
Pa(a,e)}}function Ma(a,b,c,d){var e=[],h=b.firstChild,g,k=0,l,n=a.aoColumns,m=a._rowReadObject;d=d!==p?d:m?{}:[];var w=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),Q(a)(d,b.getAttribute(c)))}},u=function(a){if(c===p||c===k)g=n[k],l=f.trim(a.innerHTML),g&&g._bAttrSrc?(Q(g.mData._)(d,l),w(g.mData.sort,a),w(g.mData.type,a),w(g.mData.filter,a)):m?(g._setter||(g._setter=Q(g.mData)),g._setter(d,l)):d[k]=l;k++};if(h)for(;h;){var q=h.nodeName.toUpperCase();if("TD"==
|
27 |
+
q||"TH"==q)u(h),e.push(h);h=h.nextSibling}else for(e=b.anCells,h=0,q=e.length;h<q;h++)u(e[h]);(b=b.firstChild?b:b.nTr)&&(b=b.getAttribute("id"))&&Q(a.rowId)(d,b);return{data:d,cells:e}}function La(a,b,c,d){var e=a.aoData[b],h=e._aData,g=[],k,l;if(null===e.nTr){var n=c||y.createElement("tr");e.nTr=n;e.anCells=g;n._DT_RowIndex=b;Pa(a,e);var m=0;for(k=a.aoColumns.length;m<k;m++){var w=a.aoColumns[m];var p=(l=c?!1:!0)?y.createElement(w.sCellType):d[m];p._DT_CellIndex={row:b,column:m};g.push(p);if(l||
|
28 |
+
!(c&&!w.mRender&&w.mData===m||f.isPlainObject(w.mData)&&w.mData._===m+".display"))p.innerHTML=I(a,b,m,"display");w.sClass&&(p.className+=" "+w.sClass);w.bVisible&&!c?n.appendChild(p):!w.bVisible&&c&&p.parentNode.removeChild(p);w.fnCreatedCell&&w.fnCreatedCell.call(a.oInstance,p,I(a,b,m),h,b,m)}A(a,"aoRowCreatedCallback",null,[n,h,b,g])}e.nTr.setAttribute("role","row")}function Pa(a,b){var c=b.nTr,d=b._aData;if(c){if(a=a.rowIdFn(d))c.id=a;d.DT_RowClass&&(a=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?
|
29 |
+
ta(b.__rowc.concat(a)):a,f(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&f(c).attr(d.DT_RowAttr);d.DT_RowData&&f(c).data(d.DT_RowData)}}function pb(a){var b,c,d=a.nTHead,e=a.nTFoot,h=0===f("th, td",d).length,g=a.oClasses,k=a.aoColumns;h&&(c=f("<tr/>").appendTo(d));var l=0;for(b=k.length;l<b;l++){var n=k[l];var m=f(n.nTh).addClass(n.sClass);h&&m.appendTo(c);a.oFeatures.bSort&&(m.addClass(n.sSortingClass),!1!==n.bSortable&&(m.attr("tabindex",a.iTabIndex).attr("aria-controls",
|
30 |
+
a.sTableId),Qa(a,n.nTh,l)));n.sTitle!=m[0].innerHTML&&m.html(n.sTitle);Ra(a,"header")(a,m,n,g)}h&&fa(a.aoHeader,d);f(d).find(">tr").attr("role","row");f(d).find(">tr>th, >tr>td").addClass(g.sHeaderTH);f(e).find(">tr>th, >tr>td").addClass(g.sFooterTH);if(null!==e)for(a=a.aoFooter[0],l=0,b=a.length;l<b;l++)n=k[l],n.nTf=a[l].cell,n.sClass&&f(n.nTf).addClass(n.sClass)}function ha(a,b,c){var d,e,h=[],g=[],k=a.aoColumns.length;if(b){c===p&&(c=!1);var l=0;for(d=b.length;l<d;l++){h[l]=b[l].slice();h[l].nTr=
|
31 |
+
b[l].nTr;for(e=k-1;0<=e;e--)a.aoColumns[e].bVisible||c||h[l].splice(e,1);g.push([])}l=0;for(d=h.length;l<d;l++){if(a=h[l].nTr)for(;e=a.firstChild;)a.removeChild(e);e=0;for(b=h[l].length;e<b;e++){var n=k=1;if(g[l][e]===p){a.appendChild(h[l][e].cell);for(g[l][e]=1;h[l+k]!==p&&h[l][e].cell==h[l+k][e].cell;)g[l+k][e]=1,k++;for(;h[l][e+n]!==p&&h[l][e].cell==h[l][e+n].cell;){for(c=0;c<k;c++)g[l+c][e+n]=1;n++}f(h[l][e].cell).attr("rowspan",k).attr("colspan",n)}}}}}function S(a){var b=A(a,"aoPreDrawCallback",
|
32 |
+
"preDraw",[a]);if(-1!==f.inArray(!1,b))K(a,!1);else{b=[];var c=0,d=a.asStripeClasses,e=d.length,h=a.oLanguage,g=a.iInitDisplayStart,k="ssp"==D(a),l=a.aiDisplay;a.bDrawing=!0;g!==p&&-1!==g&&(a._iDisplayStart=k?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);g=a._iDisplayStart;var n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,K(a,!1);else if(!k)a.iDraw++;else if(!a.bDestroying&&!qb(a))return;if(0!==l.length)for(h=k?a.aoData.length:n,k=k?0:g;k<h;k++){var m=l[k],w=a.aoData[m];
|
33 |
+
null===w.nTr&&La(a,m);var u=w.nTr;if(0!==e){var q=d[c%e];w._sRowStripe!=q&&(f(u).removeClass(w._sRowStripe).addClass(q),w._sRowStripe=q)}A(a,"aoRowCallback",null,[u,w._aData,c,k,m]);b.push(u);c++}else c=h.sZeroRecords,1==a.iDraw&&"ajax"==D(a)?c=h.sLoadingRecords:h.sEmptyTable&&0===a.fnRecordsTotal()&&(c=h.sEmptyTable),b[0]=f("<tr/>",{"class":e?d[0]:""}).append(f("<td />",{valign:"top",colSpan:W(a),"class":a.oClasses.sRowEmpty}).html(c))[0];A(a,"aoHeaderCallback","header",[f(a.nTHead).children("tr")[0],
|
34 |
+
Oa(a),g,n,l]);A(a,"aoFooterCallback","footer",[f(a.nTFoot).children("tr")[0],Oa(a),g,n,l]);d=f(a.nTBody);d.children().detach();d.append(f(b));A(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function V(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&rb(a);d?ia(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;S(a);a._drawHold=!1}function sb(a){var b=a.oClasses,c=f(a.nTable);c=f("<div/>").insertBefore(c);var d=a.oFeatures,e=
|
35 |
+
f("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var h=a.sDom.split(""),g,k,l,n,m,p,u=0;u<h.length;u++){g=null;k=h[u];if("<"==k){l=f("<div/>")[0];n=h[u+1];if("'"==n||'"'==n){m="";for(p=2;h[u+p]!=n;)m+=h[u+p],p++;"H"==m?m=b.sJUIHeader:"F"==m&&(m=b.sJUIFooter);-1!=m.indexOf(".")?(n=m.split("."),l.id=n[0].substr(1,n[0].length-1),l.className=n[1]):"#"==m.charAt(0)?l.id=m.substr(1,
|
36 |
+
m.length-1):l.className=m;u+=p}e.append(l);e=f(l)}else if(">"==k)e=e.parent();else if("l"==k&&d.bPaginate&&d.bLengthChange)g=tb(a);else if("f"==k&&d.bFilter)g=ub(a);else if("r"==k&&d.bProcessing)g=vb(a);else if("t"==k)g=wb(a);else if("i"==k&&d.bInfo)g=xb(a);else if("p"==k&&d.bPaginate)g=yb(a);else if(0!==q.ext.feature.length)for(l=q.ext.feature,p=0,n=l.length;p<n;p++)if(k==l[p].cFeature){g=l[p].fnInit(a);break}g&&(l=a.aanFeatures,l[k]||(l[k]=[]),l[k].push(g),e.append(g))}c.replaceWith(e);a.nHolding=
|
37 |
+
null}function fa(a,b){b=f(b).children("tr");var c,d,e;a.splice(0,a.length);var h=0;for(e=b.length;h<e;h++)a.push([]);h=0;for(e=b.length;h<e;h++){var g=b[h];for(c=g.firstChild;c;){if("TD"==c.nodeName.toUpperCase()||"TH"==c.nodeName.toUpperCase()){var k=1*c.getAttribute("colspan");var l=1*c.getAttribute("rowspan");k=k&&0!==k&&1!==k?k:1;l=l&&0!==l&&1!==l?l:1;var n=0;for(d=a[h];d[n];)n++;var m=n;var p=1===k?!0:!1;for(d=0;d<k;d++)for(n=0;n<l;n++)a[h+n][m+d]={cell:c,unique:p},a[h+n].nTr=g}c=c.nextSibling}}}
|
38 |
+
function ua(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],fa(c,b)));b=0;for(var e=c.length;b<e;b++)for(var h=0,g=c[b].length;h<g;h++)!c[b][h].unique||d[h]&&a.bSortCellsTop||(d[h]=c[b][h].cell);return d}function va(a,b,c){A(a,"aoServerParams","serverParams",[b]);if(b&&f.isArray(b)){var d={},e=/(.*?)\[\]$/;f.each(b,function(a,b){(a=b.name.match(e))?(a=a[0],d[a]||(d[a]=[]),d[a].push(b.value)):d[b.name]=b.value});b=d}var h=a.ajax,g=a.oInstance,k=function(b){A(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(f.isPlainObject(h)&&
|
39 |
+
h.data){var l=h.data;var n="function"===typeof l?l(b,a):l;b="function"===typeof l&&n?n:f.extend(!0,b,n);delete h.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&O(a,0,c);a.json=b;k(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c,d){d=A(a,null,"xhr",[a,null,a.jqXHR]);-1===f.inArray(!0,d)&&("parsererror"==c?O(a,0,"Invalid JSON response",1):4===b.readyState&&O(a,0,"Ajax error",7));K(a,!1)}};a.oAjaxData=b;A(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(g,
|
40 |
+
a.sAjaxSource,f.map(b,function(a,b){return{name:b,value:a}}),k,a):a.sAjaxSource||"string"===typeof h?a.jqXHR=f.ajax(f.extend(n,{url:h||a.sAjaxSource})):"function"===typeof h?a.jqXHR=h.call(g,b,k,a):(a.jqXHR=f.ajax(f.extend(n,h)),h.data=l)}function qb(a){return a.bAjaxDataGet?(a.iDraw++,K(a,!0),va(a,zb(a),function(b){Ab(a,b)}),!1):!0}function zb(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,h=a.aoPreSearchCols,g=[],k=Y(a);var l=a._iDisplayStart;var n=!1!==d.bPaginate?a._iDisplayLength:
|
41 |
+
-1;var m=function(a,b){g.push({name:a,value:b})};m("sEcho",a.iDraw);m("iColumns",c);m("sColumns",J(b,"sName").join(","));m("iDisplayStart",l);m("iDisplayLength",n);var p={draw:a.iDraw,columns:[],order:[],start:l,length:n,search:{value:e.sSearch,regex:e.bRegex}};for(l=0;l<c;l++){var u=b[l];var sa=h[l];n="function"==typeof u.mData?"function":u.mData;p.columns.push({data:n,name:u.sName,searchable:u.bSearchable,orderable:u.bSortable,search:{value:sa.sSearch,regex:sa.bRegex}});m("mDataProp_"+l,n);d.bFilter&&
|
42 |
+
(m("sSearch_"+l,sa.sSearch),m("bRegex_"+l,sa.bRegex),m("bSearchable_"+l,u.bSearchable));d.bSort&&m("bSortable_"+l,u.bSortable)}d.bFilter&&(m("sSearch",e.sSearch),m("bRegex",e.bRegex));d.bSort&&(f.each(k,function(a,b){p.order.push({column:b.col,dir:b.dir});m("iSortCol_"+a,b.col);m("sSortDir_"+a,b.dir)}),m("iSortingCols",k.length));b=q.ext.legacy.ajax;return null===b?a.sAjaxSource?g:p:b?g:p}function Ab(a,b){var c=function(a,c){return b[a]!==p?b[a]:b[c]},d=wa(a,b),e=c("sEcho","draw"),h=c("iTotalRecords",
|
43 |
+
"recordsTotal");c=c("iTotalDisplayRecords","recordsFiltered");if(e){if(1*e<a.iDraw)return;a.iDraw=1*e}qa(a);a._iRecordsTotal=parseInt(h,10);a._iRecordsDisplay=parseInt(c,10);e=0;for(h=d.length;e<h;e++)R(a,d[e]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;S(a);a._bInitComplete||xa(a,b);a.bAjaxDataGet=!0;K(a,!1)}function wa(a,b){a=f.isPlainObject(a.ajax)&&a.ajax.dataSrc!==p?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===a?b.aaData||b[a]:""!==a?U(a)(b):b}function ub(a){var b=a.oClasses,c=
|
44 |
+
a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,h=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',k=d.sSearch;k=k.match(/_INPUT_/)?k.replace("_INPUT_",g):k+g;b=f("<div/>",{id:h.f?null:c+"_filter","class":b.sFilter}).append(f("<label/>").append(k));h=function(){var b=this.value?this.value:"";b!=e.sSearch&&(ia(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,S(a))};g=null!==a.searchDelay?a.searchDelay:"ssp"===D(a)?400:0;var l=f("input",
|
45 |
+
b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Sa(h,g):h).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);f(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{l[0]!==y.activeElement&&l.val(e.sSearch)}catch(w){}});return b[0]}function ia(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,h=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive},g=function(a){return a.bEscapeRegex!==
|
46 |
+
p?!a.bEscapeRegex:a.bRegex};Ka(a);if("ssp"!=D(a)){Bb(a,b.sSearch,c,g(b),b.bSmart,b.bCaseInsensitive);h(b);for(b=0;b<e.length;b++)Cb(a,e[b].sSearch,b,g(e[b]),e[b].bSmart,e[b].bCaseInsensitive);Db(a)}else h(b);a.bFiltered=!0;A(a,null,"search",[a])}function Db(a){for(var b=q.ext.search,c=a.aiDisplay,d,e,h=0,g=b.length;h<g;h++){for(var k=[],l=0,n=c.length;l<n;l++)e=c[l],d=a.aoData[e],b[h](a,d._aFilterData,e,d._aData,l)&&k.push(e);c.length=0;f.merge(c,k)}}function Cb(a,b,c,d,e,h){if(""!==b){var g=[],k=
|
47 |
+
a.aiDisplay;d=Ta(b,d,e,h);for(e=0;e<k.length;e++)b=a.aoData[k[e]]._aFilterData[c],d.test(b)&&g.push(k[e]);a.aiDisplay=g}}function Bb(a,b,c,d,e,h){e=Ta(b,d,e,h);var g=a.oPreviousSearch.sSearch,k=a.aiDisplayMaster;h=[];0!==q.ext.search.length&&(c=!0);var f=Eb(a);if(0>=b.length)a.aiDisplay=k.slice();else{if(f||c||d||g.length>b.length||0!==b.indexOf(g)||a.bSorted)a.aiDisplay=k.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)e.test(a.aoData[b[c]]._sFilterRow)&&h.push(b[c]);a.aiDisplay=h}}function Ta(a,b,
|
48 |
+
c,d){a=b?a:Ua(a);c&&(a="^(?=.*?"+f.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0)){var b=a.match(/^"(.*)"$/);a=b?b[1]:a}return a.replace('"',"")}).join(")(?=.*?")+").*$");return new RegExp(a,d?"i":"")}function Eb(a){var b=a.aoColumns,c,d,e=q.ext.type.search;var h=!1;var g=0;for(c=a.aoData.length;g<c;g++){var k=a.aoData[g];if(!k._aFilterData){var f=[];var n=0;for(d=b.length;n<d;n++){h=b[n];if(h.bSearchable){var m=I(a,g,n,"filter");e[h.sType]&&(m=e[h.sType](m));null===m&&(m="");
|
49 |
+
"string"!==typeof m&&m.toString&&(m=m.toString())}else m="";m.indexOf&&-1!==m.indexOf("&")&&(ya.innerHTML=m,m=$b?ya.textContent:ya.innerText);m.replace&&(m=m.replace(/[\r\n\u2028]/g,""));f.push(m)}k._aFilterData=f;k._sFilterRow=f.join(" ");h=!0}}return h}function Fb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}function Gb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function xb(a){var b=a.sTableId,c=a.aanFeatures.i,
|
50 |
+
d=f("<div/>",{"class":a.oClasses.sInfo,id:c?null:b+"_info"});c||(a.aoDrawCallback.push({fn:Hb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),f(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Hb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),h=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),k=g?c.sInfo:c.sInfoEmpty;g!==h&&(k+=" "+c.sInfoFiltered);k+=c.sInfoPostFix;k=Ib(a,k);c=c.fnInfoCallback;null!==c&&(k=c.call(a.oInstance,
|
51 |
+
a,d,e,h,g,k));f(b).html(k)}}function Ib(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,h=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,h)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(h/e)))}function ja(a){var b=a.iInitDisplayStart,c=a.aoColumns;var d=a.oFeatures;var e=a.bDeferLoading;if(a.bInitialised){sb(a);
|
52 |
+
pb(a);ha(a,a.aoHeader);ha(a,a.aoFooter);K(a,!0);d.bAutoWidth&&Ja(a);var h=0;for(d=c.length;h<d;h++){var g=c[h];g.sWidth&&(g.nTh.style.width=B(g.sWidth))}A(a,null,"preInit",[a]);V(a);c=D(a);if("ssp"!=c||e)"ajax"==c?va(a,[],function(c){var d=wa(a,c);for(h=0;h<d.length;h++)R(a,d[h]);a.iInitDisplayStart=b;V(a);K(a,!1);xa(a,c)},a):(K(a,!1),xa(a))}else setTimeout(function(){ja(a)},200)}function xa(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&aa(a);A(a,null,"plugin-init",[a,b]);A(a,"aoInitComplete","init",
|
53 |
+
[a,b])}function Va(a,b){b=parseInt(b,10);a._iDisplayLength=b;Wa(a);A(a,null,"length",[a,b])}function tb(a){var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=f.isArray(d[0]),h=e?d[0]:d;d=e?d[1]:d;e=f("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect});for(var g=0,k=h.length;g<k;g++)e[0][g]=new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],h[g]);var l=f("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(l[0].id=c+"_length");l.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",
|
54 |
+
e[0].outerHTML));f("select",l).val(a._iDisplayLength).on("change.DT",function(b){Va(a,f(this).val());S(a)});f(a.nTable).on("length.dt.DT",function(b,c,d){a===c&&f("select",l).val(d)});return l[0]}function yb(a){var b=a.sPaginationType,c=q.ext.pager[b],d="function"===typeof c,e=function(a){S(a)};b=f("<div/>").addClass(a.oClasses.sPaging+b)[0];var h=a.aanFeatures;d||c.fnInit(a,b,e);h.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,g=a._iDisplayLength,
|
55 |
+
f=a.fnRecordsDisplay(),m=-1===g;b=m?0:Math.ceil(b/g);g=m?1:Math.ceil(f/g);f=c(b,g);var p;m=0;for(p=h.p.length;m<p;m++)Ra(a,"pageButton")(a,h.p[m],m,f,b,g)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Xa(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,h=a.fnRecordsDisplay();0===h||-1===e?d=0:"number"===typeof b?(d=b*e,d>h&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<h&&(d+=e):"last"==b?d=Math.floor((h-1)/e)*e:O(a,0,"Unknown paging action: "+b,5);b=
|
56 |
+
a._iDisplayStart!==d;a._iDisplayStart=d;b&&(A(a,null,"page",[a]),c&&S(a));return b}function vb(a){return f("<div/>",{id:a.aanFeatures.r?null:a.sTableId+"_processing","class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function K(a,b){a.oFeatures.bProcessing&&f(a.aanFeatures.r).css("display",b?"block":"none");A(a,null,"processing",[a,b])}function wb(a){var b=f(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,
|
57 |
+
h=a.oClasses,g=b.children("caption"),k=g.length?g[0]._captionSide:null,l=f(b[0].cloneNode(!1)),n=f(b[0].cloneNode(!1)),m=b.children("tfoot");m.length||(m=null);l=f("<div/>",{"class":h.sScrollWrapper}).append(f("<div/>",{"class":h.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?d?B(d):null:"100%"}).append(f("<div/>",{"class":h.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(l.removeAttr("id").css("margin-left",0).append("top"===k?g:null).append(b.children("thead"))))).append(f("<div/>",
|
58 |
+
{"class":h.sScrollBody}).css({position:"relative",overflow:"auto",width:d?B(d):null}).append(b));m&&l.append(f("<div/>",{"class":h.sScrollFoot}).css({overflow:"hidden",border:0,width:d?d?B(d):null:"100%"}).append(f("<div/>",{"class":h.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",0).append("bottom"===k?g:null).append(b.children("tfoot")))));b=l.children();var p=b[0];h=b[1];var u=m?b[2]:null;if(d)f(h).on("scroll.DT",function(a){a=this.scrollLeft;p.scrollLeft=a;m&&(u.scrollLeft=a)});
|
59 |
+
f(h).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=p;a.nScrollBody=h;a.nScrollFoot=u;a.aoDrawCallback.push({fn:na,sName:"scrolling"});return l[0]}function na(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY;b=b.iBarWidth;var h=f(a.nScrollHead),g=h[0].style,k=h.children("div"),l=k[0].style,n=k.children("table");k=a.nScrollBody;var m=f(k),w=k.style,u=f(a.nScrollFoot).children("div"),q=u.children("table"),t=f(a.nTHead),r=f(a.nTable),v=r[0],za=v.style,T=a.nTFoot?f(a.nTFoot):null,A=a.oBrowser,
|
60 |
+
x=A.bScrollOversize,ac=J(a.aoColumns,"nTh"),Ya=[],y=[],z=[],C=[],G,H=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};var D=k.scrollHeight>k.clientHeight;if(a.scrollBarVis!==D&&a.scrollBarVis!==p)a.scrollBarVis=D,aa(a);else{a.scrollBarVis=D;r.children("thead, tfoot").remove();if(T){var E=T.clone().prependTo(r);var F=T.find("tr");E=E.find("tr")}var I=t.clone().prependTo(r);t=t.find("tr");D=I.find("tr");I.find("th, td").removeAttr("tabindex");
|
61 |
+
c||(w.width="100%",h[0].style.width="100%");f.each(ua(a,I),function(b,c){G=ba(a,b);c.style.width=a.aoColumns[G].sWidth});T&&N(function(a){a.style.width=""},E);h=r.outerWidth();""===c?(za.width="100%",x&&(r.find("tbody").height()>k.offsetHeight||"scroll"==m.css("overflow-y"))&&(za.width=B(r.outerWidth()-b)),h=r.outerWidth()):""!==d&&(za.width=B(d),h=r.outerWidth());N(H,D);N(function(a){z.push(a.innerHTML);Ya.push(B(f(a).css("width")))},D);N(function(a,b){-1!==f.inArray(a,ac)&&(a.style.width=Ya[b])},
|
62 |
+
t);f(D).height(0);T&&(N(H,E),N(function(a){C.push(a.innerHTML);y.push(B(f(a).css("width")))},E),N(function(a,b){a.style.width=y[b]},F),f(E).height(0));N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+z[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=Ya[b]},D);T&&N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+C[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=y[b]},E);r.outerWidth()<
|
63 |
+
h?(F=k.scrollHeight>k.offsetHeight||"scroll"==m.css("overflow-y")?h+b:h,x&&(k.scrollHeight>k.offsetHeight||"scroll"==m.css("overflow-y"))&&(za.width=B(F-b)),""!==c&&""===d||O(a,1,"Possible column misalignment",6)):F="100%";w.width=B(F);g.width=B(F);T&&(a.nScrollFoot.style.width=B(F));!e&&x&&(w.height=B(v.offsetHeight+b));c=r.outerWidth();n[0].style.width=B(c);l.width=B(c);d=r.height()>k.clientHeight||"scroll"==m.css("overflow-y");e="padding"+(A.bScrollbarLeft?"Left":"Right");l[e]=d?b+"px":"0px";T&&
|
64 |
+
(q[0].style.width=B(c),u[0].style.width=B(c),u[0].style[e]=d?b+"px":"0px");r.children("colgroup").insertBefore(r.children("thead"));m.trigger("scroll");!a.bSorted&&!a.bFiltered||a._drawHold||(k.scrollTop=0)}}function N(a,b,c){for(var d=0,e=0,h=b.length,g,k;e<h;){g=b[e].firstChild;for(k=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,k,d):a(g,d),d++),g=g.nextSibling,k=c?k.nextSibling:null;e++}}function Ja(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,h=d.sX,g=d.sXInner,k=c.length,l=oa(a,"bVisible"),
|
65 |
+
n=f("th",a.nTHead),m=b.getAttribute("width"),p=b.parentNode,u=!1,q,t=a.oBrowser;d=t.bScrollOversize;(q=b.style.width)&&-1!==q.indexOf("%")&&(m=q);for(q=0;q<l.length;q++){var r=c[l[q]];null!==r.sWidth&&(r.sWidth=Jb(r.sWidthOrig,p),u=!0)}if(d||!u&&!h&&!e&&k==W(a)&&k==n.length)for(q=0;q<k;q++)l=ba(a,q),null!==l&&(c[l].sWidth=B(n.eq(q).width()));else{k=f(b).clone().css("visibility","hidden").removeAttr("id");k.find("tbody tr").remove();var v=f("<tr/>").appendTo(k.find("tbody"));k.find("thead, tfoot").remove();
|
66 |
+
k.append(f(a.nTHead).clone()).append(f(a.nTFoot).clone());k.find("tfoot th, tfoot td").css("width","");n=ua(a,k.find("thead")[0]);for(q=0;q<l.length;q++)r=c[l[q]],n[q].style.width=null!==r.sWidthOrig&&""!==r.sWidthOrig?B(r.sWidthOrig):"",r.sWidthOrig&&h&&f(n[q]).append(f("<div/>").css({width:r.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(q=0;q<l.length;q++)u=l[q],r=c[u],f(Kb(a,u)).clone(!1).append(r.sContentPadding).appendTo(v);f("[name]",k).removeAttr("name");r=f("<div/>").css(h||
|
67 |
+
e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(k).appendTo(p);h&&g?k.width(g):h?(k.css("width","auto"),k.removeAttr("width"),k.width()<p.clientWidth&&m&&k.width(p.clientWidth)):e?k.width(p.clientWidth):m&&k.width(m);for(q=e=0;q<l.length;q++)p=f(n[q]),g=p.outerWidth()-p.width(),p=t.bBounding?Math.ceil(n[q].getBoundingClientRect().width):p.outerWidth(),e+=p,c[l[q]].sWidth=B(p-g);b.style.width=B(e);r.remove()}m&&(b.style.width=B(m));!m&&!h||a._reszEvt||(b=function(){f(z).on("resize.DT-"+
|
68 |
+
a.sInstance,Sa(function(){aa(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0)}function Jb(a,b){if(!a)return 0;a=f("<div/>").css("width",B(a)).appendTo(b||y.body);b=a[0].offsetWidth;a.remove();return b}function Kb(a,b){var c=Lb(a,b);if(0>c)return null;var d=a.aoData[c];return d.nTr?d.anCells[b]:f("<td/>").html(I(a,c,b,"display"))[0]}function Lb(a,b){for(var c,d=-1,e=-1,h=0,g=a.aoData.length;h<g;h++)c=I(a,h,b,"display")+"",c=c.replace(bc,""),c=c.replace(/ /g," "),c.length>d&&(d=c.length,e=h);return e}
|
69 |
+
function B(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function Y(a){var b=[],c=a.aoColumns;var d=a.aaSortingFixed;var e=f.isPlainObject(d);var h=[];var g=function(a){a.length&&!f.isArray(a[0])?h.push(a):f.merge(h,a)};f.isArray(d)&&g(d);e&&d.pre&&g(d.pre);g(a.aaSorting);e&&d.post&&g(d.post);for(a=0;a<h.length;a++){var k=h[a][0];g=c[k].aDataSort;d=0;for(e=g.length;d<e;d++){var l=g[d];var n=c[l].sType||"string";h[a]._idx===p&&(h[a]._idx=f.inArray(h[a][1],c[l].asSorting));
|
70 |
+
b.push({src:k,col:l,dir:h[a][1],index:h[a]._idx,type:n,formatter:q.ext.type.order[n+"-pre"]})}}return b}function rb(a){var b,c=[],d=q.ext.type.order,e=a.aoData,h=0,g=a.aiDisplayMaster;Ka(a);var k=Y(a);var f=0;for(b=k.length;f<b;f++){var n=k[f];n.formatter&&h++;Mb(a,n.col)}if("ssp"!=D(a)&&0!==k.length){f=0;for(b=g.length;f<b;f++)c[g[f]]=f;h===k.length?g.sort(function(a,b){var d,h=k.length,g=e[a]._aSortData,f=e[b]._aSortData;for(d=0;d<h;d++){var l=k[d];var m=g[l.col];var n=f[l.col];m=m<n?-1:m>n?1:0;
|
71 |
+
if(0!==m)return"asc"===l.dir?m:-m}m=c[a];n=c[b];return m<n?-1:m>n?1:0}):g.sort(function(a,b){var h,g=k.length,f=e[a]._aSortData,l=e[b]._aSortData;for(h=0;h<g;h++){var m=k[h];var n=f[m.col];var p=l[m.col];m=d[m.type+"-"+m.dir]||d["string-"+m.dir];n=m(n,p);if(0!==n)return n}n=c[a];p=c[b];return n<p?-1:n>p?1:0})}a.bSorted=!0}function Nb(a){var b=a.aoColumns,c=Y(a);a=a.oLanguage.oAria;for(var d=0,e=b.length;d<e;d++){var h=b[d];var g=h.asSorting;var k=h.sTitle.replace(/<.*?>/g,"");var f=h.nTh;f.removeAttribute("aria-sort");
|
72 |
+
h.bSortable&&(0<c.length&&c[0].col==d?(f.setAttribute("aria-sort","asc"==c[0].dir?"ascending":"descending"),h=g[c[0].index+1]||g[0]):h=g[0],k+="asc"===h?a.sSortAscending:a.sSortDescending);f.setAttribute("aria-label",k)}}function Za(a,b,c,d){var e=a.aaSorting,h=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===p&&(c=f.inArray(a[1],h));return c+1<h.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=f.inArray(b,J(e,"0")),-1!==c?(b=g(e[c],!0),null===
|
73 |
+
b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=h[b],e[c]._idx=b)):(e.push([b,h[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=h[b],e[0]._idx=b):(e.length=0,e.push([b,h[0]]),e[0]._idx=0);V(a);"function"==typeof d&&d(a)}function Qa(a,b,c,d){var e=a.aoColumns[c];$a(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(K(a,!0),setTimeout(function(){Za(a,c,b.shiftKey,d);"ssp"!==D(a)&&K(a,!1)},0)):Za(a,c,b.shiftKey,d))})}function Aa(a){var b=a.aLastSort,
|
74 |
+
c=a.oClasses.sSortColumn,d=Y(a),e=a.oFeatures,h;if(e.bSort&&e.bSortClasses){e=0;for(h=b.length;e<h;e++){var g=b[e].src;f(J(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3))}e=0;for(h=d.length;e<h;e++)g=d[e].src,f(J(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Mb(a,b){var c=a.aoColumns[b],d=q.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,ca(a,b)));for(var h,g=q.ext.type.order[c.sType+"-pre"],k=0,f=a.aoData.length;k<f;k++)if(c=a.aoData[k],c._aSortData||(c._aSortData=
|
75 |
+
[]),!c._aSortData[b]||d)h=d?e[k]:I(a,k,b,"sort"),c._aSortData[b]=g?g(h):h}function Ba(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:f.extend(!0,[],a.aaSorting),search:Fb(a.oPreviousSearch),columns:f.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Fb(a.aoPreSearchCols[d])}})};A(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Ob(a,b,c){var d,
|
76 |
+
e,h=a.aoColumns;b=function(b){if(b&&b.time){var g=A(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===f.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g||b.columns&&h.length!==b.columns.length))){a.oLoadedState=f.extend(!0,{},b);b.start!==p&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==p&&(a._iDisplayLength=b.length);b.order!==p&&(a.aaSorting=[],f.each(b.order,function(b,c){a.aaSorting.push(c[0]>=h.length?[0,c[1]]:c)}));b.search!==p&&f.extend(a.oPreviousSearch,
|
77 |
+
Gb(b.search));if(b.columns)for(d=0,e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==p&&(h[d].bVisible=g.visible),g.search!==p&&f.extend(a.aoPreSearchCols[d],Gb(g.search));A(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==p&&b(g)}else c()}function Ca(a){var b=q.settings;a=f.inArray(a,J(b,"nTable"));return-1!==a?b[a]:null}function O(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
|
78 |
+
d);if(b)z.console&&console.log&&console.log(c);else if(b=q.ext,b=b.sErrMode||b.errMode,a&&A(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function M(a,b,c,d){f.isArray(c)?f.each(c,function(c,d){f.isArray(d)?M(a,b,d[0],d[1]):M(a,b,d)}):(d===p&&(d=c),b[c]!==p&&(a[d]=b[c]))}function ab(a,b,c){var d;for(d in b)if(b.hasOwnProperty(d)){var e=b[d];f.isPlainObject(e)?(f.isPlainObject(a[d])||(a[d]={}),f.extend(!0,a[d],e)):c&&"data"!==d&&"aaData"!==
|
79 |
+
d&&f.isArray(e)?a[d]=e.slice():a[d]=e}return a}function $a(a,b,c){f(a).on("click.DT",b,function(b){f(a).blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function E(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function A(a,b,c,d){var e=[];b&&(e=f.map(a[b].slice().reverse(),function(b,c){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=f.Event(c+".dt"),f(a.nTable).trigger(b,d),e.push(b.result));return e}function Wa(a){var b=a._iDisplayStart,
|
80 |
+
c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ra(a,b){a=a.renderer;var c=q.ext.renderer[b];return f.isPlainObject(a)&&a[b]?c[a[b]]||c._:"string"===typeof a?c[a]||c._:c._}function D(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ka(a,b){var c=Pb.numbers_length,d=Math.floor(c/2);b<=c?a=Z(0,b):a<=d?(a=Z(0,c-2),a.push("ellipsis"),a.push(b-1)):(a>=b-1-d?a=Z(b-(c-2),b):(a=Z(a-d+2,a+d-1),a.push("ellipsis"),
|
81 |
+
a.push(b-1)),a.splice(0,0,"ellipsis"),a.splice(0,0,0));a.DT_el="span";return a}function Ha(a){f.each({num:function(b){return Da(b,a)},"num-fmt":function(b){return Da(b,a,bb)},"html-num":function(b){return Da(b,a,Ea)},"html-num-fmt":function(b){return Da(b,a,Ea,bb)}},function(b,c){C.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(C.type.search[b+a]=C.type.search.html)})}function Qb(a){return function(){var b=[Ca(this[q.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return q.ext.internal[a].apply(this,
|
82 |
+
b)}}var q=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new v(Ca(this[C.iApiIndex])):new v(this)};this.fnAddData=function(a,b){var c=this.api(!0);a=f.isArray(a)&&(f.isArray(a[0])||f.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===p||b)&&c.draw();return a.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===p||a?b.draw(!1):
|
83 |
+
(""!==d.sX||""!==d.sY)&&na(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===p||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0);a=d.rows(a);var e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===p||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,f){e=this.api(!0);null===b||b===p?
|
84 |
+
e.search(a,c,d,f):e.column(b).search(a,c,d,f);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==p){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==p||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==p?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),
|
85 |
+
[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){a=this.api(!0).page(a);(b===p||b)&&a.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===p||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return Ca(this[C.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=
|
86 |
+
function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===p||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===p||e)&&h.columns.adjust();(d===p||d)&&h.draw();return 0};this.fnVersionCheck=C.fnVersionCheck;var b=this,c=a===p,d=this.length;c&&(a={});this.oApi=this.internal=C.internal;for(var e in q.ext.internal)e&&(this[e]=Qb(e));this.each(function(){var e={},g=1<d?ab(e,a,!0):a,k=0,l;e=this.getAttribute("id");var n=!1,m=q.defaults,w=f(this);if("table"!=
|
87 |
+
this.nodeName.toLowerCase())O(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{jb(m);kb(m.column);L(m,m,!0);L(m.column,m.column,!0);L(m,f.extend(g,w.data()),!0);var u=q.settings;k=0;for(l=u.length;k<l;k++){var t=u[k];if(t.nTable==this||t.nTHead&&t.nTHead.parentNode==this||t.nTFoot&&t.nTFoot.parentNode==this){var v=g.bRetrieve!==p?g.bRetrieve:m.bRetrieve;if(c||v)return t.oInstance;if(g.bDestroy!==p?g.bDestroy:m.bDestroy){t.oInstance.fnDestroy();break}else{O(t,0,"Cannot reinitialise DataTable",
|
88 |
+
3);return}}if(t.sTableId==this.id){u.splice(k,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+q.ext._unique++;var r=f.extend(!0,{},q.models.oSettings,{sDestroyWidth:w[0].style.width,sInstance:e,sTableId:e});r.nTable=this;r.oApi=b.internal;r.oInit=g;u.push(r);r.oInstance=1===b.length?b:w.dataTable();jb(g);Ga(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=f.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=ab(f.extend(!0,{},m),g);M(r.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));
|
89 |
+
M(r,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);M(r.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],
|
90 |
+
["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);M(r.oLanguage,g,"fnInfoCallback");E(r,"aoDrawCallback",g.fnDrawCallback,"user");E(r,"aoServerParams",g.fnServerParams,"user");E(r,"aoStateSaveParams",g.fnStateSaveParams,"user");E(r,"aoStateLoadParams",g.fnStateLoadParams,"user");E(r,"aoStateLoaded",g.fnStateLoaded,"user");E(r,"aoRowCallback",g.fnRowCallback,"user");E(r,"aoRowCreatedCallback",g.fnCreatedRow,"user");E(r,"aoHeaderCallback",g.fnHeaderCallback,"user");E(r,"aoFooterCallback",g.fnFooterCallback,
|
91 |
+
"user");E(r,"aoInitComplete",g.fnInitComplete,"user");E(r,"aoPreDrawCallback",g.fnPreDrawCallback,"user");r.rowIdFn=U(g.rowId);lb(r);var x=r.oClasses;f.extend(x,q.ext.classes,g.oClasses);w.addClass(x.sTable);r.iInitDisplayStart===p&&(r.iInitDisplayStart=g.iDisplayStart,r._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(r.bDeferLoading=!0,e=f.isArray(g.iDeferLoading),r._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,r._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var y=r.oLanguage;
|
92 |
+
f.extend(!0,y,g.oLanguage);y.sUrl&&(f.ajax({dataType:"json",url:y.sUrl,success:function(a){Ga(a);L(m.oLanguage,a);f.extend(!0,y,a);ja(r)},error:function(){ja(r)}}),n=!0);null===g.asStripeClasses&&(r.asStripeClasses=[x.sStripeOdd,x.sStripeEven]);e=r.asStripeClasses;var z=w.children("tbody").find("tr").eq(0);-1!==f.inArray(!0,f.map(e,function(a,b){return z.hasClass(a)}))&&(f("tbody tr",this).removeClass(e.join(" ")),r.asDestroyStripes=e.slice());e=[];u=this.getElementsByTagName("thead");0!==u.length&&
|
93 |
+
(fa(r.aoHeader,u[0]),e=ua(r));if(null===g.aoColumns)for(u=[],k=0,l=e.length;k<l;k++)u.push(null);else u=g.aoColumns;k=0;for(l=u.length;k<l;k++)Ia(r,e?e[k]:null);nb(r,g.aoColumnDefs,u,function(a,b){ma(r,a,b)});if(z.length){var B=function(a,b){return null!==a.getAttribute("data-"+b)?b:null};f(z[0]).children("th, td").each(function(a,b){var c=r.aoColumns[a];if(c.mData===a){var d=B(b,"sort")||B(b,"order");b=B(b,"filter")||B(b,"search");if(null!==d||null!==b)c.mData={_:a+".display",sort:null!==d?a+".@data-"+
|
94 |
+
d:p,type:null!==d?a+".@data-"+d:p,filter:null!==b?a+".@data-"+b:p},ma(r,a)}})}var C=r.oFeatures;e=function(){if(g.aaSorting===p){var a=r.aaSorting;k=0;for(l=a.length;k<l;k++)a[k][1]=r.aoColumns[k].asSorting[0]}Aa(r);C.bSort&&E(r,"aoDrawCallback",function(){if(r.bSorted){var a=Y(r),b={};f.each(a,function(a,c){b[c.src]=c.dir});A(r,null,"order",[r,a,b]);Nb(r)}});E(r,"aoDrawCallback",function(){(r.bSorted||"ssp"===D(r)||C.bDeferRender)&&Aa(r)},"sc");a=w.children("caption").each(function(){this._captionSide=
|
95 |
+
f(this).css("caption-side")});var b=w.children("thead");0===b.length&&(b=f("<thead/>").appendTo(w));r.nTHead=b[0];b=w.children("tbody");0===b.length&&(b=f("<tbody/>").appendTo(w));r.nTBody=b[0];b=w.children("tfoot");0===b.length&&0<a.length&&(""!==r.oScroll.sX||""!==r.oScroll.sY)&&(b=f("<tfoot/>").appendTo(w));0===b.length||0===b.children().length?w.addClass(x.sNoFooter):0<b.length&&(r.nTFoot=b[0],fa(r.aoFooter,r.nTFoot));if(g.aaData)for(k=0;k<g.aaData.length;k++)R(r,g.aaData[k]);else(r.bDeferLoading||
|
96 |
+
"dom"==D(r))&&pa(r,f(r.nTBody).children("tr"));r.aiDisplay=r.aiDisplayMaster.slice();r.bInitialised=!0;!1===n&&ja(r)};g.bStateSave?(C.bStateSave=!0,E(r,"aoDrawCallback",Ba,"state_save"),Ob(r,g,e)):e()}});b=null;return this},C,t,x,cb={},Rb=/[\r\n\u2028]/g,Ea=/<.*?>/g,cc=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,dc=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^|\-)/g,bb=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,P=function(a){return a&&!0!==a&&"-"!==a?!1:
|
97 |
+
!0},Sb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Tb=function(a,b){cb[b]||(cb[b]=new RegExp(Ua(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(cb[b],"."):a},db=function(a,b,c){var d="string"===typeof a;if(P(a))return!0;b&&d&&(a=Tb(a,b));c&&d&&(a=a.replace(bb,""));return!isNaN(parseFloat(a))&&isFinite(a)},Ub=function(a,b,c){return P(a)?!0:P(a)||"string"===typeof a?db(a.replace(Ea,""),b,c)?!0:null:null},J=function(a,b,c){var d=[],e=0,h=a.length;if(c!==
|
98 |
+
p)for(;e<h;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<h;e++)a[e]&&d.push(a[e][b]);return d},la=function(a,b,c,d){var e=[],h=0,g=b.length;if(d!==p)for(;h<g;h++)a[b[h]][c]&&e.push(a[b[h]][c][d]);else for(;h<g;h++)e.push(a[b[h]][c]);return e},Z=function(a,b){var c=[];if(b===p){b=0;var d=a}else d=b,b=a;for(a=b;a<d;a++)c.push(a);return c},Vb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},ta=function(a){a:{if(!(2>a.length)){var b=a.slice().sort();for(var c=b[0],d=1,
|
99 |
+
e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();b=[];e=a.length;var h,g=0;d=0;a:for(;d<e;d++){c=a[d];for(h=0;h<g;h++)if(b[h]===c)continue a;b.push(c);g++}return b};q.util={throttle:function(a,b){var c=b!==p?b:200,d,e;return function(){var b=this,g=+new Date,f=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=p;a.apply(b,f)},c)):(d=g,a.apply(b,f))}},escapeRegex:function(a){return a.replace(dc,"\\$1")}};var F=function(a,b,c){a[b]!==p&&(a[c]=a[b])},da=/\[.*?\]$/,
|
100 |
+
X=/\(\)$/,Ua=q.util.escapeRegex,ya=f("<div>")[0],$b=ya.textContent!==p,bc=/<.*?>/g,Sa=q.util.throttle,Wb=[],G=Array.prototype,ec=function(a){var b,c=q.settings,d=f.map(c,function(a,b){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase()){var e=f.inArray(a,d);return-1!==e?[c[e]]:null}if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?b=f(a):a instanceof f&&(b=a)}else return[];if(b)return b.map(function(a){e=f.inArray(this,
|
101 |
+
d);return-1!==e?c[e]:null}).toArray()};var v=function(a,b){if(!(this instanceof v))return new v(a,b);var c=[],d=function(a){(a=ec(a))&&c.push.apply(c,a)};if(f.isArray(a))for(var e=0,h=a.length;e<h;e++)d(a[e]);else d(a);this.context=ta(c);b&&f.merge(this,b);this.selector={rows:null,cols:null,opts:null};v.extend(this,this,Wb)};q.Api=v;f.extend(v.prototype,{any:function(){return 0!==this.count()},concat:G.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=
|
102 |
+
this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new v(b[a],this[a]):null},filter:function(a){var b=[];if(G.filter)b=G.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new v(this.context,b)},flatten:function(){var a=[];return new v(this.context,a.concat.apply(a,this.toArray()))},join:G.join,indexOf:G.indexOf||function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===
|
103 |
+
a)return b;return-1},iterator:function(a,b,c,d){var e=[],h,g,f=this.context,l,n=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);var m=0;for(h=f.length;m<h;m++){var q=new v(f[m]);if("table"===b){var u=c.call(q,f[m],m);u!==p&&e.push(u)}else if("columns"===b||"rows"===b)u=c.call(q,f[m],this[m],m),u!==p&&e.push(u);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){var t=this[m];"column-rows"===b&&(l=Fa(f[m],n.opts));var x=0;for(g=t.length;x<g;x++)u=t[x],u="cell"===b?c.call(q,f[m],u.row,
|
104 |
+
u.column,m,x):c.call(q,f[m],u,m,x,l),u!==p&&e.push(u)}}return e.length||d?(a=new v(f,a?e.concat.apply([],e):e),b=a.selector,b.rows=n.rows,b.cols=n.cols,b.opts=n.opts,a):this},lastIndexOf:G.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(G.map)b=G.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new v(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},
|
105 |
+
pop:G.pop,push:G.push,reduce:G.reduce||function(a,b){return mb(this,a,b,0,this.length,1)},reduceRight:G.reduceRight||function(a,b){return mb(this,a,b,this.length-1,-1,-1)},reverse:G.reverse,selector:null,shift:G.shift,slice:function(){return new v(this.context,this)},sort:G.sort,splice:G.splice,toArray:function(){return G.slice.call(this)},to$:function(){return f(this)},toJQuery:function(){return f(this)},unique:function(){return new v(this.context,ta(this))},unshift:G.unshift});v.extend=function(a,
|
106 |
+
b,c){if(c.length&&b&&(b instanceof v||b.__dt_wrapper)){var d,e=function(a,b,c){return function(){var d=b.apply(a,arguments);v.extend(d,d,c.methodExt);return d}};var h=0;for(d=c.length;h<d;h++){var g=c[h];b[g.name]="function"===g.type?e(a,g.val,g):"object"===g.type?{}:g.val;b[g.name].__dt_wrapper=!0;v.extend(a,b[g.name],g.propExt)}}};v.register=t=function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c<d;c++)v.register(a[c],b);else{d=a.split(".");var e=Wb,h;a=0;for(c=d.length;a<c;a++){var g=(h=-1!==
|
107 |
+
d[a].indexOf("()"))?d[a].replace("()",""):d[a];a:{var k=0;for(var l=e.length;k<l;k++)if(e[k].name===g){k=e[k];break a}k=null}k||(k={name:g,val:{},methodExt:[],propExt:[],type:"object"},e.push(k));a===c-1?(k.val=b,k.type="function"===typeof b?"function":f.isPlainObject(b)?"object":"other"):e=h?k.methodExt:k.propExt}}};v.registerPlural=x=function(a,b,c){v.register(a,c);v.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof v?a.length?f.isArray(a[0])?new v(a.context,
|
108 |
+
a[0]):a[0]:p:a})};var fc=function(a,b){if("number"===typeof a)return[b[a]];var c=f.map(b,function(a,b){return a.nTable});return f(c).filter(a).map(function(a){a=f.inArray(this,c);return b[a]}).toArray()};t("tables()",function(a){return a?new v(fc(a,this.context)):this});t("table()",function(a){a=this.tables(a);var b=a.context;return b.length?new v(b[0]):a});x("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});x("tables().body()","table().body()",
|
109 |
+
function(){return this.iterator("table",function(a){return a.nTBody},1)});x("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});x("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});x("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});t("draw()",function(a){return this.iterator("table",function(b){"page"===
|
110 |
+
a?S(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),V(b,!1===a))})});t("page()",function(a){return a===p?this.page.info().page:this.iterator("table",function(b){Xa(b,a)})});t("page.info()",function(a){if(0===this.context.length)return p;a=this.context[0];var b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,
|
111 |
+
serverSide:"ssp"===D(a)}});t("page.len()",function(a){return a===p?0!==this.context.length?this.context[0]._iDisplayLength:p:this.iterator("table",function(b){Va(b,a)})});var Xb=function(a,b,c){if(c){var d=new v(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==D(a))V(a,b);else{K(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();va(a,[],function(c){qa(a);c=wa(a,c);for(var d=0,e=c.length;d<e;d++)R(a,c[d]);V(a,b);K(a,!1)})}};t("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});
|
112 |
+
t("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});t("ajax.reload()",function(a,b){return this.iterator("table",function(c){Xb(c,!1===b,a)})});t("ajax.url()",function(a){var b=this.context;if(a===p){if(0===b.length)return p;b=b[0];return b.ajax?f.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){f.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});t("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Xb(c,
|
113 |
+
!1===b,a)})});var eb=function(a,b,c,d,e){var h=[],g,k,l;var n=typeof b;b&&"string"!==n&&"function"!==n&&b.length!==p||(b=[b]);n=0;for(k=b.length;n<k;n++){var m=b[n]&&b[n].split&&!b[n].match(/[\[\(:]/)?b[n].split(","):[b[n]];var q=0;for(l=m.length;q<l;q++)(g=c("string"===typeof m[q]?f.trim(m[q]):m[q]))&&g.length&&(h=h.concat(g))}a=C.selector[a];if(a.length)for(n=0,k=a.length;n<k;n++)h=a[n](d,e,h);return ta(h)},fb=function(a){a||(a={});a.filter&&a.search===p&&(a.search=a.filter);return f.extend({search:"none",
|
114 |
+
order:"current",page:"all"},a)},gb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Fa=function(a,b){var c=[],d=a.aiDisplay;var e=a.aiDisplayMaster;var h=b.search;var g=b.order;b=b.page;if("ssp"==D(a))return"removed"===h?[]:Z(0,e.length);if("current"==b)for(g=a._iDisplayStart,a=a.fnDisplayEnd();g<a;g++)c.push(d[g]);else if("current"==g||"applied"==g)if("none"==h)c=e.slice();else if("applied"==h)c=
|
115 |
+
d.slice();else{if("removed"==h){var k={};g=0;for(a=d.length;g<a;g++)k[d[g]]=null;c=f.map(e,function(a){return k.hasOwnProperty(a)?null:a})}}else if("index"==g||"original"==g)for(g=0,a=a.aoData.length;g<a;g++)"none"==h?c.push(g):(e=f.inArray(g,d),(-1===e&&"removed"==h||0<=e&&"applied"==h)&&c.push(g));return c},gc=function(a,b,c){var d;return eb("row",b,function(b){var e=Sb(b),g=a.aoData;if(null!==e&&!c)return[e];d||(d=Fa(a,c));if(null!==e&&-1!==f.inArray(e,d))return[e];if(null===b||b===p||""===b)return d;
|
116 |
+
if("function"===typeof b)return f.map(d,function(a){var c=g[a];return b(a,c._aData,c.nTr)?a:null});if(b.nodeName){e=b._DT_RowIndex;var k=b._DT_CellIndex;if(e!==p)return g[e]&&g[e].nTr===b?[e]:[];if(k)return g[k.row]&&g[k.row].nTr===b.parentNode?[k.row]:[];e=f(b).closest("*[data-dt-row]");return e.length?[e.data("dt-row")]:[]}if("string"===typeof b&&"#"===b.charAt(0)&&(e=a.aIds[b.replace(/^#/,"")],e!==p))return[e.idx];e=Vb(la(a.aoData,d,"nTr"));return f(e).filter(b).map(function(){return this._DT_RowIndex}).toArray()},
|
117 |
+
a,c)};t("rows()",function(a,b){a===p?a="":f.isPlainObject(a)&&(b=a,a="");b=fb(b);var c=this.iterator("table",function(c){return gc(c,a,b)},1);c.selector.rows=a;c.selector.opts=b;return c});t("rows().nodes()",function(){return this.iterator("row",function(a,b){return a.aoData[b].nTr||p},1)});t("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return la(a.aoData,b,"_aData")},1)});x("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){b=b.aoData[c];
|
118 |
+
return"search"===a?b._aFilterData:b._aSortData},1)});x("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ea(b,c,a)})});x("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,b){return b},1)});x("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var h=0,g=this[d].length;h<g;h++){var f=c[d].rowIdFn(c[d].aoData[this[d][h]]._aData);b.push((!0===a?"#":"")+f)}return new v(c,b)});x("rows().remove()",
|
119 |
+
"row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,h=e[c],g,f;e.splice(c,1);var l=0;for(g=e.length;l<g;l++){var n=e[l];var m=n.anCells;null!==n.nTr&&(n.nTr._DT_RowIndex=l);if(null!==m)for(n=0,f=m.length;n<f;n++)m[n]._DT_CellIndex.row=l}ra(b.aiDisplayMaster,c);ra(b.aiDisplay,c);ra(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Wa(b);c=b.rowIdFn(h._aData);c!==p&&delete b.aIds[c]});this.iterator("table",function(a){for(var b=0,d=a.aoData.length;b<d;b++)a.aoData[b].idx=
|
120 |
+
b});return this});t("rows.add()",function(a){var b=this.iterator("table",function(b){var c,d=[];var g=0;for(c=a.length;g<c;g++){var f=a[g];f.nodeName&&"TR"===f.nodeName.toUpperCase()?d.push(pa(b,f)[0]):d.push(R(b,f))}return d},1),c=this.rows(-1);c.pop();f.merge(c,b);return c});t("row()",function(a,b){return gb(this.rows(a,b))});t("row().data()",function(a){var b=this.context;if(a===p)return b.length&&this.length?b[0].aoData[this[0]]._aData:p;var c=b[0].aoData[this[0]];c._aData=a;f.isArray(a)&&c.nTr.id&&
|
121 |
+
Q(b[0].rowId)(a,c.nTr.id);ea(b[0],this[0],"data");return this});t("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});t("row.add()",function(a){a instanceof f&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?pa(b,a)[0]:R(b,a)});return this.row(b[0])});var hc=function(a,b,c,d){var e=[],h=function(b,c){if(f.isArray(b)||b instanceof f)for(var d=0,g=b.length;d<g;d++)h(b[d],c);else b.nodeName&&
|
122 |
+
"tr"===b.nodeName.toLowerCase()?e.push(b):(d=f("<tr><td/></tr>").addClass(c),f("td",d).addClass(c).html(b)[0].colSpan=W(a),e.push(d[0]))};h(c,d);b._details&&b._details.detach();b._details=f(e);b._detailsShow&&b._details.insertAfter(b.nTr)},hb=function(a,b){var c=a.context;c.length&&(a=c[0].aoData[b!==p?b:a[0]])&&a._details&&(a._details.remove(),a._detailsShow=p,a._details=p)},Yb=function(a,b){var c=a.context;c.length&&a.length&&(a=c[0].aoData[a[0]],a._details&&((a._detailsShow=b)?a._details.insertAfter(a.nTr):
|
123 |
+
a._details.detach(),ic(c[0])))},ic=function(a){var b=new v(a),c=a.aoData;b.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<J(c,"_details").length&&(b.on("draw.dt.DT_details",function(d,e){a===e&&b.rows({page:"current"}).eq(0).each(function(a){a=c[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),b.on("column-visibility.dt.DT_details",function(b,e,f,g){if(a===e)for(e=W(e),f=0,g=c.length;f<g;f++)b=c[f],b._details&&b._details.children("td[colspan]").attr("colspan",
|
124 |
+
e)}),b.on("destroy.dt.DT_details",function(d,e){if(a===e)for(d=0,e=c.length;d<e;d++)c[d]._details&&hb(b,d)}))};t("row().child()",function(a,b){var c=this.context;if(a===p)return c.length&&this.length?c[0].aoData[this[0]]._details:p;!0===a?this.child.show():!1===a?hb(this):c.length&&this.length&&hc(c[0],c[0].aoData[this[0]],a,b);return this});t(["row().child.show()","row().child().show()"],function(a){Yb(this,!0);return this});t(["row().child.hide()","row().child().hide()"],function(){Yb(this,!1);
|
125 |
+
return this});t(["row().child.remove()","row().child().remove()"],function(){hb(this);return this});t("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var jc=/^([^:]+):(name|visIdx|visible)$/,Zb=function(a,b,c,d,e){c=[];d=0;for(var f=e.length;d<f;d++)c.push(I(a,e[d],b));return c},kc=function(a,b,c){var d=a.aoColumns,e=J(d,"sName"),h=J(d,"nTh");return eb("column",b,function(b){var g=Sb(b);if(""===b)return Z(d.length);if(null!==
|
126 |
+
g)return[0<=g?g:d.length+g];if("function"===typeof b){var l=Fa(a,c);return f.map(d,function(c,d){return b(d,Zb(a,d,0,0,l),h[d])?d:null})}var n="string"===typeof b?b.match(jc):"";if(n)switch(n[2]){case "visIdx":case "visible":g=parseInt(n[1],10);if(0>g){var m=f.map(d,function(a,b){return a.bVisible?b:null});return[m[m.length+g]]}return[ba(a,g)];case "name":return f.map(e,function(a,b){return a===n[1]?b:null});default:return[]}if(b.nodeName&&b._DT_CellIndex)return[b._DT_CellIndex.column];g=f(h).filter(b).map(function(){return f.inArray(this,
|
127 |
+
h)}).toArray();if(g.length||!b.nodeName)return g;g=f(b).closest("*[data-dt-column]");return g.length?[g.data("dt-column")]:[]},a,c)};t("columns()",function(a,b){a===p?a="":f.isPlainObject(a)&&(b=a,a="");b=fb(b);var c=this.iterator("table",function(c){return kc(c,a,b)},1);c.selector.cols=a;c.selector.opts=b;return c});x("columns().header()","column().header()",function(a,b){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});x("columns().footer()","column().footer()",function(a,
|
128 |
+
b){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});x("columns().data()","column().data()",function(){return this.iterator("column-rows",Zb,1)});x("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});x("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,d,e,f){return la(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});x("columns().nodes()",
|
129 |
+
"column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return la(a.aoData,e,"anCells",b)},1)});x("columns().visible()","column().visible()",function(a,b){var c=this,d=this.iterator("column",function(b,c){if(a===p)return b.aoColumns[c].bVisible;var d=b.aoColumns,e=d[c],h=b.aoData,n;if(a!==p&&e.bVisible!==a){if(a){var m=f.inArray(!0,J(d,"bVisible"),c+1);d=0;for(n=h.length;d<n;d++){var q=h[d].nTr;b=h[d].anCells;q&&q.insertBefore(b[c],b[m]||null)}}else f(J(b.aoData,"anCells",
|
130 |
+
c)).detach();e.bVisible=a}});a!==p&&this.iterator("table",function(d){ha(d,d.aoHeader);ha(d,d.aoFooter);d.aiDisplay.length||f(d.nTBody).find("td[colspan]").attr("colspan",W(d));Ba(d);c.iterator("column",function(c,d){A(c,null,"column-visibility",[c,d,a,b])});(b===p||b)&&c.columns.adjust()});return d});x("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?ca(b,c):c},1)});t("columns.adjust()",function(){return this.iterator("table",function(a){aa(a)},
|
131 |
+
1)});t("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return ba(c,b);if("fromData"===a||"toVisible"===a)return ca(c,b)}});t("column()",function(a,b){return gb(this.columns(a,b))});var lc=function(a,b,c){var d=a.aoData,e=Fa(a,c),h=Vb(la(d,e,"anCells")),g=f([].concat.apply([],h)),k,l=a.aoColumns.length,n,m,q,u,t,v;return eb("cell",b,function(b){var c="function"===typeof b;if(null===b||b===p||c){n=[];m=0;for(q=e.length;m<q;m++)for(k=
|
132 |
+
e[m],u=0;u<l;u++)t={row:k,column:u},c?(v=d[k],b(t,I(a,k,u),v.anCells?v.anCells[u]:null)&&n.push(t)):n.push(t);return n}if(f.isPlainObject(b))return b.column!==p&&b.row!==p&&-1!==f.inArray(b.row,e)?[b]:[];c=g.filter(b).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||!b.nodeName)return c;v=f(b).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},a,c)};t("cells()",function(a,b,c){f.isPlainObject(a)&&
|
133 |
+
(a.row===p?(c=a,a=null):(c=b,b=null));f.isPlainObject(b)&&(c=b,b=null);if(null===b||b===p)return this.iterator("table",function(b){return lc(b,a,fb(c))});var d=c?{page:c.page,order:c.order,search:c.search}:{},e=this.columns(b,d),h=this.rows(a,d),g,k,l,n;d=this.iterator("table",function(a,b){a=[];g=0;for(k=h[b].length;g<k;g++)for(l=0,n=e[b].length;l<n;l++)a.push({row:h[b][g],column:e[b][l]});return a},1);d=c&&c.selected?this.cells(d,c):d;f.extend(d.selector,{cols:b,rows:a,opts:c});return d});x("cells().nodes()",
|
134 |
+
"cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&a.anCells?a.anCells[c]:p},1)});t("cells().data()",function(){return this.iterator("cell",function(a,b,c){return I(a,b,c)},1)});x("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});x("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return I(b,c,d,a)},
|
135 |
+
1)});x("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:ca(a,c)}},1)});x("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ea(b,c,a,d)})});t("cell()",function(a,b,c){return gb(this.cells(a,b,c))});t("cell().data()",function(a){var b=this.context,c=this[0];if(a===p)return b.length&&c.length?I(b[0],c[0].row,c[0].column):p;ob(b[0],c[0].row,c[0].column,a);ea(b[0],c[0].row,
|
136 |
+
"data",c[0].column);return this});t("order()",function(a,b){var c=this.context;if(a===p)return 0!==c.length?c[0].aaSorting:p;"number"===typeof a?a=[[a,b]]:a.length&&!f.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});t("order.listener()",function(a,b,c){return this.iterator("table",function(d){Qa(d,a,b,c)})});t("order.fixed()",function(a){if(!a){var b=this.context;b=b.length?b[0].aaSortingFixed:p;return f.isArray(b)?{pre:b}:
|
137 |
+
b}return this.iterator("table",function(b){b.aaSortingFixed=f.extend(!0,{},a)})});t(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];f.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});t("search()",function(a,b,c,d){var e=this.context;return a===p?0!==e.length?e[0].oPreviousSearch.sSearch:p:this.iterator("table",function(e){e.oFeatures.bFilter&&ia(e,f.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===
|
138 |
+
c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});x("columns().search()","column().search()",function(a,b,c,d){return this.iterator("column",function(e,h){var g=e.aoPreSearchCols;if(a===p)return g[h].sSearch;e.oFeatures.bFilter&&(f.extend(g[h],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),ia(e,e.oPreviousSearch,1))})});t("state()",function(){return this.context.length?this.context[0].oSavedState:null});t("state.clear()",function(){return this.iterator("table",
|
139 |
+
function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});t("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});t("state.save()",function(){return this.iterator("table",function(a){Ba(a)})});q.versionCheck=q.fnVersionCheck=function(a){var b=q.version.split(".");a=a.split(".");for(var c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};q.isDataTable=q.fnIsDataTable=function(a){var b=f(a).get(0),c=!1;if(a instanceof
|
140 |
+
q.Api)return!0;f.each(q.settings,function(a,e){a=e.nScrollHead?f("table",e.nScrollHead)[0]:null;var d=e.nScrollFoot?f("table",e.nScrollFoot)[0]:null;if(e.nTable===b||a===b||d===b)c=!0});return c};q.tables=q.fnTables=function(a){var b=!1;f.isPlainObject(a)&&(b=a.api,a=a.visible);var c=f.map(q.settings,function(b){if(!a||a&&f(b.nTable).is(":visible"))return b.nTable});return b?new v(c):c};q.camelToHungarian=L;t("$()",function(a,b){b=this.rows(b).nodes();b=f(b);return f([].concat(b.filter(a).toArray(),
|
141 |
+
b.find(a).toArray()))});f.each(["on","one","off"],function(a,b){t(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0]=f.map(a[0].split(/\s/),function(a){return a.match(/\.dt\b/)?a:a+".dt"}).join(" ");var d=f(this.tables().nodes());d[b].apply(d,a);return this})});t("clear()",function(){return this.iterator("table",function(a){qa(a)})});t("settings()",function(){return new v(this.context,this.context)});t("init()",function(){var a=this.context;return a.length?a[0].oInit:null});t("data()",
|
142 |
+
function(){return this.iterator("table",function(a){return J(a.aoData,"_aData")}).flatten()});t("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,h=b.nTBody,g=b.nTHead,k=b.nTFoot,l=f(e);h=f(h);var n=f(b.nTableWrapper),m=f.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;A(b,"aoDestroyCallback","destroy",[b]);a||(new v(b)).columns().visible(!0);n.off(".DT").find(":not(tbody *)").off(".DT");f(z).off(".DT-"+b.sInstance);
|
143 |
+
e!=g.parentNode&&(l.children("thead").detach(),l.append(g));k&&e!=k.parentNode&&(l.children("tfoot").detach(),l.append(k));b.aaSorting=[];b.aaSortingFixed=[];Aa(b);f(m).removeClass(b.asStripeClasses.join(" "));f("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);h.children().detach();h.append(m);g=a?"remove":"detach";l[g]();n[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),l.css("width",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&
|
144 |
+
h.children().each(function(a){f(this).addClass(b.asDestroyStripes[a%p])}));c=f.inArray(b,q.settings);-1!==c&&q.settings.splice(c,1)})});f.each(["column","row","cell"],function(a,b){t(b+"s().every()",function(a){var c=this.selector.opts,e=this;return this.iterator(b,function(d,f,k,l,n){a.call(e[b](f,"cell"===b?k:c,"cell"===b?c:p),f,k,l,n)})})});t("i18n()",function(a,b,c){var d=this.context[0];a=U(a)(d.oLanguage);a===p&&(a=b);c!==p&&f.isPlainObject(a)&&(a=a[c]!==p?a[c]:a._);return a.replace("%d",c)});
|
145 |
+
q.version="1.10.20";q.settings=[];q.models={};q.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};q.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};q.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,
|
146 |
+
sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};q.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,
|
147 |
+
bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},
|
148 |
+
fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",
|
149 |
+
sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:f.extend({},q.models.oSearch),sAjaxDataProp:"data",
|
150 |
+
sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};H(q.defaults);q.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};H(q.defaults.column);q.models.oSettings=
|
151 |
+
{oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},
|
152 |
+
aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,
|
153 |
+
aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:p,oAjaxData:p,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==D(this)?1*this._iRecordsTotal:
|
154 |
+
this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==D(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};q.ext=C={buttons:{},
|
155 |
+
classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:q.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:q.version};f.extend(C,{afnFiltering:C.search,aTypes:C.type.detect,ofnSearch:C.type.search,oSort:C.type.order,afnSortData:C.order,aoFeatures:C.feature,oApi:C.internal,oStdClasses:C.classes,oPagination:C.pager});
|
156 |
+
f.extend(q.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",
|
157 |
sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
|
158 |
+
sJUIHeader:"",sJUIFooter:""});var Pb=q.ext.pager;f.extend(Pb,{simple:function(a,b){return["previous","next"]},full:function(a,b){return["first","previous","next","last"]},numbers:function(a,b){return[ka(a,b)]},simple_numbers:function(a,b){return["previous",ka(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ka(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ka(a,b),"last"]},_numbers:ka,numbers_length:7});f.extend(!0,q.ext.renderer,{pageButton:{_:function(a,b,
|
159 |
+
c,d,e,h){var g=a.oClasses,k=a.oLanguage.oPaginate,l=a.oLanguage.oAria.paginate||{},n,m,q=0,t=function(b,d){var p,r=g.sPageButtonDisabled,u=function(b){Xa(a,b.data.action,!0)};var w=0;for(p=d.length;w<p;w++){var v=d[w];if(f.isArray(v)){var x=f("<"+(v.DT_el||"div")+"/>").appendTo(b);t(x,v)}else{n=null;m=v;x=a.iTabIndex;switch(v){case "ellipsis":b.append('<span class="ellipsis">…</span>');break;case "first":n=k.sFirst;0===e&&(x=-1,m+=" "+r);break;case "previous":n=k.sPrevious;0===e&&(x=-1,m+=
|
160 |
+
" "+r);break;case "next":n=k.sNext;e===h-1&&(x=-1,m+=" "+r);break;case "last":n=k.sLast;e===h-1&&(x=-1,m+=" "+r);break;default:n=v+1,m=e===v?g.sPageButtonActive:""}null!==n&&(x=f("<a>",{"class":g.sPageButton+" "+m,"aria-controls":a.sTableId,"aria-label":l[v],"data-dt-idx":q,tabindex:x,id:0===c&&"string"===typeof v?a.sTableId+"_"+v:null}).html(n).appendTo(b),$a(x,{action:v},u),q++)}}};try{var v=f(b).find(y.activeElement).data("dt-idx")}catch(mc){}t(f(b).empty(),d);v!==p&&f(b).find("[data-dt-idx="+
|
161 |
+
v+"]").focus()}}});f.extend(q.ext.type.detect,[function(a,b){b=b.oLanguage.sDecimal;return db(a,b)?"num"+b:null},function(a,b){if(a&&!(a instanceof Date)&&!cc.test(a))return null;b=Date.parse(a);return null!==b&&!isNaN(b)||P(a)?"date":null},function(a,b){b=b.oLanguage.sDecimal;return db(a,b,!0)?"num-fmt"+b:null},function(a,b){b=b.oLanguage.sDecimal;return Ub(a,b)?"html-num"+b:null},function(a,b){b=b.oLanguage.sDecimal;return Ub(a,b,!0)?"html-num-fmt"+b:null},function(a,b){return P(a)||"string"===
|
162 |
+
typeof a&&-1!==a.indexOf("<")?"html":null}]);f.extend(q.ext.type.search,{html:function(a){return P(a)?a:"string"===typeof a?a.replace(Rb," ").replace(Ea,""):""},string:function(a){return P(a)?a:"string"===typeof a?a.replace(Rb," "):a}});var Da=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Tb(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};f.extend(C.type.order,{"date-pre":function(a){a=Date.parse(a);return isNaN(a)?-Infinity:a},"html-pre":function(a){return P(a)?
|
163 |
+
"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return P(a)?"":"string"===typeof a?a.toLowerCase():a.toString?a.toString():""},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});Ha("");f.extend(!0,q.ext.renderer,{header:{_:function(a,b,c,d){f(a.nTable).on("order.dt.DT",function(e,f,g,k){a===f&&(e=c.idx,b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass("asc"==k[e]?d.sSortAsc:"desc"==k[e]?d.sSortDesc:
|
164 |
+
c.sSortingClass))})},jqueryui:function(a,b,c,d){f("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(f("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);f(a.nTable).on("order.dt.DT",function(e,f,g,k){a===f&&(e=c.idx,b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass("asc"==k[e]?d.sSortAsc:"desc"==k[e]?d.sSortDesc:c.sSortingClass),b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass("asc"==
|
165 |
+
k[e]?d.sSortJUIAsc:"desc"==k[e]?d.sSortJUIDesc:c.sSortingClassJUI))})}}});var ib=function(a){return"string"===typeof a?a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):a};q.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return ib(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
|
166 |
+
a)+f+(e||"")}}},text:function(){return{display:ib,filter:ib}}};f.extend(q.ext.internal,{_fnExternApiFunc:Qb,_fnBuildAjax:va,_fnAjaxUpdate:qb,_fnAjaxParameters:zb,_fnAjaxUpdateDraw:Ab,_fnAjaxDataSrc:wa,_fnAddColumn:Ia,_fnColumnOptions:ma,_fnAdjustColumnSizing:aa,_fnVisibleToColumnIndex:ba,_fnColumnIndexToVisible:ca,_fnVisbleColumns:W,_fnGetColumns:oa,_fnColumnTypes:Ka,_fnApplyColumnDefs:nb,_fnHungarianMap:H,_fnCamelToHungarian:L,_fnLanguageCompat:Ga,_fnBrowserDetect:lb,_fnAddData:R,_fnAddTr:pa,_fnNodeToDataIndex:function(a,
|
167 |
+
b){return b._DT_RowIndex!==p?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return f.inArray(c,a.aoData[b].anCells)},_fnGetCellData:I,_fnSetCellData:ob,_fnSplitObjNotation:Na,_fnGetObjectDataFn:U,_fnSetObjectDataFn:Q,_fnGetDataMaster:Oa,_fnClearTable:qa,_fnDeleteIndex:ra,_fnInvalidate:ea,_fnGetRowElements:Ma,_fnCreateTr:La,_fnBuildHead:pb,_fnDrawHead:ha,_fnDraw:S,_fnReDraw:V,_fnAddOptionsHtml:sb,_fnDetectHeader:fa,_fnGetUniqueThs:ua,_fnFeatureHtmlFilter:ub,_fnFilterComplete:ia,_fnFilterCustom:Db,
|
168 |
+
_fnFilterColumn:Cb,_fnFilter:Bb,_fnFilterCreateSearch:Ta,_fnEscapeRegex:Ua,_fnFilterData:Eb,_fnFeatureHtmlInfo:xb,_fnUpdateInfo:Hb,_fnInfoMacros:Ib,_fnInitialise:ja,_fnInitComplete:xa,_fnLengthChange:Va,_fnFeatureHtmlLength:tb,_fnFeatureHtmlPaginate:yb,_fnPageChange:Xa,_fnFeatureHtmlProcessing:vb,_fnProcessingDisplay:K,_fnFeatureHtmlTable:wb,_fnScrollDraw:na,_fnApplyToChildren:N,_fnCalculateColumnWidths:Ja,_fnThrottle:Sa,_fnConvertToWidth:Jb,_fnGetWidestNode:Kb,_fnGetMaxLenString:Lb,_fnStringToCss:B,
|
169 |
+
_fnSortFlatten:Y,_fnSort:rb,_fnSortAria:Nb,_fnSortListener:Za,_fnSortAttachListener:Qa,_fnSortingClasses:Aa,_fnSortData:Mb,_fnSaveState:Ba,_fnLoadState:Ob,_fnSettingsFromNode:Ca,_fnLog:O,_fnMap:M,_fnBindAction:$a,_fnCallbackReg:E,_fnCallbackFire:A,_fnLengthOverflow:Wa,_fnRenderer:Ra,_fnDataSource:D,_fnRowAttributes:Pa,_fnExtend:ab,_fnCalculateEnd:function(){}});f.fn.dataTable=q;q.$=f;f.fn.dataTableSettings=q.settings;f.fn.dataTableExt=q.ext;f.fn.DataTable=function(a){return f(this).dataTable(a).api()};
|
170 |
+
f.each(q,function(a,b){f.fn.DataTable[a]=b});return f.fn.dataTable});
|
libraries/csstidy/class.csstidy.php
CHANGED
@@ -43,79 +43,35 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
|
43 |
* @author Mark Scherer (remove $GLOBALS once and for all + PHP5.4 comp) 2012
|
44 |
*/
|
45 |
|
46 |
-
/**
|
47 |
-
* Defines ctype functions if required.
|
48 |
-
*
|
49 |
-
* @TODO: Make these methods of CSSTidy.
|
50 |
-
*/
|
51 |
-
if ( ! function_exists( 'ctype_space' ) ) {
|
52 |
-
/**
|
53 |
-
* Check for whitespace character(s).
|
54 |
-
*
|
55 |
-
* @since 1.0.0
|
56 |
-
*
|
57 |
-
* @param string $text Text to check.
|
58 |
-
* @return bool Whether all characters in the string are whitespace characters.
|
59 |
-
*/
|
60 |
-
function ctype_space( $text ) {
|
61 |
-
return ( 1 === preg_match( "/^[ \r\n\t\f]+$/", $text ) );
|
62 |
-
}
|
63 |
-
}
|
64 |
-
if ( ! function_exists( 'ctype_alpha' ) ) {
|
65 |
-
/**
|
66 |
-
* Check for alphabetic character(s).
|
67 |
-
*
|
68 |
-
* @since 1.0.0
|
69 |
-
*
|
70 |
-
* @param string $text Text to check.
|
71 |
-
* @return bool Whether all characters in the string are alphabetic characters.
|
72 |
-
*/
|
73 |
-
function ctype_alpha( $text ) {
|
74 |
-
return ( 1 === preg_match( '/^[a-zA-Z]+$/', $text ) );
|
75 |
-
}
|
76 |
-
}
|
77 |
-
if ( ! function_exists( 'ctype_xdigit' ) ) {
|
78 |
-
/**
|
79 |
-
* Check for character(s) representing a hexadecimal digit.
|
80 |
-
*
|
81 |
-
* @since 1.0.0
|
82 |
-
*
|
83 |
-
* @param string $text Text to check.
|
84 |
-
* @return bool Whether $text is a hexadecimal number.
|
85 |
-
*/
|
86 |
-
function ctype_xdigit( $text ) {
|
87 |
-
return ( 1 === preg_match( '/^[a-fA-F0-9]+$/', $text ) );
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
/**
|
92 |
* Defines constants.
|
93 |
*
|
94 |
* @TODO: Make these class constants of CSSTidy.
|
95 |
* @since 1.0.0
|
96 |
*/
|
97 |
-
define( 'AT_START',
|
98 |
-
define( 'AT_END',
|
99 |
-
define( 'SEL_START',
|
100 |
-
define( 'SEL_END',
|
101 |
-
define( 'PROPERTY',
|
102 |
-
define( 'VALUE',
|
103 |
-
define( 'COMMENT',
|
104 |
-
define( '
|
|
|
105 |
|
106 |
/**
|
107 |
* Load the class for printing CSS code.
|
108 |
*
|
109 |
* @since 1.0.0
|
110 |
*/
|
111 |
-
require
|
112 |
|
113 |
/**
|
114 |
* Load the class for optimising CSS code.
|
115 |
*
|
116 |
* @since 1.0.0
|
117 |
*/
|
118 |
-
require
|
119 |
|
120 |
/**
|
121 |
* CSS Parser class
|
@@ -383,7 +339,7 @@ class TablePress_CSSTidy {
|
|
383 |
* @since 1.0.0
|
384 |
*/
|
385 |
public function __construct() {
|
386 |
-
include
|
387 |
$this->data = $data;
|
388 |
|
389 |
$this->settings['remove_bslash'] = true;
|
@@ -504,7 +460,16 @@ class TablePress_CSSTidy {
|
|
504 |
*/
|
505 |
public function _add_token( $type, $data, $do = false ) {
|
506 |
if ( $this->get_cfg( 'preserve_css' ) || $do ) {
|
507 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
}
|
509 |
}
|
510 |
|
@@ -605,7 +570,7 @@ class TablePress_CSSTidy {
|
|
605 |
if ( ! is_dir( 'temp' ) ) {
|
606 |
$madedir = mkdir( 'temp' );
|
607 |
if ( ! $madedir ) {
|
608 |
-
print 'Could not make directory "temp" in ' .
|
609 |
exit;
|
610 |
}
|
611 |
}
|
@@ -695,6 +660,7 @@ class TablePress_CSSTidy {
|
|
695 |
$this->print->input_css = $string;
|
696 |
$string = str_replace( "\r\n", "\n", $string ) . ' ';
|
697 |
$cur_comment = '';
|
|
|
698 |
|
699 |
for ( $i = 0, $size = strlen( $string ); $i < $size; $i++ ) {
|
700 |
if ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) {
|
@@ -711,22 +677,22 @@ class TablePress_CSSTidy {
|
|
711 |
$this->from[] = 'at';
|
712 |
} elseif ( '{' === $string[ $i ] ) {
|
713 |
$this->status = 'is';
|
714 |
-
$this->at = $this->css_new_media_section( $this->at );
|
715 |
$this->_add_token( AT_START, $this->at );
|
716 |
} elseif ( ',' === $string[ $i ] ) {
|
717 |
-
$
|
718 |
} elseif ( '\\' === $string[ $i ] ) {
|
719 |
-
$
|
720 |
}
|
721 |
// Fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
|
722 |
// '/' is included for ratios in Opera: (-o-min-device-pixel-ratio: 3/2)
|
723 |
elseif ( in_array( $string[ $i ], array( '(', ')', ':', '.', '/' ), true ) ) {
|
724 |
-
$
|
725 |
}
|
726 |
} else {
|
727 |
-
$lastpos = strlen( $
|
728 |
-
if ( ! ( ( ctype_space( $
|
729 |
-
$
|
730 |
}
|
731 |
}
|
732 |
break;
|
@@ -743,18 +709,19 @@ class TablePress_CSSTidy {
|
|
743 |
foreach ( $at_rules as $name => $type ) {
|
744 |
if ( ! strcasecmp( substr( $string, $i + 1, strlen( $name ) ), $name ) ) {
|
745 |
if ( 'at' === $type ) {
|
746 |
-
$
|
747 |
} else {
|
748 |
$this->selector = '@' . $name;
|
749 |
}
|
750 |
if ( 'atis' === $type ) {
|
751 |
$this->next_selector_at = ( $this->next_selector_at ? $this->next_selector_at : ( $this->at ? $this->at : DEFAULT_AT ) );
|
752 |
-
$this->at = $this->css_new_media_section( ' ' );
|
753 |
$type = 'is';
|
754 |
}
|
755 |
$this->status = $type;
|
756 |
$i += strlen( $name );
|
757 |
$this->invalid_at = false;
|
|
|
758 |
}
|
759 |
}
|
760 |
|
@@ -780,20 +747,21 @@ class TablePress_CSSTidy {
|
|
780 |
$this->invalid_at = false;
|
781 |
$this->status = 'is';
|
782 |
if ( $this->next_selector_at ) {
|
783 |
-
$this->at = $this->
|
|
|
784 |
$this->next_selector_at = '';
|
785 |
}
|
786 |
} elseif ( '{' === $string[ $i ] ) {
|
787 |
$this->status = 'ip';
|
788 |
if ( '' === $this->at ) {
|
789 |
-
$this->at = $this->css_new_media_section( DEFAULT_AT );
|
790 |
}
|
791 |
$this->selector = $this->css_new_selector( $this->at, $this->selector );
|
792 |
$this->_add_token( SEL_START, $this->selector );
|
793 |
$this->added = false;
|
794 |
} elseif ( '}' === $string[ $i ] ) {
|
795 |
$this->_add_token( AT_END, $this->at );
|
796 |
-
$this->at =
|
797 |
$this->selector = '';
|
798 |
$this->sel_separate = array();
|
799 |
} elseif ( ',' === $string[ $i ] ) {
|
@@ -835,7 +803,8 @@ class TablePress_CSSTidy {
|
|
835 |
$this->selector = '';
|
836 |
$this->property = '';
|
837 |
if ( $this->next_selector_at ) {
|
838 |
-
$this->at = $this->
|
|
|
839 |
$this->next_selector_at = '';
|
840 |
}
|
841 |
} elseif ( ';' === $string[ $i ] ) {
|
@@ -1066,7 +1035,12 @@ class TablePress_CSSTidy {
|
|
1066 |
if ( '*' === $string[ $i ] && '/' === $string[ $i + 1 ] ) {
|
1067 |
$this->status = array_pop( $this->from );
|
1068 |
$i++;
|
1069 |
-
|
|
|
|
|
|
|
|
|
|
|
1070 |
$cur_comment = '';
|
1071 |
} else {
|
1072 |
$cur_comment .= $string[ $i ];
|
@@ -1155,6 +1129,25 @@ class TablePress_CSSTidy {
|
|
1155 |
return $pos ? ! ( @( '\\' !== $string[ $pos - 1 ] ) || $this->escaped( $string, $pos - 1 ) ) : false;
|
1156 |
}
|
1157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1158 |
/**
|
1159 |
* Adds a property with value to the existing CSS code.
|
1160 |
*
|
@@ -1181,28 +1174,26 @@ class TablePress_CSSTidy {
|
|
1181 |
}
|
1182 |
|
1183 |
/**
|
1184 |
-
*
|
|
|
1185 |
*
|
1186 |
-
*
|
1187 |
-
*
|
1188 |
-
* @since 1.0.0
|
1189 |
*
|
1190 |
-
* @param string $media Media.
|
1191 |
-
* @return string [return value]
|
1192 |
*/
|
1193 |
-
protected function
|
1194 |
-
|
1195 |
-
return $media;
|
1196 |
-
}
|
1197 |
-
// If the last @media is the same as this, keep it.
|
1198 |
if ( ! $this->css || ! is_array( $this->css ) || empty( $this->css ) ) {
|
1199 |
return $media;
|
1200 |
}
|
|
|
1201 |
end( $this->css );
|
1202 |
$at = key( $this->css );
|
1203 |
if ( $at === $media ) {
|
1204 |
return $media;
|
1205 |
}
|
|
|
1206 |
while ( isset( $this->css[ $media ] ) ) {
|
1207 |
if ( is_numeric( $media ) ) {
|
1208 |
$media++;
|
@@ -1213,6 +1204,57 @@ class TablePress_CSSTidy {
|
|
1213 |
return $media;
|
1214 |
}
|
1215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1216 |
/**
|
1217 |
* Start a new selector.
|
1218 |
*
|
43 |
* @author Mark Scherer (remove $GLOBALS once and for all + PHP5.4 comp) 2012
|
44 |
*/
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
/**
|
47 |
* Defines constants.
|
48 |
*
|
49 |
* @TODO: Make these class constants of CSSTidy.
|
50 |
* @since 1.0.0
|
51 |
*/
|
52 |
+
define( 'AT_START', 1 );
|
53 |
+
define( 'AT_END', 2 );
|
54 |
+
define( 'SEL_START', 3 );
|
55 |
+
define( 'SEL_END', 4 );
|
56 |
+
define( 'PROPERTY', 5 );
|
57 |
+
define( 'VALUE', 6 );
|
58 |
+
define( 'COMMENT', 7 );
|
59 |
+
define( 'IMPORTANT_COMMENT', 8 );
|
60 |
+
define( 'DEFAULT_AT', 41 );
|
61 |
|
62 |
/**
|
63 |
* Load the class for printing CSS code.
|
64 |
*
|
65 |
* @since 1.0.0
|
66 |
*/
|
67 |
+
require __DIR__ . '/class.csstidy_print.php';
|
68 |
|
69 |
/**
|
70 |
* Load the class for optimising CSS code.
|
71 |
*
|
72 |
* @since 1.0.0
|
73 |
*/
|
74 |
+
require __DIR__ . '/class.csstidy_optimise.php';
|
75 |
|
76 |
/**
|
77 |
* CSS Parser class
|
339 |
* @since 1.0.0
|
340 |
*/
|
341 |
public function __construct() {
|
342 |
+
include __DIR__ . '/data.inc.php';
|
343 |
$this->data = $data;
|
344 |
|
345 |
$this->settings['remove_bslash'] = true;
|
460 |
*/
|
461 |
public function _add_token( $type, $data, $do = false ) {
|
462 |
if ( $this->get_cfg( 'preserve_css' ) || $do ) {
|
463 |
+
// nested @...: if opening a new part we just closed, remove the previous closing instead of adding opening.
|
464 |
+
if ( AT_START === $type
|
465 |
+
&& count( $this->tokens )
|
466 |
+
&& ( $last = end( $this->tokens ) )
|
467 |
+
&& AT_END === $last[0]
|
468 |
+
&& trim( $data ) === $last[1] ) {
|
469 |
+
array_pop( $this->tokens );
|
470 |
+
} else {
|
471 |
+
$this->tokens[] = array( $type, ( COMMENT === $type || IMPORTANT_COMMENT === $type ) ? $data : trim( $data ) );
|
472 |
+
}
|
473 |
}
|
474 |
}
|
475 |
|
570 |
if ( ! is_dir( 'temp' ) ) {
|
571 |
$madedir = mkdir( 'temp' );
|
572 |
if ( ! $madedir ) {
|
573 |
+
print 'Could not make directory "temp" in ' . __DIR__;
|
574 |
exit;
|
575 |
}
|
576 |
}
|
660 |
$this->print->input_css = $string;
|
661 |
$string = str_replace( "\r\n", "\n", $string ) . ' ';
|
662 |
$cur_comment = '';
|
663 |
+
$cur_at = '';
|
664 |
|
665 |
for ( $i = 0, $size = strlen( $string ); $i < $size; $i++ ) {
|
666 |
if ( "\n" === $string[ $i ] || "\r" === $string[ $i ] ) {
|
677 |
$this->from[] = 'at';
|
678 |
} elseif ( '{' === $string[ $i ] ) {
|
679 |
$this->status = 'is';
|
680 |
+
$this->at = $this->css_new_media_section( $this->at, $cur_at );
|
681 |
$this->_add_token( AT_START, $this->at );
|
682 |
} elseif ( ',' === $string[ $i ] ) {
|
683 |
+
$cur_at = trim( $cur_at ) . ',';
|
684 |
} elseif ( '\\' === $string[ $i ] ) {
|
685 |
+
$cur_at .= $this->_unicode( $string, $i );
|
686 |
}
|
687 |
// Fix for complicated media, i.e @media screen and (-webkit-min-device-pixel-ratio:1.5)
|
688 |
// '/' is included for ratios in Opera: (-o-min-device-pixel-ratio: 3/2)
|
689 |
elseif ( in_array( $string[ $i ], array( '(', ')', ':', '.', '/' ), true ) ) {
|
690 |
+
$cur_at .= $string[ $i ];
|
691 |
}
|
692 |
} else {
|
693 |
+
$lastpos = strlen( $cur_at ) - 1;
|
694 |
+
if ( ! ( ( ctype_space( $cur_at[ $lastpos ] ) || $this->is_token( $cur_at, $lastpos ) && ',' === $cur_at[ $lastpos ] ) && ctype_space( $string[ $i ] ) ) ) {
|
695 |
+
$cur_at .= $string[ $i ];
|
696 |
}
|
697 |
}
|
698 |
break;
|
709 |
foreach ( $at_rules as $name => $type ) {
|
710 |
if ( ! strcasecmp( substr( $string, $i + 1, strlen( $name ) ), $name ) ) {
|
711 |
if ( 'at' === $type ) {
|
712 |
+
$cur_at = '@' . $name;
|
713 |
} else {
|
714 |
$this->selector = '@' . $name;
|
715 |
}
|
716 |
if ( 'atis' === $type ) {
|
717 |
$this->next_selector_at = ( $this->next_selector_at ? $this->next_selector_at : ( $this->at ? $this->at : DEFAULT_AT ) );
|
718 |
+
$this->at = $this->css_new_media_section( $this->at, ' ', true );
|
719 |
$type = 'is';
|
720 |
}
|
721 |
$this->status = $type;
|
722 |
$i += strlen( $name );
|
723 |
$this->invalid_at = false;
|
724 |
+
break;
|
725 |
}
|
726 |
}
|
727 |
|
747 |
$this->invalid_at = false;
|
748 |
$this->status = 'is';
|
749 |
if ( $this->next_selector_at ) {
|
750 |
+
$this->at = $this->css_close_media_section( $this->at );
|
751 |
+
$this->at = $this->css_new_media_section( $this->at, $this->next_selector_at );
|
752 |
$this->next_selector_at = '';
|
753 |
}
|
754 |
} elseif ( '{' === $string[ $i ] ) {
|
755 |
$this->status = 'ip';
|
756 |
if ( '' === $this->at ) {
|
757 |
+
$this->at = $this->css_new_media_section( $this->at, DEFAULT_AT );
|
758 |
}
|
759 |
$this->selector = $this->css_new_selector( $this->at, $this->selector );
|
760 |
$this->_add_token( SEL_START, $this->selector );
|
761 |
$this->added = false;
|
762 |
} elseif ( '}' === $string[ $i ] ) {
|
763 |
$this->_add_token( AT_END, $this->at );
|
764 |
+
$this->at = $this->css_close_media_section( $this->at );
|
765 |
$this->selector = '';
|
766 |
$this->sel_separate = array();
|
767 |
} elseif ( ',' === $string[ $i ] ) {
|
803 |
$this->selector = '';
|
804 |
$this->property = '';
|
805 |
if ( $this->next_selector_at ) {
|
806 |
+
$this->at = $this->css_close_media_section( $this->at );
|
807 |
+
$this->at = $this->css_new_media_section( $this->at, $this->next_selector_at );
|
808 |
$this->next_selector_at = '';
|
809 |
}
|
810 |
} elseif ( ';' === $string[ $i ] ) {
|
1035 |
if ( '*' === $string[ $i ] && '/' === $string[ $i + 1 ] ) {
|
1036 |
$this->status = array_pop( $this->from );
|
1037 |
$i++;
|
1038 |
+
if ( strlen( $cur_comment ) > 1 && 0 === strncmp( $cur_comment, '!', 1 ) ) {
|
1039 |
+
$this->_add_token( IMPORTANT_COMMENT, $cur_comment );
|
1040 |
+
$this->css_add_important_comment( $cur_comment );
|
1041 |
+
} else {
|
1042 |
+
$this->_add_token( COMMENT, $cur_comment );
|
1043 |
+
}
|
1044 |
$cur_comment = '';
|
1045 |
} else {
|
1046 |
$cur_comment .= $string[ $i ];
|
1129 |
return $pos ? ! ( @( '\\' !== $string[ $pos - 1 ] ) || $this->escaped( $string, $pos - 1 ) ) : false;
|
1130 |
}
|
1131 |
|
1132 |
+
/**
|
1133 |
+
* Add an important comment to the CSS code (one we want to keep when minifying).
|
1134 |
+
*
|
1135 |
+
* @since 1.10.0
|
1136 |
+
*
|
1137 |
+
* @param string $comment CSS Comment.
|
1138 |
+
*/
|
1139 |
+
protected function css_add_important_comment($comment) {
|
1140 |
+
if ( $this->get_cfg( 'preserve_css' ) || '' === trim( $comment ) ) {
|
1141 |
+
return;
|
1142 |
+
}
|
1143 |
+
if ( ! isset( $this->css['!'] ) ) {
|
1144 |
+
$this->css['!'] = '';
|
1145 |
+
} else {
|
1146 |
+
$this->css['!'] .= "\n";
|
1147 |
+
}
|
1148 |
+
$this->css['!'] .= $comment;
|
1149 |
+
}
|
1150 |
+
|
1151 |
/**
|
1152 |
* Adds a property with value to the existing CSS code.
|
1153 |
*
|
1174 |
}
|
1175 |
|
1176 |
/**
|
1177 |
+
* Check if a current media section is the continuation of the last one.
|
1178 |
+
* If not increase the name of the media section to avoid a merging.
|
1179 |
*
|
1180 |
+
* @since 1.10.0
|
|
|
|
|
1181 |
*
|
1182 |
+
* @param int|string $media Media.
|
1183 |
+
* @return int|string [return value]
|
1184 |
*/
|
1185 |
+
protected function css_check_last_media_section_or_inc( $media ) {
|
1186 |
+
// Are we starting?
|
|
|
|
|
|
|
1187 |
if ( ! $this->css || ! is_array( $this->css ) || empty( $this->css ) ) {
|
1188 |
return $media;
|
1189 |
}
|
1190 |
+
// If the last @media is the same as this, keep it.
|
1191 |
end( $this->css );
|
1192 |
$at = key( $this->css );
|
1193 |
if ( $at === $media ) {
|
1194 |
return $media;
|
1195 |
}
|
1196 |
+
// Otherwise increase the section in the array.
|
1197 |
while ( isset( $this->css[ $media ] ) ) {
|
1198 |
if ( is_numeric( $media ) ) {
|
1199 |
$media++;
|
1204 |
return $media;
|
1205 |
}
|
1206 |
|
1207 |
+
/**
|
1208 |
+
* Start a new media section.
|
1209 |
+
*
|
1210 |
+
* Check if the media is not already known, else rename it with extra spaces to avoid merging.
|
1211 |
+
*
|
1212 |
+
* @since 1.0.0
|
1213 |
+
*
|
1214 |
+
* @param string $current_media Media.
|
1215 |
+
* @param string $media Media.
|
1216 |
+
* @param bool $at_root
|
1217 |
+
* @return string [return value]
|
1218 |
+
*/
|
1219 |
+
protected function css_new_media_section( $current_media, $new_media, $at_root = false ) {
|
1220 |
+
if ( $this->get_cfg( 'preserve_css' ) ) {
|
1221 |
+
return $new_media;
|
1222 |
+
}
|
1223 |
+
// If we already are in a media and CSS level is 3, manage nested medias.
|
1224 |
+
if ( $current_media
|
1225 |
+
&& ! $at_root
|
1226 |
+
// numeric $current_media means DEFAULT_AT or inc
|
1227 |
+
&& ! is_numeric( $current_media )
|
1228 |
+
&& 0 === strncmp( $this->get_cfg( 'css_level' ), 'CSS3', 4 ) ) {
|
1229 |
+
$new_media = rtrim( $current_media ) . '{' . rtrim( $new_media );
|
1230 |
+
}
|
1231 |
+
return $this->css_check_last_media_section_or_inc( $new_media );
|
1232 |
+
}
|
1233 |
+
|
1234 |
+
/**
|
1235 |
+
* Close a media section.
|
1236 |
+
*
|
1237 |
+
* Find the parent media we were in before or the root.
|
1238 |
+
*
|
1239 |
+
* @since 1.10.0
|
1240 |
+
*
|
1241 |
+
* @param string $current_media Current Media.
|
1242 |
+
* @return string [return value]
|
1243 |
+
*/
|
1244 |
+
protected function css_close_media_section( $current_media ) {
|
1245 |
+
if ( $this->get_cfg( 'preserve_css' ) ) {
|
1246 |
+
return '';
|
1247 |
+
}
|
1248 |
+
if ( false !== strpos( $current_media, '{' ) ) {
|
1249 |
+
$current_media = explode( '{', $current_media );
|
1250 |
+
array_pop( $current_media );
|
1251 |
+
$current_media = implode( '{', $current_media );
|
1252 |
+
return $current_media;
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
return '';
|
1256 |
+
}
|
1257 |
+
|
1258 |
/**
|
1259 |
* Start a new selector.
|
1260 |
*
|
libraries/csstidy/class.csstidy_optimise.php
CHANGED
@@ -138,34 +138,40 @@ class TablePress_CSSTidy_optimise {
|
|
138 |
|
139 |
if ( 2 === (int) $this->parser->get_cfg( 'merge_selectors' ) ) {
|
140 |
foreach ( $this->css as $medium => $value ) {
|
141 |
-
|
|
|
|
|
142 |
}
|
143 |
}
|
144 |
|
145 |
if ( $this->parser->get_cfg( 'discard_invalid_selectors' ) ) {
|
146 |
foreach ( $this->css as $medium => $value ) {
|
147 |
-
|
|
|
|
|
148 |
}
|
149 |
}
|
150 |
|
151 |
if ( $this->parser->get_cfg( 'optimise_shorthands' ) > 0 ) {
|
152 |
foreach ( $this->css as $medium => $value ) {
|
153 |
-
|
154 |
-
|
|
|
155 |
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
|
160 |
-
|
161 |
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
169 |
}
|
170 |
}
|
171 |
}
|
138 |
|
139 |
if ( 2 === (int) $this->parser->get_cfg( 'merge_selectors' ) ) {
|
140 |
foreach ( $this->css as $medium => $value ) {
|
141 |
+
if ( is_array( $value ) ) {
|
142 |
+
$this->merge_selectors( $this->css[ $medium ] );
|
143 |
+
}
|
144 |
}
|
145 |
}
|
146 |
|
147 |
if ( $this->parser->get_cfg( 'discard_invalid_selectors' ) ) {
|
148 |
foreach ( $this->css as $medium => $value ) {
|
149 |
+
if ( is_array( $value ) ) {
|
150 |
+
$this->discard_invalid_selectors( $this->css[ $medium ] );
|
151 |
+
}
|
152 |
}
|
153 |
}
|
154 |
|
155 |
if ( $this->parser->get_cfg( 'optimise_shorthands' ) > 0 ) {
|
156 |
foreach ( $this->css as $medium => $value ) {
|
157 |
+
if ( is_array( $value ) ) {
|
158 |
+
foreach ( $value as $selector => $value1 ) {
|
159 |
+
$this->css[ $medium ][ $selector ] = $this->merge_4value_shorthands( $this->css[ $medium ][ $selector ] );
|
160 |
|
161 |
+
if ( $this->parser->get_cfg( 'optimise_shorthands' ) < 2 ) {
|
162 |
+
continue;
|
163 |
+
}
|
164 |
|
165 |
+
$this->css[ $medium ][ $selector ] = $this->merge_font( $this->css[ $medium ][ $selector ] );
|
166 |
|
167 |
+
if ( $this->parser->get_cfg( 'optimise_shorthands' ) < 3 ) {
|
168 |
+
continue;
|
169 |
+
}
|
170 |
|
171 |
+
$this->css[ $medium ][ $selector ] = $this->merge_bg( $this->css[ $medium ][ $selector ] );
|
172 |
+
if ( empty( $this->css[ $medium ][ $selector ] ) ) {
|
173 |
+
unset( $this->css[ $medium ][ $selector ] );
|
174 |
+
}
|
175 |
}
|
176 |
}
|
177 |
}
|
libraries/csstidy/class.csstidy_print.php
CHANGED
@@ -287,8 +287,9 @@ class TablePress_CSSTidy_print {
|
|
287 |
$output .= $template[0] . '@namespace ' . $template[5] . $this->namespace . $template[6] . $template[13];
|
288 |
}
|
289 |
|
290 |
-
$in_at_out =
|
291 |
$out = &$output;
|
|
|
292 |
|
293 |
foreach ( $this->tokens as $key => $token ) {
|
294 |
switch ( $token[0] ) {
|
@@ -297,7 +298,11 @@ class TablePress_CSSTidy_print {
|
|
297 |
$token[1] = str_replace( ',', ",\n", $token[1] );
|
298 |
}
|
299 |
$out .= $template[0] . $this->_htmlsp( $token[1], $plain ) . $template[1];
|
300 |
-
$
|
|
|
|
|
|
|
|
|
301 |
break;
|
302 |
case SEL_START:
|
303 |
if ( $this->parser->get_cfg( 'lowercase_s' ) ) {
|
@@ -335,13 +340,27 @@ class TablePress_CSSTidy_print {
|
|
335 |
}
|
336 |
break;
|
337 |
case AT_END:
|
338 |
-
$
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
344 |
break;
|
|
|
345 |
case COMMENT:
|
346 |
$out .= $template[11] . '/*' . $this->_htmlsp( $token[1], $plain ) . '*/' . $template[12];
|
347 |
break;
|
@@ -398,6 +417,12 @@ class TablePress_CSSTidy_print {
|
|
398 |
$sort_selectors = $this->parser->get_cfg( 'sort_selectors' );
|
399 |
$sort_properties = $this->parser->get_cfg( 'sort_properties' );
|
400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
foreach ( $this->css as $medium => $val ) {
|
402 |
if ( $sort_selectors ) {
|
403 |
ksort( $val );
|
@@ -405,8 +430,10 @@ class TablePress_CSSTidy_print {
|
|
405 |
if ( intval( $medium ) < DEFAULT_AT ) {
|
406 |
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
407 |
if ( strlen( trim( $medium ) ) ) {
|
408 |
-
$
|
409 |
-
|
|
|
|
|
410 |
} elseif ( $default_media ) {
|
411 |
$this->parser->_add_token( AT_START, $default_media, true );
|
412 |
}
|
@@ -446,7 +473,10 @@ class TablePress_CSSTidy_print {
|
|
446 |
if ( intval( $medium ) < DEFAULT_AT ) {
|
447 |
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
448 |
if ( strlen( trim( $medium ) ) ) {
|
449 |
-
$
|
|
|
|
|
|
|
450 |
}
|
451 |
} elseif ( $default_media ) {
|
452 |
$this->parser->_add_token( AT_END, $default_media, true );
|
287 |
$output .= $template[0] . '@namespace ' . $template[5] . $this->namespace . $template[6] . $template[13];
|
288 |
}
|
289 |
|
290 |
+
$in_at_out = array();
|
291 |
$out = &$output;
|
292 |
+
$indent_level = 0;
|
293 |
|
294 |
foreach ( $this->tokens as $key => $token ) {
|
295 |
switch ( $token[0] ) {
|
298 |
$token[1] = str_replace( ',', ",\n", $token[1] );
|
299 |
}
|
300 |
$out .= $template[0] . $this->_htmlsp( $token[1], $plain ) . $template[1];
|
301 |
+
$indent_level++;
|
302 |
+
if ( ! isset( $in_at_out[ $indent_level ] ) ) {
|
303 |
+
$in_at_out[ $indent_level ] = '';
|
304 |
+
}
|
305 |
+
$out = &$in_at_out[ $indent_level ];
|
306 |
break;
|
307 |
case SEL_START:
|
308 |
if ( $this->parser->get_cfg( 'lowercase_s' ) ) {
|
340 |
}
|
341 |
break;
|
342 |
case AT_END:
|
343 |
+
if ( strlen( $template[10] ) ) {
|
344 |
+
// Indent the block we are closing.
|
345 |
+
$out = str_replace( "\n\n", "\r\n", $out ); // Don't fill empty lines.
|
346 |
+
$out = str_replace( "\n", "\n" . $template[10], $out );
|
347 |
+
$out = str_replace( "\r\n", "\n\n", $out );
|
348 |
+
}
|
349 |
+
if ( $indent_level > 1 ) {
|
350 |
+
$out = &$in_at_out[ $indent_level - 1 ];
|
351 |
+
}else {
|
352 |
+
$out = &$output;
|
353 |
+
}
|
354 |
+
$out .= $template[10] . $in_at_out[$indent_level];
|
355 |
+
if ( AT_END !== $this->_seeknocomment( $key, 1 ) ) {
|
356 |
+
$out .= $template[9];
|
357 |
+
} else {
|
358 |
+
$out .= rtrim( $template[9] );
|
359 |
+
}
|
360 |
+
unset( $in_at_out[ $indent_level ] );
|
361 |
+
$indent_level--;
|
362 |
break;
|
363 |
+
case IMPORTANT_COMMENT:
|
364 |
case COMMENT:
|
365 |
$out .= $template[11] . '/*' . $this->_htmlsp( $token[1], $plain ) . '*/' . $template[12];
|
366 |
break;
|
417 |
$sort_selectors = $this->parser->get_cfg( 'sort_selectors' );
|
418 |
$sort_properties = $this->parser->get_cfg( 'sort_properties' );
|
419 |
|
420 |
+
// Important comment section?
|
421 |
+
if ( isset( $this->css['!'] ) ) {
|
422 |
+
$this->parser->_add_token( IMPORTANT_COMMENT, rtrim( $this->css['!'] ), true );
|
423 |
+
unset( $this->css['!'] );
|
424 |
+
}
|
425 |
+
|
426 |
foreach ( $this->css as $medium => $val ) {
|
427 |
if ( $sort_selectors ) {
|
428 |
ksort( $val );
|
430 |
if ( intval( $medium ) < DEFAULT_AT ) {
|
431 |
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
432 |
if ( strlen( trim( $medium ) ) ) {
|
433 |
+
$parts_to_open = explode( '{', $medium );
|
434 |
+
foreach ( $parts_to_open as $part ) {
|
435 |
+
$this->parser->_add_token( AT_START, $part, true );
|
436 |
+
} }
|
437 |
} elseif ( $default_media ) {
|
438 |
$this->parser->_add_token( AT_START, $default_media, true );
|
439 |
}
|
473 |
if ( intval( $medium ) < DEFAULT_AT ) {
|
474 |
// un medium vide (contenant @font-face ou autre @) ne produit aucun conteneur
|
475 |
if ( strlen( trim( $medium ) ) ) {
|
476 |
+
$parts_to_close = explode( '{', $medium );
|
477 |
+
foreach ( array_reverse( $parts_to_close ) as $part ) {
|
478 |
+
$this->parser->_add_token( AT_END, $part, true );
|
479 |
+
}
|
480 |
}
|
481 |
} elseif ( $default_media ) {
|
482 |
$this->parser->_add_token( AT_END, $default_media, true );
|
libraries/csstidy/data.inc.php
CHANGED
@@ -63,6 +63,7 @@ $data['csstidy']['at_rules'] = array(
|
|
63 |
'import' => 'iv',
|
64 |
'namespace' => 'iv',
|
65 |
'media' => 'at',
|
|
|
66 |
'keyframes' => 'at',
|
67 |
'-moz-keyframes' => 'at',
|
68 |
'-o-keyframes' => 'at',
|
@@ -676,7 +677,7 @@ $data['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
|
676 |
$data['csstidy']['predefined_templates']['high_compression'][] = "\n" . '<span class="format">}' . "\n" . '</span>';
|
677 |
$data['csstidy']['predefined_templates']['high_compression'][] = '';
|
678 |
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
|
679 |
-
$data['csstidy']['predefined_templates']['high_compression'][] = '</span>'; // after comment
|
680 |
$data['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
681 |
|
682 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="at">';
|
@@ -691,7 +692,7 @@ $data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
|
691 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
692 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
693 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="comment">'; // before comment
|
694 |
-
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span>'; // after comment
|
695 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
696 |
|
697 |
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
|
@@ -710,4 +711,4 @@ $data['csstidy']['predefined_templates']['low_compression'][] = '</span>' . "\n"
|
|
710 |
$data['csstidy']['predefined_templates']['low_compression'][] = "\n";
|
711 |
|
712 |
// Add TablePress specific modifications.
|
713 |
-
require
|
63 |
'import' => 'iv',
|
64 |
'namespace' => 'iv',
|
65 |
'media' => 'at',
|
66 |
+
'supports' => 'at',
|
67 |
'keyframes' => 'at',
|
68 |
'-moz-keyframes' => 'at',
|
69 |
'-o-keyframes' => 'at',
|
677 |
$data['csstidy']['predefined_templates']['high_compression'][] = "\n" . '<span class="format">}' . "\n" . '</span>';
|
678 |
$data['csstidy']['predefined_templates']['high_compression'][] = '';
|
679 |
$data['csstidy']['predefined_templates']['high_compression'][] = '<span class="comment">'; // before comment
|
680 |
+
$data['csstidy']['predefined_templates']['high_compression'][] = '</span>' . "\n"; // after comment
|
681 |
$data['csstidy']['predefined_templates']['high_compression'][] = "\n";
|
682 |
|
683 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="at">';
|
692 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="format">}</span>';
|
693 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
694 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '<span class="comment">'; // before comment
|
695 |
+
$data['csstidy']['predefined_templates']['highest_compression'][] = '</span>' . "\n"; // after comment
|
696 |
$data['csstidy']['predefined_templates']['highest_compression'][] = '';
|
697 |
|
698 |
$data['csstidy']['predefined_templates']['low_compression'][] = '<span class="at">';
|
711 |
$data['csstidy']['predefined_templates']['low_compression'][] = "\n";
|
712 |
|
713 |
// Add TablePress specific modifications.
|
714 |
+
require __DIR__ . '/data-tp.inc.php';
|
libraries/evalmath.class.php
CHANGED
@@ -107,6 +107,7 @@ class EvalMath {
|
|
107 |
'number_format' => array( 1, 2 ),
|
108 |
'number_format_eu' => array( 1, 2 ),
|
109 |
'sum' => array( -1 ),
|
|
|
110 |
'product' => array( -1 ),
|
111 |
'rand_int' => array( 2 ),
|
112 |
'rand_float' => array( 0 ),
|
@@ -527,7 +528,7 @@ class EvalMath {
|
|
527 |
} elseif ( 'arctan2' === $function_name ) {
|
528 |
$function_name = 'atan2';
|
529 |
}
|
530 |
-
$result =
|
531 |
if ( false === $result ) {
|
532 |
return $this->raise_error( 'internal_error' );
|
533 |
}
|
@@ -820,8 +821,7 @@ class EvalMath_Functions {
|
|
820 |
* @param double|int $args Values for which the conjunction shall be calculated.
|
821 |
* @return int Conjunction of the passed arguments.
|
822 |
*/
|
823 |
-
public static function func_and(
|
824 |
-
$args = func_get_args();
|
825 |
foreach ( $args as $value ) {
|
826 |
if ( ! $value ) {
|
827 |
return 0;
|
@@ -840,8 +840,7 @@ class EvalMath_Functions {
|
|
840 |
* @param double|int $args Values for which the disjunction shall be calculated.
|
841 |
* @return int Disjunction of the passed arguments.
|
842 |
*/
|
843 |
-
public static function func_or(
|
844 |
-
$args = func_get_args();
|
845 |
foreach ( $args as $value ) {
|
846 |
if ( $value ) {
|
847 |
return 1;
|
@@ -869,11 +868,22 @@ class EvalMath_Functions {
|
|
869 |
* @param double|int $args Values for which the sum shall be calculated.
|
870 |
* @return double|int Sum of the passed arguments.
|
871 |
*/
|
872 |
-
public static function sum(
|
873 |
-
$args = func_get_args();
|
874 |
return array_sum( $args );
|
875 |
}
|
876 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
877 |
/**
|
878 |
* Calculate the product of the arguments.
|
879 |
*
|
@@ -882,8 +892,7 @@ class EvalMath_Functions {
|
|
882 |
* @param double|int $args Values for which the product shall be calculated.
|
883 |
* @return double|int Product of the passed arguments.
|
884 |
*/
|
885 |
-
public static function product(
|
886 |
-
$args = func_get_args();
|
887 |
return array_product( $args );
|
888 |
}
|
889 |
|
@@ -895,9 +904,12 @@ class EvalMath_Functions {
|
|
895 |
* @param double|int $args Values for which the average shall be calculated.
|
896 |
* @return double|int Average value of the passed arguments.
|
897 |
*/
|
898 |
-
public static function average(
|
899 |
-
|
900 |
-
|
|
|
|
|
|
|
901 |
}
|
902 |
|
903 |
/**
|
@@ -910,8 +922,7 @@ class EvalMath_Functions {
|
|
910 |
* @param double|int $args Values for which the median shall be calculated.
|
911 |
* @return double|int Median of the passed arguments.
|
912 |
*/
|
913 |
-
public static function median(
|
914 |
-
$args = func_get_args();
|
915 |
sort( $args );
|
916 |
$middle = floor( count( $args ) / 2 ); // Upper median for even counts.
|
917 |
return $args[ $middle ];
|
@@ -925,8 +936,7 @@ class EvalMath_Functions {
|
|
925 |
* @param double|int $args Values for which the mode shall be calculated.
|
926 |
* @return double|int Mode of the passed arguments.
|
927 |
*/
|
928 |
-
public static function mode(
|
929 |
-
$args = func_get_args();
|
930 |
$values = array_count_values( $args );
|
931 |
asort( $values );
|
932 |
end( $values );
|
@@ -941,8 +951,7 @@ class EvalMath_Functions {
|
|
941 |
* @param double|int $args Values for which the range shall be calculated.
|
942 |
* @return double|int Range of the passed arguments.
|
943 |
*/
|
944 |
-
public static function range(
|
945 |
-
$args = func_get_args();
|
946 |
sort( $args );
|
947 |
return end( $args ) - reset( $args );
|
948 |
}
|
@@ -955,8 +964,7 @@ class EvalMath_Functions {
|
|
955 |
* @param double|int $args Values for which the maximum value shall be found.
|
956 |
* @return double|int Maximum value of the passed arguments.
|
957 |
*/
|
958 |
-
public static function max(
|
959 |
-
$args = func_get_args();
|
960 |
return max( $args );
|
961 |
}
|
962 |
|
@@ -968,8 +976,7 @@ class EvalMath_Functions {
|
|
968 |
* @param double|int $args Values for which the minimum value shall be found.
|
969 |
* @return double|int Minimum value of the passed arguments.
|
970 |
*/
|
971 |
-
public static function min(
|
972 |
-
$args = func_get_args();
|
973 |
return min( $args );
|
974 |
}
|
975 |
|
107 |
'number_format' => array( 1, 2 ),
|
108 |
'number_format_eu' => array( 1, 2 ),
|
109 |
'sum' => array( -1 ),
|
110 |
+
'counta' => array ( -1 ),
|
111 |
'product' => array( -1 ),
|
112 |
'rand_int' => array( 2 ),
|
113 |
'rand_float' => array( 0 ),
|
528 |
} elseif ( 'arctan2' === $function_name ) {
|
529 |
$function_name = 'atan2';
|
530 |
}
|
531 |
+
$result = EvalMath_Functions::$function_name( ...array_reverse( $args ) );
|
532 |
if ( false === $result ) {
|
533 |
return $this->raise_error( 'internal_error' );
|
534 |
}
|
821 |
* @param double|int $args Values for which the conjunction shall be calculated.
|
822 |
* @return int Conjunction of the passed arguments.
|
823 |
*/
|
824 |
+
public static function func_and( ...$args ) {
|
|
|
825 |
foreach ( $args as $value ) {
|
826 |
if ( ! $value ) {
|
827 |
return 0;
|
840 |
* @param double|int $args Values for which the disjunction shall be calculated.
|
841 |
* @return int Disjunction of the passed arguments.
|
842 |
*/
|
843 |
+
public static function func_or( ...$args ) {
|
|
|
844 |
foreach ( $args as $value ) {
|
845 |
if ( $value ) {
|
846 |
return 1;
|
868 |
* @param double|int $args Values for which the sum shall be calculated.
|
869 |
* @return double|int Sum of the passed arguments.
|
870 |
*/
|
871 |
+
public static function sum( ...$args ) {
|
|
|
872 |
return array_sum( $args );
|
873 |
}
|
874 |
|
875 |
+
/**
|
876 |
+
* Count the number of non-empty arguments.
|
877 |
+
*
|
878 |
+
* @since 1.10.0
|
879 |
+
*
|
880 |
+
* @param double|int $args Values for which the number of non-empty elements shall be counted.
|
881 |
+
* @return double|int Counted number of non-empty elements in the passed values.
|
882 |
+
*/
|
883 |
+
public static function counta( ...$args ) {
|
884 |
+
return count( array_filter( $args ) );
|
885 |
+
}
|
886 |
+
|
887 |
/**
|
888 |
* Calculate the product of the arguments.
|
889 |
*
|
892 |
* @param double|int $args Values for which the product shall be calculated.
|
893 |
* @return double|int Product of the passed arguments.
|
894 |
*/
|
895 |
+
public static function product( ...$args ) {
|
|
|
896 |
return array_product( $args );
|
897 |
}
|
898 |
|
904 |
* @param double|int $args Values for which the average shall be calculated.
|
905 |
* @return double|int Average value of the passed arguments.
|
906 |
*/
|
907 |
+
public static function average( ...$args ) {
|
908 |
+
// Catch division by zero.
|
909 |
+
if ( 0 === count( $args ) ) {
|
910 |
+
return 0;
|
911 |
+
}
|
912 |
+
return array_sum( $args ) / count( $args );
|
913 |
}
|
914 |
|
915 |
/**
|
922 |
* @param double|int $args Values for which the median shall be calculated.
|
923 |
* @return double|int Median of the passed arguments.
|
924 |
*/
|
925 |
+
public static function median( ...$args ) {
|
|
|
926 |
sort( $args );
|
927 |
$middle = floor( count( $args ) / 2 ); // Upper median for even counts.
|
928 |
return $args[ $middle ];
|
936 |
* @param double|int $args Values for which the mode shall be calculated.
|
937 |
* @return double|int Mode of the passed arguments.
|
938 |
*/
|
939 |
+
public static function mode( ...$args ) {
|
|
|
940 |
$values = array_count_values( $args );
|
941 |
asort( $values );
|
942 |
end( $values );
|
951 |
* @param double|int $args Values for which the range shall be calculated.
|
952 |
* @return double|int Range of the passed arguments.
|
953 |
*/
|
954 |
+
public static function range( ...$args ) {
|
|
|
955 |
sort( $args );
|
956 |
return end( $args ) - reset( $args );
|
957 |
}
|
964 |
* @param double|int $args Values for which the maximum value shall be found.
|
965 |
* @return double|int Maximum value of the passed arguments.
|
966 |
*/
|
967 |
+
public static function max( ...$args ) {
|
|
|
968 |
return max( $args );
|
969 |
}
|
970 |
|
976 |
* @param double|int $args Values for which the minimum value shall be found.
|
977 |
* @return double|int Minimum value of the passed arguments.
|
978 |
*/
|
979 |
+
public static function min( ...$args ) {
|
|
|
980 |
return min( $args );
|
981 |
}
|
982 |
|
libraries/excel-reader.class.php
CHANGED
@@ -207,19 +207,19 @@ class OLERead {
|
|
207 |
|
208 |
// readData(rootStartBlock)
|
209 |
$block = $rootStartBlock;
|
210 |
-
$this->entry = $this->
|
211 |
-
$this->
|
212 |
}
|
213 |
|
214 |
/**
|
215 |
-
* [
|
216 |
*
|
217 |
* @since 1.0.0
|
218 |
*
|
219 |
* @param [type] $bl [description]
|
220 |
* @return [type] [description]
|
221 |
*/
|
222 |
-
protected function
|
223 |
$block = $bl;
|
224 |
$data = '';
|
225 |
while ( -2 !== $block ) {
|
@@ -231,13 +231,13 @@ class OLERead {
|
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
-
* [
|
235 |
*
|
236 |
* @since 1.0.0
|
237 |
*
|
238 |
* @return [type] [description]
|
239 |
*/
|
240 |
-
protected function
|
241 |
$offset = 0;
|
242 |
while ( $offset < strlen( $this->entry ) ) {
|
243 |
$d = substr( $this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE );
|
@@ -275,7 +275,7 @@ class OLERead {
|
|
275 |
*/
|
276 |
public function getWorkBook() {
|
277 |
if ( $this->props[ $this->wrkbook ]['size'] < SMALL_BLOCK_THRESHOLD ) {
|
278 |
-
$rootdata = $this->
|
279 |
$streamData = '';
|
280 |
$block = $this->props[ $this->wrkbook ]['startBlock'];
|
281 |
while ( -2 !== $block ) {
|
207 |
|
208 |
// readData(rootStartBlock)
|
209 |
$block = $rootStartBlock;
|
210 |
+
$this->entry = $this->_readData( $block );
|
211 |
+
$this->_readPropertySets();
|
212 |
}
|
213 |
|
214 |
/**
|
215 |
+
* [_readData description]
|
216 |
*
|
217 |
* @since 1.0.0
|
218 |
*
|
219 |
* @param [type] $bl [description]
|
220 |
* @return [type] [description]
|
221 |
*/
|
222 |
+
protected function _readData( $bl ) {
|
223 |
$block = $bl;
|
224 |
$data = '';
|
225 |
while ( -2 !== $block ) {
|
231 |
}
|
232 |
|
233 |
/**
|
234 |
+
* [_readPropertySets description]
|
235 |
*
|
236 |
* @since 1.0.0
|
237 |
*
|
238 |
* @return [type] [description]
|
239 |
*/
|
240 |
+
protected function _readPropertySets() {
|
241 |
$offset = 0;
|
242 |
while ( $offset < strlen( $this->entry ) ) {
|
243 |
$d = substr( $this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE );
|
275 |
*/
|
276 |
public function getWorkBook() {
|
277 |
if ( $this->props[ $this->wrkbook ]['size'] < SMALL_BLOCK_THRESHOLD ) {
|
278 |
+
$rootdata = $this->_readData( $this->props[ $this->rootentry ]['startBlock'] );
|
279 |
$streamData = '';
|
280 |
$block = $this->props[ $this->wrkbook ]['startBlock'];
|
281 |
while ( -2 !== $block ) {
|
libraries/simplexlsx.class.php
CHANGED
@@ -2,120 +2,35 @@
|
|
2 |
/**
|
3 |
* Excel 2007-2013 Reader Class
|
4 |
*
|
5 |
-
* Based on SimpleXLSX v0.
|
6 |
* @link https://github.com/shuchkin/simplexlsx/
|
7 |
*
|
8 |
* @package TablePress
|
9 |
* @subpackage Import
|
10 |
-
* @author Sergey
|
11 |
* @since 1.1.0
|
12 |
*/
|
13 |
|
14 |
// Prohibit direct script loading.
|
15 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
16 |
|
|
|
|
|
|
|
|
|
17 |
/**
|
18 |
* PHP Excel 2007-2013 Reader Class
|
19 |
* @package TablePress
|
20 |
* @subpackage Import
|
21 |
-
* @author Sergey
|
22 |
* @since 1.1.0
|
23 |
*/
|
24 |
class SimpleXLSX {
|
25 |
-
|
26 |
-
/**
|
27 |
-
* XML Schema URLs.
|
28 |
-
*/
|
29 |
const SCHEMA_REL_OFFICEDOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument';
|
30 |
const SCHEMA_REL_SHAREDSTRINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings';
|
31 |
const SCHEMA_REL_WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
|
32 |
const SCHEMA_REL_STYLES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles';
|
33 |
-
|
34 |
-
/**
|
35 |
-
* [$workbook description]
|
36 |
-
*
|
37 |
-
* @since 1.1.0
|
38 |
-
* @var [type]
|
39 |
-
*/
|
40 |
-
protected $workbook;
|
41 |
-
|
42 |
-
/**
|
43 |
-
* [$sheets description]
|
44 |
-
*
|
45 |
-
* @since 1.1.0
|
46 |
-
* @var array
|
47 |
-
*/
|
48 |
-
protected $sheets = array();
|
49 |
-
|
50 |
-
/**
|
51 |
-
* [$sheetNames description]
|
52 |
-
*
|
53 |
-
* @since 1.9.1
|
54 |
-
* @var array
|
55 |
-
*/
|
56 |
-
protected $sheetNames = array();
|
57 |
-
|
58 |
-
/**
|
59 |
-
* [$styles description]
|
60 |
-
*
|
61 |
-
* @since 1.1.0
|
62 |
-
* @var array
|
63 |
-
*/
|
64 |
-
protected $styles = array();
|
65 |
-
|
66 |
-
/**
|
67 |
-
* [$hyperlinks description]
|
68 |
-
*
|
69 |
-
* @since 1.1.0
|
70 |
-
* @var [type]
|
71 |
-
*/
|
72 |
-
protected $hyperlinks;
|
73 |
-
|
74 |
-
/**
|
75 |
-
* [$package description]
|
76 |
-
*
|
77 |
-
* @since 1.1.0
|
78 |
-
* @var array
|
79 |
-
*/
|
80 |
-
protected $package = array(
|
81 |
-
'filename' => '',
|
82 |
-
'mtime' => 0,
|
83 |
-
'size' => 0,
|
84 |
-
'comment' => '',
|
85 |
-
'entries' => array(),
|
86 |
-
);
|
87 |
-
|
88 |
-
/**
|
89 |
-
* [$sharedstrings description]
|
90 |
-
*
|
91 |
-
* @since 1.1.0
|
92 |
-
* @var array
|
93 |
-
*/
|
94 |
-
protected $sharedstrings = array();
|
95 |
-
|
96 |
-
/**
|
97 |
-
* [$error description]
|
98 |
-
*
|
99 |
-
* @since 1.1.0
|
100 |
-
* @var string
|
101 |
-
*/
|
102 |
-
protected $error = '';
|
103 |
-
|
104 |
-
/**
|
105 |
-
* [$workbook_cell_formats description]
|
106 |
-
*
|
107 |
-
* @since 1.1.0
|
108 |
-
* @var array
|
109 |
-
*/
|
110 |
-
public $workbook_cell_formats = array();
|
111 |
-
|
112 |
-
/**
|
113 |
-
* [$built_in_cell_formats description]
|
114 |
-
*
|
115 |
-
* @since 1.1.0
|
116 |
-
* @var array
|
117 |
-
*/
|
118 |
-
public static $built_in_cell_formats = array(
|
119 |
0 => 'General',
|
120 |
1 => '0',
|
121 |
2 => '0.00',
|
@@ -135,21 +50,25 @@ class SimpleXLSX {
|
|
135 |
20 => 'h:mm',
|
136 |
21 => 'h:mm:ss',
|
137 |
22 => 'm/d/yy h:mm',
|
|
|
138 |
37 => '#,##0 ;(#,##0)',
|
139 |
38 => '#,##0 ;[Red](#,##0)',
|
140 |
39 => '#,##0.00;(#,##0.00)',
|
141 |
40 => '#,##0.00;[Red](#,##0.00)',
|
|
|
142 |
44 => '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)',
|
143 |
45 => 'mm:ss',
|
144 |
46 => '[h]:mm:ss',
|
145 |
47 => 'mmss.0',
|
146 |
48 => '##0.0E+0',
|
147 |
49 => '@',
|
|
|
148 |
27 => '[$-404]e/m/d',
|
149 |
30 => 'm/d/yy',
|
150 |
36 => '[$-404]e/m/d',
|
151 |
50 => '[$-404]e/m/d',
|
152 |
57 => '[$-404]e/m/d',
|
|
|
153 |
59 => 't0',
|
154 |
60 => 't0.00',
|
155 |
61 => 't#,##0',
|
@@ -159,692 +78,336 @@ class SimpleXLSX {
|
|
159 |
69 => 't# ?/?',
|
160 |
70 => 't# ??/??',
|
161 |
);
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
$this->_parse();
|
183 |
}
|
184 |
}
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
*
|
189 |
-
* @since 1.1.0
|
190 |
-
*
|
191 |
-
* @return [type] [description]
|
192 |
-
*/
|
193 |
-
public function sheets() {
|
194 |
-
return $this->sheets;
|
195 |
-
}
|
196 |
-
|
197 |
-
/**
|
198 |
-
* [sheetsCount description]
|
199 |
-
*
|
200 |
-
* @since 1.1.0
|
201 |
-
*
|
202 |
-
* @return int Number of sheets.
|
203 |
-
*/
|
204 |
-
public function sheetsCount() {
|
205 |
-
return count( $this->sheets );
|
206 |
-
}
|
207 |
-
|
208 |
-
/**
|
209 |
-
* [sheetName description]
|
210 |
-
*
|
211 |
-
* @since 1.1.0
|
212 |
-
*
|
213 |
-
* @param [type] $worksheet_index [description]
|
214 |
-
* @return string|bool [description]
|
215 |
-
*/
|
216 |
-
public function sheetName( $worksheet_index ) {
|
217 |
-
if ( isset( $this->sheetNames[ $worksheet_index ] ) ) {
|
218 |
-
return $this->sheetNames[ $worksheet_index ];
|
219 |
}
|
220 |
return false;
|
221 |
}
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
*
|
226 |
-
* @since 1.1.0
|
227 |
-
*
|
228 |
-
* @return array [description]
|
229 |
-
*/
|
230 |
-
public function sheetNames() {
|
231 |
-
return $this->sheetNames;
|
232 |
-
}
|
233 |
-
|
234 |
-
/**
|
235 |
-
* [worksheet description]
|
236 |
-
*
|
237 |
-
* @since 1.1.0
|
238 |
-
*
|
239 |
-
* @param [type] $worksheet_index [description]. Optional.
|
240 |
-
* @return [type] [description]
|
241 |
-
*/
|
242 |
-
public function worksheet( $worksheet_index = 0 ) {
|
243 |
-
if ( isset( $this->sheets[ $worksheet_index ] ) ) {
|
244 |
-
$ws = $this->sheets[ $worksheet_index ];
|
245 |
-
if ( isset( $ws->hyperlinks ) ) {
|
246 |
-
$this->hyperlinks = array();
|
247 |
-
foreach ( $ws->hyperlinks->hyperlink as $hyperlink ) {
|
248 |
-
$this->hyperlinks[ (string) $hyperlink['ref'] ] = (string) $hyperlink['display'];
|
249 |
-
}
|
250 |
-
}
|
251 |
-
return $ws;
|
252 |
}
|
253 |
-
$this->error( 'Worksheet ' . $worksheet_index . ' not found.' );
|
254 |
return false;
|
255 |
}
|
256 |
|
257 |
-
|
258 |
-
* [dimension description]
|
259 |
-
*
|
260 |
-
* "Don't trust ->dimension(), so xlsx generators very lazy and don't publish a dimension attribute."
|
261 |
-
*
|
262 |
-
* @since 1.1.0
|
263 |
-
*
|
264 |
-
* @param int $worksheet_index Optional. [description]
|
265 |
-
* @return array|false [description]
|
266 |
-
*/
|
267 |
-
public function dimension( $worksheet_index = 0 ) {
|
268 |
-
if ( false === ( $ws = $this->worksheet( $worksheet_index ) ) ) {
|
269 |
-
return false;
|
270 |
-
}
|
271 |
|
272 |
-
|
|
|
273 |
|
274 |
-
if (
|
275 |
-
$d = explode( ':', $ref );
|
276 |
-
$index = $this->_columnIndex( $d[1] );
|
277 |
-
return array( $index[0] + 1, $index[1] + 1 );
|
278 |
-
}
|
279 |
|
280 |
-
|
281 |
-
$
|
282 |
-
|
283 |
-
}
|
284 |
|
285 |
-
|
286 |
-
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
*
|
291 |
-
* Sheets numeration: 1, 2, 3, ...
|
292 |
-
*
|
293 |
-
* @since 1.1.0
|
294 |
-
*
|
295 |
-
* @param int $worksheet_index Optional. [description]
|
296 |
-
* @return array|bool [description]
|
297 |
-
*/
|
298 |
-
public function rows( $worksheet_index = 0 ) {
|
299 |
-
if ( false === ( $ws = $this->worksheet( $worksheet_index ) ) ) {
|
300 |
-
return false;
|
301 |
-
}
|
302 |
|
303 |
-
|
304 |
-
|
305 |
|
306 |
-
|
|
|
|
|
|
|
307 |
|
308 |
-
|
309 |
-
$
|
310 |
-
foreach ( $row->c as $c ) {
|
311 |
-
list( $current_cell, ) = $this->_columnIndex( (string) $c['r'] );
|
312 |
-
$rows[ $current_row ][ $current_cell ] = $this->value( $c );
|
313 |
-
}
|
314 |
-
for ( $i = 0; $i < $cols; $i++ ) {
|
315 |
-
if ( ! isset( $rows[ $current_row ][ $i ] ) ) {
|
316 |
-
$rows[ $current_row ][ $i ] = '';
|
317 |
-
}
|
318 |
-
}
|
319 |
-
ksort( $rows[ $current_row ] );
|
320 |
-
$current_row++;
|
321 |
}
|
322 |
-
|
323 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
-
/**
|
326 |
-
* [rowsEx description]
|
327 |
-
*
|
328 |
-
* @since 1.1.0
|
329 |
-
*
|
330 |
-
* @param int $worksheet_index Optional. [description]
|
331 |
-
* @return array|bool [description]
|
332 |
-
*/
|
333 |
-
public function rowsEx( $worksheet_index = 0 ) {
|
334 |
-
if ( false === ( $ws = $this->worksheet( $worksheet_index ) ) ) {
|
335 |
return false;
|
336 |
}
|
|
|
|
|
|
|
|
|
337 |
|
338 |
-
|
339 |
-
$
|
340 |
-
|
341 |
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
}
|
|
|
357 |
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
'format' => $format,
|
365 |
-
'r' => $r_idx,
|
366 |
-
);
|
367 |
}
|
368 |
-
for ( $i = 0; $i < $cols; $i++ ) {
|
369 |
-
if ( ! isset( $rows[ $current_row ][ $i ] ) ) {
|
370 |
-
for ( $c = '', $j = $i; $j >= 0; $j = (int) ( $j / 26 ) - 1 ) {
|
371 |
-
$c = chr( $j % 26 + 65 ) . $c;
|
372 |
-
}
|
373 |
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
}
|
385 |
}
|
386 |
-
ksort( $rows[ $current_row ] );
|
387 |
-
$current_row++;
|
388 |
-
}
|
389 |
-
return $rows;
|
390 |
-
}
|
391 |
|
392 |
-
|
393 |
-
* [_columnIndex description]
|
394 |
-
*
|
395 |
-
* @since 1.1.0
|
396 |
-
*
|
397 |
-
* @param string $cell Optional. [description]
|
398 |
-
* @return array [description]
|
399 |
-
*/
|
400 |
-
protected function _columnIndex( $cell = 'A1' ) {
|
401 |
-
if ( preg_match( '/([A-Z]+)(\d+)/', $cell, $m ) ) {
|
402 |
-
list( , $col, $row ) = $m;
|
403 |
|
404 |
-
|
405 |
-
$
|
|
|
|
|
|
|
|
|
|
|
406 |
|
407 |
-
|
408 |
-
|
409 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
|
411 |
-
|
412 |
-
}
|
413 |
-
$this->error( 'Invalid cell index ' . $cell );
|
414 |
|
415 |
-
return
|
416 |
}
|
417 |
|
418 |
-
|
419 |
-
* [value description]
|
420 |
-
*
|
421 |
-
* @since 1.1.0
|
422 |
-
*
|
423 |
-
* @param [type] $cell [description]
|
424 |
-
* @param [type] $format [description]
|
425 |
-
* @return mixed [description]
|
426 |
-
*/
|
427 |
-
public function value( $cell, $format = null ) {
|
428 |
-
// Determine data type.
|
429 |
-
$dataType = (string) $cell['t'];
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
|
|
|
|
435 |
}
|
436 |
}
|
437 |
-
if ( false !== strpos( $format, 'm' ) ) {
|
438 |
-
$dataType = 'd';
|
439 |
-
}
|
440 |
-
$value = '';
|
441 |
-
switch ( $dataType ) {
|
442 |
-
case 's':
|
443 |
-
// Value is a shared string.
|
444 |
-
if ( '' !== (string) $cell->v ) {
|
445 |
-
$value = $this->sharedstrings[ (int) $cell->v ];
|
446 |
-
}
|
447 |
-
break;
|
448 |
-
case 'b':
|
449 |
-
// Value is boolean.
|
450 |
-
$value = (string) $cell->v;
|
451 |
-
if ( '0' === $value ) {
|
452 |
-
$value = false;
|
453 |
-
} elseif ( '1' === $value ) {
|
454 |
-
$value = true;
|
455 |
-
} else {
|
456 |
-
$value = (bool) $cell->v;
|
457 |
-
}
|
458 |
-
break;
|
459 |
-
case 'inlineStr':
|
460 |
-
// Value is rich text inline.
|
461 |
-
$value = $this->_parseRichText( $cell->is );
|
462 |
-
break;
|
463 |
-
case 'e':
|
464 |
-
// Value is an error message.
|
465 |
-
if ( '' !== (string) $cell->v ) {
|
466 |
-
$value = (string) $cell->v;
|
467 |
-
}
|
468 |
-
break;
|
469 |
-
case 'd':
|
470 |
-
// Value is a date.
|
471 |
-
$value = $this->datetime_format ? gmdate( $this->datetime_format, $this->unixstamp( (float) $cell->v ) ) : (float) $cell->v;
|
472 |
-
break;
|
473 |
-
default:
|
474 |
-
// Value is a string.
|
475 |
-
$value = (string) $cell->v;
|
476 |
-
// Check for numeric values by converting them forth and back.
|
477 |
-
if ( is_numeric( $value ) && 's' !== $dataType ) {
|
478 |
-
if ( $value == (int) $value ) {
|
479 |
-
$value = (int) $value;
|
480 |
-
} elseif ( $value == (float) $value ) {
|
481 |
-
$value = (float) $value;
|
482 |
-
}
|
483 |
-
}
|
484 |
-
}
|
485 |
-
return $value;
|
486 |
-
}
|
487 |
-
|
488 |
-
/**
|
489 |
-
* [href description]
|
490 |
-
*
|
491 |
-
* @since 1.1.0
|
492 |
-
*
|
493 |
-
* @param [type] $cell [description]
|
494 |
-
* @return string [description]
|
495 |
-
*/
|
496 |
-
public function href( $cell ) {
|
497 |
-
return isset( $this->hyperlinks[ (string) $cell['r'] ] ) ? $this->hyperlinks[ (string) $cell['r'] ] : '';
|
498 |
-
}
|
499 |
-
|
500 |
-
/**
|
501 |
-
* [getStyles description]
|
502 |
-
*
|
503 |
-
* @since 1.8.1
|
504 |
-
*
|
505 |
-
* @return [type] [description]
|
506 |
-
*/
|
507 |
-
public function getStyles() {
|
508 |
-
return $this->styles;
|
509 |
-
}
|
510 |
-
|
511 |
-
/**
|
512 |
-
* [_unzip description]
|
513 |
-
*
|
514 |
-
* @since 1.1.0
|
515 |
-
*
|
516 |
-
* @param [type] $filename [description]
|
517 |
-
* @param bool $is_data Optional. [description]
|
518 |
-
* @return [type] [description]
|
519 |
-
*/
|
520 |
-
protected function _unzip( $filename, $is_data = false ) {
|
521 |
-
if ( $is_data ) {
|
522 |
-
$this->package['filename'] = 'default.xlsx';
|
523 |
-
$this->package['mtime'] = time();
|
524 |
-
$this->package['size'] = strlen( $filename );
|
525 |
-
$vZ = $filename;
|
526 |
-
} else {
|
527 |
-
if ( ! is_readable( $filename ) ) {
|
528 |
-
$this->error( 'File not found ' . $filename );
|
529 |
-
return false;
|
530 |
-
}
|
531 |
-
|
532 |
-
// Package information.
|
533 |
-
$this->package['filename'] = $filename;
|
534 |
-
$this->package['mtime'] = filemtime( $filename );
|
535 |
-
$this->package['size'] = filesize( $filename );
|
536 |
-
|
537 |
-
// Read file.
|
538 |
-
$vZ = file_get_contents( $filename );
|
539 |
-
}
|
540 |
-
|
541 |
-
/*
|
542 |
-
// Cut end of central directory
|
543 |
-
$aE = explode( "\x50\x4b\x05\x06", $vZ );
|
544 |
-
if ( 1 === count( $aE ) ) {
|
545 |
-
$this->error( 'Unknown format' );
|
546 |
-
return false;
|
547 |
-
}
|
548 |
-
*/
|
549 |
-
|
550 |
-
if ( false === ( $pcd = strrpos( $vZ, "\x50\x4b\x05\x06" ) ) ) {
|
551 |
-
$this->error( 'Unknown archive format' );
|
552 |
-
return false;
|
553 |
-
}
|
554 |
-
$aE = array(
|
555 |
-
0 => substr( $vZ, 0, $pcd ),
|
556 |
-
1 => substr( $vZ, $pcd + 3 ),
|
557 |
-
);
|
558 |
-
|
559 |
-
// Normal way.
|
560 |
-
$aP = unpack( 'x16/v1CL', $aE[1] );
|
561 |
-
$this->package['comment'] = substr( $aE[1], 18, $aP['CL'] );
|
562 |
-
|
563 |
-
// Translates end of line from other operating systems.
|
564 |
-
$this->package['comment'] = str_replace( array( "\r\n", "\r" ), "\n", $this->package['comment'] );
|
565 |
-
|
566 |
-
// Cut the entries from the central directory.
|
567 |
-
$aE = explode( "\x50\x4b\x01\x02", $vZ );
|
568 |
-
// Explode to each part.
|
569 |
-
$aE = explode( "\x50\x4b\x03\x04", $aE[0] );
|
570 |
-
// Shift out spanning signature or empty entry.
|
571 |
-
array_shift( $aE );
|
572 |
-
|
573 |
-
// Loop through the entries.
|
574 |
-
foreach ( $aE as $vZ ) {
|
575 |
-
$aI = array();
|
576 |
-
$aI['E'] = 0;
|
577 |
-
$aI['EM'] = '';
|
578 |
-
// Retrieving local file header information.
|
579 |
-
// $aP = unpack( 'v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL', $vZ );
|
580 |
-
$aP = unpack( 'v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL/v1EFL', $vZ );
|
581 |
-
|
582 |
-
// Check if data is encrypted.
|
583 |
-
// $bE = ( $aP['GPF'] && 0x0001 ) ? true : false;
|
584 |
-
$bE = false;
|
585 |
-
$nF = $aP['FNL'];
|
586 |
-
$mF = $aP['EFL'];
|
587 |
-
|
588 |
-
// Special case: value block after the compressed data.
|
589 |
-
if ( $aP['GPF'] & 0x0008 ) {
|
590 |
-
$aP1 = unpack( 'V1CRC/V1CS/V1UCS', substr( $vZ, -12 ) );
|
591 |
-
$aP['CRC'] = $aP1['CRC'];
|
592 |
-
$aP['CS'] = $aP1['CS'];
|
593 |
-
$aP['UCS'] = $aP1['UCS'];
|
594 |
-
// 2013-08-10
|
595 |
-
$vZ = substr( $vZ, 0, -12 );
|
596 |
-
if ( "\x50\x4b\x07\x08" === substr( $vZ, -4 ) ) {
|
597 |
-
$vZ = substr( $vZ, 0, -4 );
|
598 |
-
}
|
599 |
-
}
|
600 |
-
|
601 |
-
// Get stored filename.
|
602 |
-
$aI['N'] = substr( $vZ, 26, $nF );
|
603 |
-
|
604 |
-
// If it's a directory entry, it will be skipped.
|
605 |
-
if ( '/' === substr( $aI['N'], -1 ) ) {
|
606 |
-
continue;
|
607 |
-
}
|
608 |
-
|
609 |
-
// Truncate full filename in path and filename.
|
610 |
-
$aI['P'] = dirname( $aI['N'] );
|
611 |
-
$aI['P'] = ( '.' === $aI['P'] ) ? '' : $aI['P'];
|
612 |
-
$aI['N'] = basename( $aI['N'] );
|
613 |
-
|
614 |
-
$vZ = substr( $vZ, 26 + $nF + $mF );
|
615 |
-
|
616 |
-
if ( strlen( $vZ ) !== (int) $aP['CS'] ) { // Check only if available.
|
617 |
-
$aI['E'] = 1;
|
618 |
-
$aI['EM'] = 'Compressed size is not equal with the value in header information.';
|
619 |
-
} elseif ( $bE ) {
|
620 |
-
$aI['E'] = 5;
|
621 |
-
$aI['EM'] = 'File is encrypted, which is not supported by this class.';
|
622 |
-
} else {
|
623 |
-
switch ( $aP['CM'] ) {
|
624 |
-
case 0: // Stored
|
625 |
-
// Here is nothing to do, the file is flat.
|
626 |
-
break;
|
627 |
-
case 8: // Deflated
|
628 |
-
$vZ = gzinflate( $vZ );
|
629 |
-
break;
|
630 |
-
case 12: // BZIP2
|
631 |
-
if ( extension_loaded( 'bz2' ) ) {
|
632 |
-
$vZ = bzdecompress( $vZ );
|
633 |
-
} else {
|
634 |
-
$aI['E'] = 7;
|
635 |
-
$aI['EM'] = 'PHP BZIP2 extension not available.';
|
636 |
-
}
|
637 |
-
break;
|
638 |
-
default:
|
639 |
-
$aI['E'] = 6;
|
640 |
-
$aI['EM'] = "De-/Compression method {$aP['CM']} is not supported.";
|
641 |
-
}
|
642 |
-
if ( ! $aI['E'] ) {
|
643 |
-
if ( false === $vZ ) {
|
644 |
-
$aI['E'] = 2;
|
645 |
-
$aI['EM'] = 'Decompression of data failed.';
|
646 |
-
} elseif ( strlen( $vZ ) !== (int) $aP['UCS'] ) {
|
647 |
-
$aI['E'] = 3;
|
648 |
-
$aI['EM'] = 'Uncompressed size is not equal with the value in header information.';
|
649 |
-
} elseif ( crc32( $vZ ) !== $aP['CRC'] ) {
|
650 |
-
$aI['E'] = 4;
|
651 |
-
$aI['EM'] = 'CRC32 checksum is not equal with the value in header information.';
|
652 |
-
}
|
653 |
-
}
|
654 |
-
}
|
655 |
-
|
656 |
-
$aI['D'] = $vZ;
|
657 |
-
|
658 |
-
// DOS to UNIX timestamp.
|
659 |
-
$aI['T'] = mktime(
|
660 |
-
( $aP['FT'] & 0xf800 ) >> 11,
|
661 |
-
( $aP['FT'] & 0x07e0 ) >> 5,
|
662 |
-
( $aP['FT'] & 0x001f ) << 1,
|
663 |
-
( $aP['FD'] & 0x01e0 ) >> 5,
|
664 |
-
( $aP['FD'] & 0x001f ),
|
665 |
-
( ( $aP['FD'] & 0xfe00 ) >> 9 ) + 1980
|
666 |
-
);
|
667 |
-
|
668 |
-
// $this->Entries[] = new SimpleUnzipEntry( $aI );
|
669 |
-
$this->package['entries'][] = array(
|
670 |
-
'data' => $aI['D'],
|
671 |
-
'error' => $aI['E'],
|
672 |
-
'error_msg' => $aI['EM'],
|
673 |
-
'name' => $aI['N'],
|
674 |
-
'path' => $aI['P'],
|
675 |
-
'time' => $aI['T'],
|
676 |
-
);
|
677 |
-
|
678 |
-
} // end foreach entries
|
679 |
-
|
680 |
-
return true;
|
681 |
-
}
|
682 |
-
|
683 |
-
/**
|
684 |
-
* [getPackage description]
|
685 |
-
*
|
686 |
-
* @since 1.1.0
|
687 |
-
*
|
688 |
-
* @return [type] [description]
|
689 |
-
*/
|
690 |
-
public function getPackage() {
|
691 |
-
return $this->package;
|
692 |
-
}
|
693 |
-
|
694 |
-
/**
|
695 |
-
* [entryExists description]
|
696 |
-
*
|
697 |
-
* @since 1.1.0
|
698 |
-
*
|
699 |
-
* @param [type] $name [description]
|
700 |
-
* @return bool [description]
|
701 |
-
*/
|
702 |
-
public function entryExists( $name ) {
|
703 |
-
$dir = strtoupper( dirname( $name ) );
|
704 |
-
$name = strtoupper( basename( $name ) );
|
705 |
-
foreach ( $this->package['entries'] as $entry ) {
|
706 |
-
if ( strtoupper( $entry['path'] ) === $dir && strtoupper( $entry['name'] ) === $name ) {
|
707 |
-
return true;
|
708 |
-
}
|
709 |
-
}
|
710 |
-
return false;
|
711 |
-
}
|
712 |
-
|
713 |
-
/**
|
714 |
-
* [getEntryData description]
|
715 |
-
*
|
716 |
-
* @since 1.1.0
|
717 |
-
*
|
718 |
-
* @param [type] $name [description]
|
719 |
-
* @return [type] [description]
|
720 |
-
*/
|
721 |
-
public function getEntryData( $name ) {
|
722 |
-
$dir = strtoupper( dirname( $name ) );
|
723 |
-
$name = strtoupper( basename( $name ) );
|
724 |
-
foreach ( $this->package['entries'] as $entry ) {
|
725 |
-
if ( strtoupper( $entry['path'] ) === $dir && strtoupper( $entry['name'] ) === $name ) {
|
726 |
-
return $entry['data'];
|
727 |
-
}
|
728 |
-
}
|
729 |
-
$this->error( 'Entry not found: ' . $name );
|
730 |
-
return false;
|
731 |
-
}
|
732 |
-
|
733 |
-
/**
|
734 |
-
* [getEntryXML description]
|
735 |
-
*
|
736 |
-
* @since 1.1.0
|
737 |
-
*
|
738 |
-
* @param [type] $name [description]
|
739 |
-
* @return [type] [description]
|
740 |
-
*/
|
741 |
-
public function getEntryXML( $name ) {
|
742 |
-
if ( $entry_xml = $this->getEntryData( $name ) ) {
|
743 |
-
// Remove dirty namespace prefixes.
|
744 |
-
$entry_xml = preg_replace( '/xmlns[^=]*="[^"]*"/i', '', $entry_xml ); // remove namespaces
|
745 |
-
$entry_xml = preg_replace( '/[a-zA-Z0-9]+:([a-zA-Z0-9]+="[^"]+")/', '$1$2', $entry_xml ); // remove namespaced attrs
|
746 |
-
$entry_xml = preg_replace( '/<[a-zA-Z0-9]+:([^>]+)>/', '<$1>', $entry_xml ); // fix namespaced opened tags
|
747 |
-
$entry_xml = preg_replace( '/<\/[a-zA-Z0-9]+:([^>]+)>/', '</$1>', $entry_xml ); // fix namespaced closed tags
|
748 |
-
|
749 |
-
// XML External Entity (XXE) Prevention.
|
750 |
-
$_old_value = libxml_disable_entity_loader( true );
|
751 |
-
$entry_xmlobj = simplexml_load_string( $entry_xml );
|
752 |
-
libxml_disable_entity_loader( $_old_value );
|
753 |
-
if ( $entry_xmlobj ) {
|
754 |
-
return $entry_xmlobj;
|
755 |
-
}
|
756 |
-
$e = libxml_get_last_error();
|
757 |
-
$this->error( 'XML-entry ' . $name . ' parser error ' . $e->message . ' line ' . $e->line );
|
758 |
-
} else {
|
759 |
-
$this->error( 'XML-entry not found: ' . $name );
|
760 |
-
}
|
761 |
-
return false;
|
762 |
-
}
|
763 |
-
|
764 |
-
/**
|
765 |
-
* [unixstamp description]
|
766 |
-
*
|
767 |
-
* @since 1.1.0
|
768 |
-
*
|
769 |
-
* @param [type] $excelDateTime [description]
|
770 |
-
* @return [type] [description]
|
771 |
-
*/
|
772 |
-
public function unixstamp( $excelDateTime ) {
|
773 |
-
$d = floor( $excelDateTime ); // seconds since 1900
|
774 |
-
$t = $excelDateTime - $d;
|
775 |
-
|
776 |
-
return ( abs( $d ) > 0 ) ? ( $d - 25569 ) * DAY_IN_SECONDS + round( $t * DAY_IN_SECONDS ) : round( $t * DAY_IN_SECONDS ); // 25569 days = 70 years?
|
777 |
-
}
|
778 |
|
779 |
-
/**
|
780 |
-
* [error description]
|
781 |
-
*
|
782 |
-
* @since 1.1.0
|
783 |
-
*
|
784 |
-
* @param string $set Optional. [description]
|
785 |
-
* @return [type] [description]
|
786 |
-
*/
|
787 |
-
public function error( $set = '' ) {
|
788 |
-
if ( '' !== $set ) {
|
789 |
-
$this->error = $set;
|
790 |
-
// trigger_error( __CLASS__ . ': ' . $set, E_USER_WARNING );
|
791 |
-
}
|
792 |
return $this->error;
|
793 |
}
|
794 |
-
|
795 |
-
|
796 |
-
* [success description]
|
797 |
-
*
|
798 |
-
* @since 1.1.0
|
799 |
-
*
|
800 |
-
* @return [type] [description]
|
801 |
-
*/
|
802 |
-
public function success() {
|
803 |
-
return ! $this->error;
|
804 |
}
|
805 |
|
806 |
-
|
807 |
-
|
808 |
-
*
|
809 |
-
* @since 1.1.0
|
810 |
-
*
|
811 |
-
* @return [type] [description]
|
812 |
-
*/
|
813 |
-
protected function _parse() {
|
814 |
-
// Document data holders.
|
815 |
$this->sharedstrings = array();
|
816 |
-
$this->sheets
|
817 |
-
|
818 |
|
819 |
-
// Read relations and search for officeDocument
|
820 |
if ( $relations = $this->getEntryXML( '_rels/.rels' ) ) {
|
|
|
821 |
foreach ( $relations->Relationship as $rel ) {
|
|
|
822 |
$rel_type = trim( (string) $rel['Type'] );
|
823 |
$rel_target = trim( (string) $rel['Target'] );
|
824 |
-
|
825 |
-
|
|
|
|
|
826 |
|
827 |
$index = 0;
|
828 |
foreach ( $this->workbook->sheets->sheet as $s ) {
|
|
|
829 |
$this->sheetNames[ $index ] = (string) $s['name'];
|
830 |
$index_rId[ $index ] = (string) $s['id'];
|
831 |
$index++;
|
832 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
833 |
|
834 |
if ( $workbookRelations = $this->getEntryXML( dirname( $rel_target ) . '/_rels/workbook.xml.rels' ) ) {
|
835 |
-
|
|
|
836 |
foreach ( $workbookRelations->Relationship as $workbookRelation ) {
|
|
|
837 |
$wrel_type = trim( (string) $workbookRelation['Type'] );
|
838 |
-
$wrel_path = dirname( trim( (string) $rel['Target'] ) ) . '/' . trim( $workbookRelation['Target'] );
|
839 |
if ( ! $this->entryExists( $wrel_path ) ) {
|
840 |
continue;
|
841 |
}
|
842 |
-
|
|
|
|
|
|
|
843 |
if ( $sheet = $this->getEntryXML( $wrel_path ) ) {
|
844 |
$index = array_search( (string) $workbookRelation['Id'], $index_rId, false );
|
845 |
$this->sheets[ $index ] = $sheet;
|
846 |
}
|
847 |
-
|
|
|
|
|
848 |
if ( $sharedStrings = $this->getEntryXML( $wrel_path ) ) {
|
849 |
foreach ( $sharedStrings->si as $val ) {
|
850 |
if ( isset( $val->t ) ) {
|
@@ -854,132 +417,566 @@ class SimpleXLSX {
|
|
854 |
}
|
855 |
}
|
856 |
}
|
857 |
-
}
|
|
|
858 |
$this->styles = $this->getEntryXML( $wrel_path );
|
859 |
|
860 |
$nf = array();
|
861 |
-
if (
|
862 |
foreach ( $this->styles->numFmts->numFmt as $v ) {
|
863 |
$nf[ (int) $v['numFmtId'] ] = (string) $v['formatCode'];
|
864 |
}
|
865 |
}
|
866 |
|
867 |
-
if (
|
868 |
foreach ( $this->styles->cellXfs->xf as $v ) {
|
869 |
-
$v
|
870 |
$v['format'] = '';
|
871 |
|
872 |
if ( isset( $v['@attributes']['numFmtId'] ) ) {
|
873 |
$v = $v['@attributes'];
|
874 |
$fid = (int) $v['numFmtId'];
|
875 |
-
if ( isset( self::$
|
876 |
-
$v['format'] = self::$
|
877 |
-
}
|
878 |
$v['format'] = $nf[ $fid ];
|
879 |
}
|
880 |
}
|
881 |
-
$this->
|
882 |
}
|
883 |
}
|
884 |
}
|
885 |
-
}
|
|
|
886 |
break;
|
887 |
}
|
888 |
}
|
889 |
-
}
|
890 |
}
|
891 |
-
|
892 |
-
// Sort sheets.
|
893 |
if ( count( $this->sheets ) ) {
|
|
|
894 |
ksort( $this->sheets );
|
|
|
895 |
return true;
|
896 |
}
|
897 |
|
898 |
return false;
|
899 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
900 |
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
910 |
$value = array();
|
911 |
|
912 |
if ( isset( $is->t ) ) {
|
913 |
$value[] = (string) $is->t;
|
914 |
-
} else {
|
915 |
foreach ( $is->r as $run ) {
|
916 |
$value[] = (string) $run->t;
|
917 |
}
|
918 |
}
|
919 |
|
920 |
-
return implode( '
|
921 |
}
|
922 |
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
* @param [type] $filename [description]
|
929 |
-
* @param bool $is_data [description]
|
930 |
-
* @return [type] [description]
|
931 |
-
*/
|
932 |
-
public static function parse( $filename, $is_data = false ) {
|
933 |
-
$xlsx = new self( $filename, $is_data );
|
934 |
if ( $xlsx->success() ) {
|
935 |
return $xlsx;
|
936 |
}
|
937 |
-
self::
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
938 |
|
939 |
return false;
|
940 |
}
|
941 |
|
942 |
/**
|
943 |
-
* [
|
944 |
*
|
945 |
-
* @
|
946 |
*
|
947 |
-
* @
|
948 |
-
* @return [type] [description]
|
949 |
*/
|
950 |
-
public
|
951 |
-
|
952 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
953 |
}
|
954 |
|
955 |
/**
|
956 |
-
*
|
957 |
-
*
|
958 |
-
* Example: xlsx->getCell(2,'B87', 0);
|
959 |
-
* Get cell B87 from 2nd worksheet, formatted by General (see $built_in_cell_formats for all formats).
|
960 |
-
* It's useful when we need to get a cell that has the wrong format,
|
961 |
-
* Or just for direct cell reading. (thx EGO7000)
|
962 |
-
*
|
963 |
-
* @since 1.8.1
|
964 |
*
|
965 |
-
* @param int
|
966 |
-
* @param string
|
967 |
-
* @param null|int $format.
|
968 |
*
|
969 |
-
* @return mixed
|
970 |
*/
|
971 |
-
public function getCell( $
|
972 |
-
|
973 |
-
|
974 |
-
|
|
|
|
|
|
|
975 |
|
976 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
977 |
|
978 |
-
|
979 |
-
$c = $ws->sheetData->row[ $current_row ]->c[ $current_cell ];
|
980 |
-
return $this->value( $c, $format );
|
981 |
}
|
982 |
return null;
|
983 |
}
|
984 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
985 |
} // class SimpleXLSX
|
2 |
/**
|
3 |
* Excel 2007-2013 Reader Class
|
4 |
*
|
5 |
+
* Based on SimpleXLSX v0.8.10 by Sergey Shuchkin.
|
6 |
* @link https://github.com/shuchkin/simplexlsx/
|
7 |
*
|
8 |
* @package TablePress
|
9 |
* @subpackage Import
|
10 |
+
* @author Sergey Shuchkin, Tobias Bäthge
|
11 |
* @since 1.1.0
|
12 |
*/
|
13 |
|
14 |
// Prohibit direct script loading.
|
15 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
16 |
|
17 |
+
/** @noinspection PhpUndefinedFieldInspection */
|
18 |
+
/** @noinspection PhpComposerExtensionStubsInspection */
|
19 |
+
/** @noinspection MultiAssignmentUsageInspection */
|
20 |
+
|
21 |
/**
|
22 |
* PHP Excel 2007-2013 Reader Class
|
23 |
* @package TablePress
|
24 |
* @subpackage Import
|
25 |
+
* @author Sergey Shuchkin, Tobias Bäthge
|
26 |
* @since 1.1.0
|
27 |
*/
|
28 |
class SimpleXLSX {
|
|
|
|
|
|
|
|
|
29 |
const SCHEMA_REL_OFFICEDOCUMENT = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument';
|
30 |
const SCHEMA_REL_SHAREDSTRINGS = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings';
|
31 |
const SCHEMA_REL_WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
|
32 |
const SCHEMA_REL_STYLES = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles';
|
33 |
+
public static $CF = array( // Cell formats
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
0 => 'General',
|
35 |
1 => '0',
|
36 |
2 => '0.00',
|
50 |
20 => 'h:mm',
|
51 |
21 => 'h:mm:ss',
|
52 |
22 => 'm/d/yy h:mm',
|
53 |
+
|
54 |
37 => '#,##0 ;(#,##0)',
|
55 |
38 => '#,##0 ;[Red](#,##0)',
|
56 |
39 => '#,##0.00;(#,##0.00)',
|
57 |
40 => '#,##0.00;[Red](#,##0.00)',
|
58 |
+
|
59 |
44 => '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)',
|
60 |
45 => 'mm:ss',
|
61 |
46 => '[h]:mm:ss',
|
62 |
47 => 'mmss.0',
|
63 |
48 => '##0.0E+0',
|
64 |
49 => '@',
|
65 |
+
|
66 |
27 => '[$-404]e/m/d',
|
67 |
30 => 'm/d/yy',
|
68 |
36 => '[$-404]e/m/d',
|
69 |
50 => '[$-404]e/m/d',
|
70 |
57 => '[$-404]e/m/d',
|
71 |
+
|
72 |
59 => 't0',
|
73 |
60 => 't0.00',
|
74 |
61 => 't#,##0',
|
78 |
69 => 't# ?/?',
|
79 |
70 => 't# ??/??',
|
80 |
);
|
81 |
+
public $cellFormats = array();
|
82 |
+
public $datetimeFormat = 'Y-m-d H:i:s';
|
83 |
+
public $skipEmptyRows = false;
|
84 |
+
public $debug;
|
85 |
+
|
86 |
+
/* @var SimpleXMLElement $workbook */
|
87 |
+
private $workbook;
|
88 |
+
/* @var SimpleXMLElement[] $sheets */
|
89 |
+
private $sheets;
|
90 |
+
private $sheetNames = array();
|
91 |
+
// scheme
|
92 |
+
private $styles;
|
93 |
+
private $hyperlinks;
|
94 |
+
/* @var array[] $package */
|
95 |
+
private $package;
|
96 |
+
private $datasec;
|
97 |
+
private $sharedstrings;
|
98 |
+
private $date1904 = 0;
|
99 |
+
|
100 |
+
|
101 |
+
/*
|
102 |
+
private $date_formats = array(
|
103 |
+
0xe => "d/m/Y",
|
104 |
+
0xf => "d-M-Y",
|
105 |
+
0x10 => "d-M",
|
106 |
+
0x11 => "M-Y",
|
107 |
+
0x12 => "h:i a",
|
108 |
+
0x13 => "h:i:s a",
|
109 |
+
0x14 => "H:i",
|
110 |
+
0x15 => "H:i:s",
|
111 |
+
0x16 => "d/m/Y H:i",
|
112 |
+
0x2d => "i:s",
|
113 |
+
0x2e => "H:i:s",
|
114 |
+
0x2f => "i:s.S"
|
115 |
+
);
|
116 |
+
private $number_formats = array(
|
117 |
+
0x1 => "%1.0f", // "0"
|
118 |
+
0x2 => "%1.2f", // "0.00",
|
119 |
+
0x3 => "%1.0f", //"#,##0",
|
120 |
+
0x4 => "%1.2f", //"#,##0.00",
|
121 |
+
0x5 => "%1.0f", //"$#,##0;($#,##0)",
|
122 |
+
0x6 => '$%1.0f', //"$#,##0;($#,##0)",
|
123 |
+
0x7 => '$%1.2f', //"$#,##0.00;($#,##0.00)",
|
124 |
+
0x8 => '$%1.2f', //"$#,##0.00;($#,##0.00)",
|
125 |
+
0x9 => '%1.0f%%', //"0%"
|
126 |
+
0xa => '%1.2f%%', //"0.00%"
|
127 |
+
0xb => '%1.2f', //"0.00E00",
|
128 |
+
0x25 => '%1.0f', //"#,##0;(#,##0)",
|
129 |
+
0x26 => '%1.0f', //"#,##0;(#,##0)",
|
130 |
+
0x27 => '%1.2f', //"#,##0.00;(#,##0.00)",
|
131 |
+
0x28 => '%1.2f', //"#,##0.00;(#,##0.00)",
|
132 |
+
0x29 => '%1.0f', //"#,##0;(#,##0)",
|
133 |
+
0x2a => '$%1.0f', //"$#,##0;($#,##0)",
|
134 |
+
0x2b => '%1.2f', //"#,##0.00;(#,##0.00)",
|
135 |
+
0x2c => '$%1.2f', //"$#,##0.00;($#,##0.00)",
|
136 |
+
0x30 => '%1.0f'); //"##0.0E0";
|
137 |
+
// }}}
|
138 |
+
*/
|
139 |
+
private $errno = 0;
|
140 |
+
private $error = false;
|
141 |
+
|
142 |
+
|
143 |
+
public function __construct( $filename = null, $is_data = null, $debug = null ) {
|
144 |
+
if ( $debug !== null ) {
|
145 |
+
$this->debug = $debug;
|
146 |
+
}
|
147 |
+
$this->package = array(
|
148 |
+
'filename' => '',
|
149 |
+
'mtime' => 0,
|
150 |
+
'size' => 0,
|
151 |
+
'comment' => '',
|
152 |
+
'entries' => array()
|
153 |
+
);
|
154 |
+
if ( $filename && $this->_unzip( $filename, $is_data )) {
|
155 |
$this->_parse();
|
156 |
}
|
157 |
}
|
158 |
+
public function parseFile( $filename ) {
|
159 |
+
if ( $this->_unzip( $filename )) {
|
160 |
+
return $this->_parse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
}
|
162 |
return false;
|
163 |
}
|
164 |
+
public function parseData( $data ) {
|
165 |
+
if ( $this->_unzip($data, true )) {
|
166 |
+
return $this->_parse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
|
|
168 |
return false;
|
169 |
}
|
170 |
|
171 |
+
private function _unzip( $filename, $is_data = false ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
|
173 |
+
// Clear current file
|
174 |
+
$this->datasec = array();
|
175 |
|
176 |
+
if ( $is_data ) {
|
|
|
|
|
|
|
|
|
177 |
|
178 |
+
$this->package['filename'] = 'default.xlsx';
|
179 |
+
$this->package['mtime'] = time();
|
180 |
+
$this->package['size'] = $this->_strlen( $filename );
|
|
|
181 |
|
182 |
+
$vZ = $filename;
|
183 |
+
} else {
|
184 |
|
185 |
+
if ( ! is_readable( $filename ) ) {
|
186 |
+
$this->error( 1, 'File not found ' . $filename );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
+
return false;
|
189 |
+
}
|
190 |
|
191 |
+
// Package information
|
192 |
+
$this->package['filename'] = $filename;
|
193 |
+
$this->package['mtime'] = filemtime( $filename );
|
194 |
+
$this->package['size'] = filesize( $filename );
|
195 |
|
196 |
+
// Read file
|
197 |
+
$vZ = file_get_contents( $filename );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
}
|
199 |
+
// Cut end of central directory
|
200 |
+
/* $aE = explode("\x50\x4b\x05\x06", $vZ);
|
201 |
+
|
202 |
+
if (count($aE) == 1) {
|
203 |
+
$this->error('Unknown format');
|
204 |
+
return false;
|
205 |
+
}
|
206 |
+
*/
|
207 |
+
if ( ( $pcd = $this->_strrpos( $vZ, "\x50\x4b\x05\x06" ) ) === false ) {
|
208 |
+
$this->error( 2, 'Unknown archive format' );
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
return false;
|
211 |
}
|
212 |
+
$aE = array(
|
213 |
+
0 => $this->_substr( $vZ, 0, $pcd ),
|
214 |
+
1 => $this->_substr( $vZ, $pcd + 3 )
|
215 |
+
);
|
216 |
|
217 |
+
// Normal way
|
218 |
+
$aP = unpack( 'x16/v1CL', $aE[1] );
|
219 |
+
$this->package['comment'] = $this->_substr( $aE[1], 18, $aP['CL'] );
|
220 |
|
221 |
+
// Translates end of line from other operating systems
|
222 |
+
$this->package['comment'] = strtr( $this->package['comment'], array( "\r\n" => "\n", "\r" => "\n" ) );
|
223 |
+
|
224 |
+
// Cut the entries from the central directory
|
225 |
+
$aE = explode( "\x50\x4b\x01\x02", $vZ );
|
226 |
+
// Explode to each part
|
227 |
+
$aE = explode( "\x50\x4b\x03\x04", $aE[0] );
|
228 |
+
// Shift out spanning signature or empty entry
|
229 |
+
array_shift( $aE );
|
230 |
+
|
231 |
+
// Loop through the entries
|
232 |
+
foreach ( $aE as $vZ ) {
|
233 |
+
$aI = array();
|
234 |
+
$aI['E'] = 0;
|
235 |
+
$aI['EM'] = '';
|
236 |
+
// Retrieving local file header information
|
237 |
+
// $aP = unpack('v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL', $vZ);
|
238 |
+
$aP = unpack( 'v1VN/v1GPF/v1CM/v1FT/v1FD/V1CRC/V1CS/V1UCS/v1FNL/v1EFL', $vZ );
|
239 |
+
|
240 |
+
// Check if data is encrypted
|
241 |
+
// $bE = ($aP['GPF'] && 0x0001) ? TRUE : FALSE;
|
242 |
+
$bE = false;
|
243 |
+
$nF = $aP['FNL'];
|
244 |
+
$mF = $aP['EFL'];
|
245 |
+
|
246 |
+
// Special case : value block after the compressed data
|
247 |
+
if ( $aP['GPF'] & 0x0008 ) {
|
248 |
+
$aP1 = unpack( 'V1CRC/V1CS/V1UCS', $this->_substr( $vZ, - 12 ) );
|
249 |
+
|
250 |
+
$aP['CRC'] = $aP1['CRC'];
|
251 |
+
$aP['CS'] = $aP1['CS'];
|
252 |
+
$aP['UCS'] = $aP1['UCS'];
|
253 |
+
// 2013-08-10
|
254 |
+
$vZ = $this->_substr( $vZ, 0, - 12 );
|
255 |
+
if ( $this->_substr( $vZ, - 4 ) === "\x50\x4b\x07\x08" ) {
|
256 |
+
$vZ = $this->_substr( $vZ, 0, - 4 );
|
257 |
}
|
258 |
+
}
|
259 |
|
260 |
+
// Getting stored filename
|
261 |
+
$aI['N'] = $this->_substr( $vZ, 26, $nF );
|
262 |
+
|
263 |
+
if ( $this->_substr( $aI['N'], - 1 ) === '/' ) {
|
264 |
+
// is a directory entry - will be skipped
|
265 |
+
continue;
|
|
|
|
|
|
|
266 |
}
|
|
|
|
|
|
|
|
|
|
|
267 |
|
268 |
+
// Truncate full filename in path and filename
|
269 |
+
$aI['P'] = dirname( $aI['N'] );
|
270 |
+
$aI['P'] = $aI['P'] === '.' ? '' : $aI['P'];
|
271 |
+
$aI['N'] = basename( $aI['N'] );
|
272 |
+
|
273 |
+
$vZ = $this->_substr( $vZ, 26 + $nF + $mF );
|
274 |
+
|
275 |
+
if ( $this->_strlen( $vZ ) !== (int) $aP['CS'] ) { // check only if availabled
|
276 |
+
$aI['E'] = 1;
|
277 |
+
$aI['EM'] = 'Compressed size is not equal with the value in header information.';
|
278 |
+
} else if ( $bE ) {
|
279 |
+
$aI['E'] = 5;
|
280 |
+
$aI['EM'] = 'File is encrypted, which is not supported from this class.';
|
281 |
+
} else {
|
282 |
+
switch ( $aP['CM'] ) {
|
283 |
+
case 0: // Stored
|
284 |
+
// Here is nothing to do, the file ist flat.
|
285 |
+
break;
|
286 |
+
case 8: // Deflated
|
287 |
+
$vZ = gzinflate( $vZ );
|
288 |
+
break;
|
289 |
+
case 12: // BZIP2
|
290 |
+
if ( extension_loaded( 'bz2' ) ) {
|
291 |
+
/** @noinspection PhpComposerExtensionStubsInspection */
|
292 |
+
$vZ = bzdecompress( $vZ );
|
293 |
+
} else {
|
294 |
+
$aI['E'] = 7;
|
295 |
+
$aI['EM'] = 'PHP BZIP2 extension not available.';
|
296 |
+
}
|
297 |
+
break;
|
298 |
+
default:
|
299 |
+
$aI['E'] = 6;
|
300 |
+
$aI['EM'] = "De-/Compression method {$aP['CM']} is not supported.";
|
301 |
+
}
|
302 |
+
if ( ! $aI['E'] ) {
|
303 |
+
if ( $vZ === false ) {
|
304 |
+
$aI['E'] = 2;
|
305 |
+
$aI['EM'] = 'Decompression of data failed.';
|
306 |
+
} else if ( $this->_strlen( $vZ ) !== (int) $aP['UCS'] ) {
|
307 |
+
$aI['E'] = 3;
|
308 |
+
$aI['EM'] = 'Uncompressed size is not equal with the value in header information.';
|
309 |
+
} else if ( crc32( $vZ ) !== $aP['CRC'] ) {
|
310 |
+
$aI['E'] = 4;
|
311 |
+
$aI['EM'] = 'CRC32 checksum is not equal with the value in header information.';
|
312 |
+
}
|
313 |
}
|
314 |
}
|
|
|
|
|
|
|
|
|
|
|
315 |
|
316 |
+
$aI['D'] = $vZ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
|
318 |
+
// DOS to UNIX timestamp
|
319 |
+
$aI['T'] = mktime( ( $aP['FT'] & 0xf800 ) >> 11,
|
320 |
+
( $aP['FT'] & 0x07e0 ) >> 5,
|
321 |
+
( $aP['FT'] & 0x001f ) << 1,
|
322 |
+
( $aP['FD'] & 0x01e0 ) >> 5,
|
323 |
+
$aP['FD'] & 0x001f,
|
324 |
+
( ( $aP['FD'] & 0xfe00 ) >> 9 ) + 1980 );
|
325 |
|
326 |
+
//$this->Entries[] = &new SimpleUnzipEntry($aI);
|
327 |
+
$this->package['entries'][] = array(
|
328 |
+
'data' => $aI['D'],
|
329 |
+
'error' => $aI['E'],
|
330 |
+
'error_msg' => $aI['EM'],
|
331 |
+
'name' => $aI['N'],
|
332 |
+
'path' => $aI['P'],
|
333 |
+
'time' => $aI['T']
|
334 |
+
);
|
335 |
|
336 |
+
} // end for each entries
|
|
|
|
|
337 |
|
338 |
+
return true;
|
339 |
}
|
340 |
|
341 |
+
// sheets numeration: 1,2,3....
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
|
343 |
+
public function error( $num = null, $str = null ) {
|
344 |
+
if ( $num ) {
|
345 |
+
$this->errno = $num;
|
346 |
+
$this->error = $str;
|
347 |
+
if ( $this->debug ) {
|
348 |
+
trigger_error( __CLASS__ . ': ' . $this->error, E_USER_WARNING );
|
349 |
}
|
350 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
return $this->error;
|
353 |
}
|
354 |
+
public function errno() {
|
355 |
+
return $this->errno;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
}
|
357 |
|
358 |
+
private function _parse() {
|
359 |
+
// Document data holders
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
$this->sharedstrings = array();
|
361 |
+
$this->sheets = array();
|
362 |
+
// $this->styles = array();
|
363 |
|
364 |
+
// Read relations and search for officeDocument
|
365 |
if ( $relations = $this->getEntryXML( '_rels/.rels' ) ) {
|
366 |
+
|
367 |
foreach ( $relations->Relationship as $rel ) {
|
368 |
+
|
369 |
$rel_type = trim( (string) $rel['Type'] );
|
370 |
$rel_target = trim( (string) $rel['Target'] );
|
371 |
+
|
372 |
+
if ( $rel_type === self::SCHEMA_REL_OFFICEDOCUMENT && $this->workbook = $this->getEntryXML( $rel_target ) ) {
|
373 |
+
|
374 |
+
$index_rId = array(); // [0 => rId1]
|
375 |
|
376 |
$index = 0;
|
377 |
foreach ( $this->workbook->sheets->sheet as $s ) {
|
378 |
+
/* @var SimpleXMLElement $s */
|
379 |
$this->sheetNames[ $index ] = (string) $s['name'];
|
380 |
$index_rId[ $index ] = (string) $s['id'];
|
381 |
$index++;
|
382 |
}
|
383 |
+
if ( (int) $this->workbook->workbookPr['date1904'] === 1 ) {
|
384 |
+
$this->date1904 = 1;
|
385 |
+
}
|
386 |
+
|
387 |
+
// print_r( $index_rId );
|
388 |
+
|
389 |
|
390 |
if ( $workbookRelations = $this->getEntryXML( dirname( $rel_target ) . '/_rels/workbook.xml.rels' ) ) {
|
391 |
+
|
392 |
+
// Loop relations for workbook and extract sheets...
|
393 |
foreach ( $workbookRelations->Relationship as $workbookRelation ) {
|
394 |
+
|
395 |
$wrel_type = trim( (string) $workbookRelation['Type'] );
|
396 |
+
$wrel_path = dirname( trim( (string) $rel['Target'] ) ) . '/' . trim( (string) $workbookRelation['Target'] );
|
397 |
if ( ! $this->entryExists( $wrel_path ) ) {
|
398 |
continue;
|
399 |
}
|
400 |
+
|
401 |
+
|
402 |
+
if ( $wrel_type === self::SCHEMA_REL_WORKSHEET ) { // Sheets
|
403 |
+
|
404 |
if ( $sheet = $this->getEntryXML( $wrel_path ) ) {
|
405 |
$index = array_search( (string) $workbookRelation['Id'], $index_rId, false );
|
406 |
$this->sheets[ $index ] = $sheet;
|
407 |
}
|
408 |
+
|
409 |
+
} else if ( $wrel_type === self::SCHEMA_REL_SHAREDSTRINGS ) {
|
410 |
+
|
411 |
if ( $sharedStrings = $this->getEntryXML( $wrel_path ) ) {
|
412 |
foreach ( $sharedStrings->si as $val ) {
|
413 |
if ( isset( $val->t ) ) {
|
417 |
}
|
418 |
}
|
419 |
}
|
420 |
+
} else if ( $wrel_type === self::SCHEMA_REL_STYLES ) {
|
421 |
+
|
422 |
$this->styles = $this->getEntryXML( $wrel_path );
|
423 |
|
424 |
$nf = array();
|
425 |
+
if ( $this->styles->numFmts->numFmt !== null ) {
|
426 |
foreach ( $this->styles->numFmts->numFmt as $v ) {
|
427 |
$nf[ (int) $v['numFmtId'] ] = (string) $v['formatCode'];
|
428 |
}
|
429 |
}
|
430 |
|
431 |
+
if ( $this->styles->cellXfs->xf !== null ) {
|
432 |
foreach ( $this->styles->cellXfs->xf as $v ) {
|
433 |
+
$v = (array) $v->attributes();
|
434 |
$v['format'] = '';
|
435 |
|
436 |
if ( isset( $v['@attributes']['numFmtId'] ) ) {
|
437 |
$v = $v['@attributes'];
|
438 |
$fid = (int) $v['numFmtId'];
|
439 |
+
if ( isset( self::$CF[ $fid ] ) ) {
|
440 |
+
$v['format'] = self::$CF[ $fid ];
|
441 |
+
} else if ( isset( $nf[ $fid ] ) ) {
|
442 |
$v['format'] = $nf[ $fid ];
|
443 |
}
|
444 |
}
|
445 |
+
$this->cellFormats[] = $v;
|
446 |
}
|
447 |
}
|
448 |
}
|
449 |
+
}
|
450 |
+
|
451 |
break;
|
452 |
}
|
453 |
}
|
454 |
+
}
|
455 |
}
|
|
|
|
|
456 |
if ( count( $this->sheets ) ) {
|
457 |
+
// Sort sheets
|
458 |
ksort( $this->sheets );
|
459 |
+
|
460 |
return true;
|
461 |
}
|
462 |
|
463 |
return false;
|
464 |
}
|
465 |
+
/*
|
466 |
+
* @param string $name Filename in archive
|
467 |
+
* @return SimpleXMLElement|bool
|
468 |
+
*/
|
469 |
+
public function getEntryXML( $name ) {
|
470 |
+
if ( $entry_xml = $this->getEntryData( $name ) ) {
|
471 |
+
$entry_xml = trim( $entry_xml );
|
472 |
+
// dirty remove namespace prefixes and empty rows
|
473 |
+
$entry_xml = preg_replace('/xmlns[^=]*="[^"]*"/i','', $entry_xml ); // remove namespaces
|
474 |
+
$entry_xml = preg_replace('/[a-zA-Z0-9]+:([a-zA-Z0-9]+="[^"]+")/','$1$2', $entry_xml ); // remove namespaced attrs
|
475 |
+
$entry_xml = preg_replace('/<[a-zA-Z0-9]+:([^>]+)>/', '<$1>', $entry_xml); // fix namespaced openned tags
|
476 |
+
$entry_xml = preg_replace('/<\/[a-zA-Z0-9]+:([^>]+)>/', '</$1>', $entry_xml); // fix namespaced closed tags
|
477 |
+
|
478 |
+
if ( $this->skipEmptyRows && strpos($name, '/sheet') ) {
|
479 |
+
$entry_xml = preg_replace( '/<row[^>]+>\s*(<c[^\/]+\/>\s*)+<\/row>/', '', $entry_xml,-1, $cnt ); // remove empty rows
|
480 |
+
$entry_xml = preg_replace( '/<row[^\/>]*\/>/', '', $entry_xml, -1, $cnt2 );
|
481 |
+
if ( $cnt || $cnt2 ) {
|
482 |
+
$entry_xml = preg_replace('/<dimension[^\/]+\/>/', '', $entry_xml);
|
483 |
+
}
|
484 |
+
// file_put_contents( basename( $name ), $entry_xml ); // @to do comment!!!
|
485 |
+
}
|
486 |
|
487 |
+
// XML External Entity (XXE) Prevention
|
488 |
+
$_old = libxml_disable_entity_loader();
|
489 |
+
$entry_xmlobj = simplexml_load_string( $entry_xml );
|
490 |
+
// echo '<pre>'.print_r( $entry_xmlobj, true).'</pre>';
|
491 |
+
libxml_disable_entity_loader($_old);
|
492 |
+
if ( $entry_xmlobj ) {
|
493 |
+
return $entry_xmlobj;
|
494 |
+
}
|
495 |
+
$e = libxml_get_last_error();
|
496 |
+
$this->error( 3, 'XML-entry ' . $name.' parser error '.$e->message.' line '.$e->line );
|
497 |
+
} else {
|
498 |
+
$this->error( 4, 'XML-entry not found ' . $name );
|
499 |
+
}
|
500 |
+
return false;
|
501 |
+
}
|
502 |
+
|
503 |
+
public function getEntryData( $name ) {
|
504 |
+
$dir = $this->_strtoupper( dirname( $name ) );
|
505 |
+
$name = $this->_strtoupper( basename( $name ) );
|
506 |
+
foreach ( $this->package['entries'] as $entry ) {
|
507 |
+
if ( $this->_strtoupper( $entry['path'] ) === $dir && $this->_strtoupper( $entry['name'] ) === $name ) {
|
508 |
+
return $entry['data'];
|
509 |
+
}
|
510 |
+
}
|
511 |
+
$this->error( 5, 'Entry not found '.$name );
|
512 |
+
|
513 |
+
return false;
|
514 |
+
}
|
515 |
+
|
516 |
+
public function entryExists( $name ) { // 0.6.6
|
517 |
+
$dir = $this->_strtoupper( dirname( $name ) );
|
518 |
+
$name = $this->_strtoupper( basename( $name ) );
|
519 |
+
foreach ( $this->package['entries'] as $entry ) {
|
520 |
+
if ( $this->_strtoupper( $entry['path'] ) === $dir && $this->_strtoupper( $entry['name'] ) === $name ) {
|
521 |
+
return true;
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
return false;
|
526 |
+
}
|
527 |
+
|
528 |
+
private function _parseRichText( $is = null ) {
|
529 |
$value = array();
|
530 |
|
531 |
if ( isset( $is->t ) ) {
|
532 |
$value[] = (string) $is->t;
|
533 |
+
} else if ( isset($is->r ) ) {
|
534 |
foreach ( $is->r as $run ) {
|
535 |
$value[] = (string) $run->t;
|
536 |
}
|
537 |
}
|
538 |
|
539 |
+
return implode( '', $value );
|
540 |
}
|
541 |
|
542 |
+
public static function parse( $filename, $is_data = false, $debug = false, $skip_empty_rows = false ) {
|
543 |
+
$xlsx = new self();
|
544 |
+
$xlsx->debug = $debug;
|
545 |
+
$xlsx->skipEmptyRows = $skip_empty_rows;
|
546 |
+
$is_data ? $xlsx->parseData( $filename ) : $xlsx->parseFile( $filename );
|
|
|
|
|
|
|
|
|
|
|
|
|
547 |
if ( $xlsx->success() ) {
|
548 |
return $xlsx;
|
549 |
}
|
550 |
+
self::parseError( $xlsx->error() );
|
551 |
+
self::parseErrno( $xlsx->errno() );
|
552 |
+
|
553 |
+
return false;
|
554 |
+
}
|
555 |
+
public static function parseError( $set = false ) {
|
556 |
+
static $error = false;
|
557 |
+
return $set ? $error = $set : $error;
|
558 |
+
}
|
559 |
+
public static function parseErrno( $set = false ) {
|
560 |
+
static $errno = false;
|
561 |
+
return $set ? $errno = $set : $errno;
|
562 |
+
}
|
563 |
+
|
564 |
+
public function success() {
|
565 |
+
return ! $this->error;
|
566 |
+
}
|
567 |
+
|
568 |
+
public function rows( $worksheetIndex = 0 ) {
|
569 |
+
|
570 |
+
if ( ( $ws = $this->worksheet( $worksheetIndex ) ) === false ) {
|
571 |
+
return false;
|
572 |
+
}
|
573 |
+
$dim = $this->dimension( $worksheetIndex );
|
574 |
+
$numCols = $dim[0];
|
575 |
+
$numRows = $dim[1];
|
576 |
+
|
577 |
+
$emptyRow = array();
|
578 |
+
for( $i = 0; $i < $numCols; $i++) {
|
579 |
+
$emptyRow[] = '';
|
580 |
+
}
|
581 |
+
|
582 |
+
$rows = array();
|
583 |
+
for( $i = 0; $i < $numRows; $i++) {
|
584 |
+
$rows[] = $emptyRow;
|
585 |
+
}
|
586 |
+
|
587 |
+
$curR = 0;
|
588 |
+
/* @var SimpleXMLElement $ws */
|
589 |
+
foreach ( $ws->sheetData->row as $row ) {
|
590 |
+
$curC = 0;
|
591 |
+
foreach ( $row->c as $c ) {
|
592 |
+
// detect skipped cols
|
593 |
+
$idx = $this->getIndex( (string) $c['r'] );
|
594 |
+
$x = $idx[0];
|
595 |
+
$y = $idx[1];
|
596 |
+
|
597 |
+
if ( $x > -1 ) {
|
598 |
+
$curC = $x;
|
599 |
+
$curR = $y;
|
600 |
+
}
|
601 |
+
|
602 |
+
$rows[ $curR ][ $curC ] = $this->value( $c );
|
603 |
+
$curC++;
|
604 |
+
}
|
605 |
+
|
606 |
+
$curR ++;
|
607 |
+
}
|
608 |
+
|
609 |
+
return $rows;
|
610 |
+
}
|
611 |
+
|
612 |
+
public function rowsEx( $worksheetIndex = 0 ) {
|
613 |
+
|
614 |
+
if ( ( $ws = $this->worksheet( $worksheetIndex ) ) === false ) {
|
615 |
+
return false;
|
616 |
+
}
|
617 |
+
|
618 |
+
$rows = array();
|
619 |
+
|
620 |
+
$dim = $this->dimension( $worksheetIndex );
|
621 |
+
$numCols = $dim[0];
|
622 |
+
$numRows = $dim[1];
|
623 |
+
|
624 |
+
/** @noinspection ForeachInvariantsInspection */
|
625 |
+
for ( $y = 0; $y < $numRows; $y++ ) {
|
626 |
+
/** @noinspection ForeachInvariantsInspection */
|
627 |
+
for ( $x = 0; $x < $numCols; $x++ ) {
|
628 |
+
// 0.6.8
|
629 |
+
$c = '';
|
630 |
+
for ( $k = $x; $k >= 0; $k = (int) ( $k / 26 ) - 1 ) {
|
631 |
+
$c = chr( $k % 26 + 65 ) . $c;
|
632 |
+
}
|
633 |
+
$rows[ $y ][ $x ] = array(
|
634 |
+
'type' => '',
|
635 |
+
'name' => $c . ( $y + 1 ),
|
636 |
+
'value' => '',
|
637 |
+
'href' => '',
|
638 |
+
'f' => '',
|
639 |
+
'format' => '',
|
640 |
+
'r' => $y
|
641 |
+
);
|
642 |
+
}
|
643 |
+
}
|
644 |
+
|
645 |
+
$curR = 0;
|
646 |
+
/* @var SimpleXMLElement $ws */
|
647 |
+
foreach ( $ws->sheetData->row as $row ) {
|
648 |
+
|
649 |
+
$r_idx = (int) $row['r'];
|
650 |
+
$curC = 0;
|
651 |
+
|
652 |
+
foreach ( $row->c as $c ) {
|
653 |
+
$r = (string) $c['r'];
|
654 |
+
$t = (string) $c['t'];
|
655 |
+
$s = (int) $c['s'];
|
656 |
+
|
657 |
+
$idx = $this->getIndex( $r );
|
658 |
+
$x = $idx[0];
|
659 |
+
$y = $idx[1];
|
660 |
+
|
661 |
+
if ( $x > -1 ) {
|
662 |
+
$curC = $x;
|
663 |
+
$curR = $y;
|
664 |
+
}
|
665 |
+
|
666 |
+
if ( $s > 0 && isset( $this->cellFormats[ $s ] ) ) {
|
667 |
+
$format = $this->cellFormats[ $s ]['format'];
|
668 |
+
} else {
|
669 |
+
$format = '';
|
670 |
+
}
|
671 |
+
|
672 |
+
$rows[ $curR ][ $curC ] = array(
|
673 |
+
'type' => $t,
|
674 |
+
'name' => (string) $c['r'],
|
675 |
+
'value' => $this->value( $c ),
|
676 |
+
'href' => $this->href( $c ),
|
677 |
+
'f' => (string) $c->f,
|
678 |
+
'format' => $format,
|
679 |
+
'r' => $r_idx
|
680 |
+
);
|
681 |
+
$curC++;
|
682 |
+
}
|
683 |
+
$curR ++;
|
684 |
+
}
|
685 |
+
|
686 |
+
return $rows;
|
687 |
+
|
688 |
+
}
|
689 |
+
public function toHTML( $worksheetIndex = 0 ) {
|
690 |
+
$s = '<table class=excel>';
|
691 |
+
foreach( $this->rows( $worksheetIndex ) as $r ) {
|
692 |
+
$s .= '<tr>';
|
693 |
+
foreach ( $r as $c ) {
|
694 |
+
$s .= '<td nowrap>'.( $c === '' ? ' ' : htmlspecialchars( $c, ENT_QUOTES )).'</td>';
|
695 |
+
}
|
696 |
+
$s .= "</tr>\r\n";
|
697 |
+
}
|
698 |
+
$s .= '</table>';
|
699 |
+
return $s;
|
700 |
+
}
|
701 |
+
|
702 |
+
public function worksheet( $worksheetIndex = 0 ) {
|
703 |
+
|
704 |
+
|
705 |
+
|
706 |
+
if ( isset( $this->sheets[ $worksheetIndex ] ) ) {
|
707 |
+
$ws = $this->sheets[ $worksheetIndex ];
|
708 |
+
|
709 |
+
if ( isset( $ws->hyperlinks ) ) {
|
710 |
+
$this->hyperlinks = array();
|
711 |
+
foreach ( $ws->hyperlinks->hyperlink as $hyperlink ) {
|
712 |
+
$this->hyperlinks[ (string) $hyperlink['ref'] ] = (string) $hyperlink['display'];
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
return $ws;
|
717 |
+
}
|
718 |
+
$this->error( 6, 'Worksheet not found ' . $worksheetIndex );
|
719 |
|
720 |
return false;
|
721 |
}
|
722 |
|
723 |
/**
|
724 |
+
* returns [numCols,numRows] of worksheet
|
725 |
*
|
726 |
+
* @param int $worksheetIndex
|
727 |
*
|
728 |
+
* @return array
|
|
|
729 |
*/
|
730 |
+
public function dimension( $worksheetIndex = 0 ) {
|
731 |
+
|
732 |
+
if ( ( $ws = $this->worksheet( $worksheetIndex ) ) === false ) {
|
733 |
+
return array(0,0);
|
734 |
+
}
|
735 |
+
/* @var SimpleXMLElement $ws */
|
736 |
+
|
737 |
+
$ref = (string) $ws->dimension['ref'];
|
738 |
+
|
739 |
+
if ( $this->_strpos( $ref, ':' ) !== false ) {
|
740 |
+
$d = explode( ':', $ref );
|
741 |
+
$idx = $this->getIndex( $d[1] );
|
742 |
+
|
743 |
+
return array( $idx[0] + 1, $idx[1] + 1 );
|
744 |
+
}
|
745 |
+
if ( $ref !== '' ) { // 0.6.8
|
746 |
+
$index = $this->getIndex( $ref );
|
747 |
+
|
748 |
+
return array( $index[0] + 1, $index[1] + 1 );
|
749 |
+
}
|
750 |
+
|
751 |
+
// slow method
|
752 |
+
$maxC = $maxR = 0;
|
753 |
+
foreach ( $ws->sheetData->row as $row ) {
|
754 |
+
foreach ( $row->c as $c ) {
|
755 |
+
$idx = $this->getIndex( (string) $c['r'] );
|
756 |
+
$x = $idx[0];
|
757 |
+
$y = $idx[1];
|
758 |
+
if ( $x > 0 ) {
|
759 |
+
if ( $x > $maxC ) {
|
760 |
+
$maxC = $x;
|
761 |
+
}
|
762 |
+
if ( $y > $maxR ) {
|
763 |
+
$maxR = $y;
|
764 |
+
}
|
765 |
+
}
|
766 |
+
}
|
767 |
+
}
|
768 |
+
|
769 |
+
return array( $maxC+1, $maxR+1 );
|
770 |
+
}
|
771 |
+
|
772 |
+
public function getIndex( $cell = 'A1' ) {
|
773 |
+
|
774 |
+
if ( preg_match( '/([A-Z]+)(\d+)/', $cell, $m ) ) {
|
775 |
+
$col = $m[1];
|
776 |
+
$row = $m[2];
|
777 |
+
|
778 |
+
$colLen = $this->_strlen( $col );
|
779 |
+
$index = 0;
|
780 |
+
|
781 |
+
for ( $i = $colLen - 1; $i >= 0; $i -- ) {
|
782 |
+
/** @noinspection PowerOperatorCanBeUsedInspection */
|
783 |
+
$index += ( ord( $col[$i] ) - 64 ) * pow( 26, $colLen - $i - 1 );
|
784 |
+
}
|
785 |
+
|
786 |
+
return array( $index - 1, $row - 1 );
|
787 |
+
}
|
788 |
+
// $this->error( 'Invalid cell index ' . $cell );
|
789 |
+
|
790 |
+
return array(-1,-1);
|
791 |
+
}
|
792 |
+
|
793 |
+
public function value( $cell ) {
|
794 |
+
// Determine data type
|
795 |
+
$dataType = (string) $cell['t'];
|
796 |
+
|
797 |
+
if ( !$dataType ) { // number
|
798 |
+
$s = (int) $cell['s'];
|
799 |
+
if ( $s > 0 && isset( $this->cellFormats[ $s ] ) ) {
|
800 |
+
$format = $this->cellFormats[ $s ]['format'];
|
801 |
+
if ( strpos( $format, 'm') !== false ) {
|
802 |
+
$dataType = 'd';
|
803 |
+
}
|
804 |
+
}
|
805 |
+
}
|
806 |
+
|
807 |
+
$value = '';
|
808 |
+
|
809 |
+
switch ( $dataType ) {
|
810 |
+
case 's':
|
811 |
+
// Value is a shared string
|
812 |
+
if ( (string) $cell->v !== '' ) {
|
813 |
+
$value = $this->sharedstrings[ (int) $cell->v ];
|
814 |
+
}
|
815 |
+
|
816 |
+
break;
|
817 |
+
|
818 |
+
case 'b':
|
819 |
+
// Value is boolean
|
820 |
+
$value = (string) $cell->v;
|
821 |
+
if ( $value === '0' ) {
|
822 |
+
$value = false;
|
823 |
+
} else if ( $value === '1' ) {
|
824 |
+
$value = true;
|
825 |
+
} else {
|
826 |
+
$value = (bool) $cell->v;
|
827 |
+
}
|
828 |
+
|
829 |
+
break;
|
830 |
+
|
831 |
+
case 'inlineStr':
|
832 |
+
// Value is rich text inline
|
833 |
+
$value = $this->_parseRichText( $cell->is );
|
834 |
+
|
835 |
+
break;
|
836 |
+
|
837 |
+
case 'e':
|
838 |
+
// Value is an error message
|
839 |
+
if ( (string) $cell->v !== '' ) {
|
840 |
+
$value = (string) $cell->v;
|
841 |
+
}
|
842 |
+
|
843 |
+
break;
|
844 |
+
case 'd':
|
845 |
+
// Value is a date
|
846 |
+
$value = $this->datetimeFormat ? gmdate( $this->datetimeFormat, $this->unixstamp( (float) $cell->v ) ) : (float) $cell->v;
|
847 |
+
break;
|
848 |
+
|
849 |
+
|
850 |
+
default:
|
851 |
+
// Value is a string
|
852 |
+
$value = (string) $cell->v;
|
853 |
+
|
854 |
+
// Check for numeric values
|
855 |
+
if ( is_numeric( $value ) && $dataType !== 's' ) {
|
856 |
+
/** @noinspection TypeUnsafeComparisonInspection */
|
857 |
+
if ( $value == (int) $value ) {
|
858 |
+
$value = (int) $value;
|
859 |
+
} /** @noinspection TypeUnsafeComparisonInspection */ elseif ( $value == (float) $value ) {
|
860 |
+
$value = (float) $value;
|
861 |
+
}
|
862 |
+
}
|
863 |
+
}
|
864 |
+
|
865 |
+
return $value;
|
866 |
+
}
|
867 |
+
|
868 |
+
public function unixstamp( $excelDateTime ) {
|
869 |
+
|
870 |
+
$d = floor( $excelDateTime ); // days since 1900 or 1904
|
871 |
+
$t = $excelDateTime - $d;
|
872 |
+
|
873 |
+
if ( $this->date1904 ) {
|
874 |
+
/** @noinspection SummerTimeUnsafeTimeManipulationInspection */
|
875 |
+
$d += 1462;
|
876 |
+
}
|
877 |
+
|
878 |
+
|
879 |
+
/** @noinspection SummerTimeUnsafeTimeManipulationInspection */
|
880 |
+
$t = ( abs( $d ) > 0 ) ? ( $d - 25569 ) * 86400 + round( $t * 86400 ) : round( $t * 86400 );
|
881 |
+
|
882 |
+
return (int) $t;
|
883 |
}
|
884 |
|
885 |
/**
|
886 |
+
* Returns cell value
|
887 |
+
* VERY SLOW! Use ->rows() or ->rowsEx()
|
|
|
|
|
|
|
|
|
|
|
|
|
888 |
*
|
889 |
+
* @param int $worksheetIndex
|
890 |
+
* @param string|array $cell ref or coords, D12 or [3,12]
|
|
|
891 |
*
|
892 |
+
* @return mixed Returns NULL if not found
|
893 |
*/
|
894 |
+
public function getCell( $worksheetIndex = 0, $cell = 'A1' ) {
|
895 |
+
|
896 |
+
if (($ws = $this->worksheet( $worksheetIndex)) === false) { return false; }
|
897 |
+
|
898 |
+
$idx = is_array( $cell ) ? $cell : $this->getIndex( (string) $cell );
|
899 |
+
$C = $idx[0];
|
900 |
+
$R = $idx[1];
|
901 |
|
902 |
+
$curR = 0;
|
903 |
+
/* @var SimpleXMLElement $ws */
|
904 |
+
foreach ( $ws->sheetData->row as $row ) {
|
905 |
+
$curC = 0;
|
906 |
+
foreach ( $row->c as $c ) {
|
907 |
+
// detect skipped cols
|
908 |
+
$idx = $this->getIndex( (string) $c['r'] );
|
909 |
+
$x = $idx[0];
|
910 |
+
$y = $idx[1];
|
911 |
+
if ( $x > 0 ) {
|
912 |
+
$curC = $x;
|
913 |
+
$curR = $y;
|
914 |
+
}
|
915 |
+
if ( $curR === $R && $curC === $C ) {
|
916 |
+
return $this->value( $c );
|
917 |
+
}
|
918 |
+
if ( $curR > $R ){
|
919 |
+
return null;
|
920 |
+
}
|
921 |
+
$curC++;
|
922 |
+
}
|
923 |
|
924 |
+
$curR ++;
|
|
|
|
|
925 |
}
|
926 |
return null;
|
927 |
}
|
928 |
|
929 |
+
public function href( $cell ) {
|
930 |
+
return isset( $this->hyperlinks[ (string) $cell['r'] ] ) ? $this->hyperlinks[ (string) $cell['r'] ] : '';
|
931 |
+
}
|
932 |
+
|
933 |
+
public function sheets() {
|
934 |
+
return $this->sheets;
|
935 |
+
}
|
936 |
+
|
937 |
+
public function sheetsCount() {
|
938 |
+
return count( $this->sheets );
|
939 |
+
}
|
940 |
+
|
941 |
+
public function sheetName( $worksheetIndex ) {
|
942 |
+
if ( isset($this->sheetNames[ $worksheetIndex ])) {
|
943 |
+
return $this->sheetNames[ $worksheetIndex ];
|
944 |
+
}
|
945 |
+
|
946 |
+
return false;
|
947 |
+
}
|
948 |
+
|
949 |
+
public function sheetNames() {
|
950 |
+
|
951 |
+
return $this->sheetNames;
|
952 |
+
}
|
953 |
+
|
954 |
+
// thx Gonzo
|
955 |
+
|
956 |
+
public function getStyles() {
|
957 |
+
return $this->styles;
|
958 |
+
}
|
959 |
+
|
960 |
+
public function getPackage() {
|
961 |
+
return $this->package;
|
962 |
+
}
|
963 |
+
public function setDateTimeFormat( $value ) {
|
964 |
+
$this->datetimeFormat = is_string( $value) ? $value : false;
|
965 |
+
}
|
966 |
+
private function _strlen( $str ) {
|
967 |
+
return (ini_get('mbstring.func_overload') & 2) ? mb_strlen($str , '8bit') : strlen($str);
|
968 |
+
}
|
969 |
+
private function _strpos( $haystack, $needle, $offset = 0 ) {
|
970 |
+
return (ini_get('mbstring.func_overload') & 2) ? mb_strpos( $haystack, $needle, $offset , '8bit') : strpos($haystack, $needle, $offset);
|
971 |
+
}
|
972 |
+
private function _strrpos( $haystack, $needle, $offset = 0 ) {
|
973 |
+
return (ini_get('mbstring.func_overload') & 2) ? mb_strrpos( $haystack, $needle, $offset, '8bit') : strrpos($haystack, $needle, $offset);
|
974 |
+
}
|
975 |
+
private function _strtoupper( $str ) {
|
976 |
+
return (ini_get('mbstring.func_overload') & 2) ? mb_strtoupper($str , '8bit') : strtoupper($str);
|
977 |
+
}
|
978 |
+
private function _substr( $str, $start, $length = null ) {
|
979 |
+
return (ini_get('mbstring.func_overload') & 2) ? mb_substr( $str, $start, ($length === null) ? mb_strlen($str,'8bit') : $length, '8bit') : substr($str, $start, ($length === null) ? strlen($str) : $length );
|
980 |
+
}
|
981 |
+
|
982 |
} // class SimpleXLSX
|
models/model-options.php
CHANGED
@@ -235,7 +235,6 @@ class TablePress_Options_Model extends TablePress_Model {
|
|
235 |
// Capabilities for single roles.
|
236 |
$role = get_role( 'administrator' );
|
237 |
if ( ! empty( $role ) ) {
|
238 |
-
$role->add_cap( 'tablepress_import_tables_wptr' );
|
239 |
$role->add_cap( 'tablepress_edit_options' );
|
240 |
}
|
241 |
|
@@ -274,7 +273,7 @@ class TablePress_Options_Model extends TablePress_Model {
|
|
274 |
$role->remove_cap( 'tablepress_export_tables' );
|
275 |
$role->remove_cap( 'tablepress_access_options_screen' );
|
276 |
$role->remove_cap( 'tablepress_access_about_screen' );
|
277 |
-
|
278 |
$role->remove_cap( 'tablepress_edit_options' );
|
279 |
}
|
280 |
|
235 |
// Capabilities for single roles.
|
236 |
$role = get_role( 'administrator' );
|
237 |
if ( ! empty( $role ) ) {
|
|
|
238 |
$role->add_cap( 'tablepress_edit_options' );
|
239 |
}
|
240 |
|
273 |
$role->remove_cap( 'tablepress_export_tables' );
|
274 |
$role->remove_cap( 'tablepress_access_options_screen' );
|
275 |
$role->remove_cap( 'tablepress_access_about_screen' );
|
276 |
+
$role->remove_cap( 'tablepress_import_tables_wptr' ); // No longer used since 1.10, but might still be in the database.
|
277 |
$role->remove_cap( 'tablepress_edit_options' );
|
278 |
}
|
279 |
|
models/model-table.php
CHANGED
@@ -222,6 +222,9 @@ class TablePress_Table_Model extends TablePress_Model {
|
|
222 |
* @return array Post.
|
223 |
*/
|
224 |
protected function _table_to_post( array $table, $post_id ) {
|
|
|
|
|
|
|
225 |
// Sanitize each cell, table name, and table description, if the user is not allowed to work with unfiltered HTML.
|
226 |
if ( ! current_user_can( 'unfiltered_html' ) ) {
|
227 |
$table = $this->sanitize( $table );
|
@@ -380,8 +383,8 @@ class TablePress_Table_Model extends TablePress_Model {
|
|
380 |
*/
|
381 |
public function sanitize( array $table ) {
|
382 |
// Sanitize the table name and description.
|
383 |
-
$
|
384 |
-
foreach ( $
|
385 |
$table[ $field ] = wp_kses_post( $table[ $field ] );
|
386 |
}
|
387 |
|
@@ -395,6 +398,44 @@ class TablePress_Table_Model extends TablePress_Model {
|
|
395 |
return $table;
|
396 |
}
|
397 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
398 |
/**
|
399 |
* Save a table.
|
400 |
*
|
222 |
* @return array Post.
|
223 |
*/
|
224 |
protected function _table_to_post( array $table, $post_id ) {
|
225 |
+
// Run filters on content in each cell and other fields.
|
226 |
+
$table = $this->filter_content( $table );
|
227 |
+
|
228 |
// Sanitize each cell, table name, and table description, if the user is not allowed to work with unfiltered HTML.
|
229 |
if ( ! current_user_can( 'unfiltered_html' ) ) {
|
230 |
$table = $this->sanitize( $table );
|
383 |
*/
|
384 |
public function sanitize( array $table ) {
|
385 |
// Sanitize the table name and description.
|
386 |
+
$fields = array( 'name', 'description' );
|
387 |
+
foreach ( $fields as $field ) {
|
388 |
$table[ $field ] = wp_kses_post( $table[ $field ] );
|
389 |
}
|
390 |
|
398 |
return $table;
|
399 |
}
|
400 |
|
401 |
+
/**
|
402 |
+
* Filter/modify the content of table cells and other fields, e.g. for security hardening.
|
403 |
+
*
|
404 |
+
* This is similar to the `sanitize()` method, but executed for all users.
|
405 |
+
* In 1.10.0, adding `rel="noopener noreferrer"` to all HTML link elements like `<a target=` was added. See https://core.trac.wordpress.org/ticket/43187.
|
406 |
+
*
|
407 |
+
* @since 1.10.0
|
408 |
+
*
|
409 |
+
* @param array $table Table.
|
410 |
+
* @return array Filtered/modified table.
|
411 |
+
*/
|
412 |
+
public function filter_content( array $table ) {
|
413 |
+
/**
|
414 |
+
* Filter whether the contents of table cells and fields should be filtered/modified.
|
415 |
+
*
|
416 |
+
* @since 1.10.0
|
417 |
+
*
|
418 |
+
* @param bool $filter Whether to filter the content of table cells and other fields. Default true.
|
419 |
+
*/
|
420 |
+
if ( ! apply_filters( 'tablepress_filter_table_cell_content', true ) ) {
|
421 |
+
return;
|
422 |
+
}
|
423 |
+
|
424 |
+
// Filter the table name and description.
|
425 |
+
$fields = array( 'name', 'description' );
|
426 |
+
foreach ( $fields as $field ) {
|
427 |
+
$table[ $field ] = wp_targeted_link_rel( $table[ $field ] );
|
428 |
+
}
|
429 |
+
|
430 |
+
foreach ( $table['data'] as $row_idx => $row ) {
|
431 |
+
foreach ( $row as $column_idx => $cell_content ) {
|
432 |
+
$table['data'][ $row_idx ][ $column_idx ] = wp_targeted_link_rel( $cell_content );
|
433 |
+
}
|
434 |
+
}
|
435 |
+
|
436 |
+
return $table;
|
437 |
+
}
|
438 |
+
|
439 |
/**
|
440 |
* Save a table.
|
441 |
*
|
readme.txt
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
=== TablePress ===
|
2 |
Contributors: TobiasBg
|
3 |
Donate link: https://tablepress.org/donate/
|
4 |
-
Tags: table,data,
|
5 |
-
Requires at least:
|
6 |
-
|
7 |
-
|
|
|
8 |
License: GPLv2
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -15,7 +16,7 @@ Embed beautiful and feature-rich tables into your posts and pages, without havin
|
|
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/)).
|
19 |
|
20 |
= Supporting future development =
|
21 |
If you like TablePress, please rate and review it here in the WordPress Plugin Directory or support it with your [donation](https://tablepress.org/donate/). Thank you!
|
@@ -36,15 +37,15 @@ Additional features and useful enhancements are available as separate plugins, c
|
|
36 |
|
37 |
== Installation ==
|
38 |
|
39 |
-
The easiest way to install TablePress is via your WordPress Dashboard. Go to the "Plugins" screen, click "Add New", and search for "TablePress" in the WordPress Plugin Directory. Then, click "Install Now" and
|
40 |
|
41 |
Manual installation works just as for other WordPress plugins:
|
42 |
|
43 |
1. [Download](https://downloads.wordpress.org/plugin/tablepress.latest-stable.zip) and extract the ZIP file.
|
44 |
-
1. Move the folder "tablepress"
|
45 |
1. Activate the plugin "TablePress" on the "Plugins" screen of your WordPress Dashboard.
|
46 |
1. Create and manage tables by going to the "TablePress" screen in the admin menu.
|
47 |
-
1.
|
48 |
1. You can change the table styling by using CSS code, which can be entered into the "Custom CSS" textarea on the "Plugin Options" screen.
|
49 |
|
50 |
== Frequently Asked Questions ==
|
@@ -56,18 +57,15 @@ Many questions, regarding different features or styling, have been answered on t
|
|
56 |
For support questions, bug reports, or feature requests, please use the [WordPress Support Forums](https://wordpress.org/support/plugin/tablepress). Please search through the forums first, and only [create a new topic](https://wordpress.org/support/plugin/tablepress#new-post) if you don't find an existing answer. Thank you!
|
57 |
|
58 |
= Requirements? =
|
59 |
-
In short: WordPress
|
60 |
|
61 |
= Languages and Localization? =
|
62 |
-
TablePress
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
If you want to become a Translation Editor for your language, who can confirm or reject translation suggestions by other users, please get in touch.
|
67 |
|
68 |
= Migration from WP-Table Reloaded =
|
69 |
-
|
70 |
-
If you are currently using WP-Table Reloaded, it is highly recommended that you switch to TablePress. WP-Table Reloaded will no longer be maintained or developed. For further information on how to switch from WP-Table Reloaded to TablePress, please see the [migration guide](https://tablepress.org/migration-from-wp-table-reloaded/) on the plugin website.
|
71 |
|
72 |
= Development =
|
73 |
You can follow the development of TablePress more closely in its official [GitHub repository](https://github.com/TobiasBg/TablePress).
|
@@ -78,10 +76,8 @@ Please visit the [official plugin website](https://tablepress.org/) for the late
|
|
78 |
== Usage ==
|
79 |
|
80 |
After installing the plugin, you can create and manage tables on the "TablePress" screen in the WordPress Dashboard.
|
81 |
-
Everything should be self-explaining there.
|
82 |
|
83 |
-
To show one of your tables in a post
|
84 |
-
Alternatively, you can also insert tables by clicking the "Table" button in the editor toolbar, and then selecting the desired table.
|
85 |
|
86 |
After that, you might want to change the styling of the table. You can do this by entering CSS commands into the "Custom CSS" textarea on the "Plugin Options" screen. Some examples for common styling changes can be found on the [TablePress FAQ page](https://tablepress.org/faq/).
|
87 |
You may also add certain features (like sorting, pagination, filtering, alternating row colors, row highlighting, print name and/or description, ...) by enabling the corresponding checkboxes on a table's "Edit" screen.
|
@@ -99,221 +95,31 @@ You may use it free of charge for any purpose.
|
|
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".
|
110 |
-
* Updated external libraries (DataTables, SimpleXLSX, CSSTidy, Build tools).
|
111 |
-
* Some internal changes for better stability, security, translations, and documentation.
|
112 |
-
|
113 |
-
= Version 1.9 =
|
114 |
-
* Full compatibility with WordPress 4.9
|
115 |
-
* Feature: The "Custom CSS" text field highlights and notifies about CSS code syntax errors.
|
116 |
-
* Enhancement: Update list of allowed CSS properties in "Custom CSS".
|
117 |
-
* Enhancement: Make the CSV import more robust against malformed input.
|
118 |
-
* Bugfix: The integration into the WordPress search was broken since a WordPress core change.
|
119 |
-
* Bugfix: The HTML import was broken on certain server configurations.
|
120 |
-
* Updated external libraries (Build tools).
|
121 |
-
* Some internal changes and fixes for better stability, cleaner code, translations, and documentation.
|
122 |
-
* TablePress 1.9 requires WordPress 4.9.1!
|
123 |
-
|
124 |
-
= Version 1.8.1 =
|
125 |
-
* Enhancement: Make HTML import more robust and faster.
|
126 |
-
* Enhancement: The HTML import can now import merged cells in a row.
|
127 |
-
* Enhancement: Harden the XLSX import against potential security issues (thanks to Yuji Tounai).
|
128 |
-
* Enhancement: Allow easier changes to import data for developers, by adding a filter hook.
|
129 |
-
* Enhancement: The layout of the TablePress admin screens will look better on small screens.
|
130 |
-
* Enhancement: Update list of allowed CSS properties in "Custom CSS".
|
131 |
-
* Enhancement: Reduce size of default CSS, by removing old hacks for Internet Explorer.
|
132 |
-
* Updated external libraries (CodeMirror, DataTables, SimpleXLSX, CSSTidy, Build tools).
|
133 |
-
|
134 |
-
= Version 1.8 =
|
135 |
-
* Full compatibility with WordPress 4.7
|
136 |
-
* Updated external libraries (CodeMirror, DataTables, Build tools).
|
137 |
-
* Enhancement: Better spacing between the label and input field for the search in tables.
|
138 |
-
* Enhancement: Update list of allowed CSS properties in "Custom CSS".
|
139 |
-
* Enhancement: Make it easier for other plugins to clear the TablePress output cache.
|
140 |
-
* Enhancement: Simplification of some strings/text, to make translations easier.
|
141 |
-
* Bugfix: Better sanitization of HTML code in the Preview (thanks to Gerard Arall).
|
142 |
-
* Some internal changes and fixes for better stability, cleaner code, translations, and documentation.
|
143 |
-
* TablePress 1.8 requires WordPress 4.7!
|
144 |
-
|
145 |
-
= Version 1.7 =
|
146 |
-
* Full compatibility with WordPress 4.4
|
147 |
-
* Bugfix: Properly align tabs and heading in the main navigation bar at the top.
|
148 |
-
* Bugfix: Restore layout on small screens (responsiveness) for the "All Tables" screen.
|
149 |
-
* Bugfix: Restore layout of the overlay when inserting tables into posts/pages.
|
150 |
-
* Bugfix: Make input fields on the "Edit" screen resizable in both directions again.
|
151 |
-
* Bugfix: Restore sorting arrows on the "Edit" screen.
|
152 |
-
* Bugfix: Some strings were unclear, had typos, or used wrong HTML entities.
|
153 |
-
* Bugfix: Prevent certain "Custom Commands" from being rewritten to a new syntax in the wrong way.
|
154 |
-
* Bugfix: Make sure that the table preview is properly translated to other languages.
|
155 |
-
* Enhancement: Make the "Custom CSS" textarea vertically resizable.
|
156 |
-
* Enhancement: Support more CSS3 properties when cleaning "Custom CSS" code.
|
157 |
-
* Enhancement: Increase reliability when internally converting tables to their storage format (JSON).
|
158 |
-
* Enhancement: Use correct HTML markup for better accessibility on the admin screens.
|
159 |
-
* Enhancement: Only load required parts of jQuery, for faster page loads in some environments.
|
160 |
-
* Updated external libraries (CodeMirror, DataTables, Build tools).
|
161 |
-
* Translations: Switched from .po/.mo files to WordPress Plugin Language Packs.
|
162 |
-
* Some internal changes and fixes for better stability, cleaner code, and documentation.
|
163 |
-
* TablePress 1.7 requires WordPress 4.3!
|
164 |
-
|
165 |
-
= Version 1.6.1 =
|
166 |
-
* Bugfix: Update the DataTables JS library to fix issues with the JS features after the release of WordPress 4.3.
|
167 |
-
* Updated translations (Chinese (Simplified)).
|
168 |
-
|
169 |
-
= Version 1.6 =
|
170 |
-
* Full compatibility with WordPress 4.2
|
171 |
-
* Bugfix: Fixed integration of the "Insert Link" dialog.
|
172 |
-
* Bugfix: Divisions by zero were not caught properly in formulas in cells.
|
173 |
-
* Bugfix: Numbers were sometimes not imported correctly in the Excel importer.
|
174 |
-
* Enhancement: Importing files encoded as UTF-16 should work better now.
|
175 |
-
* Enhancement: Support dismissible notices in the admin screens.
|
176 |
-
* Enhancement: Support better tabbing on the "Edit" screen.
|
177 |
-
* Enhancement: Add page cache clearing for the WP Fastest Cache plugin.
|
178 |
-
* Enhancement: Add a plugin filter hook that allows modifying the exported data by plugins.
|
179 |
-
* Enhancement: Support more CSS3 properties when cleaning "Custom CSS" code.
|
180 |
-
* Updated external libraries (CodeMirror, DataTables, Build tools).
|
181 |
-
* Added Korean translation.
|
182 |
-
* Updated several translations (Chinese (Taiwan), English, German).
|
183 |
-
* Many internal changes and fixes for better stability, cleaner code, and documentation.
|
184 |
-
* TablePress 1.6 requires WordPress 4.2!
|
185 |
-
|
186 |
-
= Version 1.5.1 =
|
187 |
-
* Bugfix: Some properties in Custom CSS code were erroneously removed.
|
188 |
-
* Updated the Spanish translation.
|
189 |
-
|
190 |
-
= Version 1.5 =
|
191 |
-
* Full compatibility with WordPress 4.0
|
192 |
-
* Feature: Support for the new Media Manager when inserting images
|
193 |
-
* Feature: Support for the integrated WP importer/exporter
|
194 |
-
* Bugfix: The "Insert Link" dialog in the "Advanced Editor" works now.
|
195 |
-
* Bugfix: Moving the admin menu entry somewhere else was broken in rare cases.
|
196 |
-
* Bugfix: The HTML export creates valid HTML files now.
|
197 |
-
* Enhancement: Tables are now stored with extra information about the format, so that other plugins are less likely to break it.
|
198 |
-
* Extended unit tests for the plugin and some external libraries.
|
199 |
-
* Updated external libraries (CodeMirror, DataTables, Build tools).
|
200 |
-
* Added Ukrainian translation.
|
201 |
-
* Updated several translations (Chinese (Simplified), Dutch, English, French, German, Hebrew, Italian, Japanese, Russian, Turkish).
|
202 |
-
* Added and updated more language files for the DataTables library.
|
203 |
-
* TablePress 1.5 requires WordPress 4.0!
|
204 |
-
|
205 |
-
= Version 1.4 =
|
206 |
-
* Compatibility with WordPress 3.9
|
207 |
-
* Bugfix: Determine the correct Worksheet ID during XLSX import
|
208 |
-
* Bugfix: Displaying empty Shortcodes was broken
|
209 |
-
* Enhancement: Improve JSON import to also allow import of JSON objects
|
210 |
-
* Enhancement: Use more sophisticated error handling and debugging
|
211 |
-
* Enhancement: Reduce memory usage when loading tables
|
212 |
-
* Added inline documentation to all plugin filter and action hooks
|
213 |
-
* Updated external libraries
|
214 |
-
* Internal improvements to coding standards, inline documentation, and build tools
|
215 |
-
* Added Serbian translation
|
216 |
-
* Updated several translations (Chinese (Simplified), Croatian, German, Spanish)
|
217 |
-
|
218 |
-
= Version 1.3 =
|
219 |
-
* Compatibility with WordPress 3.8 and the new admin styling
|
220 |
-
* Bugfix: Import of JSON files did not take row/column visibility into account
|
221 |
-
* Bugfix: File names of exported files were sometimes broken
|
222 |
-
* Bugfix: Translations for some strings were not loaded properly
|
223 |
-
* Enhancement: Don't search for tables outside of the main search query
|
224 |
-
* Enhancement: Broken tables are now skipped
|
225 |
-
* Updated external libraries
|
226 |
-
* Added Chinese (Taiwan) translation
|
227 |
-
* Internal improvements to coding standards, inline documentation, and build tools
|
228 |
-
* TablePress 1.3 requires WordPress 3.8!
|
229 |
-
|
230 |
-
= Version 1.2 =
|
231 |
-
* Compatibility with WordPress 3.7
|
232 |
-
* Bugfix: WordPress search did not find tables in some cases
|
233 |
-
* Bugfix: Cells were sometimes erroneously interpreted as formulas
|
234 |
-
* Bugfix: HTML export did not encode entities properly
|
235 |
-
* Bugfix: Wrong variable name in table render code
|
236 |
-
* Enhancement: Add logarithm to math functions for formulas
|
237 |
-
* Enhancement: Better internal code documentation and variable type checks
|
238 |
-
* Enhancement: Add parameter to Shortcode that allows showing debug information
|
239 |
-
* Updated external libraries
|
240 |
-
* Updated several translations (Brazilian Portuguese, Czech, French, German, Latvian)
|
241 |
-
* Many more internal code improvements
|
242 |
-
* TablePress 1.2 requires WordPress 3.6!
|
243 |
-
|
244 |
-
= Version 1.1.1 =
|
245 |
-
* Fixed a bug with CSS handling that broke some TablePress Extensions
|
246 |
-
|
247 |
-
= Version 1.1 =
|
248 |
-
* Experimental import for Excel files (.xls and .xlsx)
|
249 |
-
* More math functions in formulas (including if-conditionals, statistical functions, ...)
|
250 |
-
* Better "Custom CSS" saving for higher performance
|
251 |
-
* Bugfix: Encoding problem during HTML import
|
252 |
-
* Bugfix: Roles are now deleted during uninstallation
|
253 |
-
* Bugfix: Search for tables was broken, if Shortcode had been changed
|
254 |
-
* Plugin Unit Tests for automated code testing
|
255 |
-
* Added several new translations (Brazilian Portuguese, Czech, Dutch, Finnish, Hebrew, Icelandic, Italian, Japanese, Latvian, Russian, and Turkish)
|
256 |
-
* Many more internal improvements of code and usability
|
257 |
-
* Updated external libraries
|
258 |
-
|
259 |
-
= Version 1.0 =
|
260 |
-
Official release with a few fixes and many enhancements and improvements
|
261 |
-
|
262 |
-
= Version 0.9-RC =
|
263 |
-
Release candidate in which all intended features are included and very stable.
|
264 |
-
|
265 |
-
= Version 0.8.1-beta =
|
266 |
-
Initial version where most features are ready and pretty stable.
|
267 |
-
|
268 |
== Upgrade Notice ==
|
269 |
|
270 |
-
= 1.
|
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 |
-
|
276 |
-
= 1.9 =
|
277 |
-
This update includes several new features, enhancements, and bugfixes. Updating is recommended.
|
278 |
-
|
279 |
-
= 1.8.1 =
|
280 |
-
This update is a stability, security, and maintenance release. Updating is highly recommended.
|
281 |
-
|
282 |
-
= 1.8 =
|
283 |
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
284 |
|
285 |
-
= 1.
|
286 |
-
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
287 |
-
|
288 |
-
= 1.6.1 =
|
289 |
-
This update fixes an issue with the JavaScript features after the update to WordPress 4.3.
|
290 |
-
|
291 |
-
= 1.6 =
|
292 |
-
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
293 |
-
|
294 |
-
= 1.5.1 =
|
295 |
-
This update includes several new features, enhancements, and bugfixes. Updating is recommended.
|
296 |
-
|
297 |
-
= 1.5 =
|
298 |
-
This update includes several new features, enhancements, and bugfixes. Updating is recommended.
|
299 |
-
|
300 |
-
= 1.4 =
|
301 |
-
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
302 |
-
|
303 |
-
= 1.3 =
|
304 |
-
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
305 |
-
|
306 |
-
= 1.2 =
|
307 |
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
308 |
-
|
309 |
-
= 1.1.1 =
|
310 |
-
This upgrade includes several new features, enhancements, and bugfixes, and is a recommended maintenance release.
|
311 |
-
|
312 |
-
= 1.1 =
|
313 |
-
This upgrade includes several new features, enhancements, and bugfixes, and is a recommended maintenance release.
|
314 |
-
|
315 |
-
= 1.0 =
|
316 |
-
This release contains a few bug fixed and many enhancements and new features, and is a recommended update.
|
317 |
-
|
318 |
-
= 0.9-RC =
|
319 |
-
This release contains many enhancements and bug fixes.
|
1 |
=== TablePress ===
|
2 |
Contributors: TobiasBg
|
3 |
Donate link: https://tablepress.org/donate/
|
4 |
+
Tags: table,spreadsheet,data,csv,excel,html,tables
|
5 |
+
Requires at least: 5.3
|
6 |
+
Requires PHP: 5.6.20
|
7 |
+
Tested up to: 5.3
|
8 |
+
Stable tag: 1.10
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
16 |
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.
|
17 |
|
18 |
= More information =
|
19 |
+
Please visit the plugin website at [tablepress.org](https://tablepress.org/) for more information or a [demo](https://tablepress.org/demo/). For latest news, [follow @TablePress](https://twitter.com/TablePress) on Twitter.
|
20 |
|
21 |
= Supporting future development =
|
22 |
If you like TablePress, please rate and review it here in the WordPress Plugin Directory or support it with your [donation](https://tablepress.org/donate/). Thank you!
|
37 |
|
38 |
== Installation ==
|
39 |
|
40 |
+
The easiest way to install TablePress is via your WordPress Dashboard. Go to the "Plugins" screen, click "Add New", and search for "TablePress" in the WordPress Plugin Directory. Then, click "Install Now" and wait a moment. Finally, click "Activate" and start using the plugin!
|
41 |
|
42 |
Manual installation works just as for other WordPress plugins:
|
43 |
|
44 |
1. [Download](https://downloads.wordpress.org/plugin/tablepress.latest-stable.zip) and extract the ZIP file.
|
45 |
+
1. Move the folder "tablepress" to the "wp-content/plugins/" directory of your WordPress installation, e.g. via FTP.
|
46 |
1. Activate the plugin "TablePress" on the "Plugins" screen of your WordPress Dashboard.
|
47 |
1. Create and manage tables by going to the "TablePress" screen in the admin menu.
|
48 |
+
1. To insert a table into a post or page, copy its Shortcode `[table id=<ID> /]` and paste it into a "Shortcode" block at the desired place in the block editor. Each table has a unique ID that needs to be adjusted in that Shortcode.
|
49 |
1. You can change the table styling by using CSS code, which can be entered into the "Custom CSS" textarea on the "Plugin Options" screen.
|
50 |
|
51 |
== Frequently Asked Questions ==
|
57 |
For support questions, bug reports, or feature requests, please use the [WordPress Support Forums](https://wordpress.org/support/plugin/tablepress). Please search through the forums first, and only [create a new topic](https://wordpress.org/support/plugin/tablepress#new-post) if you don't find an existing answer. Thank you!
|
58 |
|
59 |
= Requirements? =
|
60 |
+
In short: WordPress 5.3 or higher, while the latest version of WordPress is always recommended.
|
61 |
|
62 |
= Languages and Localization? =
|
63 |
+
TablePress uses the ["Translate WordPress" platform](https://translate.wordpress.org/). Please see the sidebar on the TablePress page in the [WordPress Plugin Directory](https://wordpress.org/plugins/tablepress/) for available translations.
|
64 |
|
65 |
+
To make TablePress available in your language, go to the [TablePress translations page](https://translate.wordpress.org/projects/wp-plugins/tablepress), log in with a free wordpress.org account and start translating.
|
|
|
|
|
66 |
|
67 |
= Migration from WP-Table Reloaded =
|
68 |
+
Several years ago, TablePress has superseded the now discontinued WP-Table Reloaded plugin. If you are still using that, please see the [migration guide](https://tablepress.org/migration-from-wp-table-reloaded/) and switch to TablePress.
|
|
|
69 |
|
70 |
= Development =
|
71 |
You can follow the development of TablePress more closely in its official [GitHub repository](https://github.com/TobiasBg/TablePress).
|
76 |
== Usage ==
|
77 |
|
78 |
After installing the plugin, you can create and manage tables on the "TablePress" screen in the WordPress Dashboard.
|
|
|
79 |
|
80 |
+
To show one of your tables in a post or on a page, embed the Shortcode `[table id=<the-ID> /]` into a "Shortcode" block at the desired place in the block editor. Each table has a unique ID that needs to be adjusted in that Shortcode.
|
|
|
81 |
|
82 |
After that, you might want to change the styling of the table. You can do this by entering CSS commands into the "Custom CSS" textarea on the "Plugin Options" screen. Some examples for common styling changes can be found on the [TablePress FAQ page](https://tablepress.org/faq/).
|
83 |
You may also add certain features (like sorting, pagination, filtering, alternating row colors, row highlighting, print name and/or description, ...) by enabling the corresponding checkboxes on a table's "Edit" screen.
|
95 |
|
96 |
== Changelog ==
|
97 |
|
98 |
+
Recent changes are shown below. For earlier changes, please see the [changelog history](https://tablepress.org/info/#changelog).
|
99 |
+
|
100 |
+
= Version 1.10 =
|
101 |
+
* Full compatibility with WordPress 5.3
|
102 |
+
* Enhancement: Allow importing with replacing/appending existing tables with ZIP archives of JSON files.
|
103 |
+
* Enhancement: Greatly enhance the code quality by removing old code and using modern features of PHP.
|
104 |
+
* Enhancement: Flush the caches of more caching plugins when the "Custom CSS" was modified.
|
105 |
+
* Enhancement: Update list of allowed CSS features in "Custom CSS".
|
106 |
+
* Enhancement: Add more math formulas to the formula parser.
|
107 |
+
* Bugfix: Restore correct behavior when moving columns on the "Edit" screen.
|
108 |
+
* Bugfix: Properly hide text that is intended for screen readers only.
|
109 |
+
* Updated external libraries (DataTables, SimpleXLSX, CSSTidy, Build tools).
|
110 |
+
* Some internal changes for better stability, security, translations, and documentation.
|
111 |
+
* Removed the migration/import code for the discontinued WP-Table Reloaded plugin.
|
112 |
+
* TablePress 1.10 requires WordPress 5.3!
|
113 |
+
|
114 |
= Version 1.9.2 =
|
115 |
* Compatibility with WordPress 5.1
|
116 |
* Enhancement: Make the save process more robust against data corruption.
|
117 |
* Minor internal changes on CSS and typos in the documentation.
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
== Upgrade Notice ==
|
120 |
|
121 |
+
= 1.10 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
123 |
|
124 |
+
= 1.9.2 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
This update is a stability, maintenance, and compatibility release. Updating is recommended.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tablepress.php
CHANGED
@@ -4,39 +4,37 @@
|
|
4 |
*
|
5 |
* @package TablePress
|
6 |
* @author Tobias Bäthge
|
7 |
-
* @version 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.2
|
15 |
-
Author: Tobias Bäthge
|
16 |
-
Author URI: https://tobias.baethge.com/
|
17 |
-
Author email: wordpress@tobias.baethge.com
|
18 |
-
Text Domain: tablepress
|
19 |
-
Domain Path: /i18n
|
20 |
-
License: GPL 2
|
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
|
28 |
-
published by the Free Software Foundation.
|
29 |
-
|
30 |
-
This program is distributed in the hope that it will be useful,
|
31 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
32 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
33 |
-
GNU General Public License for more details.
|
34 |
-
|
35 |
-
You should have received a copy of the GNU General Public License
|
36 |
-
along with this program; if not, write to the Free Software
|
37 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
38 |
-
*/
|
39 |
-
|
40 |
// Prohibit direct script loading.
|
41 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
42 |
|
@@ -49,19 +47,20 @@ if ( ! defined( 'TABLEPRESS__FILE__' ) ) {
|
|
49 |
define( 'TABLEPRESS__FILE__', __FILE__ );
|
50 |
}
|
51 |
|
|
|
|
|
|
|
|
|
52 |
if ( ! defined( 'TABLEPRESS_BASENAME' ) ) {
|
53 |
define( 'TABLEPRESS_BASENAME', plugin_basename( TABLEPRESS__FILE__ ) );
|
54 |
}
|
55 |
|
56 |
/*
|
57 |
* Define global JSON encoding options that TablePress uses.
|
58 |
-
* We don't escape slashes (anymore), which makes search/replace of URLs in the database much easier.
|
59 |
*/
|
60 |
if ( ! defined( 'TABLEPRESS_JSON_OPTIONS' ) ) {
|
61 |
$tablepress_json_options = 0;
|
62 |
-
|
63 |
-
$tablepress_json_options |= JSON_UNESCAPED_SLASHES; // Introduced in PHP 5.4.
|
64 |
-
}
|
65 |
define( 'TABLEPRESS_JSON_OPTIONS', $tablepress_json_options );
|
66 |
unset( $tablepress_json_options );
|
67 |
}
|
4 |
*
|
5 |
* @package TablePress
|
6 |
* @author Tobias Bäthge
|
7 |
+
* @version 1.10
|
8 |
+
*
|
9 |
+
*
|
10 |
+
* Plugin Name: TablePress
|
11 |
+
* Plugin URI: https://tablepress.org/
|
12 |
+
* Description: Embed beautiful and feature-rich tables into your posts and pages, without having to write code.
|
13 |
+
* Version: 1.10
|
14 |
+
* Requires at least: 5.3
|
15 |
+
* Requires PHP: 5.6.20
|
16 |
+
* Author: Tobias Bäthge
|
17 |
+
* Author URI: https://tobias.baethge.com/
|
18 |
+
* Author email: wordpress@tobias.baethge.com
|
19 |
+
* License: GPL 2
|
20 |
+
* Donate URI: https://tablepress.org/donate/
|
21 |
+
*
|
22 |
+
*
|
23 |
+
* Copyright 2012-2019 Tobias Bäthge
|
24 |
+
*
|
25 |
+
* TablePress is free software: you can redistribute it and/or modify
|
26 |
+
* it under the terms of the GNU General Public License, version 2, as published by
|
27 |
+
* the Free Software Foundation.
|
28 |
+
*
|
29 |
+
* TablePress is distributed in the hope that it will be useful,
|
30 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
31 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
32 |
+
* GNU General Public License for more details.
|
33 |
+
*
|
34 |
+
* You should have received a copy of the GNU General Public License
|
35 |
+
* along with WordPress. If not, see https://www.gnu.org/licenses/gpl-2.0.html.
|
36 |
*/
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
// Prohibit direct script loading.
|
39 |
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
40 |
|
47 |
define( 'TABLEPRESS__FILE__', __FILE__ );
|
48 |
}
|
49 |
|
50 |
+
if ( ! defined( 'TABLEPRESS__DIR__' ) ) {
|
51 |
+
define( 'TABLEPRESS__DIR__', __DIR__ );
|
52 |
+
}
|
53 |
+
|
54 |
if ( ! defined( 'TABLEPRESS_BASENAME' ) ) {
|
55 |
define( 'TABLEPRESS_BASENAME', plugin_basename( TABLEPRESS__FILE__ ) );
|
56 |
}
|
57 |
|
58 |
/*
|
59 |
* Define global JSON encoding options that TablePress uses.
|
|
|
60 |
*/
|
61 |
if ( ! defined( 'TABLEPRESS_JSON_OPTIONS' ) ) {
|
62 |
$tablepress_json_options = 0;
|
63 |
+
$tablepress_json_options |= JSON_UNESCAPED_SLASHES; // Don't escape slashes to make search/replace of URLs in the database much easier.
|
|
|
|
|
64 |
define( 'TABLEPRESS_JSON_OPTIONS', $tablepress_json_options );
|
65 |
unset( $tablepress_json_options );
|
66 |
}
|
views/view-about.php
CHANGED
@@ -60,7 +60,7 @@ class TablePress_About_View extends TablePress_View {
|
|
60 |
?>
|
61 |
<p>
|
62 |
<?php _e( 'TablePress allows you to create and manage tables in the admin area of WordPress.', 'tablepress' ); ?>
|
63 |
-
<?php _e( 'Tables may contain text, numbers and even HTML (e.g. to include images or links).', 'tablepress' ); ?>
|
64 |
<?php _e( 'You can then show the tables in your posts, on your pages, or in text widgets by using a Shortcode.', 'tablepress' ); ?>
|
65 |
<?php _e( 'If you want to show your tables anywhere else in your theme, you can use a Template Tag function.', 'tablepress' ); ?>
|
66 |
</p>
|
@@ -82,20 +82,20 @@ class TablePress_About_View extends TablePress_View {
|
|
82 |
<?php _e( 'This means that you either let the plugin create an empty table for you or that you load an existing table from either a CSV, HTML, JSON, XLS, or XLSX file.', 'tablepress' ); ?>
|
83 |
</p>
|
84 |
<p>
|
85 |
-
<?php _e( 'Then you can edit your data or change the structure of your table (e.g. by inserting, deleting, moving, or swapping rows or columns or sorting them) and select specific table features like alternating row colors or whether to print the name or description, if you want.', 'tablepress' ); ?>
|
86 |
<?php _e( 'To easily add a link or an image to a cell, use the provided buttons.', 'tablepress' ); ?>
|
87 |
<?php _e( 'Those will ask you for the necessary information and corresponding HTML code will be added to the cell automatically.', 'tablepress' ); ?>
|
88 |
</p>
|
89 |
<p>
|
90 |
<label class="screen-reader-text" for="table-shortcode-inline"><?php esc_html_e( 'Shortcode text for editor', 'tablepress' ); ?></label>
|
91 |
-
<?php printf( __( 'To insert a table into a
|
92 |
-
<?php
|
93 |
</p>
|
94 |
<p>
|
95 |
<?php _e( 'Tables can be styled by changing and adding CSS commands.', 'tablepress' ); ?>
|
96 |
<?php _e( 'The plugin ships with default CSS stylesheets, which can be customized with own code or replaced with other stylesheets.', 'tablepress' ); ?>
|
97 |
<?php _e( 'For this, each table is given certain CSS classes that can be used as CSS selectors.', 'tablepress' ); ?>
|
98 |
-
<?php printf( __( 'Please see the <a href="%s">
|
99 |
</p>
|
100 |
<?php
|
101 |
}
|
@@ -111,8 +111,8 @@ class TablePress_About_View extends TablePress_View {
|
|
111 |
public function postbox_more_information( array $data, array $box ) {
|
112 |
?>
|
113 |
<p>
|
114 |
-
<?php printf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin
|
115 |
-
<?php printf( __( 'For technical information, please see the <a href="%s">
|
116 |
</p>
|
117 |
<?php
|
118 |
}
|
@@ -183,13 +183,12 @@ class TablePress_About_View extends TablePress_View {
|
|
183 |
<br />· Multisite: <?php echo is_multisite() ? 'yes' : 'no'; ?>
|
184 |
<br />· PHP: <?php echo phpversion(); ?>
|
185 |
<br />· mysqli Extension: <?php echo $mysqli ? 'true' : 'false'; ?>
|
186 |
-
<br />· mySQL (Server): <?php echo $mysqli ? mysqli_get_server_info( $GLOBALS['wpdb']->dbh ) :
|
187 |
-
<br />· mySQL (Client): <?php echo $mysqli ? mysqli_get_client_info( $GLOBALS['wpdb']->dbh ) :
|
188 |
<br />· ZIP support: <?php echo $data['zip_support_available'] ? 'yes' : 'no'; ?>
|
189 |
<br />· UTF-8 conversion: <?php echo ( function_exists( 'mb_detect_encoding' ) && function_exists( 'iconv' ) ) ? 'yes' : 'no'; ?>
|
190 |
<br />· WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?>
|
191 |
<br />· Server Memory Limit: <?php echo (int) @ini_get( 'memory_limit' ) . 'M'; ?>
|
192 |
-
<br />· Magic Quotes: <?php echo get_magic_quotes_gpc() ? 'on' : 'off'; ?>
|
193 |
<br />· WP_DEBUG: <?php echo WP_DEBUG ? 'true' : 'false'; ?>
|
194 |
<br />· WP_POST_REVISIONS: <?php echo is_bool( WP_POST_REVISIONS ) ? ( WP_POST_REVISIONS ? 'true' : 'false' ) : WP_POST_REVISIONS; ?>
|
195 |
</p>
|
60 |
?>
|
61 |
<p>
|
62 |
<?php _e( 'TablePress allows you to create and manage tables in the admin area of WordPress.', 'tablepress' ); ?>
|
63 |
+
<?php _e( 'Tables may contain text, numbers, and even HTML (e.g. to include images or links).', 'tablepress' ); ?>
|
64 |
<?php _e( 'You can then show the tables in your posts, on your pages, or in text widgets by using a Shortcode.', 'tablepress' ); ?>
|
65 |
<?php _e( 'If you want to show your tables anywhere else in your theme, you can use a Template Tag function.', 'tablepress' ); ?>
|
66 |
</p>
|
82 |
<?php _e( 'This means that you either let the plugin create an empty table for you or that you load an existing table from either a CSV, HTML, JSON, XLS, or XLSX file.', 'tablepress' ); ?>
|
83 |
</p>
|
84 |
<p>
|
85 |
+
<?php _e( 'Then, you can edit your data or change the structure of your table (e.g. by inserting, deleting, moving, or swapping rows or columns or sorting them) and select specific table features like alternating row colors or whether to print the name or description, if you want.', 'tablepress' ); ?>
|
86 |
<?php _e( 'To easily add a link or an image to a cell, use the provided buttons.', 'tablepress' ); ?>
|
87 |
<?php _e( 'Those will ask you for the necessary information and corresponding HTML code will be added to the cell automatically.', 'tablepress' ); ?>
|
88 |
</p>
|
89 |
<p>
|
90 |
<label class="screen-reader-text" for="table-shortcode-inline"><?php esc_html_e( 'Shortcode text for editor', 'tablepress' ); ?></label>
|
91 |
+
<?php printf( __( 'To insert a table into a post or page, copy its Shortcode %s and paste it into a “Shortcode” block at the desired place in the block editor.', 'tablepress' ), '<label class="screen-reader-text" for="table-shortcode-inline">' . esc_html__( 'Shortcode text for editor', 'tablepress' ) . '</label>' . '<input type="text" class="table-shortcode table-shortcode-inline" id="table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . ' id=<ID> /]' ) . '" readonly="readonly" />' ); ?>
|
92 |
+
<?php _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' ); ?>
|
93 |
</p>
|
94 |
<p>
|
95 |
<?php _e( 'Tables can be styled by changing and adding CSS commands.', 'tablepress' ); ?>
|
96 |
<?php _e( 'The plugin ships with default CSS stylesheets, which can be customized with own code or replaced with other stylesheets.', 'tablepress' ); ?>
|
97 |
<?php _e( 'For this, each table is given certain CSS classes that can be used as CSS selectors.', 'tablepress' ); ?>
|
98 |
+
<?php printf( __( 'Please see the <a href="%s">Documentation</a> for a list of these selectors and for styling examples.', 'tablepress' ), 'https://tablepress.org/documentation/' ); ?>
|
99 |
</p>
|
100 |
<?php
|
101 |
}
|
111 |
public function postbox_more_information( array $data, array $box ) {
|
112 |
?>
|
113 |
<p>
|
114 |
+
<?php printf( __( 'More information about TablePress can be found on the <a href="%1$s">plugin website</a> or on its page in the <a href="%2$s">WordPress Plugin Directory</a>.', 'tablepress' ), 'https://tablepress.org/', 'https://wordpress.org/plugins/tablepress/' ); ?>
|
115 |
+
<?php printf( __( 'For technical information, please see the <a href="%s">Documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' ); ?>
|
116 |
</p>
|
117 |
<?php
|
118 |
}
|
183 |
<br />· Multisite: <?php echo is_multisite() ? 'yes' : 'no'; ?>
|
184 |
<br />· PHP: <?php echo phpversion(); ?>
|
185 |
<br />· mysqli Extension: <?php echo $mysqli ? 'true' : 'false'; ?>
|
186 |
+
<br />· mySQL (Server): <?php echo $mysqli ? mysqli_get_server_info( $GLOBALS['wpdb']->dbh ) : '<em>no mysqli</em>'; ?>
|
187 |
+
<br />· mySQL (Client): <?php echo $mysqli ? mysqli_get_client_info( $GLOBALS['wpdb']->dbh ) : '<em>no mysqli</em>'; ?>
|
188 |
<br />· ZIP support: <?php echo $data['zip_support_available'] ? 'yes' : 'no'; ?>
|
189 |
<br />· UTF-8 conversion: <?php echo ( function_exists( 'mb_detect_encoding' ) && function_exists( 'iconv' ) ) ? 'yes' : 'no'; ?>
|
190 |
<br />· WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?>
|
191 |
<br />· Server Memory Limit: <?php echo (int) @ini_get( 'memory_limit' ) . 'M'; ?>
|
|
|
192 |
<br />· WP_DEBUG: <?php echo WP_DEBUG ? 'true' : 'false'; ?>
|
193 |
<br />· WP_POST_REVISIONS: <?php echo is_bool( WP_POST_REVISIONS ) ? ( WP_POST_REVISIONS ? 'true' : 'false' ) : WP_POST_REVISIONS; ?>
|
194 |
</p>
|
views/view-add.php
CHANGED
@@ -75,12 +75,12 @@ class TablePress_Add_View extends TablePress_View {
|
|
75 |
<div class="form-wrap">
|
76 |
<div class="form-field">
|
77 |
<label for="table-name"><?php _e( 'Table Name', 'tablepress' ); ?>:</label>
|
78 |
-
<input type="text" name="table[name]" id="table-name"
|
79 |
<p><?php _e( 'The name or title of your table.', 'tablepress' ); ?></p>
|
80 |
</div>
|
81 |
<div class="form-field">
|
82 |
<label for="table-description"><?php _e( 'Description', 'tablepress' ); ?> <?php _e( '(optional)', 'tablepress' ); ?>:</label>
|
83 |
-
<textarea name="table[description]" id="table-description"
|
84 |
<p><?php _e( 'A description of the contents of your table.', 'tablepress' ); ?></p>
|
85 |
</div>
|
86 |
<div class="form-field form-required form-field-numbers-only form-field-small">
|
75 |
<div class="form-wrap">
|
76 |
<div class="form-field">
|
77 |
<label for="table-name"><?php _e( 'Table Name', 'tablepress' ); ?>:</label>
|
78 |
+
<input type="text" name="table[name]" id="table-name" value="" />
|
79 |
<p><?php _e( 'The name or title of your table.', 'tablepress' ); ?></p>
|
80 |
</div>
|
81 |
<div class="form-field">
|
82 |
<label for="table-description"><?php _e( 'Description', 'tablepress' ); ?> <?php _e( '(optional)', 'tablepress' ); ?>:</label>
|
83 |
+
<textarea name="table[description]" id="table-description" rows="4"></textarea>
|
84 |
<p><?php _e( 'A description of the contents of your table.', 'tablepress' ); ?></p>
|
85 |
</div>
|
86 |
<div class="form-field form-required form-field-numbers-only form-field-small">
|
views/view-edit.php
CHANGED
@@ -49,7 +49,6 @@ class TablePress_Edit_View extends TablePress_View {
|
|
49 |
'success_add' => __( 'The table was added successfully.', 'tablepress' ),
|
50 |
'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID “%s”.', 'tablepress' ), esc_html( $data['table']['id'] ) ),
|
51 |
'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
|
52 |
-
'success_import_wp_table_reloaded' => __( 'The table was imported successfully from WP-Table Reloaded.', 'tablepress' ),
|
53 |
'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
|
54 |
'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
|
55 |
'success_save_success_id_change' => __( 'The table was saved successfully, and the table ID was changed.', 'tablepress' ),
|
@@ -672,12 +671,8 @@ class TablePress_Edit_View extends TablePress_View {
|
|
672 |
public function textbox_head( array $data, array $box ) {
|
673 |
?>
|
674 |
<p>
|
675 |
-
<?php
|
676 |
-
<?php
|
677 |
-
</p>
|
678 |
-
<p>
|
679 |
-
<label class="screen-reader-only" for="table-shortcode-inline"><?php esc_html_e( 'Shortcode text for editor', 'tablepress' ); ?></label>
|
680 |
-
<?php printf( __( 'To insert the table into a page, post, or text widget, copy the Shortcode %s and paste it at the desired place in the editor.', 'tablepress' ), '<input type="text" id="table-shortcode-inline" class="table-shortcode table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . " id={$data['table']['id']} /]" ) . '" readonly="readonly" />' ); ?>
|
681 |
</p>
|
682 |
<?php
|
683 |
}
|
49 |
'success_add' => __( 'The table was added successfully.', 'tablepress' ),
|
50 |
'success_copy' => _n( 'The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress' ) . ' ' . sprintf( __( 'You are now seeing the copied table, which has the table ID “%s”.', 'tablepress' ), esc_html( $data['table']['id'] ) ),
|
51 |
'success_import' => __( 'The table was imported successfully.', 'tablepress' ),
|
|
|
52 |
'error_save' => __( 'Error: The table could not be saved.', 'tablepress' ),
|
53 |
'error_delete' => __( 'Error: The table could not be deleted.', 'tablepress' ),
|
54 |
'success_save_success_id_change' => __( 'The table was saved successfully, and the table ID was changed.', 'tablepress' ),
|
671 |
public function textbox_head( array $data, array $box ) {
|
672 |
?>
|
673 |
<p>
|
674 |
+
<?php _e( 'To edit the content or modify the structure of this table, use the input fields and buttons below.', 'tablepress' ); ?>
|
675 |
+
<?php printf( __( 'To insert a table into a post or page, copy its Shortcode %s and paste it into a “Shortcode” block at the desired place in the block editor.', 'tablepress' ), '<label class="screen-reader-text" for="table-shortcode-inline">' . esc_html__( 'Shortcode text for editor', 'tablepress' ) . '</label>' . '<input type="text" class="table-shortcode table-shortcode-inline" id="table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . " id={$data['table']['id']} /]" ) . '" readonly="readonly" />' ); ?>
|
|
|
|
|
|
|
|
|
676 |
</p>
|
677 |
<?php
|
678 |
}
|
views/view-editor_button_thickbox.php
CHANGED
@@ -75,23 +75,10 @@ body {
|
|
75 |
margin: 0 0 15px 15px;
|
76 |
}
|
77 |
|
78 |
-
/* Fix search field positioning */
|
79 |
-
#tablepress-page .search-box {
|
80 |
-
position: relative;
|
81 |
-
height: auto;
|
82 |
-
width: auto;
|
83 |
-
float: right;
|
84 |
-
clear: none;
|
85 |
-
margin: 0;
|
86 |
-
}
|
87 |
#tablepress-page .subtitle {
|
88 |
float: left;
|
89 |
padding: 10px 0 0;
|
90 |
}
|
91 |
-
#tablepress-page .search-box input[name="s"] {
|
92 |
-
float: left;
|
93 |
-
width: auto;
|
94 |
-
}
|
95 |
|
96 |
/* Fix pagination layout */
|
97 |
#tablepress-page .tablenav-pages {
|
@@ -119,7 +106,7 @@ body {
|
|
119 |
font-weight: bold;
|
120 |
}
|
121 |
.tablepress-editor-button-list thead .column-table_action {
|
122 |
-
width: 150px;
|
123 |
}
|
124 |
/* Responsiveness on the All Tables screen */
|
125 |
@media screen and (max-width: 782px) {
|
@@ -134,37 +121,24 @@ body {
|
|
134 |
background: transparent;
|
135 |
border: none;
|
136 |
color: #333333;
|
137 |
-
width:
|
138 |
margin: 0;
|
139 |
padding: 0;
|
140 |
font-weight: bold;
|
141 |
-
font-size: 14px;
|
142 |
-
-webkit-box-shadow: none;
|
143 |
box-shadow: none;
|
144 |
text-align: center;
|
145 |
-
vertical-align: top;
|
146 |
-
}
|
147 |
-
#tablepress-page .table-shortcode {
|
148 |
-
cursor: text;
|
149 |
}
|
150 |
<?php if ( is_rtl() ) : ?>
|
151 |
/* RTL CSS */
|
152 |
body.rtl {
|
153 |
margin: 0 15px 15px 0;
|
154 |
}
|
155 |
-
.rtl #tablepress-page .search-box {
|
156 |
-
float: left;
|
157 |
-
}
|
158 |
.rtl #tablepress-page .subtitle {
|
159 |
float: right;
|
160 |
}
|
161 |
-
.rtl #tablepress-page .search-box input[name="s"] {
|
162 |
-
float: right;
|
163 |
-
}
|
164 |
.rtl #tablepress-page .table-shortcode-inline {
|
165 |
width: 125px;
|
166 |
font-size: 13px;
|
167 |
-
vertical-align: baseline;
|
168 |
}
|
169 |
<?php endif; ?>
|
170 |
</style>
|
75 |
margin: 0 0 15px 15px;
|
76 |
}
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
#tablepress-page .subtitle {
|
79 |
float: left;
|
80 |
padding: 10px 0 0;
|
81 |
}
|
|
|
|
|
|
|
|
|
82 |
|
83 |
/* Fix pagination layout */
|
84 |
#tablepress-page .tablenav-pages {
|
106 |
font-weight: bold;
|
107 |
}
|
108 |
.tablepress-editor-button-list thead .column-table_action {
|
109 |
+
min-width: 150px;
|
110 |
}
|
111 |
/* Responsiveness on the All Tables screen */
|
112 |
@media screen and (max-width: 782px) {
|
121 |
background: transparent;
|
122 |
border: none;
|
123 |
color: #333333;
|
124 |
+
width: 120px;
|
125 |
margin: 0;
|
126 |
padding: 0;
|
127 |
font-weight: bold;
|
|
|
|
|
128 |
box-shadow: none;
|
129 |
text-align: center;
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
<?php if ( is_rtl() ) : ?>
|
132 |
/* RTL CSS */
|
133 |
body.rtl {
|
134 |
margin: 0 15px 15px 0;
|
135 |
}
|
|
|
|
|
|
|
136 |
.rtl #tablepress-page .subtitle {
|
137 |
float: right;
|
138 |
}
|
|
|
|
|
|
|
139 |
.rtl #tablepress-page .table-shortcode-inline {
|
140 |
width: 125px;
|
141 |
font-size: 13px;
|
|
|
142 |
}
|
143 |
<?php endif; ?>
|
144 |
</style>
|
views/view-import.php
CHANGED
@@ -20,14 +20,6 @@ defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
|
|
20 |
*/
|
21 |
class TablePress_Import_View extends TablePress_View {
|
22 |
|
23 |
-
/**
|
24 |
-
* List of WP feature pointers for this view.
|
25 |
-
*
|
26 |
-
* @since 1.0.0
|
27 |
-
* @var array
|
28 |
-
*/
|
29 |
-
protected $wp_pointers = array( 'tp100_wp_table_reloaded_import' );
|
30 |
-
|
31 |
/**
|
32 |
* Set up the view with data and do things that are specific for this view.
|
33 |
*
|
@@ -39,11 +31,7 @@ class TablePress_Import_View extends TablePress_View {
|
|
39 |
public function setup( $action, array $data ) {
|
40 |
parent::setup( $action, $data );
|
41 |
|
42 |
-
$this->admin_page->enqueue_script( 'import', array( 'jquery-core' )
|
43 |
-
'import' => array(
|
44 |
-
'error_wp_table_reloaded_nothing_selected' => __( 'Error: You did not select what to import from WP-Table Reloaded!', 'tablepress' ),
|
45 |
-
),
|
46 |
-
) );
|
47 |
|
48 |
$this->process_action_messages( array(
|
49 |
'error_import' => __( 'Error: The import failed.', 'tablepress' ),
|
@@ -53,34 +41,10 @@ class TablePress_Import_View extends TablePress_View {
|
|
53 |
'error_import_no_existing_id' => __( 'Error: You selected to replace or append to an existing table, but did not select a table.', 'tablepress' ),
|
54 |
'error_import_source_invalid' => __( 'Error: The source for the import is invalid or could not be accessed.', 'tablepress' ),
|
55 |
'error_import_data' => __( 'Error: The data for the import is invalid.', 'tablepress' ),
|
56 |
-
'error_wp_table_reloaded_nothing_selected' => __( 'Error: You did not select what to import from WP-Table Reloaded!', 'tablepress' ),
|
57 |
-
'error_wp_table_reloaded_not_installed' => __( 'Error: Existing WP-Table Reloaded tables were not found in the database.', 'tablepress' ),
|
58 |
-
'error_import_wp_table_reloaded' => __( 'Error: The tables from WP-Table Reloaded could not be imported.', 'tablepress' ),
|
59 |
-
'error_wp_table_reloaded_dump_file' => __( 'Error: The WP-Table Reloaded Dump File could not be imported!', 'tablepress' ),
|
60 |
) );
|
61 |
|
62 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
63 |
$this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( $this, 'postbox_import_form' ), 'normal' );
|
64 |
-
if ( current_user_can( 'tablepress_import_tables_wptr' ) ) {
|
65 |
-
$this->add_meta_box( 'import-wp-table-reloaded', __( 'Import from WP-Table Reloaded', 'tablepress' ), array( $this, 'postbox_wp_table_reloaded_import' ), 'additional' );
|
66 |
-
}
|
67 |
-
|
68 |
-
add_filter( 'default_hidden_meta_boxes', array( $this, 'hide_import_wptr_postbox' ), 10, 2 );
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Hide the "Import from WP-Table Reloaded postbox" by default, if WP-Table Reloaded is not installed. It can still be opened manually from the "Screen Options".
|
73 |
-
*
|
74 |
-
* @since 1.0.0
|
75 |
-
*/
|
76 |
-
public function hide_import_wptr_postbox( $hidden, $screen ) {
|
77 |
-
if ( 'tablepress_import' !== $screen->id ) {
|
78 |
-
return $hidden;
|
79 |
-
}
|
80 |
-
if ( ! $this->data['wp_table_reloaded_installed'] ) {
|
81 |
-
$hidden[] = 'tablepress_import-import-wp-table-reloaded';
|
82 |
-
}
|
83 |
-
return $hidden;
|
84 |
}
|
85 |
|
86 |
/**
|
@@ -95,16 +59,13 @@ class TablePress_Import_View extends TablePress_View {
|
|
95 |
?>
|
96 |
<p>
|
97 |
<?php _e( 'TablePress can import tables from existing data, like from a CSV, XLS, or XLSX file from a spreadsheet application (e.g. Excel), an HTML file resembling a webpage, or its own JSON format.', 'tablepress' ); ?>
|
98 |
-
<?php _e( 'You can also import existing tables from the WP-Table Reloaded plugin below.', 'tablepress' ); ?>
|
99 |
</p>
|
100 |
<p>
|
|
|
101 |
<?php
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
_e( 'You can also choose to import it as a new table, to replace an existing table, or to append the rows to an existing table.', 'tablepress' );
|
106 |
-
}
|
107 |
-
|
108 |
?>
|
109 |
</p>
|
110 |
<?php
|
@@ -231,80 +192,4 @@ class TablePress_Import_View extends TablePress_View {
|
|
231 |
<?php
|
232 |
}
|
233 |
|
234 |
-
/**
|
235 |
-
* Print the content of the "Import from WP-Table Reloaded" post meta box.
|
236 |
-
*
|
237 |
-
* @since 1.0.0
|
238 |
-
*
|
239 |
-
* @param array $data Data for this screen.
|
240 |
-
* @param array $box Information about the meta box.
|
241 |
-
*/
|
242 |
-
public function postbox_wp_table_reloaded_import( array $data, array $box ) {
|
243 |
-
?>
|
244 |
-
<p>
|
245 |
-
<?php _e( 'To import all tables from a WP-Table Reloaded installation, choose the relevant import source below.', 'tablepress' ); ?>
|
246 |
-
<br />
|
247 |
-
<?php _e( 'If WP-Table Reloaded is installed on this site, the “WordPress database” option is recommended.', 'tablepress' ); ?>
|
248 |
-
<?php _e( 'If you want to import tables from another site, create a “WP-Table Reloaded Dump File” there and upload it below, after choosing “WP-Table Reloaded Dump File”.', 'tablepress' ); ?>
|
249 |
-
<br />
|
250 |
-
<?php printf( __( 'Before doing this, it is highly recommended to read the <a href="%s">migration guide</a> on the TablePress website.', 'tablepress' ), 'https://tablepress.org/migration-from-wp-table-reloaded/' ); ?>
|
251 |
-
</p>
|
252 |
-
<table class="tablepress-postbox-table fixed">
|
253 |
-
<tbody>
|
254 |
-
<tr id="row-import-wp-table-reloaded-source">
|
255 |
-
<th class="column-1" scope="row"><?php _e( 'Import Source', 'tablepress' ); ?>:</th>
|
256 |
-
<td class="column-2">
|
257 |
-
<label for="import-wp-table-reloaded-source-db"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-db" type="radio" value="db" <?php
|
258 |
-
checked( $data['import_wp_table_reloaded_source'], 'db', true );
|
259 |
-
disabled( $data['wp_table_reloaded_installed'], false, true );
|
260 |
-
?> /> <?php _e( 'WordPress database', 'tablepress' ); ?></label>
|
261 |
-
<label for="import-wp-table-reloaded-source-dump-file"><input name="import[wp_table_reloaded][source]" id="import-wp-table-reloaded-source-dump-file" type="radio" value="dump-file"<?php checked( $data['import_wp_table_reloaded_source'], 'dump-file', true ); ?> /> <?php _e( 'WP-Table Reloaded Dump File', 'tablepress' ); ?></label>
|
262 |
-
</td>
|
263 |
-
</tr>
|
264 |
-
<tr id="row-import-wp-table-reloaded-source-dump-file" class="bottom-border">
|
265 |
-
<th class="column-1 top-align" scope="row"><label for="tables-import-wp-table-reloaded-dump-file"><?php _e( 'Select file', 'tablepress' ); ?>:</label></th>
|
266 |
-
<td class="column-2">
|
267 |
-
<input name="import_wp_table_reloaded_file_upload" id="tables-import-wp-table-reloaded-dump-file" type="file" class="large-text" style="box-sizing: border-box;" />
|
268 |
-
</td>
|
269 |
-
</tr>
|
270 |
-
<tr id="row-import-wp-table-reloaded-source-db" class="bottom-border">
|
271 |
-
<td class="column-1 top-align" scope="row" style="padding:2px;"></td>
|
272 |
-
<td class="column-2" style="padding:2px;"></td>
|
273 |
-
</tr>
|
274 |
-
<tr class="top-border">
|
275 |
-
<th class="column-1" scope="row"><?php _e( 'Import tables', 'tablepress' ); ?>:</th>
|
276 |
-
<td class="column-2"><label for="import-wp-table-reloaded-tables"> <input type="checkbox" id="import-wp-table-reloaded-tables" name="import[wp_table_reloaded][tables]" value="true" checked="checked" /> <?php _e( 'Import all tables and their settings from WP-Table Reloaded.', 'tablepress' ); ?> <span class="description"><?php _e( '(recommended)', 'tablepress' ); ?></span></label></td>
|
277 |
-
</tr>
|
278 |
-
<tr class="bottom-border">
|
279 |
-
<th class="column-1" scope="row"><?php _e( 'Import styling', 'tablepress' ); ?>:</th>
|
280 |
-
<td class="column-2"><label for="import-wp-table-reloaded-css"> <input type="checkbox" id="import-wp-table-reloaded-css" name="import[wp_table_reloaded][css]" value="true" checked="checked" /> <?php _e( 'Try to automatically convert the “Custom CSS” code from the “Plugin Options” screen of WP-Table Reloaded.', 'tablepress' ); ?></label></td>
|
281 |
-
</tr>
|
282 |
-
<tr class="top-border">
|
283 |
-
<td class="column-1" scope="row"></td>
|
284 |
-
<td class="column-2"><input type="submit" value="<?php echo esc_attr_x( 'Import from WP-Table Reloaded', 'button', 'tablepress' ); ?>" class="button button-large" id="submit_wp_table_reloaded_import" name="submit_wp_table_reloaded_import" /></td>
|
285 |
-
</tr>
|
286 |
-
</tbody>
|
287 |
-
</table>
|
288 |
-
<?php
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Set the content for the WP feature pointer about the WP-Table Reloaded import feature.
|
293 |
-
*
|
294 |
-
* @since 1.0.0
|
295 |
-
*/
|
296 |
-
public function wp_pointer_tp100_wp_table_reloaded_import() {
|
297 |
-
if ( ! $this->data['wp_table_reloaded_installed'] ) {
|
298 |
-
return;
|
299 |
-
}
|
300 |
-
|
301 |
-
$content = '<h3>' . __( 'TablePress Feature: Import from WP-Table Reloaded', 'tablepress' ) . '</h3>';
|
302 |
-
$content .= '<p>' . __( 'You can import your existing tables and “Custom CSS” from WP-Table Reloaded into TablePress.', 'tablepress' ) . '</p>';
|
303 |
-
|
304 |
-
$this->admin_page->print_wp_pointer_js( 'tp100_wp_table_reloaded_import', '#tablepress_import-import-wp-table-reloaded', array(
|
305 |
-
'content' => $content,
|
306 |
-
'position' => array( 'edge' => 'bottom', 'align' => 'left', 'offset' => '16 -16' ),
|
307 |
-
) );
|
308 |
-
}
|
309 |
-
|
310 |
} // class TablePress_Import_View
|
20 |
*/
|
21 |
class TablePress_Import_View extends TablePress_View {
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
/**
|
24 |
* Set up the view with data and do things that are specific for this view.
|
25 |
*
|
31 |
public function setup( $action, array $data ) {
|
32 |
parent::setup( $action, $data );
|
33 |
|
34 |
+
$this->admin_page->enqueue_script( 'import', array( 'jquery-core' ) );
|
|
|
|
|
|
|
|
|
35 |
|
36 |
$this->process_action_messages( array(
|
37 |
'error_import' => __( 'Error: The import failed.', 'tablepress' ),
|
41 |
'error_import_no_existing_id' => __( 'Error: You selected to replace or append to an existing table, but did not select a table.', 'tablepress' ),
|
42 |
'error_import_source_invalid' => __( 'Error: The source for the import is invalid or could not be accessed.', 'tablepress' ),
|
43 |
'error_import_data' => __( 'Error: The data for the import is invalid.', 'tablepress' ),
|
|
|
|
|
|
|
|
|
44 |
) );
|
45 |
|
46 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
47 |
$this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( $this, 'postbox_import_form' ), 'normal' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
|
50 |
/**
|
59 |
?>
|
60 |
<p>
|
61 |
<?php _e( 'TablePress can import tables from existing data, like from a CSV, XLS, or XLSX file from a spreadsheet application (e.g. Excel), an HTML file resembling a webpage, or its own JSON format.', 'tablepress' ); ?>
|
|
|
62 |
</p>
|
63 |
<p>
|
64 |
+
<?php _e( 'To import a table, select and enter the import source in the following form.', 'tablepress' ); ?>
|
65 |
<?php
|
66 |
+
if ( 0 < $data['tables_count'] ) {
|
67 |
+
_e( 'You can also choose to import it as a new table, to replace an existing table, or to append the rows to an existing table.', 'tablepress' );
|
68 |
+
}
|
|
|
|
|
|
|
69 |
?>
|
70 |
</p>
|
71 |
<?php
|
192 |
<?php
|
193 |
}
|
194 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
} // class TablePress_Import_View
|
views/view-list.php
CHANGED
@@ -52,7 +52,7 @@ class TablePress_List_View extends TablePress_View {
|
|
52 |
$this->add_header_message(
|
53 |
'<strong><em>' . __( 'Welcome!', 'tablepress' ) . '</em></strong><br />'
|
54 |
. __( 'Thank you for using TablePress for the first time!', 'tablepress' ) . ' '
|
55 |
-
. sprintf( __( 'If you encounter any questions or problems, please visit the <a href="%1$s">FAQ</a>, the <a href="%2$s">
|
56 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'first_visit', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ),
|
57 |
'notice-info not-dismissible'
|
58 |
);
|
@@ -63,8 +63,7 @@ class TablePress_List_View extends TablePress_View {
|
|
63 |
'<strong><em>' . __( 'Attention!', 'tablepress' ) . '</em></strong><br />'
|
64 |
. __( 'You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.', 'tablepress' ) . '<br />'
|
65 |
. __( 'It is strongly recommended that you switch from WP-Table Reloaded to TablePress, which not only fixes many problems, but also has more and better features than WP-Table Reloaded.', 'tablepress' ) . '<br />'
|
66 |
-
. sprintf( __( 'Please follow the <a href="%s">migration guide</a> to move your tables and then deactivate WP-Table Reloaded!', 'tablepress' ), 'https://tablepress.org/migration-from-wp-table-reloaded/' )
|
67 |
-
. '<a href="' . TablePress::url( array( 'action' => 'import' ) ) . '" class="button button-primary button-large" style="color:#ffffff;margin-top:5px;">' . __( 'Import your tables from WP-Table Reloaded', 'tablepress' ) . '</a>',
|
68 |
'notice-error not-dismissible'
|
69 |
);
|
70 |
}
|
@@ -77,7 +76,7 @@ class TablePress_List_View extends TablePress_View {
|
|
77 |
. sprintf( _n( 'If everything works and you are satisfied with the results of managing your %s table, isn’t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn’t that worth a coffee or two?', $data['table_count'], 'tablepress' ), esc_html( $data['table_count'] ) ) . '<br />'
|
78 |
. sprintf( __( '<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software — things for which I spend countless hours of my free time! Thank you very much!', 'tablepress' ), 'https://tablepress.org/donate/' ) . '<br /><br />'
|
79 |
. __( 'Sincerely, Tobias', 'tablepress' ) . '<br /><br />'
|
80 |
-
. sprintf( '<a href="%s" target="_blank"><strong>%s</strong></a>', 'https://tablepress.org/donate/', __( 'Sure, I’ll buy you a coffee and support TablePress!', 'tablepress' ) ) . ' · '
|
81 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'already-donated' ), __( 'I already donated.', 'tablepress' ) ) . ' · '
|
82 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'maybe-later' ), __( 'No, thanks. Don’t ask again.', 'tablepress' ) ),
|
83 |
'notice-success not-dismissible'
|
@@ -110,7 +109,6 @@ class TablePress_List_View extends TablePress_View {
|
|
110 |
'error_delete_not_all_tables' => __( 'Notice: Not all selected tables could be deleted!', 'tablepress' ),
|
111 |
'error_copy_not_all_tables' => __( 'Notice: Not all selected tables could be copied!', 'tablepress' ),
|
112 |
'success_import' => __( 'The tables were imported successfully.', 'tablepress' ),
|
113 |
-
'success_import_wp_table_reloaded' => __( 'The tables were imported successfully from WP-Table Reloaded.', 'tablepress' ),
|
114 |
) );
|
115 |
|
116 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
@@ -183,14 +181,8 @@ class TablePress_List_View extends TablePress_View {
|
|
183 |
?>
|
184 |
<p>
|
185 |
<?php _e( 'This is a list of your tables.', 'tablepress' ); ?>
|
186 |
-
<?php
|
187 |
-
</p>
|
188 |
-
<p>
|
189 |
-
<label class="screen-reader-only" for="table-shortcode-inline"><?php esc_html_e( 'Shortcode text for editor', 'tablepress' ); ?></label>
|
190 |
-
|
191 |
-
<?php printf( __( 'To insert a table into a page, post, or text widget, copy its Shortcode %s and paste it at the desired place in the editor.', 'tablepress' ), '<input type="text" class="table-shortcode table-shortcode-inline" id="table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . ' id=<ID> /]' ) . '" readonly="readonly" />' ); ?>
|
192 |
<?php _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' ); ?>
|
193 |
-
<?php printf( __( 'You can also click the “%s” button in the editor toolbar to select and insert a table.', 'tablepress' ), __( 'Table', 'tablepress' ) ); ?>
|
194 |
</p>
|
195 |
<?php
|
196 |
}
|
@@ -450,7 +442,7 @@ class TablePress_All_Tables_List_Table extends WP_List_Table {
|
|
450 |
$row_actions['delete'] = sprintf( '<a href="%1$s" title="%2$s" class="delete-link">%3$s</a>', $delete_url, esc_attr( sprintf( __( 'Delete “%s”', 'tablepress' ), $item['name'] ) ), __( 'Delete', 'tablepress' ) );
|
451 |
}
|
452 |
if ( $user_can_preview_table ) {
|
453 |
-
$row_actions['table-preview'] = sprintf( '<a href="%1$s" title="%2$s"
|
454 |
}
|
455 |
|
456 |
return $row_text . $this->row_actions( $row_actions );
|
52 |
$this->add_header_message(
|
53 |
'<strong><em>' . __( 'Welcome!', 'tablepress' ) . '</em></strong><br />'
|
54 |
. __( 'Thank you for using TablePress for the first time!', 'tablepress' ) . ' '
|
55 |
+
. sprintf( __( 'If you encounter any questions or problems, please visit the <a href="%1$s">FAQ</a>, the <a href="%2$s">Documentation</a>, and the <a href="%3$s">Support</a> section on the <a href="%4$s">plugin website</a>.', 'tablepress' ), 'https://tablepress.org/faq/', 'https://tablepress.org/documentation/', 'https://tablepress.org/support/', 'https://tablepress.org/' ) . '<br /><br />'
|
56 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'first_visit', 'return' => 'list' ), __( 'Hide this message', 'tablepress' ) ),
|
57 |
'notice-info not-dismissible'
|
58 |
);
|
63 |
'<strong><em>' . __( 'Attention!', 'tablepress' ) . '</em></strong><br />'
|
64 |
. __( 'You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.', 'tablepress' ) . '<br />'
|
65 |
. __( 'It is strongly recommended that you switch from WP-Table Reloaded to TablePress, which not only fixes many problems, but also has more and better features than WP-Table Reloaded.', 'tablepress' ) . '<br />'
|
66 |
+
. sprintf( __( 'Please follow the <a href="%s">migration guide</a> to move your tables and then deactivate WP-Table Reloaded!', 'tablepress' ), 'https://tablepress.org/migration-from-wp-table-reloaded/' ),
|
|
|
67 |
'notice-error not-dismissible'
|
68 |
);
|
69 |
}
|
76 |
. sprintf( _n( 'If everything works and you are satisfied with the results of managing your %s table, isn’t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn’t that worth a coffee or two?', $data['table_count'], 'tablepress' ), esc_html( $data['table_count'] ) ) . '<br />'
|
77 |
. sprintf( __( '<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software — things for which I spend countless hours of my free time! Thank you very much!', 'tablepress' ), 'https://tablepress.org/donate/' ) . '<br /><br />'
|
78 |
. __( 'Sincerely, Tobias', 'tablepress' ) . '<br /><br />'
|
79 |
+
. sprintf( '<a href="%s" target="_blank" rel="noopener noreferrer"><strong>%s</strong></a>', 'https://tablepress.org/donate/', __( 'Sure, I’ll buy you a coffee and support TablePress!', 'tablepress' ) ) . ' · '
|
80 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'already-donated' ), __( 'I already donated.', 'tablepress' ) ) . ' · '
|
81 |
. $this->ajax_link( array( 'action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'maybe-later' ), __( 'No, thanks. Don’t ask again.', 'tablepress' ) ),
|
82 |
'notice-success not-dismissible'
|
109 |
'error_delete_not_all_tables' => __( 'Notice: Not all selected tables could be deleted!', 'tablepress' ),
|
110 |
'error_copy_not_all_tables' => __( 'Notice: Not all selected tables could be copied!', 'tablepress' ),
|
111 |
'success_import' => __( 'The tables were imported successfully.', 'tablepress' ),
|
|
|
112 |
) );
|
113 |
|
114 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
181 |
?>
|
182 |
<p>
|
183 |
<?php _e( 'This is a list of your tables.', 'tablepress' ); ?>
|
184 |
+
<?php printf( __( 'To insert a table into a post or page, copy its Shortcode %s and paste it into a “Shortcode” block at the desired place in the block editor.', 'tablepress' ), '<label class="screen-reader-text" for="table-shortcode-inline">' . esc_html__( 'Shortcode text for editor', 'tablepress' ) . '</label>' . '<input type="text" class="table-shortcode table-shortcode-inline" id="table-shortcode-inline" value="' . esc_attr( '[' . TablePress::$shortcode . ' id=<ID> /]' ) . '" readonly="readonly" />' ); ?>
|
|
|
|
|
|
|
|
|
|
|
185 |
<?php _e( 'Each table has a unique ID that needs to be adjusted in that Shortcode.', 'tablepress' ); ?>
|
|
|
186 |
</p>
|
187 |
<?php
|
188 |
}
|
442 |
$row_actions['delete'] = sprintf( '<a href="%1$s" title="%2$s" class="delete-link">%3$s</a>', $delete_url, esc_attr( sprintf( __( 'Delete “%s”', 'tablepress' ), $item['name'] ) ), __( 'Delete', 'tablepress' ) );
|
443 |
}
|
444 |
if ( $user_can_preview_table ) {
|
445 |
+
$row_actions['table-preview'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $preview_url, esc_attr( sprintf( __( 'Show a preview of “%s”', 'tablepress' ), $item['name'] ) ), __( 'Preview', 'tablepress' ) );
|
446 |
}
|
447 |
|
448 |
return $row_text . $this->row_actions( $row_actions );
|
views/view-options.php
CHANGED
@@ -52,12 +52,11 @@ class TablePress_Options_View extends TablePress_View {
|
|
52 |
'success_save' => __( 'Options saved successfully.', 'tablepress' ),
|
53 |
'success_save_error_custom_css' => __( 'Options saved successfully, but “Custom CSS” was not saved to file.', 'tablepress' ),
|
54 |
'error_save' => __( 'Error: Options could not be saved.', 'tablepress' ),
|
55 |
-
'success_import_wp_table_reloaded' => __( 'The WP-Table Reloaded “Custom CSS” was imported successfully.', 'tablepress' ),
|
56 |
) );
|
57 |
|
58 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
59 |
if ( current_user_can( 'tablepress_edit_options' ) ) {
|
60 |
-
$this->add_meta_box( 'frontend-options', __( 'Frontend Options', 'tablepress' ), array( $this, 'postbox_frontend_options' ), 'normal' );
|
61 |
}
|
62 |
$this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' );
|
63 |
$this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' );
|
@@ -78,16 +77,7 @@ class TablePress_Options_View extends TablePress_View {
|
|
78 |
public function textbox_head( array $data, array $box ) {
|
79 |
?>
|
80 |
<p>
|
81 |
-
<?php _e( 'TablePress has
|
82 |
-
</p>
|
83 |
-
<p>
|
84 |
-
<?php
|
85 |
-
if ( current_user_can( 'tablepress_edit_options' ) ) {
|
86 |
-
_e( 'Frontend Options influence the styling of tables in pages, posts, or text widgets, by defining which CSS code shall be loaded.', 'tablepress' );
|
87 |
-
echo '<br />';
|
88 |
-
}
|
89 |
-
_e( 'In the User Options, every TablePress user can choose the position of the plugin in his WordPress admin menu.', 'tablepress' );
|
90 |
-
?>
|
91 |
</p>
|
92 |
<?php
|
93 |
}
|
@@ -106,7 +96,7 @@ class TablePress_Options_View extends TablePress_View {
|
|
106 |
<tbody>
|
107 |
<tr>
|
108 |
<th class="column-1" scope="row"><label for="option-custom-css"><?php _e( 'Custom CSS', 'tablepress' ); ?></label>:</th>
|
109 |
-
<td class="column-2"><label for="option-use-custom-css"><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?> /> <?php _e( 'Load
|
110 |
</td>
|
111 |
</tr>
|
112 |
<tr>
|
@@ -119,7 +109,7 @@ class TablePress_Options_View extends TablePress_View {
|
|
119 |
echo ' ';
|
120 |
printf( __( 'You can get styling examples from the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' );
|
121 |
echo ' ';
|
122 |
-
printf( __( 'Information on available CSS selectors can be found in the <a href="%s">
|
123 |
echo ' ';
|
124 |
_e( 'Please note that invalid CSS code will be stripped, if it can not be corrected automatically.', 'tablepress' );
|
125 |
?>
|
52 |
'success_save' => __( 'Options saved successfully.', 'tablepress' ),
|
53 |
'success_save_error_custom_css' => __( 'Options saved successfully, but “Custom CSS” was not saved to file.', 'tablepress' ),
|
54 |
'error_save' => __( 'Error: Options could not be saved.', 'tablepress' ),
|
|
|
55 |
) );
|
56 |
|
57 |
$this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' );
|
58 |
if ( current_user_can( 'tablepress_edit_options' ) ) {
|
59 |
+
$this->add_meta_box( 'frontend-options', __( 'Frontend Options and Styling', 'tablepress' ), array( $this, 'postbox_frontend_options' ), 'normal' );
|
60 |
}
|
61 |
$this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' );
|
62 |
$this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' );
|
77 |
public function textbox_head( array $data, array $box ) {
|
78 |
?>
|
79 |
<p>
|
80 |
+
<?php _e( 'TablePress has some options which affect the plugin’s behavior in different areas.', 'tablepress' ); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
</p>
|
82 |
<?php
|
83 |
}
|
96 |
<tbody>
|
97 |
<tr>
|
98 |
<th class="column-1" scope="row"><label for="option-custom-css"><?php _e( 'Custom CSS', 'tablepress' ); ?></label>:</th>
|
99 |
+
<td class="column-2"><label for="option-use-custom-css"><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?> /> <?php _e( 'Load this “Custom CSS” code to change the table styling:', 'tablepress' ); ?></label>
|
100 |
</td>
|
101 |
</tr>
|
102 |
<tr>
|
109 |
echo ' ';
|
110 |
printf( __( 'You can get styling examples from the <a href="%s">FAQ</a>.', 'tablepress' ), 'https://tablepress.org/faq/' );
|
111 |
echo ' ';
|
112 |
+
printf( __( 'Information on available CSS selectors can be found in the <a href="%s">Documentation</a>.', 'tablepress' ), 'https://tablepress.org/documentation/' );
|
113 |
echo ' ';
|
114 |
_e( 'Please note that invalid CSS code will be stripped, if it can not be corrected automatically.', 'tablepress' );
|
115 |
?>
|