PluginProbe ʕ •ᴥ•ʔ
SiteGuard WP Plugin / 1.8.7
SiteGuard WP Plugin v1.8.7
1.8.7 1.8.6 1.8.6-beta1 1.8.6-beta2 1.8.4 1.8.5 1.8.3 1.8.2 1.8.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.4.3 1.5.0 1.5.1 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 1.7.10 1.7.11 1.7.12 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8.0 1.8.0-beta1 1.8.0-beta2 1.8.0-beta3 1.8.0-beta4
siteguard / admin / siteguard-menu-updates-notify.php
siteguard / admin Last commit date
siteguard-login-history-table.php 1 month ago siteguard-menu-admin-filter.php 4 weeks ago siteguard-menu-author-query.php 2 weeks ago siteguard-menu-captcha.php 4 weeks ago siteguard-menu-dashboard.php 4 weeks ago siteguard-menu-fail-once.php 4 weeks ago siteguard-menu-init.php 1 month ago siteguard-menu-login-alert.php 4 weeks ago siteguard-menu-login-history.php 4 weeks ago siteguard-menu-login-lock.php 4 weeks ago siteguard-menu-protect-xmlrpc.php 4 weeks ago siteguard-menu-rename-login.php 2 weeks ago siteguard-menu-same-error.php 4 weeks ago siteguard-menu-updates-notify.php 4 weeks ago siteguard-menu-waf-tuning-support.php 4 weeks ago siteguard-waf-exclude-rule-table.php 1 month ago
siteguard-menu-updates-notify.php
161 lines
1 <?php
2
3 class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base {
4 const OPT_NAME_ENABLE = 'updates_notify_enable';
5 const OPT_NAME_WPCORE = 'notify_wpcore';
6 const OPT_NAME_PLUGINS = 'notify_plugins';
7 const OPT_NAME_THEMES = 'notify_themes';
8
9 function __construct() {
10 $this->render_page();
11 }
12 function is_notify_value( $value ) {
13 $items = array( '0', '1', '2' );
14 if ( in_array( $value, $items ) ) {
15 return true;
16 }
17 return false;
18 }
19 function render_page() {
20 global $siteguard_config, $siteguard_updates_notify;
21
22 $opt_val_enable = $siteguard_config->get( self::OPT_NAME_ENABLE );
23 $opt_val_wpcore = $siteguard_config->get( self::OPT_NAME_WPCORE );
24 $opt_val_plugins = $siteguard_config->get( self::OPT_NAME_PLUGINS );
25 $opt_val_themes = $siteguard_config->get( self::OPT_NAME_THEMES );
26 if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-updates-notify-submit' ) ) {
27 $error = false;
28 $errors = siteguard_check_multisite();
29 if ( is_wp_error( $errors ) ) {
30 echo '<div class="error settings-error"><p><strong>';
31 echo esc_html( $errors->get_error_message() );
32 echo '</strong></p></div>';
33 $error = true;
34 }
35 if ( ( false === $error )
36 && ( ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_ENABLE ] ) )
37 || ( false === $this->is_switch_value( $_POST[ self::OPT_NAME_WPCORE ] ) )
38 || ( false === $this->is_notify_value( $_POST[ self::OPT_NAME_PLUGINS ] ) )
39 || ( false === $this->is_notify_value( $_POST[ self::OPT_NAME_THEMES ] ) ) ) ) {
40 echo '<div class="error settings-error"><p><strong>';
41 esc_html_e( 'ERROR: Invalid input value.', 'siteguard' );
42 echo '</strong></p></div>';
43 $error = true;
44 }
45 if ( false === $error && '1' === $_POST[ self::OPT_NAME_ENABLE ] ) {
46 $ret = $siteguard_updates_notify->check_requirements();
47 if ( is_wp_error( $ret ) ) {
48 echo '<div class="error settings-error"><p><strong>' . esc_html( $ret->get_error_message() ) . '</strong></p></div>';
49 $error = true;
50 $siteguard_config->set( self::OPT_NAME_ENABLE, '0' );
51 $siteguard_config->update();
52 }
53 }
54 if ( false === $error ) {
55 $opt_val_enable = sanitize_text_field( $_POST[ self::OPT_NAME_ENABLE ] );
56 $opt_val_wpcore = sanitize_text_field( $_POST[ self::OPT_NAME_WPCORE ] );
57 $opt_val_plugins = sanitize_text_field( $_POST[ self::OPT_NAME_PLUGINS ] );
58 $opt_val_themes = sanitize_text_field( $_POST[ self::OPT_NAME_THEMES ] );
59 $siteguard_config->set( self::OPT_NAME_ENABLE, $opt_val_enable );
60 $siteguard_config->set( self::OPT_NAME_WPCORE, $opt_val_wpcore );
61 $siteguard_config->set( self::OPT_NAME_PLUGINS, $opt_val_plugins );
62 $siteguard_config->set( self::OPT_NAME_THEMES, $opt_val_themes );
63 $siteguard_config->update();
64 if ( '1' === $opt_val_enable ) {
65 SiteGuard_UpdatesNotify::feature_on();
66 } else {
67 SiteGuard_UpdatesNotify::feature_off();
68 }
69 ?>
70 <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div>
71 <?php
72 }
73 }
74
75 echo '<div class="wrap">';
76 echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
77 echo '<h2>' . esc_html__( 'Update Notifications', 'siteguard' ) . '</h2>';
78 $documentation_link = '<a href="' . esc_url( __( 'https://www.jp-secure.com/siteguard_wp_plugin_en/howto/updates_notify/', 'siteguard' ) ) . '" target="_blank">' . esc_html__( 'online documentation', 'siteguard' ) . '</a>';
79 echo '<div class="siteguard-description">'
80 . sprintf(
81 /* translators: %1$s: Link to the online documentation. */
82 esc_html__( 'See the %1$s.', 'siteguard' ),
83 $documentation_link
84 )
85 . '</div>';
86 ?>
87 <form name="form1" method="post" action="">
88 <table class="form-table">
89 <tr>
90 <th scope="row" colspan="2">
91 <ul class="siteguard-radios">
92 <li>
93 <input type="radio" name="<?php echo self::OPT_NAME_ENABLE; ?>" id="<?php echo self::OPT_NAME_ENABLE . '_on'; ?>" value="1" <?php checked( $opt_val_enable, '1' ); ?> >
94 <label for="<?php echo self::OPT_NAME_ENABLE . '_on'; ?>"><?php esc_html_e( 'ON', 'siteguard' ); ?></label>
95 </li><li>
96 <input type="radio" name="<?php echo self::OPT_NAME_ENABLE; ?>" id="<?php echo self::OPT_NAME_ENABLE . '_off'; ?>" value="0" <?php checked( $opt_val_enable, '0' ); ?> >
97 <label for="<?php echo self::OPT_NAME_ENABLE . '_off'; ?>"><?php esc_html_e( 'OFF', 'siteguard' ); ?></label>
98 </li>
99 </ul>
100 <?php
101 $error = $siteguard_updates_notify->check_requirements();
102 if ( is_wp_error( $error ) ) {
103 echo '<p class="description">';
104 echo esc_html( $error->get_error_message() );
105 echo '</p>';
106 }
107 ?>
108 </th>
109 </tr><tr>
110 <th scope="row"><?php esc_html_e( 'WordPress updates', 'siteguard' ); ?></th>
111 <td>
112 <input type="radio" name="<?php echo self::OPT_NAME_WPCORE; ?>" id="<?php echo self::OPT_NAME_WPCORE . '_0'; ?>" value="0" <?php checked( $opt_val_wpcore, '0' ); ?> >
113 <label for="<?php echo self::OPT_NAME_WPCORE . '_0'; ?>"><?php esc_html_e( 'Disable', 'siteguard' ); ?></label>
114 <br />
115 <input type="radio" name="<?php echo self::OPT_NAME_WPCORE; ?>" id="<?php echo self::OPT_NAME_WPCORE . '_1'; ?>" value="1" <?php checked( $opt_val_wpcore, '1' ); ?> >
116 <label for="<?php echo self::OPT_NAME_WPCORE . '_1'; ?>"><?php esc_html_e( 'Enable', 'siteguard' ); ?></label>
117 </td>
118 </tr><tr>
119 <th scope="row"><?php esc_html_e( 'Plugin updates', 'siteguard' ); ?></th>
120 <td>
121 <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS; ?>" id="<?php echo self::OPT_NAME_PLUGINS . '_0'; ?>" value="0" <?php checked( $opt_val_plugins, '0' ); ?> >
122 <label for="<?php echo self::OPT_NAME_PLUGINS . '_0'; ?>"><?php esc_html_e( 'Disable', 'siteguard' ); ?></label>
123 <br />
124 <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS; ?>" id="<?php echo self::OPT_NAME_PLUGINS . '_1'; ?>" value="1" <?php checked( $opt_val_plugins, '1' ); ?> >
125 <label for="<?php echo self::OPT_NAME_PLUGINS . '_1'; ?>"><?php esc_html_e( 'All plugins', 'siteguard' ); ?></label>
126 <br />
127 <input type="radio" name="<?php echo self::OPT_NAME_PLUGINS; ?>" id="<?php echo self::OPT_NAME_PLUGINS . '_2'; ?>" value="2" <?php checked( $opt_val_plugins, '2' ); ?> >
128 <label for="<?php echo self::OPT_NAME_PLUGINS . '_2'; ?>"><?php esc_html_e( 'Active plugins only', 'siteguard' ); ?></label>
129 </td>
130 </tr><tr>
131 <th scope="row"><?php esc_html_e( 'Theme updates', 'siteguard' ); ?></th>
132 <td>
133 <input type="radio" name="<?php echo self::OPT_NAME_THEMES; ?>" id="<?php echo self::OPT_NAME_THEMES . '_0'; ?>" value="0" <?php checked( $opt_val_themes, '0' ); ?> >
134 <label for="<?php echo self::OPT_NAME_THEMES . '_0'; ?>"><?php esc_html_e( 'Disable', 'siteguard' ); ?></label>
135 <br />
136 <input type="radio" name="<?php echo self::OPT_NAME_THEMES; ?>" id="<?php echo self::OPT_NAME_THEMES . '_1'; ?>" value="1" <?php checked( $opt_val_themes, '1' ); ?> >
137 <label for="<?php echo self::OPT_NAME_THEMES . '_1'; ?>"><?php esc_html_e( 'All themes', 'siteguard' ); ?></label>
138 <br />
139 <input type="radio" name="<?php echo self::OPT_NAME_THEMES; ?>" id="<?php echo self::OPT_NAME_THEMES . '_2'; ?>" value="2" <?php checked( $opt_val_themes, '2' ); ?> >
140 <label for="<?php echo self::OPT_NAME_THEMES . '_2'; ?>"><?php esc_html_e( 'Active themes only', 'siteguard' ); ?></label>
141 </td>
142 </tr>
143 </table>
144 <div class="siteguard-description">
145 <?php esc_html_e( 'Keeping WordPress core, plugins, and themes up to date is a basic security practice. This feature checks for updates every 24 hours and emails administrators when updates are available.', 'siteguard' ); ?>
146 </div>
147 <hr />
148 <input type="hidden" name="update" value="Y">
149
150 <?php
151 wp_nonce_field( 'siteguard-menu-updates-notify-submit' );
152 submit_button();
153 ?>
154
155 </form>
156 </div>
157
158 <?php
159 }
160 }
161