PluginProbe ʕ •ᴥ•ʔ
NinjaFirewall (WP Edition) – Advanced Security Plugin and Firewall / trunk
NinjaFirewall (WP Edition) – Advanced Security Plugin and Firewall vtrunk
4.8.7 4.8.6 trunk 4.5 4.5.1 4.5.10 4.5.11 4.5.2 4.5.3 4.5.4 4.5.5 4.5.6 4.5.7 4.5.8 4.5.9 4.6 4.6.1 4.7 4.7.1 4.7.2 4.7.3 4.7.4 4.7.5 4.8 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5
ninjafirewall / lib / widget.php
ninjafirewall / lib Last commit date
share 8 years ago .htaccess 11 years ago anti_malware.php 4 years ago class-coupon.php 5 months ago class-email-sodium.php 5 days ago class-firewall-log.php 2 days ago class-helpers.php 7 months ago class-import-export.php 2 months ago class-ip.php 3 months ago class-nfw-database.php 5 months ago class-nfw-session.php 7 months ago class-php-session.php 1 year ago class_mail.php 5 days ago event_updates.php 9 months ago firewall.php 3 months ago fw_centlog.php 3 months ago fw_fileguard.php 3 months ago fw_livelog.php 1 year ago help.php 5 days ago helpers.php 3 weeks ago i18n-extra.php 5 days ago i18n.php 1 year ago index.html 13 years ago init_update.php 1 year ago install.php 1 year ago install_default.php 5 months ago loader.php 5 months ago mail_template_firewall.php 1 year ago mail_template_plugin.php 3 weeks ago scheduled_tasks.php 3 years ago settings_dashboard.php 3 weeks ago settings_dashboard_about.php 5 days ago settings_dashboard_statistics.php 3 weeks ago settings_event_notifications.php 3 weeks ago settings_events.php 3 weeks ago settings_firewall_options.php 3 weeks ago settings_firewall_policies.php 3 weeks ago settings_login_protection.php 3 weeks ago settings_logs.php 3 weeks ago settings_logs_firewall_log.php 5 days ago settings_logs_live_log.php 3 weeks ago settings_monitoring.php 5 days ago settings_monitoring_file_check.php 3 weeks ago settings_monitoring_file_guard.php 3 weeks ago settings_network.php 3 weeks ago settings_security_rules.php 3 weeks ago settings_security_rules_editor.php 3 weeks ago settings_security_rules_update.php 3 weeks ago sign.pub 7 years ago thickbox.php 4 years ago widget.php 3 years ago wpplus.php 2 months ago
widget.php
102 lines
1 <?php
2 /*
3 +---------------------------------------------------------------------+
4 | NinjaFirewall (WP Edition) |
5 | |
6 | (c) NinTechNet - https://nintechnet.com/ |
7 +---------------------------------------------------------------------+
8 | This program is free software: you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License as |
10 | published by the Free Software Foundation, either version 3 of |
11 | the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 +---------------------------------------------------------------------+ i18n++ / sa2
18 */
19
20 if (! defined( 'NFW_ENGINE_VERSION' ) ) {
21 header('HTTP/1.1 404 Not Found');
22 header('Status: 404 Not Found');
23 exit;
24 }
25
26 // Return immediately if user is not allowed (only the admin can see the widget):
27 if (nf_not_allowed( 0, __LINE__ ) ) { return; }
28
29 wp_add_dashboard_widget( 'nfw_dashboard_welcome', esc_html__('NinjaFirewall Statistics', 'ninjafirewall'), 'nfw_stats_widget' );
30
31 global $wp_meta_boxes;
32 if ( is_multisite() ) {
33 $dashboard = 'dashboard-network';
34 } else {
35 $dashboard = 'dashboard';
36 }
37 if (! empty( $wp_meta_boxes[$dashboard]['normal']['core'] ) ) {
38 $wpmb = $wp_meta_boxes[$dashboard]['normal']['core'];
39 $nfwidget = ['nfw_dashboard_welcome' => $wpmb['nfw_dashboard_welcome'] ];
40 $wp_meta_boxes[$dashboard]['normal']['core'] = array_merge( $nfwidget, $wpmb );
41 }
42
43 function nfw_stats_widget() {
44
45 $stat_file = NFW_LOG_DIR . '/nfwlog/stats_' . date( 'Y-m' ) . '.php';
46 if ( file_exists( $stat_file ) ) {
47 $nfw_stat = file_get_contents( $stat_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
48 $nfw_stat = str_replace( '<?php exit; ?>', '', $nfw_stat );
49 } else {
50 $nfw_stat = '0:0:0:0:0:0:0:0:0:0';
51 }
52 list($tmp, $medium, $high, $critical) = explode(':', $nfw_stat . ':');
53 $medium = (int) $medium;
54 $high = (int) $high;
55 $critical = (int) $critical;
56 $total = $critical + $high + $medium;
57 if ( $total ) {
58 $coef = 100 / $total;
59 $critical = round( $critical * $coef, 2);
60 $high = round( $high * $coef, 2);
61 $medium = round( $medium * $coef, 2);
62 }
63 echo '
64 <table border="0" width="100%">
65 <tr>
66 <th width="50%" align="left"><h3>' . esc_html__('Blocked threats', 'ninjafirewall') .'</h3></th>
67 <td width="50%" align="left">' . number_format_i18n( $total ) . '</td>
68 </tr>
69 <tr>
70 <th width="50%" align="left"><h3>' . esc_html__('Threats level', 'ninjafirewall') .'</h3></th>
71 <td width="50%" align="left">
72 <i>' . esc_html__('Critical:', 'ninjafirewall') . ' ' . $critical . '%</i>
73 <br />
74 <table bgcolor="#DFDFDF" border="0" cellpadding="0" cellspacing="0" height="14" width="100%" align="left" style="height:14px;">
75 <tr>
76 <td width="' . round( $critical) . '%" background="' . plugins_url() . '/ninjafirewall/images/bar-critical.png" style="padding:0px"></td><td width="' . round(100 - $critical) . '%" style="padding:0px"></td>
77 </tr>
78 </table>
79 <br />
80 <i>' . esc_html__('High:', 'ninjafirewall') . ' ' . $high . '%</i>
81 <br />
82 <table bgcolor="#DFDFDF" border="0" cellpadding="0" cellspacing="0" height="14" width="100%" align="left" style="height:14px;">
83 <tr>
84 <td width="' . round( $high) . '%" background="' . plugins_url() . '/ninjafirewall/images/bar-high.png" style="padding:0px"></td><td width="' . round(100 - $high) . '%" style="padding:0px"></td>
85 </tr>
86 </table>
87 <br />
88 <i>' . esc_html__('Medium:', 'ninjafirewall') . ' ' . $medium . '%</i>
89 <br />
90 <table bgcolor="#DFDFDF" border="0" cellpadding="0" cellspacing="0" height="14" width="100%" align="left" style="height:14px;">
91 <tr>
92 <td width="' . round( $medium) . '%" background="' . plugins_url() . '/ninjafirewall/images/bar-medium.png" style="padding:0px;"></td><td width="' . round(100 - $medium) . '%" style="padding:0px;"></td>
93 </tr>
94 </table>
95 </td>
96 </tr>
97 </table>
98 <div align="right" class="activity-block"><a style="text-decoration:none" href="admin.php?page=NinjaFirewall&tab=statistics">' . esc_html__('View statistics', 'ninjafirewall') .'</a>&nbsp;&nbsp;-&nbsp;&nbsp;<a style="text-decoration:none" href="admin.php?page=nfsublog">' . esc_html__('View firewall log', 'ninjafirewall') .'</a></div>';
99 }
100 // =====================================================================
101 // EOF
102