wpDataTables Lite - Version 2.1.22

Version Description

  • Improvement: Added pagination above the table on browse page for tables and charts.
  • Improvement: Added new hook to filter URL of PHP array tables: wpdatatables_filter_url_php_array.
  • Improvement: Add new pre-formatted hooks for all column types in datatables: wpdatatables_filter_date_cell_before_formatting, wpdatatables_filter_time_cell_before_formatting, wpdatatables_filter_datetime_cell_before_formatting, wpdatatables_filter_link_cell_before_formatting, wpdatatables_filter_email_cell_before_formatting, wpdatatables_filter_string_cell_before_formatting, wpdatatables_filter_int_cell_before_formatting, wpdatatables_filter_float_cell_before_formatting and wpdatatables_filter_image_cell_before_formatting.
  • Bugfix: Fixed notice for deprecated hook in Gutenberg.
  • Bugfix: Fixed issue with browsing tables and charts with search
  • Compatibility with WordPress 5.8.2 approved.
  • Other small bug fixes and stability improvements
Download this release

Release Info

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

Code changes from version 2.1.21 to 2.1.22

assets/js/wpdatatables/admin/browse/wdt.browse.js CHANGED
@@ -22,7 +22,7 @@ var duplicate_table_id = '';
22
  /**
23
  * Search tables and charts in backend
24
  */
25
- $("input#search_id-search-input").on("keyup", _.debounce(function() {
26
  $("button#search-submit").click();
27
  }, 800)
28
  );
22
  /**
23
  * Search tables and charts in backend
24
  */
25
+ $("input#search_id-search-input").on("keyup input", _.debounce(function() {
26
  $("button#search-submit").click();
27
  }, 800)
28
  );
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.21');
13
 
14
  /**
15
  * Regular Expressions
9
 
10
  // Current version
11
 
12
+ define('WDT_CURRENT_VERSION', '2.1.22');
13
 
14
  /**
15
  * Regular Expressions
controllers/wdt_functions.php CHANGED
@@ -750,13 +750,13 @@ function wdtSanitizeQuery($query) {
750
  function initGutenbergBlocks (){
751
  WpDataTablesGutenbergBlock::init();
752
  WpDataChartsGutenbergBlock::init();
753
- add_filter( 'block_categories', 'addWpDataTablesBlockCategory', 10, 2);
754
  }
755
 
756
  add_action('plugins_loaded', 'initGutenbergBlocks');
757
 
758
  /**
759
- * Creating Amelia block category in Gutenberg
760
  */
