PluginProbe
RSFirewall! / trunk
RSFirewall! vtrunk
rsfirewall / rsfirewall.php

rsfirewall.php in RSFirewall! trunk, at rsfirewall.php

149 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package RSFirewall!
4 * @copyright (c) 2018-2023 RSJoomla!
5 * @link https://www.rsjoomla.com
6 * @license GNU General Public License http://www.gnu.org/licenses/gpl-3.0.en.html
7 */
8
9 /*
10 Plugin Name: RSFirewall!
11 Plugin URI: https://www.rsjoomla.com/wordpress-plugins/wordpress-security-plugin.html
12 Description: Based on the success of the most popular firewall for Joomla!, RSFirewall! is now available to protect your WordPress website as well.
13 Version: 1.1.48
14 Author: RSJoomla!
15 Author URI: https://www.rsjoomla.com
16 License: GNU General Public License http://www.gnu.org/licenses/gpl-3.0.en.html
17 */
18
19 if ( ! defined( 'WPINC' ) ) {
20 die;
21 }
22
23 // Define constants
24 define( 'RSFIREWALL_BASE', plugin_dir_path( __FILE__ ) );
25 define( 'RSFIREWALL_URL', plugin_dir_url( __FILE__ ) );
26 define( 'RSFIREWALL_REL_PATH', basename( dirname( __FILE__ ) )) ;
27 define( 'RSFIREWALL_SITE', rtrim(ABSPATH, '\\/') );
28 define( 'RSFIREWALL_POSTS_PREFIX', 'rsf_' );
29
30 require_once RSFIREWALL_BASE.'libraries/version.php';
31
32 /**
33 * The code that runs during plugin activation.
34 */
35 function activate_rsfirewall() {
36 if (file_exists(RSFIREWALL_BASE.'proversion/installer/installer.php')) {
37 require_once RSFIREWALL_BASE.'proversion/installer/installer.php';
38 } else {
39 require_once RSFIREWALL_BASE . 'installer/installer.php';
40 }
41
42 require_once RSFIREWALL_BASE . 'helpers/rsfirewall.php';
43 RSFirewall_Installer::activate();
44 }
45
46 /**
47 * The code that runs during plugin deactivation.
48 */
49 function deactivate_rsfirewall() {
50 if (file_exists(RSFIREWALL_BASE.'proversion/installer/installer.php')) {
51 require_once RSFIREWALL_BASE.'proversion/installer/installer.php';
52 } else {
53 require_once RSFIREWALL_BASE . 'installer/installer.php';
54 }
55 RSFirewall_Installer::deactivate();
56 }
57
58 /**
59 * The code that runs during plugin deactivation.
60 */
61 function uninstall_rsfirewall() {
62 if (file_exists(RSFIREWALL_BASE.'proversion/installer/installer.php')) {
63 require_once RSFIREWALL_BASE.'proversion/installer/installer.php';
64 } else {
65 require_once RSFIREWALL_BASE . 'installer/installer.php';
66 }
67 RSFirewall_Installer::uninstall();
68 }
69
70 register_activation_hook( __FILE__, 'activate_rsfirewall' );
71 register_deactivation_hook( __FILE__, 'deactivate_rsfirewall' );
72 register_uninstall_hook( __FILE__, 'uninstall_rsfirewall' );
73
74 /**
75 * The core plugin class that is used to define internationalization,
76 * admin-specific hooks, and public-facing site hooks.
77 */
78 require_once RSFIREWALL_BASE . 'libraries/autoloader.php';
79 require_once RSFIREWALL_BASE . 'libraries/rsfirewall.php';
80
81 // Load the proversion too if exists
82 if (file_exists(RSFIREWALL_BASE.'proversion/libraries/rsfirewall.php')) {
83 require_once RSFIREWALL_BASE . 'proversion/libraries/rsfirewall.php';
84 }
85
86
87 /**
88 * Begins execution of the plugin.
89 *
90 * @since 1.0.0
91 */
92
93 function run_rsfirewall()
94 {
95 $rsfirewall = RSFirewall_Helper::call_user_func_pro(array('RSFirewall', 'get_instance'));
96
97 /**
98 * Load language files
99 */
100 $rsfirewall->set_locale();
101
102
103 /**
104 * Define global hooks (both front and admin)
105 */
106 $rsfirewall->define_global_hooks();
107
108 /**
109 * Define admin hooks
110 */
111 $rsfirewall->define_admin_hooks();
112
113 /**
114 * Start the buffer and callback function
115 */
116 if (method_exists($rsfirewall, 'setup_buffer')) {
117 $rsfirewall->setup_buffer();
118 }
119
120 /**
121 * Create admin menu
122 */
123 if (is_admin())
124 {
125 add_action( 'init', array('RSFirewall_Installer', 'upgrade'));
126
127 add_action( 'init', array($rsfirewall,'add_menu_pages'));
128 add_action( 'init', array($rsfirewall,'add_settings_link'));
129
130 }
131
132 /**
133 * Define updates hooks
134 */
135 add_action( 'init', array($rsfirewall,'enable_updates'));
136 }
137
138 if (file_exists(RSFIREWALL_BASE.'proversion/installer/installer.php')) {
139 require_once RSFIREWALL_BASE.'proversion/installer/installer.php';
140 } else {
141 require_once RSFIREWALL_BASE . 'installer/installer.php';
142 }
143
144 if (RSFirewall_Installer::check_version(false)) {
145 add_action(
146 'plugins_loaded',
147 'run_rsfirewall'
148 );
149 }