wpDataTables Lite - Version 2.0.3

Version Description

  • An option to choose CSV delimiter in the Settings page.
  • Bug fixes and stability improvements.
  • Compatibility with WordPress 4.9.7 approved.
Download this release

Release Info

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

Code changes from version 2.0.2 to 2.0.3

assets/css/bootstrap/wpdatatables-bootstrap.css CHANGED
@@ -13949,3 +13949,7 @@ input:focus {
13949
  .wpdt-c .checkbox .input-helper:after {
13950
  font-size: 14px;
13951
  }
 
 
 
 
13949
  .wpdt-c .checkbox .input-helper:after {
13950
  font-size: 14px;
13951
  }
13952
+
13953
+ .wdt-include-bootstrap-block,.wdt-include-bootstrap-back-end-block {
13954
+ margin-bottom: 25px;
13955
+ }
assets/js/wpdatatables/admin/browse/wdt.browse.js CHANGED
@@ -19,6 +19,15 @@ var duplicate_table_id = '';
19
  });
20
  });
21
 
 
 
 
 
 
 
 
 
 
22
  /**
23
  * Bulk action alert
24
  */
19
  });
20
  });
21
 
22
+ /**
23
+ * Search tables and charts in backend by enter
24
+ */
25
+ $("input#search_id-search-input").on("keydown",function (e) {
26
+ if(e.keyCode == 13) {
27
+ $("button#search-submit").click();
28
+ }
29
+ });
30
+
31
  /**
32
  * Bulk action alert
33
  */
assets/js/wpdatatables/admin/plugin-settings/main.js CHANGED
@@ -54,7 +54,14 @@
54
  wpdatatable_plugin_config.setNumberFormat( $(this).val() );
55
  });
56
 
57
- /**
 
 
 
 
 
 
 
58
  * Change position of advance filter - "Render advanced filter"
59
  */
60
  $('#wp-render-filter').change(function(e){
@@ -134,7 +141,12 @@
134
 
135
  });
136
 
137
-
 
 
 
 
 
138
 
139
  /**
140
  * Change border input radius
@@ -181,6 +193,7 @@
181
  wpdatatable_plugin_config.setTimeFormat ( wdt_current_config.wdtTimeFormat );
182
  wpdatatable_plugin_config.setBaseSkin ( wdt_current_config.wdtBaseSkin );
183
  wpdatatable_plugin_config.setNumberFormat ( wdt_current_config.wdtNumberFormat );
 
184
 
185
 
186
 
@@ -190,6 +203,7 @@
190
 
191
  wpdatatable_plugin_config.setPurchaseCode ( wdt_current_config.wdtPurchaseCode );
192
  wpdatatable_plugin_config.setIncludeBootstrap ( wdt_current_config.wdtIncludeBootstrap == 1 ? 1 : 0 );
 
193
  wpdatatable_plugin_config.setParseShortcodes ( wdt_current_config.wdtParseShortcodes == 1 ? 1 : 0 );
194
  wpdatatable_plugin_config.setAlignNumber ( wdt_current_config.wdtNumbersAlign == 1 ? 1 : 0 );
195
  wpdatatable_plugin_config.setCustomCss ( wdt_current_config.wdtCustomCss );
54
  wpdatatable_plugin_config.setNumberFormat( $(this).val() );
55
  });
56
 
57
+ /**
58
+ * Change CSV delimiter - "CSV delimiter"
59
+ */
60
+ $('#wdt-csv-delimiter').change(function(e){
61
+ wpdatatable_plugin_config.setCSVDelimiter( $(this).val() );
62
+ });
63
+
64
+ /**
65
  * Change position of advance filter - "Render advanced filter"
66
  */
67
  $('#wp-render-filter').change(function(e){
141
 
142
  });
143
 
144
+ /**
145
+ * Set Include Bootstrap on back-end
146
+ */
147
+ $('#wdt-include-bootstrap-back-end').change(function(e){
148
+ wpdatatable_plugin_config.setIncludeBootstrapBackEnd( $(this).is(':checked') ? 1 : 0 );
149
+ });
150
 
