| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | // Security check. |
| 16 | 16 | if ( 'delete_remote_database' === $action ) { |
| 17 | 17 | $wp_nonce = isset( $_REQUEST['_wpnoncedelrdb'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnoncedelrdb'] ) ) : ''; // input var okay. |
| 18 | 18 | if ( ! wp_verify_nonce( $wp_nonce, 'wpda-delete-remote-database-' . WPDA::get_current_user_login() ) ) { |
| 19 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 19 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | if ( isset( $_REQUEST['remote_database_name'] ) ) { |
| 23 | 23 | $remote_database_name = sanitize_text_field( wp_unslash( $_REQUEST['remote_database_name'] ) ); // input var okay. |
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | } |
| 26 | 26 | } elseif ( 'update_remote_database' === $action ) { |
| 27 | 27 | $wp_nonce = isset( $_REQUEST['_wpnonceupdrdb'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonceupdrdb'] ) ) : ''; // input var okay. |
| 28 | 28 | if ( ! wp_verify_nonce( $wp_nonce, 'wpda-update-remote-database-' . WPDA::get_current_user_login() ) ) { |
| 29 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 29 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $database_old = isset( $_REQUEST['remote_database_old'] ) ? |
| 33 | 33 | sanitize_text_field( wp_unslash( $_REQUEST['remote_database_old'] ) ) : ''; // input var okay. |
| @@ -61,9 +61,9 @@ | ||
| 61 | 61 | |
| 62 | 62 | if ( '' === $database_old || '' === $database || '' === $host || '' === $username || '' === $password || '' === $port || '' === $schema || '' === $enabled ) { |
| 63 | 63 | $msg = new WPDA_Message_Box( |
| 64 | 64 | array( |
| 65 | - 'message_text' => sprintf( __( 'Cannot save remote database connection [missing arguments]', 'wp-data-access' ) ), | |
| 65 | + 'message_text' => __( 'Cannot save remote database connection [missing arguments]', 'wp-data-access' ), | |
| 66 | 66 | 'message_type' => 'error', |
| 67 | 67 | 'message_is_dismissible' => false, |
| 68 | 68 | ) |
| 69 | 69 | ); |
| @@ -88,9 +88,9 @@ | ||
| 88 | 88 | } |
| 89 | 89 | } else { |
| 90 | 90 | $wp_nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['_wpnonce'] ) ) : ''; // input var okay. |
| 91 | 91 | if ( ! wp_verify_nonce( $wp_nonce, 'wpda-plugin-settings-' . WPDA::get_current_user_login() ) ) { |
| 92 | - wp_die( __( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 92 | + wp_die( esc_attr__( 'ERROR: Not authorized', 'wp-data-access' ) ); | |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | if ( 'save' === $action ) { |
| 96 | 96 | WPDA::set_option( |
| @@ -130,13 +130,13 @@ | ||
| 130 | 130 | |
| 131 | 131 | if ( isset( $_REQUEST['remote_database_name'] ) && isset( $_REQUEST['remote_database_enabled'] ) ) { |
| 132 | 132 | if ( is_array( $_REQUEST['remote_database_name'] ) && |
| 133 | 133 | is_array( $_REQUEST['remote_database_enabled'] ) && |
| 134 | - count( $_REQUEST['remote_database_name'] ) === count( $_REQUEST['remote_database_enabled'] )//phpcs:ignore - 8.1 proof | |
| 134 | + count( $_REQUEST['remote_database_name'] ) === count( $_REQUEST['remote_database_enabled'] ) // phpcs:ignore -- 8.1 proof | |
| 135 | 135 | ) { |
| 136 | 136 | $i = 0; |
| 137 | - while ( $i < count( $_REQUEST['remote_database_name'] ) ) {//phpcs:ignore - 8.1 proof | |
| 138 | - $rdb_name = sanitize_text_field( wp_unslash( $_REQUEST['remote_database_name'][ $i ] ) ); | |
| 137 | + while ( $i < count( $_REQUEST['remote_database_name'] ) ) { // phpcs:ignore -- 8.1 proof | |
| 138 | + $rdb_name = sanitize_text_field( wp_unslash( $_REQUEST['remote_database_name'][ $i ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 139 | 139 | $dbs = WPDADB::get_remote_database( $rdb_name, true ); |
| 140 | 140 | if ( ! $dbs ) { |
| 141 | 141 | $msg = new WPDA_Message_Box( |
| 142 | 142 | array( |
| @@ -153,9 +153,9 @@ | ||
| 153 | 153 | $dbs['username'], |
| 154 | 154 | $dbs['password'], |
| 155 | 155 | $dbs['port'], |
| 156 | 156 | $dbs['database'], |
| 157 | - $_REQUEST['remote_database_enabled'][ $i ] === 'FALSE', | |
| 157 | + $_REQUEST['remote_database_enabled'][ $i ] === 'FALSE', // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated | |
| 158 | 158 | false, |
| 159 | 159 | $dbs['ssl'], |
| 160 | 160 | $dbs['ssl_key'], |
| 161 | 161 | $dbs['ssl_cert'], |
| @@ -265,9 +265,9 @@ | ||
| 265 | 265 | |
| 266 | 266 | <script> |
| 267 | 267 | function delete_remote_database(id) { |
| 268 | 268 | remote_database_name = jQuery('#remote_database_name' + id).val(); |
| 269 | - if (confirm("<?php echo __( 'Delete remote database connection from plugin repository?', 'wp-data-access' ); ?>")) { | |
| 269 | + if (confirm("<?php esc_html_e( 'Delete remote database connection from plugin repository?', 'wp-data-access' ); ?>")) { | |
| 270 | 270 | jQuery('#delete_remote_database_name').val(remote_database_name); |
| 271 | 271 | jQuery('#wpda_delete_database').submit(); |
| 272 | 272 | } |
| 273 | 273 | } |
| @@ -371,9 +371,9 @@ | ||
| 371 | 371 | <div id="wpda_update_database_popup"> |
| 372 | 372 | <div id="wpda_update_database_popup_header"> |
| 373 | 373 | <span style="display:inline-block;margin-top:5px;"> |
| 374 | 374 | <strong> |
| 375 | - <?php echo __( 'Edit Remote Database Connection', 'wp-data-access' ); ?> | |
| 375 | + <?php esc_html_e( 'Edit Remote Database Connection', 'wp-data-access' ); ?> | |
| 376 | 376 | </strong> |
| 377 | 377 | </span> |
| 378 | 378 | <span class="button" style="float:right;height:10px;" |
| 379 | 379 | onclick="jQuery('#wpda_update_database_popup').hide()">x</span><br/> |
| @@ -444,13 +444,13 @@ | ||
| 444 | 444 | <div style="height:10px;"></div> |
| 445 | 445 | </div> |
| 446 | 446 | <input type="hidden" name="remote_database_old" id="remote_database_old" value="""> |
| 447 | 447 | <input type="hidden" name="action" value="update_remote_database"/> |
| 448 | - <input type="submit" class="button button-secondary" value="<?php echo __( 'Save', 'wp-data-access' ); ?>"> | |
| 448 | + <input type="submit" class="button button-secondary" value="<?php esc_html_e( 'Save', 'wp-data-access' ); ?>"> | |
| 449 | 449 | <a href="javascript:void(0)" |
| 450 | 450 | onclick="jQuery('#wpda_update_database_popup').hide()" |
| 451 | 451 | class="button button-secondary"> |
| 452 | - <?php echo __( 'Cancel', 'wp-data-access' ); ?> | |
| 452 | + <?php esc_html_e( 'Cancel', 'wp-data-access' ); ?> | |
| 453 | 453 | </a> |
| 454 | 454 | <?php |
| 455 | 455 | $rdb_wp_nonce_action = 'wpda-update-remote-database-' . WPDA::get_current_user_login(); |
| 456 | 456 | $rdb_wp_nonce = wp_create_nonce( $rdb_wp_nonce_action ); |
| @@ -471,27 +471,27 @@ | ||
| 471 | 471 | <form id="wpda_settings_plugin" method="post" |
| 472 | 472 | action="?page=<?php echo esc_attr( $this->page ); ?>&tab=plugin"> |
| 473 | 473 | <table class="wpda-table-settings" id="wpda_table_plugin"> |
| 474 | 474 | <tr> |
| 475 | - <th><?php echo __( 'Plugin menu', 'wp-data-access' ); ?></th> | |
| 475 | + <th><?php esc_html_e( 'Plugin menu', 'wp-data-access' ); ?></th> | |
| 476 | 476 | <td> |
| 477 | 477 | <label> |
| 478 | 478 | <input type="checkbox" name="hide_admin_menu" <?php echo 'on' === $hide_admin_menu ? 'checked="checked"' : ''; ?>/> |
| 479 | - <?php echo __( 'Hide plugin menu in admin panel', 'wp-data-access' ); ?> | |
| 479 | + <?php esc_html_e( 'Hide plugin menu in admin panel', 'wp-data-access' ); ?> | |
| 480 | 480 | </label> |
| 481 | 481 | </td> |
| 482 | 482 | </tr> |
| 483 | 483 | <tr> |
| 484 | - <th><?php echo __( 'Notices', 'wp-data-access' ); ?></th> | |
| 484 | + <th><?php esc_html_e( 'Notices', 'wp-data-access' ); ?></th> | |
| 485 | 485 | <td> |
| 486 | 486 | <label> |
| 487 | 487 | <input type="checkbox" name="hide_foreign_notices" <?php echo $hide_foreign_notices === 'on' ? 'checked' : ''; ?> /> |
| 488 | - <?php echo __( 'Hide notices of other themes and plugins on WP Data Access admin pages', 'wp-data-access' ); ?> | |
| 488 | + <?php esc_html_e( 'Hide notices of other themes and plugins on WP Data Access admin pages', 'wp-data-access' ); ?> | |
| 489 | 489 | </label> |
| 490 | 490 | </td> |
| 491 | 491 | </tr> |
| 492 | 492 | <tr> |
| 493 | - <th><?php echo __( 'Panel cookies', 'wp-data-access' ); ?></th> | |
| 493 | + <th><?php esc_html_e( 'Panel cookies', 'wp-data-access' ); ?></th> | |
| 494 | 494 | <td> |
| 495 | 495 | <label> |
| 496 | 496 | <input |
| 497 | 497 | type="radio" |
| @@ -497,9 +497,9 @@ | ||
| 497 | 497 | type="radio" |
| 498 | 498 | name="panel_cookies" |
| 499 | 499 | value="clear" |
| 500 | 500 | <?php echo 'clear' === $panel_cookies ? 'checked' : ''; ?> |
| 501 | - ><?php echo __( 'Clear when switching panels', 'wp-data-access' ); ?> | |
| 501 | + ><?php esc_html_e( 'Clear when switching panels', 'wp-data-access' ); ?> | |
| 502 | 502 | </label> |
| 503 | 503 | <br/> |
| 504 | 504 | <label> |
| 505 | 505 | <input |
| @@ -506,24 +506,24 @@ | ||
| 506 | 506 | type="radio" |
| 507 | 507 | name="panel_cookies" |
| 508 | 508 | value="keep" |
| 509 | 509 | <?php echo 'keep' === $panel_cookies ? 'checked' : ''; ?> |
| 510 | - ><?php echo __( 'Keep when switching panels', 'wp-data-access' ); ?> | |
| 510 | + ><?php esc_html_e( 'Keep when switching panels', 'wp-data-access' ); ?> | |
| 511 | 511 | </label> |
| 512 | 512 | </td> |
| 513 | 513 | </tr> |
| 514 | 514 | <tr> |
| 515 | - <th><?php echo __( 'Secret key and IV' ); ?></th> | |
| 515 | + <th><?php esc_html_e( 'Secret key and IV', 'wp-data-access' ); ?></th> | |
| 516 | 516 | <td> |
| 517 | 517 | <input type="text" name="secret_key" value="<?php echo esc_attr( $secret_key ); ?>"/> |
| 518 | 518 | <br/> |
| 519 | 519 | <input type="text" name="secret_iv" value="<?php echo esc_attr( $secret_iv ); ?>"/> |
| 520 | 520 | <br/><br/> |
| 521 | - <span class="dashicons dashicons-info"></span><?php echo __( 'Existing remote database connection settings will be converted', 'wp-data-access' ); ?> | |
| 521 | + <span class="dashicons dashicons-info"></span><?php esc_html_e( 'Existing remote database connection settings will be converted', 'wp-data-access' ); ?> | |
| 522 | 522 | </td> |
| 523 | 523 | </tr> |
| 524 | 524 | <tr> |
| 525 | - <th><?php echo __( 'Remote database connections' ); ?></th> | |
| 525 | + <th><?php esc_html_e( 'Remote database connections', 'wp-data-access' ); ?></th> | |
| 526 | 526 | <td> |
| 527 | 527 | <?php |
| 528 | 528 | $i = 0; |
| 529 | 529 | foreach ( $remote_databases as $remote_database => $remote_database_settings ) { |
| @@ -533,12 +533,12 @@ | ||
| 533 | 533 | <a href="javascript:void(0)" |
| 534 | 534 | onclick="delete_remote_database('<?php echo esc_attr( $i ); ?>')" |
| 535 | 535 | style="text-decoration:none;" |
| 536 | 536 | class="wpda_tooltip" |
| 537 | - title="<?php echo __( 'Delete remote database connection from plugin repository', 'wp-data-access' ); ?>"> | |
| 537 | + title="<?php esc_html_e( 'Delete remote database connection from plugin repository', 'wp-data-access' ); ?>"> | |
| 538 | 538 | <span class="dashicons dashicons-trash" style="font-size:18px;"></span> |
| 539 | 539 | </a> |
| 540 | - <label class="wpda_tooltip" title="<?php echo __( 'Disable remote database connection', 'wp-data-access' ); ?>"> | |
| 540 | + <label class="wpda_tooltip" title="<?php esc_html_e( 'Disable remote database connection', 'wp-data-access' ); ?>"> | |
| 541 | 541 | <input type="checkbox" name="remote_database[]" id="remote_database<?php echo esc_attr( $i ); ?>" onclick="update_rdb_setting('<?php echo esc_attr( $i ); ?>')" <?php echo esc_attr( $checked ); ?>> |
| 542 | 542 | <input type="hidden" name="remote_database_name[]" id="remote_database_name<?php echo esc_attr( $i ); ?>" value="<?php echo esc_attr( $remote_database ); ?>"> |
| 543 | 543 | <input type="hidden" name="remote_database_enabled[]" id="remote_database_enabled<?php echo esc_attr( $i ); ?>" value="<?php echo esc_attr( $enabled ); ?>"> |
| 544 | 544 | <?php echo esc_attr( $remote_database ); ?> |
| @@ -546,9 +546,9 @@ | ||
| 546 | 546 | <a href="javascript:void(0)" |
| 547 | 547 | onclick="edit_rdb_setting('<?php echo esc_attr( $remote_database ); ?>')" |
| 548 | 548 | style="text-decoration:none;" |
| 549 | 549 | class="wpda_tooltip" |
| 550 | - title="<?php echo __( 'Edit remote database connection', 'wp-data-access' ); ?>"> | |
| 550 | + title="<?php esc_html_e( 'Edit remote database connection', 'wp-data-access' ); ?>"> | |
| 551 | 551 | <span class="dashicons dashicons-edit" style="font-size:18px;"></span> |
| 552 | 552 | </a><br/> |
| 553 | 553 | <?php |
| 554 | 554 | $i++; |
| @@ -556,15 +556,15 @@ | ||
| 556 | 556 | ?> |
| 557 | 557 | </td> |
| 558 | 558 | </tr> |
| 559 | 559 | <tr> |
| 560 | - <th><?php echo __( 'Debug mode', 'wp-data-access' ); ?></th> | |
| 560 | + <th><?php esc_html_e( 'Debug mode', 'wp-data-access' ); ?></th> | |
| 561 | 561 | <td> |
| 562 | 562 | <label> |
| 563 | 563 | <input |
| 564 | 564 | type="checkbox" |
| 565 | 565 | name="debug" <?php echo 'on' === $debug ? 'checked' : ''; ?> |
| 566 | - ><?php echo __( 'Enable debug mode', 'wp-data-access' ); ?> | |
| 566 | + ><?php esc_html_e( 'Enable debug mode', 'wp-data-access' ); ?> | |
| 567 | 567 | </label> |
| 568 | 568 | </td> |
| 569 | 569 | </tr> |
| 570 | 570 | </table> |
| @@ -571,18 +571,18 @@ | ||
| 571 | 571 | <div class="wpda-table-settings-button"> |
| 572 | 572 | <input type="hidden" name="action" value="save"/> |
| 573 | 573 | <button type="submit" class="button button-primary"> |
| 574 | 574 | <i class="fas fa-check wpda_icon_on_button"></i> |
| 575 | - <?php echo __( 'Save Plugin Settings', 'wp-data-access' ); ?> | |
| 575 | + <?php esc_html_e( 'Save Plugin Settings', 'wp-data-access' ); ?> | |
| 576 | 576 | </button> |
| 577 | 577 | <a href="javascript:void(0)" |
| 578 | - onclick="if (confirm('<?php echo __( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 578 | + onclick="if (confirm('<?php esc_html_e( 'Reset to defaults?', 'wp-data-access' ); ?>')) { | |
| 579 | 579 | jQuery('input[name="action"]').val('setdefaults'); |
| 580 | 580 | jQuery('#wpda_settings_plugin').trigger('submit') |
| 581 | 581 | }" |
| 582 | 582 | class="button"> |
| 583 | 583 | <i class="fas fa-times-circle wpda_icon_on_button"></i> |
| 584 | - <?php echo __( 'Reset Plugin Settings To Defaults', 'wp-data-access' ); ?> | |
| 584 | + <?php esc_html_e( 'Reset Plugin Settings To Defaults', 'wp-data-access' ); ?> | |
| 585 | 585 | </a> |
| 586 | 586 | </div> |
| 587 | 587 | <?php wp_nonce_field( 'wpda-plugin-settings-' . WPDA::get_current_user_login(), '_wpnonce', false ); ?> |
| 588 | 588 | </form> |