Completed
Branch FET/remove-bot-trap-timestamp (a292ee)
by
unknown
45:46 queued 36:49
created
espresso.php 1 patch
Indentation   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -38,103 +38,103 @@
 block discarded – undo
38 38
  * @since           4.0
39 39
  */
40 40
 if (function_exists('espresso_version')) {
41
-    if (! function_exists('espresso_duplicate_plugin_error')) {
42
-        /**
43
-         *    espresso_duplicate_plugin_error
44
-         *    displays if more than one version of EE is activated at the same time
45
-         */
46
-        function espresso_duplicate_plugin_error()
47
-        {
48
-            ?>
41
+	if (! function_exists('espresso_duplicate_plugin_error')) {
42
+		/**
43
+		 *    espresso_duplicate_plugin_error
44
+		 *    displays if more than one version of EE is activated at the same time
45
+		 */
46
+		function espresso_duplicate_plugin_error()
47
+		{
48
+			?>
49 49
             <div class="error">
50 50
                 <p>
51 51
                     <?php
52
-                    echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                    ); ?>
52
+					echo esc_html__(
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+					); ?>
56 56
                 </p>
57 57
             </div>
58 58
             <?php
59
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-        }
61
-    }
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+		}
61
+	}
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
-    if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.4.0');
65
+	if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                        esc_html__(
79
-                            'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                            'event_espresso'
81
-                        ),
82
-                        EE_MIN_PHP_VER_REQUIRED,
83
-                        PHP_VERSION,
84
-                        '<br/>',
85
-                        '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+						esc_html__(
79
+							'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+							'event_espresso'
81
+						),
82
+						EE_MIN_PHP_VER_REQUIRED,
83
+						PHP_VERSION,
84
+						'<br/>',
85
+						'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
-        /**
98
-         * espresso_version
99
-         * Returns the plugin version
100
-         *
101
-         * @return string
102
-         */
103
-        function espresso_version()
104
-        {
105
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.76.rc.002');
106
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
97
+		/**
98
+		 * espresso_version
99
+		 * Returns the plugin version
100
+		 *
101
+		 * @return string
102
+		 */
103
+		function espresso_version()
104
+		{
105
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.76.rc.002');
106
+		}
107 107
 
108
-        /**
109
-         * espresso_plugin_activation
110
-         * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
-         */
112
-        function espresso_plugin_activation()
113
-        {
114
-            update_option('ee_espresso_activation', true);
115
-        }
108
+		/**
109
+		 * espresso_plugin_activation
110
+		 * adds a wp-option to indicate that EE has been activated via the WP admin plugins page
111
+		 */
112
+		function espresso_plugin_activation()
113
+		{
114
+			update_option('ee_espresso_activation', true);
115
+		}
116 116
 
117
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
117
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
118 118
 
119
-        require_once __DIR__ . '/core/bootstrap_espresso.php';
120
-        bootstrap_espresso();
121
-    }
119
+		require_once __DIR__ . '/core/bootstrap_espresso.php';
120
+		bootstrap_espresso();
121
+	}
122 122
 }
123 123
 if (! function_exists('espresso_deactivate_plugin')) {
124
-    /**
125
-     *    deactivate_plugin
126
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
-     *
128
-     * @access public
129
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
-     * @return    void
131
-     */
132
-    function espresso_deactivate_plugin($plugin_basename = '')
133
-    {
134
-        if (! function_exists('deactivate_plugins')) {
135
-            require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
-        }
137
-        unset($_GET['activate'], $_REQUEST['activate']);
138
-        deactivate_plugins($plugin_basename);
139
-    }
124
+	/**
125
+	 *    deactivate_plugin
126
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
127
+	 *
128
+	 * @access public
129
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
130
+	 * @return    void
131
+	 */
132
+	function espresso_deactivate_plugin($plugin_basename = '')
133
+	{
134
+		if (! function_exists('deactivate_plugins')) {
135
+			require_once ABSPATH . 'wp-admin/includes/plugin.php';
136
+		}
137
+		unset($_GET['activate'], $_REQUEST['activate']);
138
+		deactivate_plugins($plugin_basename);
139
+	}
140 140
 }
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 1 patch
Indentation   +275 added lines, -275 removed lines patch added patch discarded remove patch
@@ -16,304 +16,304 @@
 block discarded – undo
16 16
 class EED_Bot_Trap extends EED_Module
17 17
 {
18 18
 
19
-    /**
20
-     * @return EED_Bot_Trap|EED_Module
21
-     */
22
-    public static function instance()
23
-    {
24
-        return parent::get_instance(__CLASS__);
25
-    }
19
+	/**
20
+	 * @return EED_Bot_Trap|EED_Module
21
+	 */
22
+	public static function instance()
23
+	{
24
+		return parent::get_instance(__CLASS__);
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * set_hooks - for hooking into EE Core, other modules, etc
30
-     *
31
-     * @return void
32
-     */
33
-    public static function set_hooks()
34
-    {
35
-        if (apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
36
-            EE_Registry::instance()->CFG->registration->use_bot_trap
37
-        ) {
38
-            EED_Bot_Trap::set_trap();
39
-            // redirect bots to bogus success page
40
-            EE_Config::register_route(
41
-                'ticket_selection_received',
42
-                'EED_Bot_Trap',
43
-                'display_bot_trap_success'
44
-            );
45
-        }
46
-    }
28
+	/**
29
+	 * set_hooks - for hooking into EE Core, other modules, etc
30
+	 *
31
+	 * @return void
32
+	 */
33
+	public static function set_hooks()
34
+	{
35
+		if (apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
36
+			EE_Registry::instance()->CFG->registration->use_bot_trap
37
+		) {
38
+			EED_Bot_Trap::set_trap();
39
+			// redirect bots to bogus success page
40
+			EE_Config::register_route(
41
+				'ticket_selection_received',
42
+				'EED_Bot_Trap',
43
+				'display_bot_trap_success'
44
+			);
45
+		}
46
+	}
47 47
 
48 48
 
49
-    /**
50
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
51
-     *
52
-     * @return void
53
-     */
54
-    public static function set_trap()
55
-    {
56
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
57
-        add_action(
58
-            'AHEE__ticket_selector_chart__template__after_ticket_selector',
59
-            array('EED_Bot_Trap', 'generate_bot_trap'),
60
-            10,
61
-            2
62
-        );
63
-        add_action(
64
-            'EED_Ticket_Selector__process_ticket_selections__before',
65
-            array('EED_Bot_Trap', 'process_bot_trap'),
66
-            1,
67
-            2
68
-        );
69
-    }
49
+	/**
50
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
51
+	 *
52
+	 * @return void
53
+	 */
54
+	public static function set_trap()
55
+	{
56
+		define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
57
+		add_action(
58
+			'AHEE__ticket_selector_chart__template__after_ticket_selector',
59
+			array('EED_Bot_Trap', 'generate_bot_trap'),
60
+			10,
61
+			2
62
+		);
63
+		add_action(
64
+			'EED_Ticket_Selector__process_ticket_selections__before',
65
+			array('EED_Bot_Trap', 'process_bot_trap'),
66
+			1,
67
+			2
68
+		);
69
+	}
70 70
 
71 71
 
72
-    /**
73
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
74
-     *
75
-     * @return void
76
-     */
77
-    public static function set_hooks_admin()
78
-    {
79
-        if (defined('DOING_AJAX')
80
-            && DOING_AJAX
81
-            && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
82
-            && EE_Registry::instance()->CFG->registration->use_bot_trap
83
-        ) {
84
-            EED_Bot_Trap::set_trap();
85
-        }
86
-        add_action(
87
-            'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
88
-            array('EED_Bot_Trap', 'bot_trap_settings_form'),
89
-            5
90
-        );
91
-        add_filter(
92
-            'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
93
-            array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
94
-            10,
95
-            1
96
-        );
97
-    }
72
+	/**
73
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
74
+	 *
75
+	 * @return void
76
+	 */
77
+	public static function set_hooks_admin()
78
+	{
79
+		if (defined('DOING_AJAX')
80
+			&& DOING_AJAX
81
+			&& apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
82
+			&& EE_Registry::instance()->CFG->registration->use_bot_trap
83
+		) {
84
+			EED_Bot_Trap::set_trap();
85
+		}
86
+		add_action(
87
+			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
88
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
89
+			5
90
+		);
91
+		add_filter(
92
+			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
93
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
94
+			10,
95
+			1
96
+		);
97
+	}
98 98
 
99 99
 
100
-    /**
101
-     * run - initial module setup
102
-     *
103
-     * @param WP $WP
104
-     * @return void
105
-     */
106
-    public function run($WP)
107
-    {
108
-    }
100
+	/**
101
+	 * run - initial module setup
102
+	 *
103
+	 * @param WP $WP
104
+	 * @return void
105
+	 */
106
+	public function run($WP)
107
+	{
108
+	}
109 109
 
110 110
 
111
-    /**
112
-     * generate_bot_trap
113
-     *
114
-     * @return void
115
-     * @throws RuntimeException
116
-     */
117
-    public static function generate_bot_trap()
118
-    {
119
-        $do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
120
-        $time = microtime(true);
121
-        $html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
122
-        $html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>';
123
-        $html .= '<input type="email" id="tkt-slctr-request-processor-email-';
124
-        $html .= $time . '" name="tkt-slctr-request-processor-email" value=""/>';
125
-        $html .= '</div><!-- .tkt-slctr-request-processor-dv -->';
126
-        echo $html;
127
-    }
111
+	/**
112
+	 * generate_bot_trap
113
+	 *
114
+	 * @return void
115
+	 * @throws RuntimeException
116
+	 */
117
+	public static function generate_bot_trap()
118
+	{
119
+		$do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
120
+		$time = microtime(true);
121
+		$html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
122
+		$html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>';
123
+		$html .= '<input type="email" id="tkt-slctr-request-processor-email-';
124
+		$html .= $time . '" name="tkt-slctr-request-processor-email" value=""/>';
125
+		$html .= '</div><!-- .tkt-slctr-request-processor-dv -->';
126
+		echo $html;
127
+	}
128 128
 
129 129
 
130
-    /**
131
-     * process_bot_trap
132
-     *
133
-     * @param array|string $triggered_trap_callback Callback that will be executed for handling the
134
-     *                                              response if the bot trap is triggered.
135
-     *                                              It should receive one argument: a boolean indicating
136
-     *                                              whether the trap was triggered by suspicious timing or not.
137
-     * @throws RuntimeException
138
-     */
139
-    public static function process_bot_trap($triggered_trap_callback = array())
140
-    {
141
-        // what's your email address Mr. Bot ?
142
-        $empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
143
-                      && $_REQUEST['tkt-slctr-request-processor-email'] === '';
144
-        // are we human ?
145
-        if ($empty_trap) {
146
-            do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
147
-            return;
148
-        }
149
-        // check the given callback is valid first before executing
150
-        if (! is_callable($triggered_trap_callback)) {
151
-            // invalid callback so lets just sub in our default.
152
-            $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
153
-        }
154
-        call_user_func($triggered_trap_callback);
155
-    }
130
+	/**
131
+	 * process_bot_trap
132
+	 *
133
+	 * @param array|string $triggered_trap_callback Callback that will be executed for handling the
134
+	 *                                              response if the bot trap is triggered.
135
+	 *                                              It should receive one argument: a boolean indicating
136
+	 *                                              whether the trap was triggered by suspicious timing or not.
137
+	 * @throws RuntimeException
138
+	 */
139
+	public static function process_bot_trap($triggered_trap_callback = array())
140
+	{
141
+		// what's your email address Mr. Bot ?
142
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
143
+					  && $_REQUEST['tkt-slctr-request-processor-email'] === '';
144
+		// are we human ?
145
+		if ($empty_trap) {
146
+			do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
147
+			return;
148
+		}
149
+		// check the given callback is valid first before executing
150
+		if (! is_callable($triggered_trap_callback)) {
151
+			// invalid callback so lets just sub in our default.
152
+			$triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
153
+		}
154
+		call_user_func($triggered_trap_callback);
155
+	}
156 156
 
157 157
 
158
-    /**
159
-     * This is the default callback executed by EED_Bot_Trap::process_bot_trap that handles the response.
160
-     *
161
-     * @throws InvalidArgumentException
162
-     * @throws InvalidDataTypeException
163
-     * @throws InvalidInterfaceException
164
-     */
165
-    public static function triggered_trap_response()
166
-    {
167
-        // UH OH...
168
-        $redirect_url = apply_filters(
169
-            'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url',
170
-            add_query_arg(
171
-                array('ee' => 'ticket_selection_received'),
172
-                EE_Registry::instance()->CFG->core->reg_page_url()
173
-            )
174
-        );
175
-        // if AJAX, return the redirect URL
176
-        if (defined('DOING_AJAX') && DOING_AJAX) {
177
-            echo wp_json_encode(
178
-                array_merge(
179
-                    EE_Error::get_notices(false),
180
-                    array(
181
-                        'redirect_url' => $redirect_url,
182
-                    )
183
-                )
184
-            );
185
-            exit();
186
-        }
187
-        wp_safe_redirect($redirect_url);
188
-        exit();
189
-    }
158
+	/**
159
+	 * This is the default callback executed by EED_Bot_Trap::process_bot_trap that handles the response.
160
+	 *
161
+	 * @throws InvalidArgumentException
162
+	 * @throws InvalidDataTypeException
163
+	 * @throws InvalidInterfaceException
164
+	 */
165
+	public static function triggered_trap_response()
166
+	{
167
+		// UH OH...
168
+		$redirect_url = apply_filters(
169
+			'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url',
170
+			add_query_arg(
171
+				array('ee' => 'ticket_selection_received'),
172
+				EE_Registry::instance()->CFG->core->reg_page_url()
173
+			)
174
+		);
175
+		// if AJAX, return the redirect URL
176
+		if (defined('DOING_AJAX') && DOING_AJAX) {
177
+			echo wp_json_encode(
178
+				array_merge(
179
+					EE_Error::get_notices(false),
180
+					array(
181
+						'redirect_url' => $redirect_url,
182
+					)
183
+				)
184
+			);
185
+			exit();
186
+		}
187
+		wp_safe_redirect($redirect_url);
188
+		exit();
189
+	}
190 190
 
191 191
 
192
-    /**
193
-     * display_bot_trap_success
194
-     * shows a "success" screen to bots so that they (ie: the ppl managing them)
195
-     * think the form was submitted successfully
196
-     *
197
-     * @return void
198
-     */
199
-    public static function display_bot_trap_success()
200
-    {
201
-        add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
202
-        $bot_notice = esc_html__(
203
-            'Thank you so much. Your ticket selections have been received for consideration.',
204
-            'event_espresso'
205
-        );
206
-        $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== ''
207
-            ? sanitize_text_field(stripslashes($_REQUEST['ee-notice']))
208
-            : $bot_notice;
209
-        EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
210
-    }
192
+	/**
193
+	 * display_bot_trap_success
194
+	 * shows a "success" screen to bots so that they (ie: the ppl managing them)
195
+	 * think the form was submitted successfully
196
+	 *
197
+	 * @return void
198
+	 */
199
+	public static function display_bot_trap_success()
200
+	{
201
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
202
+		$bot_notice = esc_html__(
203
+			'Thank you so much. Your ticket selections have been received for consideration.',
204
+			'event_espresso'
205
+		);
206
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== ''
207
+			? sanitize_text_field(stripslashes($_REQUEST['ee-notice']))
208
+			: $bot_notice;
209
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
210
+	}
211 211
 
212 212
 
213 213
 
214
-    /***********************************    ADMIN    **********************************/
214
+	/***********************************    ADMIN    **********************************/
215 215
 
216 216
 
217
-    /**
218
-     * bot_trap_settings_form
219
-     *
220
-     * @return void
221
-     * @throws EE_Error
222
-     * @throws InvalidArgumentException
223
-     * @throws InvalidDataTypeException
224
-     * @throws InvalidInterfaceException
225
-     */
226
-    public static function bot_trap_settings_form()
227
-    {
228
-        EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
229
-        echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
230
-    }
217
+	/**
218
+	 * bot_trap_settings_form
219
+	 *
220
+	 * @return void
221
+	 * @throws EE_Error
222
+	 * @throws InvalidArgumentException
223
+	 * @throws InvalidDataTypeException
224
+	 * @throws InvalidInterfaceException
225
+	 */
226
+	public static function bot_trap_settings_form()
227
+	{
228
+		EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
229
+		echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
230
+	}
231 231
 
232 232
 
233
-    /**
234
-     * _bot_trap_settings_form
235
-     *
236
-     * @return EE_Form_Section_Proper
237
-     * @throws EE_Error
238
-     */
239
-    protected static function _bot_trap_settings_form()
240
-    {
241
-        return new EE_Form_Section_Proper(
242
-            array(
243
-                'name'            => 'bot_trap_settings',
244
-                'html_id'         => 'bot_trap_settings',
245
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
246
-                'subsections'     => array(
247
-                    'bot_trap_hdr' => new EE_Form_Section_HTML(
248
-                        EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))
249
-                    ),
250
-                    'use_bot_trap' => new EE_Yes_No_Input(
251
-                        array(
252
-                            'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'),
253
-                            'html_help_text'  => esc_html__(
254
-                                'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.',
255
-                                'event_espresso'
256
-                            ),
257
-                            'default'         => EE_Registry::instance()->CFG->registration->use_bot_trap !== null
258
-                                ? EE_Registry::instance()->CFG->registration->use_bot_trap
259
-                                : true,
260
-                            'required'        => false,
261
-                        )
262
-                    ),
263
-                ),
264
-            )
265
-        );
266
-    }
233
+	/**
234
+	 * _bot_trap_settings_form
235
+	 *
236
+	 * @return EE_Form_Section_Proper
237
+	 * @throws EE_Error
238
+	 */
239
+	protected static function _bot_trap_settings_form()
240
+	{
241
+		return new EE_Form_Section_Proper(
242
+			array(
243
+				'name'            => 'bot_trap_settings',
244
+				'html_id'         => 'bot_trap_settings',
245
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
246
+				'subsections'     => array(
247
+					'bot_trap_hdr' => new EE_Form_Section_HTML(
248
+						EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))
249
+					),
250
+					'use_bot_trap' => new EE_Yes_No_Input(
251
+						array(
252
+							'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'),
253
+							'html_help_text'  => esc_html__(
254
+								'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.',
255
+								'event_espresso'
256
+							),
257
+							'default'         => EE_Registry::instance()->CFG->registration->use_bot_trap !== null
258
+								? EE_Registry::instance()->CFG->registration->use_bot_trap
259
+								: true,
260
+							'required'        => false,
261
+						)
262
+					),
263
+				),
264
+			)
265
+		);
266
+	}
267 267
 