761
  function addWpDataTablesBlockCategory ($categories, $post) {
762
  return array_merge(
750
  function initGutenbergBlocks (){
751
  WpDataTablesGutenbergBlock::init();
752
  WpDataChartsGutenbergBlock::init();
753
+ add_filter( 'block_categories_all', 'addWpDataTablesBlockCategory', 10, 2);
754
  }
755
 
756
  add_action('plugins_loaded', 'initGutenbergBlocks');
757
 
758
  /**
759
+ * Creating wpDataTables block category in Gutenberg
760
  */
761
  function addWpDataTablesBlockCategory ($categories, $post) {
762
  return array_merge(
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
  Contributors: wpDataTables
3
  Author URI: https://tms-outsource.com
4
  Plugin URI: https://wpdatatables.com/
5
- Tags: table, table builder, data tables, tables, charts, simple table, tables from csv, tables from excel, datatables, responsive tables, charting, pie charts, mysql tables, table plugin, wp table, WordPress table Plugin, Google Charts, Excel, JSON, XML, PHP array, line chart, donut, bar chart, histogram, area chart, bubble chart, gauge chart, scatter chart, candlestick, waterfall
6
  Requires at least: 4.0
7
- Tested up to: 5.8.1
8
  Requires PHP: 5.6
9
- Stable tag: 2.1.21
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -238,6 +238,20 @@ This can be changed from the “Number format” drop-down menu in the wpDataTab
238
 
239
  == Changelog ==
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  = 2.1.21 =
242
  * Feature: Added new options for link columns in datatables (noreferrer and sponsored attributes)
243
  * Feature: Added new options for link editor in simple table (noreferrer and sponsored attributes)
2
  Contributors: wpDataTables
3
  Author URI: https://tms-outsource.com
4
  Plugin URI: https://wpdatatables.com/
5
+ Tags: table, table builder, data tables, tables, charts, datatables, simple table, tables from csv, tables from excel, responsive tables, charting, pie charts, mysql tables, table plugin, wp table, WordPress table Plugin, Google Charts, Excel, JSON, XML, PHP array, line chart, donut, bar chart, histogram, area chart, bubble chart, gauge chart, scatter chart, candlestick, waterfall
6
  Requires at least: 4.0
7
+ Tested up to: 5.8.2
8
  Requires PHP: 5.6
9
+ Stable tag: 2.1.22
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
238
 
239
  == Changelog ==
240
 
241
+ = 2.1.22 =
242
+ * Improvement: Added pagination above the table on browse page for tables and charts.
243
+ * Improvement: Added new hook to filter URL of PHP array tables: wpdatatables_filter_url_php_array.
244
+ * Improvement: Add new pre-formatted hooks for all column types in datatables:
245
+ wpdatatables_filter_date_cell_before_formatting, wpdatatables_filter_time_cell_before_formatting,
246
+ wpdatatables_filter_datetime_cell_before_formatting, wpdatatables_filter_link_cell_before_formatting,
247
+ wpdatatables_filter_email_cell_before_formatting, wpdatatables_filter_string_cell_before_formatting,
248
+ wpdatatables_filter_int_cell_before_formatting, wpdatatables_filter_float_cell_before_formatting
249
+ and wpdatatables_filter_image_cell_before_formatting.
250
+ * Bugfix: Fixed notice for deprecated hook in Gutenberg.
251
+ * Bugfix: Fixed issue with browsing tables and charts with search
252
+ * Compatibility with WordPress 5.8.2 approved.
253
+ * Other small bug fixes and stability improvements
254
+
255
  = 2.1.21 =
256
  * Feature: Added new options for link columns in datatables (noreferrer and sponsored attributes)
257
  * Feature: Added new options for link editor in simple table (noreferrer and sponsored attributes)
source/class.date.wpdatacolumn.php CHANGED
@@ -29,6 +29,9 @@ class DateWDTColumn extends WDTColumn {
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
 
 
 
32
  if (!is_array($content)) {
33
  if (!empty($content) && ($content != '0000-00-00')) {
34
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
@@ -40,8 +43,7 @@ class DateWDTColumn extends WDTColumn {
40
  $content['value'] = str_replace('/', '-', $content['value']);
41
  $formattedValue = date(get_option('wdtDateFormat'), strtotime($content['value']));
42
  }
43
- $formattedValue = apply_filters('wpdatatables_filter_date_cell', $formattedValue, $this->getParentTable()->getWpId());
44
- return $formattedValue;
45
  }
46
 
47
  /**
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
32
+
33
+ $content = apply_filters('wpdatatables_filter_date_cell_before_formatting', $content, $this->getParentTable()->getWpId());
34
+
35
  if (!is_array($content)) {
36
  if (!empty($content) && ($content != '0000-00-00')) {
37
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
43
  $content['value'] = str_replace('/', '-', $content['value']);
44
  $formattedValue = date(get_option('wdtDateFormat'), strtotime($content['value']));
45
  }
46
+ return apply_filters('wpdatatables_filter_date_cell', $formattedValue, $this->getParentTable()->getWpId());
 
47
  }
48
 
49
  /**
source/class.datetime.wpdatacolumn.php CHANGED
@@ -29,6 +29,9 @@ class DateTimeWDTColumn extends WDTColumn {
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
 
 
 
32
  if (!is_array($content)) {
33
  if (!empty($content) && ($content != '0000-00-00')) {
34
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
@@ -40,8 +43,7 @@ class DateTimeWDTColumn extends WDTColumn {
40
  $content['value'] = str_replace('/', '-', $content['value']);
41
  $formattedValue = date(get_option('wdtDateFormat') . ' ' . get_option('wdtTimeFormat'), strtotime($content['value']));
42
  }
43
- $formattedValue = apply_filters('wpdatatables_filter_datetime_cell', $formattedValue, $this->getParentTable()->getWpId());
44
- return $formattedValue;
45
  }
46
 
47
  /**
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
32
+
33
+ $content = apply_filters('wpdatatables_filter_datetime_cell_before_formatting', $content, $this->getParentTable()->getWpId());
34
+
35
  if (!is_array($content)) {
36
  if (!empty($content) && ($content != '0000-00-00')) {
37
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
43
  $content['value'] = str_replace('/', '-', $content['value']);
44
  $formattedValue = date(get_option('wdtDateFormat') . ' ' . get_option('wdtTimeFormat'), strtotime($content['value']));
45
  }
46
+ return apply_filters('wpdatatables_filter_datetime_cell', $formattedValue, $this->getParentTable()->getWpId());
 
47
  }
48
 
49
  /**
source/class.email.wpdatacolumn.php CHANGED
@@ -24,14 +24,15 @@ class EmailWDTColumn extends WDTColumn
24
  */
25
  public function prepareCellOutput($content)
26
  {
 
 
27
  if (strpos($content, '||') !== false) {
28
  list($link, $content) = explode('||', $content);
29
  $formattedValue = "<a href='mailto:{$link}'>{$content}</a>";
30
  } else {
31
  $formattedValue = "<a href='mailto:{$content}'>{$content}</a>";
32
  }
33
- $formattedValue = apply_filters('wpdatatables_filter_email_cell', $formattedValue, $this->getParentTable()->getWpId());
34
- return $formattedValue;
35
  }
36
 
37
  }
24
  */
25
  public function prepareCellOutput($content)
26
  {
27
+ $content = apply_filters('wpdatatables_filter_email_cell_before_formatting', $content, $this->getParentTable()->getWpId());
28
+
29
  if (strpos($content, '||') !== false) {
30
  list($link, $content) = explode('||', $content);
31
  $formattedValue = "<a href='mailto:{$link}'>{$content}</a>";
32
  } else {
33
  $formattedValue = "<a href='mailto:{$content}'>{$content}</a>";
34
  }
35
+ return apply_filters('wpdatatables_filter_email_cell', $formattedValue, $this->getParentTable()->getWpId());
 
36
  }
37
 
38
  }
source/class.float.wpdatacolumn.php CHANGED
@@ -25,6 +25,8 @@ class FloatWDTColumn extends WDTColumn {
25
  */
26
  public function prepareCellOutput($content) {
27
 
 
 
28
  if ($content === '' || $content === null) {
29
  $content = '';
30
  return $content;
@@ -47,8 +49,7 @@ class FloatWDTColumn extends WDTColumn {
47
  );
48
  }
49
 
50
- $formattedValue = apply_filters('wpdatatables_filter_float_cell', $formattedValue, $this->getParentTable()->getWpId());
51
- return $formattedValue;
52
  }
53
 
54
  /**
25
  */
26
  public function prepareCellOutput($content) {
27
 
28
+ $content = apply_filters('wpdatatables_filter_float_cell_before_formatting', $content, $this->getParentTable()->getWpId());
29
+
30
  if ($content === '' || $content === null) {
31
  $content = '';
32
  return $content;
49
  );
50
  }
51
 
52
+ return apply_filters('wpdatatables_filter_float_cell', $formattedValue, $this->getParentTable()->getWpId());
 
53
  }
54
 
55
  /**
source/class.image.wpdatacolumn.php CHANGED
@@ -24,6 +24,8 @@ class ImageWDTColumn extends WDTColumn
24
  */
25
  public function prepareCellOutput($content)
26
  {
 
 
27
  if (empty($content)) {
28
  return '';
29
  }
@@ -33,8 +35,7 @@ class ImageWDTColumn extends WDTColumn
33
  } else {
34
  $formattedValue = "<img src='{$content}' />";
35
  }
36
- $formattedValue = apply_filters('wpdatatables_filter_image_cell', $formattedValue, $this->getParentTable()->getWpId());
37
- return $formattedValue;
38
  }
39
 
40
  }
24
  */
25
  public function prepareCellOutput($content)
26
  {
27
+ $content = apply_filters('wpdatatables_filter_image_cell_before_formatting', $content, $this->getParentTable()->getWpId());
28
+
29
  if (empty($content)) {
30
  return '';
31
  }
35
  } else {
36
  $formattedValue = "<img src='{$content}' />";
37
  }
38
+ return apply_filters('wpdatatables_filter_image_cell', $formattedValue, $this->getParentTable()->getWpId());
 
39
  }
40
 
41
  }
