Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
@@ -53,7 +53,7 @@ class Nginx_Helper_Admin {
|
||||
*
|
||||
* @since 2.0.0
|
||||
* @access public
|
||||
* @var string $options Purge options.
|
||||
* @var string[] $options Purge options.
|
||||
*/
|
||||
public $options;
|
||||
|
||||
@@ -345,6 +345,27 @@ class Nginx_Helper_Admin {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the nginx log is enabled.
|
||||
*
|
||||
* @since 2.2.4
|
||||
* @return boolean
|
||||
*/
|
||||
public function is_nginx_log_enabled() {
|
||||
|
||||
$options = get_site_option( 'rt_wp_nginx_helper_options', array() );
|
||||
|
||||
if ( ! empty( $options['enable_log'] ) && 1 === (int) $options['enable_log'] ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( defined( 'NGINX_HELPER_LOG' ) && true === NGINX_HELPER_LOG ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the asset path.
|
||||
*
|
||||
@@ -732,10 +753,10 @@ class Nginx_Helper_Admin {
|
||||
}
|
||||
|
||||
if ( 'purge' === $action ) {
|
||||
|
||||
|
||||
/**
|
||||
* Fire an action after the entire cache has been purged whatever caching type is used.
|
||||
*
|
||||
*
|
||||
* @since 2.2.2
|
||||
*/
|
||||
do_action( 'rt_nginx_helper_after_purge_all' );
|
||||
|
||||
@@ -529,7 +529,7 @@ abstract class Purger {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
if ( ! $nginx_helper_admin->options['enable_log'] ) {
|
||||
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ abstract class Purger {
|
||||
|
||||
global $nginx_helper_admin;
|
||||
|
||||
if ( ! $nginx_helper_admin->options['enable_log'] ) {
|
||||
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,3 +98,8 @@ form#purgeall .button-primary:focus {
|
||||
}
|
||||
|
||||
.rt-purge_url { width: 100%; }
|
||||
|
||||
.enable-logging-message {
|
||||
font-size: 13px;
|
||||
margin-left: 23px;
|
||||
}
|
||||
|
||||
@@ -539,9 +539,46 @@ if ( is_multisite() ) {
|
||||
<?php } ?>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<input type="checkbox" value="1" id="enable_log" name="enable_log"<?php checked( $nginx_helper_settings['enable_log'], 1 ); ?> />
|
||||
<?php
|
||||
$is_checkbox_enabled = false;
|
||||
if ( 1 === (int) $nginx_helper_settings['enable_log'] ) {
|
||||
$is_checkbox_enabled = true;
|
||||
}
|
||||
?>
|
||||
<input
|
||||
type="checkbox" value="1" id="enable_log" name="enable_log"
|
||||
<?php checked( $nginx_helper_admin->is_nginx_log_enabled(), true ); ?>
|
||||
<?php echo esc_attr( $is_checkbox_enabled ? '' : ' disabled ' ); ?>
|
||||
/>
|
||||
<label for="enable_log">
|
||||
<?php esc_html_e( 'Enable Logging', 'nginx-helper' ); ?>
|
||||
<?php
|
||||
if ( ! $is_checkbox_enabled ) {
|
||||
|
||||
$setting_message_detail = [
|
||||
'status' => __( 'disable', 'nginx-helper' ),
|
||||
'value' => 'false',
|
||||
];
|
||||
|
||||
if ( ! $nginx_helper_admin->is_nginx_log_enabled() ) {
|
||||
$setting_message_detail = [
|
||||
'status' => __( 'enable', 'nginx-helper' ),
|
||||
'value' => 'true',
|
||||
];
|
||||
}
|
||||
|
||||
printf(
|
||||
'<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>',
|
||||
esc_html__( 'NOTE', 'nginx-helper' ),
|
||||
esc_html__( 'To', 'nginx-helper' ),
|
||||
esc_html( $setting_message_detail['status'] ),
|
||||
esc_html__( 'the logging feature, you must define', 'nginx-helper' ),
|
||||
esc_html__( 'as', 'nginx-helper' ),
|
||||
esc_html( $setting_message_detail['value'] ),
|
||||
esc_html__( 'in your', 'nginx-helper' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -626,7 +663,7 @@ if ( is_multisite() ) {
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<div class="postbox enable_log"<?php echo ( empty( $nginx_helper_settings['enable_log'] ) ) ? ' style="display: none;"' : ''; ?>>
|
||||
<div class="postbox enable_log"<?php echo ( ! $nginx_helper_admin->is_nginx_log_enabled() ) ? ' style="display: none;"' : ''; ?>>
|
||||
<h3 class="hndle">
|
||||
<span><?php esc_html_e( 'Logging Options', 'nginx-helper' ); ?></span>
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user