268 268
 
269
-    /**
270
-     * update_bot_trap_settings_form
271
-     *
272
-     * @param EE_Registration_Config $EE_Registration_Config
273
-     * @return EE_Registration_Config
274
-     * @throws EE_Error
275
-     * @throws InvalidArgumentException
276
-     * @throws ReflectionException
277
-     * @throws InvalidDataTypeException
278
-     * @throws InvalidInterfaceException
279
-     */
280
-    public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config)
281
-    {
282
-        try {
283
-            $bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
284
-            // if not displaying a form, then check for form submission
285
-            if ($bot_trap_settings_form->was_submitted()) {
286
-                // capture form data
287
-                $bot_trap_settings_form->receive_form_submission();
288
-                // validate form data
289
-                if ($bot_trap_settings_form->is_valid()) {
290
-                    // grab validated data from form
291
-                    $valid_data = $bot_trap_settings_form->valid_data();
292
-                    if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
293
-                        $EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
294
-                    } else {
295
-                        EE_Error::add_error(
296
-                            esc_html__(
297
-                                'Invalid or missing Bot Trap settings. Please refresh the form and try again.',
298
-                                'event_espresso'
299
-                            ),
300
-                            __FILE__,
301
-                            __FUNCTION__,
302
-                            __LINE__
303
-                        );
304
-                    }
305
-                } elseif ($bot_trap_settings_form->submission_error_message() !== '') {
306
-                    EE_Error::add_error(
307
-                        $bot_trap_settings_form->submission_error_message(),
308
-                        __FILE__,
309
-                        __FUNCTION__,
310
-                        __LINE__
311
-                    );
312
-                }
313
-            }
314
-        } catch (EE_Error $e) {
315
-            $e->get_error();
316
-        }
317
-        return $EE_Registration_Config;
318
-    }
269
+	/**
270
+	 * update_bot_trap_settings_form
271
+	 *
272
+	 * @param EE_Registration_Config $EE_Registration_Config
273
+	 * @return EE_Registration_Config
274
+	 * @throws EE_Error
275
+	 * @throws InvalidArgumentException
276
+	 * @throws ReflectionException
277
+	 * @throws InvalidDataTypeException
278
+	 * @throws InvalidInterfaceException
279
+	 */
280
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config)
281
+	{
282
+		try {
283
+			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
284
+			// if not displaying a form, then check for form submission
285
+			if ($bot_trap_settings_form->was_submitted()) {
286
+				// capture form data
287
+				$bot_trap_settings_form->receive_form_submission();
288
+				// validate form data
289
+				if ($bot_trap_settings_form->is_valid()) {
290
+					// grab validated data from form
291
+					$valid_data = $bot_trap_settings_form->valid_data();
292
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
293
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
294
+					} else {
295
+						EE_Error::add_error(
296
+							esc_html__(
297
+								'Invalid or missing Bot Trap settings. Please refresh the form and try again.',
298
+								'event_espresso'
299
+							),
300
+							__FILE__,
301
+							__FUNCTION__,
302
+							__LINE__
303
+						);
304
+					}
305
+				} elseif ($bot_trap_settings_form->submission_error_message() !== '') {
306
+					EE_Error::add_error(
307
+						$bot_trap_settings_form->submission_error_message(),
308
+						__FILE__,
309
+						__FUNCTION__,
310
+						__LINE__
311
+					);
312
+				}
313
+			}
314
+		} catch (EE_Error $e) {
315
+			$e->get_error();
316
+		}
317
+		return $EE_Registration_Config;
318
+	}
319 319
 }
Please login to merge, or discard this patch.