source/class.int.wpdatacolumn.php CHANGED
@@ -27,6 +27,7 @@ class IntWDTColumn extends WDTColumn
27
  */
28
  public function prepareCellOutput($content)
29
  {
 
30
 
31
  if ($content === '' || $content === null) {
32
  $content = '';
@@ -49,8 +50,7 @@ class IntWDTColumn extends WDTColumn
49
  $this->isShowThousandsSeparator() ? ',' : ''
50
  );
51
  }
52
- $content = apply_filters('wpdatatables_filter_int_cell', $content, $this->getParentTable()->getWpId());
53
- return $content;
54
  }
55
 
56
  /**
27
  */
28
  public function prepareCellOutput($content)
29
  {
30
+ $content = apply_filters('wpdatatables_filter_int_cell_before_formatting', $content, $this->getParentTable()->getWpId());
31
 
32
  if ($content === '' || $content === null) {
33
  $content = '';
50
  $this->isShowThousandsSeparator() ? ',' : ''
51
  );
52
  }
53
+ return apply_filters('wpdatatables_filter_int_cell', $content, $this->getParentTable()->getWpId());
 
54
  }
55
 
56
  /**
source/class.link.wpdatacolumn.php CHANGED
@@ -46,6 +46,8 @@ class LinkWDTColumn extends WDTColumn
46
  $rel = $nofollowAttribute . $noreferrerAttribute . $sponsoredAttribute;
47
  $buttonClass = $this->getLinkButtonClass();
48
 
 
 
49
  if (strpos($content, '||') !== false) {
50
  list($link, $content) = explode('||', $content);
51
  $buttonLabel = $this->getLinkButtonLabel() !== '' ? $this->getLinkButtonLabel() : $content;
@@ -85,8 +87,7 @@ class LinkWDTColumn extends WDTColumn
85
  }
86
  }
87
  }
88
- $formattedValue = apply_filters('wpdatatables_filter_link_cell', $formattedValue, $this->getParentTable()->getWpId());
89
- return $formattedValue;
90
  }
91
 
92
  /**
46
  $rel = $nofollowAttribute . $noreferrerAttribute . $sponsoredAttribute;
47
  $buttonClass = $this->getLinkButtonClass();
48
 
49
+ $content = apply_filters('wpdatatables_filter_link_cell_before_formatting', $content, $this->getParentTable()->getWpId());
50
+
51
  if (strpos($content, '||') !== false) {
52
  list($link, $content) = explode('||', $content);
53
  $buttonLabel = $this->getLinkButtonLabel() !== '' ? $this->getLinkButtonLabel() : $content;
87
  }
88
  }
89
  }
90
+ return apply_filters('wpdatatables_filter_link_cell', $formattedValue, $this->getParentTable()->getWpId());
 
91
  }
92
 
93
  /**
source/class.string.wpdatacolumn.php CHANGED
@@ -17,11 +17,12 @@ class StringWDTColumn extends WDTColumn
17
 
18
  public function prepareCellOutput($content)
19
  {
 
 
20
  if (get_option('wdtParseShortcodes')) {
21
  $content = do_shortcode($content);
22
  }
23
- $content = apply_filters('wpdatatables_filter_string_cell', $content, $this->getParentTable()->getWpId());
24
- return $content;
25
  }
26
 
27
  }
17
 
18
  public function prepareCellOutput($content)
19
  {
20
+ $content = apply_filters('wpdatatables_filter_string_cell_before_formatting', $content, $this->getParentTable()->getWpId());
21
+
22
  if (get_option('wdtParseShortcodes')) {
23
  $content = do_shortcode($content);
24
  }
25
+ return apply_filters('wpdatatables_filter_string_cell', $content, $this->getParentTable()->getWpId());
 
26
  }
27
 
28
  }
source/class.time.wpdatacolumn.php CHANGED
@@ -29,6 +29,9 @@ class TimeWDTColumn extends WDTColumn {
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
 
 
 
32
  if (!is_array($content)) {
33
  if (!empty($content) && ($content != '0000-00-00')) {
34
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
@@ -40,8 +43,7 @@ class TimeWDTColumn extends WDTColumn {
40
  $content['value'] = str_replace('/', '-', $content['value']);
41
  $formattedValue = date(get_option('wdtTimeFormat'), strtotime($content['value']));
42
  }
43
- $formattedValue = apply_filters('wpdatatables_filter_time_cell', $formattedValue, $this->getParentTable()->getWpId());
44
- return $formattedValue;
45
  }
46
 
47
  }
29
  * @return false|mixed|string
30
  */
