get_safe_view_name() !== $page ) { return; } // Tab links. $wsal_help_tabs = array( 'help' => array( 'name' => esc_html__( 'Help', 'wp-security-audit-log' ), 'link' => $this->get_url(), 'render' => array( $this, 'tab_help' ), 'priority' => 10, ), ); if ( Settings_Helper::current_user_can( 'edit' ) ) { $wsal_help_tabs['contact'] = array( 'name' => esc_html__( 'Contact Us', 'wp-security-audit-log' ), 'link' => add_query_arg( 'tab', 'contact', $this->get_url() ), 'render' => array( $this, 'tab_contact_us' ), 'priority' => 15, ); $wsal_help_tabs['system-info'] = array( 'name' => esc_html__( 'System Info', 'wp-security-audit-log' ), 'link' => add_query_arg( 'tab', 'system-info', $this->get_url() ), 'render' => array( $this, 'tab_system_info' ), 'priority' => 20, ); } /** * Filter: `wsal_help_tabs` * * Help tabs structure: * $wsal_help_tabs['unique-tab-id'] = array( * 'name' => Name of the tab, * 'link' => Link of the tab, * 'render' => This function is used to render HTML elements in the tab, * 'priority' => Priority of the tab, * ); * * @param array $wsal_help_tabs – Array of WSAL Help Tabs. */ $wsal_help_tabs = apply_filters( 'wsal_help_tabs', $wsal_help_tabs ); // Sort by priority. array_multisort( array_column( $wsal_help_tabs, 'priority' ), SORT_ASC, $wsal_help_tabs ); $this->wsal_help_tabs = $wsal_help_tabs; // Get the current tab. $current_tab = ( isset( $_GET['tab'] ) ) ? \sanitize_text_field( \wp_unslash( $_GET['tab'] ) ) : null; $this->current_tab = empty( $current_tab ) ? 'help' : $current_tab; } /** * {@inheritDoc} */ public function get_title() { return esc_html__( 'Help', 'wp-security-audit-log' ); } /** * {@inheritDoc} */ public function get_icon() { return 'dashicons-sos'; } /** * {@inheritDoc} */ public function get_name() { return esc_html__( 'Help & Contact Us', 'wp-security-audit-log' ); } /** * {@inheritDoc} */ public function get_weight() { return 9; } /** * {@inheritDoc} */ public function header() { wp_enqueue_style( 'extensions', WSAL_BASE_URL . 'css/extensions.css', array(), WSAL_VERSION ); } /** * {@inheritDoc} */ public function render() { $can_current_user_edit = Settings_Helper::current_user_can( 'edit' ); ?>

is_premium() ) : ?>

 

get_id() ) { // phpcs:ignore Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure $vars = array( 'id' => $freemius_id ); echo fs_get_template( 'contact.php', $vars ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } else { echo '

'; printf( /* translators: Link to our contact form */ esc_html__( 'Please refer to the Help tab for links and information on how to open a support ticket, or access the database. If you have any other queries, please use our %1$scontact form %2$s', 'wp-security-audit-log' ), '', '' ); echo '

'; } } /** * Tab: System info. */ public function tab_system_info() { ?>

trailingslashit( WSAL_BASE_URL ) . 'img/help/wp-2fa-img.jpg', 'desc' => esc_html__( 'Add an extra layer of security to your login pages with 2FA & require your users to use it.', 'wp-security-audit-log' ), 'alt' => 'WP 2FA', 'link' => 'https://melapress.com/wordpress-2fa/?utm_source=plugin&utm_medium=wsal&utm_campaign=about-us-wp2fa-ad', ), array( 'img' => trailingslashit( WSAL_BASE_URL ) . 'img/help/mlr.jpg', 'desc' => esc_html__( 'Create, edit, and delete and easily manage WordPress user roles like a pro', 'wp-security-audit-log' ), 'alt' => 'Mellapress Role Editor', 'link' => 'https://melapress.com/wordpress-user-roles-editor/?utm_source=plugin&utm_medium=wsal&utm_campaign=about-us-mre-ad', ), array( 'img' => trailingslashit( WSAL_BASE_URL ) . 'img/help/password-policy-manager.jpeg', 'desc' => esc_html__( 'Boost WordPress security with login & password policies.', 'wp-security-audit-log' ), 'alt' => 'WPassword', 'link' => 'https://melapress.com/wordpress-login-security/?utm_source=plugin&utm_medium=wsal&utm_campaign=about-us-mls-ad', ), ); ?>

