Plugin Directory

Changeset 3259470


Ignore:
Timestamp:
03/20/2025 11:10:30 PM (13 months ago)
Author:
bitspecter
Message:

Delete unnecessary functions

Location:
bitspecter-suite/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bitspecter-suite/trunk/bitspecter-suite.php

    r3229325 r3259470  
    33Plugin Name: Bitspecter Suite
    44Description: Kompletní sada nástrojů pro branding, optimalizaci a zabezpečení WordPress webů.
    5 Version: 1.0.0
     5Version: 1.1.0
    66Author: BitSpecter
    77Author URI: https://www.bitspecter.com
     
    1010*/
    1111
    12 if ( ! defined( 'ABSPATH' ) ) exit;
     12if (! defined('ABSPATH'))
     13    exit;
    1314
    1415define('BITSPECTER_SUITE_URL', plugin_dir_url(__FILE__));
    1516
    16 require_once __DIR__ . '/includes/autoload.php';
     17require_once __DIR__.'/includes/Branding/BitspecterSuiteBranding.php';
     18require_once __DIR__.'/includes/Hardening/BitspecterSuiteHardening.php';
     19require_once __DIR__.'/includes/Optimization/BitspecterSuiteOptimization.php';
    1720
    1821use Bitspecter\Suite\Branding\BitspecterSuiteBranding;
  • bitspecter-suite/trunk/includes/Branding/BitspecterSuiteBranding.php

    r3259459 r3259470  
    4545    public function removeAdminBarLogo($wp_admin_bar): void
    4646    {
    47         if (is_a($wp_admin_bar, 'WP_Admin_Bar')) {
     47        if ($wp_admin_bar->get_node('wp-logo')) {
    4848            $wp_admin_bar->remove_node('wp-logo');
    4949        }
  • bitspecter-suite/trunk/includes/Hardening/BitspecterSuiteHardening.php

    r3259459 r3259470  
    2525        add_action('init', [$this, 'removeUnnecessaryWpHeadItems']);
    2626        add_action('init', [$this, 'disableFileEditor']);
    27         add_action('init', [$this, 'blockXmlRpcRequests']);
    28         add_action('init', [$this, 'enforceHttps']);
    2927        add_action('init', [$this, 'blockAuthorScan']);
    3028
     
    9694    public function addSecurityHeaders(): void
    9795    {
    98         $headers = [
    99             'Strict-Transport-Security' => 'max-age=31536000; includeSubDomains; preload',
    100             'X-Content-Type-Options' => 'nosniff',
    101             'X-Frame-Options' => 'SAMEORIGIN',
    102             'X-XSS-Protection' => '1; mode=block',
    103             'Referrer-Policy' => 'no-referrer-when-downgrade',
    104         ];
    105 
    106         foreach ($headers as $key => $value) {
    107             header(sanitize_key($key).': '.sanitize_text_field($value));
    108         }
     96        header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");
     97        header("X-Content-Type-Options: nosniff");
     98        header("X-Frame-Options: SAMEORIGIN");
     99        header("X-XSS-Protection: 1; mode=block");
     100        header("Referrer-Policy: no-referrer-when-downgrade");
    109101    }
    110102
    111     public function blockXmlRpcRequests(): void
    112     {
    113         add_filter('xmlrpc_enabled', '__return_false');
    114 
    115         if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
    116             wp_die(esc_html__('XML-RPC services are disabled.', 'bitspecter-suite'));
    117         }
    118     }
    119 
    120 
    121     public function enforceHttps(): void
    122     {
    123         if (wp_get_environment_type() !== 'production') {
    124             return;
    125         }
    126 
    127         $host = isset($_SERVER['HTTP_HOST']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_HOST'])) : '';
    128         $uri = isset($_SERVER['REQUEST_URI']) ? esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])) : '';
    129 
    130         if (! is_ssl() && $host && $uri) {
    131             wp_redirect('https://'.$host.$uri, 301);
    132             exit;
    133         }
    134     }
    135103
    136104    public function blockAuthorScan(): void
  • bitspecter-suite/trunk/includes/Optimization/BitspecterSuiteOptimization.php

    r3259459 r3259470  
    8686    {
    8787        wp_deregister_script('wp-embed');
    88         wp_deregister_script('jquery');
     88       
     89        if (!is_admin()) {
     90            wp_deregister_script('jquery');
     91        }
    8992    }
    9093}
Note: See TracChangeset for help on using the changeset viewer.