|
539 | 539 | <?php } ?>
|
540 | 540 | <tr valign="top">
|
541 | 541 | <td>
|
542 |
| - <input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $nginx_helper_settings['enable_log'], 1 ); ?> /> |
| 542 | + <?php |
| 543 | + $is_checkbox_enabled = false; |
| 544 | + if ( 1 === (int) $nginx_helper_settings['enable_log'] ) { |
| 545 | + $is_checkbox_enabled = true; |
| 546 | + } |
| 547 | + ?> |
| 548 | + <input |
| 549 | + type="checkbox" value="1" id="enable_log" name="enable_log" |
| 550 | + <?php checked( $nginx_helper_admin->is_nginx_log_enabled(), true ); ?> |
| 551 | + <?php echo esc_attr( $is_checkbox_enabled ? '' : ' disabled ' ); ?> |
| 552 | + /> |
543 | 553 | <label for="enable_log">
|
544 | 554 | <?php esc_html_e( 'Enable Logging', 'nginx-helper' ); ?>
|
| 555 | + <?php |
| 556 | + if ( ! $is_checkbox_enabled ) { |
| 557 | + |
| 558 | + $setting_message_detail = [ |
| 559 | + 'status' => __( 'disable', 'nginx-helper' ), |
| 560 | + 'value' => 'false', |
| 561 | + ]; |
| 562 | + |
| 563 | + if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) { |
| 564 | + $setting_message_detail = [ |
| 565 | + 'status' => __( 'enable', 'nginx-helper' ), |
| 566 | + 'value' => 'true', |
| 567 | + ]; |
| 568 | + } |
| 569 | + |
| 570 | + printf( |
| 571 | + '<p class="enable-logging-message">(<b>%1$s:</b> %2$s %3$s %4$s <b>NGINX_HELPER_LOG</b> constant %5$s <b>%6$s</b> %7$s <b>wp-config.php</b>)</p>', |
| 572 | + esc_html__( 'NOTE', 'nginx-helper' ), |
| 573 | + esc_html__( 'To', 'nginx-helper' ), |
| 574 | + esc_html( $setting_message_detail['status'] ), |
| 575 | + esc_html__( 'the logging feature, you must define', 'nginx-helper' ), |
| 576 | + esc_html__( 'as', 'nginx-helper' ), |
| 577 | + esc_html( $setting_message_detail['value'] ), |
| 578 | + esc_html__( 'in your', 'nginx-helper' ) |
| 579 | + ); |
| 580 | + } |
| 581 | + ?> |
545 | 582 | </label>
|
546 | 583 | </td>
|
547 | 584 | </tr>
|
|
626 | 663 | <?php
|
627 | 664 | }
|
628 | 665 | ?>
|
629 |
| - <div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>> |
| 666 | + <div class="postbox enable_log"<?php echo ( ! $nginx_helper_admin->is_nginx_log_enabled() ) ? ' style="display: none;"' : ''; ?>> |
630 | 667 | <h3 class="hndle">
|
631 | 668 | <span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
|
632 | 669 | </h3>
|
|
0 commit comments