← All changes
|
WPDataProjects/Project/WPDP_Project_Table_Form.php
+93
-94
5.5.41
→
5.5.84
View file →
| @@ -4,8 +4,9 @@ | ||
| 4 | 4 | * Suppress "error - 0 - No summary was found for this file" on phpdoc generation |
| 5 | 5 | * |
| 6 | 6 | * @package WPDataProjects\Project |
| 7 | 7 | */ |
| 8 | +// phpcs:disable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing -- verified in function is_authorized | |
| 8 | 9 | namespace WPDataProjects\Project; |
| 9 | 10 | |
| 10 | 11 | use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Exist; |
| 11 | 12 | use WPDataAccess\Data_Dictionary\WPDA_Dictionary_Lists; |
| @@ -138,9 +139,9 @@ | ||
| 138 | 139 | if ( isset( $_REQUEST['page'] ) ) { |
| 139 | 140 | $this->page = sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ); |
| 140 | 141 | // input var okay. |
| 141 | 142 | } else { |
| 142 | - wp_die( __( 'ERROR: Wrong arguments [missing page]', 'wp-data-access' ) ); | |
| 143 | + wp_die( esc_attr__( 'ERROR: Wrong arguments [missing page]', 'wp-data-access' ) ); | |
| 143 | 144 | } |
| 144 | 145 | if ( isset( $_REQUEST['action'] ) ) { |
| 145 | 146 | $this->action = sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ); |
| 146 | 147 | } |
| @@ -156,23 +157,19 @@ | ||
| 156 | 157 | ); |
| 157 | 158 | $this->current_tab = 'tableinfo'; |
| 158 | 159 | if ( isset( $_REQUEST['tab'] ) ) { |
| 159 | 160 | $tab = sanitize_text_field( wp_unslash( $_REQUEST['tab'] ) ); |
| 160 | - // input var okay. | |
| 161 | 161 | if ( isset( $this->tabs[$tab] ) ) { |
| 162 | 162 | $this->current_tab = $tab; |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | $this->wpnonce_requested = ( isset( $_POST['wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['wpnonce'] ) ) : null ); |
| 166 | - // input var okay. | |
| 167 | 166 | if ( isset( $_REQUEST['wpda_table_name'] ) && !is_array( $_REQUEST['wpda_table_name'] ) ) { |
| 168 | 167 | $wpda_project_design_table_model = new WPDP_Project_Design_Table_Model(); |
| 169 | 168 | if ( 'reconcile' === $this->action ) { |
| 170 | 169 | $wpda_table_name_re = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name'] ) ); |
| 171 | - // input var okay. | |
| 172 | 170 | $this->is_authorized( $wpda_table_name_re ); |
| 173 | 171 | $wpda_schema_name_re = ( isset( $_REQUEST['wpda_schema_name'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name'] ) ) : '' ); |
| 174 | - // input var okay. | |
| 175 | 172 | $wpda_reverse_engineering = new WPDA_Reverse_Engineering($wpda_table_name_re, $wpda_schema_name_re); |
| 176 | 173 | $table_structure = $wpda_reverse_engineering->get_designer_format( 'advanced' ); |
| 177 | 174 | if ( isset( $_REQUEST['keep_options'] ) ) { |
| 178 | 175 | $param_keep_options = sanitize_text_field( wp_unslash( $_REQUEST['keep_options'] ) ); |
| @@ -201,22 +198,20 @@ | ||
| 201 | 198 | } |
| 202 | 199 | } elseif ( 'reverse_engineering' === $this->action ) { |
| 203 | 200 | if ( isset( $_REQUEST['wpda_table_name'] ) ) { |
| 204 | 201 | $wpda_table_name_re = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name'] ) ); |
| 205 | - // input var okay. | |
| 206 | 202 | $this->is_authorized( WPDP_Project_Design_Table_Model::get_base_table_name() ); |
| 207 | 203 | $wpda_schema_name_re = ( isset( $_REQUEST['wpda_schema_name'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name'] ) ) : '' ); |
| 208 | - // input var okay. | |
| 209 | 204 | $wpda_reverse_engineering = new WPDA_Reverse_Engineering($wpda_table_name_re, $wpda_schema_name_re); |
| 210 | 205 | $table_structure = $wpda_reverse_engineering->get_designer_format( 'advanced' ); |
| 211 | 206 | if ( count( $table_structure ) > 0 ) { |
| 212 | - //phpcs:ignore - 8.1 proof | |
| 207 | + // phpcs:ignore -- 8.1 proof | |
| 213 | 208 | $this->wpda_schema_name = $wpda_schema_name_re; |
| 214 | 209 | $this->wpda_table_name = $wpda_table_name_re; |
| 215 | 210 | $this->get_unique_setname(); |
| 216 | 211 | $this->wpda_table_design = $table_structure; |
| 217 | 212 | } else { |
| 218 | - wp_die( __( 'ERROR: Reverse engineering table failed [invalid structure]', 'wp-data-access' ) ); | |
| 213 | + wp_die( esc_attr__( 'ERROR: Reverse engineering table failed [invalid structure]', 'wp-data-access' ) ); | |
| 219 | 214 | } |
| 220 | 215 | if ( !WPDP_Project_Design_Table_Model::insert_reverse_engineered( |
| 221 | 216 | $this->wpda_table_name, |
| 222 | 217 | $this->wpda_table_setname, |
| @@ -223,9 +218,9 @@ | ||
| 223 | 218 | $this->wpda_table_design, |
| 224 | 219 | $this->wpda_schema_name |
| 225 | 220 | ) ) { |
| 226 | 221 | $db_error = ( '' === $wpdb->last_error ? '' : ' [' . $wpdb->last_error . ']' ); |
| 227 | - wp_die( __( 'ERROR: Reverse engineering table failed' . $db_error, 'wp-data-access' ) ); | |
| 222 | + wp_die( esc_attr__( 'ERROR: Reverse engineering table failed', 'wp-data-access' ) . esc_html( $db_error ) ); | |
| 228 | 223 | } else { |
| 229 | 224 | // Convert named array to object (needed to display structure). |
| 230 | 225 | $this->wpda_table_design = json_decode( json_encode( $table_structure ) ); |
| 231 | 226 | $wpda_project_design_table_model->prepare_query( $this->wpda_table_setname ); |
| @@ -235,14 +230,13 @@ | ||
| 235 | 230 | 'message_text' => __( 'Table added to respository', 'wp-data-access' ), |
| 236 | 231 | )); |
| 237 | 232 | $msg->box(); |
| 238 | 233 | } else { |
| 239 | - wp_die( __( 'ERROR: Wrong arguments', 'wp-data-access' ) ); | |
| 234 | + wp_die( esc_attr__( 'ERROR: Wrong arguments', 'wp-data-access' ) ); | |
| 240 | 235 | } |
| 241 | 236 | } elseif ( null !== $this->action2 ) { |
| 242 | 237 | // Check authorization |
| 243 | 238 | $table_name = sanitize_text_field( wp_unslash( $_REQUEST['wpda_table_name'] ) ); |
| 244 | - // input var okay. | |
| 245 | 239 | $this->is_authorized( $table_name ); |
| 246 | 240 | $result_update = $wpda_project_design_table_model->update(); |
| 247 | 241 | if ( false === $result_update ) { |
| 248 | 242 | $msg = new WPDA_Message_Box(array( |
| @@ -284,9 +278,8 @@ | ||
| 284 | 278 | } |
| 285 | 279 | $this->table_structure = $wpda_project_design_table_model->get_table_design(); |
| 286 | 280 | $this->wpda_table_setname = $wpda_project_design_table_model->get_table_setname(); |
| 287 | 281 | $this->wpda_schema_name = ( isset( $_REQUEST['wpda_schema_name'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['wpda_schema_name'] ) ) : '' ); |
| 288 | - // input var okay. | |
| 289 | 282 | $this->wpda_schema_name_db = $this->wpda_schema_name; |
| 290 | 283 | if ( '' === $this->wpda_schema_name ) { |
| 291 | 284 | $this->wpda_schema_name = $wpdb->dbname; |
| 292 | 285 | } |
| @@ -299,18 +292,18 @@ | ||
| 299 | 292 | 'tableform', |
| 300 | 293 | $this->wpda_table_setname |
| 301 | 294 | ); |
| 302 | 295 | if ( 0 === count( $this->wpda_list_columns->get_table_primary_key() ) ) { |
| 303 | - //phpcs:ignore - 8.1 proof | |
| 296 | + // phpcs:ignore -- 8.1 proof | |
| 304 | 297 | $this->has_primary_key = false; |
| 305 | 298 | } else { |
| 306 | 299 | $this->has_primary_key = true; |
| 307 | 300 | } |
| 308 | 301 | } else { |
| 309 | - wp_die( __( 'ERROR: Invalid table name or not authorized', 'wp-data-access' ) ); | |
| 302 | + wp_die( esc_attr__( 'ERROR: Invalid table name or not authorized', 'wp-data-access' ) ); | |
| 310 | 303 | } |
| 311 | 304 | } else { |
| 312 | - wp_die( __( 'ERROR: Argument wpda_table_name not found', 'wp-data-access' ) ); | |
| 305 | + wp_die( esc_attr__( 'ERROR: Argument wpda_table_name not found', 'wp-data-access' ) ); | |
| 313 | 306 | } |
| 314 | 307 | $this->wpnonce = wp_create_nonce( self::WPNONCE_SEED . $this->wpda_table_name ); |
| 315 | 308 | } |
| 316 | 309 | |
| @@ -318,9 +311,9 @@ | ||
| 318 | 311 | } |
| 319 | 312 | |
| 320 | 313 | protected function is_authorized( $table_name ) { |
| 321 | 314 | if ( !wp_verify_nonce( $this->wpnonce_requested, self::WPNONCE_SEED . $table_name ) ) { |
| 322 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 315 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 323 | 316 | } |
| 324 | 317 | } |
| 325 | 318 | |
| 326 | 319 | /** |
| @@ -330,8 +323,9 @@ | ||
| 330 | 323 | $this->wpda_table_setname = 'default'; |
| 331 | 324 | // Default for first options set |
| 332 | 325 | global $wpdb; |
| 333 | 326 | $query = "select 'x' from `%1s` where wpda_table_name = %s"; |
| 327 | + // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL -- plugin table | |
| 334 | 328 | $wpdb->get_results( $wpdb->prepare( |
| 335 | 329 | $query, |
| 336 | 330 | // phpcs:ignore WordPress.DB.PreparedSQL |
| 337 | 331 | array(WPDA::remove_backticks( WPDP_Project_Design_Table_Model::get_base_table_name() ), $this->wpda_table_name) |
| @@ -339,34 +333,27 @@ | ||
| 339 | 333 | if ( $wpdb->num_rows > 0 ) { |
| 340 | 334 | $query = "select 'x' from `%1s` where wpda_schema_name = %s and wpda_table_name = %s and wpda_table_setname = %s"; |
| 341 | 335 | $i = $wpdb->num_rows + 1; |
| 342 | 336 | $this->wpda_table_setname = "options_set_{$i}"; |
| 343 | - $wpdb->get_results( $wpdb->prepare( | |
| 344 | - $query, | |
| 345 | - // phpcs:ignore WordPress.DB.PreparedSQL | |
| 346 | - array( | |
| 337 | + $wpdb->get_results( $wpdb->prepare( $query, array( | |
| 338 | + WPDA::remove_backticks( WPDP_Project_Design_Table_Model::get_base_table_name() ), | |
| 339 | + $this->wpda_schema_name, | |
| 340 | + $this->wpda_table_name, | |
| 341 | + $this->wpda_table_setname | |
| 342 | + ) ) ); | |
| 343 | + while ( $wpdb->num_rows > 0 ) { | |
| 344 | + // Search until a free options set is found | |
| 345 | + $this->wpda_table_setname = "options_set_{$i}"; | |
| 346 | + $wpdb->get_results( $wpdb->prepare( $query, array( | |
| 347 | 347 | WPDA::remove_backticks( WPDP_Project_Design_Table_Model::get_base_table_name() ), |
| 348 | 348 | $this->wpda_schema_name, |
| 349 | 349 | $this->wpda_table_name, |
| 350 | 350 | $this->wpda_table_setname |
| 351 | - ) | |
| 352 | - ) ); | |
| 353 | - while ( $wpdb->num_rows > 0 ) { | |
| 354 | - // Search until a free options set is found | |
| 355 | - $this->wpda_table_setname = "options_set_{$i}"; | |
| 356 | - $wpdb->get_results( $wpdb->prepare( | |
| 357 | - $query, | |
| 358 | - // phpcs:ignore WordPress.DB.PreparedSQL | |
| 359 | - array( | |
| 360 | - WPDA::remove_backticks( WPDP_Project_Design_Table_Model::get_base_table_name() ), | |
| 361 | - $this->wpda_schema_name, | |
| 362 | - $this->wpda_table_name, | |
| 363 | - $this->wpda_table_setname | |
| 364 | - ) | |
| 365 | - ) ); | |
| 351 | + ) ) ); | |
| 366 | 352 | $i++; |
| 367 | 353 | } |
| 368 | 354 | } |
| 355 | + // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter, WordPress.DB.PreparedSQL | |
| 369 | 356 | } |
| 370 | 357 | |
| 371 | 358 | /** |
| 372 | 359 | * Adds tabs to page |
| @@ -382,10 +369,11 @@ | ||
| 382 | 369 | $table_name = esc_attr( $this->wpda_table_name ); |
| 383 | 370 | $set_name = esc_attr( $this->wpda_table_setname ); |
| 384 | 371 | $tab_value = esc_attr( $tab ); |
| 385 | 372 | $tab_form = "\n\t\t\t\t\t\t<form id='{$form_id}' method='post' action='?page={$page}&tab={$tab_value}'>\n\t\t\t\t\t\t\t<input type='hidden' name='wpda_schema_name' value='{$schema_name}'/>\n\t\t\t\t\t\t\t<input type='hidden' name='wpda_table_name' value='{$table_name}'/>\n\t\t\t\t\t\t\t<input type='hidden' name='wpda_table_setname' value='{$set_name}'/>\n\t\t\t\t\t\t\t<input type='hidden' name='wpda_table_setname_old' value='{$set_name}'/>\n\t\t\t\t\t\t\t<input type='hidden' name='action' value='edit'/>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t"; |
| 373 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 386 | 374 | echo $tab_form; |
| 387 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 375 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 388 | 376 | } |
| 389 | 377 | ?> |
| 390 | 378 | </div> |
| 391 | 379 | <h2 class="nav-tab-wrapper"> |
| @@ -487,9 +475,9 @@ | ||
| 487 | 475 | echo esc_attr( $this->page ); |
| 488 | 476 | ?>" |
| 489 | 477 | class="dashicons dashicons-arrow-left-alt2" |
| 490 | 478 | title="<?php |
| 491 | - echo __( 'Template list', 'wp-data-access' ); | |
| 479 | + esc_html_e( 'Template list', 'wp-data-access' ); | |
| 492 | 480 | ?>" |
| 493 | 481 | ></a> |
| 494 | 482 | <?php |
| 495 | 483 | echo esc_attr( $title ); |
| @@ -568,9 +556,9 @@ | ||
| 568 | 556 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 569 | 557 | <legend> |
| 570 | 558 | <label style="font-weight: normal;"> |
| 571 | 559 | <?php |
| 572 | - echo __( 'Manage table settings for table ', 'wp-data-access' ); | |
| 560 | + esc_html_e( 'Manage table settings for table ', 'wp-data-access' ); | |
| 573 | 561 | ?> |
| 574 | 562 | </label> |
| 575 | 563 | <label> |
| 576 | 564 | <?php |
| @@ -583,9 +571,9 @@ | ||
| 583 | 571 | <tr> |
| 584 | 572 | <td style="text-align: right; padding-right: 5px; width: 140px;" class="wpdp-label-column"> |
| 585 | 573 | <label> |
| 586 | 574 | <?php |
| 587 | - echo __( 'Template set name', 'wp-data-access' ); | |
| 575 | + esc_html_e( 'Template set name', 'wp-data-access' ); | |
| 588 | 576 | ?> |
| 589 | 577 | </label> |
| 590 | 578 | </td> |
| 591 | 579 | <td> |
| @@ -604,9 +592,9 @@ | ||
| 604 | 592 | <tr> |
| 605 | 593 | <td style="text-align: right; padding-right: 5px;"> |
| 606 | 594 | <label> |
| 607 | 595 | <?php |
| 608 | - echo __( 'Tab label', 'wp-data-access' ); | |
| 596 | + esc_html_e( 'Tab label', 'wp-data-access' ); | |
| 609 | 597 | ?> |
| 610 | 598 | </label> |
| 611 | 599 | </td> |
| 612 | 600 | <td> |
| @@ -638,16 +626,17 @@ | ||
| 638 | 626 | <tr> |
| 639 | 627 | <td style="text-align: right; padding-right: 5px; padding-top: 10px;" class="wpdp-label-column"> |
| 640 | 628 | <label> |
| 641 | 629 | <?php |
| 642 | - echo __( 'Hyperlinks parent', 'wp-data-access' ); | |
| 630 | + esc_html_e( 'Hyperlinks parent', 'wp-data-access' ); | |
| 643 | 631 | ?> |
| 644 | 632 | </label> |
| 645 | 633 | </td> |
| 646 | 634 | <td style="padding-top: 10px;"> |
| 647 | 635 | <?php |
| 636 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 648 | 637 | echo $html; |
| 649 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 638 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 650 | 639 | ?> |
| 651 | 640 | </td> |
| 652 | 641 | </tr> |
| 653 | 642 | <tr> |
| @@ -653,16 +642,17 @@ | ||
| 653 | 642 | <tr> |
| 654 | 643 | <td style="text-align: right; padding-right: 5px;" class="wpdp-label-column"> |
| 655 | 644 | <label> |
| 656 | 645 | <?php |
| 657 | - echo __( 'Hyperlinks child', 'wp-data-access' ); | |
| 646 | + esc_html_e( 'Hyperlinks child', 'wp-data-access' ); | |
| 658 | 647 | ?> |
| 659 | 648 | </label> |
| 660 | 649 | </td> |
| 661 | 650 | <td> |
| 662 | 651 | <?php |
| 652 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 663 | 653 | echo $html_child; |
| 664 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 654 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 665 | 655 | ?> |
| 666 | 656 | </td> |
| 667 | 657 | </tr> |
| 668 | 658 | </table> |
| @@ -678,9 +668,9 @@ | ||
| 678 | 668 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 679 | 669 | <legend> |
| 680 | 670 | <label style="font-weight: normal;"> |
| 681 | 671 | <?php |
| 682 | - echo __( 'Child table setting only', 'wp-data-access' ); | |
| 672 | + esc_html_e( 'Child table setting only', 'wp-data-access' ); | |
| 683 | 673 | ?> |
| 684 | 674 | <span class="dashicons dashicons-editor-help wpda_tooltip" title="These settings only affect child tables! Parent table settings are available on Data Projects page."></span> |
| 685 | 675 | </label> |
| 686 | 676 | </legend> |
| @@ -689,9 +679,9 @@ | ||
| 689 | 679 | <tr> |
| 690 | 680 | <td style="text-align: right; padding-right: 5px;" class="wpdp-label-column"> |
| 691 | 681 | <label> |
| 692 | 682 | <?php |
| 693 | - echo __( 'Default WHERE', 'wp-data-access' ); | |
| 683 | + esc_html_e( 'Default WHERE', 'wp-data-access' ); | |
| 694 | 684 | ?> |
| 695 | 685 | </label> |
| 696 | 686 | </td> |
| 697 | 687 | <td> |
| @@ -707,9 +697,9 @@ | ||
| 707 | 697 | <tr> |
| 708 | 698 | <td style="text-align: right; padding-right: 5px;" class="wpdp-label-column"> |
| 709 | 699 | <label> |
| 710 | 700 | <?php |
| 711 | - echo __( 'Default ORDER BY', 'wp-data-access' ); | |
| 701 | + esc_html_e( 'Default ORDER BY', 'wp-data-access' ); | |
| 712 | 702 | ?> |
| 713 | 703 | </label> |
| 714 | 704 | </td> |
| 715 | 705 | <td> |
| @@ -742,9 +732,9 @@ | ||
| 742 | 732 | ?>"/> |
| 743 | 733 | <button type="submit" class="button button-primary"> |
| 744 | 734 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 745 | 735 | <?php |
| 746 | - echo __( 'Save table info', 'wp-data-access' ); | |
| 736 | + esc_html_e( 'Save table info', 'wp-data-access' ); | |
| 747 | 737 | ?> |
| 748 | 738 | </button> |
| 749 | 739 | <a href="?page=<?php |
| 750 | 740 | echo esc_attr( $this->page ); |
| @@ -750,9 +740,9 @@ | ||
| 750 | 740 | echo esc_attr( $this->page ); |
| 751 | 741 | ?>" class="button button-secondary"> |
| 752 | 742 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 753 | 743 | <?php |
| 754 | - echo __( 'Back to list', 'wp-data-access' ); | |
| 744 | + esc_html_e( 'Back to list', 'wp-data-access' ); | |
| 755 | 745 | ?> |
| 756 | 746 | </a> |
| 757 | 747 | </div> |
| 758 | 748 | |
| @@ -976,10 +966,11 @@ | ||
| 976 | 966 | foreach ( $target_table_names as $target_table_name ) { |
| 977 | 967 | $option = "<option value='" . esc_attr( $target_table_name['table_name'] ) . "'>" . esc_attr( $target_table_name['table_name'] ) . '</option>'; |
| 978 | 968 | ?> |
| 979 | 969 | jQuery('#relation_table_name_' + row_num).append("<?php |
| 970 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 980 | 971 | echo $option; |
| 981 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 972 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 982 | 973 | ?>"); |
| 983 | 974 | jQuery('#relation_table_name_' + row_num).val(relation_table_name); |
| 984 | 975 | <?php |
| 985 | 976 | } |
| @@ -1082,9 +1073,9 @@ | ||
| 1082 | 1073 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 1083 | 1074 | <legend> |
| 1084 | 1075 | <label style="font-weight: normal;"> |
| 1085 | 1076 | <?php |
| 1086 | - echo __( 'Manage relationships for table', 'wp-data-access' ); | |
| 1077 | + esc_html_e( 'Manage relationships for table', 'wp-data-access' ); | |
| 1087 | 1078 | ?> |
| 1088 | 1079 | </label> |
| 1089 | 1080 | <label> |
| 1090 | 1081 | <?php |
| @@ -1098,37 +1089,37 @@ | ||
| 1098 | 1089 | <tr> |
| 1099 | 1090 | <th class="wpda-table-structure-first-column-move"></th> |
| 1100 | 1091 | <th> |
| 1101 | 1092 | <?php |
| 1102 | - echo __( 'Type', 'wp-data-access' ); | |
| 1093 | + esc_html_e( 'Type', 'wp-data-access' ); | |
| 1103 | 1094 | ?> |
| 1104 | 1095 | </th> |
| 1105 | 1096 | <th> |
| 1106 | 1097 | <?php |
| 1107 | - echo __( 'Source column name', 'wp-data-access' ); | |
| 1098 | + esc_html_e( 'Source column name', 'wp-data-access' ); | |
| 1108 | 1099 | ?> |
| 1109 | 1100 | </th> |
| 1110 | 1101 | <th style="width:20px;"></th> |
| 1111 | 1102 | <th> |
| 1112 | 1103 | <?php |
| 1113 | - echo __( 'Target table name', 'wp-data-access' ); | |
| 1104 | + esc_html_e( 'Target table name', 'wp-data-access' ); | |
| 1114 | 1105 | ?> |
| 1115 | 1106 | </th> |
| 1116 | 1107 | <th> |
| 1117 | 1108 | <?php |
| 1118 | - echo __( 'Target column name', 'wp-data-access' ); | |
| 1109 | + esc_html_e( 'Target column name', 'wp-data-access' ); | |
| 1119 | 1110 | ?> |
| 1120 | 1111 | </th> |
| 1121 | 1112 | <th> |
| 1122 | 1113 | <span style="vertical-align:inherit"> |
| 1123 | 1114 | <?php |
| 1124 | - echo __( 'Relation table name (only n:m)', 'wp-data-access' ); | |
| 1115 | + esc_html_e( 'Relation table name (only n:m)', 'wp-data-access' ); | |
| 1125 | 1116 | ?> |
| 1126 | 1117 | </span> |
| 1127 | 1118 | <span |
| 1128 | 1119 | class="dashicons dashicons-info wpda_tooltip" |
| 1129 | 1120 | title="<?php |
| 1130 | - echo __( 'Table shown on the other end of the n:m relationship (instead of target table shown for 1:n relationships). Not available for 1:n relationships.', 'wp-data-access' ); | |
| 1121 | + esc_html_e( 'Table shown on the other end of the n:m relationship (instead of target table shown for 1:n relationships). Not available for 1:n relationships.', 'wp-data-access' ); | |
| 1131 | 1122 | ?>" |
| 1132 | 1123 | style="cursor:pointer;" |
| 1133 | 1124 | ></span> |
| 1134 | 1125 | </th> |
| @@ -1171,9 +1162,9 @@ | ||
| 1171 | 1162 | ?>"/> |
| 1172 | 1163 | <button type="submit" class="button button-primary"> |
| 1173 | 1164 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 1174 | 1165 | <?php |
| 1175 | - echo __( 'Save relationships', 'wp-data-access' ); | |
| 1166 | + esc_html_e( 'Save relationships', 'wp-data-access' ); | |
| 1176 | 1167 | ?> |
| 1177 | 1168 | </button> |
| 1178 | 1169 | <a href="?page=<?php |
| 1179 | 1170 | echo esc_attr( $this->page ); |
| @@ -1179,9 +1170,9 @@ | ||
| 1179 | 1170 | echo esc_attr( $this->page ); |
| 1180 | 1171 | ?>" class="button button-secondary"> |
| 1181 | 1172 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 1182 | 1173 | <?php |
| 1183 | - echo __( 'Back to list', 'wp-data-access' ); | |
| 1174 | + esc_html_e( 'Back to list', 'wp-data-access' ); | |
| 1184 | 1175 | ?> |
| 1185 | 1176 | </a> |
| 1186 | 1177 | </div> |
| 1187 | 1178 | |
| @@ -1189,9 +1180,9 @@ | ||
| 1189 | 1180 | <?php |
| 1190 | 1181 | if ( isset( $this->table_structure->relationships ) ) { |
| 1191 | 1182 | $relationships = $this->table_structure->relationships; |
| 1192 | 1183 | if ( 0 < count( $relationships ) ) { |
| 1193 | - //phpcs:ignore - 8.1 proof | |
| 1184 | + // phpcs:ignore -- 8.1 proof | |
| 1194 | 1185 | foreach ( $relationships as $relationship ) { |
| 1195 | 1186 | ?> |
| 1196 | 1187 | <script type='text/javascript'> |
| 1197 | 1188 | <?php |
| @@ -1199,17 +1190,19 @@ | ||
| 1199 | 1190 | $source_column_name_array = '[""]'; |
| 1200 | 1191 | } else { |
| 1201 | 1192 | $source_column_name_array = wp_json_encode( $relationship->source_column_name ); |
| 1202 | 1193 | } |
| 1194 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 1203 | 1195 | echo 'var source_column_name_array = ' . $source_column_name_array . ";\n"; |
| 1204 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1196 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 1205 | 1197 | if ( !is_array( $relationship->target_column_name ) ) { |
| 1206 | 1198 | $target_column_name_array = '[""]'; |
| 1207 | 1199 | } else { |
| 1208 | 1200 | $target_column_name_array = wp_json_encode( $relationship->target_column_name ); |
| 1209 | 1201 | } |
| 1202 | + // phpcs:disable WordPress.Security.EscapeOutput | |
| 1210 | 1203 | echo 'var target_column_name_array = ' . $target_column_name_array . ";\n"; |
| 1211 | - // phpcs:ignore WordPress.Security.EscapeOutput | |
| 1204 | + // phpcs:enable WordPress.Security.EscapeOutput | |
| 1212 | 1205 | if ( isset( $relationship->relation_table_name ) ) { |
| 1213 | 1206 | $relation_table_name = $relationship->relation_table_name; |
| 1214 | 1207 | } else { |
| 1215 | 1208 | $relation_table_name = ''; |
| @@ -1273,9 +1266,9 @@ | ||
| 1273 | 1266 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 1274 | 1267 | <legend> |
| 1275 | 1268 | <label style="font-weight: normal;"> |
| 1276 | 1269 | <?php |
| 1277 | - echo __( 'Manage columns for list table of table', 'wp-data-access' ); | |
| 1270 | + esc_html_e( 'Manage columns for list table of table', 'wp-data-access' ); | |
| 1278 | 1271 | ?> |
| 1279 | 1272 | </label> |
| 1280 | 1273 | <label> |
| 1281 | 1274 | <?php |
| @@ -1289,40 +1282,40 @@ | ||
| 1289 | 1282 | <tr> |
| 1290 | 1283 | <th class="wpda-table-structure-first-column-move"></th> |
| 1291 | 1284 | <th> |
| 1292 | 1285 | <?php |
| 1293 | - echo __( 'Column name', 'wp-data-access' ); | |
| 1286 | + esc_html_e( 'Column name', 'wp-data-access' ); | |
| 1294 | 1287 | ?> |
| 1295 | 1288 | </th> |
| 1296 | 1289 | <th> |
| 1297 | 1290 | <?php |
| 1298 | - echo __( 'Data type', 'wp-data-access' ); | |
| 1291 | + esc_html_e( 'Data type', 'wp-data-access' ); | |
| 1299 | 1292 | ?> |
| 1300 | 1293 | </th> |
| 1301 | 1294 | <th> |
| 1302 | 1295 | <?php |
| 1303 | - echo __( 'Key', 'wp-data-access' ); | |
| 1296 | + esc_html_e( 'Key', 'wp-data-access' ); | |
| 1304 | 1297 | ?> |
| 1305 | 1298 | </th> |
| 1306 | 1299 | <th> |
| 1307 | 1300 | <?php |
| 1308 | - echo __( 'Mandatory', 'wp-data-access' ); | |
| 1301 | + esc_html_e( 'Mandatory', 'wp-data-access' ); | |
| 1309 | 1302 | ?> |
| 1310 | 1303 | </th> |
| 1311 | 1304 | <th> |
| 1312 | 1305 | <?php |
| 1313 | - echo __( 'Visible', 'wp-data-access' ); | |
| 1306 | + esc_html_e( 'Visible', 'wp-data-access' ); | |
| 1314 | 1307 | ?> |
| 1315 | 1308 | </th> |
| 1316 | 1309 | <th> |
| 1317 | 1310 | <?php |
| 1318 | - echo __( 'Label', 'wp-data-access' ); | |
| 1311 | + esc_html_e( 'Label', 'wp-data-access' ); | |
| 1319 | 1312 | ?> |
| 1320 | 1313 | </th> |
| 1321 | 1314 | <th></th> |
| 1322 | 1315 | <th> |
| 1323 | 1316 | <?php |
| 1324 | - echo __( 'Lookup', 'wp-data-access' ); | |
| 1317 | + esc_html_e( 'Lookup', 'wp-data-access' ); | |
| 1325 | 1318 | ?> |
| 1326 | 1319 | </th> |
| 1327 | 1320 | </tr> |
| 1328 | 1321 | </thead> |
| @@ -1346,13 +1339,15 @@ | ||
| 1346 | 1339 | $key = $table_structure[$column_name]->key; |
| 1347 | 1340 | $mandatory = $table_structure[$column_name]->mandatory; |
| 1348 | 1341 | $max_length = $table_structure[$column_name]->max_length; |
| 1349 | 1342 | } else { |
| 1343 | + // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment | |
| 1350 | 1344 | $msg = new WPDA_Message_Box(array( |
| 1351 | - 'message_text' => __( "Column {$column_name} not found for list table", 'wp-data-access' ), | |
| 1345 | + 'message_text' => sprintf( __( 'Column %s not found for list table', 'wp-data-access' ), esc_attr( $column_name ) ), | |
| 1352 | 1346 | 'message_type' => 'error', |
| 1353 | 1347 | 'message_is_dismissible' => false, |
| 1354 | 1348 | )); |
| 1349 | + // phpcs:enable WordPress.WP.I18n.MissingTranslatorsComment | |
| 1355 | 1350 | $msg->box(); |
| 1356 | 1351 | break; |
| 1357 | 1352 | } |
| 1358 | 1353 | if ( '' === $max_length ) { |
| @@ -1503,9 +1498,9 @@ | ||
| 1503 | 1498 | ?>"/> |
| 1504 | 1499 | <button type="submit" class="button button-primary"> |
| 1505 | 1500 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 1506 | 1501 | <?php |
| 1507 | - echo __( 'Save list table columns', 'wp-data-access' ); | |
| 1502 | + esc_html_e( 'Save list table columns', 'wp-data-access' ); | |
| 1508 | 1503 | ?> |
| 1509 | 1504 | </button> |
| 1510 | 1505 | <a href="?page=<?php |
| 1511 | 1506 | echo esc_attr( $this->page ); |
| @@ -1511,9 +1506,9 @@ | ||
| 1511 | 1506 | echo esc_attr( $this->page ); |
| 1512 | 1507 | ?>" class="button button-secondary"> |
| 1513 | 1508 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 1514 | 1509 | <?php |
| 1515 | - echo __( 'Back to list', 'wp-data-access' ); | |
| 1510 | + esc_html_e( 'Back to list', 'wp-data-access' ); | |
| 1516 | 1511 | ?> |
| 1517 | 1512 | </a> |
| 1518 | 1513 | </div> |
| 1519 | 1514 | |
| @@ -1539,9 +1534,9 @@ | ||
| 1539 | 1534 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 1540 | 1535 | <legend> |
| 1541 | 1536 | <label style="font-weight: normal;"> |
| 1542 | 1537 | <?php |
| 1543 | - echo __( 'Manage columns for data entry form for table', 'wp-data-access' ); | |
| 1538 | + esc_html_e( 'Manage columns for data entry form for table', 'wp-data-access' ); | |
| 1544 | 1539 | ?> |
| 1545 | 1540 | </label> |
| 1546 | 1541 | <label> |
| 1547 | 1542 | <?php |
| @@ -1555,68 +1550,68 @@ | ||
| 1555 | 1550 | <tr> |
| 1556 | 1551 | <th class="wpda-table-structure-first-column-move"></th> |
| 1557 | 1552 | <th> |
| 1558 | 1553 | <?php |
| 1559 | - echo __( 'Column name', 'wp-data-access' ); | |
| 1554 | + esc_html_e( 'Column name', 'wp-data-access' ); | |
| 1560 | 1555 | ?> |
| 1561 | 1556 | </th> |
| 1562 | 1557 | <th> |
| 1563 | 1558 | <?php |
| 1564 | - echo __( 'Data type', 'wp-data-access' ); | |
| 1559 | + esc_html_e( 'Data type', 'wp-data-access' ); | |
| 1565 | 1560 | ?> |
| 1566 | 1561 | </th> |
| 1567 | 1562 | <th> |
| 1568 | 1563 | <?php |
| 1569 | - echo __( 'Key', 'wp-data-access' ); | |
| 1564 | + esc_html_e( 'Key', 'wp-data-access' ); | |
| 1570 | 1565 | ?> |
| 1571 | 1566 | </th> |
| 1572 | 1567 | <th> |
| 1573 | 1568 | <?php |
| 1574 | - echo __( 'Mandatory', 'wp-data-access' ); | |
| 1569 | + esc_html_e( 'Mandatory', 'wp-data-access' ); | |
| 1575 | 1570 | ?> |
| 1576 | 1571 | </th> |
| 1577 | 1572 | <th> |
| 1578 | 1573 | <?php |
| 1579 | - echo __( 'Visible', 'wp-data-access' ); | |
| 1574 | + esc_html_e( 'Visible', 'wp-data-access' ); | |
| 1580 | 1575 | ?> |
| 1581 | 1576 | </th> |
| 1582 | 1577 | <th> |
| 1583 | 1578 | <?php |
| 1584 | - echo __( 'Read only', 'wp-data-access' ); | |
| 1579 | + esc_html_e( 'Read only', 'wp-data-access' ); | |
| 1585 | 1580 | ?> |
| 1586 | 1581 | </th> |
| 1587 | 1582 | <th> |
| 1588 | 1583 | <?php |
| 1589 | - echo __( 'Less', 'wp-data-access' ); | |
| 1584 | + esc_html_e( 'Less', 'wp-data-access' ); | |
| 1590 | 1585 | ?> |
| 1591 | 1586 | </th> |
| 1592 | 1587 | <th> |
| 1593 | 1588 | <?php |
| 1594 | - echo __( 'Label', 'wp-data-access' ); | |
| 1589 | + esc_html_e( 'Label', 'wp-data-access' ); | |
| 1595 | 1590 | ?> |
| 1596 | 1591 | </th> |
| 1597 | 1592 | <th></th> |
| 1598 | 1593 | <th> |
| 1599 | 1594 | <?php |
| 1600 | - echo __( 'Default value', 'wp-data-access' ); | |
| 1595 | + esc_html_e( 'Default value', 'wp-data-access' ); | |
| 1601 | 1596 | ?> |
| 1602 | 1597 | </th> |
| 1603 | 1598 | <th></th> |
| 1604 | 1599 | <th> |
| 1605 | 1600 | <?php |
| 1606 | - echo __( 'Lookup', 'wp-data-access' ); | |
| 1601 | + esc_html_e( 'Lookup', 'wp-data-access' ); | |
| 1607 | 1602 | ?> |
| 1608 | 1603 | </th> |
| 1609 | 1604 | <th> |
| 1610 | 1605 | <span style="vertical-align:inherit"> |
| 1611 | 1606 | <?php |
| 1612 | - echo __( 'ID?', 'wp-data-access' ); | |
| 1607 | + esc_html_e( 'ID?', 'wp-data-access' ); | |
| 1613 | 1608 | ?> |
| 1614 | 1609 | </span> |
| 1615 | 1610 | <span |
| 1616 | 1611 | class="dashicons dashicons-info wpda_tooltip" |
| 1617 | 1612 | title="<?php |
| 1618 | - echo __( 'Enable to hide ID in lookup', 'wp-data-access' ); | |
| 1613 | + esc_html_e( 'Enable to hide ID in lookup', 'wp-data-access' ); | |
| 1619 | 1614 | ?>" |
| 1620 | 1615 | style="cursor:pointer;" |
| 1621 | 1616 | ></span> |
| 1622 | 1617 | |
| @@ -1643,13 +1638,15 @@ | ||
| 1643 | 1638 | $key = $table_structure[$column_name]->key; |
| 1644 | 1639 | $mandatory = $table_structure[$column_name]->mandatory; |
| 1645 | 1640 | $max_length = $table_structure[$column_name]->max_length; |
| 1646 | 1641 | } else { |
| 1642 | + // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment | |
| 1647 | 1643 | $msg = new WPDA_Message_Box(array( |
| 1648 | - 'message_text' => __( "Column {$column_name} not found for data entry form", 'wp-data-access' ), | |
| 1644 | + 'message_text' => sprintf( __( 'Column %s not found for data entry form', 'wp-data-access' ), esc_attr( $column_name ) ), | |
| 1649 | 1645 | 'message_type' => 'error', |
| 1650 | 1646 | 'message_is_dismissible' => false, |
| 1651 | 1647 | )); |
| 1648 | + // phpcs:enable WordPress.WP.I18n.MissingTranslatorsComment | |
| 1652 | 1649 | $msg->box(); |
| 1653 | 1650 | break; |
| 1654 | 1651 | } |
| 1655 | 1652 | if ( '' === $max_length ) { |
| @@ -1898,9 +1895,9 @@ | ||
| 1898 | 1895 | ?>"/> |
| 1899 | 1896 | <button type="submit" class="button button-primary"> |
| 1900 | 1897 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 1901 | 1898 | <?php |
| 1902 | - echo __( 'Save data entry form columns', 'wp-data-access' ); | |
| 1899 | + esc_html_e( 'Save data entry form columns', 'wp-data-access' ); | |
| 1903 | 1900 | ?> |
| 1904 | 1901 | </button> |
| 1905 | 1902 | <a href="?page=<?php |
| 1906 | 1903 | echo esc_attr( $this->page ); |
| @@ -1906,9 +1903,9 @@ | ||
| 1906 | 1903 | echo esc_attr( $this->page ); |
| 1907 | 1904 | ?>" class="button button-secondary"> |
| 1908 | 1905 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 1909 | 1906 | <?php |
| 1910 | - echo __( 'Back to list', 'wp-data-access' ); | |
| 1907 | + esc_html_e( 'Back to list', 'wp-data-access' ); | |
| 1911 | 1908 | ?> |
| 1912 | 1909 | </a> |
| 1913 | 1910 | </div> |
| 1914 | 1911 | |
| @@ -1923,9 +1920,9 @@ | ||
| 1923 | 1920 | <fieldset class="wpda_fieldset wpdp_fieldset"> |
| 1924 | 1921 | <legend> |
| 1925 | 1922 | <label style="font-weight: normal;"> |
| 1926 | 1923 | <?php |
| 1927 | - echo __( 'Reconcile columns for table', 'wp-data-access' ); | |
| 1924 | + esc_html_e( 'Reconcile columns for table', 'wp-data-access' ); | |
| 1928 | 1925 | ?> |
| 1929 | 1926 | </label> |
| 1930 | 1927 | <label> |
| 1931 | 1928 | <?php |
| @@ -1971,14 +1968,14 @@ | ||
| 1971 | 1968 | echo esc_attr( $this->wpnonce ); |
| 1972 | 1969 | ?>"/> |
| 1973 | 1970 | <button type="submit" class="button button-primary wpda_tooltip" |
| 1974 | 1971 | onclick="return (confirm('<?php |
| 1975 | - echo __( 'Reconcile table? Your current modifications will be lost!' ); | |
| 1972 | + esc_html_e( 'Reconcile table? Your current modifications will be lost!', 'wp-data-access' ); | |
| 1976 | 1973 | ?>'));" |
| 1977 | 1974 | > |
| 1978 | 1975 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 1979 | 1976 | <?php |
| 1980 | - echo __( 'Reconcile Table', 'wp-data-access' ); | |
| 1977 | + esc_html_e( 'Reconcile Table', 'wp-data-access' ); | |
| 1981 | 1978 | ?> |
| 1982 | 1979 | </button> |
| 1983 | 1980 | <a href="?page=<?php |
| 1984 | 1981 | echo esc_attr( $this->page ); |
| @@ -1984,9 +1981,9 @@ | ||
| 1984 | 1981 | echo esc_attr( $this->page ); |
| 1985 | 1982 | ?>" class="button button-secondary"> |
| 1986 | 1983 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 1987 | 1984 | <?php |
| 1988 | - echo __( 'Back to list', 'wp-data-access' ); | |
| 1985 | + esc_html_e( 'Back to list', 'wp-data-access' ); | |
| 1989 | 1986 | ?> |
| 1990 | 1987 | </a> |
| 1991 | 1988 | </div> |
| 1992 | 1989 | </form> |
| @@ -1994,4 +1991,6 @@ | ||
| 1994 | 1991 | <?php |
| 1995 | 1992 | } |
| 1996 | 1993 | |
| 1997 | 1994 | } |
| 1995 | + | |
| 1996 | +// phpcs:enable WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |