private function show_settings_page() { $form = new ITSEC_Form(); $module_filters = array('all' => array(_x('All', 'List all modules', 'better-wp-security'), 0), 'recommended' => array(_x('Recommended', 'List recommended modules', 'better-wp-security'), 0), 'advanced' => array(_x('Advanced', 'List advanced modules', 'better-wp-security'), 0)); $current_type = isset($_REQUEST['module_type']) ? $_REQUEST['module_type'] : 'recommended'; $visible_modules = array(); foreach ($this->modules as $id => $module) { $module_filters['all'][1]++; if ('all' === $current_type) { $visible_modules[] = $id; } if (isset($module_filters[$module->type])) { $module_filters[$module->type][1]++; if ($module->type === $current_type) { $visible_modules[] = $id; } } $module->enabled = ITSEC_Modules::is_active($id); $module->always_active = ITSEC_Modules::is_always_active($id); } $feature_tabs = array(); foreach ($module_filters as $type => $data) { if ($current_type === $type) { $class = 'current'; } else { $class = ''; } $feature_tabs[] = "<li class='itsec-module-filter' id='itsec-module-filter-{$type}'><a href='" . esc_url(add_query_arg('module_type', $type, $this->self_url)) . "' class='{$class}'>{$data[0]} <span class='count'>({$data[1]})</span></a>"; } $whitelisted_ips = ITSEC_Lib::get_whitelisted_ips(); $blacklisted_ips = ITSEC_Lib::get_blacklisted_ips(); // Get user's view preference $view = get_user_meta(get_current_user_id(), 'itsec-settings-view', true); // Default to grid view for users that have an invalid or unspecified view if (!in_array($view, array('grid', 'list'))) { $view = 'grid'; } ?> <div class="wrap"> <h1> <?php _e('iThemes Security', 'better-wp-security'); ?> <a href="<?php echo esc_url(ITSEC_Core::get_logs_page_url()); ?> " class="page-title-action"><?php _e('View Logs', 'better-wp-security'); ?> </a> <a href="<?php echo esc_url(apply_filters('itsec_support_url', 'https://wordpress.org/support/plugin/better-wp-security')); ?> " target="_blank" class="page-title-action"><?php _e('Support', 'better-wp-security'); ?> </a> </h1> <div id="itsec-settings-messages-container"> <?php foreach (ITSEC_Response::get_errors() as $error) { ITSEC_Lib::show_error_message($error); } foreach (ITSEC_Response::get_messages() as $message) { ITSEC_Lib::show_status_message($message); } ?> </div> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2 hide-if-no-js"> <div id="postbox-container-2" class="postbox-container"> <div class="itsec-module-section-heading"> <div class="itsec-settings-view-toggle hide-if-no-js" data-nonce="<?php echo esc_attr(wp_create_nonce('set-user-setting-itsec-settings-view')); ?> "> <a class="itsec-grid<?php if ('grid' === $view) { echo ' itsec-selected'; } ?> "><span class="dashicons dashicons-grid-view"></span></a> <a class="itsec-list<?php if ('list' === $view) { echo ' itsec-selected'; } ?> "><span class="dashicons dashicons-list-view"></span></a> </div> <ul class="subsubsub itsec-feature-tabs hide-if-no-js"> <?php echo implode($feature_tabs, " |</li>\n") . "</li>\n"; ?> </ul> </div> <div class="itsec-module-cards-container <?php echo $view; ?> hide-if-js"> <?php $form->start_form('itsec-module-settings-form'); ?> <?php $form->add_nonce('itsec-settings-page'); ?> <ul class="itsec-module-cards"> <?php foreach ($this->modules as $id => $module) { ?> <?php if (!in_array($id, $visible_modules)) { // continue; } $classes = array('itsec-module-type-' . $module->type, 'itsec-module-type-' . ($module->enabled ? 'enabled' : 'disabled')); if ($module->upsell) { $classes[] = 'itsec-module-pro-upsell'; } if ($module->pro) { $classes[] = 'itsec-module-type-pro'; } ?> <li id="itsec-module-card-<?php echo $id; ?> " class="itsec-module-card <?php echo implode(' ', $classes); ?> " data-module-id="<?php echo $id; ?> "> <div class="itsec-module-card-content"> <?php if ($module->upsell) { ?> <a href="<?php echo esc_url($module->upsell_url); ?> " target="_blank" class="itsec-pro-upsell"> </a> <?php } ?> <h2><?php echo esc_html($module->title); ?> </h2> <?php if ($module->pro) { ?> <div class="itsec-pro-label"><?php _e('Pro', 'better-wp-security'); ?> </div> <?php } ?> <p class="module-description"><?php echo $module->description; ?> </p> <?php if (!$module->upsell) { ?> <div class="module-actions hide-if-no-js"> <?php if ($module->information_only) { ?> <button class="button button-secondary itsec-toggle-settings information-only"><?php echo $this->translations['show_information']; ?> </button> <?php } elseif ($module->enabled || $module->always_active) { ?> <button class="button button-secondary itsec-toggle-settings"><?php echo $this->translations['show_settings']; ?> </button> <?php if (!$module->always_active) { ?> <button class="button button-secondary itsec-toggle-activation"><?php echo $this->translations['deactivate']; ?> </button> <?php } ?> <?php } else { ?> <button class="button button-secondary itsec-toggle-settings"><?php echo $this->translations['show_description']; ?> </button> <button class="button button-primary itsec-toggle-activation"><?php echo $this->translations['activate']; ?> </button> <?php } ?> </div> <?php } ?> </div> <?php if (!$module->upsell) { ?> <div class="itsec-module-settings-container"> <div class="itsec-modal-navigation"> <button class="dashicons itsec-close-modal"></button> <button class="itsec-right dashicons hidden"><span class="screen-reader-text"><?php _e('Configure next iThemes Security setting', 'better-wp-security'); ?> </span></button> <button class="itsec-left dashicons hidden"><span class="screen-reader-text"><?php _e('Configure previous iThemes Security setting', 'better-wp-security'); ?> </span></button> </div> <div class="itsec-module-settings-content-container"> <div class="itsec-module-settings-content"> <h3 class="itsec-modal-header"><?php echo esc_html($module->title); ?> </h3> <div class="itsec-module-messages-container"></div> <div class="itsec-module-settings-content-main"> <?php $this->get_module_settings($id, $form, true); ?> </div> </div> </div> <div class="itsec-list-content-footer hide-if-no-js"> <?php if ($module->can_save) { ?> <button class="button button-primary align-left itsec-module-settings-save"><?php echo $this->translations['save_settings']; ?> </button> <?php } ?> <button class="button button-secondary align-left itsec-module-settings-cancel"><?php _e('Cancel', 'better-wp-security'); ?> </button> </div> <div class="itsec-modal-content-footer"> <?php if ($module->enabled || $module->always_active || $module->information_only) { ?> <?php if (!$module->always_active && !$module->information_only) { ?> <button class="button button-secondary align-right itsec-toggle-activation"><?php echo $this->translations['deactivate']; ?> </button> <?php } ?> <?php } else { ?> <button class="button button-primary align-right itsec-toggle-activation"><?php echo $this->translations['activate']; ?> </button> <?php } ?> <?php if ($module->can_save) { ?> <button class="button button-primary align-left itsec-module-settings-save"><?php echo $this->translations['save_settings']; ?> </button> <?php } else { ?> <button class="button button-primary align-left itsec-close-modal"><?php echo $this->translations['close_settings']; ?> </button> <?php } ?> </div> </div> <?php } ?> </li> <?php } ?> <li class="itsec-module-card-filler"></li> </ul> <?php $form->end_form(); ?> </div> </div> <div class="itsec-modal-background"></div> <div id="postbox-container-1" class="postbox-container"> <?php foreach ($this->widgets as $id => $widget) { ?> <?php if ($widget->settings_form) { ?> <?php $form->start_form("itsec-sidebar-widget-form-{$id}"); ?> <?php $form->add_nonce('itsec-settings-page'); ?> <?php $form->add_hidden('widget-id', $id); ?> <?php } ?> <div id="itsec-sidebar-widget-<?php echo $id; ?> " class="postbox itsec-sidebar-widget"> <h3 class="hndle ui-sortable-handle"><span><?php echo esc_html($widget->title); ?> </span></h3> <div class="inside"> <?php $this->get_widget_settings($id, $form, true); ?> </div> </div> <?php if ($widget->settings_form) { $form->end_form(); } ?> <?php } ?> </div> </div> <div class="hide-if-js"> <p class="itsec-warning-message"><?php _e('iThemes Security requires Javascript in order for the settings to be modified. Please enable Javascript to configure the settings.', 'better-wp-security'); ?> </p> </div> </div> </div> <?php }
private function show_settings_page() { require_once ITSEC_Core::get_core_dir() . '/lib/class-itsec-wp-list-table.php'; if (isset($_GET['filter'])) { $filter = $_GET['filter']; } else { $filter = 'all'; } $form = new ITSEC_Form(); $filters = array('all' => __('All Log Data', 'better-wp-security')); foreach ($this->logger_displays as $log_provider) { $filters[$log_provider['module']] = $log_provider['title']; } $form->set_option('filter', $filter); ?> <div class="wrap"> <h1> <?php _e('iThemes Security', 'better-wp-security'); ?> <a href="<?php echo esc_url(ITSEC_Core::get_settings_page_url()); ?> " class="page-title-action"><?php _e('Manage Settings', 'better-wp-security'); ?> </a> <a href="<?php echo esc_url(apply_filters('itsec_support_url', 'https://wordpress.org/support/plugin/better-wp-security')); ?> " class="page-title-action"><?php _e('Support', 'better-wp-security'); ?> </a> </h1> <div id="itsec-settings-messages-container"> <?php foreach (ITSEC_Response::get_errors() as $error) { ITSEC_Lib::show_error_message($error); } foreach (ITSEC_Response::get_messages() as $message) { ITSEC_Lib::show_status_message($message); } ?> </div> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2 hide-if-no-js"> <div id="postbox-container-2" class="postbox-container"> <?php if ('file' === ITSEC_Modules::get_setting('global', 'log_type')) { ?> <p><?php _e('To view logs within the plugin you must enable database logging in the Global Settings. File logging is not available for access within the plugin itself.', 'better-wp-security'); ?> </p> <?php } else { ?> <div class="itsec-module-cards-container list"> <p><?php _e('Below are various logs of information collected by iThemes Security Pro. This information can help you get a picture of what is happening with your site and the level of success you have achieved in your security efforts.', 'better-wp-security'); ?> </p> <p><?php _e('Logging settings can be managed in the Global Settings.', 'better-wp-security'); ?> </p> <?php $form->start_form('itsec-module-settings-form'); ?> <?php $form->add_nonce('itsec-settings-page'); ?> <p><?php $form->add_select('filter', $filters); ?> </p> <?php $form->end_form(); ?> <?php $this->show_filtered_logs($filter); ?> </div> <?php } ?> </div> <div class="itsec-modal-background"></div> <div id="postbox-container-1" class="postbox-container"> <?php foreach ($this->widgets as $id => $widget) { ?> <?php $form->start_form("itsec-sidebar-widget-form-{$id}"); ?> <?php $form->add_nonce('itsec-logs-page'); ?> <?php $form->add_hidden('widget-id', $id); ?> <div id="itsec-sidebar-widget-<?php echo $id; ?> " class="postbox itsec-sidebar-widget"> <h3 class="hndle ui-sortable-handle"><span><?php echo esc_html($widget->title); ?> </span></h3> <div class="inside"> <?php $this->get_widget_settings($id, $form, true); ?> </div> </div> <?php $form->end_form(); ?> <?php } ?> </div> </div> <div class="hide-if-js"> <p class="itsec-warning-message"><?php _e('iThemes Security requires Javascript in order for the settings to be modified. Please enable Javascript to configure the settings.', 'better-wp-security'); ?> </p> </div> </div> </div> <?php }