示例#1
0
 private static function add_network_brute_force_signup()
 {
     if (!in_array('network-brute-force', self::$available_modules)) {
         return;
     }
     $settings = ITSEC_Modules::get_settings('network-brute-force');
     if (!empty($settings['api_key']) && !empty($settings['api_secret'])) {
         self::enforce_activation('network-brute-force', __('Network Brute Force Protection', 'better-wp-security'));
         return;
     }
     require_once ITSEC_Core::get_core_dir() . '/lib/form.php';
     $form = new ITSEC_Form();
     $form->add_input_group('security-check');
     ob_start();
     self::open_container('incomplete', 'itsec-security-check-network-brute-force-container');
     echo '<p>' . __('With Network Brute Force Protection, your site is protected against attackers found by other sites running iThemes Security. If your site identifies a new attacker, it automatically notifies the network so that other sites are protected as well. To join this site to the network and enable the protection, click the button below.', 'better-wp-security') . '</p>';
     ob_start();
     $form->add_text('email', array('class' => 'regular-text', 'value' => get_option('admin_email')));
     $email_input = ob_get_clean();
     /* translators: 1: email text input */
     echo '<p><label for="itsec-security-check-email">' . sprintf(__('Email Address: %1$s', 'better-wp-security'), $email_input) . '</p>';
     ob_start();
     $form->add_select('updates_optin', array('true' => __('Yes', 'better-wp-security'), 'false' => __('No', 'better-wp-security')));
     $optin_input = ob_get_clean();
     /* translators: 1: opt-in input */
     echo '<p><label for="itsec-security-check-updates_optin">' . sprintf(__('Receive email updates about WordPress Security from iThemes: %1$s', 'better-wp-security'), $optin_input) . '</p>';
     ob_start();
     $form->add_button('enable_network_brute_force', array('class' => 'button-primary', 'value' => __('Activate Network Brute Force Protection', 'better-wp-security')));
     echo '<p>' . ob_get_clean() . '</p>';
     echo '<div id="itsec-security-check-network-brute-force-errors"></div>';
     echo '</div>';
     self::$calls_to_action[] = ob_get_clean();
 }
 private function get_widget_settings($id, $form = false, $echo = false)
 {
     if (!isset($this->widgets[$id])) {
         $error = new WP_Error('itsec-settings-page-get-widget-settings-invalid-id', sprintf(__('The requested widget (%s) does not exist. Settings for it cannot be rendered.', 'better-wp-security'), $id));
         if ($echo) {
             ITSEC_Lib::show_error_message($error);
         } else {
             return $error;
         }
     }
     if (false === $form) {
         $form = new ITSEC_Form();
     }
     $widget = $this->widgets[$id];
     $form->add_input_group($id);
     $form->set_defaults($widget->get_defaults());
     if (!$echo) {
         ob_start();
     }
     $widget->render($form);
     $form->remove_all_input_groups();
     if (!$echo) {
         return ob_get_clean();
     }
 }