PluginProbe
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards / 5.5.84
WP Data Access – App Builder for Tables, Forms, Charts, Maps & Dashboards v5.5.84
5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 5.5.41 5.5.42 All 160 releases
← All changes | WPDataAccess/Plugin_Table_Models/WPDA_Design_Table_Model.php +52 -53 5.5.365.5.84 View file →
@@ -74,22 +74,22 @@
74 74 public function __construct() {
75 75 $this->table_name = self::get_base_table_name();
76 76
77 77 // Watch out for arrays! (array = starting export)
78 - if ( isset( $_REQUEST['wpda_table_name'] ) && ! is_array( $_REQUEST['wpda_table_name'] ) ) {
79 - $this->wpda_table_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name'] ) );
78 + if ( isset( $_REQUEST['wpda_table_name'] ) && ! is_array( $_REQUEST['wpda_table_name'] ) ) { // phpcs:ignore
79 + $this->wpda_table_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name'] ) ); // phpcs:ignore
80 80 }
81 81
82 - if ( isset( $_REQUEST['wpda_table_name_original'] ) ) {
83 - $this->wpda_table_name_original = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name_original'] ) );
82 + if ( isset( $_REQUEST['wpda_table_name_original'] ) ) { // phpcs:ignore
83 + $this->wpda_table_name_original = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name_original'] ) ); // phpcs:ignore
84 84 }
85 85
86 - if ( isset( $_REQUEST['wpda_schema_name'] ) && ! is_array( $_REQUEST['wpda_schema_name'] ) ) {
87 - $this->wpda_schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name'] ) );
86 + if ( isset( $_REQUEST['wpda_schema_name'] ) && ! is_array( $_REQUEST['wpda_schema_name'] ) ) { // phpcs:ignore
87 + $this->wpda_schema_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name'] ) ); // phpcs:ignore
88 88 }
89 89
90 - if ( isset( $_REQUEST['wpda_schema_name_original'] ) ) {
91 - $this->wpda_schema_name_original = sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name_original'] ) );
90 + if ( isset( $_REQUEST['wpda_schema_name_original'] ) ) { // phpcs:ignore
91 + $this->wpda_schema_name_original = sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name_original'] ) ); // phpcs:ignore
92 92 }
93 93 }
94 94
95 95 /**
@@ -105,9 +105,9 @@
105 105 return false;
106 106 }
107 107
108 108 global $wpdb;
109 - $wpda_table_design_raw = $wpdb->get_results(
109 + $wpda_table_design_raw = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- plugin table
110 110 $wpdb->prepare(
111 111 'SELECT wpda_table_design FROM `%1s` WHERE wpda_table_name = %s AND wpda_schema_name = %s', // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
112 112 array(
113 113 WPDA::remove_backticks( $this->table_name ),
@@ -171,9 +171,9 @@
171 171 $unique_column_names = array();
172 172 foreach ( $this->wpda_table_design->table as $column ) {
173 173 $unique_column_names[ $column->column_name ] = true;
174 174 }
175 - if ( count( $unique_column_names ) !== count( $this->wpda_table_design->table ) ) {//phpcs:ignore - 8.1 proof
175 + if ( count( $unique_column_names ) !== count( $this->wpda_table_design->table ) ) { // phpcs:ignore -- 8.1 proof
176 176 $structure_messages[] = array( 'ERR', 'Column name must be unique within a table' );
177 177 }
178 178 }
179 179 if ( ! isset( $this->wpda_table_design->indexes ) ) {
@@ -182,9 +182,9 @@
182 182 $unique_index_names = array();
183 183 foreach ( $this->wpda_table_design->indexes as $index ) {
184 184 $unique_index_names[ $index->index_name ] = true;
185 185 }
186 - if ( count( $unique_index_names ) !== count( $this->wpda_table_design->indexes ) ) {//phpcs:ignore - 8.1 proof
186 + if ( count( $unique_index_names ) !== count( $this->wpda_table_design->indexes ) ) { // phpcs:ignore -- 8.1 proof
187 187 $structure_messages[] = array( 'ERR', 'Index name must be unique within a table' );
188 188 }
189 189 }
190 190 return $structure_messages;
@@ -198,22 +198,22 @@
198 198 */
199 199 public function prepare_insert() {
200 200 $this->wpda_table_design = (object) null;
201 201
202 - if ( isset( $_REQUEST['design_mode'] ) ) {
203 - $this->wpda_table_design->design_mode = sanitize_text_field( wp_unslash( $_REQUEST['design_mode'] ) );
202 + if ( isset( $_REQUEST['design_mode'] ) ) { // phpcs:ignore
203 + $this->wpda_table_design->design_mode = sanitize_text_field( wp_unslash( $_REQUEST['design_mode'] ) ); // phpcs:ignore
204 204 } else {
205 205 $this->wpda_table_design->design_mode = WPDA::get_option( WPDA::OPTION_BE_DESIGN_MODE );
206 206 }
207 207
208 - if ( isset( $_REQUEST['engine'] ) ) {
209 - $this->wpda_table_design->engine = sanitize_text_field( wp_unslash( $_REQUEST['engine'] ) );
208 + if ( isset( $_REQUEST['engine'] ) ) { // phpcs:ignore
209 + $this->wpda_table_design->engine = sanitize_text_field( wp_unslash( $_REQUEST['engine'] ) ); // phpcs:ignore
210 210 } else {
211 211 $this->wpda_table_design->engine = '';
212 212 }
213 213
214 - if ( isset( $_REQUEST['collation'] ) ) {
215 - $this->wpda_table_design->collation = sanitize_text_field( wp_unslash( $_REQUEST['collation'] ) );
214 + if ( isset( $_REQUEST['collation'] ) ) { // phpcs:ignore
215 + $this->wpda_table_design->collation = sanitize_text_field( wp_unslash( $_REQUEST['collation'] ) ); // phpcs:ignore
216 216 } else {
217 217 $this->wpda_table_design->collation = '';
218 218 }
219 219
@@ -238,9 +238,9 @@
238 238 $this->wpda_table_design->table_type = self::get_table_type( $this->table_name, $this->wpda_schema_name );
239 239
240 240 global $wpdb;
241 241
242 - return $wpdb->insert(
242 + return $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- plugin table
243 243 $this->table_name,
244 244 array(
245 245 'wpda_table_name' => $this->wpda_table_name,
246 246 'wpda_schema_name' => $this->wpda_schema_name,
@@ -258,26 +258,26 @@
258 258 */
259 259 protected function get_table_structure() {
260 260 $table_structure = array();
261 261
262 - if ( isset( $_REQUEST['column_name'] ) &&
263 - is_array( $_REQUEST['column_name'] )) {//phpcs:ignore - 8.1 proof
264 - $no_columns = count( $_REQUEST['column_name'] );//phpcs:ignore - 8.1 proof
262 + if ( isset( $_REQUEST['column_name'] ) && // phpcs:ignore
263 + is_array( $_REQUEST['column_name'] )) { // phpcs:ignore
264 + $no_columns = count( $_REQUEST['column_name'] ); // phpcs:ignore
265 265 for ( $i = 0; $i < $no_columns; $i ++ ) {
266 - if ( isset( $_REQUEST['row_action'][ $i ] ) && 'd' === $_REQUEST['row_action'][ $i ] ) {
266 + if ( isset( $_REQUEST['row_action'][ $i ] ) && 'd' === $_REQUEST['row_action'][ $i ] ) { // phpcs:ignore
267 267 // Do not process deleted rows.
268 268 continue;
269 269 }
270 270
271 - $column_name = sanitize_text_field( wp_unslash( $_REQUEST['column_name'][ $i ] ) );
272 - $data_type = sanitize_text_field( wp_unslash( $_REQUEST['data_type'][ $i ] ) );
273 - $type_attribute = sanitize_text_field( wp_unslash( $_REQUEST['type_attribute'][ $i ] ) );
274 - $key = sanitize_text_field( wp_unslash( $_REQUEST['key'][ $i ] ) );
275 - $mandatory = sanitize_text_field( wp_unslash( $_REQUEST['mandatory'][ $i ] ) );
276 - $max_length = sanitize_text_field( wp_unslash( $_REQUEST['max_length'][ $i ] ) );
277 - $extra = sanitize_text_field( wp_unslash( $_REQUEST['extra'][ $i ] ) );
278 - $default = sanitize_text_field( wp_unslash( $_REQUEST['default'][ $i ] ) );
279 - $list = sanitize_text_field( wp_unslash( $_REQUEST['list'][ $i ] ) );
271 + $column_name = sanitize_text_field( wp_unslash( $_REQUEST['column_name'][ $i ] ) ); // phpcs:ignore
272 + $data_type = sanitize_text_field( wp_unslash( $_REQUEST['data_type'][ $i ] ) ); // phpcs:ignore
273 + $type_attribute = sanitize_text_field( wp_unslash( $_REQUEST['type_attribute'][ $i ] ) ); // phpcs:ignore
274 + $key = sanitize_text_field( wp_unslash( $_REQUEST['key'][ $i ] ) ); // phpcs:ignore
275 + $mandatory = sanitize_text_field( wp_unslash( $_REQUEST['mandatory'][ $i ] ) ); // phpcs:ignore
276 + $max_length = sanitize_text_field( wp_unslash( $_REQUEST['max_length'][ $i ] ) ); // phpcs:ignore
277 + $extra = sanitize_text_field( wp_unslash( $_REQUEST['extra'][ $i ] ) ); // phpcs:ignore
278 + $default = sanitize_text_field( wp_unslash( $_REQUEST['default'][ $i ] ) ); // phpcs:ignore
279 + $list = sanitize_text_field( wp_unslash( $_REQUEST['list'][ $i ] ) ); // phpcs:ignore
280 280
281 281 $table_structure[ $i ]['column_name'] = $column_name;
282 282 $table_structure[ $i ]['data_type'] = $data_type;
283 283 $table_structure[ $i ]['type_attribute'] = $type_attribute;
@@ -301,20 +301,19 @@
301 301 */
302 302 protected function get_indexes() {
303 303 $indexes = array();
304 304
305 - if ( isset( $_REQUEST['column_names'] )&&
306 - is_array( $_REQUEST['column_names']) ) {
307 - $no_columns = count( $_REQUEST['column_names'] );//phpcs:ignore - 8.1 proof
305 + if ( isset( $_REQUEST['column_names'] ) && is_array( $_REQUEST['column_names']) ) { // phpcs:ignore
306 + $no_columns = count( $_REQUEST['column_names'] ); // phpcs:ignore -- 8.1 proof
308 307 for ( $i = 0; $i < $no_columns; $i ++ ) {
309 - if ( isset( $_REQUEST['row_action'][ $i ] ) && 'd' === $_REQUEST['row_action'][ $i ] ) {
308 + if ( isset( $_REQUEST['row_action'][ $i ] ) && 'd' === $_REQUEST['row_action'][ $i ] ) { // phpcs:ignore
310 309 // Do not process deleted rows.
311 310 continue;
312 311 }
313 312
314 - $index_name = sanitize_text_field( wp_unslash( $_REQUEST['index_name'][ $i ] ) );
315 - $unique = sanitize_text_field( wp_unslash( $_REQUEST['unique'][ $i ] ) );
316 - $column_names = sanitize_text_field( wp_unslash( $_REQUEST['column_names'][ $i ] ) );
313 + $index_name = sanitize_text_field( wp_unslash( $_REQUEST['index_name'][ $i ] ) ); // phpcs:ignore
314 + $unique = sanitize_text_field( wp_unslash( $_REQUEST['unique'][ $i ] ) ); // phpcs:ignore
315 + $column_names = sanitize_text_field( wp_unslash( $_REQUEST['column_names'][ $i ] ) ); // phpcs:ignore
317 316
318 317 $indexes[ $i ]['index_name'] = $index_name;
319 318 $indexes[ $i ]['unique'] = $unique;
320 319 $indexes[ $i ]['column_names'] = $column_names;
@@ -336,32 +335,32 @@
336 335 $this->wpda_table_name_original === $this->wpda_table_name ? null : $this->wpda_table_name_original,
337 336 $this->wpda_schema_name_original === $this->wpda_schema_name ? null : $this->wpda_schema_name_original
338 337 );
339 338
340 - if ( isset( $_REQUEST['design_mode'] ) ) {
341 - $this->wpda_table_design->design_mode = sanitize_text_field( wp_unslash( $_REQUEST['design_mode'] ) );
339 + if ( isset( $_REQUEST['design_mode'] ) ) { // phpcs:ignore
340 + $this->wpda_table_design->design_mode = sanitize_text_field( wp_unslash( $_REQUEST['design_mode'] ) ); // phpcs:ignore
342 341 }
343 342
344 - if ( isset( $_REQUEST['engine'] ) ) {
345 - $this->wpda_table_design->engine = sanitize_text_field( wp_unslash( $_REQUEST['engine'] ) );
343 + if ( isset( $_REQUEST['engine'] ) ) { // phpcs:ignore
344 + $this->wpda_table_design->engine = sanitize_text_field( wp_unslash( $_REQUEST['engine'] ) ); // phpcs:ignore
346 345 }
347 346
348 - if ( isset( $_REQUEST['collation'] ) ) {
349 - $this->wpda_table_design->collation = sanitize_text_field( wp_unslash( $_REQUEST['collation'] ) );
347 + if ( isset( $_REQUEST['collation'] ) ) { // phpcs:ignore
348 + $this->wpda_table_design->collation = sanitize_text_field( wp_unslash( $_REQUEST['collation'] ) ); // phpcs:ignore
350 349 }
351 350
352 - if ( isset( $_REQUEST['column_name'] ) ) {
351 + if ( isset( $_REQUEST['column_name'] ) ) { // phpcs:ignore
353 352 $this->wpda_table_design->table = $this->get_table_structure();
354 353 } else {
355 - if ( isset( $_REQUEST['submitted_changes'] ) && 'table' === $_REQUEST['submitted_changes'] ) {
354 + if ( isset( $_REQUEST['submitted_changes'] ) && 'table' === $_REQUEST['submitted_changes'] ) { // phpcs:ignore
356 355 $this->wpda_table_design->table = array();
357 356 }
358 357 }
359 358
360 - if ( isset( $_REQUEST['column_names'] ) ) {
359 + if ( isset( $_REQUEST['column_names'] ) ) { // phpcs:ignore
361 360 $this->wpda_table_design->indexes = $this->get_indexes();
362 361 } else {
363 - if ( isset( $_REQUEST['submitted_changes'] ) && 'indexes' === $_REQUEST['submitted_changes'] ) {
362 + if ( isset( $_REQUEST['submitted_changes'] ) && 'indexes' === $_REQUEST['submitted_changes'] ) { // phpcs:ignore
364 363 $this->wpda_table_design->indexes = array();
365 364 }
366 365 }
367 366 }
@@ -380,9 +379,9 @@
380 379 $this->prepare_update();
381 380
382 381 global $wpdb;
383 382
384 - return $wpdb->update(
383 + return $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- plugin table
385 384 $this->table_name,
386 385 array(
387 386 'wpda_table_name' => $this->wpda_table_name,
388 387 'wpda_schema_name' => $this->wpda_schema_name,
@@ -402,9 +401,9 @@
402 401 * @return array
403 402 */
404 403 public static function get_designer_table_list() {
405 404 global $wpdb;
406 - return $wpdb->get_results(
405 + return $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- plugin table
407 406 $wpdb->prepare(
408 407 'SELECT `wpda_table_name` FROM `%1s`', // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders
409 408 array(
410 409 WPDA::remove_backticks( self::get_base_table_name() ),
@@ -430,9 +429,9 @@
430 429
431 430 $wpda_table_design['table_type'] = self::get_table_type( $wpda_table_name, $wpda_schema_name );
432 431
433 432 return (
434 - 1 === $wpdb->insert(
433 + 1 === $wpdb->insert( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- plugin table
435 434 $table_name,
436 435 array(
437 436 'wpda_table_name' => $wpda_table_name,
438 437 'wpda_schema_name' => $wpda_schema_name,
@@ -451,9 +450,9 @@
451 450 * @return bool
452 451 */
453 452 public static function get_table_type( $table_name, $schema_name ) {
454 453 global $wpdb;
455 - $result = $wpdb->get_results(
454 + $result = $wpdb->get_results( // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- plugin table
456 455 $wpdb->prepare(
457 456 '
458 457 SELECT table_type AS table_type
459 458 FROM information_schema.tables
@@ -465,9 +464,9 @@
465 464 $table_name,
466 465 )
467 466 ), // db call ok; no-cache ok.
468 467 'ARRAY_A'
469 - ); // phpcs:ignore Standard.Category.SniffName.ErrorCode
468 + );
470 469
471 470 if ( 1 !== $wpdb->num_rows ) {
472 471 return false;
473 472 } else {