文件操作 - SettingsWPScan.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/ionos-security/inc/Controllers/Settings/SettingsWPScan.php
编辑文件内容
<?php namespace Ionos\Security\Controllers\Settings; use Exception; use Ionos\Security\Controllers\WPScan; use Ionos\SettingsPage\Elements\CheckboxField; use Ionos\SettingsPage\Elements\SectionHeader; use Ionos\SettingsPage\SettingsBuilder; /** * Class for handling the xmlrpc-guard tab.f */ class SettingsWPScan { /** * Name of the tab that is used in the settings builder. * * @var string */ const TAB_NAME = 'wpscan'; /** * Name of the menu slug that is used in WordPress. * * @var string */ const MENU_SLUG = 'ionos_security'; /** * SettingsBuilder instance for the wpscan tab. * * @var SettingsBuilder $settings_builder */ private $settings_builder; /** * Creates an object of the SettingsBuilder class and stores it as class property. */ public function __construct() { $this->settings_builder = new SettingsBuilder( 'ionos-security', __( 'Security', 'ionos-security' ), self::MENU_SLUG ); } /** * Merges the feature-specific settings builder with that of the main plugin one. * * @since 1.0.0 */ private function merge_with_base() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound apply_filters( self::MENU_SLUG . '_merge_settings_page', $this->settings_builder ); add_filter( 'ionos-security_options_array_sanitize_callback', [ $this, 'validate_options' ], 10, 2 ); } /** * Validates the options. * * @since 1.0.0 * * @param array $data Array of raw form values. * @param string $tab The current tab. * * @return array Array of validated values. */ public function validate_options( $data, $tab ) { if ( $tab !== self::TAB_NAME && $tab !== '' ) { return array_merge( WPScan::get_feature_options(), $data ); } if ( empty( $data ) || ! is_array( $data ) ) { // force 0, don't throw out of array. otherwise option migration in init_options() overwrites this. return [ 'wpscan_mail_notification' => 0 ]; } $data['wpscan_mail_notification'] = empty( $data['wpscan_mail_notification'] ) ? 0 : 1; return $data; } /** * Registers the assets and tabs for the settings builder and adds the elements to the settings view. * * @since 1.0.0 * * @param object $wpscan The WPScan Controller object. * @return void * @throws Exception If something goes wrong while adding elements. */ public function init( $wpscan ) { $this->settings_builder->register_assets(); $this->settings_builder->add_tab( self::TAB_NAME, __( 'Vulnerability Scan', 'ionos-security' ) ); $args['summary'] = $wpscan->get_summary(); ob_start(); load_template( IONOS_SECURITY_DIR . '/inc/Views/WPScan/tab/tab.php', true, $args ); $summary = ob_get_clean(); $this->settings_builder->add_element( self::TAB_NAME, new SectionHeader( [ 'heading' => __( 'Vulnerability Scan', 'ionos-security' ), 'description' => $summary, 'kses_for_description' => [ 'strong' => [], 'p' => [], 'br' => [], 'ul' => [], 'li' => [], 'h3' => [], 'h4' => [], 'div' => [ 'class' => [], 'id' => [], ], 'button' => [ 'class' => [], ], 'a' => [ 'href' => [], 'target' => [], 'class' => [], 'id' => [], 'rel' => [], ], ], ] ) ); $this->settings_builder->add_field( self::TAB_NAME, new CheckboxField( 'ionos-security[wpscan_mail_notification]', [ 'label' => __( 'Notify me about negative scan results', 'ionos-security' ), 'description' => sprintf( // translators: %number$s is a placeholder for email-address and html-tags. __( 'Notification will be sent to: %1$s <br />You can %2$s change the email address%3$s in settings.', 'ionos-security' ), get_option( 'admin_email' ), '<a href="' . admin_url( 'options-general.php#new_admin_email' ) . '" title="' . __( 'Change email address', 'ionos-security' ) . '" target="_blank">', '</a>' ), 'kses_for_description' => [ 'br' => [], 'a' => [ 'href' => [], 'target' => [], 'title' => [], ], ], ] ) ); $this->merge_with_base(); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件