wpDataTables Lite - Version 2.0.9

Version Description

  • Feature: Added Gutenberg block the plugin is now Gutenberg optimized.
  • Feature: Added option to choose whether you want to keep the tables after deleting the plugin from the Plugins page (by default the tables will be saved in database after deleting the plugin).
  • Bug fixes and stability improvements.
  • Compatibility with WordPress 5.2.1 approved.
Download this release

Release Info

Developer wpDataTables
Plugin Icon 128x128 wpDataTables Lite
Version 2.0.9
Comparing to
See all releases

Code changes from version 2.0.8 to 2.0.9

assets/css/admin/admin.css CHANGED
@@ -6,6 +6,115 @@
6
src: url(../../fonts/wpdatatablesicons-base.eot?#iefix) format('embedded-opentype'), url(../../fonts/wpdatatablesicons-base.woff) format('woff'), url(../../fonts/wpdatatablesicons-base.ttf) format('truetype'), url(../../fonts/wpdatatablesicons-base.svg#wpdatatablesicons-base) format('svg');
7
}
8
9
/* Icons */
10
#toplevel_page_wpdatatables-administration div.wp-menu-image:before,
11
.toplevel_page_wpdatatables-administration .ui-dialog-titlebar-close:before {
@@ -19,8 +128,11 @@
19
-webkit-font-smoothing: antialiased;
20
}
21
22
- #toplevel_page_wpdatatables-administration div.wp-menu-image:before {
23
- content: "\e016";
24
}
25
26
.wpdt-c #pick-range-table-container { width: 100%; max-height: 400px; overflow: auto; }
@@ -41,15 +153,14 @@
41
background-color: #fdd;
42
}
43
44
- div.mce-widget button i.mce-i-wpdatatable:before{
45
- content: "\e016";
46
- font-family: 'WPDataTablesIcons' !important;
47
}
48
49
- div.mce-widget button i.mce-i-wpdatachart:before{
50
- content: "\f185";
51
- font: 400 20px/1 dashicons;
52
- }
53
54
.wpdt-c #formattingRules { padding: 10px }
55
6
src: url(../../fonts/wpdatatablesicons-base.eot?#iefix) format('embedded-opentype'), url(../../fonts/wpdatatablesicons-base.woff) format('woff'), url(../../fonts/wpdatatablesicons-base.ttf) format('truetype'), url(../../fonts/wpdatatablesicons-base.svg#wpdatatablesicons-base) format('svg');
7
}
8
9
+ .wdt-rating-notice {
10
+ position: relative;
11
+ overflow: hidden;
12
+ padding: 5px 10px 0;
13
+ border-left: none;
14
+ background: #fff;
15
+ font-size: 13px;
16
+ line-height: 2.1em;
17
+ }
18
+
19
+ .wdt-rating-buttons {
20
+ clear: both;
21
+ }
22
+
23
+ .wdt-rating-buttons li{
24
+ display: inline;
25
+ outline: none;
26
+ }
27
+
28
+ .wdt-rating-button {
29
+ font-size: 1rem;
30
+ line-height: 1.75;
31
+ padding: .2rem 1.5rem;
32
+ border-radius: 28px;
33
+ box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
34
+ text-transform: none;
35
+ position: relative;
36
+ transition: all .3s ease;
37
+ -webkit-box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
38
+ -moz-box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
39
+ color: #fff;
40
+ cursor: pointer;
41
+ margin: 0 0 0 10px;
42
+ display: inline-block;
43
+ box-sizing: border-box;
44
+ vertical-align: middle;
45
+ text-align: center;
46
+ text-decoration: none;
47
+ outline: 0 !important;
48
+ outline-color: #fff;
49
+ text-decoration: #fff;
50
+ }
51
+
52
+ h1.wdt-rating-heading {
53
+ font-size: 23px !important;
54
+ margin-top: 0 !important;
55
+ margin-bottom: 0 !important;
56
+ font-weight: 400 !important;
57
+ padding: 9px 0 4px 0 !important;
58
+ line-height: 29px !important;
59
+ color: #23282d !important;
60
+ }
61
+
62
+ .wdt-first-btn {
63
+ background-color: #008cff !important;
64
+ color: #fff !important;
65
+ }
66
+
67
+ a.wdt-other-btn, a.wdt-other-btn:hover {
68
+ color: #008cff;
69
+ }
70
+ a.wdt-first-btn:focus,
71
+ a.wdt-first-btn:visited,
72
+ a.wdt-first-btn:active,
73
+ a.wdt-other-btn:focus,
74
+ a.wdt-other-btn:visited,
75
+ a.wdt-other-btn:active
76
+ {
77
+ outline:0 !important;
78
+ box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
79
+ -webkit-box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
80
+ -moz-box-shadow: 0 2px 6px 0 rgba(122,122,122,.5);
81
+ }
82
+ .wdt-float-left {
83
+ float: left;
84
+ line-height: normal;
85
+ }
86
+ .wdt-rating-notice .wdt-rating-massage {
87
+ font-size: 15px;
88
+ margin: 3px 0;
89
+ }
90
+ .wdt-icon-rating {
91
+ margin-right: 5px;
92
+ }
93
+
94
+ .wdt-dismiss {
95
+ cursor: pointer;
96
+ }
97
+ .wdt-dismiss-dash {
98
+ position: absolute;
99
+ top: 0;
100
+ right: 0;
101
+ padding: 5px;
102
+ line-height: normal;
103
+ }
104
+
105
+ @media only screen and (max-width : 1025px) {
106
+ .wdt-rating-button {
107
+ margin: 10px 0 0 10px;
108
+ }
109
+ .wdt-float-left {
110
+ float: none;
111
+ text-align: center;
112
+ }
113
+ .wdt-rating-buttons {
114
+ text-align: center;
115
+ }
116
+
117
+ }
118
/* Icons */
119
#toplevel_page_wpdatatables-administration div.wp-menu-image:before,
120
.toplevel_page_wpdatatables-administration .ui-dialog-titlebar-close:before {
128
-webkit-font-smoothing: antialiased;
129
}
130
131
+ #toplevel_page_wpdatatables-administration div.wp-menu-image {
132
+ background-image: url(../../img/logo-large.png);
133
+ background-size: 25px 25px;
134
+ background-repeat: no-repeat;
135
+ background-position: center center;
136
}
137
138
.wpdt-c #pick-range-table-container { width: 100%; max-height: 400px; overflow: auto; }
153
background-color: #fdd;
154
}
155
156
+ div.mce-widget button i.mce-i-wpdatatable{
157
+ background-image: url(../../img/logo-large.png);
158
+ background-size: 23px 23px;
159
+ background-repeat: no-repeat;
160
+ background-position: center center;
161
}
162
163
+
164
165
.wpdt-c #formattingRules { padding: 10px }
166
assets/img/vc-charts-icon.png CHANGED
Binary file
assets/img/vc-icon.png CHANGED
Binary file
assets/js/gutenberg/wpdatatables-gutenberg-block.js ADDED
@@ -0,0 +1,177 @@
1
+ (function (wp) {
2
+
3
+ var el = wp.element.createElement;
4
+ var components = wp.components;
5
+ var blockControls = wp.editor.BlockControls;
6
+ var inspectorControls = wp.editor.InspectorControls;
7
+ var allTables = wpdatatables.data;
8
+
9
+ var tables = [];
10
+
11
+ if (allTables !== null){
12
+ for (var i = 0; i < allTables.length; i++) {
13
+ tables.push({
14
+ value: allTables[i].id,
15
+ text: allTables[i].name + ' (id: ' + allTables[i].id + ')'
16
+ })
17
+ }
18
+ } else {
19
+ tables = []
20
+ }
21
+
22
+ // Registering the Block for catalog shortcode
23
+ wp.blocks.registerBlockType('wpdatatables/wpdatatables-gutenberg-block', {
24
+ title: wpdatatables.title,
25
+ description: wpdatatables.description,
26
+ icon: el('svg', {width: '58', height: '47', viewBox: '0 0 58 47'},
27
+ el('path', {
28
+ style: {fill: '#008CFF'},
29
+ d: 'M0.179929715,11.7269973 L0.179929715,20.2720523 C0.179929715,21.9656668 1.56795894,23.3513514 3.26443911,23.3513514 L11.8239527,23.3513514 L11.8239527,31.8964063 C11.8239527,33.5900208 13.2119819,34.9757054 14.9084621,34.9757054 L23.4679757,34.9757054 L23.4679757,11.7269973 L0.179929715,11.7269973 Z'
30
+ }),
31
+ el('path', {
32
+ style: {fill: '#5DD3FF'},
33
+ transform: 'translate(11.823953, 0.000000)',
34
+ d: 'M41.8979193,0.102643303 L4.72958108,0.102643303 C2.13345233,0.102643303 0.025704245,2.20683101 0.025704245,4.7985744 L0.025704245,11.7269973 L11.6697272,11.7269973 L23.3137502,23.3513514 L23.3137502,11.7269973 L34.9577732,11.7269973 L34.9577732,23.3513514 L23.3137502,23.3513514 L45.2394712,45.2400356 C46.0877113,44.3932284 46.6275004,43.2128304 46.6275004,41.9041283 L46.6275004,4.7985744 C46.6017962,2.20683101 44.4940481,0.102643303 41.8979193,0.102643303 Z'
35
+ }),
36
+ el('path', {
37
+ style: {fill: '#5DD3FF'},
38
+ transform: 'translate(11.823953, 0.000000)',
39
+ d: 'M11.6697272,41.9041283 C11.6697272,44.4958717 13.7774753,46.6000594 16.3736041,46.6000594 L23.3137502,46.6000594 L11.6697272,34.9757054 L11.6697272,41.9041283 Z'
40
+ }),
41
+ el('polygon', {
42
+ style: {fill: '#00A5FF'},
43
+ points: '0.10281698 11.8039798 11.74684 11.8039798 0.10281698 0.17962578',
44
+ transform: 'translate(23.390863, 11.547372)'
45
+ }),
46
+ el('path', {
47
+ style: {fill: '#00A5FF'},
48
+ transform: 'translate(23.390863, 11.547372)',
49
+ d: 'M11.74684,11.8039798 L11.74684,23.4283338 L0.10281698,23.4283338 L11.74684,35.0526879 L30.3310091,35.0526879 C31.6419256,35.0526879 32.7986166,34.5138105 33.6725609,33.6670033 L11.74684,11.8039798 Z'
50
+ })
51
+ ),
52
+ category: 'wpdatatables-blocks',
53
+ keywords: [
54
+ 'wpdatatables',
55
+ 'tables'
56
+ ],
57
+ supports: {
58
+ customClassName: false,
59
+ html: false
60
+ },
61
+ attributes: {
62
+ short_code: {
63
+ type: 'string',
64
+ default: ''
65
+ },
66
+ tableID: {
67
+ type: 'string',
68
+ default: ''
69
+ },
70
+ export_file_name: {
71
+ type: 'string',
72
+ default: ''
73
+ }
74
+
75
+ },
76
+ edit: function (props) {
77
+ var inspectorElements = [];
78
+ var attributes = props.attributes;
79
+ var options = [];
80
+
81
+ options['tables'] = [];
82
+
83
+ function getOptions(data) {
84
+ var options = [];
85
+ data = Object.keys(data).map(function (key) {
86
+ return data[key]
87
+ });
88
+
89
+ data.sort(function (a, b) {
90
+ if (parseInt(a.value) < parseInt(b.value))
91
+ return -1;
92
+ if (parseInt(a.value) > parseInt(b.value))
93
+ return 1;
94
+ return 0
95
+ });
96
+
97
+ data.forEach(function (element) {
98
+ options.push({value: element.value, label: element.text})
99
+ });
100
+
101
+ return options;
102
+ }
103
+
104
+ getOptions(tables)
105
+ .forEach(function (element) {
106
+ options['tables'].push(element);
107
+ });
108
+
109
+ function getShortCode(props, attributes) {
110
+ var short_code = '';
111
+ var export_file_name = '';
112
+
113
+ if (attributes.export_file_name) {
114
+ export_file_name = ' export_file_name=' + attributes.export_file_name;
115
+ }
116
+
117
+ if (attributes.tableID !== '' ) {
118
+ short_code += '[wpdatatable id=' + attributes.tableID + export_file_name + ']'
119
+ } else if (tables.length !== 0 ) {
120
+ short_code = '[wpdatatable id=' + tables[0].value + export_file_name + ']'
121
+ } else {
122
+ short_code += 'Please create wpdatatable first.';
123
+ }
124
+
125
+ props.setAttributes({short_code: short_code});
126
+
127
+ return short_code
128
+ }
129
+
130
+ if (tables.length !== 0){
131
+ inspectorElements.push(el(components.SelectControl, {
132
+ id: 'wpdatatables-js-select-table',
133
+ label: 'Select wpdatatable:',
134
+ value: attributes.tableID,
135
+ options: options.tables,
136
+ onChange: function (selectControl) {
137
+ return props.setAttributes({tableID: selectControl})
138
+ }
139
+ }));
140
+
141
+ inspectorElements.push(el(components.TextControl, {
142
+ id: 'wpdatatables-js-insert-export-file-name',
143
+ label: 'Set name for export file:',
144
+ value: attributes.export_file_name,
145
+ onChange: function (content) {
146
+ return props.setAttributes({export_file_name: content})
147
+ }
148
+ }));
149
+ } else {
150
+ inspectorElements.push(el('p', {style: {'margin-bottom': '1em'}}, 'Please create wpdatatable first. You can find instructions in our documentation on link below.'));
151
+ inspectorElements.push(el('a', {href:'https://wpdatatables.com/documentation/general/features-overview/', target:'_blank', style: {'margin-bottom': '1em'}}, 'How to create tables in wpdatatables?'));
152
+ }
153
+
154
+ return [
155
+ el(blockControls, {key: 'controls'}),
156
+ el(inspectorControls, {key: 'inspector'},
157
+ el(components.PanelBody, {initialOpen: true},
158
+ inspectorElements
159
+ )
160
+ ),
161
+ el('div', {},
162
+ getShortCode(props, props.attributes)
163
+ )
164
+ ]
165
+ },
166
+
167
+ save: function (props) {
168
+ return (
169
+ el('div', {},
170
+ props.attributes.short_code
171
+ )
172
+ )
173
+ }
174
+ })
175
+ })(
176
+ window.wp
177
+ );
assets/js/wpdatatables/admin/plugin-settings/main.js CHANGED
@@ -110,7 +110,12 @@
110
wpdatatable_plugin_config.setIncludeBootstrap( $(this).is(':checked') ? 1 : 0 );
111
});
112
113
-
114
115
/**
116
* Toggle Parse shortcodes in strings
@@ -185,7 +190,7 @@
185
*/
186
wpdatatable_plugin_config.setSeparateConnection ( wdt_current_config.wdtUseSeparateCon == 1 ? 1 : 0 );
187
188
-
189
190
wpdatatable_plugin_config.setLanguage ( wdt_current_config.wdtInterfaceLanguage );
191
wpdatatable_plugin_config.setDateFormat ( wdt_current_config.wdtDateFormat );
@@ -204,6 +209,7 @@
204
wpdatatable_plugin_config.setPurchaseCode ( wdt_current_config.wdtPurchaseCode );
205
wpdatatable_plugin_config.setIncludeBootstrap ( wdt_current_config.wdtIncludeBootstrap == 1 ? 1 : 0 );
206
wpdatatable_plugin_config.setIncludeBootstrapBackEnd ( wdt_current_config.wdtIncludeBootstrapBackEnd == 1 ? 1 : 0 );
207
wpdatatable_plugin_config.setParseShortcodes ( wdt_current_config.wdtParseShortcodes == 1 ? 1 : 0 );
208
wpdatatable_plugin_config.setAlignNumber ( wdt_current_config.wdtNumbersAlign == 1 ? 1 : 0 );
209
wpdatatable_plugin_config.setCustomCss ( wdt_current_config.wdtCustomCss );
110
wpdatatable_plugin_config.setIncludeBootstrap( $(this).is(':checked') ? 1 : 0 );
111
});
112
113
+ /**
114
+ * Set Prevent deleting tables in database
115
+ */
116
+ $('#wdt-prevent-deleting-tables').change(function (e) {
117
+ wpdatatable_plugin_config.setPreventDeletingTables($(this).is(':checked') ? 1 : 0);
118
+ });
119
120
/**
121
* Toggle Parse shortcodes in strings
190
*/
191
wpdatatable_plugin_config.setSeparateConnection ( wdt_current_config.wdtUseSeparateCon == 1 ? 1 : 0 );
192
193
+
194
195
wpdatatable_plugin_config.setLanguage ( wdt_current_config.wdtInterfaceLanguage );
196
wpdatatable_plugin_config.setDateFormat ( wdt_current_config.wdtDateFormat );
209
wpdatatable_plugin_config.setPurchaseCode ( wdt_current_config.wdtPurchaseCode );
210
wpdatatable_plugin_config.setIncludeBootstrap ( wdt_current_config.wdtIncludeBootstrap == 1 ? 1 : 0 );
211
wpdatatable_plugin_config.setIncludeBootstrapBackEnd ( wdt_current_config.wdtIncludeBootstrapBackEnd == 1 ? 1 : 0 );
212
+ wpdatatable_plugin_config.setPreventDeletingTables(wdt_current_config.wdtPreventDeletingTables == 1 ? 1 : 0);
213
wpdatatable_plugin_config.setParseShortcodes ( wdt_current_config.wdtParseShortcodes == 1 ? 1 : 0 );
214
wpdatatable_plugin_config.setAlignNumber ( wdt_current_config.wdtNumbersAlign == 1 ? 1 : 0 );
215
wpdatatable_plugin_config.setCustomCss ( wdt_current_config.wdtCustomCss );
assets/js/wpdatatables/admin/plugin-settings/plugin_config_object.js CHANGED
@@ -188,6 +188,13 @@ var wpdatatable_plugin_config = {
188
}
189
},
190
191
setParseShortcodes: function ( wdtParseShortcodes ) {
192
wdt_current_config.wdtParseShortcodes = wdtParseShortcodes;
193
if( jQuery('#wdt-parse-shortcodes').val() != wdtParseShortcodes ){
188
}
189
},
190
191
+ setPreventDeletingTables: function (preventDeletingTables) {
192
+ wdt_current_config.wdtPreventDeletingTables = preventDeletingTables;
193
+ if( jQuery('#wdt-prevent-deleting-tables').val() != preventDeletingTables ){
194
+ jQuery('#wdt-prevent-deleting-tables').prop( 'checked', preventDeletingTables );
195
+ }
196
+ },
197
+
198
setParseShortcodes: function ( wdtParseShortcodes ) {
199
wdt_current_config.wdtParseShortcodes = wdtParseShortcodes;
200
if( jQuery('#wdt-parse-shortcodes').val() != wdtParseShortcodes ){
assets/js/wpdatatables/admin/wdtRating.js ADDED
@@ -0,0 +1,45 @@
1
+ (function ($) {
2
+ $(function () {
3
+ $('.wdt-dismiss').on("click", function (event) {
4
+ event.preventDefault();
5
+ $.ajax({
6
+ url: ajaxurl,
7
+ method: "POST",
8
+ data: {
9
+ 'action': 'wdtTempHideRating'
10
+ },
11
+ dataType: "json",
12
+ async: !0,
13
+ success: function (e) {
14
+ if (e == "success") {
15
+ $('.wdt-rating-notice').fadeTo(100, 0, function () {
16
+ $('.wdt-rating-notice').slideUp(100, function () {
17
+ this.remove();
18
+ });
19
+ });
20
+ }
21
+ }
22
+
23
+ });
24
+ });
25
+
26
+ $('.wdt-hide-rating').click(function () {
27
+ event.preventDefault();
28
+ $.ajax({
29
+ url: ajaxurl,
30
+ method: "POST",
31
+ data: {
32
+ 'action': 'wdtHideRating'
33
+ },
34
+ dataType: "json",
35
+ async: !0,
36
+ success: function (e) {
37
+ if (e == "success") {
38
+ $('.wdt-rating-notice').slideUp('fast');
39
+ }
40
+ }
41
+ });
42
+ })
43
+
44
+ });
45
+ })(jQuery);
assets/js/wpdatatables/wdt.mce.js CHANGED
@@ -13,12 +13,7 @@
13
title : 'Insert a wpDataTable',
14
cmd : 'wpdatatable'
15
});
16
-
17
- ed.addButton('wpdatachart', {
18
- title : 'Insert a wpDataChart',
19
- cmd : 'wpdatachart'
20
- });
21
-
22
ed.addCommand( 'wpdatatable', function(){
23
jQuery.ajax({
24
url: ajaxurl,
@@ -64,40 +59,6 @@
64
});
65
});
66
67
- ed.addCommand( 'wpdatachart', function(){
68
- jQuery.ajax({
69
- url: ajaxurl,
70
- dataType: 'json',
71
- data: {
72
- action: 'wpdatatable_list_all_charts'
73
- },
74
- success: function( charts ){
75
-
76
- var selectboxValues = [];
77
-
78
- for( var i in charts ){
79
- selectboxValues.push({ value: charts[i].id, text: charts[i].title+' (id: '+charts[i].id+')' })
80
- }
81
-
82
- ed.windowManager.open({
83
- title: 'wpDataChart',
84
- body: [
85
- {
86
- type: 'listbox',
87
- name: 'wpdatachart_select',
88
- label: 'wpDataChart',
89
- values: selectboxValues
90
- }
91
- ],
92
- onsubmit: function(e){
93
- ed.focus();
94
- ed.execCommand( 'mceInsertContent', 0, '[wpdatachart id='+e.data.wpdatachart_select+']' )
95
- }
96
- });
97
- }
98
- });
99
- });
100
-
101
},
102
103
/**
@@ -124,8 +85,8 @@
124
return {
125
longname : 'wpdatatables',
126
author : 'touchmesoft',
127
- authorurl : 'http://touchmesoft.net',
128
- infourl : 'http://wpdatatables.com',
129
version : "1.6.2"
130
};
131
}
13
title : 'Insert a wpDataTable',
14
cmd : 'wpdatatable'
15
});
16
+
17
ed.addCommand( 'wpdatatable', function(){
18
jQuery.ajax({
19
url: ajaxurl,
59
});
60
});
61
62
},
63
64
/**
85
return {
86
longname : 'wpdatatables',
87
author : 'touchmesoft',
88
+ authorurl : 'https://touchmesoft.net',
89
+ infourl : 'https://wpdatatables.com',
90
version : "1.6.2"
91
};
92
}
config/config.inc.php CHANGED
@@ -9,7 +9,7 @@ defined('ABSPATH') or die("Cannot access pages directly.");
9
10
// Current version
11
12
- define('WDT_CURRENT_VERSION', '2.0.8');
13
define('WDT_TIMEOUT_FACTOR', 5);
14
15
/**
9
10
// Current version
11
12
+ define('WDT_CURRENT_VERSION', '2.0.9');
13
define('WDT_TIMEOUT_FACTOR', 5);
14
15
/**
controllers/wdt_admin.php CHANGED
@@ -86,6 +86,8 @@ function wdtAdminEnqueue($hook) {
86
wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout.js', array('jquery'), 1.12, true);
87
wp_enqueue_script('tms-store-checkout-wpdatatables', WDT_STORE_URL . '/static/js/checkout/wpdatatables.js', array('jquery'), 1.12, true);
88
89
wp_enqueue_media();
90
91
wp_localize_script('wdt-common', 'wpdatatables_edit_strings', WDTTools::getTranslationStrings());
86
wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout.js', array('jquery'), 1.12, true);
87
wp_enqueue_script('tms-store-checkout-wpdatatables', WDT_STORE_URL . '/static/js/checkout/wpdatatables.js', array('jquery'), 1.12, true);
88
89
+ wp_enqueue_script('wdt-rating', WDT_JS_PATH . 'wpdatatables/admin/wdtRating.js', array('jquery'), 1.12, true);
90
+
91
wp_enqueue_media();
92
93
wp_localize_script('wdt-common', 'wpdatatables_edit_strings', WDTTools::getTranslationStrings());
controllers/wdt_functions.php CHANGED
@@ -185,14 +185,69 @@ function wdtActivationCreateTables() {
185
if (get_option('wdtIncludeBootstrap') === false) {
186
update_option('wdtIncludeBootstrap', true);
187
}
188
- if (get_option('wdtIncludeBootstrapBackEnd') === false) {
189
update_option('wdtIncludeBootstrapBackEnd', true);
190
}
191
- if (get_option('wdtSiteLink') === false) {
192
update_option('wdtSiteLink', true);
193
}
194
}
195
196
function wdtDeactivation() {
197
198
}
@@ -202,48 +257,50 @@ function wdtDeactivation() {
202
*/
203
function wdtUninstallDelete() {
204
global $wpdb;
205
-
206
- delete_option('wdtUseSeparateCon');
207
- delete_option('wdtTimepickerRange');
208
- delete_option('wdtTimeFormat');
209
- delete_option('wdtTabletWidth');
210
- delete_option('wdtTablesPerPage');
211
- delete_option('wdtSumFunctionsLabel');
212
- delete_option('wdtRenderFilter');
213
- delete_option('wdtRenderCharts');
214
- delete_option('wdtPurchaseCode');
215
- delete_option('wdtIncludeBootstrap');
216
- delete_option('wdtIncludeBootstrapBackEnd');
217
- delete_option('wdtParseShortcodes');
218
- delete_option('wdtNumbersAlign');
219
- delete_option('wdtNumberFormat');
220
- delete_option('wdtMySqlUser');
221
- delete_option('wdtMySqlPwd');
222
- delete_option('wdtMySqlPort');
223
- delete_option('wdtMySqlHost');
224
- delete_option('wdtMySqlDB');
225
- delete_option('wdtMobileWidth');
226
- delete_option('wdtMinifiedJs');
227
- delete_option('wdtMinFunctionsLabel');
228
- delete_option('wdtMaxFunctionsLabel');
229
- delete_option('wdtLeftOffset');
230
- delete_option('wdtTopOffset');
231
- delete_option('wdtInterfaceLanguage');
232
- delete_option('wdtGeneratedTablesCount');
233
- delete_option('wdtFontColorSettings');
234
- delete_option('wdtDecimalPlaces');
235
- delete_option('wdtCSVDelimiter');
236
- delete_option('wdtDateFormat');
237
- delete_option('wdtCustomJs');
238
- delete_option('wdtCustomCss');
239
- delete_option('wdtBaseSkin');
240
- delete_option('wdtAvgFunctionsLabel');
241
-
242
- delete_option('wdtSiteLink');
243
-
244
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatatables");
245
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatatables_columns");
246
- $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatacharts");
247
}
248
249
/**
@@ -583,6 +640,28 @@ function wdtSanitizeQuery($query) {
583
return $query;
584
}
585
586
/**
587
* Buttons for "insert wpDataTable" and "insert wpDataCharts" in WP MCE editor
588
*/
185
if (get_option('wdtIncludeBootstrap') === false) {
186
update_option('wdtIncludeBootstrap', true);
187
}
188
+ if (get_option('wdtIncludeBootstrapBackEnd') === false) {
189
update_option('wdtIncludeBootstrapBackEnd', true);
190
}
191
+ if (get_option('wdtPreventDeletingTables') === false) {
192
+ update_option('wdtPreventDeletingTables', true);
193
+ }
194
+ if (get_option('wdtSiteLink') === false) {
195
update_option('wdtSiteLink', true);
196
}
197
+ if (get_option('wdtInstallDate') === false) {
198
+ update_option('wdtInstallDate', date( 'Y-m-d' ));
199
+ }
200
+ if (get_option('wdtRatingDiv') === false) {
201
+ update_option('wdtRatingDiv', 'no' );
202
+ }
203
+ if (get_option('wdtTempFutureDate') === false) {
204
+ update_option('wdtTempFutureDate', date( 'Y-m-d'));
205
+ }
206
+ }
207
+
208
+ /**
209
+ * Add rating massage on all admin pages after 2 weeks of using
210
+ */
211
+ function wdtAdminRatingMessages() {
212
+
213
+ $installDate = get_option( 'wdtInstallDate' );
214
+ $currentDate = date( 'Y-m-d' );
215
+ $tempIgnoreDate = get_option( 'wdtTempFutureDate' );
216
+
217
+ $tempIgnore = strtotime($currentDate) >= strtotime($tempIgnoreDate) ? true : false;
218
+ $datetimeInstallDate = new DateTime( $installDate );
219
+ $datetimeCurrentDate = new DateTime( $currentDate );
220
+ $diffIntrval = round( ($datetimeCurrentDate->format( 'U' ) - $datetimeInstallDate->format( 'U' )) / (60 * 60 * 24) );
221
+ if( $diffIntrval >= 14 && get_option( 'wdtRatingDiv' ) == "no" && $tempIgnore) {
222
+ include WDT_TEMPLATE_PATH . 'admin/common/ratingDiv.inc.php';
223
+ }
224
}
225
226
+ add_action( 'admin_notices', 'wdtAdminRatingMessages' );
227
+
228
+ /**
229
+ * Remove rating message
230
+ */
231
+ function wpdtHideRatingDiv() {
232
+ update_option( 'wdtRatingDiv', 'yes' );
233
+ echo json_encode( array("success") );
234
+ exit;
235
+ }
236
+
237
+ add_action( 'wp_ajax_wdtHideRating', 'wpdtHideRatingDiv' );
238
+
239
+ /**
240
+ * Temperary hide rating message for 7 days
241
+ */
242
+ function wpdtTempHideRatingDiv() {
243
+ $date = strtotime("+7 day");
244
+ update_option('wdtTempFutureDate', date( 'Y-m-d', $date));
245
+ echo json_encode( array("success") );
246
+ exit;
247
+ }
248
+
249
+ add_action( 'wp_ajax_wdtTempHideRating', 'wpdtTempHideRatingDiv' );
250
+
251
function wdtDeactivation() {
252
253
}
257
*/
258
function wdtUninstallDelete() {
259
global $wpdb;
260
+ if (get_option('wdtPreventDeletingTables') == false) {
261
+ delete_option('wdtUseSeparateCon');
262
+ delete_option('wdtTimepickerRange');
263
+ delete_option('wdtTimeFormat');
264
+ delete_option('wdtTabletWidth');
265
+ delete_option('wdtTablesPerPage');
266
+ delete_option('wdtSumFunctionsLabel');
267
+ delete_option('wdtRenderFilter');
268
+ delete_option('wdtRenderCharts');
269
+ delete_option('wdtPurchaseCode');
270
+ delete_option('wdtIncludeBootstrap');
271
+ delete_option('wdtIncludeBootstrapBackEnd');
272
+ delete_option('wdtPreventDeletingTables');
273
+ delete_option('wdtParseShortcodes');
274
+ delete_option('wdtNumbersAlign');
275
+ delete_option('wdtNumberFormat');
276
+ delete_option('wdtMySqlUser');
277
+ delete_option('wdtMySqlPwd');
278
+ delete_option('wdtMySqlPort');
279
+ delete_option('wdtMySqlHost');
280
+ delete_option('wdtMySqlDB');
281
+ delete_option('wdtMobileWidth');
282
+ delete_option('wdtMinifiedJs');
283
+ delete_option('wdtMinFunctionsLabel');
284
+ delete_option('wdtMaxFunctionsLabel');
285
+ delete_option('wdtLeftOffset');
286
+ delete_option('wdtTopOffset');
287
+ delete_option('wdtInterfaceLanguage');
288
+ delete_option('wdtGeneratedTablesCount');
289
+ delete_option('wdtFontColorSettings');
290
+ delete_option('wdtDecimalPlaces');
291
+ delete_option('wdtCSVDelimiter');
292
+ delete_option('wdtDateFormat');
293
+ delete_option('wdtCustomJs');
294
+ delete_option('wdtCustomCss');
295
+ delete_option('wdtBaseSkin');
296
+ delete_option('wdtAvgFunctionsLabel');
297
+
298
+ delete_option('wdtSiteLink');
299
+
300
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatatables");
301
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatatables_columns");
302
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}wpdatacharts");
303
+ }
304
}
305
306
/**
640
return $query;
641
}
642
643
+ function initGutenbergBlocks (){
644
+ WpDataTablesGutenbergBlock::init();
645
+ add_filter( 'block_categories', 'addWpDataTablesBlockCategory', 10, 2);
646
+ }
647
+
648
+ add_action('plugins_loaded', 'initGutenbergBlocks');
649
+
650
+ /**
651
+ * Creating Amelia block category in Gutenberg
652
+ */
653
+ function addWpDataTablesBlockCategory ($categories, $post) {
654
+ return array_merge(
655
+ array(
656
+ array(
657
+ 'slug' => 'wpdatatables-blocks',
658
+ 'title' => 'wpDataTables',
659
+ ),
660
+ ),
661
+ $categories
662
+ );
663
+ }
664
+
665
/**
666
* Buttons for "insert wpDataTable" and "insert wpDataCharts" in WP MCE editor
667
*/
readme.txt CHANGED
@@ -4,9 +4,9 @@ Author URI: http://tms-plugins.com/
4
Plugin URI: http://wpdatatables.com/
5
Tags: wordpress table plugin, tables, wpdatatables, tables from excel, tables from CSV, datatables
6
Requires at least: 4.0
7
- Tested up to: 5.1.1
8
Requires PHP: 5.4
9
- Stable tag: 2.0.8
10
License: GPLv2 or later
11
License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
@@ -163,6 +163,12 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
163
164
== Changelog ==
165
166
= 2.0.8 =
167
* Bug fixes and stability improvements.
168
* Compatibility with WordPress 5.1.1 approved.
4
Plugin URI: http://wpdatatables.com/
5
Tags: wordpress table plugin, tables, wpdatatables, tables from excel, tables from CSV, datatables
6
Requires at least: 4.0
7
+ Tested up to: 5.2.1
8
Requires PHP: 5.4
9
+ Stable tag: 2.0.9
10
License: GPLv2 or later
11
License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
163
164
== Changelog ==
165
166
+ = 2.0.9 =
167
+ * Feature: Added Gutenberg block – the plugin is now Gutenberg optimized.
168
+ * Feature: Added option to choose whether you want to keep the tables after deleting the plugin from the Plugins page (by default the tables will be saved in database after deleting the plugin).
169
+ * Bug fixes and stability improvements.
170
+ * Compatibility with WordPress 5.2.1 approved.
171
+
172
= 2.0.8 =
173
* Bug fixes and stability improvements.
174
* Compatibility with WordPress 5.1.1 approved.
source/WpDataTablesGutenbergBlock.php ADDED
@@ -0,0 +1,121 @@
1
+ <?php
2
+
3
+ defined('ABSPATH') or die('Access denied.');
4
+
5
+ /**
6
+ * Class WpDataTablesGutenbergBlock
7
+ *
8
+ */
9
+ class WpDataTablesGutenbergBlock
10
+ {
11
+ public static function registerBlockType()
12
+ {
13
+
14
+ wp_enqueue_script(
15
+ 'wpdatatables-gutenberg-block',
16
+ WDT_ROOT_URL . 'assets/js/gutenberg/wpdatatables-gutenberg-block.js',
17
+ array( 'wp-blocks', 'wp-components', 'wp-element', 'wp-editor')
18
+ );
19
+
20
+ wp_localize_script(
21
+ 'wpdatatables-gutenberg-block',
22
+ 'wpdatatables',
23
+ array(
24
+ 'title' => 'wpDataTables Lite',
25
+ 'description' => __('Choose the table that you’ve just created in the dropdown below, and the shortcode will be inserted automatically. You are able to provide Export file name as well.','wpdatatables'),
26
+ 'data' => self::wdtGetAllTablesForGutenberg()
27
+ )
28
+ );
29
+
30
+ register_block_type(
31
+ 'wpdatatables/wpdatatables-gutenberg-block',
32
+ array('editor_script' => 'wpdatatables_gutenberg_block')
33
+ );
34
+
35
+ }
36
+
37
+ public static function wdtGetAllTablesForGutenberg() {
38
+
39
+ global $wpdb;
40
+ $query = "SELECT id, title FROM {$wpdb->prefix}wpdatatables ORDER BY id";
41
+
42
+ $allTables = $wpdb->get_results($query, ARRAY_A);
43
+
44
+ foreach ($allTables as $table) {
45
+ $returnTables[] = [
46
+ 'name' => $table['title'],
47
+ 'id' => $table['id'],
48
+ ];
49
+
50
+ }
51
+
52
+ return $returnTables;
53
+ }
54
+
55
+ /**
56
+ * Register WP Ajax actions.
57
+ */
58
+ public static function init()
59
+ {
60
+ if (is_admin() && function_exists('register_block_type')) {
61
+ if (substr($_SERVER['PHP_SELF'], '-8') == 'post.php' ||
62
+ substr($_SERVER['PHP_SELF'], '-12') == 'post-new.php'
63
+ ) {
64
+
65
+ if (self::isGutenbergActive()) {
66
+ add_action('init', array('WpDataTablesGutenbergBlock','registerBlockType'));
67
+ }
68
+
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Check if Block Editor is active.
75
+ *
76
+ * @return bool
77
+ */
78
+ public static function isGutenbergActive()
79
+ {
80
+ // Gutenberg plugin is installed and activated.
81
+ $gutenberg = !(false === has_filter('replace_editor', 'gutenberg_init'));
82
+
83
+ // Block editor since 5.0.
84
+ $block_editor = version_compare($GLOBALS['wp_version'], '5.0-beta', '>');
85
+
86
+ if (!$gutenberg && !$block_editor) {
87
+ return false;
88
+ }
89
+
90
+ if (self::isClassicEditorPluginActive()) {
91
+ $editor_option = get_option('classic-editor-replace');
92
+ $block_editor_active = array('no-replace', 'block');
93
+
94
+ return in_array($editor_option, $block_editor_active, true);
95
+ }
96
+
97
+ return true;
98
+ }
99
+
100
+ /**
101
+ * Check if Classic Editor plugin is active
102
+ *
103
+ * @return bool
104
+ */
105
+ public static function isClassicEditorPluginActive()
106
+ {
107
+
108
+ if (!function_exists('is_plugin_active')) {
109
+
110
+ include_once ABSPATH . 'wp-admin/includes/plugin.php';
111
+ }
112
+
113
+ if (is_plugin_active('classic-editor/classic-editor.php')) {
114
+
115
+ return true;
116
+ }
117
+
118
+ return false;
119
+ }
120
+
121
+ }
source/class.wdtsettingscontroller.php CHANGED
@@ -54,6 +54,7 @@ class WDTSettingsController {
54
'wdtPurchaseCode' => get_option('wdtPurchaseCode'),
55
'wdtIncludeBootstrap' => get_option('wdtIncludeBootstrap'),
56
'wdtIncludeBootstrapBackEnd'=> get_option('wdtIncludeBootstrapBackEnd'),
57
'wdtParseShortcodes' => get_option('wdtParseShortcodes'),
58
'wdtNumbersAlign' => get_option('wdtNumbersAlign'),
59
'wdtUseSeparateCon' => get_option('wdtUseSeparateCon'),
54
'wdtPurchaseCode' => get_option('wdtPurchaseCode'),
55
'wdtIncludeBootstrap' => get_option('wdtIncludeBootstrap'),
56
'wdtIncludeBootstrapBackEnd'=> get_option('wdtIncludeBootstrapBackEnd'),
57
+ 'wdtPreventDeletingTables' => get_option('wdtPreventDeletingTables'),
58
'wdtParseShortcodes' => get_option('wdtParseShortcodes'),
59
'wdtNumbersAlign' => get_option('wdtNumbersAlign'),
60
'wdtUseSeparateCon' => get_option('wdtUseSeparateCon'),
templates/admin/common/ratingDiv.inc.php ADDED
@@ -0,0 +1,24 @@
1
+ <?php defined('ABSPATH') or die("Cannot access pages directly."); ?>
2
+
3
+ <div class="wdt-rating-notice notice notice-success">
4
+ <div class="wdt-float-left">
5
+ <img class="wdt-icon-rating" src="<?php echo WDT_ROOT_URL ?>assets/img/logo-large.png" alt="">
6
+ </div>
7
+ <div class="wdt-float-left">
8
+ <h1 class="wdt-rating-heading"><?php _e("Leave a Review?", "wpdatatables") ?></h1>
9
+ <p class="wdt-rating-massage"><?php _e("We hope you've enjoyed using wpDataTables Lite. Would you consider
10
+ leaving us a review on WordPress.org?", "wpdatatables") ?></p>
11
+ </div>
12
+ <div class="wdt-dismiss-dash">
13
+ <span class="wdt-dismiss dashicons dashicons-dismiss"></span>
14
+ </div>
15
+ <ul class="wdt-rating-buttons">
16
+ <li><a href="https://wordpress.org/support/plugin/wpdatatables/reviews/?rate=5&filter=5#new-post"
17
+ class="wdt-rating-button wdt-first-btn" target="_new"
18
+ ><?php _e("Sure! I Like wpDataTables Lite", "wpdatatables") ?></a>
19
+ </li>
20
+ <li><a href="javascript:void(0);" class="wdt-rating-button wdt-hide-rating wdt-other-btn"><?php _e("I've already left a review", "wpdatatables") ?></a></li>
21
+ <li><a href="javascript:void(0);" class="wdt-rating-button wdt-other-btn wdt-dismiss"><?php _e("Maybe Later", "wpdatatables") ?></a></li>
22
+ <li><a href="javascript:void(0);" class="wdt-rating-button wdt-hide-rating wdt-other-btn"><?php _e("Never show again", "wpdatatables") ?></a></li>
23
+ </ul>
24
+ </div>
templates/admin/settings/tabs/main_plugin_settings.php CHANGED
@@ -394,5 +394,17 @@
394
<label for="wdt-site-link" class="ts-helper"></label>
395
</div>
396
</div>
397
</div>
398
</div>
394
<label for="wdt-site-link" class="ts-helper"></label>
395
</div>
396
</div>
397
+ <div class="col-sm-4 wdt-prevent-deleting-tables-block">
398
+ <h4 class="c-black m-b-20">
399
+ <?php _e('Prevent deleting tables in database', 'wpdatatables'); ?>
400
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
401
+ title="<?php _e('It is recommended to leave this optiosn as checked if you what to keep your tables in database after deleting plugin from Plugins page. If you uncheck this option, it will be deleted all tables in database after deleting plugin', 'wpdatatables'); ?>"></i>
402
+ </h4>
403
+ <div class="toggle-switch" data-ts-color="blue">
404
+ <label for="wdt-prevent-deleting-tables" class="ts-label">Prevent deleting tables in database after deleting plugin from Plugins page</label>
405
+ <input type="checkbox" name="wdt-prevent-deleting-tables" id="wdt-prevent-deleting-tables"/>
406
+ <label for="wdt-prevent-deleting-tables" class="ts-helper"></label>
407
+ </div>
408
+ </div>
409
</div>
410
</div>
templates/admin/table-settings/table_preview_block.inc.php CHANGED
@@ -43,11 +43,11 @@
43
<div class="col-sm-12 p-0 wdt-edit-buttons hidden">
44
<span class="pull-right"><?php _e('Switch View:', 'wpdatatables'); ?>
45
<?php if (isset($_GET['table_view']) && $_GET['table_view'] == 'excel') { ?>
46
- <a href="<?php echo admin_url(isset($_GET['table_id']) ? 'admin.php?page=wpdatatables-constructor&source&table_id=' . $_GET['table_id'] : ''); ?>"><?php _e('STANDARD', 'wpdatatables'); ?></a> |
47
<?php _e('EXCEL-LIKE', 'wpdatatables'); ?>
48
<?php } else { ?>
49
<?php _e('STANDARD', 'wpdatatables'); ?> |
50
- <a href="<?php echo admin_url(isset($_GET['table_id']) ? 'admin.php?page=wpdatatables-constructor&source&table_id=' . $_GET['table_id'] . '&table_view=excel' : ''); ?>"><?php _e('EXCEL-LIKE', 'wpdatatables'); ?></a>
51
<?php } ?>
52
</span>
53
</div>
43
<div class="col-sm-12 p-0 wdt-edit-buttons hidden">
44
<span class="pull-right"><?php _e('Switch View:', 'wpdatatables'); ?>
45
<?php if (isset($_GET['table_view']) && $_GET['table_view'] == 'excel') { ?>
46
+ <a href="<?php echo admin_url(isset($_GET['table_id']) ? 'admin.php?page=wpdatatables-constructor&source&table_id=' . (int)$_GET['table_id'] : ''); ?>"><?php _e('STANDARD', 'wpdatatables'); ?></a> |
47
<?php _e('EXCEL-LIKE', 'wpdatatables'); ?>
48
<?php } else { ?>
49
<?php _e('STANDARD', 'wpdatatables'); ?> |
50
+ <a href="<?php echo admin_url(isset($_GET['table_id']) ? 'admin.php?page=wpdatatables-constructor&source&table_id=' . (int)$_GET['table_id'] . '&table_view=excel' : ''); ?>"><?php _e('EXCEL-LIKE', 'wpdatatables'); ?></a>
51
<?php } ?>
52
</span>
53
</div>
wpdatatables.php CHANGED
@@ -5,7 +5,7 @@
5
Plugin Name: wpDataTables
6
Plugin URI: http://tms-plugins.com
7
Description: Add interactive tables easily from any input source
8
- Version: 2.0.8 Lite
9
Author: TMS-Plugins
10
Author URI: http://tms-plugins.com
11
Text Domain: wpdatatables
@@ -52,6 +52,7 @@ function wpdatatables_load() {
52
53
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsetable.php');
54
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsechartstable.php');
55
56
add_action('plugins_loaded', 'wdtLoadTextdomain');
57
}
5
Plugin Name: wpDataTables
6
Plugin URI: http://tms-plugins.com
7
Description: Add interactive tables easily from any input source
8
+ Version: 2.0.9 Lite
9
Author: TMS-Plugins
10
Author URI: http://tms-plugins.com
11
Text Domain: wpdatatables
52
53
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsetable.php');
54
require_once(WDT_ROOT_PATH . 'source/class.wdtbrowsechartstable.php');
55
+ require_once(WDT_ROOT_PATH . 'source/WpDataTablesGutenbergBlock.php');
56
57
add_action('plugins_loaded', 'wdtLoadTextdomain');
58
}