Name . ' ' . $theme_data->Version; // phpcs:ignore $parent_theme = $theme_data->Template; // phpcs:ignore if ( ! empty( $parent_theme ) ) { $parent_theme_data = wp_get_theme( $parent_theme ); $parent_theme = $parent_theme_data->Name . ' ' . $parent_theme_data->Version; // phpcs:ignore } // Language information. $locale = get_locale(); // WordPress configuration. $sysinfo .= "\n" . '-- WordPress Configuration --' . "\n\n"; $sysinfo .= 'Version: ' . get_bloginfo( 'version' ) . "\n"; $sysinfo .= 'Language: ' . ( ! empty( $locale ) ? $locale : 'en_US' ) . "\n"; $sysinfo .= 'Permalink Structure: ' . ( get_option( 'permalink_structure' ) ? get_option( 'permalink_structure' ) : 'Default' ) . "\n"; $sysinfo .= 'Active Theme: ' . $theme . "\n"; if ( $parent_theme !== $theme ) { $sysinfo .= 'Parent Theme: ' . $parent_theme . "\n"; } $sysinfo .= 'Show On Front: ' . get_option( 'show_on_front' ) . "\n"; // Only show page specs if frontpage is set to 'page'. if ( 'page' === get_option( 'show_on_front' ) ) { $front_page_id = (int) get_option( 'page_on_front' ); $blog_page_id = (int) get_option( 'page_for_posts' ); $sysinfo .= 'Page On Front: ' . ( 0 !== $front_page_id ? get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' : 'Unset' ) . "\n"; $sysinfo .= 'Page For Posts: ' . ( 0 !== $blog_page_id ? get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' : 'Unset' ) . "\n"; } $sysinfo .= 'ABSPATH: ' . ABSPATH . "\n"; $sysinfo .= 'WP_DEBUG: ' . ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? 'Enabled' : 'Disabled' : 'Not set' ) . "\n"; $sysinfo .= 'WP Memory Limit: ' . WP_MEMORY_LIMIT . "\n"; // Get plugins that have an update. $updates = get_plugin_updates(); // Must-use plugins. // NOTE: MU plugins can't show updates! $muplugins = get_mu_plugins(); if ( count( $muplugins ) > 0 ) { $sysinfo .= "\n" . '-- Must-Use Plugins --' . "\n\n"; foreach ( $muplugins as $plugin => $plugin_data ) { $sysinfo .= $plugin_data['Name'] . ': ' . $plugin_data['Version'] . "\n"; } } // WordPress active plugins. $sysinfo .= "\n" . '-- WordPress Active Plugins --' . "\n\n"; $plugins = get_plugins(); $active_plugins = get_option( 'active_plugins', array() ); $can_use_freemius_premium_code = wsal_freemius()->can_use_premium_code(); foreach ( $plugins as $plugin_path => $plugin ) { if ( ! in_array( $plugin_path, $active_plugins ) ) { // phpcs:ignore continue; } if ( 'WP Activity Log' === $plugin['Name'] && $can_use_freemius_premium_code ) { $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $sysinfo .= $plugin['Name'] . ' Premium: ' . $plugin['Version'] . $update . "\n"; } else { $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } } // WordPress inactive plugins. $sysinfo .= "\n" . '-- WordPress Inactive Plugins --' . "\n\n"; foreach ( $plugins as $plugin_path => $plugin ) { if ( in_array( $plugin_path, $active_plugins ) ) { // phpcs:ignore continue; } $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } if ( WP_Helper::is_multisite() ) { // WordPress Multisite active plugins. $sysinfo .= "\n" . '-- Network Active Plugins --' . "\n\n"; $plugins = wp_get_active_network_plugins(); $active_plugins = get_site_option( 'active_sitewide_plugins', array() ); foreach ( $plugins as $plugin_path ) { $plugin_base = plugin_basename( $plugin_path ); if ( ! array_key_exists( $plugin_base, $active_plugins ) ) { continue; } if ( 'WP Activity Log' === $plugin['Name'] && $can_use_freemius_premium_code ) { $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $plugin = get_plugin_data( $plugin_path ); $sysinfo .= $plugin['Name'] . ' Premium: ' . $plugin['Version'] . $update . "\n"; } else { $update = ( array_key_exists( $plugin_path, $updates ) ) ? ' (needs update - ' . $updates[ $plugin_path ]->update->new_version . ')' : ''; $plugin = get_plugin_data( $plugin_path ); $sysinfo .= $plugin['Name'] . ': ' . $plugin['Version'] . $update . "\n"; } } } // Server configuration. $server_software = \sanitize_text_field( \wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ); $sysinfo .= "\n" . '-- Webserver Configuration --' . "\n\n"; $sysinfo .= 'PHP Version: ' . PHP_VERSION . "\n"; $sysinfo .= 'MySQL Version: ' . $wpdb->db_version() . "\n"; if ( isset( $server_software ) ) { $sysinfo .= 'Webserver Info: ' . $server_software . "\n"; } else { $sysinfo .= 'Webserver Info: Global $_SERVER array is not set.' . "\n"; } // PHP configs. $sysinfo .= "\n" . '-- PHP Configuration --' . "\n\n"; $sysinfo .= 'Memory Limit: ' . ini_get( 'memory_limit' ) . "\n"; $sysinfo .= 'Upload Max Size: ' . ini_get( 'upload_max_filesize' ) . "\n"; $sysinfo .= 'Post Max Size: ' . ini_get( 'post_max_size' ) . "\n"; $sysinfo .= 'Upload Max Filesize: ' . ini_get( 'upload_max_filesize' ) . "\n"; $sysinfo .= 'Time Limit: ' . ini_get( 'max_execution_time' ) . "\n"; $sysinfo .= 'Max Input Vars: ' . ini_get( 'max_input_vars' ) . "\n"; $sysinfo .= 'Display Errors: ' . ( ini_get( 'display_errors' ) ? 'On (' . ini_get( 'display_errors' ) . ')' : 'N/A' ) . "\n"; // WSAL options. $sysinfo .= "\n" . '-- WSAL Options --' . "\n\n"; $options = Plugin_Settings_Helper::get_plugin_settings(); if ( ! empty( $options ) && is_array( $options ) ) { foreach ( $options as $option ) { $sysinfo .= 'Option: ' . $option->option_name . "\n"; $sysinfo .= 'Value: ' . $option->option_value . "\n\n"; } } $sysinfo .= 'Occurrences table rows: ' . Occurrences_Entity::count() . "\n"; $sysinfo .= 'Occurrences table size: ' . Occurrences_Entity::get_table_size() . "Mb\n"; $sysinfo .= 'Meta table rows: ' . Metadata_Entity::count() . "\n"; $sysinfo .= 'Meta table size: ' . Metadata_Entity::get_table_size() . "Mb\n\n"; if ( Settings_Helper::is_archiving_enabled() ) { $connection_name = Settings_Helper::get_option_value( 'archive-connection' ); $wsal_db = Connection::get_connection( $connection_name ); if ( null !== $wsal_db && isset( $wsal_db::$error_string ) && null !== $wsal_db::$error_string ) { $sysinfo .= $wsal_db::$error_string . "\n"; } else { $sysinfo .= 'Archive Occurrences table rows: ' . Occurrences_Entity::count( '%d', array( 1 ), $wsal_db ) . "\n"; $sysinfo .= 'Archive Occurrences table size: ' . Occurrences_Entity::get_table_size( $wsal_db ) . "Mb\n"; $sysinfo .= 'Archive Meta table rows: ' . Metadata_Entity::count( '%d', array( 1 ), $wsal_db ) . "\n"; $sysinfo .= 'Archive Meta table size: ' . Metadata_Entity::get_table_size( $wsal_db ) . "Mb\n\n"; } } $sysinfo .= "\n" . '### System Info → End ###' . "\n\n"; return $sysinfo; } /** * {@inheritDoc} */ public function footer() { if ( 'system-info' === $this->current_tab && Settings_Helper::current_user_can( 'edit' ) ) : ?>