-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtorque.php
64 lines (55 loc) · 1.76 KB
/
torque.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
62
63
64
<?php
/**
* Initialises the Torque Wordpress plugin
*
* @package hexydec/torque
*/
namespace hexydec\torque;
/*
Plugin Name: Torque - Optimise the transport of your Website
Plugin URI: https://github.com/hexydec/torque
Description: Make your Wordpress website noticably faster by optimising how it is delivered. Analyse your website's performance and security, minify and combine your assets, and configure an array of performance and security settings quickly and easily with this comprehensive plugin. Achieves the best compression of any minification plugin.
Version: 1.0.0
Requires PHP: 8.1
Author: Hexydec
Author URI: https://github.com/hexydec/
License: GPL
License URI: https://github.com/hexydec/htmldoc/blob/master/LICENSE
*/
require(__DIR__.'/autoload.php');
// activate the plugin
\register_activation_hook(__FILE__, function () : void {
// from GitHub, download packages
if (\class_exists('\\hexydec\\torque\\installExternal')) {
$obj = new installExternal();
// for Wordpress, packages are included
} else {
$obj = new install();
}
$obj->install();
});
// install the admin menu
\add_action('admin_menu', function () : void {
$obj = new admin();
$obj->update();
$obj->draw();
});
// load the app
\add_action('wp_loaded', function () : void {
$obj = new app();
$obj->optimise();
});
// uninstall
\register_uninstall_hook(__FILE__, '\\hexydec\\torque\\install::uninstall');
// rebuild files when a plugin is updated
\add_action('upgrader_process_complete', function () : void {
assets::rebuildAssets();
});
// add rebuild command
if (\class_exists('WP_CLI')) {
\WP_CLI::add_command('torque rebuild', function () : bool {
return \hexydec\torque\assets::rebuildAssets();
}, [
'shortdesc' => 'Rebuild the configured combined CSS and Javascript files'
]);
}