151
  /**
152
  * Change border input radius
193
  wpdatatable_plugin_config.setTimeFormat ( wdt_current_config.wdtTimeFormat );
194
  wpdatatable_plugin_config.setBaseSkin ( wdt_current_config.wdtBaseSkin );
195
  wpdatatable_plugin_config.setNumberFormat ( wdt_current_config.wdtNumberFormat );
196
+ wpdatatable_plugin_config.setCSVDelimiter ( wdt_current_config.wdtCSVDelimiter );
197
 
198
 
199
 
203
 
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 );
assets/js/wpdatatables/admin/plugin-settings/plugin_config_object.js CHANGED
@@ -120,6 +120,14 @@ var wpdatatable_plugin_config = {
120
  jQuery('#wdt-number-format').selectpicker( 'val', numberFormat );
121
  }
122
  },
 
 
 
 
 
 
 
 
123
 
124
  setRenderPosition: function ( renderPosition ) {
125
  if( wdt_current_config.wdtRenderFilter != renderPosition ){
@@ -173,6 +181,13 @@ var wpdatatable_plugin_config = {
173
  }
174
  },
175
 
 
 
 
 
 
 
 
176
  setParseShortcodes: function ( wdtParseShortcodes ) {
177
  wdt_current_config.wdtParseShortcodes = wdtParseShortcodes;
178
  if( jQuery('#wdt-parse-shortcodes').val() != wdtParseShortcodes ){
120
  jQuery('#wdt-number-format').selectpicker( 'val', numberFormat );
121
  }
122
  },
123
+ setCSVDelimiter: function ( wdtCSVDelimiter ) {
124
+ if( wdt_current_config.wdtCSVDelimiter != wdtCSVDelimiter ){
125
+ wdt_current_config.wdtCSVDelimiter = wdtCSVDelimiter;
126
+ }
127
+ if( jQuery('#wdt-csv-delimiter').val() != wdtCSVDelimiter ){
128
+ jQuery('#wdt-csv-delimiter').selectpicker( 'val', wdtCSVDelimiter );
129
+ }
130
+ },
131
 
132
  setRenderPosition: function ( renderPosition ) {
133
  if( wdt_current_config.wdtRenderFilter != renderPosition ){
181
  }
182
  },
183
 
184
+ setIncludeBootstrapBackEnd: function (includeBootstrapBackEnd) {
185
+ wdt_current_config.wdtIncludeBootstrapBackEnd = includeBootstrapBackEnd;
186
+ if( jQuery('#wdt-include-bootstrap-back-end').val() != includeBootstrapBackEnd ){
187
+ jQuery('#wdt-include-bootstrap-back-end').prop( 'checked', includeBootstrapBackEnd );
188
+ }
189
+ },
190
+
191
  setParseShortcodes: function ( wdtParseShortcodes ) {
192
  wdt_current_config.wdtParseShortcodes = wdtParseShortcodes;
193
  if( jQuery('#wdt-parse-shortcodes').val() != wdtParseShortcodes ){
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.0');
13
  define('WDT_TIMEOUT_FACTOR', 5);
14
 
15
  /**
9
 
10
  // Current version
11
 
12
+ define('WDT_CURRENT_VERSION', '2.0.3');
13
  define('WDT_TIMEOUT_FACTOR', 5);
14
 
15
  /**
controllers/wdt_functions.php CHANGED
@@ -149,13 +149,16 @@ function wdtActivationCreateTables() {
149
  if (!get_option('wdtDecimalPlaces')) {
150
  update_option('wdtDecimalPlaces', 2);
151
  }
 
 
 
152
  if (!get_option('wdtDateFormat')) {
153
  update_option('wdtDateFormat', 'd/m/Y');
154
  }
155
- if (!get_option('wdtParseShortcodes')) {
156
  update_option('wdtParseShortcodes', false);
157
  }
158
- if (!get_option('wdtNumbersAlign')) {
159
  update_option('wdtNumbersAlign', true);
160
  }
161
  if (!get_option('wdtFontColorSettings')) {
@@ -179,11 +182,13 @@ function wdtActivationCreateTables() {
179
  if (!get_option('wdtPurchaseCode')) {
180
  update_option('wdtPurchaseCode', '');
181
  }
182
- if (!get_option('wdtIncludeBootstrap')) {
183
  update_option('wdtIncludeBootstrap', true);
184
  }
185
-
186
- if (!get_option('wdtSiteLink')) {
 
 
187
  update_option('wdtSiteLink', true);
188
  }
189
  }
@@ -208,6 +213,7 @@ function wdtUninstallDelete() {
208
  delete_option('wdtRenderCharts');
209
  delete_option('wdtPurchaseCode');
210
  delete_option('wdtIncludeBootstrap');
 
211
  delete_option('wdtParseShortcodes');
212
  delete_option('wdtNumbersAlign');
213
  delete_option('wdtNumberFormat');
@@ -226,6 +232,7 @@ function wdtUninstallDelete() {
226
  delete_option('wdtGeneratedTablesCount');
227
  delete_option('wdtFontColorSettings');
228
  delete_option('wdtDecimalPlaces');
 
229
  delete_option('wdtDateFormat');
230
  delete_option('wdtCustomJs');
231
  delete_option('wdtCustomCss');
149
  if (!get_option('wdtDecimalPlaces')) {
150
  update_option('wdtDecimalPlaces', 2);
151
  }
152
+ if (!get_option('wdtCSVDelimiter')) {
153
+ update_option('wdtCSVDelimiter', ',');
154
+ }
155
  if (!get_option('wdtDateFormat')) {
156
  update_option('wdtDateFormat', 'd/m/Y');
157
  }
158
+ if (get_option('wdtParseShortcodes') === false) {
159
  update_option('wdtParseShortcodes', false);
160
  }
161
+ if (get_option('wdtNumbersAlign') === false) {
162
  update_option('wdtNumbersAlign', true);
163
  }
164
  if (!get_option('wdtFontColorSettings')) {
182
  if (!get_option('wdtPurchaseCode')) {
183
  update_option('wdtPurchaseCode', '');
184
  }
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
  }
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');
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');
readme.txt CHANGED
@@ -4,9 +4,9 @@ Author URI: http://tms-plugins.com/
4
  Plugin URI: http://wpdatatables.com/
5
  Tags: tables, wpdatatables, tables from excel, tables from CSV, datatables
6
  Requires at least: 4.0
7
- Tested up to: 4.9.1
8
  Requires PHP: 5.4
9
- Stable tag: 2.0.2
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -117,6 +117,11 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
117
 
118
  == Changelog ==
119
 
 
 
 
 
 
120
  = 2.0.2 =
121
  * The plugin’s design was re-worked from scratch to a more intuitive, smooth and user friendly interface following Material Design guidelines;
122
  * New skin and new UI elements – a new Material-style skin for tables front-end, new UI elements;
4
  Plugin URI: http://wpdatatables.com/
5
  Tags: tables, wpdatatables, tables from excel, tables from CSV, datatables
6
  Requires at least: 4.0
7
+ Tested up to: 4.9.7
8
  Requires PHP: 5.4
9
+ Stable tag: 2.0.3
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
117
 
118
  == Changelog ==
119
 
120
+ = 2.0.3 =
121
+ * An option to choose CSV delimiter in the Settings page.
122
+ * Bug fixes and stability improvements.
123
+ * Compatibility with WordPress 4.9.7 approved.
124
+
125
  = 2.0.2 =
126
  * The plugin’s design was re-worked from scratch to a more intuitive, smooth and user friendly interface following Material Design guidelines;
127
  * New skin and new UI elements – a new Material-style skin for tables front-end, new UI elements;
source/class.wdtbrowsetable.php CHANGED
@@ -64,6 +64,13 @@ class WDTBrowseTable extends WP_List_Table {
64
  function getTableCount() {
65
  global $wpdb;
66
  $query = "SELECT COUNT(*) FROM {$wpdb->prefix}wpdatatables";
 
 
 
 
 
 
 
67
  $count = $wpdb->get_var($query);
68
  return $count;
69
  }
@@ -79,7 +86,11 @@ class WDTBrowseTable extends WP_List_Table {
79
  $query = "SELECT id, title, table_type, editable FROM {$wpdb->prefix}wpdatatables ";
80
 
81
  if (isset($_REQUEST['s'])) {
82
- $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
 
 
 
 
83
  }
84
 
85
  if (isset($_REQUEST['orderby'])) {
64
  function getTableCount() {
65
  global $wpdb;
66
  $query = "SELECT COUNT(*) FROM {$wpdb->prefix}wpdatatables";
67
+ if (isset($_REQUEST['s'])) {
68
+ if (is_numeric($_REQUEST['s'])){
69
+ $query .= " WHERE id LIKE '" . sanitize_text_field($_POST['s']) . "'";
70
+ }else{
71
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
72
+ }
73
+ }
74
  $count = $wpdb->get_var($query);
75
  return $count;
76
  }
86
  $query = "SELECT id, title, table_type, editable FROM {$wpdb->prefix}wpdatatables ";
87
 
88
  if (isset($_REQUEST['s'])) {
89
+ if (is_numeric($_REQUEST['s'])){
90
+ $query .= " WHERE id LIKE '" . sanitize_text_field($_POST['s']) . "'";
91
+ }else{
92
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
93
+ }
94
  }
95
 
96
  if (isset($_REQUEST['orderby'])) {
source/class.wdtsettingscontroller.php CHANGED
@@ -48,10 +48,12 @@ class WDTSettingsController {
48
  'wdtNumberFormat' => get_option('wdtNumberFormat'),
49
  'wdtRenderFilter' => get_option('wdtRenderFilter'),
50
  'wdtDecimalPlaces' => get_option('wdtDecimalPlaces'),
 
51
  'wdtTabletWidth' => get_option('wdtTabletWidth'),
52
  'wdtMobileWidth' => get_option('wdtMobileWidth'),
53
  'wdtPurchaseCode' => get_option('wdtPurchaseCode'),
54
  'wdtIncludeBootstrap' => get_option('wdtIncludeBootstrap'),
 
55
  'wdtParseShortcodes' => get_option('wdtParseShortcodes'),
56
  'wdtNumbersAlign' => get_option('wdtNumbersAlign'),
57
  'wdtUseSeparateCon' => get_option('wdtUseSeparateCon'),
48
  'wdtNumberFormat' => get_option('wdtNumberFormat'),
49
  'wdtRenderFilter' => get_option('wdtRenderFilter'),
50
  'wdtDecimalPlaces' => get_option('wdtDecimalPlaces'),
51
+ 'wdtCSVDelimiter' => get_option('wdtCSVDelimiter'),
52
  'wdtTabletWidth' => get_option('wdtTabletWidth'),
53
  'wdtMobileWidth' => get_option('wdtMobileWidth'),
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'),
source/class.wdttools.php CHANGED
@@ -171,6 +171,85 @@ class WDTTools {
171
  : $factor
172
  );
173
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  /**
176
  * Helper function that convert CSV file to Array
@@ -753,9 +832,11 @@ class WDTTools {
753
  wp_enqueue_style('wdt-iconic-font', WDT_CSS_PATH . 'material-design-iconic-font/css/material-design-iconic-font.min.css');
754
 
755
  if (!is_admin() && get_option('wdtIncludeBootstrap') == 1) {
756
- wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), false, true);
 
 
757
  }else{
758
- wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), false, true);
759
  }
760
 
761
  wp_enqueue_script('wdt-bootstrap-select', WDT_JS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.js', array(), false, true);
171
  : $factor
172
  );
173
  }
174
+ /**
175
+ * Helper function to find CSV delimiter
176
+ * @param $csv_url
177
+ * @return string
178
+ */
179
+ public static function detectCSVDelimiter ($csv_url) {
180
+
181
+ if (!file_exists($csv_url) || !is_readable($csv_url)) {
182
+ throw new WDTException('Could not open ' . $csv_url . ' for reading! File does not exist.');
183
+ }
184
+ $fileResurce = fopen($csv_url, 'r');
185
+
186
+ $delimiterList = [',', ':', ';', "\t", '|'];
187
+ $counts = [];
188
+ foreach ($delimiterList as $delimiter) {
189
+ $counts[$delimiter] = [];
190
+ }
191
+
192
+ $lineNumber = 0;
193
+ while (($line = fgets($fileResurce)) !== false && (++$lineNumber < 1000)) {
194
+ $lineCount = [];
195
+ for ($i = strlen($line) - 1; $i >= 0; --$i) {
196
+ $character = $line[$i];
197
+ if (isset($counts[$character])) {
198
+ if (!isset($lineCount[$character])) {
199
+ $lineCount[$character] = 0;
200
+ }
201
+ ++$lineCount[$character];
202
+ }
203
+ }
204
+ foreach ($delimiterList as $delimiter) {
205
+ $counts[$delimiter][] = isset($lineCount[$delimiter])
206
+ ? $lineCount[$delimiter]
207
+ : 0;
208
+ }
209
+ }
210
+
211
+ $RMSD = [];
212
+ $middleIdx = floor(($lineNumber - 1) / 2);
213
+
214
+ foreach ($delimiterList as $delimiter) {
215
+ $series = $counts[$delimiter];
216
+ sort($series);
217
+
218
+ $median = ($lineNumber % 2)
219
+ ? $series[$middleIdx]
220
+ : ($series[$middleIdx] + $series[$middleIdx + 1]) / 2;
221
+
222
+ if ($median === 0) {
223
+ continue;
224
+ }
225
+
226
+ $RMSD[$delimiter] = array_reduce(
227
+ $series,
228
+ function ($sum, $value) use ($median) {
229
+ return $sum + pow($value - $median, 2);
230
+ }
231
+ ) / count($series);
232
+ }
233
+
234
+ $min = INF;
235
+ foreach ($delimiterList as $delimiter) {
236
+ if (!isset($RMSD[$delimiter])) {
237
+ continue;
238
+ }
239
+
240
+ if ($RMSD[$delimiter] < $min) {
241
+ $min = $RMSD[$delimiter];
242
+ $finalDelimiter = $delimiter;
243
+ }
244
+ }
245
+
246
+ if ($delimiter === null) {
247
+ $finalDelimiter = reset($delimiterList);
248
+ }
249
+
250
+ return $finalDelimiter;
251
+ }
252
+
253
 
