Files
wp-recache/wp-recache.php
T

73 lines
2.0 KiB
PHP

<?php
/**
* Plugin Name: WP Recache
* Plugin URI: https://gitea.cyanet.fr/kevin.bataille/wp-recache
* Description: Open source WordPress performance plugin - page caching, file optimization, image optimization
* Version: 1.0.0
* Requires at least: 5.8
* Requires PHP: 7.4
* Author: Kevin Bataille
* Author URI: https://gitea.cyanet.fr/kevin.bataille
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wp-recache
* Domain Path: /languages
*/
defined('ABSPATH') || exit;
define('WP_RECACHE_VERSION', '1.0.0');
define('WP_RECACHE_PATH', plugin_dir_path(__FILE__));
define('WP_RECACHE_URL', plugin_dir_url(__FILE__));
define('WP_RECACHE_INC_PATH', WP_RECACHE_PATH . 'includes/');
define('WP_RECACHE_CACHE_PATH', WP_CONTENT_DIR . '/cache/wp-recache/');
define('WP_RECACHE_DEFAULT_REJECTED_COOKIES', [
'woocommerce_items_in_cart',
'wp_woocommerce_session_*',
'wp-postpass',
'comment_author_*',
'wordpress_*',
]);
require_once WP_RECACHE_INC_PATH . 'Common/Helpers.php';
/**
* Main plugin initialization.
*/
function wp_recache_init() {
if (is_admin()) {
require_once WP_RECACHE_INC_PATH . 'Admin/Admin.php';
$admin = new WP_Recache_Admin();
$admin->init();
}
if (wp_recache_is_cache_enabled()) {
require_once WP_RECACHE_INC_PATH . 'Cache/WPCache.php';
$cache = new WP_Recache_WPCache();
$cache->init();
}
add_action('wp_enqueue_scripts', 'wp_recache_enqueue_admin_bar_script');
}
/**
* Plugin activation.
*/
function wp_recache_activate() {
require_once WP_RECACHE_INC_PATH . 'Activator.php';
WP_Recache_Activator::activate();
}
register_activation_hook(__FILE__, 'wp_recache_activate');
/**
* Plugin deactivation.
*/
function wp_recache_deactivate() {
require_once WP_RECACHE_INC_PATH . 'Activator.php';
require_once WP_RECACHE_INC_PATH . 'Deactivator.php';
WP_Recache_Deactivator::deactivate();
}
register_deactivation_hook(__FILE__, 'wp_recache_deactivate');
add_action('plugins_loaded', 'wp_recache_init');