31
  public function prepareCellOutput($content) {
32
+
33
+ $content = apply_filters('wpdatatables_filter_time_cell_before_formatting', $content, $this->getParentTable()->getWpId());
34
+
35
  if (!is_array($content)) {
36
  if (!empty($content) && ($content != '0000-00-00')) {
37
  $timestamp = is_numeric($content) ? $content : strtotime(str_replace('/', '-', $content));
43
  $content['value'] = str_replace('/', '-', $content['value']);
44
  $formattedValue = date(get_option('wdtTimeFormat'), strtotime($content['value']));
45
  }
46
+ return apply_filters('wpdatatables_filter_time_cell', $formattedValue, $this->getParentTable()->getWpId());
 
47
  }
48
 
49
  }
source/class.wdtbrowsechartstable.php CHANGED
@@ -71,9 +71,9 @@ class WDTBrowseChartsTable extends WP_List_Table
71
 
72
  if (isset($_REQUEST['s'])) {
73
  if (is_numeric($_REQUEST['s'])){
74
- $query .= " WHERE id LIKE '" . sanitize_text_field($_POST['s']) . "'";
75
  }else{
76
- $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
77
  }
78
  }
79
 
@@ -98,9 +98,9 @@ class WDTBrowseChartsTable extends WP_List_Table
98
 
