PluginProbe
WebTotem Security / 2.4.3
WebTotem Security v2.4.3
3.0.1 3.0.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 2.0 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.1 2.2.2 2.2.3 2.2.4 All 109 releases
wt-security / src / Common.php

Common.php in WebTotem Security 2.4.3, at src/Common.php

115 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('WEBTOTEM_INIT') || WEBTOTEM_INIT !== true) {
4 if (!headers_sent()) {
5 header('HTTP/1.1 403 Forbidden');
6 }
7 die("Protected By WebTotem!");
8 }
9
10 /**
11 * Plugin's global variables.
12 */
13 if (defined('WEBTOTEM')) {
14
15 if(!session_id()) {
16 session_start();
17 }
18
19 /**
20 * Remove the WordPress generator meta-tag from the source code.
21 */
22 remove_action('wp_head', 'wp_generator');
23
24 /**
25 * Define which javascript and css files will be loaded in the header of the
26 * plugin pages.
27 */
28 add_action('admin_enqueue_scripts', 'WebTotemInterface::enqueueScripts', 1);
29
30 /* Execute pre-checks before every page */
31 add_action('wp_loaded', 'WebTotemInterface::startupChecks');
32
33 add_action( 'wp_insert_site', 'WebTotemInterface::addNewSite' );
34
35
36 /* Attach HTTP request handlers for the AJAX requests */
37 add_action('wp_ajax_wtotem_ajax', 'wtotem_ajax_callback');
38
39 /**
40 * List an associative array with the sub-pages of this plugin.
41 *
42 * @return array List of sub-pages of this plugin.
43 */
44 function wtotemPages() {
45 if( WebTotem::isMultiSite() ) {
46 $pages['wtotem_all_sites'] = [ 'title' => __('All sites', 'wtotem'), 'slug' => 'wtotem'];
47 }
48 $slug = WebTotem::isMultiSite() ? 'wtotem_' : 'wtotem';
49
50 $pages['wtotem_dashboard'] = [ 'title' => __('Dashboard', 'wtotem'), 'slug' => $slug];
51 $pages['wtotem_firewall'] = [ 'title' => __('Firewall', 'wtotem'), 'slug' => $slug];
52 if(!WebTotem::isMultiSite() or is_super_admin()) {
53 $pages['wtotem_antivirus'] = [ 'title' => __('Antivirus', 'wtotem'), 'slug' => $slug];
54 $pages['wtotem_settings'] = [ 'title' => __('Settings', 'wtotem'), 'slug' => $slug];
55 }
56 $pages['wtotem_reports'] = [ 'title' => __('Reports', 'wtotem'), 'slug' => $slug];
57 $pages['wtotem_documentation'] = [ 'title' => __('Documentation', 'wtotem'), 'slug' => 'wtotem'];
58
59 return $pages;
60 }
61
62 if (function_exists('add_action')) {
63 /**
64 * Display extension menu and submenu items in the correct interface.
65 *
66 * @return void
67 */
68 function wtotemAddMenu() {
69
70 $page = ! WebTotemOption::isActivated() ? 'activation' : ( WebTotem::isMultiSite() ? 'all_sites' : 'dashboard' );
71
72 add_menu_page(
73 __('WebTotem Security', 'wtotem'),
74 __('WebTotem Security', 'wtotem'),
75 'manage_options',
76 'wtotem',
77 'wtotem_' . $page . '_page',
78 WebTotem::getImagePath('logo_17x17_w.png')
79 );
80
81 if(WebTotemOption::isActivated()){
82 $pages = wtotemPages();
83 foreach ($pages as $sub_page_function => $sub_page) {
84 add_submenu_page(
85 $sub_page['slug'],
86 $sub_page['title'],
87 $sub_page['title'],
88 'manage_options',
89 $sub_page_function,
90 $sub_page_function . '_page'
91 );
92 }
93
94 } else {
95 add_submenu_page(
96 'wtotem',
97 __('Activation', 'wtotem'),
98 __('Activation', 'wtotem'),
99 'manage_options',
100 'wtotem_activation',
101 'wtotem_activation_page'
102 );
103 }
104 }
105
106 /* Attach HTTP request handlers for the internal plugin pages */
107 if(WebTotem::isMultiSite()){
108 add_action('network_admin_menu', 'wtotemAddMenu');
109 }
110 add_action('admin_menu', 'wtotemAddMenu');
111
112 }
113
114 }
115