PluginProbe
WebTotem Security / 2.4.6
WebTotem Security v2.4.6
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.6, at src/Common.php

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