99
  if (isset($_REQUEST['s'])) {
100
  if (is_numeric($_REQUEST['s'])){
101
- $query .= " WHERE id LIKE '" . sanitize_text_field($_POST['s']) . "'";
102
  }else{
103
- $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
104
  }
105
  }
106
 
@@ -448,6 +448,11 @@ class WDTBrowseChartsTable extends WP_List_Table
448
  $removable_query_args = wp_removable_query_args();
449
  $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
450
  $current_url = remove_query_arg($removable_query_args, $current_url);
 
 
 
 
 
451
 
452
  /** Add current page to the array */
453
  if ($paged >= 1)
@@ -481,7 +486,7 @@ class WDTBrowseChartsTable extends WP_List_Table
481
  $disable_last = true;
482
  }
483
 
484
- require_once(WDT_ROOT_PATH . '/templates/admin/browse/pagination.inc.php');
485
  }
486
 
487
  /**
71
 
72
  if (isset($_REQUEST['s'])) {
73
  if (is_numeric($_REQUEST['s'])){
74
+ $query .= " WHERE id LIKE '" . sanitize_text_field($_REQUEST['s']) . "'";
75
  }else{
76
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_REQUEST['s']) . "%'";
77
  }
78
  }
79
 
98
 
99
  if (isset($_REQUEST['s'])) {
100
  if (is_numeric($_REQUEST['s'])){
101
+ $query .= " WHERE id LIKE '" . sanitize_text_field($_REQUEST['s']) . "'";
102
  }else{
103
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_REQUEST['s']) . "%'";
104
  }
105
  }
106
 
448
  $removable_query_args = wp_removable_query_args();
449
  $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
450
  $current_url = remove_query_arg($removable_query_args, $current_url);
451
+ $search_term = '';
452
+ if( isset($_REQUEST['s'] ) ){
453
+ $search_term = sanitize_text_field($_REQUEST['s']);
454
+ $current_url = add_query_arg( 's', $search_term, $current_url );
455
+ }
456
 
457
  /** Add current page to the array */
458
  if ($paged >= 1)
486
  $disable_last = true;
487
  }
488
 
489
+ require(WDT_ROOT_PATH . '/templates/admin/browse/pagination.inc.php');
490
  }
491
 
492
  /**
source/class.wdtbrowsetable.php CHANGED
@@ -65,10 +65,10 @@ class WDTBrowseTable extends WP_List_Table {
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);
@@ -89,10 +89,10 @@ class WDTBrowseTable extends WP_List_Table {
89
  $query = "SELECT id, title, table_type, editable FROM {$wpdb->prefix}wpdatatables ";
90
 
91
  if (isset($_REQUEST['s'])) {
92
- if (is_numeric($_REQUEST['s'])){
93
- $query .= " WHERE id LIKE '" . sanitize_text_field($_POST['s']) . "'";
94
- }else{
95
- $query .= " WHERE title LIKE '%" . sanitize_text_field($_POST['s']) . "%'";
96
  }
97
  }
98
 
@@ -409,7 +409,11 @@ class WDTBrowseTable extends WP_List_Table {
409
  $removable_query_args = wp_removable_query_args();
410
  $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
411
  $current_url = remove_query_arg($removable_query_args, $current_url);
412
-
 
 
 
 
413
  /** Add current page to the array */
