PluginProbe
WebTotem Security / 2.4.12
WebTotem Security v2.4.12
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.12, at src/Common.php

134 lines 4.1 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 /** Login Page */
24 add_action('login_enqueue_scripts', 'WebTotemInterface::loginEnqueueScripts');
25
26 /** Add authenticate filter */
27 add_filter('authenticate', 'WebTotemInterface::wt_authenticate', 25, 3);
28
29 /** Execute pre-checks before every page */
30 add_action('init', 'WebTotemInterface::startupChecks'); //wp_loaded
31
32 /** Add site or new sites if it is multisite */
33 add_action( 'wp_insert_site', 'WebTotemInterface::addNewSite' );
34
35 /** Attach HTTP request handlers for the AJAX requests */
36 add_action('wp_ajax_wtotem_ajax', 'wtotem_ajax_callback');
37 add_action('wp_ajax_nopriv_wtotem_ajax', 'wtotem_public_ajax_callback');
38
39 /** Hide or show WP version */
40 if (WebTotemOption::getPluginSettings('hide_wp_version')) {
41 add_filter('update_feedback', 'WebTotemInterface::restoreReadmeWhenUpdating');
42 }
43
44 /** Define role of current user */
45 //add_action('init', 'WebTotem::getUserRole');
46
47 /** */
48 add_action( 'wp', 'webtotem_add_cron' );
49 add_action( 'webtotem_daily_cron', 'dailyCron' );
50
51 function webtotem_add_cron() {
52 if( ! wp_next_scheduled( 'webtotem_daily_cron' ) ) {
53 wp_schedule_event( time(), 'daily', 'webtotem_daily_cron' );
54 }
55 }
56
57 /**
58 * List an associative array with the sub-pages of this plugin.
59 *
60 * @return array List of sub-pages of this plugin.
61 */
62 function wtotemPages() {
63 if( WebTotem::isMultiSite() ) {
64 $pages['wtotem_all_sites'] = [ 'title' => __('All sites', 'wtotem'), 'slug' => 'wtotem'];
65 }
66 $slug = WebTotem::isMultiSite() ? 'wtotem_' : 'wtotem';
67
68 $pages['wtotem_dashboard'] = [ 'title' => __('Dashboard', 'wtotem'), 'slug' => $slug];
69 $pages['wtotem_firewall'] = [ 'title' => __('Firewall', 'wtotem'), 'slug' => $slug];
70 if(!WebTotem::isMultiSite() or is_super_admin()) {
71 $pages['wtotem_antivirus'] = [ 'title' => __('Antivirus', 'wtotem'), 'slug' => $slug];
72 $pages['wtotem_settings'] = [ 'title' => __('Settings', 'wtotem'), 'slug' => $slug];
73 }
74 $pages['wtotem_reports'] = [ 'title' => __('Reports', 'wtotem'), 'slug' => $slug];
75 $pages['wtotem_documentation'] = [ 'title' => __('Documentation', 'wtotem'), 'slug' => 'wtotem'];
76
77 return $pages;
78 }
79
80 if (function_exists('add_action')) {
81 /**
82 * Display extension menu and submenu items in the correct interface.
83 *
84 * @return void
85 */
86 function wtotemAddMenu() {
87
88 $page = ! WebTotemOption::isActivated() ? 'activation' : ( WebTotem::isMultiSite() ? 'all_sites' : 'dashboard' );
89
90 add_menu_page(
91 __('WebTotem Security', 'wtotem'),
92 __('WebTotem Security', 'wtotem'),
93 'manage_options',
94 'wtotem',
95 'wtotem_' . $page . '_page',
96 WebTotem::getImagePath('logo_17x17_w.png')
97 );
98
99 if(WebTotemOption::isActivated()){
100 $pages = wtotemPages();
101 foreach ($pages as $sub_page_function => $sub_page) {
102 add_submenu_page(
103 $sub_page['slug'],
104 $sub_page['title'],
105 $sub_page['title'],
106 'manage_options',
107 $sub_page_function,
108 $sub_page_function . '_page'
109 );
110 }
111
112 } else {
113 add_submenu_page(
114 'wtotem',
115 __('Activation', 'wtotem'),
116 __('Activation', 'wtotem'),
117 'manage_options',
118 'wtotem_activation',
119 'wtotem_activation_page'
120 );
121 }
122 }
123
124 /* Attach HTTP request handlers for the internal plugin pages */
125 if(WebTotem::isMultiSite()){
126 add_action('network_admin_menu', 'wtotemAddMenu');
127 }
128 add_action('admin_menu', 'wtotemAddMenu');
129
130
131 }
132
133 }
134