function init()
 {
     global $config;
     if (true === check_multisite()) {
         $config->set('disable_pingback_enable', '1');
     } else {
         $config->set('disable_pingback_enable', '0');
     }
     $config->update();
 }
 function init()
 {
     global $config;
     if (true === check_multisite()) {
         $config->set('loginalert_enable', '1');
     } else {
         $config->set('loginalert_enable', '0');
     }
     $config->set('loginalert_admin_only', '1');
     $config->set('loginalert_subject', __('New login at %SITENAME%', 'siteguard'));
     $config->set('loginalert_body', __("%USERNAME% logged in at %DATE% %TIME%\n\n== Login information ==\nIP Address: %IPADDRESS%\nReferer: %REFERER%\nUser-Agent: %USERAGENT%\n\n--\nSiteGuard WP Plugin", 'siteguard'));
     $config->update();
 }
 function init()
 {
     global $config;
     $config->set('renamelogin_path', 'login_' . sprintf('%05d', mt_rand(1, 99999)));
     if ($this->check_module('rewrite') && null == $this->get_active_incompatible_plugin() && true === check_multisite()) {
         $config->set('renamelogin_enable', '1');
         $config->update();
         $this->feature_on();
     } else {
         $config->set('renamelogin_enable', '0');
         $config->update();
     }
 }
 function init()
 {
     global $config;
     if (true === check_multisite()) {
         $config->set('loginlock_enable', '1');
     } else {
         $config->set('loginlock_enable', '0');
     }
     $config->set('loginlock_interval', '5');
     $config->set('loginlock_threshold', '3');
     $config->set('loginlock_locksec', '60');
     $config->set('loginlock_fail_once', '0');
     $config->set('fail_once_admin_only', '1');
     $config->update();
 }
 public function check_requirements()
 {
     $error = check_multisite();
     if (is_wp_error($error)) {
         return $error;
     }
     $error = self::check_disable_wp_cron();
     if (is_wp_error($error)) {
         return $error;
     }
     $error = self::check_wp_cron_access();
     if (is_wp_error($error)) {
         return $error;
     }
     return true;
 }
    function render_page()
    {
        global $config, $updates_notify;
        $opt_name_enable = 'updates_notify_enable';
        $opt_name_wpcore = 'notify_wpcore';
        $opt_name_plugins = 'notify_plugins';
        $opt_name_themes = 'notify_themes';
        $opt_val_enable = $config->get($opt_name_enable);
        $opt_val_wpcore = $config->get($opt_name_wpcore);
        $opt_val_plugins = $config->get($opt_name_plugins);
        $opt_val_themes = $config->get($opt_name_themes);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-updates-notify-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && (false == $this->is_switch_value($_POST[$opt_name_enable]) || false == $this->is_switch_value($_POST[$opt_name_wpcore]) || false == $this->is_notify_value($_POST[$opt_name_plugins]) || false == $this->is_notify_value($_POST[$opt_name_themes]))) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_enable]) {
                $ret = $updates_notify->check_requirements();
                if (is_wp_error($ret)) {
                    echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message() . '</strong></p></div>';
                    $error = true;
                    $config->set($opt_name_enable, '0');
                    $config->update();
                }
            }
            if (false == $error) {
                $opt_val_enable = $_POST[$opt_name_enable];
                $opt_val_wpcore = $_POST[$opt_name_wpcore];
                $opt_val_plugins = $_POST[$opt_name_plugins];
                $opt_val_themes = $_POST[$opt_name_themes];
                $config->set($opt_name_enable, $opt_val_enable);
                $config->set($opt_name_wpcore, $opt_val_wpcore);
                $config->set($opt_name_plugins, $opt_val_plugins);
                $config->set($opt_name_themes, $opt_val_themes);
                $config->update();
                if ('1' == $opt_val_enable) {
                    SiteGuard_UpdatesNotify::feature_on();
                } else {
                    SiteGuard_UpdatesNotify::feature_off();
                }
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Updates Notify', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/updates_notify_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_on';
        ?>
"><?php 
        esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_off';
        ?>
"><?php 
        esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = $updates_notify->check_requirements();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('WordPress updates', 'siteguard');
        ?>
</th>
			<td>
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_wpcore . '_0';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
				<br />
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_wpcore . '_1';
        ?>
"><?php 
        esc_html_e('Enable', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Plugins updates', 'siteguard');
        ?>
</th>
			<td>
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_plugins . '_0';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
				<br />
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_plugins . '_1';
        ?>
"><?php 
        esc_html_e('All plugins', 'siteguard');
        ?>
</label>
				<br />
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_plugins . '_2';
        ?>
"><?php 
        esc_html_e('Active plugins only', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Themes updates', 'siteguard');
        ?>
</th>
			<td>
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_themes . '_0';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
				<br />
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_themes . '_1';
        ?>
"><?php 
        esc_html_e('All themes', 'siteguard');
        ?>
</label>
				<br />
				<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' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_themes . '_2';
        ?>
"><?php 
        esc_html_e('Active themes only', 'siteguard');
        ?>
</label>
			</td>
		</tr>
		</table>
		<div class="siteguard-description">
		<?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');
        ?>
		</div>
		<hr />
		<input type="hidden" name="update" value="Y">

		<?php 
        wp_nonce_field('siteguard-menu-updates-notify-submit');
        submit_button();
        ?>

		</form>
		</div>

		<?php 
    }
    function render_page()
    {
        global $waf_exclude_rule;
        isset($_GET['action']) ? $action = $_GET['action'] : ($action = 'list');
        if ('list' == $action && isset($_POST['action'])) {
            $action = $_POST['action'];
        }
        if ('list' != $action && 'add' != $action && 'edit' != $action && 'delete' != $action) {
            $action = 'list';
        }
        $waf_exclude_rule_enable = $waf_exclude_rule->get_enable();
        if ('edit' == $action && isset($_GET['rule'])) {
            $offset = 0;
            $id = intval($_GET['rule']);
            $rule = $waf_exclude_rule->get_rule($id, $offset);
            if (false === $rule) {
                $filename = '';
                $sig = '';
                $comment = '';
            } else {
                $filename = $rule['filename'];
                $sig = $rule['sig'];
                $comment = $rule['comment'];
            }
        } else {
            if ('delete' == $action) {
                if (isset($_GET['rule'])) {
                    $ids = array($_GET['rule']);
                } else {
                    if (isset($_POST['rule'])) {
                        $ids = $_POST['rule'];
                    }
                }
            } else {
                $filename = '';
                $sig = '';
                $comment = '';
            }
        }
        if (isset($_POST['update'])) {
            $update = $_POST['update'];
            switch ($update) {
                case 'add':
                    if (check_admin_referer('siteguard-menu-waf-tuning-support-add')) {
                        $error = false;
                        $errors = check_multisite();
                        if (is_wp_error($errors)) {
                            $error = true;
                        }
                        if (true == $error || !isset($_POST['filename']) || !isset($_POST['sig']) || !isset($_POST['comment'])) {
                            // error
                        } else {
                            $filename = $this->set_filename(stripslashes($_POST['filename']));
                            $sig = stripslashes($_POST['sig']);
                            $comment = stripslashes($_POST['comment']);
                            $errors = $waf_exclude_rule->add_rule($filename, $sig, $comment);
                            if (!is_wp_error($errors)) {
                                if ($waf_exclude_rule_enable) {
                                    $waf_exclude_rule->feature_on();
                                }
                                echo '<div class="updated"><p><strong>' . esc_html__('New rule created', 'siteguard') . '</strong></p></div>';
                                $action = 'list';
                                $this->wp_list_table->prepare_items();
                            } else {
                                $action = 'add';
                            }
                        }
                    }
                    break;
                case 'edit':
                    if (check_admin_referer('siteguard-menu-waf-tuning-support-edit')) {
                        if (!isset($_POST['rule']) || !isset($_POST['filename']) || !isset($_POST['sig']) || !isset($_POST['comment'])) {
                            // error
                        } else {
                            $id = $_POST['rule'];
                            $filename = $this->set_filename(stripslashes($_POST['filename']));
                            $sig = stripslashes($_POST['sig']);
                            $comment = stripslashes($_POST['comment']);
                            $errors = $waf_exclude_rule->set_rule($id, $filename, $sig, $comment);
                            if (!is_wp_error($errors)) {
                                if ($waf_exclude_rule_enable) {
                                    $waf_exclude_rule->feature_on();
                                }
                                echo '<div class="updated"><p><strong>' . esc_html__('Rule updated', 'siteguard') . '</strong></p></div>';
                                $action = 'list';
                                $this->wp_list_table->prepare_items();
                            } else {
                                $action = 'edit';
                            }
                        }
                    }
                    break;
                case 'delete':
                    if (check_admin_referer('siteguard-menu-waf-tuning-support-delete')) {
                        if (!isset($_POST['rule'])) {
                            // error
                        } else {
                            $ids = $_POST['rule'];
                            $waf_exclude_rule->delete_rule($ids);
                            if ($waf_exclude_rule_enable) {
                                $waf_exclude_rule->feature_on();
                            }
                            echo '<div class="updated"><p><strong>' . esc_html__('Rule deleted', 'siteguard') . '</strong></p></div>';
                            $action = 'list';
                            $this->wp_list_table->prepare_items();
                        }
                    }
                    break;
                case 'apply':
                    if (isset($_POST['action']) && 'delete' == $_POST['action']) {
                        break;
                    }
                    if (check_admin_referer('siteguard-menu-waf-tuning-support-apply')) {
                        if (!isset($_POST['waf_exclude_rule_enable'])) {
                            // error
                        } else {
                            $error = false;
                            $errors = check_multisite();
                            if (is_wp_error($errors)) {
                                $error = true;
                            }
                            if (false == $error && '1' == $_POST['waf_exclude_rule_enable'] && false == $this->check_module('siteguard')) {
                                echo '<div class="error settings-error"><p><strong>';
                                esc_html_e('To use the WAF exclude rule, WAF ( SiteGuard Lite ) should be installed on Apache.', 'siteguard');
                                echo '</strong></p></div>';
                                $error = true;
                                $waf_exclude_rule->set_enable('0');
                                $waf_exclude_rule->feature_off();
                                $waf_exclude_rule_enable = '0';
                            }
                            if (false == $error && false == $this->is_switch_value($_POST['waf_exclude_rule_enable'])) {
                                echo '<div class="error settings-error"><p><strong>';
                                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                                echo '</strong></p></div>';
                                $error = true;
                            }
                            if (false == $error) {
                                $waf_exclude_rule_enable = $_POST['waf_exclude_rule_enable'];
                                $waf_exclude_rule->set_enable($waf_exclude_rule_enable);
                                if ('1' == $waf_exclude_rule_enable) {
                                    $waf_exclude_rule->feature_on();
                                    echo '<div class="updated"><p><strong>' . esc_html__('Rules applied', 'siteguard') . '</strong></p></div>';
                                } else {
                                    $waf_exclude_rule->feature_off();
                                    echo '<div class="updated"><p><strong>' . esc_html__('Rules unapplied', 'siteguard') . '</strong></p></div>';
                                }
                            }
                        }
                    }
                    break;
                default:
            }
        } else {
            if ('delete' == $action) {
                if (isset($_GET['rule'])) {
                    $ids = array($_GET['rule']);
                } else {
                    if (isset($_POST['rule'])) {
                        $ids = $_POST['rule'];
                    }
                }
            }
        }
        if (isset($errors) && is_wp_error($errors)) {
            ?>
			<div class="error">
			<ul>
			<?php 
            foreach ($errors->get_error_messages() as $err) {
                echo "<li>{$err}</li>\n";
            }
            ?>
			</ul>
			</div>
			<?php 
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        switch ($action) {
            case 'list':
                echo '<h2>' . esc_html__('WAF Tuning Support', 'siteguard') . ' <a href="?page=siteguard_waf_tuning_support&action=add" class="add-new-h2">' . esc_html__('Add New', 'siteguard') . '</a></h2>';
                echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/waf_tuning_support_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
                ?>
				<form name="form1" method="post" action="">
				<table class="form-table">
				<tr>
				<th scope="row" colspan="2">
					<ul class="siteguard-radios">
					<li>
					<input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_on" value="1" <?php 
                echo '1' == $waf_exclude_rule_enable ? 'checked' : '';
                ?>
 >
					<label for="waf_exclude_rule_enable_on"><?php 
                esc_html_e('ON', 'siteguard');
                ?>
</label>
					</li><li>
					<input type="radio" name="waf_exclude_rule_enable" id="waf_exclude_rule_enable_off" value="0" <?php 
                echo '0' == $waf_exclude_rule_enable ? 'checked' : '';
                ?>
 >
					<label for="waf_exclude_rule_enable_off"><?php 
                esc_html_e('OFF', 'siteguard');
                ?>
</label>
					</li>
					</ul>
					<?php 
                $error = check_multisite();
                if (is_wp_error($error)) {
                    echo '<p class="description">';
                    echo $error->get_error_message();
                    echo '</p>';
                }
                echo '<p class="description">';
                esc_html_e('To use the WAF Tuning Support, WAF ( SiteGuard Lite ) should be installed on Apache.', 'siteguard');
                echo '</p>';
                ?>
				</th>
				</table>
				<?php 
                $this->wp_list_table->display();
                ?>
				<div class="siteguard-description">
				<?php 
                esc_html_e('It is the function to create the rule to avoid the false detection in WordPress (including 403 error occurrence with normal access,) if WAF ( SiteGuard Lite ) by JP-Secure is installed on a Web server. WAF prevents the attack from the outside against the Web server, but for some WordPress or plugin functions, WAF may detect the attack which is actually not attack and block the function.
By creating the WAF exclude rule, the WAF protection function can be activated while the false detection for the specified function is prevented.', 'siteguard');
                ?>
				</div>
				<hr />
				<?php 
                echo '<input type="hidden" name="update" id="update" value="apply">';
                wp_nonce_field('siteguard-menu-waf-tuning-support-apply');
                submit_button(esc_attr__('Apply rules', 'siteguard'));
                ?>
				</form>
				<?php 
                break;
            case 'add':
            case 'edit':
                if ('add' == $action) {
                    echo '<h2>' . esc_html__('WAF Exclude Rule Add', 'siteguard') . '</h2>';
                } else {
                    echo '<h2>' . esc_html__('WAF Exclude Rule Edit', 'siteguard') . '</h2>';
                }
                ?>
				<form name="form1" method="post" action="<?php 
                echo esc_url(menu_page_url('siteguard_waf_tuning_support', false));
                ?>
">
				<table class="form-table">
				<tr>
				<th scope="row"><label for="sig"><?php 
                echo esc_html_e('Signature', 'siteguard');
                ?>
</label></th>
				<td>
				<textarea name="sig" id="sig" style="width:350px;" rows="5" ><?php 
                echo esc_html($sig);
                ?>
</textarea>
				<p class="description"><?php 
                esc_html_e('The detected signature name or signature ID is specified. To specify more than one, separate them with new line.', 'siteguard');
                ?>
</p> 
				</td>
				</tr>
				<tr>
				<th scope="row"><label for="filename"><?php 
                echo esc_html_e('Filename (optional)', 'siteguard');
                ?>
</label></th>
				<td>
				<input type="text" name="filename" id="filename" value="<?php 
                echo esc_attr($filename);
                ?>
" class="regular-text code" >
				<p class="description"><?php 
                esc_html_e('The target file name is specified. URL ( the part before ? ) can also be pasted.', 'siteguard');
                ?>
</p>
				</td>
				</tr>
				<tr>
				<th scope="row"><label for="comment"><?php 
                echo esc_html_e('Comment (optional)', 'siteguard');
                ?>
</label></th>
				<td>
				<input type="text" name="comment" id="comment" value="<?php 
                echo esc_attr($comment);
                ?>
" class="regular-text" >
				</td>
				</tr>
				</table>
	
				<hr />
				<?php 
                if ('add' == $action) {
                    echo '<input type="hidden" name="update" id="update" value="add">';
                    wp_nonce_field('siteguard-menu-waf-tuning-support-add');
                    submit_button(esc_attr__('Save', 'siteguard'));
                } else {
                    echo '<input type="hidden" name="update" id="update" value="edit">';
                    echo '<input type="hidden" name="rule" id="rule" value="' . esc_attr($id) . '">';
                    wp_nonce_field('siteguard-menu-waf-tuning-support-edit');
                    submit_button();
                }
                echo '</form>';
                break;
            case 'delete':
                echo '<h2>' . esc_html__('WAF Exclude Rule Delete', 'siteguard') . '</h2>';
                ?>
				<form name="form1" method="post" action="<?php 
                echo esc_url(menu_page_url('siteguard_waf_tuning_support', false));
                ?>
">
				<?php 
                echo '<p>' . esc_html(_n('You have specified this rule for deletion:', 'You have specified these rules for deletion:', count($ids), 'siteguard')) . '</p>';
                $go_delete = 0;
                foreach ($ids as $id) {
                    $offset = 0;
                    $rule = $waf_exclude_rule->get_rule($id, $offset);
                    echo '<input type="hidden" name="rule[]" value="' . esc_attr($id) . '" />' . esc_html__('Signature', 'siteguard') . ' : ' . esc_html__('Filename', 'siteguard') . ' : ' . esc_html__('Comment', 'siteguard') . ' [' . esc_html($rule['sig']) . ' : ' . esc_html($rule['filename']) . ' : ' . esc_html($rule['comment']) . "]<br />\n";
                    $go_delete = 1;
                }
                if (1 == $go_delete) {
                    echo '<input type="hidden" name="update" id="update" value="delete">';
                    wp_nonce_field('siteguard-menu-waf-tuning-support-delete');
                    submit_button(esc_attr__('Confirm Deletion', 'siteguard'));
                } else {
                    echo '<p>' . esc_html__('There are no rules selected for deletion.', 'siteguard') . '</p>';
                }
                echo '</form>';
                break;
        }
        ?>
		</div>
		<?php 
    }
    function render_page()
    {
        global $config;
        $opt_name_feature = 'disable_pingback_enable';
        $opt_val_feature = $config->get($opt_name_feature);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-disable-pingback-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_feature])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_feature = $_POST[$opt_name_feature];
                $config->set($opt_name_feature, $opt_val_feature);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Disable Pingback', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/pingback_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">

		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_on';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_on';
        ?>
"><?php 
        echo esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_off';
        ?>
"><?php 
        echo esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('The pingback function is disabled and its abuse is prevented.', 'siteguard');
        ?>
		</div>
		<hr />
		<?php 
        wp_nonce_field('siteguard-menu-disable-pingback-submit');
        submit_button();
        ?>
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $config, $login_history;
        $img_path = SITEGUARD_URL_PATH . 'images/';
        $admin_filter_enable = $config->get('admin_filter_enable');
        $renamelogin_enable = $config->get('renamelogin_enable');
        $captcha_enable = $config->get('captcha_enable');
        $same_error_enable = $config->get('same_login_error');
        $loginlock_enable = $config->get('loginlock_enable');
        $loginalert_enable = $config->get('loginalert_enable');
        $fail_once_enable = $config->get('loginlock_fail_once');
        $disable_pingback_enable = $config->get('disable_pingback_enable');
        $updates_notify_enable = $config->get('updates_notify_enable');
        $waf_exclude_rule_enable = $config->get('waf_exclude_rule_enable');
        echo '<div class="wrap">';
        echo '<img src="' . $img_path . 'sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Dashboard', 'siteguard') . "</h2>\n";
        echo '<div class="siteguard-description">' . esc_html__('You can find docs, FAQ and more detailed information about SiteGuard WP Plugin on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/index_en.html', 'siteguard') . '" target="_blank">' . esc_html__('SiteGuard WP Plugin Page', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        echo '<h3>' . esc_html__('Setting status', 'siteguard') . "</h3>\n";
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		<table class="siteguard-form-table">
		<tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $admin_filter_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_admin_filter"><?php 
        esc_html_e('Admin Page IP Filter', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The management directory (/wp-admin/) is protected against the connection source which does not login.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $renamelogin_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_rename_login"><?php 
        esc_html_e('Rename Login', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The login page name is changed.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $captcha_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_captcha"><?php 
        esc_html_e('CAPTCHA', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('CAPTCHA is added to the login page or comment post.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $same_error_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_same_error"><?php 
        esc_html_e('Same Login Error Message', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('Instead of the detailed error message at the login error, the single message is returned.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scope="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $loginlock_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_login_lock"><?php 
        esc_html_e('Login Lock', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The connection source which repeats login failure is being locked within a certain period.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scope="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $loginalert_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_login_alert"><?php 
        esc_html_e('Login Alert', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('E-mail notifies that there was login.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scope="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $fail_once_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_fail_once"><?php 
        esc_html_e('Fail once', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The first login must fail even if the input is correct.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $disable_pingback_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_disable_pingback"><?php 
        esc_html_e('Disable Pingback', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The abuse of pingback is prevented.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $updates_notify_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_updates_notify"><?php 
        esc_html_e('Updates Notify', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('If WordPress core, plugins, and themes updates are needed , sends email to notify administrators.', 'siteguard');
        ?>
</td>
		</tr><tr>
		<th scpoe="row">
		<img src=<?php 
        echo '"' . $img_path . ('1' == $waf_exclude_rule_enable ? 'yes.png" alt="yes"' : 'yes_glay.png" alt="no"');
        ?>
>
		<a href="?page=siteguard_waf_tuning_support"><?php 
        esc_html_e('WAF Tuning Support', 'siteguard');
        ?>
</a></th>
		<td><?php 
        esc_html_e('The exclude rule for WAF (SiteGuard Lite) is created.', 'siteguard');
        ?>
</td>
		</tr>
		</table>
		<hr />
		<form name="form1" method="post" action="">
		<?php 
        echo '<h3>' . esc_html__('Login history', 'siteguard') . "</h3>\n";
        ?>
		<?php 
        $this->wp_list_table->display();
        ?>
		<input type="hidden" name="page" value="<?php 
        echo esc_attr($_REQUEST['page']);
        ?>
">
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $admin_filter, $config;
        $opt_name_feature = 'admin_filter_enable';
        $opt_name_exclude = 'admin_filter_exclude_path';
        $opt_val_feature = $config->get($opt_name_feature);
        $opt_val_exclude = $this->cvt_camma2ret($config->get($opt_name_exclude));
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-admin-filter-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_feature] && false == $this->check_module('rewrite')) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
                $config->set($opt_name_feature, '0');
                $config->update();
                $admin_filter->feature_off();
                $opt_val_feature = '0';
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_feature])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_feature = $_POST[$opt_name_feature];
                $opt_val_exclude = $this->cvt_ret2camma(stripslashes($_POST[$opt_name_exclude]));
                $config->set($opt_name_feature, $opt_val_feature);
                $config->set($opt_name_exclude, $opt_val_exclude);
                $config->update();
                $opt_val_exclude = $this->cvt_camma2ret($opt_val_exclude);
                $mark = $admin_filter->get_mark();
                if ('0' == $opt_val_feature) {
                    $admin_filter->feature_off();
                } else {
                    $admin_filter->feature_on($_SERVER['REMOTE_ADDR']);
                }
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Admin Page IP Filter', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/admin_filter_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_on';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_on';
        ?>
" ><?php 
        echo esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li>
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_off';
        ?>
" ><?php 
        echo esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        echo '<p class="description">';
        esc_html_e('To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard');
        echo '</p>';
        ?>
		</th>
		</tr><tr>
		<th scope="row"><label for="<?php 
        echo $opt_name_exclude;
        ?>
"><?php 
        echo esc_html_e('Exclude Path', 'siteguard');
        ?>
</label></th>
		<td><textarea name="<?php 
        echo $opt_name_exclude;
        ?>
" id="<?php 
        echo $opt_name_exclude;
        ?>
" col=40 rows=5 ><?php 
        echo esc_textarea($opt_val_exclude);
        ?>
</textarea>
		<p class="description"><?php 
        esc_html_e('The path of /wp-admin/ henceforth is specified. To specify more than one, separate them with new line. ', 'siteguard');
        ?>
</p></td>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function for the protection against the attack to the management page (under /wp-admin/.) To the access from the connection source IP address which does not login to the management page, 404 (Not Found) is returned. At the login, the connection source IP address is recorded and the access to that page is allowed. The connection source IP address which does not login for more than 24 hours is sequentially deleted. The URL (under /wp-admin/) where this function is excluded can be specified.', 'siteguard');
        ?>
 
		</div>
		<hr />
		<?php 
        wp_nonce_field('siteguard-menu-admin-filter-submit');
        submit_button();
        ?>
		</form>
		</div>

		<?php 
    }
    function render_page()
    {
        global $config;
        $opt_name_enable = 'loginlock_enable';
        $opt_name_interval = 'loginlock_interval';
        $opt_name_threshold = 'loginlock_threshold';
        $opt_name_locksec = 'loginlock_locksec';
        $opt_val_enable = $config->get($opt_name_enable);
        $opt_val_interval = $config->get($opt_name_interval);
        $opt_val_threshold = $config->get($opt_name_threshold);
        $opt_val_locksec = $config->get($opt_name_locksec);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-login-lock-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && (false == $this->is_switch_value($_POST[$opt_name_enable]) || false == $this->is_interval_value($_POST[$opt_name_interval]) || false == $this->is_threshold_value($_POST[$opt_name_threshold]) || false == $this->is_locksec_value($_POST[$opt_name_locksec]))) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_enable = $_POST[$opt_name_enable];
                $opt_val_interval = $_POST[$opt_name_interval];
                $opt_val_threshold = $_POST[$opt_name_threshold];
                $opt_val_locksec = $_POST[$opt_name_locksec];
                $config->set($opt_name_enable, $opt_val_enable);
                $config->set($opt_name_interval, $opt_val_interval);
                $config->set($opt_name_threshold, $opt_val_threshold);
                $config->set($opt_name_locksec, $opt_val_locksec);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Login Lock', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_lock_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_on';
        ?>
"><?php 
        esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_off';
        ?>
"><?php 
        esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Interval', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_interval;
        ?>
" id="<?php 
        echo $opt_name_interval . '_1';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_interval ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_interval . '_1';
        ?>
"><?php 
        esc_html_e('1 second', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_interval;
        ?>
" id="<?php 
        echo $opt_name_interval . '_5';
        ?>
" value="5" <?php 
        echo '5' == $opt_val_interval ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_interval . '_5';
        ?>
"><?php 
        esc_html_e('5 seconds', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_interval;
        ?>
" id="<?php 
        echo $opt_name_interval . '_30';
        ?>
" value="30" <?php 
        echo '30' == $opt_val_interval ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_interval . '_30';
        ?>
"><?php 
        esc_html_e('30 seconds', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Threshold', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_threshold;
        ?>
" id="<?php 
        echo $opt_name_threshold . '_3';
        ?>
" value="3" <?php 
        echo '3' == $opt_val_threshold ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_threshold . '_3';
        ?>
"><?php 
        esc_html_e('3 times', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_threshold;
        ?>
" id="<?php 
        echo $opt_name_threshold . '_10';
        ?>
" value="10" <?php 
        echo '10' == $opt_val_threshold ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_threshold . '_10';
        ?>
"><?php 
        esc_html_e('10 times', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_threshold;
        ?>
" id="<?php 
        echo $opt_name_threshold . '_100';
        ?>
" value="100" <?php 
        echo '100' == $opt_val_threshold ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_threshold . '_100';
        ?>
"><?php 
        esc_html_e('100 times', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Lock Time', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_locksec;
        ?>
" id="<?php 
        echo $opt_name_locksec . '_30';
        ?>
" value="30" <?php 
        echo '30' == $opt_val_locksec ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_locksec . '_30';
        ?>
"><?php 
        esc_html_e('30 seconds', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_locksec;
        ?>
" id="<?php 
        echo $opt_name_locksec . '_60';
        ?>
" value="60" <?php 
        echo '60' == $opt_val_locksec ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_locksec . '_60';
        ?>
"><?php 
        esc_html_e('1 minute', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_locksec;
        ?>
" id="<?php 
        echo $opt_name_locksec . '_300';
        ?>
" value="300" <?php 
        echo '300' == $opt_val_locksec ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_locksec . '_300';
        ?>
"><?php 
        esc_html_e('5 minutes', 'siteguard');
        ?>
</label>
			</td>
		</tr>
		</table>
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack. Especially, it is the function to prevent an automated attack. The connection source IP address the number of login failure of which reaches the specified number within the specified period is blocked for the specified time. Each user account is not locked.', 'siteguard');
        ?>
		</div>
		<hr />
		<input type="hidden" name="update" value="Y">

		<?php 
        wp_nonce_field('siteguard-menu-login-lock-submit');
        submit_button();
        ?>

		</form>
		</div>

		<?php 
    }
    function render_page()
    {
        global $config;
        $opt_name_feature = 'loginalert_enable';
        $opt_name_subject = 'loginalert_subject';
        $opt_name_body = 'loginalert_body';
        $opt_name_admin = 'loginalert_admin_only';
        $opt_val_feature = $config->get($opt_name_feature);
        $opt_val_subject = $config->get($opt_name_subject);
        $opt_val_body = $config->get($opt_name_body);
        $opt_val_admin = $config->get($opt_name_admin);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-login-alert-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_feature])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_feature = $_POST[$opt_name_feature];
                $opt_val_subject = $_POST[$opt_name_subject];
                $opt_val_body = $_POST[$opt_name_body];
                if (isset($_POST[$opt_name_admin])) {
                    $opt_val_admin = $_POST[$opt_name_admin];
                } else {
                    $opt_val_admin = '0';
                }
                $config->set($opt_name_feature, $opt_val_feature);
                $config->set($opt_name_subject, $opt_val_subject);
                $config->set($opt_name_body, $opt_val_body);
                $config->set($opt_name_admin, $opt_val_admin);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Login Alert', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/login_alert_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_on';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_on';
        ?>
"><?php 
        echo esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_off';
        ?>
"><?php 
        echo esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr><tr>
		<th scope="row"><label for="<?php 
        echo $opt_name_subject;
        ?>
"><?php 
        esc_html_e('Subject', 'siteguard');
        ?>
</label></th>
		<td>
			<input type="text" name="<?php 
        echo $opt_name_subject;
        ?>
" id="<?php 
        echo $opt_name_subject;
        ?>
" size="50" value="<?php 
        echo esc_attr($opt_val_subject);
        ?>
" >
		</td>
		</tr><tr>
		<th scope="row"><label for="<?php 
        echo $opt_name_body;
        ?>
"><?php 
        esc_html_e('Body', 'siteguard');
        ?>
</label></th>
		<td>
			<textarea name="<?php 
        echo $opt_name_body;
        ?>
" id="<?php 
        echo $opt_name_body;
        ?>
" cols="50" rows="5" ><?php 
        echo esc_textarea($opt_val_body);
        ?>
</textarea>
		</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Recipients', 'siteguard');
        ?>
</th>
        <td>
            <input type="checkbox" name="<?php 
        echo $opt_name_admin;
        ?>
" id="<?php 
        echo $opt_name_admin;
        ?>
" value="1" <?php 
        echo '1' == $opt_val_admin ? 'checked' : '';
        ?>
 >
            <label for="<?php 
        echo $opt_name_admin;
        ?>
"><?php 
        esc_html_e('Admin only', 'siteguard');
        ?>
</label>
        </td>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to make it easier to notice unauthorized login. E-mail will be sent to a login user when logged in. If you receive an e-mail to there is no logged-in idea, please suspect unauthorized login. The subject and the mail body, the following variables can be used. (Site Name:%SITENAME%, User Name:%USERNAME%, DATE:%DATE%, Time:%TIME%, IP Address:%IPADDRESS%, User-Agent:%USERAGENT%, Referer:%REFERER%) Access by the XML-RPC will not be notified.', 'siteguard');
        ?>
 
		</div>
		<hr />
		<?php 
        wp_nonce_field('siteguard-menu-login-alert-submit');
        submit_button();
        ?>
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $rename_login, $config;
        $opt_name_feature = 'renamelogin_enable';
        $opt_name_rename_login_path = 'renamelogin_path';
        $opt_val_feature = $config->get($opt_name_feature);
        $opt_val_rename_login_path = $config->get($opt_name_rename_login_path);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-rename-login-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_feature] && false == $this->check_module('rewrite')) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
                $config->set($opt_name_feature, '0');
                $config->update();
                $rename_login->feature_off();
                $opt_val_feature = '0';
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_feature])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_feature]) {
                $incompatible_plugin = $rename_login->get_active_incompatible_plugin();
                if (null != $incompatible_plugin) {
                    echo '<div class="error settings-error"><p><strong>';
                    echo esc_html__('This function and Plugin "', 'siteguard') . $incompatible_plugin . esc_html__('" cannot be used at the same time.', 'siteguard');
                    echo '</strong></p></div>';
                    $error = true;
                    $config->set($opt_name_feature, '0');
                    $config->update();
                    $rename_login->feature_off();
                    $opt_val_feature = '0';
                    $opt_val_rename_login_path = stripslashes($_POST[$opt_name_rename_login_path]);
                }
            }
            if (false == $error && 1 != preg_match('/^[a-zA-Z0-9_-]+$/', $_POST[$opt_name_rename_login_path])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('It is only an alphanumeric character, a hyphen, and an underbar that can be used for New Login Path.', 'siteguard');
                echo '</strong></p></div>';
                $opt_val_rename_login_path = stripslashes($_POST[$opt_name_rename_login_path]);
                $error = true;
            }
            if (false == $error && 1 == preg_match('/^(wp-admin|wp-login$|login$)/', $_POST[$opt_name_rename_login_path], $matches)) {
                echo '<div class="error settings-error"><p><strong>';
                echo esc_html($matches[0]) . esc_html__(' can not be used for New Login Path.', 'siteguard');
                echo '</strong></p></div>';
                $opt_val_rename_login_path = stripslashes($_POST[$opt_name_rename_login_path]);
                $error = true;
            }
            if (false == $error) {
                $opt_val_feature = $_POST[$opt_name_feature];
                $opt_val_rename_login_path = $_POST[$opt_name_rename_login_path];
                $config->set($opt_name_feature, $opt_val_feature);
                $config->set($opt_name_rename_login_path, $opt_val_rename_login_path);
                $config->update();
                if ('0' == $opt_val_feature) {
                    $rename_login->feature_off();
                } else {
                    $rename_login->feature_on();
                    $rename_login->send_notify();
                }
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Rename Login', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/rename_login_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_on';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_on';
        ?>
"><?php 
        echo esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<input type="radio" name="<?php 
        echo $opt_name_feature;
        ?>
" id="<?php 
        echo $opt_name_feature . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_feature ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_feature . '_off';
        ?>
"><?php 
        echo esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        echo '<p class="description">';
        esc_html_e('To use this function, “mod_rewrite” should be loaded on Apache.', 'siteguard');
        echo '</p>';
        ?>
		</th>
		</tr><tr>
		<th scope="row"><label for="<?php 
        echo $opt_name_rename_login_path;
        ?>
"><?php 
        esc_html_e('New Login Path', 'siteguard');
        ?>
</label></th>
		<td>
			<?php 
        echo site_url() . '/';
        ?>
<input type="text" name="<?php 
        echo $opt_name_rename_login_path;
        ?>
" id="<?php 
        echo $opt_name_rename_login_path;
        ?>
" value="<?php 
        echo esc_attr($opt_val_rename_login_path);
        ?>
" >
			<?php 
        echo '<p class="description">';
        esc_html_e('An alphanumeric character, a hyphen, and an underbar can be used.', 'siteguard');
        echo '</p>';
        ?>
		</td>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack. The login page name (wp-login.php) is changed. The initial value is “login_&lt;5 random digits&gt;” but it can be changed to a favorite name.', 'siteguard');
        ?>
 
		</div>
		<hr />
		<?php 
        wp_nonce_field('siteguard-menu-rename-login-submit');
        submit_button();
        ?>
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $config, $captcha;
        $opt_name_enable = 'same_login_error';
        $opt_val_enable = $config->get($opt_name_enable);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-same-error-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_enable]) {
                $ret = $captcha->check_requirements();
                if (is_wp_error($ret)) {
                    echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message() . '</strong></p></div>';
                    $error = true;
                    $config->set($opt_name_enable, '0');
                    $config->update();
                }
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_enable])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_enable = $_POST[$opt_name_enable];
                $config->set($opt_name_enable, $opt_val_enable);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Same Login Error Message', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/same_error_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_on';
        ?>
"><?php 
        esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_off';
        ?>
"><?php 
        esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to decrease the vulnerability against the attack to examine if a user name exists. All error messages about the login should be equalized. The single error message is displayed even if anyone of a username, password, or CAPTCHA is wrong.', 'siteguard');
        ?>
		</div>
		<hr />

		<?php 
        wp_nonce_field('siteguard-menu-same-error-submit');
        submit_button();
        ?>
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $config, $captcha;
        $opt_name_enable = 'captcha_enable';
        $opt_name_login = '******';
        $opt_name_comment = 'captcha_comment';
        $opt_name_lostpassword = '******';
        $opt_name_registuser = '******';
        $opt_val_enable = $config->get($opt_name_enable);
        $opt_val_login = $config->get($opt_name_login);
        $opt_val_comment = $config->get($opt_name_comment);
        $opt_val_lostpassword = $config->get($opt_name_lostpassword);
        $opt_val_registuser = $config->get($opt_name_registuser);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-captcha-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && '1' == $_POST[$opt_name_enable]) {
                $ret = $captcha->check_requirements();
                if (is_wp_error($ret)) {
                    echo '<div class="error settings-error"><p><strong>' . $ret->get_error_message() . '</strong></p></div>';
                    $error = true;
                    $config->set($opt_name_enable, '0');
                    $config->update();
                }
            }
            if (false == $error && (false == $this->is_switch_value($_POST[$opt_name_enable]) || false == $this->is_captcha_switch_value($_POST[$opt_name_login]) || false == $this->is_captcha_switch_value($_POST[$opt_name_comment]) || false == $this->is_captcha_switch_value($_POST[$opt_name_lostpassword]) || false == $this->is_captcha_switch_value($_POST[$opt_name_registuser]))) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_enable = $_POST[$opt_name_enable];
                $opt_val_login = $_POST[$opt_name_login];
                $opt_val_comment = $_POST[$opt_name_comment];
                $opt_val_lostpassword = $_POST[$opt_name_lostpassword];
                $opt_val_registuser = $_POST[$opt_name_registuser];
                $config->set($opt_name_enable, $opt_val_enable);
                $config->set($opt_name_login, $opt_val_login);
                $config->set($opt_name_comment, $opt_val_comment);
                $config->set($opt_name_lostpassword, $opt_val_lostpassword);
                $config->set($opt_name_registuser, $opt_val_registuser);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('CAPTCHA', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/captcha_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_on';
        ?>
"><?php 
        esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<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' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_enable . '_off';
        ?>
"><?php 
        esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = $captcha->check_requirements();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Login page', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_login;
        ?>
" id="<?php 
        echo $opt_name_login . '_jp';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_login ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_login . '_jp';
        ?>
"><?php 
        esc_html_e('Hiragana (Japanese)', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_login;
        ?>
" id="<?php 
        echo $opt_name_login . '_en';
        ?>
" value="2" <?php 
        echo '2' == $opt_val_login ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_login . '_en';
        ?>
"><?php 
        esc_html_e('Alphanumeric', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_login;
        ?>
" id="<?php 
        echo $opt_name_login . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_login ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_login . '_off';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Comment page', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_comment;
        ?>
" id="<?php 
        echo $opt_name_comment . '_jp';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_comment ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_comment . '_jp';
        ?>
"><?php 
        esc_html_e('Hiragana (Japanese)', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_comment;
        ?>
" id="<?php 
        echo $opt_name_comment . '_en';
        ?>
" value="2" <?php 
        echo '2' == $opt_val_comment ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_comment . '_en';
        ?>
"><?php 
        esc_html_e('Alphanumeric', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_comment;
        ?>
" id="<?php 
        echo $opt_name_comment . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_comment ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_comment . '_off';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Lost password page', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_lostpassword;
        ?>
" id="<?php 
        echo $opt_name_lostpassword . '_jp';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_lostpassword ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_lostpassword . '_jp';
        ?>
"><?php 
        esc_html_e('Hiragana (Japanese)', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_lostpassword;
        ?>
" id="<?php 
        echo $opt_name_lostpassword . '_en';
        ?>
" value="2" <?php 
        echo '2' == $opt_val_lostpassword ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_lostpassword . '_en';
        ?>
"><?php 
        esc_html_e('Alphanumeric', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_lostpassword;
        ?>
" id="<?php 
        echo $opt_name_lostpassword . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_lostpassword ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_lostpassword . '_off';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
			</td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Registration user page', 'siteguard');
        ?>
</th>
			<td>
				<input type="radio" name="<?php 
        echo $opt_name_registuser;
        ?>
" id="<?php 
        echo $opt_name_registuser . '_jp';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_registuser ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_registuser . '_jp';
        ?>
"><?php 
        esc_html_e('Hiragana (Japanese)', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_registuser;
        ?>
" id="<?php 
        echo $opt_name_registuser . '_en';
        ?>
" value="2" <?php 
        echo '2' == $opt_val_registuser ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_registuser . '_en';
        ?>
"><?php 
        esc_html_e('Alphanumeric', 'siteguard');
        ?>
</label>
				<br />
				<input type="radio" name="<?php 
        echo $opt_name_registuser;
        ?>
" id="<?php 
        echo $opt_name_registuser . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_registuser ? 'checked' : '';
        ?>
 >
				<label for="<?php 
        echo $opt_name_registuser . '_off';
        ?>
"><?php 
        esc_html_e('Disable', 'siteguard');
        ?>
</label>
			</td>
		</tr>
		</table>
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to decrease the vulnerability against an illegal login attempt attack such as a brute force attack or a password list attack, or to receive less comment spam. For the character of CAPTCHA, hiragana and alphanumeric characters can be selected.', 'siteguard');
        ?>
		</div>
		<input type="hidden" name="update" value="Y">
		<hr />

		<?php 
        wp_nonce_field('siteguard-menu-captcha-submit');
        submit_button();
        ?>
		</form>
		</div>
		<?php 
    }
    function render_page()
    {
        global $config;
        $opt_name_fail_once = 'loginlock_fail_once';
        $opt_name_admin_only = 'fail_once_admin_only';
        $opt_val_fail_once = $config->get($opt_name_fail_once);
        $opt_val_admin_only = $config->get($opt_name_admin_only);
        if (isset($_POST['update']) && check_admin_referer('siteguard-menu-fail-once-submit')) {
            $error = false;
            $errors = check_multisite();
            if (is_wp_error($errors)) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e($errors->get_error_message(), 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error && false == $this->is_switch_value($_POST[$opt_name_fail_once])) {
                echo '<div class="error settings-error"><p><strong>';
                esc_html_e('ERROR: Invalid input value.', 'siteguard');
                echo '</strong></p></div>';
                $error = true;
            }
            if (false == $error) {
                $opt_val_fail_once = $_POST[$opt_name_fail_once];
                if (isset($_POST[$opt_name_admin_only])) {
                    $opt_val_admin_only = $_POST[$opt_name_admin_only];
                } else {
                    $opt_val_admin_only = '0';
                }
                $config->set($opt_name_fail_once, $opt_val_fail_once);
                $config->set($opt_name_admin_only, $opt_val_admin_only);
                $config->update();
                ?>
				<div class="updated"><p><strong><?php 
                esc_html_e('Options saved.', 'siteguard');
                ?>
</strong></p></div>
				<?php 
            }
        }
        echo '<div class="wrap">';
        echo '<img src="' . SITEGUARD_URL_PATH . 'images/sg_wp_plugin_logo_40.png" alt="SiteGuard Logo" />';
        echo '<h2>' . esc_html__('Fail once', 'siteguard') . '</h2>';
        echo '<div class="siteguard-description">' . esc_html__('You can find docs about this function on ', 'siteguard') . '<a href="' . esc_html__('http://www.jp-secure.com/cont/products/siteguard_wp_plugin/fail_once_en.html', 'siteguard') . '" target="_blank">' . esc_html__('here', 'siteguard') . '</a>' . esc_html__('.', 'siteguard') . '</div>';
        ?>
		<form name="form1" method="post" action="">
		<table class="form-table">
		<tr>
		<th scope="row" colspan="2">
			<ul class="siteguard-radios">
			<li>
			<input type="radio" name="<?php 
        echo $opt_name_fail_once;
        ?>
" id="<?php 
        echo $opt_name_fail_once . '_on';
        ?>
" value="1" <?php 
        echo '1' == $opt_val_fail_once ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_fail_once . '_on';
        ?>
"><?php 
        esc_html_e('ON', 'siteguard');
        ?>
</label>
			</li><li>
			<input type="radio" name="<?php 
        echo $opt_name_fail_once;
        ?>
" id="<?php 
        echo $opt_name_fail_once . '_off';
        ?>
" value="0" <?php 
        echo '0' == $opt_val_fail_once ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_fail_once . '_off';
        ?>
"><?php 
        esc_html_e('OFF', 'siteguard');
        ?>
</label>
			</li>
			</ul>
			<?php 
        $error = check_multisite();
        if (is_wp_error($error)) {
            echo '<p class="description">';
            echo $error->get_error_message();
            echo '</p>';
        }
        ?>
		</th>
		<td>
		</tr><tr>
		<th scope="row"><?php 
        esc_html_e('Target user', 'siteguard');
        ?>
</th>
		<td>
			<input type="checkbox" name="<?php 
        echo $opt_name_admin_only;
        ?>
" id="<?php 
        echo $opt_name_admin_only;
        ?>
" value="1" <?php 
        echo '1' == $opt_val_admin_only ? 'checked' : '';
        ?>
 >
			<label for="<?php 
        echo $opt_name_admin_only;
        ?>
"><?php 
        esc_html_e('Admin only', 'siteguard');
        ?>
</label>
		</td>
		</tr>
		</table>
		<input type="hidden" name="update" value="Y">
		<div class="siteguard-description">
		<?php 
        esc_html_e('It is the function to decrease the vulnerability against a password list attack. Even is the login input is correct, the first login must fail. After 5 seconds and later within 60 seconds, another correct login input make login succeed. At the first login failure, the following error message is displayed.', 'siteguard');
        ?>
		</div>
		<hr />

		<?php 
        wp_nonce_field('siteguard-menu-fail-once-submit');
        submit_button();
        ?>

		</form>
		</div>

		<?php 
    }
Пример #17
0
 function init()
 {
     global $config;
     $errors = $this->check_requirements();
     if (!is_wp_error($errors)) {
         $switch = '1';
     } else {
         $switch = '0';
     }
     $config->set('captcha_enable', $switch);
     $language = get_bloginfo('language');
     if ('ja' == $language) {
         $mode = '1';
         // hiragana
     } else {
         $mode = '2';
         // alphanumeric
     }
     $config->set('captcha_login', $mode);
     $config->set('captcha_comment', $mode);
     $config->set('captcha_lostpasswd', $mode);
     $config->set('captcha_registuser', $mode);
     if (true === check_multisite()) {
         $config->set('same_login_error', '1');
     } else {
         $config->set('same_login_error', '0');
     }
     $config->update();
 }