414
  if ($paged >= 1)
415
  $links[] = $paged;
@@ -442,7 +446,7 @@ class WDTBrowseTable extends WP_List_Table {
442
  $disable_last = true;
443
  }
444
 
445
- require_once(WDT_ROOT_PATH . '/templates/admin/browse/pagination.inc.php');
446
  }
447
 
448
  /**
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($_REQUEST['s']) . "'";
70
+ } else {
71
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_REQUEST['s']) . "%'";
72
  }
73
  }
74
  $count = $wpdb->get_var($query);
89
  $query = "SELECT id, title, table_type, editable FROM {$wpdb->prefix}wpdatatables ";
90
 
91
  if (isset($_REQUEST['s'])) {
92
+ if (is_numeric($_REQUEST['s'])) {
93
+ $query .= " WHERE id LIKE '" . sanitize_text_field($_REQUEST['s']) . "'";
94
+ } else {
95
+ $query .= " WHERE title LIKE '%" . sanitize_text_field($_REQUEST['s']) . "%'";
96
  }
97
  }
98
 
409
  $removable_query_args = wp_removable_query_args();
410
  $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
411
  $current_url = remove_query_arg($removable_query_args, $current_url);
412
+ $search_term = '';
413
+ if( isset($_REQUEST['s'] ) ){
414
+ $search_term = sanitize_text_field($_REQUEST['s']);
415
+ $current_url = add_query_arg( 's', $search_term, $current_url );
416
+ }
417
  /** Add current page to the array */
418
  if ($paged >= 1)
419
  $links[] = $paged;
446
  $disable_last = true;
447
  }
448
 
449
+ require(WDT_ROOT_PATH . '/templates/admin/browse/pagination.inc.php');
450
  }
451
 
