id = 'global'; $this->title = __( 'Global Settings', 'better-wp-security' ); $this->description = __( 'Configure basic settings that control how iThemes Security functions.', 'better-wp-security' ); $this->type = 'recommended'; parent::__construct(); add_filter( 'admin_body_class', array( $this, 'filter_body_classes' ) ); } public function filter_body_classes( $classes ) { if ( ITSEC_Modules::get_setting( 'global', 'show_error_codes' ) ) { $classes .= ' itsec-show-error-codes'; } if ( ITSEC_Modules::get_setting( 'global', 'write_files' ) ) { $classes .= ' itsec-write-files-enabled'; } else { $classes .= ' itsec-write-files-disabled'; } $classes = trim( $classes ); return $classes; } public function enqueue_scripts_and_styles() { $vars = array( 'ip' => ITSEC_Lib::get_ip(), 'log_location' => ITSEC_Modules::get_default( $this->id, 'log_location' ), ); wp_enqueue_script( 'itsec-global-settings-page-script', plugins_url( 'js/settings-page.js', __FILE__ ), array( 'jquery', 'itsec-settings-page-script' ), $this->version, true ); wp_localize_script( 'itsec-global-settings-page-script', 'itsec_global_settings_page', $vars ); } public function handle_form_post( $data ) { $retval = ITSEC_Modules::set_settings( $this->id, $data ); if ( $retval['saved'] ) { if ( $retval['old_settings']['show_error_codes'] !== $retval['new_settings']['show_error_codes'] ) { ITSEC_Response::add_js_function_call( 'itsec_change_show_error_codes', array( (bool) $retval['new_settings']['show_error_codes'] ) ); } if ( $retval['old_settings']['write_files'] !== $retval['new_settings']['write_files'] ) { ITSEC_Response::add_js_function_call( 'itsec_change_write_files', array( (bool) $retval['new_settings']['write_files'] ) ); } } } protected function render_description( $form ) { ?>

id ); $log_types = $validator->get_valid_log_types(); $show_error_codes_options = array( false => __( 'No (default)' ), true => __( 'Yes' ), ); $enable_grade_report_options = array( false => __( 'No (default)' ), true => __( 'Yes' ), ); $proxy = array( 'value' => $validator->get_proxy_types() ); if ( $proxy_header = ITSEC_Modules::get_setting( 'security-check-pro', 'remote_ip_index' ) ) { $proxy['disabled'] = true; } $possible_headers = apply_filters( 'itsec_filter_remote_addr_headers', array( 'HTTP_CF_CONNECTING_IP', // CloudFlare 'HTTP_X_FORWARDED_FOR', // Squid and most other forward and reverse proxies 'REMOTE_ADDR', // Default source of remote IP ) ); $ucwords = version_compare( phpversion(), '5.5.16', '>=' ) || ( version_compare( phpversion(), '5.4.32', '>=' ) && version_compare( phpversion(), '5.5.0', '<' ) ); $proxy_header_opt = array(); foreach ( $possible_headers as $header ) { $label = $header; if ( 0 === strpos( $header, 'HTTP_' ) ) { $label = substr( $label, 5 ); } $label = str_replace( '_', '-', $label ); $label = strtolower( $label ); $label = $ucwords ? ucwords( $label, '-' ) : implode( '-', array_map( 'ucfirst', explode( '-', $label ) ) ); if ( isset( $_SERVER[ $header ] ) ) { $label .= ' (' . esc_attr( $_SERVER[ $header ] ) . ')'; } $label = str_replace('Ip', 'IP', $label ); $proxy_header_opt[ $header ] = $label; } ?>
add_checkbox( 'write_files' ); ?>

add_textarea( 'lockout_message', array( 'class' => 'widefat' ) ); ?>

add_textarea( 'user_lockout_message', array( 'class' => 'widefat' ) ); ?>

add_textarea( 'community_lockout_message', array( 'class' => 'widefat' ) ); ?>

add_checkbox( 'blacklist' ); ?>

add_text( 'blacklist_count', array( 'class' => 'small-text' ) ); ?>

add_text( 'blacklist_period', array( 'class' => 'small-text' ) ); ?>

add_text( 'lockout_period', array( 'class' => 'small-text' ) ); ?>

add_textarea( 'lockout_white_list' ); ?>

add_button( 'add-to-whitelist', array( 'value' => __( 'Add my current IP to the White List', 'better-wp-security' ), 'class' => 'button-primary' ) ); ?>

add_select( 'log_type', $log_types ); ?>

add_text( 'log_rotation', array( 'class' => 'small-text' ) ); ?>

add_text( 'file_log_rotation', array( 'class' => 'small-text' ) ); ?>

add_text( 'log_location', array( 'class' => 'large-text code' ) ); ?>

add_button( 'reset-log-location', array( 'value' => __( 'Restore Default Log File Path', 'better-wp-security' ), 'class' => 'button-secondary' ) ); ?>

add_checkbox( 'infinitewp_compatibility' ); ?>

InfiniteWP. Do not turn it on unless you use the InfiniteWP service.', 'better-wp-security' ), 'http://infinitewp.com' ); ?>

add_checkbox( 'allow_tracking' ); ?>
add_text( 'nginx_file', array( 'class' => 'large-text code' ) ); ?>

' . esc_attr( $proxy_header ) . '' ); ?>

add_select( 'proxy', $proxy ); ?>

', '' ); ?>

add_select( 'proxy_header', $proxy_header_opt ); ?>

', '' ); ?>

add_checkbox( 'hide_admin_bar' ); ?>
add_select( 'show_error_codes', $show_error_codes_options ); ?>

add_select( 'enable_grade_report', $enable_grade_report_options ); ?>