404 ) ); } public static function copy_protection() { if ( is_user_logged_in() ) { return; } wp_register_style( 'svabg-copy', false, array(), SOFTVOLT_AI_BODYGUARD_VERSION ); wp_enqueue_style( 'svabg-copy' ); wp_add_inline_style( 'svabg-copy', 'body{-webkit-user-select:none;user-select:none}input,textarea,[contenteditable]{-webkit-user-select:text;user-select:text}' ); wp_register_script( 'svabg-copy', false, array(), SOFTVOLT_AI_BODYGUARD_VERSION, true ); wp_enqueue_script( 'svabg-copy' ); wp_add_inline_script( 'svabg-copy', "(function(){function f(e){var t=e.target;if(t&&t.closest&&t.closest('input,textarea,[contenteditable]')){return;}e.preventDefault();}['contextmenu','copy','cut','dragstart','selectstart'].forEach(function(n){document.addEventListener(n,f);});})();" ); } /** * Visitors get a short "back soon" page with 503 and Retry-After; administrators and editors see the site. */ public static function maintenance() { if ( current_user_can( 'edit_posts' ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || wp_doing_ajax() || wp_doing_cron() ) { return; } // One maintenance page: the one designed in Tools › Maintenance, with its own exceptions. if ( class_exists( 'Softvolt_Ai_Bodyguard_Maintenance' ) ) { if ( is_robots() || is_favicon() || Softvolt_Ai_Bodyguard_Maintenance::lets_through() ) { return; } Softvolt_Ai_Bodyguard_Maintenance::render( array_merge( Softvolt_Ai_Bodyguard_Maintenance::get(), array( 'mode' => 'maintenance' ) ) ); exit; } status_header( 503 ); nocache_headers(); header( 'Retry-After: 3600' ); header( 'Content-Type: text/html; charset=utf-8' ); $site = esc_html( wp_specialchars_decode( (string) get_option( 'blogname' ), ENT_QUOTES ) ); echo '' . $site . '' . Softvolt_Ai_Bodyguard_Helpers::page_style( 'svabg-maintenance-page', 'body{margin:0;font:17px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;background:#f4f6f2;color:#151a14;display:flex;min-height:100vh;align-items:center;justify-content:center;text-align:center}.box{max-width:520px;margin:24px;padding:40px 32px;background:#fff;border:1px solid #e1e4dd;border-radius:16px}h1{margin:0 0 10px;font-size:26px}p{margin:0;color:#5f675d}' ) . '

' . esc_html__( 'We will be back soon', 'ai-guardwall' ) . '

' . esc_html__( 'The site is being updated. Please check back in a little while.', 'ai-guardwall' ) . '

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- escaped above. exit; } public static function maintenance_bar( $bar ) { if ( ! current_user_can( 'manage_options' ) ) { return; } $bar->add_node( array( 'id' => 'svabg-maintenance', 'title' => '● ' . esc_html__( 'Maintenance mode is on', 'ai-guardwall' ), 'href' => Softvolt_Ai_Bodyguard_Admin::url( 'security', 'hardening' ) . '#hardening:maintenance_mode', ) ); } }