452
  /**
source/class.wpdatachart.php CHANGED
@@ -823,23 +823,31 @@ class WPDataChart
823
  break;
824
  case 'int':
825
  if (has_filter('wpdatatables_filter_int_cell_data_in_charts')) {
826
- $row[$columnKey] = apply_filters('wpdatatables_filter_int_cell_data_in_charts', $row[$columnKey], $columnKey, $this->_wpdatatable->getWpId());
827
- $return_data_row[] = $row[$columnKey];
 
 
 
 
828
  } else {
829
  $return_data_row[] = (float)$row[$columnKey];
830
  }
831
  break;
832
  case 'float':
833
  if (has_filter('wpdatatables_filter_float_cell_data_in_charts')) {
834
- $row[$columnKey] = apply_filters('wpdatatables_filter_float_cell_data_in_charts', $row[$columnKey], $columnKey, $this->_wpdatatable->getWpId());
835
- if ($decimalPlaces != -1){
836
- $return_data_row[] = number_format(
837
- ($row[$columnKey]),
838
- $decimalPlaces,
839
- '.',
840
- $thousandsSeparator ? '' : '.');
841
- }else {
842
- $return_data_row[] = $row[$columnKey];
 
 
 
 
843
  }
844
  } else {
845
  if ($decimalPlaces != -1){
@@ -867,6 +875,7 @@ class WPDataChart
867
  foreach ($this->getSelectedColumns() as $columnKey) {
868
 
869
  $dataType = $this->_wpdatatable->getColumn($columnKey)->getDataType();
 
870
  switch ($dataType) {
871
  case 'date':
872
  $timestamp = is_int($this->_wpdatatable->getCell($columnKey, $rowIndex)) ?
@@ -900,10 +909,50 @@ class WPDataChart
900
  );
901
  break;
902
  case 'int':
903
- $return_data_row[] = (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);
 
 
 
 
 
 
 
 
 
904
  break;
905
  case 'float':
906
- $return_data_row[] = (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
907
  break;
908
  case 'string':
909
  default:
823
  break;
824
  case 'int':
825
  if (has_filter('wpdatatables_filter_int_cell_data_in_charts')) {
826
+ $row[$columnKey] = apply_filters('wpdatatables_filter_int_cell_data_in_charts', $row[$columnKey], $columnKey, $this->getId(), $this->_wpdatatable->getWpId());
827
+ if (!is_null($row[$columnKey])) {
828
+ $return_data_row[] = (float)$row[$columnKey];
829
+ } else {
830
+ $return_data_row[] = null;
831
+ }
832
  } else {
833
  $return_data_row[] = (float)$row[$columnKey];
834
  }
835
  break;
836
  case 'float':
837
  if (has_filter('wpdatatables_filter_float_cell_data_in_charts')) {
838
+ $row[$columnKey] = apply_filters('wpdatatables_filter_float_cell_data_in_charts', $row[$columnKey], $columnKey, $this->getId(), $this->_wpdatatable->getWpId());
839
+ if (!is_null($row[$columnKey])) {
840
+ if ($decimalPlaces != -1) {
841
+ $return_data_row[] = (float)number_format(
842
+ (float)($row[$columnKey]),
843
+ $decimalPlaces,
844
+ '.',
845
+ $thousandsSeparator ? '' : '.');
846
+ } else {
847
+ $return_data_row[] = (float)$row[$columnKey];
848
+ }
849
+ } else {
850
+ $return_data_row[] = null;
851
  }
852
  } else {
853
  if ($decimalPlaces != -1){
875
  foreach ($this->getSelectedColumns() as $columnKey) {
876
 
877
  $dataType = $this->_wpdatatable->getColumn($columnKey)->getDataType();
878
+ $decimalPlaces =$this->_wpdatatable->getColumn($columnKey)->getDecimalPlaces();
879
  switch ($dataType) {
880
  case 'date':
881
  $timestamp = is_int($this->_wpdatatable->getCell($columnKey, $rowIndex)) ?
909
  );
910
  break;
911
  case 'int':
912
+ if (has_filter('wpdatatables_filter_int_cell_data_in_charts')) {
913
+ $cellData = apply_filters('wpdatatables_filter_int_cell_data_in_charts', $this->_wpdatatable->getCell($columnKey, $rowIndex), $columnKey, $this->getId(), $this->_wpdatatable->getWpId());
914
+ if (!is_null($cellData)) {
915
+ $return_data_row[] = (float)$cellData;
916
+ } else {
917
+ $return_data_row[] = null;
918
+ }
919
+ }else {
920
+ $return_data_row[] = (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);
921
+ }
922
  break;
923
  case 'float':
924
+ if (has_filter('wpdatatables_filter_float_cell_data_in_charts')) {
925
+ $floatNumber = apply_filters('wpdatatables_filter_float_cell_data_in_charts', $this->_wpdatatable->getCell($columnKey, $rowIndex), $columnKey , $this->getId(), $this->_wpdatatable->getWpId());
926
+ if (!is_null($floatNumber)) {
927
+ if ($decimalPlaces != -1) {
928
+ $return_data_row[] = (float)number_format($floatNumber, $decimalPlaces);
929
+ } else {
930
+ $return_data_row[] = $floatNumber;
931
+ }
932
+ } else {
933
+ $return_data_row[] = null;
934
+ }
935
+ } else {
936
+ $floatNumber= (float)$this->_wpdatatable->getCell($columnKey, $rowIndex);;
937
+ if ($decimalPlaces != -1){
938
+ $return_data_row[] = (float)number_format ($floatNumber, $decimalPlaces);
939
+ } else {
940
+ $return_data_row[] = $floatNumber;
941
+ }
942
+ }
943
+ break;
944
+ case 'link':
945
+ $cellData = $this->_wpdatatable->getCell($columnKey, $rowIndex);
946
+ if (!in_array($this->getEngine(),['google','chartjs'])) {
947
+ if (strpos($cellData, '||') !== false) {
948
+ list($link, $cellData) = explode('||', $cellData);
949
+ $return_data_row[] = '<a href="' . $link . '">' . $cellData . '</a>';
950
+ } else {
951
+ $return_data_row[] = '<a href="' . $cellData . '">' . $cellData . '</a>';
952
+ }
953
+ } else {
954
+ $return_data_row[] = $cellData;
955
+ }
956
  break;
957
  case 'string':
958
  default:
source/class.wpdatatable.php CHANGED
@@ -1962,7 +1962,8 @@ class WPDataTable
1962
  );
1963
  break;
1964
  case 'serialized':
1965
- $serialized_content = apply_filters('wpdatatables_filter_serialized', WDTTools::curlGetData($tableData->content), $this->_wpId);
 
1966
  $array = unserialize($serialized_content);
1967
  $this->arrayBasedConstruct(
1968
  $array,
1962
  );
1963
  break;
1964
  case 'serialized':
1965
+ $url = apply_filters('wpdatatables_filter_url_php_array', $tableData->content, $this->getWpId());
1966
+ $serialized_content = apply_filters('wpdatatables_filter_serialized', WDTTools::curlGetData($url), $this->getWpId());
1967
  $array = unserialize($serialized_content);
1968
  $this->arrayBasedConstruct(
1969
  $array,
templates/admin/browse/pagination.inc.php CHANGED
@@ -35,8 +35,10 @@
35
  // Link to current page, plus 2 pages in either direction if necessary
36
  sort($links);
37
  foreach ((array)$links as $link) {
 
38
  $class = $paged == $link ? ' class="active"' : '';
39
- printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)), $link);
 
40
  }
41
 
42
  // Ellipse sign on right side
35
  // Link to current page, plus 2 pages in either direction if necessary
36
  sort($links);
37
  foreach ((array)$links as $link) {
38
+ $search_term_temp = '';
39
  $class = $paged == $link ? ' class="active"' : '';
40
+ $search_term_temp = $search_term != '' ? '&s=' . $search_term : '';
41
+ printf('<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url(get_pagenum_link($link)) . $search_term_temp, $link);
42
  }
43
 
44
  // Ellipse sign on right side
templates/admin/browse/table_list.inc.php CHANGED
@@ -10,6 +10,9 @@
10
  </div>
11
  </div>
12
  <div class="col-xs-6">
 
 
 
13
  <div class="pull-right search-box-container">
14
  <?php $this->search_box('search', 'search_id'); ?>
15
  </div>
10
  </div>
11
  </div>
12
  <div class="col-xs-6">
13
+ <div class="pull-right pagination-container">
14
+ <?php $this->pagination('top'); ?>
15
+ </div>
16
  <div class="pull-right search-box-container">
17
  <?php $this->search_box('search', 'search_id'); ?>
18
  </div>
templates/admin/dashboard/dashboard.inc.php CHANGED
@@ -342,8 +342,17 @@ $tableChartsCount = WDTTools::getTablesCount('chart');
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 new options for link columns in datatable (noreferrer and sponsored attributes)</li>
346
- <li><strong>Feature:</strong> Added new options for link editor in simple table (noreferrer and sponsored attributes)</li>
 
 
 
 
 
 
 
 
 
347
  <li>Other small bug fixes and stability improvements.</li>
348
  </ul>
349
  </div>
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>Improvement:</strong> Added pagination above the table on browse page for tables and charts.</li>
346
+ <li><strong>Improvement:</strong> Added new hook to filter URL of PHP array tables: wpdatatables_filter_url_php_array.</li>
347
+ <li><strong>Improvement:</strong> Add new pre-formatted hooks for all column types in datatables:
348
+ wpdatatables_filter_date_cell_before_formatting, wpdatatables_filter_time_cell_before_formatting,
349
+ wpdatatables_filter_datetime_cell_before_formatting, wpdatatables_filter_link_cell_before_formatting,
350
+ wpdatatables_filter_email_cell_before_formatting, wpdatatables_filter_string_cell_before_formatting,
351
+ wpdatatables_filter_int_cell_before_formatting, wpdatatables_filter_float_cell_before_formatting
352
+ and wpdatatables_filter_image_cell_before_formatting.</li>
353
+ <li><strong>Bugfix:</strong> Fixed notice for deprecated hooks in Gutenberg.</li>
354
+ <li><strong>Bugfix:</strong> Fixed issue with browsing tables and charts and search.</li>
355
+ <li>Compatibility with WordPress 5.8.2 approved.</li>
356
  <li>Other small bug fixes and stability improvements.</li>
357
  </ul>
358
  </div>
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.21
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.22
7
  Author: TMS-Plugins
8
  Author URI: https://tms-outsource.com
9
  Text Domain: wpdatatables