Version Description
- Added a new option for creating CSV and Excel tables using different server and location sources. Other small bug fixes and stability improvements.
Download this release
Release Info
Developer | wpDataTables |
Plugin | wpDataTables Lite |
Version | 2.1.47 |
Comparing to | |
See all releases |
Code changes from version 2.1.46 to 2.1.47
- assets/js/wpdatatables/admin/table-settings/main.js +7 -0
- assets/js/wpdatatables/admin/table-settings/table_config_object.js +44 -2
- config/config.inc.php +1 -1
- controllers/wdt_admin.php +1 -1
- controllers/wdt_admin_ajax_actions.php +1 -0
- controllers/wdt_functions.php +1 -0
- readme.txt +5 -1
- source/class.wdtconfigcontroller.php +19 -5
- source/class.wpdatatable.php +29 -1
- source/class.wpdatatablecache.php +10 -1
- templates/admin/common/premium_modal.inc.php +1 -1
- templates/admin/common/promo.inc.php +1 -1
- templates/admin/dashboard/dashboard.inc.php +3 -4
- templates/admin/lite-vs-premium/lite_vs_premium.inc.php +4 -4
- templates/admin/table-settings/table_settings_block.inc.php +21 -0
- wpdatatables.php +1 -1
assets/js/wpdatatables/admin/table-settings/main.js
CHANGED
@@ -17,6 +17,13 @@
|
|
17 |
wpdatatable_config.setTableType( $(this).val() );
|
18 |
});
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
/**
|
21 |
* Toggle server-side processing
|
22 |
*/
|
17 |
wpdatatable_config.setTableType( $(this).val() );
|
18 |
});
|
19 |
|
20 |
+
/**
|
21 |
+
* Change file location
|
22 |
+
*/
|
23 |
+
$('#wdt-file-location').change(function (e) {
|
24 |
+
wpdatatable_config.setFileLocation($(this).val());
|
25 |
+
});
|
26 |
+
|
27 |
/**
|
28 |
* Toggle server-side processing
|
29 |
*/
|
assets/js/wpdatatables/admin/table-settings/table_config_object.js
CHANGED
@@ -21,6 +21,7 @@ var wpdatatable_config = {
|
|
21 |
sorting: 1,
|
22 |
word_wrap: 0,
|
23 |
table_type: '',
|
|
|
24 |
server_side: 1,
|
25 |
auto_refresh: 0,
|
26 |
content: '',
|
@@ -84,6 +85,9 @@ var wpdatatable_config = {
|
|
84 |
if (jQuery('.wdt-table-settings .mysql-settings-block').hasClass('hidden')) {
|
85 |
jQuery('.wdt-table-settings .input-path-block').addClass('hidden');
|
86 |
}
|
|
|
|
|
|
|
87 |
break;
|
88 |
case 'manual':
|
89 |
wpdatatable_config.setServerSide(1);
|
@@ -111,6 +115,16 @@ var wpdatatable_config = {
|
|
111 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').addClass('hidden');
|
112 |
if (jQuery.inArray(type, ['google_spreadsheet', 'xml', 'json','nested_json', 'serialized']) != -1)
|
113 |
jQuery('.wdt-table-settings #wdt-browse-button').addClass('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
break;
|
115 |
case 'nested_json':
|
116 |
jQuery('.placeholders-settings-tab').animateFadeIn();
|
@@ -126,6 +140,9 @@ var wpdatatable_config = {
|
|
126 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').removeClass('hidden');
|
127 |
jQuery('.wdt-table-settings #wdt-get-nested-json-roots').removeClass('hidden');
|
128 |
wpdatatable_config.setServerSide( 0 );
|
|
|
|
|
|
|
129 |
break;
|
130 |
default:
|
131 |
jQuery('.wdt-table-settings .input-path-block').addClass('hidden');
|
@@ -137,10 +154,27 @@ var wpdatatable_config = {
|
|
137 |
jQuery('.wdt-table-settings #wdt-get-nested-json-roots').addClass('hidden');
|
138 |
jQuery('.wdt-table-settings #wdt-nested-json-block').addClass('hidden');
|
139 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').addClass('hidden');
|
|
|
140 |
break;
|
141 |
}
|
142 |
jQuery('#wdt-table-type').val(type).selectpicker('refresh');
|
143 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
renderCustomHeadersRow: function (row){
|
145 |
var custom_headers_row = jQuery('#wdt-nested-json-custom-headers-template').html();
|
146 |
var $block = jQuery(custom_headers_row)
|
@@ -628,9 +662,18 @@ var wpdatatable_config = {
|
|
628 |
if (allowedTableTypes.includes(wpdatatable_config.table_type)){
|
629 |
jQuery('.wdt-table-settings .cache-settings-block').removeClass('hidden');
|
630 |
jQuery('.wdt-table-settings .auto-update-cache-block').removeClass('hidden');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
631 |
} else {
|
632 |
jQuery('.wdt-table-settings .cache-settings-block').addClass('hidden');
|
633 |
jQuery('.wdt-table-settings .auto-update-cache-block').addClass('hidden');
|
|
|
|
|
634 |
}
|
635 |
if (cacheSourceData == 0){
|
636 |
wpdatatable_config.auto_update_cache = 0
|
@@ -983,10 +1026,9 @@ var wpdatatable_config = {
|
|
983 |
wpdatatable_config.setId(tableJSON.id);
|
984 |
wpdatatable_config.setTitle(tableJSON.title);
|
985 |
wpdatatable_config.setTableType(tableJSON.table_type);
|
|
|
986 |
wpdatatable_config.setAutoRefresh(tableJSON.auto_refresh);
|
987 |
wpdatatable_config.setShowTitle(tableJSON.show_title);
|
988 |
-
|
989 |
-
|
990 |
wpdatatable_config.setContent(tableJSON.content);
|
991 |
wpdatatable_config.setDisplayLength(tableJSON.display_length);
|
992 |
wpdatatable_config.setShowRowsPerPage(tableJSON.showRowsPerPage);
|
21 |
sorting: 1,
|
22 |
word_wrap: 0,
|
23 |
table_type: '',
|
24 |
+
file_location: 'wp_media_lib',
|
25 |
server_side: 1,
|
26 |
auto_refresh: 0,
|
27 |
content: '',
|
85 |
if (jQuery('.wdt-table-settings .mysql-settings-block').hasClass('hidden')) {
|
86 |
jQuery('.wdt-table-settings .input-path-block').addClass('hidden');
|
87 |
}
|
88 |
+
jQuery('.wdt-table-settings .wdt-file-location').addClass('hidden');
|
89 |
+
jQuery('.wdt-table-settings .wdt-input-data-source-type').removeClass('col-sm-4').addClass('col-sm-6');
|
90 |
+
jQuery('.wdt-table-settings .input-path-block').removeClass('col-sm-4').addClass('col-sm-6');
|
91 |
break;
|
92 |
case 'manual':
|
93 |
wpdatatable_config.setServerSide(1);
|
115 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').addClass('hidden');
|
116 |
if (jQuery.inArray(type, ['google_spreadsheet', 'xml', 'json','nested_json', 'serialized']) != -1)
|
117 |
jQuery('.wdt-table-settings #wdt-browse-button').addClass('hidden');
|
118 |
+
if (jQuery.inArray(type, ['csv', 'xls']) != -1 ){
|
119 |
+
wpdatatable_config.setFileLocation('wp_media_lib');
|
120 |
+
jQuery('.wdt-table-settings .wdt-file-location').removeClass('hidden');
|
121 |
+
jQuery('.wdt-table-settings .wdt-input-data-source-type').removeClass('col-sm-6').addClass('col-sm-4');
|
122 |
+
jQuery('.wdt-table-settings .input-path-block').removeClass('col-sm-6').addClass('col-sm-4');
|
123 |
+
} else {
|
124 |
+
jQuery('.wdt-table-settings .wdt-file-location').addClass('hidden');
|
125 |
+
jQuery('.wdt-table-settings .wdt-input-data-source-type').removeClass('col-sm-4').addClass('col-sm-6');
|
126 |
+
jQuery('.wdt-table-settings .input-path-block').removeClass('col-sm-4').addClass('col-sm-6');
|
127 |
+
}
|
128 |
break;
|
129 |
case 'nested_json':
|
130 |
jQuery('.placeholders-settings-tab').animateFadeIn();
|
140 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').removeClass('hidden');
|
141 |
jQuery('.wdt-table-settings #wdt-get-nested-json-roots').removeClass('hidden');
|
142 |
wpdatatable_config.setServerSide( 0 );
|
143 |
+
jQuery('.wdt-table-settings .wdt-input-data-source-type').removeClass('col-sm-4').addClass('col-sm-6');
|
144 |
+
jQuery('.wdt-table-settings .input-path-block').removeClass('col-sm-4').addClass('col-sm-6');
|
145 |
+
jQuery('.wdt-table-settings .wdt-file-location').addClass('hidden');
|
146 |
break;
|
147 |
default:
|
148 |
jQuery('.wdt-table-settings .input-path-block').addClass('hidden');
|
154 |
jQuery('.wdt-table-settings #wdt-get-nested-json-roots').addClass('hidden');
|
155 |
jQuery('.wdt-table-settings #wdt-nested-json-block').addClass('hidden');
|
156 |
jQuery('.wdt-table-settings #wdt-nested-json-additional-block').addClass('hidden');
|
157 |
+
jQuery('.wdt-table-settings .wdt-file-location').addClass('hidden');
|
158 |
break;
|
159 |
}
|
160 |
jQuery('#wdt-table-type').val(type).selectpicker('refresh');
|
161 |
},
|
162 |
+
setFileLocation: function( fileLocation ){
|
163 |
+
wpdatatable_config.file_location = fileLocation;
|
164 |
+
switch( fileLocation ){
|
165 |
+
case 'wp_media_lib':
|
166 |
+
jQuery('#wdt-browse-button').removeClass('hidden');
|
167 |
+
jQuery('#wdt-input-url').closest('.col-sm-9').css('cssText', 'width: 75% !important');
|
168 |
+
jQuery('#wdt-input-url').val('');
|
169 |
+
break;
|
170 |
+
case 'wp_any_url':
|
171 |
+
jQuery('#wdt-browse-button').addClass('hidden');
|
172 |
+
jQuery('#wdt-input-url').closest('.col-sm-9').css('cssText', 'width: 100% !important');
|
173 |
+
jQuery('#wdt-input-url').val('');
|
174 |
+
break;
|
175 |
+
}
|
176 |
+
jQuery('#wdt-file-location').val( fileLocation ).selectpicker('refresh');
|
177 |
+
},
|
178 |
renderCustomHeadersRow: function (row){
|
179 |
var custom_headers_row = jQuery('#wdt-nested-json-custom-headers-template').html();
|
180 |
var $block = jQuery(custom_headers_row)
|
662 |
if (allowedTableTypes.includes(wpdatatable_config.table_type)){
|
663 |
jQuery('.wdt-table-settings .cache-settings-block').removeClass('hidden');
|
664 |
jQuery('.wdt-table-settings .auto-update-cache-block').removeClass('hidden');
|
665 |
+
if (['csv', 'xls'].includes(wpdatatable_config.table_type)) {
|
666 |
+
jQuery('.wdt-table-settings .cache-settings-block').removeClass('col-sm-3').addClass('col-sm-4');
|
667 |
+
jQuery('.wdt-table-settings .auto-update-cache-block').removeClass('col-sm-3').addClass('col-sm-4');
|
668 |
+
} else {
|
669 |
+
jQuery('.wdt-table-settings .cache-settings-block').removeClass('col-sm-4').addClass('col-sm-3');
|
670 |
+
jQuery('.wdt-table-settings .auto-update-cache-block').removeClass('col-sm-4').addClass('col-sm-3');
|
671 |
+
}
|
672 |
} else {
|
673 |
jQuery('.wdt-table-settings .cache-settings-block').addClass('hidden');
|
674 |
jQuery('.wdt-table-settings .auto-update-cache-block').addClass('hidden');
|
675 |
+
jQuery('.wdt-table-settings .cache-settings-block').removeClass('col-sm-4').addClass('col-sm-3');
|
676 |
+
jQuery('.wdt-table-settings .auto-update-cache-block').removeClass('col-sm-4').addClass('col-sm-3');
|
677 |
}
|
678 |
if (cacheSourceData == 0){
|
679 |
wpdatatable_config.auto_update_cache = 0
|
1026 |
wpdatatable_config.setId(tableJSON.id);
|
1027 |
wpdatatable_config.setTitle(tableJSON.title);
|
1028 |
wpdatatable_config.setTableType(tableJSON.table_type);
|
1029 |
+
wpdatatable_config.setFileLocation( tableJSON.file_location );
|
1030 |
wpdatatable_config.setAutoRefresh(tableJSON.auto_refresh);
|
1031 |
wpdatatable_config.setShowTitle(tableJSON.show_title);
|
|
|
|
|
1032 |
wpdatatable_config.setContent(tableJSON.content);
|
1033 |
wpdatatable_config.setDisplayLength(tableJSON.display_length);
|
1034 |
wpdatatable_config.setShowRowsPerPage(tableJSON.showRowsPerPage);
|
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.1.
|
13 |
|
14 |
// Number of active plugin installs for wpDataTables
|
15 |
define('WDT_NUMBER_OF_ACTIVE_INSTALLS', '66,000+');
|
9 |
|
10 |
// Current version
|
11 |
|
12 |
+
define('WDT_CURRENT_VERSION', '2.1.47');
|
13 |
|
14 |
// Number of active plugin installs for wpDataTables
|
15 |
define('WDT_NUMBER_OF_ACTIVE_INSTALLS', '66,000+');
|
controllers/wdt_admin.php
CHANGED
@@ -550,7 +550,7 @@ function wdtStoreEnqueue() {
|
|
550 |
wp_enqueue_script('tms-store-checkout-config', WDT_STORE_URL . '/static/js/checkout/config.js', array('jquery'), 1.12, true);
|
551 |
//wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout.js', array('jquery'), 1.12, true);
|
552 |
wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout-promo.js', array('jquery'), 1.12, true);
|
553 |
-
|
554 |
}
|
555 |
|
556 |
/**
|
550 |
wp_enqueue_script('tms-store-checkout-config', WDT_STORE_URL . '/static/js/checkout/config.js', array('jquery'), 1.12, true);
|
551 |
//wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout.js', array('jquery'), 1.12, true);
|
552 |
wp_enqueue_script('tms-store-checkout', WDT_STORE_URL . '/static/js/checkout/checkout-promo.js', array('jquery'), 1.12, true);
|
553 |
+
//wp_enqueue_script('tms-store-checkout-wpdatatables', WDT_STORE_URL . '/static/js/checkout/wpdatatables.js', array('jquery'), 1.12, true);
|
554 |
}
|
555 |
|
556 |
/**
|
controllers/wdt_admin_ajax_actions.php
CHANGED
@@ -109,6 +109,7 @@ function wdtDuplicateTable() {
|
|
109 |
'title' => $newTableName,
|
110 |
'show_title' => $tableData->show_title,
|
111 |
'table_type' => $tableData->table_type,
|
|
|
112 |
'content' => $content,
|
113 |
'filtering' => $tableData->filtering,
|
114 |
'filtering_form' => $tableData->filtering_form,
|
109 |
'title' => $newTableName,
|
110 |
'show_title' => $tableData->show_title,
|
111 |
'table_type' => $tableData->table_type,
|
112 |
+
'file_location' => $tableData->file_location,
|
113 |
'content' => $content,
|
114 |
'filtering' => $tableData->filtering,
|
115 |
'filtering_form' => $tableData->filtering_form,
|
controllers/wdt_functions.php
CHANGED
@@ -23,6 +23,7 @@ function wdtActivationCreateTables() {
|
|
23 |
title varchar(255) NOT NULL,
|
24 |
show_title tinyint(1) NOT NULL default '1',
|
25 |
table_type varchar(55) NOT NULL,
|
|
|
26 |
content text NOT NULL,
|
27 |
filtering tinyint(1) NOT NULL default '1',
|
28 |
filtering_form tinyint(1) NOT NULL default '0',
|
23 |
title varchar(255) NOT NULL,
|
24 |
show_title tinyint(1) NOT NULL default '1',
|
25 |
table_type varchar(55) NOT NULL,
|
26 |
+
file_location varchar(15) NOT NULL default '',
|
27 |
content text NOT NULL,
|
28 |
filtering tinyint(1) NOT NULL default '1',
|
29 |
filtering_form tinyint(1) NOT NULL default '0',
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: table, table builder, data tables, tables, charts, datatables, csv, excel,
|
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 6.1.1
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.1.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -369,6 +369,10 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
|
|
369 |
|
370 |
== Changelog ==
|
371 |
|
|
|
|
|
|
|
|
|
372 |
= 2.1.46 =
|
373 |
* Improved logging errors for cashing tables.
|
374 |
* Compatibility with WordPress 6.1.1 approved.
|
6 |
Requires at least: 4.0
|
7 |
Tested up to: 6.1.1
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.1.47
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
369 |
|
370 |
== Changelog ==
|
371 |
|
372 |
+
= 2.1.47 =
|
373 |
+
* Added a new option for creating CSV and Excel tables using different server and location sources.
|
374 |
+
Other small bug fixes and stability improvements.
|
375 |
+
|
376 |
= 2.1.46 =
|
377 |
* Improved logging errors for cashing tables.
|
378 |
* Compatibility with WordPress 6.1.1 approved.
|
source/class.wdtconfigcontroller.php
CHANGED
@@ -33,7 +33,11 @@ class WDTConfigController {
|
|
33 |
sanitize_text_field($tableData->var3) : '';
|
34 |
|
35 |
// trying to generate/validate the WPDataTable config
|
36 |
-
$res = WDTConfigController::tryCreateTable(
|
|
|
|
|
|
|
|
|
37 |
|
38 |
if (empty($res->error)) {
|
39 |
// If the table can be created by wpDataTables performing the save to DB
|
@@ -53,7 +57,9 @@ class WDTConfigController {
|
|
53 |
if (count($wpDataTable->getDataRows()) > 2000) {
|
54 |
$tableData->server_side = 1;
|
55 |
}
|
56 |
-
if ($tableData->
|
|
|
|
|
57 |
$tableData->content = WDTTools::pathToUrl($tableData->content);
|
58 |
}
|
59 |
$tableData->editor_roles = !empty($tableData->editor_roles) ? explode(",", $tableData->editor_roles) : '';
|
@@ -95,7 +101,9 @@ class WDTConfigController {
|
|
95 |
if (count($wpDataTable->getDataRows()) > 2000) {
|
96 |
$tableData->server_side = 1;
|
97 |
}
|
98 |
-
if ($tableData->
|
|
|
|
|
99 |
$tableData->content = WDTTools::pathToUrl($tableData->content);
|
100 |
}
|
101 |
$tableData->editor_roles = !empty($tableData->editor_roles) ? explode(",", $tableData->editor_roles) : '';
|
@@ -259,6 +267,7 @@ class WDTConfigController {
|
|
259 |
'show_title' => $table->show_title,
|
260 |
'table_type' => $table->table_type,
|
261 |
'content' => $table->content,
|
|
|
262 |
'sorting' => $table->sorting,
|
263 |
'fixed_layout' => $table->fixed_layout,
|
264 |
'word_wrap' => $table->word_wrap,
|
@@ -358,6 +367,7 @@ class WDTConfigController {
|
|
358 |
$table->pagination = (int)$table->pagination;
|
359 |
$table->paginationAlign = sanitize_text_field($table->paginationAlign);
|
360 |
$table->paginationLayout = sanitize_text_field($table->paginationLayout);
|
|
|
361 |
$table->simpleResponsive = (int)$table->simpleResponsive;
|
362 |
$table->simpleHeader = (int)$table->simpleHeader;
|
363 |
$table->stripeTable = (int)$table->stripeTable;
|
@@ -413,7 +423,9 @@ class WDTConfigController {
|
|
413 |
$table = self::sanitizeTableSettingsSimpleTable($table);
|
414 |
}
|
415 |
|
416 |
-
if (
|
|
|
|
|
417 |
$table->content = WDTTools::urlToPath($table->content);
|
418 |
}
|
419 |
|
@@ -656,7 +668,7 @@ class WDTConfigController {
|
|
656 |
* @param $content - Content for creating the table (path to source or a MySQL query)
|
657 |
* @return stdClass Object which has an 'error' property in case there were problems, or a 'table' on success
|
658 |
*/
|
659 |
-
public static function tryCreateTable($type, $content) {
|
660 |
|
661 |
global $wdtVar1, $wdtVar2, $wdtVar3;
|
662 |
|
@@ -669,6 +681,7 @@ class WDTConfigController {
|
|
669 |
$tableData = new stdClass();
|
670 |
$tableData->table_type = $type;
|
671 |
$tableData->content = $content;
|
|
|
672 |
$tableData->init_read = true;
|
673 |
$tableData->limit = 10;
|
674 |
$tableData->var1 = !empty($wdtVar1) ? $wdtVar1 : '';
|
@@ -1118,6 +1131,7 @@ class WDTConfigController {
|
|
1118 |
$table->pagination = 1;
|
1119 |
$table->paginationAlign = 'right';
|
1120 |
$table->paginationLayout = 'full_numbers';
|
|
|
1121 |
$table->simpleResponsive = 0;
|
1122 |
$table->cache_source_data = 0;
|
1123 |
$table->auto_update_cache = 0;
|
33 |
sanitize_text_field($tableData->var3) : '';
|
34 |
|
35 |
// trying to generate/validate the WPDataTable config
|
36 |
+
$res = WDTConfigController::tryCreateTable(
|
37 |
+
$tableData->table_type,
|
38 |
+
$tableData->content,
|
39 |
+
$tableData->file_location
|
40 |
+
);
|
41 |
|
42 |
if (empty($res->error)) {
|
43 |
// If the table can be created by wpDataTables performing the save to DB
|
57 |
if (count($wpDataTable->getDataRows()) > 2000) {
|
58 |
$tableData->server_side = 1;
|
59 |
}
|
60 |
+
if ($tableData->file_location == 'wp_media_lib' &&
|
61 |
+
($tableData->table_type === 'csv' || $tableData->table_type === 'xls')
|
62 |
+
) {
|
63 |
$tableData->content = WDTTools::pathToUrl($tableData->content);
|
64 |
}
|
65 |
$tableData->editor_roles = !empty($tableData->editor_roles) ? explode(",", $tableData->editor_roles) : '';
|
101 |
if (count($wpDataTable->getDataRows()) > 2000) {
|
102 |
$tableData->server_side = 1;
|
103 |
}
|
104 |
+
if ($tableData->file_location == 'wp_media_lib' &&
|
105 |
+
($tableData->table_type === 'csv' || $tableData->table_type === 'xls')
|
106 |
+
) {
|
107 |
$tableData->content = WDTTools::pathToUrl($tableData->content);
|
108 |
}
|
109 |
$tableData->editor_roles = !empty($tableData->editor_roles) ? explode(",", $tableData->editor_roles) : '';
|
267 |
'show_title' => $table->show_title,
|
268 |
'table_type' => $table->table_type,
|
269 |
'content' => $table->content,
|
270 |
+
'file_location' => $table->file_location,
|
271 |
'sorting' => $table->sorting,
|
272 |
'fixed_layout' => $table->fixed_layout,
|
273 |
'word_wrap' => $table->word_wrap,
|
367 |
$table->pagination = (int)$table->pagination;
|
368 |
$table->paginationAlign = sanitize_text_field($table->paginationAlign);
|
369 |
$table->paginationLayout = sanitize_text_field($table->paginationLayout);
|
370 |
+
$table->file_location = sanitize_text_field($table->file_location);
|
371 |
$table->simpleResponsive = (int)$table->simpleResponsive;
|
372 |
$table->simpleHeader = (int)$table->simpleHeader;
|
373 |
$table->stripeTable = (int)$table->stripeTable;
|
423 |
$table = self::sanitizeTableSettingsSimpleTable($table);
|
424 |
}
|
425 |
|
426 |
+
if ($table->file_location == 'wp_media_lib' &&
|
427 |
+
(($table->table_type == 'csv') || ($table->table_type == 'xls'))
|
428 |
+
) {
|
429 |
$table->content = WDTTools::urlToPath($table->content);
|
430 |
}
|
431 |
|
668 |
* @param $content - Content for creating the table (path to source or a MySQL query)
|
669 |
* @return stdClass Object which has an 'error' property in case there were problems, or a 'table' on success
|
670 |
*/
|
671 |
+
public static function tryCreateTable($type, $content, $fileLocation = '') {
|
672 |
|
673 |
global $wdtVar1, $wdtVar2, $wdtVar3;
|
674 |
|
681 |
$tableData = new stdClass();
|
682 |
$tableData->table_type = $type;
|
683 |
$tableData->content = $content;
|
684 |
+
$tableData->file_location = $fileLocation;
|
685 |
$tableData->init_read = true;
|
686 |
$tableData->limit = 10;
|
687 |
$tableData->var1 = !empty($wdtVar1) ? $wdtVar1 : '';
|
1131 |
$table->pagination = 1;
|
1132 |
$table->paginationAlign = 'right';
|
1133 |
$table->paginationLayout = 'full_numbers';
|
1134 |
+
$table->file_location = 'wp_media_lib';
|
1135 |
$table->simpleResponsive = 0;
|
1136 |
$table->cache_source_data = 0;
|
1137 |
$table->auto_update_cache = 0;
|
source/class.wpdatatable.php
CHANGED
@@ -22,6 +22,7 @@ class WPDataTable
|
|
22 |
private $_defaultSortDirection = 'ASC';
|
23 |
private $_tableContent = '';
|
24 |
private $_tableType = '';
|
|
|
25 |
private $_title = '';
|
26 |
private $_interfaceLanguage;
|
27 |
private $_responsive = false;
|
@@ -205,6 +206,21 @@ class WPDataTable
|
|
205 |
$this->_tableContent = $tableContent;
|
206 |
}
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
/**
|
209 |
* @return string
|
210 |
*/
|
@@ -1656,16 +1672,24 @@ class WPDataTable
|
|
1656 |
$cache = WPDataTableCache::maybeCache($this->getCacheSourceData(), (int)$this->getWpId());
|
1657 |
if (!$cache){
|
1658 |
ini_set('memory_limit', '2048M');
|
|
|
1659 |
if (!$xls_url) {
|
1660 |
throw new WDTException(esc_html__('Excel file not found!','wpdatatables'));
|
1661 |
}
|
1662 |
-
|
1663 |
throw new WDTException('Provided file ' . stripcslashes($xls_url) . ' does not exist!');
|
1664 |
}
|
1665 |
|
1666 |
$format = substr(strrchr($xls_url, "."), 1);
|
1667 |
$objReader = self::createObjectReader($xls_url);
|
1668 |
$xls_url = apply_filters( 'wpdatatables_filter_excel_based_data_url', $xls_url, $this->getWpId() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1669 |
$objPHPExcel = $objReader->load($xls_url);
|
1670 |
$objWorksheet = $objPHPExcel->getActiveSheet();
|
1671 |
$highestRow = $objWorksheet->getHighestRow();
|
@@ -2199,6 +2223,9 @@ class WPDataTable
|
|
2199 |
$this->setDisplayLength($tableData->display_length);
|
2200 |
} else {
|
2201 |
$this->disablePagination();
|
|
|
|
|
|
|
2202 |
}
|
2203 |
$this->setCacheSourceData(!empty($tableData->cache_source_data));
|
2204 |
$this->setAutoUpdateCache(!empty($tableData->auto_update_cache));
|
@@ -2465,6 +2492,7 @@ class WPDataTable
|
|
2465 |
$obj->pagination = $this->isPagination();
|
2466 |
$obj->paginationAlign = $this->getPaginationAlign();
|
2467 |
$obj->paginationLayout = $this->getPaginationLayout();
|
|
|
2468 |
$obj->globalSearch = $this->isGlobalSearch();
|
2469 |
$obj->showRowsPerPage = $this->isShowRowsPerPage();
|
2470 |
|
22 |
private $_defaultSortDirection = 'ASC';
|
23 |
private $_tableContent = '';
|
24 |
private $_tableType = '';
|
25 |
+
private $_fileLocation = 'wp_media_lib';
|
26 |
private $_title = '';
|
27 |
private $_interfaceLanguage;
|
28 |
private $_responsive = false;
|
206 |
$this->_tableContent = $tableContent;
|
207 |
}
|
208 |
|
209 |
+
/**
|
210 |
+
* @return string
|
211 |
+
*/
|
212 |
+
|
213 |
+
public function getFileLocation() {
|
214 |
+
return $this->_fileLocation;
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @param string $fileLocation
|
219 |
+
*/
|
220 |
+
public function setFileLocation($fileLocation) {
|
221 |
+
$this->_fileLocation = $fileLocation;
|
222 |
+
}
|
223 |
+
|
224 |
/**
|
225 |
* @return string
|
226 |
*/
|
1672 |
$cache = WPDataTableCache::maybeCache($this->getCacheSourceData(), (int)$this->getWpId());
|
1673 |
if (!$cache){
|
1674 |
ini_set('memory_limit', '2048M');
|
1675 |
+
$fileLocation = $this->getFileLocation();
|
1676 |
if (!$xls_url) {
|
1677 |
throw new WDTException(esc_html__('Excel file not found!','wpdatatables'));
|
1678 |
}
|
1679 |
+
if ($fileLocation == 'wp_media_lib' && !file_exists($xls_url)) {
|
1680 |
throw new WDTException('Provided file ' . stripcslashes($xls_url) . ' does not exist!');
|
1681 |
}
|
1682 |
|
1683 |
$format = substr(strrchr($xls_url, "."), 1);
|
1684 |
$objReader = self::createObjectReader($xls_url);
|
1685 |
$xls_url = apply_filters( 'wpdatatables_filter_excel_based_data_url', $xls_url, $this->getWpId() );
|
1686 |
+
if ($fileLocation == 'wp_any_url'){
|
1687 |
+
$file = @file_get_contents($xls_url);
|
1688 |
+
if ($file === false) throw new WDTException('There is an error opening the file!');
|
1689 |
+
$tempFileName = 'tempfile.' . $format;
|
1690 |
+
file_put_contents($tempFileName, $file);
|
1691 |
+
$xls_url = $tempFileName;
|
1692 |
+
}
|
1693 |
$objPHPExcel = $objReader->load($xls_url);
|
1694 |
$objWorksheet = $objPHPExcel->getActiveSheet();
|
1695 |
$highestRow = $objWorksheet->getHighestRow();
|
2223 |
$this->setDisplayLength($tableData->display_length);
|
2224 |
} else {
|
2225 |
$this->disablePagination();
|
2226 |
+
}
|
2227 |
+
if (isset($tableData->file_location)) {
|
2228 |
+
$this->setFileLocation($tableData->file_location);
|
2229 |
}
|
2230 |
$this->setCacheSourceData(!empty($tableData->cache_source_data));
|
2231 |
$this->setAutoUpdateCache(!empty($tableData->auto_update_cache));
|
2492 |
$obj->pagination = $this->isPagination();
|
2493 |
$obj->paginationAlign = $this->getPaginationAlign();
|
2494 |
$obj->paginationLayout = $this->getPaginationLayout();
|
2495 |
+
$obj->file_location = $this->getFileLocation();
|
2496 |
$obj->globalSearch = $this->isGlobalSearch();
|
2497 |
$obj->showRowsPerPage = $this->isShowRowsPerPage();
|
2498 |
|
source/class.wpdatatablecache.php
CHANGED
@@ -316,7 +316,7 @@ class WPDataTableCache
|
|
316 |
case 'xls':
|
317 |
case 'csv':
|
318 |
ini_set('memory_limit', '2048M');
|
319 |
-
|
320 |
self::_logErrors(
|
321 |
'Error message:',
|
322 |
'Provided file ' . stripcslashes($source) . ' does not exist!',
|
@@ -326,6 +326,15 @@ class WPDataTableCache
|
|
326 |
}
|
327 |
$format = substr(strrchr($source, "."), 1);
|
328 |
$objReader = WPDataTable::createObjectReader($source);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
$objPHPExcel = $objReader->load($source);
|
330 |
$objWorksheet = $objPHPExcel->getActiveSheet();
|
331 |
$highestRow = $objWorksheet->getHighestRow();
|
316 |
case 'xls':
|
317 |
case 'csv':
|
318 |
ini_set('memory_limit', '2048M');
|
319 |
+
if (isset($tableData) && $tableData->file_location == 'wp_media_lib' && !file_exists($source)) {
|
320 |
self::_logErrors(
|
321 |
'Error message:',
|
322 |
'Provided file ' . stripcslashes($source) . ' does not exist!',
|
326 |
}
|
327 |
$format = substr(strrchr($source, "."), 1);
|
328 |
$objReader = WPDataTable::createObjectReader($source);
|
329 |
+
if (isset($tableData) && $tableData->file_location == 'wp_any_url'){
|
330 |
+
$file = @file_get_contents($source);
|
331 |
+
if ($file === false){
|
332 |
+
throw new Exception('There is an error opening the file!');
|
333 |
+
}
|
334 |
+
$tempFileName = 'tempfile.' . $format;
|
335 |
+
file_put_contents($tempFileName, $file);
|
336 |
+
$source = $tempFileName;
|
337 |
+
}
|
338 |
$objPHPExcel = $objReader->load($source);
|
339 |
$objWorksheet = $objPHPExcel->getActiveSheet();
|
340 |
$highestRow = $objWorksheet->getHighestRow();
|
templates/admin/common/premium_modal.inc.php
CHANGED
@@ -34,7 +34,7 @@
|
|
34 |
<div class="modal-footer">
|
35 |
<a id="wdt-premium-compare-link"><?php esc_html_e('Compare', 'wpdatatables') ?></a>
|
36 |
<span><?php esc_html_e('or', 'wpdatatables') ?></span>
|
37 |
-
<a href="https://wpdatatables.com/pricing
|
38 |
</div>
|
39 |
<!--/ .modal-footer -->
|
40 |
</div>
|
34 |
<div class="modal-footer">
|
35 |
<a id="wdt-premium-compare-link"><?php esc_html_e('Compare', 'wpdatatables') ?></a>
|
36 |
<span><?php esc_html_e('or', 'wpdatatables') ?></span>
|
37 |
+
<a href="https://wpdatatables.com/pricing/?utm_source=wpdt-lite&utm_medium=lite-upgrade&utm_content=wpdt&utm_campaign=wpdt" target="_blank"><?php esc_html_e('View Pricing', 'wpdatatables') ?></a>
|
38 |
</div>
|
39 |
<!--/ .modal-footer -->
|
40 |
</div>
|
templates/admin/common/promo.inc.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
<img class="wpdt-promo-text" src="<?php echo WDT_ROOT_URL ?>assets/img/promo/all-licenses.png" alt="">
|
13 |
</div>
|
14 |
<div id="wpdt-fourth-section">
|
15 |
-
<button id="wpdt-grab-it"
|
16 |
</div>
|
17 |
<div class="wpdt-promo-close">
|
18 |
<span class="wpdt-promo-dismiss-text">Don't show again</span>
|
12 |
<img class="wpdt-promo-text" src="<?php echo WDT_ROOT_URL ?>assets/img/promo/all-licenses.png" alt="">
|
13 |
</div>
|
14 |
<div id="wpdt-fourth-section">
|
15 |
+
<button id="wpdt-grab-it" onclick="window.open('https://wpdatatables.com/pricing/?utm_source=wpdt-lite&utm_medium=lite-upgrade&utm_content=wpdt&utm_campaign=wpdt', '_blank')">Grab yours!</button>
|
16 |
</div>
|
17 |
<div class="wpdt-promo-close">
|
18 |
<span class="wpdt-promo-dismiss-text">Don't show again</span>
|
templates/admin/dashboard/dashboard.inc.php
CHANGED
@@ -337,13 +337,12 @@ $tableChartsCount = (int)WDTTools::getTablesCount('chart');
|
|
337 |
</span>
|
338 |
</p>
|
339 |
<p class="wpdt-text wpdt-font m-b-18">
|
340 |
-
A
|
341 |
</p>
|
342 |
<div class="alert alert-info m-b-0" role="alert">
|
343 |
<i class="wpdt-icon-info-circle-full"></i>
|
344 |
<ul>
|
345 |
-
<li><strong>Feature:</strong>
|
346 |
-
<li><strong>Feature:</strong> <a href="https://wpdatatables.com/documentation/creating-wpdatatables/creating-wordpress-tables-from-nested-json-data-with-json-authentication/#json-authentication">JSON authentication.</a> </li>
|
347 |
<li>Other small bug fixes.</li>
|
348 |
</ul>
|
349 |
</div>
|
@@ -449,7 +448,7 @@ $tableChartsCount = (int)WDTTools::getTablesCount('chart');
|
|
449 |
<i class="wpdt-icon-check m-r-8"></i><?php esc_html_e('Premium support', 'wpdatatables'); ?>
|
450 |
</p>
|
451 |
</div>
|
452 |
-
<a class="btn btn-primary m-t-20
|
453 |
<?php esc_html_e('Get Premium Today', 'wpdatatables'); ?></a>
|
454 |
</div>
|
455 |
</div>
|
337 |
</span>
|
338 |
</p>
|
339 |
<p class="wpdt-text wpdt-font m-b-18">
|
340 |
+
A minor update with a new feature and stability improvements:
|
341 |
</p>
|
342 |
<div class="alert alert-info m-b-0" role="alert">
|
343 |
<i class="wpdt-icon-info-circle-full"></i>
|
344 |
<ul>
|
345 |
+
<li><strong>Feature:</strong> Added a new option for creating CSV and Excel tables using different server and location sources.</li>
|
|
|
346 |
<li>Other small bug fixes.</li>
|
347 |
</ul>
|
348 |
</div>
|
448 |
<i class="wpdt-icon-check m-r-8"></i><?php esc_html_e('Premium support', 'wpdatatables'); ?>
|
449 |
</p>
|
450 |
</div>
|
451 |
+
<a class="btn btn-primary m-t-20" target="_blank" href="https://wpdatatables.com/pricing/?utm_source=wpdt-lite&utm_medium=lite-upgrade&utm_content=wpdt&utm_campaign=wpdt">
|
452 |
<?php esc_html_e('Get Premium Today', 'wpdatatables'); ?></a>
|
453 |
</div>
|
454 |
</div>
|
templates/admin/lite-vs-premium/lite_vs_premium.inc.php
CHANGED
@@ -46,8 +46,8 @@
|
|
46 |
<div class="card-header wdt-admin-card-header">
|
47 |
<h5><?php esc_html_e('Lite vs Premium comparison', 'wpdatatables'); ?></h5>
|
48 |
<p><?php esc_html_e('Get the most out of wpDataTables by upgrading to Premium and unlocking all of the powerful features.', 'wpdatatables'); ?></p>
|
49 |
-
<a target="_blank"
|
50 |
-
class="btn btn-primary f-500
|
51 |
<i class="wpdt-icon-star-full m-r-5"></i>
|
52 |
<?php esc_html_e('Go Premium Now', 'wpdatatables'); ?></a>
|
53 |
</div>
|
@@ -653,8 +653,8 @@
|
|
653 |
<p style="padding-left: 28px;padding-top: 10px;font-size: 10px"><?php esc_html_e('* Please note that wpDataTables add-ons are not included in premium version of plugin.', 'wpdatatables'); ?></p>
|
654 |
</div>
|
655 |
<div class="wdt-lite-vs-premium-footer text-center">
|
656 |
-
<a target="_blank"
|
657 |
-
class="btn btn-primary m-t-24 p-r-48 p-l-48 f-500
|
658 |
<i class="wpdt-icon-star-full m-r-5"></i>
|
659 |
<?php esc_html_e('Go Premium Now', 'wpdatatables'); ?></a>
|
660 |
</div>
|
46 |
<div class="card-header wdt-admin-card-header">
|
47 |
<h5><?php esc_html_e('Lite vs Premium comparison', 'wpdatatables'); ?></h5>
|
48 |
<p><?php esc_html_e('Get the most out of wpDataTables by upgrading to Premium and unlocking all of the powerful features.', 'wpdatatables'); ?></p>
|
49 |
+
<a target="_blank" href="https://wpdatatables.com/pricing/?utm_source=wpdt-lite&utm_medium=lite-upgrade&utm_content=wpdt&utm_campaign=wpdt"
|
50 |
+
class="btn btn-primary f-500">
|
51 |
<i class="wpdt-icon-star-full m-r-5"></i>
|
52 |
<?php esc_html_e('Go Premium Now', 'wpdatatables'); ?></a>
|
53 |
</div>
|
653 |
<p style="padding-left: 28px;padding-top: 10px;font-size: 10px"><?php esc_html_e('* Please note that wpDataTables add-ons are not included in premium version of plugin.', 'wpdatatables'); ?></p>
|
654 |
</div>
|
655 |
<div class="wdt-lite-vs-premium-footer text-center">
|
656 |
+
<a target="_blank" href="https://wpdatatables.com/pricing/?utm_source=wpdt-lite&utm_medium=lite-upgrade&utm_content=wpdt&utm_campaign=wpdt"
|
657 |
+
class="btn btn-primary m-t-24 p-r-48 p-l-48 f-500">
|
658 |
<i class="wpdt-icon-star-full m-r-5"></i>
|
659 |
<?php esc_html_e('Go Premium Now', 'wpdatatables'); ?></a>
|
660 |
</div>
|
templates/admin/table-settings/table_settings_block.inc.php
CHANGED
@@ -128,6 +128,27 @@ $globalAutoUpdateOption = get_option('wdtAutoUpdateOption');
|
|
128 |
<!-- /input source type selection -->
|
129 |
</div>
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
<div class="col-sm-6 input-path-block hidden">
|
132 |
<h4 class="c-title-color m-b-2">
|
133 |
<?php esc_html_e('Input file path or URL', 'wpdatatables'); ?>
|
128 |
<!-- /input source type selection -->
|
129 |
</div>
|
130 |
|
131 |
+
<div class="col-sm-4 wdt-file-location hidden">
|
132 |
+
<h4 class="c-title-color m-b-2">
|
133 |
+
<?php esc_html_e('File location', 'wpdatatables'); ?>
|
134 |
+
<i class=" wpdt-icon-info-circle-thin" data-toggle="tooltip" data-placement="right"
|
135 |
+
title="<?php esc_attr_e('Please choose a file location (WordPress Media Library or URL from any domain) for CSV or Excel files. Default option is WordPress Media Library.', 'wpdatatables'); ?>"></i>
|
136 |
+
</h4>
|
137 |
+
|
138 |
+
<!-- input source type selection -->
|
139 |
+
<div class="form-group">
|
140 |
+
<div class="fg-line">
|
141 |
+
<div class="select">
|
142 |
+
<select class="selectpicker" id="wdt-file-location">
|
143 |
+
<option value="wp_media_lib"><?php esc_html_e('WordPress Media Library', 'wpdatatables'); ?></option>
|
144 |
+
<option value="wp_any_url"><?php esc_html_e('URL from any domain', 'wpdatatables'); ?></option>
|
145 |
+
</select>
|
146 |
+
</div>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
<!-- /input source type selection -->
|
150 |
+
</div>
|
151 |
+
|
152 |
<div class="col-sm-6 input-path-block hidden">
|
153 |
<h4 class="c-title-color m-b-2">
|
154 |
<?php esc_html_e('Input file path or URL', 'wpdatatables'); ?>
|
wpdatatables.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: wpDataTables - Tables & Table Charts
|
4 |
Plugin URI: https://wpdatatables.com
|
5 |
Description: Create responsive, sortable tables & charts from Excel, CSV or PHP. Add tables & charts to any post in minutes with DataTables.
|
6 |
-
Version: 2.1.
|
7 |
Author: TMS-Plugins
|
8 |
Author URI: https://tms-outsource.com
|
9 |
Text Domain: wpdatatables
|
3 |
Plugin Name: wpDataTables - Tables & Table Charts
|
4 |
Plugin URI: https://wpdatatables.com
|
5 |
Description: Create responsive, sortable tables & charts from Excel, CSV or PHP. Add tables & charts to any post in minutes with DataTables.
|
6 |
+
Version: 2.1.47
|
7 |
Author: TMS-Plugins
|
8 |
Author URI: https://tms-outsource.com
|
9 |
Text Domain: wpdatatables
|