PluginProbe
WebTotem Security / 2.4.10
WebTotem Security v2.4.10
3.0.2 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 All 110 releases
wt-security / src / Common.php

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

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