PluginProbe
WebTotem Security / 2.4.9
WebTotem Security v2.4.9
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.9, at src/Common.php

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