| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: SecuPress Free with Simple SSL – Simple and Performant Security |
| 4 |
* Plugin URI: https://secupress.me |
| 5 |
* Description: More than a plugin, the guarantee of a protected website by experts. |
| 6 |
* Author: SecuPress |
| 7 |
* Author URI: https://secupress.me |
| 8 |
* Version: 2.6.3 |
| 9 |
* Code Name: Makeshift |
| 10 |
* Network: true |
| 11 |
* Contributors: SecuPress, juliobox, GregLone |
| 12 |
* License: GPLv2 |
| 13 |
* Domain Path: /languages/ |
| 14 |
* Requires at least: 5.4 |
| 15 |
* Requires PHP: 7.0 |
| 16 |
* Copyright 2012-2026 SecuPress |
| 17 |
* |
| 18 |
* ██████╗███████╗ █████╗██╗ ██╗██████╗ ██████╗ ███████╗ ██████╗ ██████╗ ███╗ ███╗███████╗ |
| 19 |
* ██╔════╝██╔════╝██╔═══╝██║ ██║██╔══██╗██╔══██╗██╔════╝██╔════╝██╔════╝ ████╗ ████║██╔════╝ |
| 20 |
* ███████╗█████╗ ██║ ██║ ██║██████╔╝██████╔╝█████╗ ███████╗███████╗ ██╔████╔██║█████╗ |
| 21 |
* ╚════██║██╔══╝ ██║ ██║ ██║██╔═══╝ ██╔═██╝ ██╔══╝ ╚════██║╚════██║ ██║╚██╔╝██║██╔══╝ |
| 22 |
* ███████║███████╗ █████╗╚██████╔╝██║ ██║ ██╗███████╗███████║███████║██╗██║ ╚═╝ ██║███████╗ |
| 23 |
* ╚══════╝╚══════╝ ╚════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝ ╚═════╝╚═╝╚═╝ ╚═╝╚══════╝ |
| 24 |
*/ |
| 25 |
|
| 26 |
defined( 'ABSPATH' ) or die( 'Something went wrong.' ); |
| 27 |
|
| 28 |
$secupress_is_playground = isset( $_SERVER['SERVER_NAME'] ) && ( 'playground.wordpress.net' === $_SERVER['SERVER_NAME'] || 'my.wordpress.net' === $_SERVER['SERVER_NAME'] ); |
| 29 |
add_action( 'admin_notices', 'secupress_does_not_work_on_playground' ); |
| 30 |
/* :) */ |
| 31 |
function secupress_does_not_work_on_playground() { |
| 32 |
global $secupress_is_playground; |
| 33 |
if ( ! $secupress_is_playground ) { |
| 34 |
return; |
| 35 |
} |
| 36 |
$server_name = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'this host'; |
| 37 |
printf( '<div class="error"><p><strong>SecuPress</strong> does not work on <code>%s</code>.<br>Use <a href="https://demo.tastewp.com/secupress/">https://demo.tastewp.com/secupress/</a> to test the Free Version.<br>You can also <a href="https://secupress.me/pricing/">purchase a Pro Version</a> to test it (we refund during 14 days).</p></div>', esc_html( $server_name ) ); // DO NOT TRANSLATE |
| 38 |
} |
| 39 |
if ( $secupress_is_playground ) { |
| 40 |
return; // DO NOT LOAD SECUPRESS |
| 41 |
} |
| 42 |
/** --------------------------------------------------------------------------------------------- */ |
| 43 |
/** DEFINES ===================================================================================== */ |
| 44 |
/** --------------------------------------------------------------------------------------------- */ |
| 45 |
|
| 46 |
// Common constants |
| 47 |
if ( ! defined( 'SECUPRESS_FILE' ) ) { |
| 48 |
define( 'SECUPRESS_FILE', __FILE__ ); |
| 49 |
} |
| 50 |
if ( file_exists( plugin_dir_path( __FILE__ ) . 'defines.php' ) ) { |
| 51 |
require_once( plugin_dir_path( __FILE__ ) . 'defines.php' ); |
| 52 |
} |
| 53 |
|
| 54 |
define( 'SECUPRESS_ACTIVE_SUBMODULES' , 'secupress_active_submodules' ); |
| 55 |
define( 'SECUPRESS_SETTINGS_SLUG' , 'secupress_settings' ); |
| 56 |
define( 'SECUPRESS_SCAN_TIMES' , 'secupress_scanners_times' ); |
| 57 |
define( 'SECUPRESS_WP_CORE_FILES_HASHES' , 'secupress_wp_core_files_hashes' ); |
| 58 |
define( 'SECUPRESS_FULL_FILETREE' , 'secupress_full_filetree' ); |
| 59 |
define( 'SECUPRESS_DATABASE_MALWARES' , 'secupress_database_malwares' ); |
| 60 |
define( 'SECUPRESS_FIX_DISTS' , 'secupress_fix_dists' ); |
| 61 |
define( 'SECUPRESS_BAN_IP' , 'secupress_ban_ip' ); |
| 62 |
define( 'SECUPRESS_USER_PROTECTION' , 'secupress_user_protection' ); |
| 63 |
define( 'SECUPRESS_SAME_EMAIL_DOMAIN_OK' , 'secupress_same_email_domain_ok' ); |
| 64 |
define( 'SECUPRESS_WHITE_IP' , 'secupress_whitelist_ip' ); |
| 65 |
define( 'SECUPRESS_ATTACKS' , 'secupress_attacks_log' ); |
| 66 |
define( 'SECUPRESS_BAD_THEMES' , 'secupress_bad_themes__vuln' ); |
| 67 |
define( 'SECUPRESS_OLD_THEMES' , 'secupress_bad_themes__old' ); |
| 68 |
define( 'SECUPRESS_CLOSED_THEMES' , 'secupress_bad_themes__closed' ); |
| 69 |
define( 'SECUPRESS_BAD_PLUGINS' , 'secupress_bad_plugins__vuln' ); |
| 70 |
define( 'SECUPRESS_OLD_PLUGINS' , 'secupress_bad_plugins__old' ); |
| 71 |
define( 'SECUPRESS_CLOSED_PLUGINS' , 'secupress_bad_plugins__closed' ); |
| 72 |
define( 'SECUPRESS_RATE_URL' , 'https://wordpress.org/support/view/plugin-reviews/secupress?filter=5#topic' ); |
| 73 |
define( 'SECUPRESS_WEB_MAIN' , 'https://secupress.me/' ); |
| 74 |
define( 'SECUPRESS_API_MAIN' , 'https://secupress.me/wp-json/api/' ); |
| 75 |
define( 'SECUPRESS_MODULES_PATH' , SECUPRESS_INC_PATH . 'modules/' ); |
| 76 |
define( 'SECUPRESS_ADMIN_PATH' , SECUPRESS_INC_PATH . 'admin/' ); |
| 77 |
define( 'SECUPRESS_CLASSES_PATH' , SECUPRESS_INC_PATH . 'classes/' ); |
| 78 |
define( 'SECUPRESS_ADMIN_SETTINGS_MODULES', SECUPRESS_ADMIN_PATH . 'modules/' ); |
| 79 |
define( 'SECUPRESS_PLUGIN_URL' , plugin_dir_url( SECUPRESS_FILE ) ); |
| 80 |
define( 'SECUPRESS_FREE_URL' , SECUPRESS_PLUGIN_URL . 'free/' ); |
| 81 |
define( 'SECUPRESS_FRONT_URL' , SECUPRESS_FREE_URL . 'front/' ); |
| 82 |
define( 'SECUPRESS_ADMIN_URL' , SECUPRESS_FREE_URL . 'admin/' ); |
| 83 |
define( 'SECUPRESS_ASSETS_URL' , SECUPRESS_PLUGIN_URL . 'assets/' ); |
| 84 |
define( 'SECUPRESS_ADMIN_CSS_URL' , SECUPRESS_ASSETS_URL . 'admin/css/' ); |
| 85 |
define( 'SECUPRESS_ADMIN_JS_URL' , SECUPRESS_ASSETS_URL . 'admin/js/' ); |
| 86 |
define( 'SECUPRESS_ADMIN_IMAGES_URL' , SECUPRESS_ASSETS_URL . 'admin/images/' ); |
| 87 |
define( 'SECUPRESS_PHP_MIN' , '7.0' ); |
| 88 |
define( 'SECUPRESS_WP_MIN' , '4.9' ); |
| 89 |
define( 'SECUPRESS_INT_MAX' , PHP_INT_MAX - 20 ); |
| 90 |
|
| 91 |
if ( defined( 'SECUPRESS_API_EMAIL' ) && defined( 'SECUPRESS_API_KEY' ) && ! defined( 'SECUPRESS_HIDE_API_KEY' ) ) { |
| 92 |
define( 'SECUPRESS_HIDE_API_KEY', true ); |
| 93 |
} |
| 94 |
|
| 95 |
/** --------------------------------------------------------------------------------------------- */ |
| 96 |
/** INIT ======================================================================================== */ |
| 97 |
/** --------------------------------------------------------------------------------------------- */ |
| 98 |
|
| 99 |
/** |
| 100 |
* Requires hotfixes first because it's hot. |
| 101 |
*/ |
| 102 |
require_once( SECUPRESS_INC_PATH . 'functions/hotfixes.php' ); |
| 103 |
|
| 104 |
/** |
| 105 |
* All the stuff for the plugin activation and deactivation. |
| 106 |
*/ |
| 107 |
require_once( SECUPRESS_INC_PATH . 'activation.php' ); |
| 108 |
|
| 109 |
|
| 110 |
add_action( 'init', 'secupress_init_i18n', 0 ); |
| 111 |
/** |
| 112 |
* Load the i18n here since WP6.7 is doing sh*t |
| 113 |
* |
| 114 |
* @since 2.2.6 |
| 115 |
* @author Julio Potier |
| 116 |
*/ |
| 117 |
function secupress_init_i18n() { |
| 118 |
// Load translations. |
| 119 |
secupress_load_plugin_textdomain_translations(); |
| 120 |
} |
| 121 |
|
| 122 |
add_action( 'plugins_loaded', 'secupress_init', 0 ); |
| 123 |
/** |
| 124 |
* Tell WP what to do when the plugin is loaded. |
| 125 |
* |
| 126 |
* @since 2.2.6 wp-login.php || is_admin() |
| 127 |
* @author Julio Potier |
| 128 |
* @since 1.0 |
| 129 |
* @author Grégory Viguier |
| 130 |
*/ |
| 131 |
function secupress_init() { |
| 132 |
global $pagenow; |
| 133 |
// Nothing to do if autosave. |
| 134 |
if ( defined( 'DOING_AUTOSAVE' ) ) { |
| 135 |
return; |
| 136 |
} |
| 137 |
|
| 138 |
// Functions. |
| 139 |
secupress_load_functions(); |
| 140 |
|
| 141 |
// Last constants. |
| 142 |
if ( secupress_is_pro() ) { |
| 143 |
define( 'SECUPRESS_PLUGIN_NAME', esc_html( secupress_get_option( 'wl_plugin_name', 'SecuPress' ) ) ); |
| 144 |
} else { |
| 145 |
define( 'SECUPRESS_PLUGIN_NAME', 'SecuPress' ); |
| 146 |
} |
| 147 |
define( 'SECUPRESS_PLUGIN_SLUG', sanitize_title( SECUPRESS_PLUGIN_NAME ) ); |
| 148 |
|
| 149 |
// Hooks. |
| 150 |
require_once( SECUPRESS_INC_PATH . 'network-options-autoload.php' ); |
| 151 |
require_once( SECUPRESS_INC_PATH . 'common.php' ); |
| 152 |
require_once( SECUPRESS_INC_PATH . 'admin-bar.php' ); |
| 153 |
|
| 154 |
// Cleanup leftovers periodically. |
| 155 |
SecuPress_Cleanup_Leftovers::get_instance(); |
| 156 |
|
| 157 |
if ( 'wp-login.php' === $pagenow || is_admin() ) { |
| 158 |
if ( is_multisite() ) { |
| 159 |
// Hooks for multisite. |
| 160 |
require_once( SECUPRESS_ADMIN_PATH . 'multisite/centralize-blog-options.php' ); |
| 161 |
require_once( SECUPRESS_ADMIN_PATH . 'multisite/settings.php' ); |
| 162 |
} |
| 163 |
|
| 164 |
// Notices. |
| 165 |
SecuPress_Admin_Notices::get_instance(); |
| 166 |
SecuPress_Admin_Notices::enqueue_script(); |
| 167 |
|
| 168 |
// Pro upgrade. |
| 169 |
SecuPress_Admin_Pro_Upgrade::get_instance(); |
| 170 |
|
| 171 |
// Hooks. |
| 172 |
require_once( SECUPRESS_ADMIN_PATH . 'options.php' ); |
| 173 |
require_once( SECUPRESS_ADMIN_PATH . 'settings.php' ); |
| 174 |
require_once( SECUPRESS_ADMIN_PATH . 'admin.php' ); |
| 175 |
require_once( SECUPRESS_ADMIN_PATH . 'ajax-post-callbacks.php' ); |
| 176 |
} |
| 177 |
require_once( SECUPRESS_ADMIN_PATH . 'notices.php' ); |
| 178 |
require_once( SECUPRESS_INC_PATH . 'migrations.php' ); |
| 179 |
|
| 180 |
/** |
| 181 |
* Fires when SecuPress is correctly loaded. |
| 182 |
* |
| 183 |
* @since 1.0 |
| 184 |
*/ |
| 185 |
do_action( 'secupress.loaded' ); |
| 186 |
// Load the upgrader after the load of our plugins, SecuPress is still considered "loaded" even without this file since it's not usefull for security |
| 187 |
if ( is_admin() ) { |
| 188 |
require_once( SECUPRESS_ADMIN_PATH . 'upgrader.php' ); |
| 189 |
secupress_upgrader(); |
| 190 |
} |
| 191 |
} |
| 192 |
|
| 193 |
add_action( 'secupress.loaded', 'secupress_load_plugins' ); |
| 194 |
/** |
| 195 |
* Load modules. |
| 196 |
* |
| 197 |
* @author Grégory Viguier |
| 198 |
* @since 1.0 |
| 199 |
*/ |
| 200 |
function secupress_load_plugins() { |
| 201 |
// All modules. |
| 202 |
$modules = secupress_get_modules(); |
| 203 |
|
| 204 |
if ( $modules ) { |
| 205 |
foreach ( $modules as $key => $dummy ) { |
| 206 |
if ( secupress_has_pro() ) { |
| 207 |
$file = SECUPRESS_PRO_MODULES_PATH . sanitize_key( $key ) . '/tools.php'; |
| 208 |
|
| 209 |
if ( file_exists( $file ) ) { |
| 210 |
require_once( $file ); |
| 211 |
} |
| 212 |
} |
| 213 |
|
| 214 |
$file = SECUPRESS_MODULES_PATH . sanitize_key( $key ) . '/tools.php'; |
| 215 |
|
| 216 |
if ( file_exists( $file ) ) { |
| 217 |
require_once( $file ); |
| 218 |
} |
| 219 |
|
| 220 |
if ( ! is_admin() ) { |
| 221 |
continue; |
| 222 |
} |
| 223 |
|
| 224 |
if ( secupress_has_pro() ) { |
| 225 |
$file = SECUPRESS_PRO_MODULES_PATH . sanitize_key( $key ) . '/callbacks.php'; |
| 226 |
|
| 227 |
if ( file_exists( $file ) ) { |
| 228 |
require_once( $file ); |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
$file = SECUPRESS_MODULES_PATH . sanitize_key( $key ) . '/callbacks.php'; |
| 233 |
|
| 234 |
if ( file_exists( $file ) ) { |
| 235 |
require_once( $file ); |
| 236 |
} |
| 237 |
} |
| 238 |
} |
| 239 |
|
| 240 |
// OK, this one is a bit lonely. |
| 241 |
require_once( SECUPRESS_MODULES_PATH . 'discloses/tools.php' ); |
| 242 |
|
| 243 |
// Active sub-modules. |
| 244 |
$modules = secupress_get_active_submodules(); |
| 245 |
|
| 246 |
if ( $modules ) { |
| 247 |
foreach ( $modules as $module => $plugins ) { |
| 248 |
foreach ( $plugins as $plugin ) { |
| 249 |
if ( secupress_is_pro() || ! secupress_submodule_is_pro( $module, $plugin ) ) { |
| 250 |
$file_path = secupress_get_submodule_file_path( $module, $plugin ); |
| 251 |
if ( is_array( $file_path ) ) { |
| 252 |
foreach ( $file_path as $path ) { |
| 253 |
if ( file_exists( $path ) ) { |
| 254 |
require_once( $path ); |
| 255 |
} |
| 256 |
} |
| 257 |
} else { |
| 258 |
if ( file_exists( $file_path ) ) { |
| 259 |
require_once( $file_path ); |
| 260 |
} |
| 261 |
} |
| 262 |
} |
| 263 |
} |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
$has_activation = false; |
| 268 |
|
| 269 |
if ( is_admin() && secupress_get_site_transient( 'secupress_activation' ) ) { |
| 270 |
$has_activation = true; |
| 271 |
|
| 272 |
secupress_delete_site_transient( 'secupress_activation' ); |
| 273 |
|
| 274 |
/** |
| 275 |
* Fires once SecuPress is activated, after the SecuPress's plugins are loaded. |
| 276 |
* |
| 277 |
* @since 1.0 |
| 278 |
* @see `secupress_activation()` |
| 279 |
*/ |
| 280 |
do_action( 'secupress.plugins.activation' ); |
| 281 |
} |
| 282 |
|
| 283 |
if ( secupress_is_pro() && is_admin() && secupress_get_site_transient( 'secupress_pro_activation' ) ) { |
| 284 |
$has_activation = true; |
| 285 |
|
| 286 |
secupress_delete_site_transient( 'secupress_pro_activation' ); |
| 287 |
|
| 288 |
/** |
| 289 |
* Fires once SecuPress is activated, after the SecuPress's plugins are loaded. |
| 290 |
* |
| 291 |
* @since 1.1.4 |
| 292 |
* @see `secupress_pro_activation()` |
| 293 |
*/ |
| 294 |
do_action( 'secupress.pro.plugins.activation' ); |
| 295 |
} |
| 296 |
|
| 297 |
if ( $has_activation ) { |
| 298 |
/** |
| 299 |
* Fires once SecuPress or SecuPress is activated, after the SecuPress's plugins are loaded. |
| 300 |
* |
| 301 |
* @since 1.1.4 |
| 302 |
*/ |
| 303 |
do_action( 'secupress.all.plugins.activation' ); |
| 304 |
} |
| 305 |
// Autovalidate license if constants are set. |
| 306 |
if ( ! secupress_has_pro_license() && defined( 'SECUPRESS_API_EMAIL' ) && defined( 'SECUPRESS_API_KEY' ) ) { |
| 307 |
if ( ! function_exists( 'secupress_global_settings_activate_pro_license' ) ) { |
| 308 |
include( SECUPRESS_MODULES_PATH . 'welcome/callbacks.php' ); |
| 309 |
} |
| 310 |
$args = array(); |
| 311 |
$options = get_site_option( SECUPRESS_SETTINGS_SLUG ); |
| 312 |
$args['install_time'] = isset( $options['install_time'] ) && -1 !== (int) $options['install_time'] ? $options['install_time'] : time(); |
| 313 |
$args['consumer_email'] = SECUPRESS_API_EMAIL; |
| 314 |
$args['consumer_key'] = SECUPRESS_API_KEY; |
| 315 |
secupress_global_settings_activate_pro_license( $args ); |
| 316 |
} |
| 317 |
|
| 318 |
/** |
| 319 |
* Fires once all our plugins/submodules has been loaded. |
| 320 |
* |
| 321 |
* @since 1.0 |
| 322 |
*/ |
| 323 |
do_action( 'secupress.plugins.loaded' ); |
| 324 |
/** |
| 325 |
* Fires once all our plugins/submodules has been loaded in front-office or ajax. |
| 326 |
* |
| 327 |
* @since 2.2.6 |
| 328 |
*/ |
| 329 |
if ( ! is_admin() || wp_doing_ajax() ) { |
| 330 |
do_action( 'secupress.plugins.loaded.front' ); |
| 331 |
} |
| 332 |
/** |
| 333 |
* Fires once all our plugins/submodules has been loaded in back-office. |
| 334 |
* |
| 335 |
* @since 2.2.6 |
| 336 |
*/ |
| 337 |
if ( is_admin() && ! wp_doing_ajax() ) { |
| 338 |
do_action( 'secupress.plugins.loaded.back' ); |
| 339 |
} |
| 340 |
} |
| 341 |
|
| 342 |
/** |
| 343 |
* Check is the $locale if a FR one |
| 344 |
* |
| 345 |
* @author Julio Potier |
| 346 |
* @since 2.2 |
| 347 |
* |
| 348 |
* @param (string) $locale The locale to be tested |
| 349 |
* |
| 350 |
* @return (bool) True if $locale is fr_FR (france) or fr_BE (belgium) or fr_CA (canada) |
| 351 |
**/ |
| 352 |
function secupress_locale_is_FR( $locale ) { |
| 353 |
return 'fr_FR' === $locale || 'fr_CA' === $locale || 'fr_BE' === $locale; |
| 354 |
} |
| 355 |
|
| 356 |
/** |
| 357 |
* Check is the $locale if a DE one |
| 358 |
* |
| 359 |
* @author Julio Potier |
| 360 |
* @since 2.2.6 |
| 361 |
* |
| 362 |
* @param (string) $locale The locale to be tested |
| 363 |
* @return (bool) True if $locale is de_DE, de_DE_formal, de_CH_informal, de_AT, de_CH |
| 364 |
**/ |
| 365 |
function secupress_locale_is_DE( $locale ) { |
| 366 |
return 'de_DE' === $locale || 'de_DE_formal' === $locale || 'de_CH_informal' === $locale || 'de_AT' === $locale || 'de_CH' === $locale; |
| 367 |
} |
| 368 |
|
| 369 |
/** |
| 370 |
* Include files that contain our functions. |
| 371 |
* |
| 372 |
* @since 2.2.6 wp-login.php || is_admin() |
| 373 |
* @author Julio Potier |
| 374 |
* @since 1.2.3 |
| 375 |
* @since 1.2.5 Includes requirement checks. |
| 376 |
* @author Grégory Viguier |
| 377 |
*/ |
| 378 |
function secupress_load_functions() { |
| 379 |
global $is_iis7, $wp_version, $pagenow; |
| 380 |
static $done = false; |
| 381 |
|
| 382 |
if ( $done ) { |
| 383 |
return; |
| 384 |
} |
| 385 |
$done = true; |
| 386 |
|
| 387 |
/** |
| 388 |
* Check requirements. |
| 389 |
*/ |
| 390 |
// Check php version. |
| 391 |
if ( version_compare( phpversion(), SECUPRESS_PHP_MIN ) < 0 ) { |
| 392 |
$plugin = plugin_basename( SECUPRESS_FILE ); |
| 393 |
|
| 394 |
if ( current_filter() !== 'activate_' . $plugin ) { |
| 395 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 396 |
deactivate_plugins( SECUPRESS_FILE, true ); |
| 397 |
} |
| 398 |
|
| 399 |
secupress_load_plugin_textdomain_translations(); |
| 400 |
|
| 401 |
wp_die( sprintf( __( '<strong>%1$s</strong> requires PHP %2$s minimum, your website is actually running version %3$s.', 'secupress' ), 'SecuPress', '<code>' . SECUPRESS_PHP_MIN . '</code>', '<code>' . phpversion() . '</code>' ) ); |
| 402 |
} |
| 403 |
|
| 404 |
// Check WordPress version. |
| 405 |
if ( version_compare( $wp_version, SECUPRESS_WP_MIN ) < 0 ) { |
| 406 |
$plugin = plugin_basename( SECUPRESS_FILE ); |
| 407 |
|
| 408 |
if ( current_filter() !== 'activate_' . $plugin ) { |
| 409 |
require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
| 410 |
deactivate_plugins( SECUPRESS_FILE, true ); |
| 411 |
} |
| 412 |
|
| 413 |
secupress_load_plugin_textdomain_translations(); |
| 414 |
|
| 415 |
wp_die( sprintf( __( '<strong>%1$s</strong> requires WordPress %2$s minimum, your website is actually running version %3$s.', 'secupress' ), 'SecuPress', '<code>' . SECUPRESS_WP_MIN . '</code>', '<code>' . $wp_version . '</code>' ) ); |
| 416 |
} |
| 417 |
|
| 418 |
/** |
| 419 |
* Require our functions. |
| 420 |
*/ |
| 421 |
require_once( SECUPRESS_INC_PATH . 'functions/common.php' ); |
| 422 |
require_once( SECUPRESS_INC_PATH . 'functions/compat.php' ); |
| 423 |
require_once( SECUPRESS_INC_PATH . 'functions/deprecated.php' ); |
| 424 |
require_once( SECUPRESS_INC_PATH . 'functions/3rdparty.php' ); |
| 425 |
require_once( SECUPRESS_INC_PATH . 'functions/formatting.php' ); |
| 426 |
require_once( SECUPRESS_INC_PATH . 'functions/options.php' ); |
| 427 |
require_once( SECUPRESS_INC_PATH . 'functions/modules.php' ); |
| 428 |
require_once( SECUPRESS_INC_PATH . 'functions/db.php' ); |
| 429 |
require_once( SECUPRESS_INC_PATH . 'functions/ip.php' ); |
| 430 |
require_once( SECUPRESS_INC_PATH . 'functions/files.php' ); |
| 431 |
require_once( SECUPRESS_INC_PATH . 'functions/htaccess.php' ); |
| 432 |
require_once( SECUPRESS_INC_PATH . 'functions/widgets.php' ); |
| 433 |
|
| 434 |
if ( $is_iis7 ) { |
| 435 |
require_once( SECUPRESS_INC_PATH . 'functions/iis7.php' ); |
| 436 |
} |
| 437 |
|
| 438 |
// The Singleton class. |
| 439 |
secupress_require_class( 'Singleton' ); |
| 440 |
|
| 441 |
// Cleanup leftovers periodically. |
| 442 |
secupress_require_class( 'Cleanup_Leftovers' ); |
| 443 |
// The Scanner results class. |
| 444 |
secupress_require_class( 'Scanner_Results' ); |
| 445 |
|
| 446 |
// Admin side but need when running cron. |
| 447 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/settings.php' ); |
| 448 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/scan-fix.php' ); |
| 449 |
|
| 450 |
if ( 'wp-login.php' !== $pagenow && ! is_admin() ) { |
| 451 |
return; |
| 452 |
} |
| 453 |
|
| 454 |
if ( is_multisite() ) { |
| 455 |
// Functions for multisite. |
| 456 |
require_once( SECUPRESS_ADMIN_PATH . 'multisite/options.php' ); |
| 457 |
} |
| 458 |
|
| 459 |
// The notices class. |
| 460 |
secupress_require_class( 'Admin', 'Notices' ); |
| 461 |
|
| 462 |
// The Pro upgrade class. |
| 463 |
secupress_require_class( 'Admin', 'Offer_Migration' ); |
| 464 |
secupress_require_class( 'Admin', 'Pro_Upgrade' ); |
| 465 |
secupress_require_class( 'Admin', 'Pointers' ); |
| 466 |
|
| 467 |
// Functions for the admin side. |
| 468 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/admin.php' ); |
| 469 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/options.php' ); |
| 470 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/ajax-post.php' ); |
| 471 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/modules.php' ); |
| 472 |
require_once( SECUPRESS_ADMIN_PATH . 'functions/notices.php' ); |
| 473 |
} |
| 474 |
|
| 475 |
|
| 476 |
/** --------------------------------------------------------------------------------------------- */ |
| 477 |
/** I18N ======================================================================================== */ |
| 478 |
/** --------------------------------------------------------------------------------------------- */ |
| 479 |
|
| 480 |
add_filter( 'load_textdomain_mofile', 'secupress_load_own_i18n', 11, 2 ); |
| 481 |
/** |
| 482 |
* Load our own i18n to prevent too long strings or spelling errors from voluteers at translate.wp.org, sorry guys. |
| 483 |
* |
| 484 |
* @since 2.2.6 Usage of secupress_locale_is_DE() |
| 485 |
* @since 2.2 Usage of secupress_locale_is_FR() |
| 486 |
* @since 2.0.3 fr_BE & fr_CA = fr_FR |
| 487 |
* @since 2.0 |
| 488 |
* @author Julio Potier |
| 489 |
* |
| 490 |
* @param (string) $mofile The file to be loaded |
| 491 |
* @param (string) $domain The desired textdomain |
| 492 |
* |
| 493 |
* @return (string) $mofile |
| 494 |
**/ |
| 495 |
function secupress_load_own_i18n( $mofile, $domain ) { |
| 496 |
if ( 'secupress' === $domain ) { |
| 497 |
$locale = apply_filters( 'plugin_locale', determine_locale(), $domain ); |
| 498 |
if ( ! function_exists( 'determine_locale' ) ) { // WP 5.0. |
| 499 |
$determined_locale = is_admin() ? get_user_locale() : get_locale(); |
| 500 |
} else { |
| 501 |
$determined_locale = determine_locale(); |
| 502 |
} |
| 503 |
$locale = apply_filters( 'plugin_locale', $determined_locale, $domain ); |
| 504 |
if ( secupress_locale_is_FR( $locale ) ) { |
| 505 |
$locale = 'fr_FR'; |
| 506 |
} elseif ( secupress_locale_is_DE( $locale ) ) { |
| 507 |
$locale = 'de_DE'; |
| 508 |
} |
| 509 |
$mofile = WP_PLUGIN_DIR . '/' . dirname( plugin_basename( SECUPRESS_FILE ) ) . '/languages/' . $domain . '-' . $locale . '.mo'; |
| 510 |
} |
| 511 |
return $mofile; |
| 512 |
} |
| 513 |
/** |
| 514 |
* Translations for the plugin textdomain. |
| 515 |
* |
| 516 |
* @author Grégory Viguier |
| 517 |
* @since 1.0 |
| 518 |
*/ |
| 519 |
function secupress_load_plugin_textdomain_translations() { |
| 520 |
static $done = false; |
| 521 |
|
| 522 |
if ( $done ) { |
| 523 |
return; |
| 524 |
} |
| 525 |
$done = true; |
| 526 |
|
| 527 |
load_plugin_textdomain( 'secupress', false, dirname( plugin_basename( SECUPRESS_FILE ) ) . '/languages' ); |
| 528 |
/** |
| 529 |
* Fires right after the plugin text domain is loaded. |
| 530 |
* |
| 531 |
* @since 1.0 |
| 532 |
*/ |
| 533 |
do_action( 'secupress.plugin_textdomain_loaded' ); |
| 534 |
|
| 535 |
// Make sure Poedit keeps our plugin headers. |
| 536 |
/** Translators: Plugin Name of the plugin/theme */ |
| 537 |
__( 'SecuPress Free with Simple SSL – Simple and Performant Security', 'secupress' ); |
| 538 |
/** Translators: Description of the plugin/theme */ |
| 539 |
__( 'Protect your WordPress with SecuPress, analyze and ensure the safety of your website daily.', 'secupress' ); |
| 540 |
} |
| 541 |
|