-
Notifications
You must be signed in to change notification settings - Fork 122
/
nginx-helper.php
97 lines (82 loc) · 2.54 KB
/
nginx-helper.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
/**
* Plugin Name: Nginx Helper
* Plugin URI: https://rtcamp.com/nginx-helper/
* Description: Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does few more things.
* Version: 2.2.5
* Author: rtCamp
* Author URI: https://rtcamp.com
* Text Domain: nginx-helper
* Domain Path: /languages
* Requires at least: 3.0
* Tested up to: 6.4
*
* @link https://rtcamp.com/nginx-helper/
* @since 2.0.0
* @package nginx-helper
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Base URL of plugin
*/
if ( ! defined( 'NGINX_HELPER_BASEURL' ) ) {
define( 'NGINX_HELPER_BASEURL', plugin_dir_url( __FILE__ ) );
}
/**
* Base Name of plugin
*/
if ( ! defined( 'NGINX_HELPER_BASENAME' ) ) {
define( 'NGINX_HELPER_BASENAME', plugin_basename( __FILE__ ) );
}
/**
* Base PATH of plugin
*/
if ( ! defined( 'NGINX_HELPER_BASEPATH' ) ) {
define( 'NGINX_HELPER_BASEPATH', plugin_dir_path( __FILE__ ) );
}
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-nginx-helper-activator.php
*/
function activate_nginx_helper() {
require_once NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper-activator.php';
Nginx_Helper_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-nginx-helper-deactivator.php
*/
function deactivate_nginx_helper() {
require_once NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper-deactivator.php';
Nginx_Helper_Deactivator::deactivate();
}
register_activation_hook( __FILE__, 'activate_nginx_helper' );
register_deactivation_hook( __FILE__, 'deactivate_nginx_helper' );
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require NGINX_HELPER_BASEPATH . 'includes/class-nginx-helper.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 2.0.0
*/
function run_nginx_helper() {
global $nginx_helper;
$nginx_helper = new Nginx_Helper();
$nginx_helper->run();
// Load WP-CLI command.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once NGINX_HELPER_BASEPATH . 'class-nginx-helper-wp-cli-command.php';
\WP_CLI::add_command( 'nginx-helper', 'Nginx_Helper_WP_CLI_Command' );
}
}
run_nginx_helper();