| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: GD Security Headers |
| 4 |
* Plugin URI: https://plugins.dev4press.com/gd-security-headers/ |
| 5 |
* Description: Configure various security related HTTP headers, including Content Security Policy, Referrer Policy and more. All headers can be added to .HTACCESS file. |
| 6 |
* Author: Milan Petrovic |
| 7 |
* Author URI: https://www.dev4press.com/ |
| 8 |
* Text Domain: gd-security-headers |
| 9 |
* Version: 1.9 |
| 10 |
* Requires at least: 5.5 |
| 11 |
* Tested up to: 7.0 |
| 12 |
* Requires PHP: 7.4 |
| 13 |
* Network: true |
| 14 |
* License: GPLv3 or later |
| 15 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| 16 |
* |
| 17 |
* == Copyright == |
| 18 |
* Copyright 2008 - 2026 Milan Petrovic (email: support@dev4press.com) |
| 19 |
* |
| 20 |
* This program is free software: you can redistribute it and/or modify |
| 21 |
* it under the terms of the GNU General Public License as published by |
| 22 |
* the Free Software Foundation, either version 3 of the License, or |
| 23 |
* (at your option) any later version. |
| 24 |
* |
| 25 |
* This program is distributed in the hope that it will be useful, |
| 26 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 |
* GNU General Public License for more details. |
| 29 |
* |
| 30 |
* You should have received a copy of the GNU General Public License |
| 31 |
* along with this program. If not, see <http://www.gnu.org/licenses/> |
| 32 |
*/ |
| 33 |
|
| 34 |
$gdsih_dirname_basic = dirname( __FILE__ ) . '/'; |
| 35 |
$gdsih_urlname_basic = plugins_url( '/gd-security-headers/' ); |
| 36 |
|
| 37 |
define( 'GDSIH_PATH', $gdsih_dirname_basic ); |
| 38 |
define( 'GDSIH_URL', $gdsih_urlname_basic ); |
| 39 |
define( 'GDSIH_D4PLIB', $gdsih_dirname_basic . 'd4plib/' ); |
| 40 |
|
| 41 |
/* D4PLIB */ |
| 42 |
if ( ! defined( 'D4PLIB_PATH' ) ) { |
| 43 |
define( 'D4PLIB_PATH', GDSIH_PATH . 'd4plib/' ); |
| 44 |
} |
| 45 |
|
| 46 |
if ( ! defined( 'D4PLIB_URL' ) ) { |
| 47 |
define( 'D4PLIB_URL', GDSIH_URL . 'd4plib/' ); |
| 48 |
} |
| 49 |
|
| 50 |
require_once( GDSIH_D4PLIB . 'd4p.core.php' ); |
| 51 |
/* D4PLIB */ |
| 52 |
|
| 53 |
d4p_includes( array( |
| 54 |
array( 'name' => 'datetime', 'directory' => 'core' ), |
| 55 |
array( 'name' => 'scope', 'directory' => 'core' ), |
| 56 |
array( 'name' => 'wpdb', 'directory' => 'core' ), |
| 57 |
array( 'name' => 'plugin', 'directory' => 'plugin' ), |
| 58 |
array( 'name' => 'errors', 'directory' => 'plugin' ), |
| 59 |
array( 'name' => 'settings', 'directory' => 'plugin' ), |
| 60 |
array( 'name' => 'ip', 'directory' => 'classes' ), |
| 61 |
'functions', |
| 62 |
'sanitize', |
| 63 |
'access', |
| 64 |
'wp', |
| 65 |
), GDSIH_D4PLIB ); |
| 66 |
|
| 67 |
require_once( GDSIH_PATH . 'core/version.php' ); |
| 68 |
require_once( GDSIH_PATH . 'core/settings.php' ); |
| 69 |
require_once( GDSIH_PATH . 'core/functions.php' ); |
| 70 |
require_once( GDSIH_PATH . 'core/plugin.php' ); |
| 71 |
|
| 72 |
require_once( GDSIH_PATH . 'core/objects/core.db.php' ); |
| 73 |
|
| 74 |
global $_gdsih_core, $_gdsih_settings, $_gdsih_db; |
| 75 |
|
| 76 |
$_gdsih_settings = new gdsih_core_settings(); |
| 77 |
$_gdsih_core = new gdsih_core_plugin(); |
| 78 |
$_gdsih_db = new gdsih_core_db(); |
| 79 |
|
| 80 |
function gdsih() : gdsih_core_plugin { |
| 81 |
global $_gdsih_core; |
| 82 |
|
| 83 |
return $_gdsih_core; |
| 84 |
} |
| 85 |
|
| 86 |
function gdsih_settings() : gdsih_core_settings { |
| 87 |
global $_gdsih_settings; |
| 88 |
|
| 89 |
return $_gdsih_settings; |
| 90 |
} |
| 91 |
|
| 92 |
function gdsih_db() : gdsih_core_db { |
| 93 |
global $_gdsih_db; |
| 94 |
|
| 95 |
return $_gdsih_db; |
| 96 |
} |
| 97 |
|
| 98 |
if ( D4P_ADMIN ) { |
| 99 |
d4p_includes( array( |
| 100 |
array( 'name' => 'admin', 'directory' => 'plugin' ), |
| 101 |
array( 'name' => 'functions', 'directory' => 'admin' ), |
| 102 |
), GDSIH_D4PLIB ); |
| 103 |
|
| 104 |
require_once( GDSIH_PATH . 'core/admin/plugin.php' ); |
| 105 |
} |
| 106 |
|