254
  /**
255
  * Helper function that convert CSV file to Array
832
  wp_enqueue_style('wdt-iconic-font', WDT_CSS_PATH . 'material-design-iconic-font/css/material-design-iconic-font.min.css');
833
 
834
  if (!is_admin() && get_option('wdtIncludeBootstrap') == 1) {
835
+ wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
836
+ }else if (is_admin() && get_option('wdtIncludeBootstrapBackEnd') == 1){
837
+ wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
838
  }else{
839
+ wp_enqueue_script('wdt-bootstrap', WDT_JS_PATH . 'bootstrap/noconf.bootstrap.min.js', array('jquery', 'wdt-bootstrap-select'), WDT_CURRENT_VERSION, true);
840
  }
841
 
842
  wp_enqueue_script('wdt-bootstrap-select', WDT_JS_PATH . 'bootstrap/bootstrap-select/bootstrap-select.min.js', array(), false, true);
source/class.wpdatatable.php CHANGED
@@ -2,8 +2,6 @@
2
 
3
  defined('ABSPATH') or die("Cannot access pages directly.");
4
 
5
- use PHPSQLParser\PHPSQLCreator;
6
- use PHPSQLParser\PHPSQLParser;
7
 
8
  /**
9
  * Main engine of wpDataTables plugin
@@ -478,7 +476,7 @@ class WPDataTable {
478
  }
479
 
480
  public function setDisplayLength($length) {
481
- if (!in_array($length, array(5, 10, 20, 25, 30, 50, 100, 200, -1))) {
482
  return false;
483
  }
484
  $this->_lengthDisplay = $length;
@@ -727,7 +725,7 @@ class WPDataTable {
727
  }
728
  }
729
 
730
- if ($dataColumn->getPossibleValuesType() == 'foreignkey' && $dataColumn->getForeignKeyRule() != null) {
731
  $foreignKeyData = $this->joinWithForeignWpDataTable($dataColumn->getOriginalHeader(), $dataColumn->getForeignKeyRule(), $this->getDataRows());
732
  $this->_dataRows = $foreignKeyData['dataRows'];
733
  $dataColumn->setPossibleValues($foreignKeyData['distinctValues']);
@@ -1197,6 +1195,8 @@ class WPDataTable {
1197
  } elseif (strpos(strtolower($xls_url), '.csv')) {
1198
  $format = 'csv';
1199
  $objReader = new PHPExcel_Reader_CSV();
 
 
1200
  } else {
1201
  throw new WDTException('File format not supported!');
1202
  }
@@ -1800,7 +1800,7 @@ class WPDataTable {
1800
 
1801
  if ($this->paginationEnabled()) {
1802
  $obj->dataTableParams->bPaginate = true;
1803
- $obj->dataTableParams->aLengthMenu = json_decode('[[10,25,50,100,-1],[10,25,50,100,"All"]]');
1804
  $obj->dataTableParams->iDisplayLength = (int)$this->getDisplayLength();
1805
  } else {
1806
  $obj->dataTableParams->bPaginate = false;
2
 
3
  defined('ABSPATH') or die("Cannot access pages directly.");
4
 
 
 
5
 
6
  /**
7
  * Main engine of wpDataTables plugin
476
  }
477
 
478
  public function setDisplayLength($length) {
479
+ if (!in_array($length, array(1, 5, 10, 20, 25, 30, 50, 100, 200, -1))) {
480
  return false;
481
  }
482
  $this->_lengthDisplay = $length;
725
  }
726
  }
727
 
728
+ if ($dataColumn && $dataColumn->getPossibleValuesType() == 'foreignkey' && $dataColumn->getForeignKeyRule() != null) {
729
  $foreignKeyData = $this->joinWithForeignWpDataTable($dataColumn->getOriginalHeader(), $dataColumn->getForeignKeyRule(), $this->getDataRows());
730
  $this->_dataRows = $foreignKeyData['dataRows'];
731
  $dataColumn->setPossibleValues($foreignKeyData['distinctValues']);
1195
  } elseif (strpos(strtolower($xls_url), '.csv')) {
1196
  $format = 'csv';
1197
  $objReader = new PHPExcel_Reader_CSV();
1198
+ $csvDelimiter = stripcslashes(get_option('wdtCSVDelimiter')) ? stripcslashes(get_option('wdtCSVDelimiter')) : WDTTools::detectCSVDelimiter($xls_url);
1199
+ $objReader->setDelimiter($csvDelimiter);
1200
  } else {
1201
  throw new WDTException('File format not supported!');
1202
  }
1800
 
1801
  if ($this->paginationEnabled()) {
1802
  $obj->dataTableParams->bPaginate = true;
1803
+ $obj->dataTableParams->aLengthMenu = json_decode('[[1,5,10,25,50,100,-1],[1,5,10,25,50,100,"All"]]');
1804
  $obj->dataTableParams->iDisplayLength = (int)$this->getDisplayLength();
1805
  } else {
1806
  $obj->dataTableParams->bPaginate = false;
templates/admin/chart_wizard/steps/charts_pick/highcharts.inc.php CHANGED
@@ -204,5 +204,28 @@
204
  </div>
205
  </div>
206
  </div>
207
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
  </div>
204
  </div>
205
  </div>
206
  </div>
207
+ <div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
208
+ <div class="card" data-type="highcharts_treemap_chart" data-min_columns="2" data-max_columns="2">
209
+ <div class="card-header">
210
+ <div class="wdt-chart-wizard-overlay"></div>
211
+ <img class="img-responsive"
212
+ src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/highcharts_treemap_chart.jpg">
213
+ </div>
214
+ <div class="card-body">
215
+ <h4 class="f-14"><?php _e('Treemap chart', 'wpdatatables'); ?></h4>
216
+ </div>
217
+ </div>
218
+ </div>
219
+ <div class="wdt-chart-wizard-chart-selecter-block col-sm-2">
220
+ <div class="card" data-type="highcharts_treemap_level_chart" data-min_columns="3" data-max_columns="0">
221
+ <div class="card-header">
222
+ <div class="wdt-chart-wizard-overlay"></div>
223
+ <img class="img-responsive"
224
+ src="<?php echo WDT_ASSETS_PATH ?>img/chart-thumbs/highcharts_treemap_level_chart.jpg">
225
+ </div>
226
+ <div class="card-body">
227
+ <h4 class="f-14"><?php _e('Treemap level chart', 'wpdatatables'); ?></h4>
228
+ </div>
229
+ </div>
230
+ </div>
231
  </div>
templates/admin/settings/tabs/color_and_font_settings.php CHANGED
@@ -226,6 +226,30 @@
226
  </div>
227
  </div>
228
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  </div>
230
  </div>
231
  </div>
@@ -607,4 +631,138 @@
607
  </div>
608
  </div>
609
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
610
  </div>
226
  </div>
227
  </div>
228
  </div>
229
+ <div class="col-sm-3 wdt-remove-borders">
230
+ <h5 class="c-black m-b-20">
231
+ <?php _e('Table borders', 'wpdatatables'); ?>
232
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
233
+ title="<?php _e('When this is checked, borders in table will be removed ', 'wpdatatables'); ?>"></i>
234
+ </h5>
235
+ <div class="toggle-switch" data-ts-color="blue">
236
+ <label for="wdt-remove-borders" class="ts-label">Remove borders in table</label>
237
+ <input type="checkbox" name="wdt-remove-borders" id="wdt-remove-borders" <?php echo ' data-version="full-version-option"' ?>/>
238
+ <label for="wdt-remove-borders" class="ts-helper"></label>
239
+ </div>
240
+ </div>
241
+ <div class="col-sm-3 wdt-remove-borders-header">
242
+ <h5 class="c-black m-b-20">
243
+ <?php _e('Header border', 'wpdatatables'); ?>
244
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
245
+ title="<?php _e('When this is checked,borders in header will be removed ', 'wpdatatables'); ?>"></i>
246
+ </h5>
247
+ <div class="toggle-switch" data-ts-color="blue">
248
+ <label for="wdt-remove-borders-table" class="ts-label">Remove borders in header</label>
249
+ <input type="checkbox" name="wdt-remove-borders-header" id="wdt-remove-borders-header" <?php echo ' data-version="full-version-option"' ?>/>
250
+ <label for="wdt-remove-borders-header" class="ts-helper"></label>
251
+ </div>
252
+ </div>
253
  </div>
254
  </div>
255
  </div>
631
  </div>
632
  </div>
633
  </div>
634
+ <div class="row">
635
+ <div class="panel-group col-sm-12" role="tablist" aria-multiselectable="true">
636
+ <div class="panel panel-collapse">
637
+ <div class="panel-heading" role="tab" id="heading-eight">
638
+ <h4 class="panel-title">
639
+ <a data-toggle="collapse" data-parent="#accordion" href="#collapse-eight" aria-expanded="true"
640
+ aria-controls="collapse-eight">Pagination</a>
641
+ </h4>
642
+ </div>
643
+ <div id="collapse-eight" class="collapse" role="tabpanel" aria-labelledby="heading-eight">
644
+ <div class="panel-body">
645
+ <div class="col-sm-3">
646
+ <h5 class="c-black m-b-20">
647
+ <?php _e('Background color', 'wpdatatables'); ?>
648
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
649
+ title="<?php _e('This color is used for the background of the pagination', 'wpdatatables'); ?>"></i>
650
+ </h5>
651
+ <div class="cp-container">
652
+ <div class="form-group">
653
+ <div class="fg-line dropdown">
654
+ <div id="cp"
655
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
656
+ <input type="text" id="wdt-pagination-background-color"
657
+ data-name="wdtPaginationBackgroundColor" class="form-control cp-value"
658
+ value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
659
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
660
+ </div>
661
+ </div>
662
+ </div>
663
+ </div>
664
+ </div>
665
+ <div class="col-sm-3">
666
+ <h5 class="c-black m-b-20">
667
+ <?php _e('Color', 'wpdatatables'); ?>
668
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
669
+ title="<?php _e('This color is used for the color of the links in the pagination.', 'wpdatatables'); ?>"></i>
670
+ </h5>
671
+ <div class="cp-container">
672
+ <div class="form-group">
673
+ <div class="fg-line dropdown">
674
+ <div id="cp"
675
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
676
+ <input type="text" id="wdt-pagination--color"
677
+ data-name="wdtPaginationColor" class="form-control cp-value"
678
+ value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
679
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
680
+ </div>
681
+ </div>
682
+ </div>
683
+ </div>
684
+ </div>
685
+ <div class="col-sm-3">
686
+ <h5 class="c-black m-b-20">
687
+ <?php _e('Current page background color', 'wpdatatables'); ?>
688
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
689
+ title="<?php _e('The color is used for background of the current page', 'wpdatatables'); ?>"></i>
690
+ </h5>
691
+ <div class="cp-container">
692
+ <div class="form-group">
693
+ <div class="fg-line dropdown">
694
+ <div id="cp"
695
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
696
+ <input type="text" id="wdt-pagination-current-background-color" data-name="wdtPaginationCurrentBackgroundColor"
697
+ class="form-control cp-value" value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
698
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
699
+ </div>
700
+ </div>
701
+ </div>
702
+ </div>
703
+ </div>
704
+ <div class="col-sm-3">
705
+ <h5 class="c-black m-b-20">
706
+ <?php _e('Current page color', 'wpdatatables'); ?>
707
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
708
+ title="<?php _e('This color is used for the color of the current page.', 'wpdatatables'); ?>"></i>
709
+ </h5>
710
+ <div class="cp-container">
711
+ <div class="form-group">
712
+ <div class="fg-line dropdown">
713
+ <div id="cp"
714
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
715
+ <input type="text" id="wdt-pagination-current-color"
716
+ data-name="wdtPaginationCurrentColor" class="form-control cp-value"
717
+ value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
718
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
719
+ </div>
720
+ </div>
721
+ </div>
722
+ </div>
723
+ </div>
724
+ <div class="col-sm-3">
725
+ <h5 class="c-black m-b-20">
726
+ <?php _e('Other pages hover background color', 'wpdatatables'); ?>
727
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
728
+ title="<?php _e('This background color is used when you hover the mouse above the other pages', 'wpdatatables'); ?>"></i>
729
+ </h5>
730
+ <div class="cp-container">
731
+ <div class="form-group">
732
+ <div class="fg-line dropdown">
733
+ <div id="cp"
734
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
735
+ <input type="text" id="wdt-pagination-hover-background-color" data-name="wdtPaginationHoverBackgroundColor"
736
+ class="form-control cp-value" value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
737
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
738
+ </div>
739
+ </div>
740
+ </div>
741
+ </div>
742
+ </div>
743
+ <div class="col-sm-3">
744
+ <h5 class="c-black m-b-20">
745
+ <?php _e('Other pages hover color', 'wpdatatables'); ?>
746
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
747
+ title="<?php _e('This color is used when you hover the mouse above the other pages.', 'wpdatatables'); ?>"></i>
748
+ </h5>
749
+ <div class="cp-container">
750
+ <div class="form-group">
751
+ <div class="fg-line dropdown">
752
+ <div id="cp"
753
+ class="input-group colorpicker-component colorpicker-element color-picker wpcolorpicker">
754
+ <input type="text" id="wdt-pagination-hover-color"
755
+ data-name="wdtPaginationHoverColor" class="form-control cp-value"
756
+ value=""<?php echo ' data-version="full-version-option-focus"' ?>/>
757
+ <span class="input-group-addon wpcolorpicker-icon"><i></i></span>
758
+ </div>
759
+ </div>
760
+ </div>
761
+ </div>
762
+ </div>
763
+ </div>
764
+ </div>
765
+ </div>
766
+ </div>
767
+ </div>
768
  </div>
templates/admin/settings/tabs/main_plugin_settings.php CHANGED
@@ -162,6 +162,29 @@
162
  </div>
163
  </div>
164
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  <div class="row">
166
  <div class="col-sm-4 tablet-width">
167
  <h4 class="c-black m-b-20">
@@ -315,6 +338,7 @@
315
  </div>
316
 
317
  </div>
 
318
  <!-- /.row -->
319
  <div class="row">
320
  <div class="col-sm-4 purchase-code">
@@ -334,27 +358,44 @@
334
  </div>
335
  </div>
336
  </div>
 
 
 
 
 
 
337
  <div class="col-sm-4 wdt-include-bootstrap-block">
338
  <h4 class="c-black m-b-20">
339
- <?php _e('Include bootstrap', 'wpdatatables'); ?>
340
  <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
341
- title="<?php _e('If bootstrap.js is already included in one of the theme files it is recommended to uncheck this option', 'wpdatatables'); ?>"></i>
342
  </h4>
343
  <div class="toggle-switch" data-ts-color="blue">
344
- <label for="wdt-include-bootstrap" class="ts-label">Include bootstrap.js on the front-end</label>
345
- <input type="checkbox" name="wdt-include-bootstrap" id="wdt-include-bootstrap" checked="checked"/>
346
  <label for="wdt-include-bootstrap" class="ts-helper"></label>
347
  </div>
348
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
349
  </div>
350
 
351
- <?php echo '
352
  <div class="row">
353
  <div class="col-sm-4 wdt-site-link-block">
354
- <h4 class="c-black m-b-20">'; ?>
355
- <?php _e('Show plugin credentials below tables', 'wpdatatables'); ?>
356
- <?php echo '<i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
357
- title="'; ?><?php _e('If you want to support our project, please, keep this checkbox as checked', 'wpdatatables'); ?><?php echo '"></i>
358
  </h4>
359
  <div class="toggle-switch" data-ts-color="blue">
360
  <label for="wdt-site-link" class="ts-label">Show plugin credentials below tables</label>
@@ -362,6 +403,5 @@
362
  <label for="wdt-site-link" class="ts-helper"></label>
363
  </div>
364
  </div>
365
- </div>' ?>
366
-
367
  </div>
162
  </div>
163
  </div>
164
  </div>
165
+ <div class="row">
166
+ <div class="col-sm-4 csv-delimiter">
167
+ <h4 class="c-black m-b-20">
168
+ <?php _e('CSV delimiter', 'wpdatatables'); ?>
169
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
170
+ title="<?php _e('Pick the CSV delimiter', 'wpdatatables'); ?>"></i>
171
+ </h4>
172
+ <div class="form-group">
173
+ <div class="fg-line">
174
+ <div class="select">
175
+ <select class="selectpicker" id="wdt-csv-delimiter">
176
+ <option value=""></option>
177
+ <option value=",">,</option>
178
+ <option value=":">:</option>
179
+ <option value=";">;</option>
180
+ <option value="|">|</option>
181
+ <option value="\t">TAB</option>
182
+ </select>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
  <div class="row">
189
  <div class="col-sm-4 tablet-width">
190
  <h4 class="c-black m-b-20">
338
  </div>
339
 
340
  </div>
341
+
342
  <!-- /.row -->
343
  <div class="row">
344
  <div class="col-sm-4 purchase-code">
358
  </div>
359
  </div>
360
  </div>
361
+
362
+
363
+ </div>
364
+ <!-- /.row -->
365
+ <!-- Include bootstrap on front and back settings -->
366
+ <div class="row">
367
  <div class="col-sm-4 wdt-include-bootstrap-block">
368
  <h4 class="c-black m-b-20">
369
+ <?php _e('Include full bootstrap front-end', 'wpdatatables'); ?>
370
  <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
371
+ title="<?php _e('It is recommended to uncheck this option if bootstrap.js is already included in one of the theme files. Unchecked option means that there is still bootstrap.js included just in noconflict mode which should prevent errors.', 'wpdatatables'); ?>"></i>
372
  </h4>
373
  <div class="toggle-switch" data-ts-color="blue">
374
+ <label for="wdt-include-bootstrap" class="ts-label">Include full bootstrap.js on the front-end</label>
375
+ <input type="checkbox" name="wdt-include-bootstrap" id="wdt-include-bootstrap"/>
376
  <label for="wdt-include-bootstrap" class="ts-helper"></label>
377
  </div>
378
  </div>
379
+ <div class="col-sm-4 wdt-include-bootstrap-back-end-block">
380
+ <h4 class="c-black m-b-20">
381
+ <?php _e('Include full bootstrap back-end', 'wpdatatables'); ?>
382
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
383
+ title="<?php _e('It is recommended to uncheck this option if bootstrap.js is already included in one of the theme files. Unchecked option means that there is still bootstrap.js included just in noconflict mode which should prevent errors.', 'wpdatatables'); ?>"></i>
384
+ </h4>
385
+ <div class="toggle-switch" data-ts-color="blue">
386
+ <label for="wdt-include-bootstrap-back-end" class="ts-label">Include full bootstrap.js on the back-end</label>
387
+ <input type="checkbox" name="wdt-include-bootstrap-back-end" id="wdt-include-bootstrap-back-end"/>
388
+ <label for="wdt-include-bootstrap-back-end" class="ts-helper"></label>
389
+ </div>
390
+ </div>
391
  </div>
392
 
 
393
  <div class="row">
394
  <div class="col-sm-4 wdt-site-link-block">
395
+ <h4 class="c-black m-b-20">
396
+ <?php _e('Show plugin credentials below tables', 'wpdatatables'); ?>
397
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
398
+ title="<?php _e('If you want to support our project, please, keep this checkbox as checked', 'wpdatatables');?>"></i>
399
  </h4>
400
  <div class="toggle-switch" data-ts-color="blue">
401
  <label for="wdt-site-link" class="ts-label">Show plugin credentials below tables</label>
403
  <label for="wdt-site-link" class="ts-helper"></label>
404
  </div>
405
  </div>
406
+ </div>
 
407
  </div>
templates/admin/table-settings/column_settings_panel.inc.php CHANGED
@@ -530,6 +530,28 @@
530
  </div>
531
  </div>
532
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  </div>
534
  <!-- /.row -->
535
 
530
  </div>
531
  </div>
532
 
533
+ <div class="col-sm-6">
534
+ <h4 class="c-black m-b-20">
535
+ <?php _e('Number of possible values to load', 'wpdatatables'); ?>
536
+ <i class="zmdi zmdi-help-outline" data-toggle="tooltip" data-placement="right"
537
+ title="<?php _e('Define here how many possible values per page will be loaded in selectbox filters and editor inputs. It is recommended not to be set to All if you have more than 50 possible values for this column. This option is not working when Cascade Filtering option from Powerful Filters add-on is enabled.', 'wpdatatables'); ?>"></i>
538
+ </h4>
539
+ <div class="form-group">
540
+ <div class="fg-line">
541
+ <div class="select">
542
+ <select class="selectpicker" id="wdt-possible-values-ajax" <?php echo ' data-version="full-version-option"' ?>>
543
+ <option value="10">10</option>
544
+ <option value="25">25</option>
545
+ <option value="50">50</option>
546
+ <option value="100">100</option>
547
+ <option value="-1"><?php _e('All', 'wpdatatables'); ?></option>
548
+ </select>
549
+ </div>
550
+ </div>
551
+ </div>
552
+
553
+ </div>
554
+
555
  </div>
556
  <!-- /.row -->
557
 
templates/admin/table-settings/table_settings_block.inc.php CHANGED
@@ -309,6 +309,8 @@
309
  <div class="fg-line">
310
  <div class="select">
311
  <select class="form-control selectpicker" id="wdt-rows-per-page">
 
 
312
  <option value="10">10</option>
313
  <option value="25">25</option>
314
  <option value="50">50</option>
309
  <div class="fg-line">
310
  <div class="select">
311
  <select class="form-control selectpicker" id="wdt-rows-per-page">
312
+ <option value="1">1</option>
313
+ <option value="5">5</option>
314
  <option value="10">10</option>
315
  <option value="25">25</option>
316
  <option value="50">50</option>
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.2 Lite
9
  Author: TMS-Plugins
10
  Author URI: http://tms-plugins.com
11
  Text Domain: wpdatatables
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.3 Lite
9
  Author: TMS-Plugins
10
  Author URI: http://tms-plugins.com
11
  Text Domain: wpdatatables