Ninja Tables – WP Data Table Plugin for WordPress - Version 4.1.14

Version Description

Download this release

Release Info

Developer techjewel
Plugin Icon 128x128 Ninja Tables – WP Data Table Plugin for WordPress
Version 4.1.14
Comparing to
See all releases

Code changes from version 4.1.13 to 4.1.14

includes/libs/TableDrivers/NinjaFooTable.php CHANGED
@@ -20,7 +20,7 @@ class NinjaFooTable
20
  $tableInstance = 'ninja_table_instance_' . count($ninja_table_instances);
21
  $ninja_table_instances[] = $tableInstance;
22
 
23
- $tableArray['uniqueID'] = 'ninja_table_unique_id_'.rand().'_'.$tableArray['table_id'];
24
 
25
  $ninja_table_current_rendering_table = $tableArray;
26
 
@@ -55,10 +55,10 @@ class NinjaFooTable
55
  );
56
 
57
  $localizeData = array(
58
- 'ajax_url' => admin_url('admin-ajax.php'),
59
- 'tables' => array(),
60
- 'ninja_version' => NINJA_TABLES_VERSION,
61
- 'i18n' => array(
62
  'search_in' => __('Search in', 'ninja-tables'),
63
  'search' => __('Search', 'ninja-tables'),
64
  'empty_text' => __('No Result Found', 'ninja-tables'),
@@ -66,7 +66,7 @@ class NinjaFooTable
66
  'ninja_table_public_nonce' => wp_create_nonce('ninja_table_public_nonce')
67
  );
68
 
69
- if(defined('NINJAPROPLUGIN_VERSION')) {
70
  $localizeData['pro_version'] = NINJAPROPLUGIN_VERSION;
71
  }
72
 
@@ -86,8 +86,13 @@ class NinjaFooTable
86
  {
87
  $css = self::generateCustomColorCSS($tableArray, $extra_css);
88
  if ($css) {
89
- add_action('ninja_tables_after_table_print', function () use ($css) {
90
- echo ninjaTablesEscCss($css);
 
 
 
 
 
91
  });
92
  }
93
  }
@@ -144,7 +149,7 @@ class NinjaFooTable
144
 
145
  $fonts = array(
146
  'table_font_family' => ArrayHelper::get($tableArray, 'settings.table_font_family'),
147
- 'table_font_size' => ArrayHelper::get($tableArray, 'settings.table_font_size'),
148
  );
149
  if (ArrayHelper::get($tableArray, 'settings.table_color_type') == 'custom_color'
150
  && defined('NINJATABLESPRO')
@@ -355,7 +360,7 @@ class NinjaFooTable
355
  $configSettings['extra_css_class'] = 'inverted';
356
  }
357
 
358
- $table_classes .= ' '.$configSettings['extra_css_class'];
359
 
360
  if ($pagingPosition = ArrayHelper::get($settings, 'pagination_position')) {
361
  $table_classes .= ' footable-paging-' . $pagingPosition;
@@ -427,7 +432,7 @@ class NinjaFooTable
427
 
428
  $configSettings['has_formula'] = ArrayHelper::get($settings, 'formula_support', 'no');
429
 
430
- $tableCaption = get_post_meta($table_id, '_ninja_table_caption', true);
431
 
432
  $table_vars = array(
433
  'table_id' => $table_id,
@@ -447,10 +452,10 @@ class NinjaFooTable
447
  $table_vars = apply_filters('ninja_table_rendering_table_vars', $table_vars, $table_id, $tableArray);
448
 
449
  if ($tableArray['provider'] == 'wp_woo') {
450
- $table_vars['wc_ajax_url'] = add_query_arg( array(
451
- 'wc-ajax' => 'add_to_cart',
452
  'ninja_table' => $tableArray['table_id']
453
- ), home_url( '/', 'relative') );
454
  }
455
 
456
  if ($renderType == 'ajax_table') {
@@ -491,7 +496,7 @@ class NinjaFooTable
491
  {
492
  $columnContentCss = '';
493
 
494
- foreach ( $columns as $index => $column) {
495
  if ($contentAlign = ArrayHelper::get($column, 'contentAlign')) {
496
  $columnContentCss .= '#footable_' . $tableId . ' td.ninja_column_' . $index
497
  . ' { text-align: ' . $contentAlign . '; }';
@@ -536,7 +541,7 @@ class NinjaFooTable
536
  if (!$ownOnly && $isHtmlCacheEnabled) {
537
  $cachedTableData = self::getTableCachedHTML($tableId, $table_vars);
538
  if ($cachedTableData) {
539
- ninjaTablesPrintSafeVar($cachedTableData );
540
  return;
541
  }
542
  }
@@ -634,7 +639,7 @@ class NinjaFooTable
634
  $tableCassClasses[] = 'nt_search_full_width';
635
  }
636
 
637
- $tableCassClasses[] = 'nt_type_'.ArrayHelper::get($settings, 'render_type');
638
 
639
  $definedClasses = ArrayHelper::get($settings, 'css_classes', array());
640
  $classArray = array_merge($tableCassClasses, $definedClasses);
@@ -689,7 +694,7 @@ class NinjaFooTable
689
 
690
  private static function getFootableAtrributes($tableVars)
691
  {
692
- $tableID = $tableVars['table_id'];
693
  $delay_time = apply_filters('ninja_table_search_time_delay', 1000, $tableID);
694
  $atts = array(
695
  'data-footable_id' => $tableID,
@@ -708,7 +713,7 @@ class NinjaFooTable
708
  $atts_string .= $att_name . '="' . esc_attr($att) . '" ';
709
  }
710
  }
711
- return (string) $atts_string;
712
  }
713
 
714
  public static function getFormattedColumn($column, $index, $settings, $globalSorting, $sortingType)
@@ -784,12 +789,12 @@ class NinjaFooTable
784
  if (ArrayHelper::get($tableConfig, 'render_type') !== 'legacy_table') {
785
 
786
  $rowRequestUrlParams = array(
787
- 'action' => 'wp_ajax_ninja_tables_public_action',
788
- 'table_id' => $tableId,
789
- 'target_action' => 'get-all-data',
790
- 'default_sorting' => ArrayHelper::get($tableSettings, 'default_sorting'),
791
- 'skip_rows' => ArrayHelper::get($tableSettings, 'skip_rows'),
792
- 'limit_rows' => ArrayHelper::get($tableSettings, 'limit_rows'),
793
  'ninja_table_public_nonce' => wp_create_nonce('ninja_table_public_nonce')
794
  );
795
 
20
  $tableInstance = 'ninja_table_instance_' . count($ninja_table_instances);
21
  $ninja_table_instances[] = $tableInstance;
22
 
23
+ $tableArray['uniqueID'] = 'ninja_table_unique_id_' . rand() . '_' . $tableArray['table_id'];
24
 
25
  $ninja_table_current_rendering_table = $tableArray;
26
 
55
  );
56
 
57
  $localizeData = array(
58
+ 'ajax_url' => admin_url('admin-ajax.php'),
59
+ 'tables' => array(),
60
+ 'ninja_version' => NINJA_TABLES_VERSION,
61
+ 'i18n' => array(
62
  'search_in' => __('Search in', 'ninja-tables'),
63
  'search' => __('Search', 'ninja-tables'),
64
  'empty_text' => __('No Result Found', 'ninja-tables'),
66
  'ninja_table_public_nonce' => wp_create_nonce('ninja_table_public_nonce')
67
  );
68
 
69
+ if (defined('NINJAPROPLUGIN_VERSION')) {
70
  $localizeData['pro_version'] = NINJAPROPLUGIN_VERSION;
71
  }
72
 
86
  {
87
  $css = self::generateCustomColorCSS($tableArray, $extra_css);
88
  if ($css) {
89
+ $tableId = $tableArray['table_id'];
90
+ add_action('ninja_tables_after_table_print', function () use ($css, $tableId) {
91
+ ?>
92
+ <style type="text/css" id='ninja_table_custom_css_<?php echo esc_attr($tableId); ?>'>
93
+ <?php echo ninjaTablesEscCss($css); ?>
94
+ </style>
95
+ <?php
96
  });
97
  }
98
  }
149
 
150
  $fonts = array(
151
  'table_font_family' => ArrayHelper::get($tableArray, 'settings.table_font_family'),
152
+ 'table_font_size' => ArrayHelper::get($tableArray, 'settings.table_font_size'),
153
  );
154
  if (ArrayHelper::get($tableArray, 'settings.table_color_type') == 'custom_color'
155
  && defined('NINJATABLESPRO')
360
  $configSettings['extra_css_class'] = 'inverted';
361
  }
362
 
363
+ $table_classes .= ' ' . $configSettings['extra_css_class'];
364
 
365
  if ($pagingPosition = ArrayHelper::get($settings, 'pagination_position')) {
366
  $table_classes .= ' footable-paging-' . $pagingPosition;
432
 
433
  $configSettings['has_formula'] = ArrayHelper::get($settings, 'formula_support', 'no');
434
 
435
+ $tableCaption = get_post_meta($table_id, '_ninja_table_caption', true);
436
 
437
  $table_vars = array(
438
  'table_id' => $table_id,
452
  $table_vars = apply_filters('ninja_table_rendering_table_vars', $table_vars, $table_id, $tableArray);
453
 
454
  if ($tableArray['provider'] == 'wp_woo') {
455
+ $table_vars['wc_ajax_url'] = add_query_arg(array(
456
+ 'wc-ajax' => 'add_to_cart',
457
  'ninja_table' => $tableArray['table_id']
458
+ ), home_url('/', 'relative'));
459
  }
460
 
461
  if ($renderType == 'ajax_table') {
496
  {
497
  $columnContentCss = '';
498
 
499
+ foreach ($columns as $index => $column) {
500
  if ($contentAlign = ArrayHelper::get($column, 'contentAlign')) {
501
  $columnContentCss .= '#footable_' . $tableId . ' td.ninja_column_' . $index
502
  . ' { text-align: ' . $contentAlign . '; }';
541
  if (!$ownOnly && $isHtmlCacheEnabled) {
542
  $cachedTableData = self::getTableCachedHTML($tableId, $table_vars);
543
  if ($cachedTableData) {
544
+ ninjaTablesPrintSafeVar($cachedTableData);
545
  return;
546
  }
547
  }
639
  $tableCassClasses[] = 'nt_search_full_width';
640
  }
641
 
642
+ $tableCassClasses[] = 'nt_type_' . ArrayHelper::get($settings, 'render_type');
643
 
644
  $definedClasses = ArrayHelper::get($settings, 'css_classes', array());
645
  $classArray = array_merge($tableCassClasses, $definedClasses);
694
 
695
  private static function getFootableAtrributes($tableVars)
696
  {
697
+ $tableID = $tableVars['table_id'];
698
  $delay_time = apply_filters('ninja_table_search_time_delay', 1000, $tableID);
699
  $atts = array(
700
  'data-footable_id' => $tableID,
713
  $atts_string .= $att_name . '="' . esc_attr($att) . '" ';
714
  }
715
  }
716
+ return (string)$atts_string;
717
  }
718
 
719
  public static function getFormattedColumn($column, $index, $settings, $globalSorting, $sortingType)
789
  if (ArrayHelper::get($tableConfig, 'render_type') !== 'legacy_table') {
790
 
791
  $rowRequestUrlParams = array(
792
+ 'action' => 'wp_ajax_ninja_tables_public_action',
793
+ 'table_id' => $tableId,
794
+ 'target_action' => 'get-all-data',
795
+ 'default_sorting' => ArrayHelper::get($tableSettings, 'default_sorting'),
796
+ 'skip_rows' => ArrayHelper::get($tableSettings, 'skip_rows'),
797
+ 'limit_rows' => ArrayHelper::get($tableSettings, 'limit_rows'),
798
  'ninja_table_public_nonce' => wp_create_nonce('ninja_table_public_nonce')
799
  );
800
 
includes/libs/TableDrivers/views/ninja_footable_css.php CHANGED
@@ -1,4 +1,3 @@
1
- <style id="ninja_table_custom_css_<?php echo esc_attr($tableId); ?>" type="text/css">
2
  <?php if($fonts):?>
3
  <?php echo esc_attr($css_prefix); ?> {
4
  font-family: <?php echo esc_attr($fonts['table_font_family']);?>;
@@ -156,4 +155,3 @@ $cellPrefix = $css_prefix.'.ninja_footable.ninja_table_pro tbody tr.nt_row_id_'.
156
  <?php endif; ?>
157
  <?php endif; ?>
158
  <?php echo ninjaTablesEscCss($custom_css); ?>
159
- </style>
 
1
  <?php if($fonts):?>
2
  <?php echo esc_attr($css_prefix); ?> {
3
  font-family: <?php echo esc_attr($fonts['table_font_family']);?>;
155
  <?php endif; ?>
156
  <?php endif; ?>
157
  <?php echo ninjaTablesEscCss($custom_css); ?>
 
includes/ninja_tables-global-functions.php CHANGED
@@ -302,21 +302,8 @@ function ninja_tables_allowed_html_tags()
302
  ];
303
  //button
304
  $tags['button']['onclick'] = [];
305
- // svg
306
- $tags['svg'] = [
307
- 'width' => [],
308
- 'height' => [],
309
- ];
310
- // circle
311
- $tags['circle'] = [
312
- 'cx' => [],
313
- 'cy' => [],
314
- 'r' => [],
315
- 'stroke' => [],
316
- 'fill' => [],
317
- 'stroke-width' => [],
318
- ];
319
 
 
320
  if (empty($tags['svg'])) {
321
  $svg_args = array(
322
  'svg' => array(
@@ -977,7 +964,7 @@ function ninjaTablesGetShortCodeIds($content)
977
  foreach ($matches as $shortcode) {
978
  if ($tag === $shortcode[2]) {
979
  // Replace braces with empty string.
980
- $parsedCode = str_replace(['[', ']', '&#91;', '&#93;'], '', $shortcode[0]);
981
 
982
  $result = shortcode_parse_atts($parsedCode);
983
 
302
  ];
303
  //button
304
  $tags['button']['onclick'] = [];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
 
306
+ //svg
307
  if (empty($tags['svg'])) {
308
  $svg_args = array(
309
  'svg' => array(
964
  foreach ($matches as $shortcode) {
965
  if ($tag === $shortcode[2]) {
966
  // Replace braces with empty string.
967
+ $parsedCode = str_replace(['[', ']', '&#91;', '&#93;', '\\'], '', $shortcode[0]);
968
 
969
  $result = shortcode_parse_atts($parsedCode);
970
 
ninja-tables.php CHANGED
@@ -16,7 +16,7 @@
16
  * Plugin Name: Ninja Tables
17
  * Plugin URI: https://wpmanageninja.com/downloads/ninja-tables-pro-add-on/
18
  * Description: The Easiest & Fastest Responsive Table Plugin on WordPress. Multiple templates, drag-&-drop live table builder, multiple color scheme, and styles.
19
- * Version: 4.1.13
20
  * Author: WPManageNinja LLC
21
  * Author URI: https://wpmanageninja.com/
22
  * License: GPL-2.0+
@@ -33,7 +33,7 @@ if (!defined('WPINC')) {
33
  define('NINJA_TABLES_DIR_URL', plugin_dir_url(__FILE__));
34
  define('NINJA_TABLES_DIR_PATH', plugin_dir_path(__FILE__));
35
  define('NINJA_TABLES_PUBLIC_DIR_URL', NINJA_TABLES_DIR_URL . 'public/');
36
- define('NINJA_TABLES_VERSION', '4.1.13');
37
  define('NINJA_TABLES_ASSET_VERSION', '3.1.0');
38
  define('NINJA_TABLES_PRELOAD_FONT_VERSION', "1a82860cb5286f7833a2c33fbdd1d76c");
39
 
16
  * Plugin Name: Ninja Tables
17
  * Plugin URI: https://wpmanageninja.com/downloads/ninja-tables-pro-add-on/
18
  * Description: The Easiest & Fastest Responsive Table Plugin on WordPress. Multiple templates, drag-&-drop live table builder, multiple color scheme, and styles.
19
+ * Version: 4.1.14
20
  * Author: WPManageNinja LLC
21
  * Author URI: https://wpmanageninja.com/
22
  * License: GPL-2.0+
33
  define('NINJA_TABLES_DIR_URL', plugin_dir_url(__FILE__));
34
  define('NINJA_TABLES_DIR_PATH', plugin_dir_path(__FILE__));
35
  define('NINJA_TABLES_PUBLIC_DIR_URL', NINJA_TABLES_DIR_URL . 'public/');
36
+ define('NINJA_TABLES_VERSION', '4.1.14');
37
  define('NINJA_TABLES_ASSET_VERSION', '3.1.0');
38
  define('NINJA_TABLES_PRELOAD_FONT_VERSION', "1a82860cb5286f7833a2c33fbdd1d76c");
39
 
public/NinjaTablePublic.php CHANGED
@@ -49,9 +49,9 @@ class NinjaTablePublic
49
  /**
50
  * Initialize the class and set its properties.
51
  *
 
 
52
  * @since 1.0.0
53
- * @param string $plugin_name The name of the plugin.
54
- * @param string $version The version of this plugin.
55
  */
56
  public function __construct($plugin_name, $version)
57
  {
@@ -170,7 +170,7 @@ class NinjaTablePublic
170
  }
171
 
172
  $tableArray = apply_filters('ninja_table_js_config', $tableArray, $shortCodeData['filter']);
173
-
174
  ob_start();
175
  do_action('ninja_tables-render-table-' . ArrayHelper::get($tableArray, 'settings.library'), $tableArray);
176
  return ob_get_clean();
@@ -347,7 +347,7 @@ class NinjaTablePublic
347
  return '';
348
  }
349
 
350
- $tableColumns = ninja_table_get_table_columns($id, 'public');
351
  $data = ninjaTablesGetTablesDataByID($id, $tableColumns, $tableSettings['default_sorting'], false, 1, $row - 1);
352
 
353
  if ($data) {
@@ -377,13 +377,13 @@ class NinjaTablePublic
377
  $tableColumns = ninja_table_get_table_columns($tableId);
378
  $targetColumn = [];
379
  foreach ($tableColumns as $tableColumn) {
380
- if($tableColumn['key'] == $column) {
381
  $targetColumn = $tableColumn;
382
  }
383
  }
384
 
385
- if($tableColumn['data_type'] == 'image') {
386
- if(function_exists('nt_parse_image_column')) {
387
  return nt_parse_image_column($value, $targetColumn);
388
  }
389
  }
@@ -435,6 +435,8 @@ class NinjaTablePublic
435
  */
436
  public function preRenderTableAssets($tableId)
437
  {
 
 
438
  $atts = [
439
  'id' => $tableId,
440
  'filter' => false,
@@ -445,7 +447,7 @@ class NinjaTablePublic
445
  $tableArray = $this->getTableArray($atts, '');
446
 
447
  // No table array means the shortcode ID is invalid.
448
- if (!$tableArray ) return;
449
 
450
  $columnContentCss = NinjaFooTable::getColumnsCss($tableArray['table_id'], $tableArray['columns']);
451
 
@@ -454,8 +456,12 @@ class NinjaTablePublic
454
  // Keep a flag that this css has been loaded so that we won't duplicate assets.
455
  NinjaFooTable::$tableCssStatuses[$tableId] = true;
456
 
457
- add_action('wp_head', function () use ($css) {
458
- echo ninjaTablesEscCss($css);
 
 
 
 
459
  }, 99);
460
  }
461
  }
49
  /**
50
  * Initialize the class and set its properties.
51
  *
52
+ * @param string $plugin_name The name of the plugin.
53
+ * @param string $version The version of this plugin.
54
  * @since 1.0.0
 
 
55
  */
56
  public function __construct($plugin_name, $version)
57
  {
170
  }
171
 
172
  $tableArray = apply_filters('ninja_table_js_config', $tableArray, $shortCodeData['filter']);
173
+
174
  ob_start();
175
  do_action('ninja_tables-render-table-' . ArrayHelper::get($tableArray, 'settings.library'), $tableArray);
176
  return ob_get_clean();
347
  return '';
348
  }
349
 
350
+ $tableColumns = ninja_table_get_table_columns($id, 'public');
351
  $data = ninjaTablesGetTablesDataByID($id, $tableColumns, $tableSettings['default_sorting'], false, 1, $row - 1);
352
 
353
  if ($data) {
377
  $tableColumns = ninja_table_get_table_columns($tableId);
378
  $targetColumn = [];
379
  foreach ($tableColumns as $tableColumn) {
380
+ if ($tableColumn['key'] == $column) {
381
  $targetColumn = $tableColumn;
382
  }
383
  }
384
 
385
+ if ($tableColumn['data_type'] == 'image') {
386
+ if (function_exists('nt_parse_image_column')) {
387
  return nt_parse_image_column($value, $targetColumn);
388
  }
389
  }
435
  */
436
  public function preRenderTableAssets($tableId)
437
  {
438
+ $tableId = intval($tableId);
439
+
440
  $atts = [
441
  'id' => $tableId,
442
  'filter' => false,
447
  $tableArray = $this->getTableArray($atts, '');
448
 
449
  // No table array means the shortcode ID is invalid.
450
+ if (!$tableArray) return;
451
 
452
  $columnContentCss = NinjaFooTable::getColumnsCss($tableArray['table_id'], $tableArray['columns']);
453
 
456
  // Keep a flag that this css has been loaded so that we won't duplicate assets.
457
  NinjaFooTable::$tableCssStatuses[$tableId] = true;
458
 
459
+ add_action('wp_head', function () use ($css, $tableId) {
460
+ ?>
461
+ <style id='ninja_table_custom_css_<?php echo esc_attr($tableId); ?>' type='text/css'>
462
+ <?php echo ninjaTablesEscCss($css); ?>
463
+ </style>
464
+ <?php
465
  }, 99);
466
  }
467
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: table builder, table plugin, wpdatatables, wordpress tables, table grid, c
5
  Requires at least: 4.5
6
  Requires PHP: 5.4 or greater
7
  Tested up to: 5.9
8
- Stable tag: 4.1.13
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -315,6 +315,9 @@ Yes, you can connect your Google spreadsheets to your WordPress table plugin by
315
 
316
  == Changelog ==
317
 
 
 
 
318
  =4.1.13 Date: March 18, 2021) =
319
  * Fix Data sanitization and esc_* functions
320
  * Support for Raw HTMLs in table cells
5
  Requires at least: 4.5
6
  Requires PHP: 5.4 or greater
7
  Tested up to: 5.9
8
+ Stable tag: 4.1.14
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
315
 
316
  == Changelog ==
317
 
318
+ =4.1.14 Date: March 21, 2021) =
319
+ * Fix CSS Output issues
320
+
321
  =4.1.13 Date: March 18, 2021) =
322
  * Fix Data sanitization and esc_* functions
323
  * Support for Raw HTMLs in table cells