siteguard-login-history-table.php
11 years ago
siteguard-menu-admin-filter.php
11 years ago
siteguard-menu-captcha.php
11 years ago
siteguard-menu-dashboard.php
11 years ago
siteguard-menu-disable-pingback.php
11 years ago
siteguard-menu-fail-once.php
11 years ago
siteguard-menu-init.php
11 years ago
siteguard-menu-login-alert.php
11 years ago
siteguard-menu-login-lock.php
11 years ago
siteguard-menu-rename-login.php
11 years ago
siteguard-menu-same-error.php
11 years ago
siteguard-menu-updates-notify.php
11 years ago
siteguard-menu-waf-tuning-support.php
11 years ago
siteguard-waf-exclude-rule-table.php
11 years ago
siteguard-menu-updates-notify.php
161 lines
| 1 | <?php |
| 2 | |
| 3 | class SiteGuard_Menu_Updates_Notify extends SiteGuard_Base { |
| 4 | function __construct( ) { |
| 5 | $this->render_page( ); |
| 6 | } |
| 7 | function is_notify_value( $value ) { |
| 8 | if ( '0' == $value || '1' == $value || '2' == $value ) { |
| 9 | return true; |
| 10 | } |
| 11 | return false; |
| 12 | } |
| 13 | function render_page( ) { |
| 14 | global $config, $updates_notify; |
| 15 | |
| 16 | $opt_name_enable = 'updates_notify_enable'; |
| 17 | $opt_name_wpcore = 'notify_wpcore'; |
| 18 | $opt_name_plugins = 'notify_plugins'; |
| 19 | $opt_name_themes = 'notify_themes'; |
| 20 | |
| 21 | $opt_val_enable = $config->get( $opt_name_enable ); |
| 22 | $opt_val_wpcore = $config->get( $opt_name_wpcore ); |
| 23 | $opt_val_plugins = $config->get( $opt_name_plugins ); |
| 24 | $opt_val_themes = $config->get( $opt_name_themes ); |
| 25 | if ( isset( $_POST['update'] ) && check_admin_referer( 'siteguard-menu-updates-notify-submit' ) ) { |
| 26 | $error = false; |
| 27 | $errors = check_multisite( ); |
| 28 | if ( is_wp_error( $errors ) ) { |
| 29 | echo '<div class="error settings-error"><p><strong>'; |
| 30 | esc_html_e( $errors->get_error_message( ), 'siteguard' ); |
| 31 | echo '</strong></p></div>'; |
| 32 | $error = true; |
| 33 | } |
| 34 | if ( ( false == $error ) |
| 35 | && ( ( false == $this->is_switch_value( $_POST[ $opt_name_enable ] ) ) |
| 36 | || ( false == $this->is_switch_value( $_POST[ $opt_name_wpcore ] ) ) |
| 37 | || ( false == $this->is_notify_value( $_POST[ $opt_name_plugins ] ) ) |
| 38 | || ( false == $this->is_notify_value( $_POST[ $opt_name_themes ] ) ) ) ) { |
| 39 | echo '<div class="error settings-error"><p><strong>'; |
| 40 | esc_html_e( 'ERROR: Invalid input value.', 'siteguard' ); |
| 41 | echo '</strong></p></div>'; |
| 42 | $error = true; |
| 43 | } |
| 44 | if ( false == $error && '1' == $_POST[ $opt_name_enable ] ) { |
| 45 | $ret = $updates_notify->check_requirements( ); |
| 46 | if ( is_wp_error( $ret ) ) { |
| 47 | echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message( ) . '</strong></p></div>'; |
| 48 | $error = true; |
| 49 | $config->set( $opt_name_enable, '0' ); |
| 50 | $config->update( ); |
| 51 | } |
| 52 | } |
| 53 | if ( false == $error ) { |
| 54 | $opt_val_enable = $_POST[ $opt_name_enable ]; |
| 55 | $opt_val_wpcore = $_POST[ $opt_name_wpcore ]; |
| 56 | $opt_val_plugins = $_POST[ $opt_name_plugins ]; |
| 57 | $opt_val_themes = $_POST[ $opt_name_themes ]; |
| 58 | $config->set( $opt_name_enable, $opt_val_enable ); |
| 59 | $config->set( $opt_name_wpcore, $opt_val_wpcore ); |
| 60 | $config->set( $opt_name_plugins, $opt_val_plugins ); |
| 61 | $config->set( $opt_name_themes, $opt_val_themes ); |
| 62 | $config->update( ); |
| 63 | if ( '1' == $opt_val_enable ) { |
| 64 | SiteGuard_UpdatesNotify::feature_on( ); |
| 65 | } else { |
| 66 | SiteGuard_UpdatesNotify::feature_off( ); |
| 67 | } |
| 68 | ?> |
| 69 | <div class="updated"><p><strong><?php esc_html_e( 'Options saved.', 'siteguard' ); ?></strong></p></div> |
| 70 | <?php |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | echo '<div class="wrap">'; |
| 75 | echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />'; |
| 76 | echo '<h2>' . esc_html__( 'Updates Notify', 'siteguard' ) . '</h2>'; |
| 77 | echo '<div class="siteguard-description">' |
| 78 | . esc_html__( 'You can find docs about this function on ', 'siteguard' ) |
| 79 | . '<a href="' . esc_html__( 'http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify_en.html', 'siteguard' ) |
| 80 | . '" target="_blank">' |
| 81 | . esc_html__( 'here', 'siteguard' ) |
| 82 | . '</a>' |
| 83 | . esc_html__( '.', 'siteguard' ) |
| 84 | . '</div>'; |
| 85 | ?> |
| 86 | <form name="form1" method="post" action=""> |
| 87 | <table class="form-table"> |
| 88 | <tr> |
| 89 | <th scope="row" colspan="2"> |
| 90 | <ul class="siteguard-radios"> |
| 91 | <li> |
| 92 | <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_on' ?>" value="1" <?php echo ( '1' == $opt_val_enable ? 'checked' : '') ?> > |
| 93 | <label for="<?php echo $opt_name_enable.'_on' ?>"><?php esc_html_e( 'ON', 'siteguard' ) ?></label> |
| 94 | </li><li> |
| 95 | <input type="radio" name="<?php echo $opt_name_enable ?>" id="<?php echo $opt_name_enable.'_off' ?>" value="0" <?php echo ( '0' == $opt_val_enable ? 'checked' : '') ?> > |
| 96 | <label for="<?php echo $opt_name_enable.'_off' ?>"><?php esc_html_e( 'OFF', 'siteguard' ) ?></label> |
| 97 | </li> |
| 98 | </ul> |
| 99 | <?php |
| 100 | $error = $updates_notify->check_requirements( ); |
| 101 | if ( is_wp_error( $error ) ) { |
| 102 | echo '<p class="description">'; |
| 103 | echo $error->get_error_message( ); |
| 104 | echo '</p>'; |
| 105 | } |
| 106 | ?> |
| 107 | </th> |
| 108 | </tr><tr> |
| 109 | <th scope="row"><?php esc_html_e( 'WordPress updates', 'siteguard' ); ?></th> |
| 110 | <td> |
| 111 | <input type="radio" name="<?php echo $opt_name_wpcore ?>" id="<?php echo $opt_name_wpcore.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_wpcore ? 'checked' : '') ?> > |
| 112 | <label for="<?php echo $opt_name_wpcore.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label> |
| 113 | <br /> |
| 114 | <input type="radio" name="<?php echo $opt_name_wpcore ?>" id="<?php echo $opt_name_wpcore.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_wpcore ? 'checked' : '') ?> > |
| 115 | <label for="<?php echo $opt_name_wpcore.'_1' ?>"><?php esc_html_e( 'Enable', 'siteguard' ) ?></label> |
| 116 | </td> |
| 117 | </tr><tr> |
| 118 | <th scope="row"><?php esc_html_e( 'Plugins updates', 'siteguard' ); ?></th> |
| 119 | <td> |
| 120 | <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_plugins ? 'checked' : '') ?> > |
| 121 | <label for="<?php echo $opt_name_plugins.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label> |
| 122 | <br /> |
| 123 | <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_plugins ? 'checked' : '') ?> > |
| 124 | <label for="<?php echo $opt_name_plugins.'_1' ?>"><?php esc_html_e( 'All plugins', 'siteguard' ) ?></label> |
| 125 | <br /> |
| 126 | <input type="radio" name="<?php echo $opt_name_plugins ?>" id="<?php echo $opt_name_plugins.'_2' ?>" value="2" <?php echo ( '2' == $opt_val_plugins ? 'checked' : '') ?> > |
| 127 | <label for="<?php echo $opt_name_plugins.'_2' ?>"><?php esc_html_e( 'Active plugins only', 'siteguard' ) ?></label> |
| 128 | </td> |
| 129 | </tr><tr> |
| 130 | <th scope="row"><?php esc_html_e( 'Themes updates', 'siteguard' ); ?></th> |
| 131 | <td> |
| 132 | <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_0' ?>" value="0" <?php echo ( '0' == $opt_val_themes ? 'checked' : '') ?> > |
| 133 | <label for="<?php echo $opt_name_themes.'_0' ?>"><?php esc_html_e( 'Disable', 'siteguard' ) ?></label> |
| 134 | <br /> |
| 135 | <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_1' ?>" value="1" <?php echo ( '1' == $opt_val_themes ? 'checked' : '') ?> > |
| 136 | <label for="<?php echo $opt_name_themes.'_1' ?>"><?php esc_html_e( 'All themes', 'siteguard' ) ?></label> |
| 137 | <br /> |
| 138 | <input type="radio" name="<?php echo $opt_name_themes ?>" id="<?php echo $opt_name_themes.'_2' ?>" value="2" <?php echo ( '2' == $opt_val_themes ? 'checked' : '') ?> > |
| 139 | <label for="<?php echo $opt_name_themes.'_2' ?>"><?php esc_html_e( 'Active themes only', 'siteguard' ) ?></label> |
| 140 | </td> |
| 141 | </tr> |
| 142 | </table> |
| 143 | <div class="siteguard-description"> |
| 144 | <?php esc_html_e( 'Basic of security is that always you use the latest version. If WordPress core, plugins, and themes updates are needed , sends email to notify administrators. Check for updates will be run every 24 hours.', 'siteguard' ) ?> |
| 145 | </div> |
| 146 | <hr /> |
| 147 | <input type="hidden" name="update" value="Y"> |
| 148 | |
| 149 | <?php |
| 150 | wp_nonce_field( 'siteguard-menu-updates-notify-submit' ); |
| 151 | submit_button( ); |
| 152 | ?> |
| 153 | |
| 154 | </form> |
| 155 | </div> |
| 156 | |
| 157 | <?php |
| 158 | } |
| 159 | } |
| 160 | ?> |
| 161 |