-
Notifications
You must be signed in to change notification settings - Fork 7
/
unusedcss.php
64 lines (42 loc) · 1.74 KB
/
unusedcss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/*
Plugin Name: RapidLoad - Optimize Web Vitals Automatically
Plugin URI: https://rapidload.io/
Description: Makes your site even faster and lighter by automatically removing Unused CSS from your website.
Version: 2.4.4
Author: RapidLoad
Author URI: https://rapidload.io/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if(isset($_REQUEST['no_rapidload'])){
return;
}
require_once __DIR__ . '/constants.php';
define( 'UUCSS_PLUGIN_FILE', __FILE__ );
define('UUCSS_PLUGIN_URL', plugin_dir_url( __FILE__ ));
define('UUCSS_ABSPATH', str_replace(wp_basename(WP_CONTENT_DIR), '', WP_CONTENT_DIR));
define('RAPIDLOAD_BASE', ( function_exists( 'wp_normalize_path' ) ) ? plugin_basename( __DIR__ . '/' . basename(__FILE__) ) : null);
if (file_exists(dirname(__FILE__) . '/includes/RapidLoad_CLI_Command.php')) {
require_once dirname(__FILE__) . '/includes/RapidLoad_CLI_Command.php';
}
if ( is_multisite() ) {
$blog_id = get_current_blog_id();
define('UUCSS_LOG_DIR', wp_get_upload_dir()['basedir'] . '/rapidload/' . date('Ymd') . '/' . $blog_id . '/');
} else {
define('UUCSS_LOG_DIR', wp_get_upload_dir()['basedir'] . '/rapidload/' . date('Ymd') . '/');
}
require_once __DIR__ . '/vendor/autoload.php';
if(is_admin()){
register_activation_hook( UUCSS_PLUGIN_FILE, 'RapidLoad_Base::uucss_activate' );
register_activation_hook( UUCSS_PLUGIN_FILE, 'RapidLoad_DB::initialize' );
register_uninstall_hook(UUCSS_PLUGIN_FILE, 'RapidLoad_DB::drop');
register_activation_hook( UUCSS_PLUGIN_FILE, 'RapidLoad_Cache::on_activation' );
register_deactivation_hook( UUCSS_PLUGIN_FILE, 'RapidLoad_Cache::on_deactivation' );
}
/**
* @type $uucss UnusedCSS_Autoptimize
*/
global $rapidload;
$rapidload = RapidLoad_Base::get();