文件操作 - SSLCheck.php
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/ionos-security/inc/Controllers/SSLCheck.php
编辑文件内容
<?php namespace Ionos\Security\Controllers; use Ionos\Librarysecurity\Config; use Ionos\Security\Controllers\Settings\SettingsSSL; use Ionos\Security\Helper; /** * Plugin Settings */ class SSLCheck { /** * Handle for the scripts and styles. */ const HANDLE = 'ionos-ssl-check'; /** * Initiates the plugin and language files. * * @since 1.0.0 */ public static function load() { // Check if the feature is enabled in the s3 config. if ( Config::get( 'features.sslCheck.enabled' ) !== '1' ) { return; } add_action( 'admin_init', [ __CLASS__, 'init_settings_builder' ], 220 ); if ( ! get_transient( 'ionos-ssl-check-notice-dismissed' ) ) { add_action( 'admin_notices', [ __CLASS__, 'admin_notice' ] ); add_action( 'admin_enqueue_scripts', [ __CLASS__, 'enqueue_script' ] ); add_action( 'wp_ajax_ionos-ssl-check-dismiss-notice', [ __CLASS__, 'dismiss_notice' ] ); } } /** * Load the settings builder scripts. */ public static function init_settings_builder() { new SettingsSSL(); } /** * Enqueues the script for the admin notice. * * @since 1.0.0 */ public static function enqueue_script() { $assets = include_once IONOS_SECURITY_DIR . '/build/ssl-check.asset.php'; wp_enqueue_script( self::HANDLE, plugins_url( 'build/ssl-check.js', IONOS_SECURITY_FILE ), $assets['dependencies'], $assets['version'], true ); $vars = [ 'ajax_url' => admin_url( 'admin-ajax.php' ), ]; wp_localize_script( self::HANDLE, 'ionosSSLCheck', $vars ); } /** * Adds an admin notice. * * @since 1.0.0 */ public static function admin_notice() { if ( is_ssl() ) { return; } $notice = __( 'Your WordPress website is currently <strong>without SSL</strong>, which means that the connection between your website and users\' browsers is not encrypted. It is highly <strong>recommended to activate SSL</strong> to protect sensitive information and to provide a secure browsing.', 'ionos-security' ); $button = sprintf( '<a href="%s" class="button" target="_blank">%s</a>', esc_url( __( 'https://ionos.com/help', 'ionos-security' ) ), esc_html__( 'Learn more about SSL and how to activate it.', 'ionos-security' ) ); printf( '<div class="ionos-ssl-check notice notice-warning is-dismissible"><p>%s<br>%s</p></div>', wp_kses( $notice, [ 'strong' => [], 'em' => [], ] ), $button // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } /** * Dismisses the admin notice. * * @since 1.0.0 */ public static function dismiss_notice() { set_transient( 'ionos-ssl-check-notice-dismissed', true, 0 ); } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件